38884 lines
1.2 MiB
38884 lines
1.2 MiB
/*!
|
||
* Webflow: Front-end site library
|
||
* @license MIT
|
||
* Inline scripts may access the api using an async handler:
|
||
* var Webflow = Webflow || [];
|
||
* Webflow.push(readyFunction);
|
||
*/
|
||
/******/ (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 = "";
|
||
/******/
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(__webpack_require__.s = 152);
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ([
|
||
/* 0 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var getOwnPropertyDescriptor = __webpack_require__(117).f;
|
||
var hide = __webpack_require__(21);
|
||
var redefine = __webpack_require__(118);
|
||
var setGlobal = __webpack_require__(75);
|
||
var copyConstructorProperties = __webpack_require__(232);
|
||
var isForced = __webpack_require__(236);
|
||
|
||
/*
|
||
options.target - name of the target object
|
||
options.global - target is the global object
|
||
options.stat - export as static methods of target
|
||
options.proto - export as prototype methods of target
|
||
options.real - real prototype method for the `pure` version
|
||
options.forced - export even if the native feature is available
|
||
options.bind - bind methods to the target, required for the `pure` version
|
||
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
||
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
||
options.sham - add a flag to not completely full polyfills
|
||
options.enumerable - export as enumerable property
|
||
options.noTargetGet - prevent calling a getter on target
|
||
*/
|
||
module.exports = function (options, source) {
|
||
var TARGET = options.target;
|
||
var GLOBAL = options.global;
|
||
var STATIC = options.stat;
|
||
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
||
if (GLOBAL) {
|
||
target = global;
|
||
} else if (STATIC) {
|
||
target = global[TARGET] || setGlobal(TARGET, {});
|
||
} else {
|
||
target = (global[TARGET] || {}).prototype;
|
||
}
|
||
if (target) for (key in source) {
|
||
sourceProperty = source[key];
|
||
if (options.noTargetGet) {
|
||
descriptor = getOwnPropertyDescriptor(target, key);
|
||
targetProperty = descriptor && descriptor.value;
|
||
} else targetProperty = target[key];
|
||
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
||
// contained in target
|
||
if (!FORCED && targetProperty !== undefined) {
|
||
if (typeof sourceProperty === typeof targetProperty) continue;
|
||
copyConstructorProperties(sourceProperty, targetProperty);
|
||
}
|
||
// add a flag to not completely full polyfills
|
||
if (options.sham || (targetProperty && targetProperty.sham)) {
|
||
hide(sourceProperty, 'sham', true);
|
||
}
|
||
// extend global
|
||
redefine(target, key, sourceProperty, options);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 1 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _interopRequireDefault(obj) {
|
||
return obj && obj.__esModule ? obj : {
|
||
"default": obj
|
||
};
|
||
}
|
||
|
||
module.exports = _interopRequireDefault;
|
||
|
||
/***/ }),
|
||
/* 2 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks if `value` is classified as an `Array` object.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
||
* @example
|
||
*
|
||
* _.isArray([1, 2, 3]);
|
||
* // => true
|
||
*
|
||
* _.isArray(document.body.children);
|
||
* // => false
|
||
*
|
||
* _.isArray('abc');
|
||
* // => false
|
||
*
|
||
* _.isArray(_.noop);
|
||
* // => false
|
||
*/
|
||
var isArray = Array.isArray;
|
||
|
||
module.exports = isArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 3 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var toInteger = __webpack_require__(27);
|
||
|
||
var min = Math.min;
|
||
|
||
// `ToLength` abstract operation
|
||
// https://tc39.github.io/ecma262/#sec-tolength
|
||
module.exports = function (argument) {
|
||
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 4 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var requireObjectCoercible = __webpack_require__(73);
|
||
|
||
// `ToObject` abstract operation
|
||
// https://tc39.github.io/ecma262/#sec-toobject
|
||
module.exports = function (argument) {
|
||
return Object(requireObjectCoercible(argument));
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 5 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var shared = __webpack_require__(51);
|
||
var uid = __webpack_require__(115);
|
||
var NATIVE_SYMBOL = __webpack_require__(239);
|
||
|
||
var Symbol = global.Symbol;
|
||
var store = shared('wks');
|
||
|
||
module.exports = function (name) {
|
||
return store[name] || (store[name] = NATIVE_SYMBOL && Symbol[name]
|
||
|| (NATIVE_SYMBOL ? Symbol : uid)('Symbol.' + name));
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 6 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireWildcard = __webpack_require__(39);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
var _exportNames = {
|
||
IX2EngineActionTypes: true,
|
||
IX2EngineConstants: true
|
||
};
|
||
exports.IX2EngineConstants = exports.IX2EngineActionTypes = void 0;
|
||
|
||
var _triggerEvents = __webpack_require__(307);
|
||
|
||
Object.keys(_triggerEvents).forEach(function (key) {
|
||
if (key === "default" || key === "__esModule") return;
|
||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||
Object.defineProperty(exports, key, {
|
||
enumerable: true,
|
||
get: function get() {
|
||
return _triggerEvents[key];
|
||
}
|
||
});
|
||
});
|
||
|
||
var _animationActions = __webpack_require__(135);
|
||
|
||
Object.keys(_animationActions).forEach(function (key) {
|
||
if (key === "default" || key === "__esModule") return;
|
||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||
Object.defineProperty(exports, key, {
|
||
enumerable: true,
|
||
get: function get() {
|
||
return _animationActions[key];
|
||
}
|
||
});
|
||
});
|
||
|
||
var _triggerInteractions = __webpack_require__(308);
|
||
|
||
Object.keys(_triggerInteractions).forEach(function (key) {
|
||
if (key === "default" || key === "__esModule") return;
|
||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||
Object.defineProperty(exports, key, {
|
||
enumerable: true,
|
||
get: function get() {
|
||
return _triggerInteractions[key];
|
||
}
|
||
});
|
||
});
|
||
|
||
var _reducedMotion = __webpack_require__(309);
|
||
|
||
Object.keys(_reducedMotion).forEach(function (key) {
|
||
if (key === "default" || key === "__esModule") return;
|
||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||
Object.defineProperty(exports, key, {
|
||
enumerable: true,
|
||
get: function get() {
|
||
return _reducedMotion[key];
|
||
}
|
||
});
|
||
});
|
||
|
||
var IX2EngineActionTypes = _interopRequireWildcard(__webpack_require__(310));
|
||
|
||
exports.IX2EngineActionTypes = IX2EngineActionTypes;
|
||
|
||
var IX2EngineConstants = _interopRequireWildcard(__webpack_require__(311));
|
||
|
||
exports.IX2EngineConstants = IX2EngineConstants;
|
||
|
||
/***/ }),
|
||
/* 7 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(global) {var O = 'object';
|
||
var check = function (it) {
|
||
return it && it.Math == Math && it;
|
||
};
|
||
|
||
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
||
module.exports =
|
||
// eslint-disable-next-line no-undef
|
||
check(typeof globalThis == O && globalThis) ||
|
||
check(typeof window == O && window) ||
|
||
check(typeof self == O && self) ||
|
||
check(typeof global == O && global) ||
|
||
// eslint-disable-next-line no-new-func
|
||
Function('return this')();
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(44)))
|
||
|
||
/***/ }),
|
||
/* 8 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = function (exec) {
|
||
try {
|
||
return !!exec();
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 9 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals window, document, navigator, WEBFLOW_ENV_TEST */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Core site library
|
||
*/
|
||
|
||
var Webflow = {};
|
||
var modules = {};
|
||
var primary = [];
|
||
var secondary = window.Webflow || [];
|
||
var $ = window.jQuery;
|
||
var $win = $(window);
|
||
var $doc = $(document);
|
||
var isFunction = $.isFunction;
|
||
|
||
var _ = Webflow._ = __webpack_require__(154);
|
||
|
||
var tram = Webflow.tram = __webpack_require__(91) && $.tram;
|
||
var domready = false;
|
||
var destroyed = false;
|
||
tram.config.hideBackface = false;
|
||
tram.config.keepInherited = true;
|
||
/**
|
||
* Webflow.define - Define a named module
|
||
* @param {string} name
|
||
* @param {function} factory
|
||
* @param {object} options
|
||
* @return {object}
|
||
*/
|
||
|
||
Webflow.define = function (name, factory, options) {
|
||
if (modules[name]) {
|
||
unbindModule(modules[name]);
|
||
}
|
||
|
||
var instance = modules[name] = factory($, _, options) || {};
|
||
bindModule(instance);
|
||
return instance;
|
||
};
|
||
/**
|
||
* Webflow.require - Require a named module
|
||
* @param {string} name
|
||
* @return {object}
|
||
*/
|
||
|
||
|
||
Webflow.require = function (name) {
|
||
return modules[name];
|
||
};
|
||
|
||
function bindModule(module) {
|
||
// If running in Webflow app, subscribe to design/preview events
|
||
if (Webflow.env()) {
|
||
isFunction(module.design) && $win.on('__wf_design', module.design);
|
||
isFunction(module.preview) && $win.on('__wf_preview', module.preview);
|
||
} // Subscribe to front-end destroy event
|
||
|
||
|
||
isFunction(module.destroy) && $win.on('__wf_destroy', module.destroy); // Look for ready method on module
|
||
|
||
if (module.ready && isFunction(module.ready)) {
|
||
addReady(module);
|
||
}
|
||
}
|
||
|
||
function addReady(module) {
|
||
// If domready has already happened, run ready method
|
||
if (domready) {
|
||
module.ready();
|
||
return;
|
||
} // Otherwise add ready method to the primary queue (only once)
|
||
|
||
|
||
if (_.contains(primary, module.ready)) {
|
||
return;
|
||
}
|
||
|
||
primary.push(module.ready);
|
||
}
|
||
|
||
function unbindModule(module) {
|
||
// Unsubscribe module from window events
|
||
isFunction(module.design) && $win.off('__wf_design', module.design);
|
||
isFunction(module.preview) && $win.off('__wf_preview', module.preview);
|
||
isFunction(module.destroy) && $win.off('__wf_destroy', module.destroy); // Remove ready method from primary queue
|
||
|
||
if (module.ready && isFunction(module.ready)) {
|
||
removeReady(module);
|
||
}
|
||
}
|
||
|
||
function removeReady(module) {
|
||
primary = _.filter(primary, function (readyFn) {
|
||
return readyFn !== module.ready;
|
||
});
|
||
}
|
||
/**
|
||
* Webflow.push - Add a ready handler into secondary queue
|
||
* @param {function} ready Callback to invoke on domready
|
||
*/
|
||
|
||
|
||
Webflow.push = function (ready) {
|
||
// If domready has already happened, invoke handler
|
||
if (domready) {
|
||
isFunction(ready) && ready();
|
||
return;
|
||
} // Otherwise push into secondary queue
|
||
|
||
|
||
secondary.push(ready);
|
||
};
|
||
/**
|
||
* Webflow.env - Get the state of the Webflow app
|
||
* @param {string} mode [optional]
|
||
* @return {boolean}
|
||
*/
|
||
|
||
|
||
Webflow.env = function (mode) {
|
||
var designFlag = window.__wf_design;
|
||
var inApp = typeof designFlag !== 'undefined';
|
||
|
||
if (!mode) {
|
||
return inApp;
|
||
}
|
||
|
||
if (mode === 'design') {
|
||
return inApp && designFlag;
|
||
}
|
||
|
||
if (mode === 'preview') {
|
||
return inApp && !designFlag;
|
||
}
|
||
|
||
if (mode === 'slug') {
|
||
return inApp && window.__wf_slug;
|
||
}
|
||
|
||
if (mode === 'editor') {
|
||
return window.WebflowEditor;
|
||
}
|
||
|
||
if (mode === 'test') {
|
||
return false || window.__wf_test;
|
||
}
|
||
|
||
if (mode === 'frame') {
|
||
return window !== window.top;
|
||
}
|
||
}; // Feature detects + browser sniffs ಠ_ಠ
|
||
|
||
|
||
var userAgent = navigator.userAgent.toLowerCase();
|
||
var touch = Webflow.env.touch = 'ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch;
|
||
var chrome = Webflow.env.chrome = /chrome/.test(userAgent) && /Google/.test(navigator.vendor) && parseInt(userAgent.match(/chrome\/(\d+)\./)[1], 10);
|
||
var ios = Webflow.env.ios = /(ipod|iphone|ipad)/.test(userAgent);
|
||
Webflow.env.safari = /safari/.test(userAgent) && !chrome && !ios; // Maintain current touch target to prevent late clicks on touch devices
|
||
|
||
var touchTarget; // Listen for both events to support touch/mouse hybrid devices
|
||
|
||
touch && $doc.on('touchstart mousedown', function (evt) {
|
||
touchTarget = evt.target;
|
||
});
|
||
/**
|
||
* Webflow.validClick - validate click target against current touch target
|
||
* @param {HTMLElement} clickTarget Element being clicked
|
||
* @return {Boolean} True if click target is valid (always true on non-touch)
|
||
*/
|
||
|
||
Webflow.validClick = touch ? function (clickTarget) {
|
||
return clickTarget === touchTarget || $.contains(clickTarget, touchTarget);
|
||
} : function () {
|
||
return true;
|
||
};
|
||
/**
|
||
* Webflow.resize, Webflow.scroll - throttled event proxies
|
||
*/
|
||
|
||
var resizeEvents = 'resize.webflow orientationchange.webflow load.webflow';
|
||
var scrollEvents = 'scroll.webflow ' + resizeEvents;
|
||
Webflow.resize = eventProxy($win, resizeEvents);
|
||
Webflow.scroll = eventProxy($win, scrollEvents);
|
||
Webflow.redraw = eventProxy(); // Create a proxy instance for throttled events
|
||
|
||
function eventProxy(target, types) {
|
||
// Set up throttled method (using custom frame-based _.throttle)
|
||
var handlers = [];
|
||
var proxy = {};
|
||
proxy.up = _.throttle(function (evt) {
|
||
_.each(handlers, function (h) {
|
||
h(evt);
|
||
});
|
||
}); // Bind events to target
|
||
|
||
if (target && types) {
|
||
target.on(types, proxy.up);
|
||
}
|
||
/**
|
||
* Add an event handler
|
||
* @param {function} handler
|
||
*/
|
||
|
||
|
||
proxy.on = function (handler) {
|
||
if (typeof handler !== 'function') {
|
||
return;
|
||
}
|
||
|
||
if (_.contains(handlers, handler)) {
|
||
return;
|
||
}
|
||
|
||
handlers.push(handler);
|
||
};
|
||
/**
|
||
* Remove an event handler
|
||
* @param {function} handler
|
||
*/
|
||
|
||
|
||
proxy.off = function (handler) {
|
||
// If no arguments supplied, clear all handlers
|
||
if (!arguments.length) {
|
||
handlers = [];
|
||
return;
|
||
} // Otherwise, remove handler from the list
|
||
|
||
|
||
handlers = _.filter(handlers, function (h) {
|
||
return h !== handler;
|
||
});
|
||
};
|
||
|
||
return proxy;
|
||
} // Webflow.location - Wrap window.location in api
|
||
|
||
|
||
Webflow.location = function (url) {
|
||
window.location = url;
|
||
};
|
||
|
||
if (Webflow.env()) {
|
||
// Ignore redirects inside a Webflow design/edit environment
|
||
Webflow.location = function () {};
|
||
} // Webflow.ready - Call primary and secondary handlers
|
||
|
||
|
||
Webflow.ready = function () {
|
||
domready = true; // Restore modules after destroy
|
||
|
||
if (destroyed) {
|
||
restoreModules(); // Otherwise run primary ready methods
|
||
} else {
|
||
_.each(primary, callReady);
|
||
} // Run secondary ready methods
|
||
|
||
|
||
_.each(secondary, callReady); // Trigger resize
|
||
|
||
|
||
Webflow.resize.up();
|
||
};
|
||
|
||
function callReady(readyFn) {
|
||
isFunction(readyFn) && readyFn();
|
||
}
|
||
|
||
function restoreModules() {
|
||
destroyed = false;
|
||
|
||
_.each(modules, bindModule);
|
||
}
|
||
/**
|
||
* Webflow.load - Add a window load handler that will run even if load event has already happened
|
||
* @param {function} handler
|
||
*/
|
||
|
||
|
||
var deferLoad;
|
||
|
||
Webflow.load = function (handler) {
|
||
deferLoad.then(handler);
|
||
};
|
||
|
||
function bindLoad() {
|
||
// Reject any previous deferred (to support destroy)
|
||
if (deferLoad) {
|
||
deferLoad.reject();
|
||
$win.off('load', deferLoad.resolve);
|
||
} // Create deferred and bind window load event
|
||
|
||
|
||
deferLoad = new $.Deferred();
|
||
$win.on('load', deferLoad.resolve);
|
||
} // Webflow.destroy - Trigger a destroy event for all modules
|
||
|
||
|
||
Webflow.destroy = function (options) {
|
||
options = options || {};
|
||
destroyed = true;
|
||
$win.triggerHandler('__wf_destroy'); // Allow domready reset for tests
|
||
|
||
if (options.domready != null) {
|
||
domready = options.domready;
|
||
} // Unbind modules
|
||
|
||
|
||
_.each(modules, unbindModule); // Clear any proxy event handlers
|
||
|
||
|
||
Webflow.resize.off();
|
||
Webflow.scroll.off();
|
||
Webflow.redraw.off(); // Clear any queued ready methods
|
||
|
||
primary = [];
|
||
secondary = []; // If load event has not yet fired, replace the deferred
|
||
|
||
if (deferLoad.state() === 'pending') {
|
||
bindLoad();
|
||
}
|
||
}; // Listen for domready
|
||
|
||
|
||
$(Webflow.ready); // Listen for window.onload and resolve deferred
|
||
|
||
bindLoad(); // Export commonjs module
|
||
|
||
module.exports = window.Webflow = Webflow;
|
||
|
||
/***/ }),
|
||
/* 10 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var freeGlobal = __webpack_require__(96);
|
||
|
||
/** Detect free variable `self`. */
|
||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||
|
||
/** Used as a reference to the global object. */
|
||
var root = freeGlobal || freeSelf || Function('return this')();
|
||
|
||
module.exports = root;
|
||
|
||
|
||
/***/ }),
|
||
/* 11 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
var create = __webpack_require__(123);
|
||
var hide = __webpack_require__(21);
|
||
|
||
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
||
var ArrayPrototype = Array.prototype;
|
||
|
||
// Array.prototype[@@unscopables]
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
||
if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
||
hide(ArrayPrototype, UNSCOPABLES, create(null));
|
||
}
|
||
|
||
// add a key to Array.prototype[@@unscopables]
|
||
module.exports = function (key) {
|
||
ArrayPrototype[UNSCOPABLES][key] = true;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 12 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks if `value` is the
|
||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
||
* @example
|
||
*
|
||
* _.isObject({});
|
||
* // => true
|
||
*
|
||
* _.isObject([1, 2, 3]);
|
||
* // => true
|
||
*
|
||
* _.isObject(_.noop);
|
||
* // => true
|
||
*
|
||
* _.isObject(null);
|
||
* // => false
|
||
*/
|
||
function isObject(value) {
|
||
var type = typeof value;
|
||
return value != null && (type == 'object' || type == 'function');
|
||
}
|
||
|
||
module.exports = isObject;
|
||
|
||
|
||
/***/ }),
|
||
/* 13 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var fails = __webpack_require__(8);
|
||
|
||
module.exports = function (METHOD_NAME, argument) {
|
||
var method = [][METHOD_NAME];
|
||
return !method || !fails(function () {
|
||
// eslint-disable-next-line no-useless-call,no-throw-literal
|
||
method.call(null, argument || function () { throw 1; }, 1);
|
||
});
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 14 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var fails = __webpack_require__(8);
|
||
|
||
// Thank's IE8 for his funny defineProperty
|
||
module.exports = !fails(function () {
|
||
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 15 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
var IE8_DOM_DEFINE = __webpack_require__(113);
|
||
var anObject = __webpack_require__(28);
|
||
var toPrimitive = __webpack_require__(76);
|
||
|
||
var nativeDefineProperty = Object.defineProperty;
|
||
|
||
// `Object.defineProperty` method
|
||
// https://tc39.github.io/ecma262/#sec-object.defineproperty
|
||
exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
||
anObject(O);
|
||
P = toPrimitive(P, true);
|
||
anObject(Attributes);
|
||
if (IE8_DOM_DEFINE) try {
|
||
return nativeDefineProperty(O, P, Attributes);
|
||
} catch (error) { /* empty */ }
|
||
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
||
if ('value' in Attributes) O[P] = Attributes.value;
|
||
return O;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 16 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = function (it) {
|
||
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 17 */
|
||
/***/ (function(module, exports) {
|
||
|
||
var hasOwnProperty = {}.hasOwnProperty;
|
||
|
||
module.exports = function (it, key) {
|
||
return hasOwnProperty.call(it, key);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 18 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseMatches = __webpack_require__(158),
|
||
baseMatchesProperty = __webpack_require__(212),
|
||
identity = __webpack_require__(71),
|
||
isArray = __webpack_require__(2),
|
||
property = __webpack_require__(221);
|
||
|
||
/**
|
||
* The base implementation of `_.iteratee`.
|
||
*
|
||
* @private
|
||
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
||
* @returns {Function} Returns the iteratee.
|
||
*/
|
||
function baseIteratee(value) {
|
||
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
||
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
||
if (typeof value == 'function') {
|
||
return value;
|
||
}
|
||
if (value == null) {
|
||
return identity;
|
||
}
|
||
if (typeof value == 'object') {
|
||
return isArray(value)
|
||
? baseMatchesProperty(value[0], value[1])
|
||
: baseMatches(value);
|
||
}
|
||
return property(value);
|
||
}
|
||
|
||
module.exports = baseIteratee;
|
||
|
||
|
||
/***/ }),
|
||
/* 19 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIsNative = __webpack_require__(170),
|
||
getValue = __webpack_require__(175);
|
||
|
||
/**
|
||
* Gets the native function at `key` of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @param {string} key The key of the method to get.
|
||
* @returns {*} Returns the function if it's native, else `undefined`.
|
||
*/
|
||
function getNative(object, key) {
|
||
var value = getValue(object, key);
|
||
return baseIsNative(value) ? value : undefined;
|
||
}
|
||
|
||
module.exports = getNative;
|
||
|
||
|
||
/***/ }),
|
||
/* 20 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||
* and has a `typeof` result of "object".
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||
* @example
|
||
*
|
||
* _.isObjectLike({});
|
||
* // => true
|
||
*
|
||
* _.isObjectLike([1, 2, 3]);
|
||
* // => true
|
||
*
|
||
* _.isObjectLike(_.noop);
|
||
* // => false
|
||
*
|
||
* _.isObjectLike(null);
|
||
* // => false
|
||
*/
|
||
function isObjectLike(value) {
|
||
return value != null && typeof value == 'object';
|
||
}
|
||
|
||
module.exports = isObjectLike;
|
||
|
||
|
||
/***/ }),
|
||
/* 21 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
var definePropertyModule = __webpack_require__(15);
|
||
var createPropertyDescriptor = __webpack_require__(52);
|
||
|
||
module.exports = DESCRIPTORS ? function (object, key, value) {
|
||
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
||
} : function (object, key, value) {
|
||
object[key] = value;
|
||
return object;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 22 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
// toObject with fallback for non-array-like ES3 strings
|
||
var IndexedObject = __webpack_require__(53);
|
||
var requireObjectCoercible = __webpack_require__(73);
|
||
|
||
module.exports = function (it) {
|
||
return IndexedObject(requireObjectCoercible(it));
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 23 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var bind = __webpack_require__(54);
|
||
var IndexedObject = __webpack_require__(53);
|
||
var toObject = __webpack_require__(4);
|
||
var toLength = __webpack_require__(3);
|
||
var arraySpeciesCreate = __webpack_require__(37);
|
||
|
||
var push = [].push;
|
||
|
||
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
|
||
var createMethod = function (TYPE) {
|
||
var IS_MAP = TYPE == 1;
|
||
var IS_FILTER = TYPE == 2;
|
||
var IS_SOME = TYPE == 3;
|
||
var IS_EVERY = TYPE == 4;
|
||
var IS_FIND_INDEX = TYPE == 6;
|
||
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
||
return function ($this, callbackfn, that, specificCreate) {
|
||
var O = toObject($this);
|
||
var self = IndexedObject(O);
|
||
var boundFunction = bind(callbackfn, that, 3);
|
||
var length = toLength(self.length);
|
||
var index = 0;
|
||
var create = specificCreate || arraySpeciesCreate;
|
||
var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
|
||
var value, result;
|
||
for (;length > index; index++) if (NO_HOLES || index in self) {
|
||
value = self[index];
|
||
result = boundFunction(value, index, O);
|
||
if (TYPE) {
|
||
if (IS_MAP) target[index] = result; // map
|
||
else if (result) switch (TYPE) {
|
||
case 3: return true; // some
|
||
case 5: return value; // find
|
||
case 6: return index; // findIndex
|
||
case 2: push.call(target, value); // filter
|
||
} else if (IS_EVERY) return false; // every
|
||
}
|
||
}
|
||
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
||
};
|
||
};
|
||
|
||
module.exports = {
|
||
// `Array.prototype.forEach` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
|
||
forEach: createMethod(0),
|
||
// `Array.prototype.map` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.map
|
||
map: createMethod(1),
|
||
// `Array.prototype.filter` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
|
||
filter: createMethod(2),
|
||
// `Array.prototype.some` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.some
|
||
some: createMethod(3),
|
||
// `Array.prototype.every` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.every
|
||
every: createMethod(4),
|
||
// `Array.prototype.find` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.find
|
||
find: createMethod(5),
|
||
// `Array.prototype.findIndex` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
|
||
findIndex: createMethod(6)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 24 */
|
||
/***/ (function(module, exports) {
|
||
|
||
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;
|
||
}
|
||
|
||
module.exports = _defineProperty;
|
||
|
||
/***/ }),
|
||
/* 25 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Symbol = __webpack_require__(32),
|
||
getRawTag = __webpack_require__(171),
|
||
objectToString = __webpack_require__(172);
|
||
|
||
/** `Object#toString` result references. */
|
||
var nullTag = '[object Null]',
|
||
undefinedTag = '[object Undefined]';
|
||
|
||
/** Built-in value references. */
|
||
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
||
|
||
/**
|
||
* The base implementation of `getTag` without fallbacks for buggy environments.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to query.
|
||
* @returns {string} Returns the `toStringTag`.
|
||
*/
|
||
function baseGetTag(value) {
|
||
if (value == null) {
|
||
return value === undefined ? undefinedTag : nullTag;
|
||
}
|
||
return (symToStringTag && symToStringTag in Object(value))
|
||
? getRawTag(value)
|
||
: objectToString(value);
|
||
}
|
||
|
||
module.exports = baseGetTag;
|
||
|
||
|
||
/***/ }),
|
||
/* 26 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isFunction = __webpack_require__(95),
|
||
isLength = __webpack_require__(64);
|
||
|
||
/**
|
||
* Checks if `value` is array-like. A value is considered array-like if it's
|
||
* not a function and has a `value.length` that's an integer greater than or
|
||
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
||
* @example
|
||
*
|
||
* _.isArrayLike([1, 2, 3]);
|
||
* // => true
|
||
*
|
||
* _.isArrayLike(document.body.children);
|
||
* // => true
|
||
*
|
||
* _.isArrayLike('abc');
|
||
* // => true
|
||
*
|
||
* _.isArrayLike(_.noop);
|
||
* // => false
|
||
*/
|
||
function isArrayLike(value) {
|
||
return value != null && isLength(value.length) && !isFunction(value);
|
||
}
|
||
|
||
module.exports = isArrayLike;
|
||
|
||
|
||
/***/ }),
|
||
/* 27 */
|
||
/***/ (function(module, exports) {
|
||
|
||
var ceil = Math.ceil;
|
||
var floor = Math.floor;
|
||
|
||
// `ToInteger` abstract operation
|
||
// https://tc39.github.io/ecma262/#sec-tointeger
|
||
module.exports = function (argument) {
|
||
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 28 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(16);
|
||
|
||
module.exports = function (it) {
|
||
if (!isObject(it)) {
|
||
throw TypeError(String(it) + ' is not an object');
|
||
} return it;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 29 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var classof = __webpack_require__(80);
|
||
|
||
// `IsArray` abstract operation
|
||
// https://tc39.github.io/ecma262/#sec-isarray
|
||
module.exports = Array.isArray || function isArray(arg) {
|
||
return classof(arg) == 'Array';
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 30 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireWildcard = __webpack_require__(39);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.IX2VanillaUtils = exports.IX2VanillaPlugins = exports.IX2ElementsReducer = exports.IX2EasingUtils = exports.IX2Easings = exports.IX2BrowserSupport = void 0;
|
||
|
||
var IX2BrowserSupport = _interopRequireWildcard(__webpack_require__(86));
|
||
|
||
exports.IX2BrowserSupport = IX2BrowserSupport;
|
||
|
||
var IX2Easings = _interopRequireWildcard(__webpack_require__(138));
|
||
|
||
exports.IX2Easings = IX2Easings;
|
||
|
||
var IX2EasingUtils = _interopRequireWildcard(__webpack_require__(140));
|
||
|
||
exports.IX2EasingUtils = IX2EasingUtils;
|
||
|
||
var IX2ElementsReducer = _interopRequireWildcard(__webpack_require__(317));
|
||
|
||
exports.IX2ElementsReducer = IX2ElementsReducer;
|
||
|
||
var IX2VanillaPlugins = _interopRequireWildcard(__webpack_require__(142));
|
||
|
||
exports.IX2VanillaPlugins = IX2VanillaPlugins;
|
||
|
||
var IX2VanillaUtils = _interopRequireWildcard(__webpack_require__(319));
|
||
|
||
exports.IX2VanillaUtils = IX2VanillaUtils;
|
||
|
||
/***/ }),
|
||
/* 31 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _extends() {
|
||
module.exports = _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);
|
||
}
|
||
|
||
module.exports = _extends;
|
||
|
||
/***/ }),
|
||
/* 32 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var root = __webpack_require__(10);
|
||
|
||
/** Built-in value references. */
|
||
var Symbol = root.Symbol;
|
||
|
||
module.exports = Symbol;
|
||
|
||
|
||
/***/ }),
|
||
/* 33 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isSymbol = __webpack_require__(50);
|
||
|
||
/** Used as references for various `Number` constants. */
|
||
var INFINITY = 1 / 0;
|
||
|
||
/**
|
||
* Converts `value` to a string key if it's not a string or symbol.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to inspect.
|
||
* @returns {string|symbol} Returns the key.
|
||
*/
|
||
function toKey(value) {
|
||
if (typeof value == 'string' || isSymbol(value)) {
|
||
return value;
|
||
}
|
||
var result = (value + '');
|
||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
||
}
|
||
|
||
module.exports = toKey;
|
||
|
||
|
||
/***/ }),
|
||
/* 34 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var toInteger = __webpack_require__(27);
|
||
|
||
var max = Math.max;
|
||
var min = Math.min;
|
||
|
||
// Helper for a popular repeating case of the spec:
|
||
// Let integer be ? ToInteger(index).
|
||
// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
|
||
module.exports = function (index, length) {
|
||
var integer = toInteger(index);
|
||
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 35 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = {};
|
||
|
||
|
||
/***/ }),
|
||
/* 36 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var toPrimitive = __webpack_require__(76);
|
||
var definePropertyModule = __webpack_require__(15);
|
||
var createPropertyDescriptor = __webpack_require__(52);
|
||
|
||
module.exports = function (object, key, value) {
|
||
var propertyKey = toPrimitive(key);
|
||
if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
|
||
else object[propertyKey] = value;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 37 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(16);
|
||
var isArray = __webpack_require__(29);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var SPECIES = wellKnownSymbol('species');
|
||
|
||
// `ArraySpeciesCreate` abstract operation
|
||
// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
|
||
module.exports = function (originalArray, length) {
|
||
var C;
|
||
if (isArray(originalArray)) {
|
||
C = originalArray.constructor;
|
||
// cross-realm fallback
|
||
if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
|
||
else if (isObject(C)) {
|
||
C = C[SPECIES];
|
||
if (C === null) C = undefined;
|
||
}
|
||
} return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 38 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var fails = __webpack_require__(8);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var SPECIES = wellKnownSymbol('species');
|
||
|
||
module.exports = function (METHOD_NAME) {
|
||
return !fails(function () {
|
||
var array = [];
|
||
var constructor = array.constructor = {};
|
||
constructor[SPECIES] = function () {
|
||
return { foo: 1 };
|
||
};
|
||
return array[METHOD_NAME](Boolean).foo !== 1;
|
||
});
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 39 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _interopRequireWildcard(obj) {
|
||
if (obj && obj.__esModule) {
|
||
return obj;
|
||
} else {
|
||
var newObj = {};
|
||
|
||
if (obj != null) {
|
||
for (var key in obj) {
|
||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
||
|
||
if (desc.get || desc.set) {
|
||
Object.defineProperty(newObj, key, desc);
|
||
} else {
|
||
newObj[key] = obj[key];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
newObj["default"] = obj;
|
||
return newObj;
|
||
}
|
||
}
|
||
|
||
module.exports = _interopRequireWildcard;
|
||
|
||
/***/ }),
|
||
/* 40 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||
|
||
exports.clone = clone;
|
||
exports.addLast = addLast;
|
||
exports.addFirst = addFirst;
|
||
exports.removeLast = removeLast;
|
||
exports.removeFirst = removeFirst;
|
||
exports.insert = insert;
|
||
exports.removeAt = removeAt;
|
||
exports.replaceAt = replaceAt;
|
||
exports.getIn = getIn;
|
||
exports.set = set;
|
||
exports.setIn = setIn;
|
||
exports.update = update;
|
||
exports.updateIn = updateIn;
|
||
exports.merge = merge;
|
||
exports.mergeDeep = mergeDeep;
|
||
exports.mergeIn = mergeIn;
|
||
exports.omit = omit;
|
||
exports.addDefaults = addDefaults;
|
||
|
||
|
||
/*!
|
||
* Timm
|
||
*
|
||
* Immutability helpers with fast reads and acceptable writes.
|
||
*
|
||
* @copyright Guillermo Grau Panea 2016
|
||
* @license MIT
|
||
*/
|
||
|
||
var INVALID_ARGS = 'INVALID_ARGS';
|
||
|
||
// ===============================================
|
||
// ### Helpers
|
||
// ===============================================
|
||
|
||
|
||
function throwStr(msg) {
|
||
throw new Error(msg);
|
||
}
|
||
|
||
function getKeysAndSymbols(obj) {
|
||
var keys = Object.keys(obj);
|
||
if (Object.getOwnPropertySymbols) {
|
||
return keys.concat(Object.getOwnPropertySymbols(obj));
|
||
}
|
||
return keys;
|
||
}
|
||
|
||
var hasOwnProperty = {}.hasOwnProperty;
|
||
|
||
function clone(obj) {
|
||
if (Array.isArray(obj)) return obj.slice();
|
||
var keys = getKeysAndSymbols(obj);
|
||
var out = {};
|
||
for (var i = 0; i < keys.length; i++) {
|
||
var key = keys[i];
|
||
out[key] = obj[key];
|
||
}
|
||
return out;
|
||
}
|
||
|
||
function doMerge(fAddDefaults, fDeep, first) {
|
||
var out = first;
|
||
!(out != null) && throwStr( false ? undefined : INVALID_ARGS);
|
||
var fChanged = false;
|
||
|
||
for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
||
rest[_key - 3] = arguments[_key];
|
||
}
|
||
|
||
for (var idx = 0; idx < rest.length; idx++) {
|
||
var obj = rest[idx];
|
||
if (obj == null) continue;
|
||
var keys = getKeysAndSymbols(obj);
|
||
if (!keys.length) continue;
|
||
for (var j = 0; j <= keys.length; j++) {
|
||
var key = keys[j];
|
||
if (fAddDefaults && out[key] !== undefined) continue;
|
||
var nextVal = obj[key];
|
||
if (fDeep && isObject(out[key]) && isObject(nextVal)) {
|
||
nextVal = doMerge(fAddDefaults, fDeep, out[key], nextVal);
|
||
}
|
||
if (nextVal === undefined || nextVal === out[key]) continue;
|
||
if (!fChanged) {
|
||
fChanged = true;
|
||
out = clone(out);
|
||
}
|
||
out[key] = nextVal;
|
||
}
|
||
}
|
||
return out;
|
||
}
|
||
|
||
function isObject(o) {
|
||
var type = typeof o === 'undefined' ? 'undefined' : _typeof(o);
|
||
return o != null && (type === 'object' || type === 'function');
|
||
}
|
||
|
||
// _deepFreeze = (obj) ->
|
||
// Object.freeze obj
|
||
// for key in Object.getOwnPropertyNames obj
|
||
// val = obj[key]
|
||
// if isObject(val) and not Object.isFrozen val
|
||
// _deepFreeze val
|
||
// obj
|
||
|
||
// ===============================================
|
||
// -- ### Arrays
|
||
// ===============================================
|
||
|
||
// -- #### addLast()
|
||
// -- Returns a new array with an appended item or items.
|
||
// --
|
||
// -- Usage: `addLast<T>(array: Array<T>, val: Array<T>|T): Array<T>`
|
||
// --
|
||
// -- ```js
|
||
// -- arr = ['a', 'b']
|
||
// -- arr2 = addLast(arr, 'c')
|
||
// -- // ['a', 'b', 'c']
|
||
// -- arr2 === arr
|
||
// -- // false
|
||
// -- arr3 = addLast(arr, ['c', 'd'])
|
||
// -- // ['a', 'b', 'c', 'd']
|
||
// -- ```
|
||
// `array.concat(val)` also handles the scalar case,
|
||
// but is apparently very slow
|
||
function addLast(array, val) {
|
||
if (Array.isArray(val)) return array.concat(val);
|
||
return array.concat([val]);
|
||
}
|
||
|
||
// -- #### addFirst()
|
||
// -- Returns a new array with a prepended item or items.
|
||
// --
|
||
// -- Usage: `addFirst<T>(array: Array<T>, val: Array<T>|T): Array<T>`
|
||
// --
|
||
// -- ```js
|
||
// -- arr = ['a', 'b']
|
||
// -- arr2 = addFirst(arr, 'c')
|
||
// -- // ['c', 'a', 'b']
|
||
// -- arr2 === arr
|
||
// -- // false
|
||
// -- arr3 = addFirst(arr, ['c', 'd'])
|
||
// -- // ['c', 'd', 'a', 'b']
|
||
// -- ```
|
||
function addFirst(array, val) {
|
||
if (Array.isArray(val)) return val.concat(array);
|
||
return [val].concat(array);
|
||
}
|
||
|
||
// -- #### removeLast()
|
||
// -- Returns a new array removing the last item.
|
||
// --
|
||
// -- Usage: `removeLast<T>(array: Array<T>): Array<T>`
|
||
// --
|
||
// -- ```js
|
||
// -- arr = ['a', 'b']
|
||
// -- arr2 = removeLast(arr)
|
||
// -- // ['a']
|
||
// -- arr2 === arr
|
||
// -- // false
|
||
// --
|
||
// -- // The same array is returned if there are no changes:
|
||
// -- arr3 = []
|
||
// -- removeLast(arr3) === arr3
|
||
// -- // true
|
||
// -- ```
|
||
function removeLast(array) {
|
||
if (!array.length) return array;
|
||
return array.slice(0, array.length - 1);
|
||
}
|
||
|
||
// -- #### removeFirst()
|
||
// -- Returns a new array removing the first item.
|
||
// --
|
||
// -- Usage: `removeFirst<T>(array: Array<T>): Array<T>`
|
||
// --
|
||
// -- ```js
|
||
// -- arr = ['a', 'b']
|
||
// -- arr2 = removeFirst(arr)
|
||
// -- // ['b']
|
||
// -- arr2 === arr
|
||
// -- // false
|
||
// --
|
||
// -- // The same array is returned if there are no changes:
|
||
// -- arr3 = []
|
||
// -- removeFirst(arr3) === arr3
|
||
// -- // true
|
||
// -- ```
|
||
function removeFirst(array) {
|
||
if (!array.length) return array;
|
||
return array.slice(1);
|
||
}
|
||
|
||
// -- #### insert()
|
||
// -- Returns a new array obtained by inserting an item or items
|
||
// -- at a specified index.
|
||
// --
|
||
// -- Usage: `insert<T>(array: Array<T>, idx: number, val: Array<T>|T): Array<T>`
|
||
// --
|
||
// -- ```js
|
||
// -- arr = ['a', 'b', 'c']
|
||
// -- arr2 = insert(arr, 1, 'd')
|
||
// -- // ['a', 'd', 'b', 'c']
|
||
// -- arr2 === arr
|
||
// -- // false
|
||
// -- insert(arr, 1, ['d', 'e'])
|
||
// -- // ['a', 'd', 'e', 'b', 'c']
|
||
// -- ```
|
||
function insert(array, idx, val) {
|
||
return array.slice(0, idx).concat(Array.isArray(val) ? val : [val]).concat(array.slice(idx));
|
||
}
|
||
|
||
// -- #### removeAt()
|
||
// -- Returns a new array obtained by removing an item at
|
||
// -- a specified index.
|
||
// --
|
||
// -- Usage: `removeAt<T>(array: Array<T>, idx: number): Array<T>`
|
||
// --
|
||
// -- ```js
|
||
// -- arr = ['a', 'b', 'c']
|
||
// -- arr2 = removeAt(arr, 1)
|
||
// -- // ['a', 'c']
|
||
// -- arr2 === arr
|
||
// -- // false
|
||
// --
|
||
// -- // The same array is returned if there are no changes:
|
||
// -- removeAt(arr, 4) === arr
|
||
// -- // true
|
||
// -- ```
|
||
function removeAt(array, idx) {
|
||
if (idx >= array.length || idx < 0) return array;
|
||
return array.slice(0, idx).concat(array.slice(idx + 1));
|
||
}
|
||
|
||
// -- #### replaceAt()
|
||
// -- Returns a new array obtained by replacing an item at
|
||
// -- a specified index. If the provided item is the same as
|
||
// -- (*referentially equal to*) the previous item at that position,
|
||
// -- the original array is returned.
|
||
// --
|
||
// -- Usage: `replaceAt<T>(array: Array<T>, idx: number, newItem: T): Array<T>`
|
||
// --
|
||
// -- ```js
|
||
// -- arr = ['a', 'b', 'c']
|
||
// -- arr2 = replaceAt(arr, 1, 'd')
|
||
// -- // ['a', 'd', 'c']
|
||
// -- arr2 === arr
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- replaceAt(arr, 1, 'b') === arr
|
||
// -- // true
|
||
// -- ```
|
||
function replaceAt(array, idx, newItem) {
|
||
if (array[idx] === newItem) return array;
|
||
var len = array.length;
|
||
var result = Array(len);
|
||
for (var i = 0; i < len; i++) {
|
||
result[i] = array[i];
|
||
}
|
||
result[idx] = newItem;
|
||
return result;
|
||
}
|
||
|
||
// ===============================================
|
||
// -- ### Collections (objects and arrays)
|
||
// ===============================================
|
||
// -- The following types are used throughout this section
|
||
// -- ```js
|
||
// -- type ArrayOrObject = Array<any>|Object;
|
||
// -- type Key = number|string;
|
||
// -- ```
|
||
|
||
// -- #### getIn()
|
||
// -- Returns a value from an object at a given path. Works with
|
||
// -- nested arrays and objects. If the path does not exist, it returns
|
||
// -- `undefined`.
|
||
// --
|
||
// -- Usage: `getIn(obj: ?ArrayOrObject, path: Array<Key>): any`
|
||
// --
|
||
// -- ```js
|
||
// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: ['a', 'b', 'c'] }
|
||
// -- getIn(obj, ['d', 'd1'])
|
||
// -- // 3
|
||
// -- getIn(obj, ['e', 1])
|
||
// -- // 'b'
|
||
// -- ```
|
||
function getIn(obj, path) {
|
||
!Array.isArray(path) && throwStr( false ? undefined : INVALID_ARGS);
|
||
if (obj == null) return undefined;
|
||
var ptr = obj;
|
||
for (var i = 0; i < path.length; i++) {
|
||
var key = path[i];
|
||
ptr = ptr != null ? ptr[key] : undefined;
|
||
if (ptr === undefined) return ptr;
|
||
}
|
||
return ptr;
|
||
}
|
||
|
||
// -- #### set()
|
||
// -- Returns a new object with a modified attribute.
|
||
// -- If the provided value is the same as (*referentially equal to*)
|
||
// -- the previous value, the original object is returned.
|
||
// --
|
||
// -- Usage: `set<T>(obj: ?T, key: Key, val: any): T`
|
||
// --
|
||
// -- ```js
|
||
// -- obj = { a: 1, b: 2, c: 3 }
|
||
// -- obj2 = set(obj, 'b', 5)
|
||
// -- // { a: 1, b: 5, c: 3 }
|
||
// -- obj2 === obj
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- set(obj, 'b', 2) === obj
|
||
// -- // true
|
||
// -- ```
|
||
function set(obj, key, val) {
|
||
var fallback = typeof key === 'number' ? [] : {};
|
||
var finalObj = obj == null ? fallback : obj;
|
||
if (finalObj[key] === val) return finalObj;
|
||
var obj2 = clone(finalObj);
|
||
obj2[key] = val;
|
||
return obj2;
|
||
}
|
||
|
||
// -- #### setIn()
|
||
// -- Returns a new object with a modified **nested** attribute.
|
||
// --
|
||
// -- Notes:
|
||
// --
|
||
// -- * If the provided value is the same as (*referentially equal to*)
|
||
// -- the previous value, the original object is returned.
|
||
// -- * If the path does not exist, it will be created before setting
|
||
// -- the new value.
|
||
// --
|
||
// -- Usage: `setIn<T: ArrayOrObject>(obj: T, path: Array<Key>, val: any): T`
|
||
// --
|
||
// -- ```js
|
||
// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } }
|
||
// -- obj2 = setIn(obj, ['d', 'd1'], 4)
|
||
// -- // { a: 1, b: 2, d: { d1: 4, d2: 4 }, e: { e1: 'foo', e2: 'bar' } }
|
||
// -- obj2 === obj
|
||
// -- // false
|
||
// -- obj2.d === obj.d
|
||
// -- // false
|
||
// -- obj2.e === obj.e
|
||
// -- // true
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- obj3 = setIn(obj, ['d', 'd1'], 3)
|
||
// -- // { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } }
|
||
// -- obj3 === obj
|
||
// -- // true
|
||
// -- obj3.d === obj.d
|
||
// -- // true
|
||
// -- obj3.e === obj.e
|
||
// -- // true
|
||
// --
|
||
// -- // ... unknown paths create intermediate keys. Numeric segments are treated as array indices:
|
||
// -- setIn({ a: 3 }, ['unknown', 0, 'path'], 4)
|
||
// -- // { a: 3, unknown: [{ path: 4 }] }
|
||
// -- ```
|
||
function doSetIn(obj, path, val, idx) {
|
||
var newValue = void 0;
|
||
var key = path[idx];
|
||
if (idx === path.length - 1) {
|
||
newValue = val;
|
||
} else {
|
||
var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === 'number' ? [] : {};
|
||
newValue = doSetIn(nestedObj, path, val, idx + 1);
|
||
}
|
||
return set(obj, key, newValue);
|
||
}
|
||
|
||
function setIn(obj, path, val) {
|
||
if (!path.length) return val;
|
||
return doSetIn(obj, path, val, 0);
|
||
}
|
||
|
||
// -- #### update()
|
||
// -- Returns a new object with a modified attribute,
|
||
// -- calculated via a user-provided callback based on the current value.
|
||
// -- If the calculated value is the same as (*referentially equal to*)
|
||
// -- the previous value, the original object is returned.
|
||
// --
|
||
// -- Usage: `update<T: ArrayOrObject>(obj: T, key: Key,
|
||
// -- fnUpdate: (prevValue: any) => any): T`
|
||
// --
|
||
// -- ```js
|
||
// -- obj = { a: 1, b: 2, c: 3 }
|
||
// -- obj2 = update(obj, 'b', (val) => val + 1)
|
||
// -- // { a: 1, b: 3, c: 3 }
|
||
// -- obj2 === obj
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- update(obj, 'b', (val) => val) === obj
|
||
// -- // true
|
||
// -- ```
|
||
function update(obj, key, fnUpdate) {
|
||
var prevVal = obj == null ? undefined : obj[key];
|
||
var nextVal = fnUpdate(prevVal);
|
||
return set(obj, key, nextVal);
|
||
}
|
||
|
||
// -- #### updateIn()
|
||
// -- Returns a new object with a modified **nested** attribute,
|
||
// -- calculated via a user-provided callback based on the current value.
|
||
// -- If the calculated value is the same as (*referentially equal to*)
|
||
// -- the previous value, the original object is returned.
|
||
// --
|
||
// -- Usage: `updateIn<T: ArrayOrObject>(obj: T, path: Array<Key>,
|
||
// -- fnUpdate: (prevValue: any) => any): T`
|
||
// --
|
||
// -- ```js
|
||
// -- obj = { a: 1, d: { d1: 3, d2: 4 } }
|
||
// -- obj2 = updateIn(obj, ['d', 'd1'], (val) => val + 1)
|
||
// -- // { a: 1, d: { d1: 4, d2: 4 } }
|
||
// -- obj2 === obj
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- obj3 = updateIn(obj, ['d', 'd1'], (val) => val)
|
||
// -- // { a: 1, d: { d1: 3, d2: 4 } }
|
||
// -- obj3 === obj
|
||
// -- // true
|
||
// -- ```
|
||
function updateIn(obj, path, fnUpdate) {
|
||
var prevVal = getIn(obj, path);
|
||
var nextVal = fnUpdate(prevVal);
|
||
return setIn(obj, path, nextVal);
|
||
}
|
||
|
||
// -- #### merge()
|
||
// -- Returns a new object built as follows: the overlapping keys from the
|
||
// -- second one overwrite the corresponding entries from the first one.
|
||
// -- Similar to `Object.assign()`, but immutable.
|
||
// --
|
||
// -- Usage:
|
||
// --
|
||
// -- * `merge(obj1: Object, obj2: ?Object): Object`
|
||
// -- * `merge(obj1: Object, ...objects: Array<?Object>): Object`
|
||
// --
|
||
// -- The unmodified `obj1` is returned if `obj2` does not *provide something
|
||
// -- new to* `obj1`, i.e. if either of the following
|
||
// -- conditions are true:
|
||
// --
|
||
// -- * `obj2` is `null` or `undefined`
|
||
// -- * `obj2` is an object, but it is empty
|
||
// -- * All attributes of `obj2` are `undefined`
|
||
// -- * All attributes of `obj2` are referentially equal to the
|
||
// -- corresponding attributes of `obj1`
|
||
// --
|
||
// -- Note that `undefined` attributes in `obj2` do not modify the
|
||
// -- corresponding attributes in `obj1`.
|
||
// --
|
||
// -- ```js
|
||
// -- obj1 = { a: 1, b: 2, c: 3 }
|
||
// -- obj2 = { c: 4, d: 5 }
|
||
// -- obj3 = merge(obj1, obj2)
|
||
// -- // { a: 1, b: 2, c: 4, d: 5 }
|
||
// -- obj3 === obj1
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- merge(obj1, { c: 3 }) === obj1
|
||
// -- // true
|
||
// -- ```
|
||
function merge(a, b, c, d, e, f) {
|
||
for (var _len2 = arguments.length, rest = Array(_len2 > 6 ? _len2 - 6 : 0), _key2 = 6; _key2 < _len2; _key2++) {
|
||
rest[_key2 - 6] = arguments[_key2];
|
||
}
|
||
|
||
return rest.length ? doMerge.call.apply(doMerge, [null, false, false, a, b, c, d, e, f].concat(rest)) : doMerge(false, false, a, b, c, d, e, f);
|
||
}
|
||
|
||
// -- #### mergeDeep()
|
||
// -- Returns a new object built as follows: the overlapping keys from the
|
||
// -- second one overwrite the corresponding entries from the first one.
|
||
// -- If both the first and second entries are objects they are merged recursively.
|
||
// -- Similar to `Object.assign()`, but immutable, and deeply merging.
|
||
// --
|
||
// -- Usage:
|
||
// --
|
||
// -- * `mergeDeep(obj1: Object, obj2: ?Object): Object`
|
||
// -- * `mergeDeep(obj1: Object, ...objects: Array<?Object>): Object`
|
||
// --
|
||
// -- The unmodified `obj1` is returned if `obj2` does not *provide something
|
||
// -- new to* `obj1`, i.e. if either of the following
|
||
// -- conditions are true:
|
||
// --
|
||
// -- * `obj2` is `null` or `undefined`
|
||
// -- * `obj2` is an object, but it is empty
|
||
// -- * All attributes of `obj2` are `undefined`
|
||
// -- * All attributes of `obj2` are referentially equal to the
|
||
// -- corresponding attributes of `obj1`
|
||
// --
|
||
// -- Note that `undefined` attributes in `obj2` do not modify the
|
||
// -- corresponding attributes in `obj1`.
|
||
// --
|
||
// -- ```js
|
||
// -- obj1 = { a: 1, b: 2, c: { a: 1 } }
|
||
// -- obj2 = { b: 3, c: { b: 2 } }
|
||
// -- obj3 = mergeDeep(obj1, obj2)
|
||
// -- // { a: 1, b: 3, c: { a: 1, b: 2 } }
|
||
// -- obj3 === obj1
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- mergeDeep(obj1, { c: { a: 1 } }) === obj1
|
||
// -- // true
|
||
// -- ```
|
||
function mergeDeep(a, b, c, d, e, f) {
|
||
for (var _len3 = arguments.length, rest = Array(_len3 > 6 ? _len3 - 6 : 0), _key3 = 6; _key3 < _len3; _key3++) {
|
||
rest[_key3 - 6] = arguments[_key3];
|
||
}
|
||
|
||
return rest.length ? doMerge.call.apply(doMerge, [null, false, true, a, b, c, d, e, f].concat(rest)) : doMerge(false, true, a, b, c, d, e, f);
|
||
}
|
||
|
||
// -- #### mergeIn()
|
||
// -- Similar to `merge()`, but merging the value at a given nested path.
|
||
// -- Note that the returned type is the same as that of the first argument.
|
||
// --
|
||
// -- Usage:
|
||
// --
|
||
// -- * `mergeIn<T: ArrayOrObject>(obj1: T, path: Array<Key>, obj2: ?Object): T`
|
||
// -- * `mergeIn<T: ArrayOrObject>(obj1: T, path: Array<Key>,
|
||
// -- ...objects: Array<?Object>): T`
|
||
// --
|
||
// -- ```js
|
||
// -- obj1 = { a: 1, d: { b: { d1: 3, d2: 4 } } }
|
||
// -- obj2 = { d3: 5 }
|
||
// -- obj3 = mergeIn(obj1, ['d', 'b'], obj2)
|
||
// -- // { a: 1, d: { b: { d1: 3, d2: 4, d3: 5 } } }
|
||
// -- obj3 === obj1
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- mergeIn(obj1, ['d', 'b'], { d2: 4 }) === obj1
|
||
// -- // true
|
||
// -- ```
|
||
function mergeIn(a, path, b, c, d, e, f) {
|
||
var prevVal = getIn(a, path);
|
||
if (prevVal == null) prevVal = {};
|
||
var nextVal = void 0;
|
||
|
||
for (var _len4 = arguments.length, rest = Array(_len4 > 7 ? _len4 - 7 : 0), _key4 = 7; _key4 < _len4; _key4++) {
|
||
rest[_key4 - 7] = arguments[_key4];
|
||
}
|
||
|
||
if (rest.length) {
|
||
nextVal = doMerge.call.apply(doMerge, [null, false, false, prevVal, b, c, d, e, f].concat(rest));
|
||
} else {
|
||
nextVal = doMerge(false, false, prevVal, b, c, d, e, f);
|
||
}
|
||
return setIn(a, path, nextVal);
|
||
}
|
||
|
||
// -- #### omit()
|
||
// -- Returns an object excluding one or several attributes.
|
||
// --
|
||
// -- Usage: `omit(obj: Object, attrs: Array<string>|string): Object`
|
||
//
|
||
// -- ```js
|
||
// -- obj = { a: 1, b: 2, c: 3, d: 4 }
|
||
// -- omit(obj, 'a')
|
||
// -- // { b: 2, c: 3, d: 4 }
|
||
// -- omit(obj, ['b', 'c'])
|
||
// -- // { a: 1, d: 4 }
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- omit(obj, 'z') === obj1
|
||
// -- // true
|
||
// -- ```
|
||
function omit(obj, attrs) {
|
||
var omitList = Array.isArray(attrs) ? attrs : [attrs];
|
||
var fDoSomething = false;
|
||
for (var i = 0; i < omitList.length; i++) {
|
||
if (hasOwnProperty.call(obj, omitList[i])) {
|
||
fDoSomething = true;
|
||
break;
|
||
}
|
||
}
|
||
if (!fDoSomething) return obj;
|
||
var out = {};
|
||
var keys = getKeysAndSymbols(obj);
|
||
for (var _i = 0; _i < keys.length; _i++) {
|
||
var key = keys[_i];
|
||
if (omitList.indexOf(key) >= 0) continue;
|
||
out[key] = obj[key];
|
||
}
|
||
return out;
|
||
}
|
||
|
||
// -- #### addDefaults()
|
||
// -- Returns a new object built as follows: `undefined` keys in the first one
|
||
// -- are filled in with the corresponding values from the second one
|
||
// -- (even if they are `null`).
|
||
// --
|
||
// -- Usage:
|
||
// --
|
||
// -- * `addDefaults(obj: Object, defaults: Object): Object`
|
||
// -- * `addDefaults(obj: Object, ...defaultObjects: Array<?Object>): Object`
|
||
// --
|
||
// -- ```js
|
||
// -- obj1 = { a: 1, b: 2, c: 3 }
|
||
// -- obj2 = { c: 4, d: 5, e: null }
|
||
// -- obj3 = addDefaults(obj1, obj2)
|
||
// -- // { a: 1, b: 2, c: 3, d: 5, e: null }
|
||
// -- obj3 === obj1
|
||
// -- // false
|
||
// --
|
||
// -- // The same object is returned if there are no changes:
|
||
// -- addDefaults(obj1, { c: 4 }) === obj1
|
||
// -- // true
|
||
// -- ```
|
||
function addDefaults(a, b, c, d, e, f) {
|
||
for (var _len5 = arguments.length, rest = Array(_len5 > 6 ? _len5 - 6 : 0), _key5 = 6; _key5 < _len5; _key5++) {
|
||
rest[_key5 - 6] = arguments[_key5];
|
||
}
|
||
|
||
return rest.length ? doMerge.call.apply(doMerge, [null, true, false, a, b, c, d, e, f].concat(rest)) : doMerge(true, false, a, b, c, d, e, f);
|
||
}
|
||
|
||
// ===============================================
|
||
// ### Public API
|
||
// ===============================================
|
||
var timm = {
|
||
clone: clone,
|
||
addLast: addLast,
|
||
addFirst: addFirst,
|
||
removeLast: removeLast,
|
||
removeFirst: removeFirst,
|
||
insert: insert,
|
||
removeAt: removeAt,
|
||
replaceAt: replaceAt,
|
||
|
||
getIn: getIn,
|
||
// eslint-disable-next-line object-shorthand
|
||
set: set, // so that flow doesn't complain
|
||
setIn: setIn,
|
||
update: update,
|
||
updateIn: updateIn,
|
||
merge: merge,
|
||
mergeDeep: mergeDeep,
|
||
mergeIn: mergeIn,
|
||
omit: omit,
|
||
addDefaults: addDefaults
|
||
};
|
||
|
||
exports.default = timm;
|
||
|
||
|
||
/***/ }),
|
||
/* 41 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _typeof2(obj) { 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); }
|
||
|
||
function _typeof(obj) {
|
||
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
|
||
module.exports = _typeof = function _typeof(obj) {
|
||
return _typeof2(obj);
|
||
};
|
||
} else {
|
||
module.exports = _typeof = function _typeof(obj) {
|
||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
|
||
};
|
||
}
|
||
|
||
return _typeof(obj);
|
||
}
|
||
|
||
module.exports = _typeof;
|
||
|
||
/***/ }),
|
||
/* 42 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var listCacheClear = __webpack_require__(160),
|
||
listCacheDelete = __webpack_require__(161),
|
||
listCacheGet = __webpack_require__(162),
|
||
listCacheHas = __webpack_require__(163),
|
||
listCacheSet = __webpack_require__(164);
|
||
|
||
/**
|
||
* Creates an list cache object.
|
||
*
|
||
* @private
|
||
* @constructor
|
||
* @param {Array} [entries] The key-value pairs to cache.
|
||
*/
|
||
function ListCache(entries) {
|
||
var index = -1,
|
||
length = entries == null ? 0 : entries.length;
|
||
|
||
this.clear();
|
||
while (++index < length) {
|
||
var entry = entries[index];
|
||
this.set(entry[0], entry[1]);
|
||
}
|
||
}
|
||
|
||
// Add methods to `ListCache`.
|
||
ListCache.prototype.clear = listCacheClear;
|
||
ListCache.prototype['delete'] = listCacheDelete;
|
||
ListCache.prototype.get = listCacheGet;
|
||
ListCache.prototype.has = listCacheHas;
|
||
ListCache.prototype.set = listCacheSet;
|
||
|
||
module.exports = ListCache;
|
||
|
||
|
||
/***/ }),
|
||
/* 43 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var eq = __webpack_require__(57);
|
||
|
||
/**
|
||
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||
*
|
||
* @private
|
||
* @param {Array} array The array to inspect.
|
||
* @param {*} key The key to search for.
|
||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||
*/
|
||
function assocIndexOf(array, key) {
|
||
var length = array.length;
|
||
while (length--) {
|
||
if (eq(array[length][0], key)) {
|
||
return length;
|
||
}
|
||
}
|
||
return -1;
|
||
}
|
||
|
||
module.exports = assocIndexOf;
|
||
|
||
|
||
/***/ }),
|
||
/* 44 */
|
||
/***/ (function(module, exports) {
|
||
|
||
var g;
|
||
|
||
// This works in non-strict mode
|
||
g = (function() {
|
||
return this;
|
||
})();
|
||
|
||
try {
|
||
// This works if eval is allowed (see CSP)
|
||
g = g || new Function("return this")();
|
||
} catch (e) {
|
||
// This works if the window reference is available
|
||
if (typeof window === "object") g = window;
|
||
}
|
||
|
||
// g can still be undefined, but nothing to do about it...
|
||
// We return undefined, instead of nothing here, so it's
|
||
// easier to handle this case. if(!global) { ...}
|
||
|
||
module.exports = g;
|
||
|
||
|
||
/***/ }),
|
||
/* 45 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getNative = __webpack_require__(19);
|
||
|
||
/* Built-in method references that are verified to be native. */
|
||
var nativeCreate = getNative(Object, 'create');
|
||
|
||
module.exports = nativeCreate;
|
||
|
||
|
||
/***/ }),
|
||
/* 46 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isKeyable = __webpack_require__(184);
|
||
|
||
/**
|
||
* Gets the data for `map`.
|
||
*
|
||
* @private
|
||
* @param {Object} map The map to query.
|
||
* @param {string} key The reference key.
|
||
* @returns {*} Returns the map data.
|
||
*/
|
||
function getMapData(map, key) {
|
||
var data = map.__data__;
|
||
return isKeyable(key)
|
||
? data[typeof key == 'string' ? 'string' : 'hash']
|
||
: data.map;
|
||
}
|
||
|
||
module.exports = getMapData;
|
||
|
||
|
||
/***/ }),
|
||
/* 47 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayLikeKeys = __webpack_require__(103),
|
||
baseKeys = __webpack_require__(65),
|
||
isArrayLike = __webpack_require__(26);
|
||
|
||
/**
|
||
* Creates an array of the own enumerable property names of `object`.
|
||
*
|
||
* **Note:** Non-object values are coerced to objects. See the
|
||
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||
* for more details.
|
||
*
|
||
* @static
|
||
* @since 0.1.0
|
||
* @memberOf _
|
||
* @category Object
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of property names.
|
||
* @example
|
||
*
|
||
* function Foo() {
|
||
* this.a = 1;
|
||
* this.b = 2;
|
||
* }
|
||
*
|
||
* Foo.prototype.c = 3;
|
||
*
|
||
* _.keys(new Foo);
|
||
* // => ['a', 'b'] (iteration order is not guaranteed)
|
||
*
|
||
* _.keys('hi');
|
||
* // => ['0', '1']
|
||
*/
|
||
function keys(object) {
|
||
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
||
}
|
||
|
||
module.exports = keys;
|
||
|
||
|
||
/***/ }),
|
||
/* 48 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIsArguments = __webpack_require__(202),
|
||
isObjectLike = __webpack_require__(20);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/** Built-in value references. */
|
||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||
|
||
/**
|
||
* Checks if `value` is likely an `arguments` object.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
||
* else `false`.
|
||
* @example
|
||
*
|
||
* _.isArguments(function() { return arguments; }());
|
||
* // => true
|
||
*
|
||
* _.isArguments([1, 2, 3]);
|
||
* // => false
|
||
*/
|
||
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
||
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
||
!propertyIsEnumerable.call(value, 'callee');
|
||
};
|
||
|
||
module.exports = isArguments;
|
||
|
||
|
||
/***/ }),
|
||
/* 49 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isArray = __webpack_require__(2),
|
||
isKey = __webpack_require__(70),
|
||
stringToPath = __webpack_require__(213),
|
||
toString = __webpack_require__(216);
|
||
|
||
/**
|
||
* Casts `value` to a path array if it's not one.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to inspect.
|
||
* @param {Object} [object] The object to query keys on.
|
||
* @returns {Array} Returns the cast property path array.
|
||
*/
|
||
function castPath(value, object) {
|
||
if (isArray(value)) {
|
||
return value;
|
||
}
|
||
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
||
}
|
||
|
||
module.exports = castPath;
|
||
|
||
|
||
/***/ }),
|
||
/* 50 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGetTag = __webpack_require__(25),
|
||
isObjectLike = __webpack_require__(20);
|
||
|
||
/** `Object#toString` result references. */
|
||
var symbolTag = '[object Symbol]';
|
||
|
||
/**
|
||
* Checks if `value` is classified as a `Symbol` primitive or object.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
||
* @example
|
||
*
|
||
* _.isSymbol(Symbol.iterator);
|
||
* // => true
|
||
*
|
||
* _.isSymbol('abc');
|
||
* // => false
|
||
*/
|
||
function isSymbol(value) {
|
||
return typeof value == 'symbol' ||
|
||
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
||
}
|
||
|
||
module.exports = isSymbol;
|
||
|
||
|
||
/***/ }),
|
||
/* 51 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var setGlobal = __webpack_require__(75);
|
||
var IS_PURE = __webpack_require__(77);
|
||
|
||
var SHARED = '__core-js_shared__';
|
||
var store = global[SHARED] || setGlobal(SHARED, {});
|
||
|
||
(module.exports = function (key, value) {
|
||
return store[key] || (store[key] = value !== undefined ? value : {});
|
||
})('versions', []).push({
|
||
version: '3.1.3',
|
||
mode: IS_PURE ? 'pure' : 'global',
|
||
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 52 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = function (bitmap, value) {
|
||
return {
|
||
enumerable: !(bitmap & 1),
|
||
configurable: !(bitmap & 2),
|
||
writable: !(bitmap & 4),
|
||
value: value
|
||
};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 53 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var fails = __webpack_require__(8);
|
||
var classof = __webpack_require__(80);
|
||
|
||
var split = ''.split;
|
||
|
||
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
||
module.exports = fails(function () {
|
||
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
||
// eslint-disable-next-line no-prototype-builtins
|
||
return !Object('z').propertyIsEnumerable(0);
|
||
}) ? function (it) {
|
||
return classof(it) == 'String' ? split.call(it, '') : Object(it);
|
||
} : Object;
|
||
|
||
|
||
/***/ }),
|
||
/* 54 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var aFunction = __webpack_require__(55);
|
||
|
||
// optional / simple context binding
|
||
module.exports = function (fn, that, length) {
|
||
aFunction(fn);
|
||
if (that === undefined) return fn;
|
||
switch (length) {
|
||
case 0: return function () {
|
||
return fn.call(that);
|
||
};
|
||
case 1: return function (a) {
|
||
return fn.call(that, a);
|
||
};
|
||
case 2: return function (a, b) {
|
||
return fn.call(that, a, b);
|
||
};
|
||
case 3: return function (a, b, c) {
|
||
return fn.call(that, a, b, c);
|
||
};
|
||
}
|
||
return function (/* ...args */) {
|
||
return fn.apply(that, arguments);
|
||
};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 55 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = function (it) {
|
||
if (typeof it != 'function') {
|
||
throw TypeError(String(it) + ' is not a function');
|
||
} return it;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 56 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals window, document */
|
||
|
||
/* eslint-disable no-var */
|
||
// eslint-disable-next-line strict
|
||
|
||
|
||
var IXEvents = __webpack_require__(288);
|
||
|
||
function dispatchCustomEvent(element, eventName) {
|
||
var event = document.createEvent('CustomEvent');
|
||
event.initCustomEvent(eventName, true, true, null);
|
||
element.dispatchEvent(event);
|
||
}
|
||
/**
|
||
* Webflow: IX Event triggers for other modules
|
||
*/
|
||
|
||
|
||
var $ = window.jQuery;
|
||
var api = {};
|
||
var namespace = '.w-ix';
|
||
var eventTriggers = {
|
||
reset: function reset(i, el) {
|
||
IXEvents.triggers.reset(i, el);
|
||
},
|
||
intro: function intro(i, el) {
|
||
IXEvents.triggers.intro(i, el);
|
||
dispatchCustomEvent(el, 'COMPONENT_ACTIVE');
|
||
},
|
||
outro: function outro(i, el) {
|
||
IXEvents.triggers.outro(i, el);
|
||
dispatchCustomEvent(el, 'COMPONENT_INACTIVE');
|
||
}
|
||
};
|
||
api.triggers = {};
|
||
api.types = {
|
||
INTRO: 'w-ix-intro' + namespace,
|
||
OUTRO: 'w-ix-outro' + namespace
|
||
};
|
||
$.extend(api.triggers, eventTriggers);
|
||
module.exports = api;
|
||
|
||
/***/ }),
|
||
/* 57 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Performs a
|
||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||
* comparison between two values to determine if they are equivalent.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to compare.
|
||
* @param {*} other The other value to compare.
|
||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||
* @example
|
||
*
|
||
* var object = { 'a': 1 };
|
||
* var other = { 'a': 1 };
|
||
*
|
||
* _.eq(object, object);
|
||
* // => true
|
||
*
|
||
* _.eq(object, other);
|
||
* // => false
|
||
*
|
||
* _.eq('a', 'a');
|
||
* // => true
|
||
*
|
||
* _.eq('a', Object('a'));
|
||
* // => false
|
||
*
|
||
* _.eq(NaN, NaN);
|
||
* // => true
|
||
*/
|
||
function eq(value, other) {
|
||
return value === other || (value !== value && other !== other);
|
||
}
|
||
|
||
module.exports = eq;
|
||
|
||
|
||
/***/ }),
|
||
/* 58 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getNative = __webpack_require__(19),
|
||
root = __webpack_require__(10);
|
||
|
||
/* Built-in method references that are verified to be native. */
|
||
var Map = getNative(root, 'Map');
|
||
|
||
module.exports = Map;
|
||
|
||
|
||
/***/ }),
|
||
/* 59 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var mapCacheClear = __webpack_require__(176),
|
||
mapCacheDelete = __webpack_require__(183),
|
||
mapCacheGet = __webpack_require__(185),
|
||
mapCacheHas = __webpack_require__(186),
|
||
mapCacheSet = __webpack_require__(187);
|
||
|
||
/**
|
||
* Creates a map cache object to store key-value pairs.
|
||
*
|
||
* @private
|
||
* @constructor
|
||
* @param {Array} [entries] The key-value pairs to cache.
|
||
*/
|
||
function MapCache(entries) {
|
||
var index = -1,
|
||
length = entries == null ? 0 : entries.length;
|
||
|
||
this.clear();
|
||
while (++index < length) {
|
||
var entry = entries[index];
|
||
this.set(entry[0], entry[1]);
|
||
}
|
||
}
|
||
|
||
// Add methods to `MapCache`.
|
||
MapCache.prototype.clear = mapCacheClear;
|
||
MapCache.prototype['delete'] = mapCacheDelete;
|
||
MapCache.prototype.get = mapCacheGet;
|
||
MapCache.prototype.has = mapCacheHas;
|
||
MapCache.prototype.set = mapCacheSet;
|
||
|
||
module.exports = MapCache;
|
||
|
||
|
||
/***/ }),
|
||
/* 60 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Appends the elements of `values` to `array`.
|
||
*
|
||
* @private
|
||
* @param {Array} array The array to modify.
|
||
* @param {Array} values The values to append.
|
||
* @returns {Array} Returns `array`.
|
||
*/
|
||
function arrayPush(array, values) {
|
||
var index = -1,
|
||
length = values.length,
|
||
offset = array.length;
|
||
|
||
while (++index < length) {
|
||
array[offset + index] = values[index];
|
||
}
|
||
return array;
|
||
}
|
||
|
||
module.exports = arrayPush;
|
||
|
||
|
||
/***/ }),
|
||
/* 61 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(10),
|
||
stubFalse = __webpack_require__(203);
|
||
|
||
/** Detect free variable `exports`. */
|
||
var freeExports = true && exports && !exports.nodeType && exports;
|
||
|
||
/** Detect free variable `module`. */
|
||
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
||
|
||
/** Detect the popular CommonJS extension `module.exports`. */
|
||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||
|
||
/** Built-in value references. */
|
||
var Buffer = moduleExports ? root.Buffer : undefined;
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
||
|
||
/**
|
||
* Checks if `value` is a buffer.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.3.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
||
* @example
|
||
*
|
||
* _.isBuffer(new Buffer(2));
|
||
* // => true
|
||
*
|
||
* _.isBuffer(new Uint8Array(2));
|
||
* // => false
|
||
*/
|
||
var isBuffer = nativeIsBuffer || stubFalse;
|
||
|
||
module.exports = isBuffer;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(104)(module)))
|
||
|
||
/***/ }),
|
||
/* 62 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used as references for various `Number` constants. */
|
||
var MAX_SAFE_INTEGER = 9007199254740991;
|
||
|
||
/** Used to detect unsigned integer values. */
|
||
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
||
|
||
/**
|
||
* Checks if `value` is a valid array-like index.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
||
*/
|
||
function isIndex(value, length) {
|
||
var type = typeof value;
|
||
length = length == null ? MAX_SAFE_INTEGER : length;
|
||
|
||
return !!length &&
|
||
(type == 'number' ||
|
||
(type != 'symbol' && reIsUint.test(value))) &&
|
||
(value > -1 && value % 1 == 0 && value < length);
|
||
}
|
||
|
||
module.exports = isIndex;
|
||
|
||
|
||
/***/ }),
|
||
/* 63 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIsTypedArray = __webpack_require__(204),
|
||
baseUnary = __webpack_require__(205),
|
||
nodeUtil = __webpack_require__(206);
|
||
|
||
/* Node.js helper references. */
|
||
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
||
|
||
/**
|
||
* Checks if `value` is classified as a typed array.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 3.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
||
* @example
|
||
*
|
||
* _.isTypedArray(new Uint8Array);
|
||
* // => true
|
||
*
|
||
* _.isTypedArray([]);
|
||
* // => false
|
||
*/
|
||
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
||
|
||
module.exports = isTypedArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 64 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used as references for various `Number` constants. */
|
||
var MAX_SAFE_INTEGER = 9007199254740991;
|
||
|
||
/**
|
||
* Checks if `value` is a valid array-like length.
|
||
*
|
||
* **Note:** This method is loosely based on
|
||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||
* @example
|
||
*
|
||
* _.isLength(3);
|
||
* // => true
|
||
*
|
||
* _.isLength(Number.MIN_VALUE);
|
||
* // => false
|
||
*
|
||
* _.isLength(Infinity);
|
||
* // => false
|
||
*
|
||
* _.isLength('3');
|
||
* // => false
|
||
*/
|
||
function isLength(value) {
|
||
return typeof value == 'number' &&
|
||
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
||
}
|
||
|
||
module.exports = isLength;
|
||
|
||
|
||
/***/ }),
|
||
/* 65 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isPrototype = __webpack_require__(66),
|
||
nativeKeys = __webpack_require__(207);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of property names.
|
||
*/
|
||
function baseKeys(object) {
|
||
if (!isPrototype(object)) {
|
||
return nativeKeys(object);
|
||
}
|
||
var result = [];
|
||
for (var key in Object(object)) {
|
||
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
||
result.push(key);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = baseKeys;
|
||
|
||
|
||
/***/ }),
|
||
/* 66 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/**
|
||
* Checks if `value` is likely a prototype object.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
||
*/
|
||
function isPrototype(value) {
|
||
var Ctor = value && value.constructor,
|
||
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
||
|
||
return value === proto;
|
||
}
|
||
|
||
module.exports = isPrototype;
|
||
|
||
|
||
/***/ }),
|
||
/* 67 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var DataView = __webpack_require__(208),
|
||
Map = __webpack_require__(58),
|
||
Promise = __webpack_require__(209),
|
||
Set = __webpack_require__(210),
|
||
WeakMap = __webpack_require__(106),
|
||
baseGetTag = __webpack_require__(25),
|
||
toSource = __webpack_require__(97);
|
||
|
||
/** `Object#toString` result references. */
|
||
var mapTag = '[object Map]',
|
||
objectTag = '[object Object]',
|
||
promiseTag = '[object Promise]',
|
||
setTag = '[object Set]',
|
||
weakMapTag = '[object WeakMap]';
|
||
|
||
var dataViewTag = '[object DataView]';
|
||
|
||
/** Used to detect maps, sets, and weakmaps. */
|
||
var dataViewCtorString = toSource(DataView),
|
||
mapCtorString = toSource(Map),
|
||
promiseCtorString = toSource(Promise),
|
||
setCtorString = toSource(Set),
|
||
weakMapCtorString = toSource(WeakMap);
|
||
|
||
/**
|
||
* Gets the `toStringTag` of `value`.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to query.
|
||
* @returns {string} Returns the `toStringTag`.
|
||
*/
|
||
var getTag = baseGetTag;
|
||
|
||
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||
(Map && getTag(new Map) != mapTag) ||
|
||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
||
(Set && getTag(new Set) != setTag) ||
|
||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
||
getTag = function(value) {
|
||
var result = baseGetTag(value),
|
||
Ctor = result == objectTag ? value.constructor : undefined,
|
||
ctorString = Ctor ? toSource(Ctor) : '';
|
||
|
||
if (ctorString) {
|
||
switch (ctorString) {
|
||
case dataViewCtorString: return dataViewTag;
|
||
case mapCtorString: return mapTag;
|
||
case promiseCtorString: return promiseTag;
|
||
case setCtorString: return setTag;
|
||
case weakMapCtorString: return weakMapTag;
|
||
}
|
||
}
|
||
return result;
|
||
};
|
||
}
|
||
|
||
module.exports = getTag;
|
||
|
||
|
||
/***/ }),
|
||
/* 68 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGet = __webpack_require__(69);
|
||
|
||
/**
|
||
* Gets the value at `path` of `object`. If the resolved value is
|
||
* `undefined`, the `defaultValue` is returned in its place.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 3.7.0
|
||
* @category Object
|
||
* @param {Object} object The object to query.
|
||
* @param {Array|string} path The path of the property to get.
|
||
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
||
* @returns {*} Returns the resolved value.
|
||
* @example
|
||
*
|
||
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
||
*
|
||
* _.get(object, 'a[0].b.c');
|
||
* // => 3
|
||
*
|
||
* _.get(object, ['a', '0', 'b', 'c']);
|
||
* // => 3
|
||
*
|
||
* _.get(object, 'a.b.c', 'default');
|
||
* // => 'default'
|
||
*/
|
||
function get(object, path, defaultValue) {
|
||
var result = object == null ? undefined : baseGet(object, path);
|
||
return result === undefined ? defaultValue : result;
|
||
}
|
||
|
||
module.exports = get;
|
||
|
||
|
||
/***/ }),
|
||
/* 69 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var castPath = __webpack_require__(49),
|
||
toKey = __webpack_require__(33);
|
||
|
||
/**
|
||
* The base implementation of `_.get` without support for default values.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @param {Array|string} path The path of the property to get.
|
||
* @returns {*} Returns the resolved value.
|
||
*/
|
||
function baseGet(object, path) {
|
||
path = castPath(path, object);
|
||
|
||
var index = 0,
|
||
length = path.length;
|
||
|
||
while (object != null && index < length) {
|
||
object = object[toKey(path[index++])];
|
||
}
|
||
return (index && index == length) ? object : undefined;
|
||
}
|
||
|
||
module.exports = baseGet;
|
||
|
||
|
||
/***/ }),
|
||
/* 70 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isArray = __webpack_require__(2),
|
||
isSymbol = __webpack_require__(50);
|
||
|
||
/** Used to match property names within property paths. */
|
||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
||
reIsPlainProp = /^\w*$/;
|
||
|
||
/**
|
||
* Checks if `value` is a property name and not a property path.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @param {Object} [object] The object to query keys on.
|
||
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
||
*/
|
||
function isKey(value, object) {
|
||
if (isArray(value)) {
|
||
return false;
|
||
}
|
||
var type = typeof value;
|
||
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
||
value == null || isSymbol(value)) {
|
||
return true;
|
||
}
|
||
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
||
(object != null && value in Object(object));
|
||
}
|
||
|
||
module.exports = isKey;
|
||
|
||
|
||
/***/ }),
|
||
/* 71 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* This method returns the first argument it receives.
|
||
*
|
||
* @static
|
||
* @since 0.1.0
|
||
* @memberOf _
|
||
* @category Util
|
||
* @param {*} value Any value.
|
||
* @returns {*} Returns `value`.
|
||
* @example
|
||
*
|
||
* var object = { 'a': 1 };
|
||
*
|
||
* console.log(_.identity(object) === object);
|
||
* // => true
|
||
*/
|
||
function identity(value) {
|
||
return value;
|
||
}
|
||
|
||
module.exports = identity;
|
||
|
||
|
||
/***/ }),
|
||
/* 72 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseTrim = __webpack_require__(224),
|
||
isObject = __webpack_require__(12),
|
||
isSymbol = __webpack_require__(50);
|
||
|
||
/** Used as references for various `Number` constants. */
|
||
var NAN = 0 / 0;
|
||
|
||
/** Used to detect bad signed hexadecimal string values. */
|
||
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
||
|
||
/** Used to detect binary string values. */
|
||
var reIsBinary = /^0b[01]+$/i;
|
||
|
||
/** Used to detect octal string values. */
|
||
var reIsOctal = /^0o[0-7]+$/i;
|
||
|
||
/** Built-in method references without a dependency on `root`. */
|
||
var freeParseInt = parseInt;
|
||
|
||
/**
|
||
* Converts `value` to a number.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to process.
|
||
* @returns {number} Returns the number.
|
||
* @example
|
||
*
|
||
* _.toNumber(3.2);
|
||
* // => 3.2
|
||
*
|
||
* _.toNumber(Number.MIN_VALUE);
|
||
* // => 5e-324
|
||
*
|
||
* _.toNumber(Infinity);
|
||
* // => Infinity
|
||
*
|
||
* _.toNumber('3.2');
|
||
* // => 3.2
|
||
*/
|
||
function toNumber(value) {
|
||
if (typeof value == 'number') {
|
||
return value;
|
||
}
|
||
if (isSymbol(value)) {
|
||
return NAN;
|
||
}
|
||
if (isObject(value)) {
|
||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
||
value = isObject(other) ? (other + '') : other;
|
||
}
|
||
if (typeof value != 'string') {
|
||
return value === 0 ? value : +value;
|
||
}
|
||
value = baseTrim(value);
|
||
var isBinary = reIsBinary.test(value);
|
||
return (isBinary || reIsOctal.test(value))
|
||
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
||
: (reIsBadHex.test(value) ? NAN : +value);
|
||
}
|
||
|
||
module.exports = toNumber;
|
||
|
||
|
||
/***/ }),
|
||
/* 73 */
|
||
/***/ (function(module, exports) {
|
||
|
||
// `RequireObjectCoercible` abstract operation
|
||
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
|
||
module.exports = function (it) {
|
||
if (it == undefined) throw TypeError("Can't call method on " + it);
|
||
return it;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 74 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var NATIVE_WEAK_MAP = __webpack_require__(230);
|
||
var global = __webpack_require__(7);
|
||
var isObject = __webpack_require__(16);
|
||
var hide = __webpack_require__(21);
|
||
var objectHas = __webpack_require__(17);
|
||
var sharedKey = __webpack_require__(78);
|
||
var hiddenKeys = __webpack_require__(79);
|
||
|
||
var WeakMap = global.WeakMap;
|
||
var set, get, has;
|
||
|
||
var enforce = function (it) {
|
||
return has(it) ? get(it) : set(it, {});
|
||
};
|
||
|
||
var getterFor = function (TYPE) {
|
||
return function (it) {
|
||
var state;
|
||
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
||
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
||
} return state;
|
||
};
|
||
};
|
||
|
||
if (NATIVE_WEAK_MAP) {
|
||
var store = new WeakMap();
|
||
var wmget = store.get;
|
||
var wmhas = store.has;
|
||
var wmset = store.set;
|
||
set = function (it, metadata) {
|
||
wmset.call(store, it, metadata);
|
||
return metadata;
|
||
};
|
||
get = function (it) {
|
||
return wmget.call(store, it) || {};
|
||
};
|
||
has = function (it) {
|
||
return wmhas.call(store, it);
|
||
};
|
||
} else {
|
||
var STATE = sharedKey('state');
|
||
hiddenKeys[STATE] = true;
|
||
set = function (it, metadata) {
|
||
hide(it, STATE, metadata);
|
||
return metadata;
|
||
};
|
||
get = function (it) {
|
||
return objectHas(it, STATE) ? it[STATE] : {};
|
||
};
|
||
has = function (it) {
|
||
return objectHas(it, STATE);
|
||
};
|
||
}
|
||
|
||
module.exports = {
|
||
set: set,
|
||
get: get,
|
||
has: has,
|
||
enforce: enforce,
|
||
getterFor: getterFor
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 75 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var hide = __webpack_require__(21);
|
||
|
||
module.exports = function (key, value) {
|
||
try {
|
||
hide(global, key, value);
|
||
} catch (error) {
|
||
global[key] = value;
|
||
} return value;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 76 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(16);
|
||
|
||
// `ToPrimitive` abstract operation
|
||
// https://tc39.github.io/ecma262/#sec-toprimitive
|
||
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
||
// and the second argument - flag - preferred type is a string
|
||
module.exports = function (input, PREFERRED_STRING) {
|
||
if (!isObject(input)) return input;
|
||
var fn, val;
|
||
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
||
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
|
||
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
||
throw TypeError("Can't convert object to primitive value");
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 77 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = false;
|
||
|
||
|
||
/***/ }),
|
||
/* 78 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var shared = __webpack_require__(51);
|
||
var uid = __webpack_require__(115);
|
||
|
||
var keys = shared('keys');
|
||
|
||
module.exports = function (key) {
|
||
return keys[key] || (keys[key] = uid(key));
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 79 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = {};
|
||
|
||
|
||
/***/ }),
|
||
/* 80 */
|
||
/***/ (function(module, exports) {
|
||
|
||
var toString = {}.toString;
|
||
|
||
module.exports = function (it) {
|
||
return toString.call(it).slice(8, -1);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 81 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var path = __webpack_require__(119);
|
||
var global = __webpack_require__(7);
|
||
|
||
var aFunction = function (variable) {
|
||
return typeof variable == 'function' ? variable : undefined;
|
||
};
|
||
|
||
module.exports = function (namespace, method) {
|
||
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
|
||
: path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 82 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var toIndexedObject = __webpack_require__(22);
|
||
var toLength = __webpack_require__(3);
|
||
var toAbsoluteIndex = __webpack_require__(34);
|
||
|
||
// `Array.prototype.{ indexOf, includes }` methods implementation
|
||
var createMethod = function (IS_INCLUDES) {
|
||
return function ($this, el, fromIndex) {
|
||
var O = toIndexedObject($this);
|
||
var length = toLength(O.length);
|
||
var index = toAbsoluteIndex(fromIndex, length);
|
||
var value;
|
||
// Array#includes uses SameValueZero equality algorithm
|
||
// eslint-disable-next-line no-self-compare
|
||
if (IS_INCLUDES && el != el) while (length > index) {
|
||
value = O[index++];
|
||
// eslint-disable-next-line no-self-compare
|
||
if (value != value) return true;
|
||
// Array#indexOf ignores holes, Array#includes - not
|
||
} else for (;length > index; index++) {
|
||
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
||
} return !IS_INCLUDES && -1;
|
||
};
|
||
};
|
||
|
||
module.exports = {
|
||
// `Array.prototype.includes` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
|
||
includes: createMethod(true),
|
||
// `Array.prototype.indexOf` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
|
||
indexOf: createMethod(false)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 83 */
|
||
/***/ (function(module, exports) {
|
||
|
||
// IE8- don't enum bug keys
|
||
module.exports = [
|
||
'constructor',
|
||
'hasOwnProperty',
|
||
'isPrototypeOf',
|
||
'propertyIsEnumerable',
|
||
'toLocaleString',
|
||
'toString',
|
||
'valueOf'
|
||
];
|
||
|
||
|
||
/***/ }),
|
||
/* 84 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionTypes", function() { return ActionTypes; });
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return createStore; });
|
||
/* harmony import */ var lodash_es_isPlainObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(129);
|
||
/* harmony import */ var symbol_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(302);
|
||
|
||
|
||
|
||
/**
|
||
* These are private action types reserved by Redux.
|
||
* For any unknown actions, you must return the current state.
|
||
* If the current state is undefined, you must return the initial state.
|
||
* Do not reference these action types directly in your code.
|
||
*/
|
||
var ActionTypes = {
|
||
INIT: '@@redux/INIT'
|
||
};
|
||
|
||
/**
|
||
* Creates a Redux store that holds the state tree.
|
||
* The only way to change the data in the store is to call `dispatch()` on it.
|
||
*
|
||
* There should only be a single store in your app. To specify how different
|
||
* parts of the state tree respond to actions, you may combine several reducers
|
||
* into a single reducer function by using `combineReducers`.
|
||
*
|
||
* @param {Function} reducer A function that returns the next state tree, given
|
||
* the current state tree and the action to handle.
|
||
*
|
||
* @param {any} [preloadedState] The initial state. You may optionally specify it
|
||
* to hydrate the state from the server in universal apps, or to restore a
|
||
* previously serialized user session.
|
||
* If you use `combineReducers` to produce the root reducer function, this must be
|
||
* an object with the same shape as `combineReducers` keys.
|
||
*
|
||
* @param {Function} enhancer The store enhancer. You may optionally specify it
|
||
* to enhance the store with third-party capabilities such as middleware,
|
||
* time travel, persistence, etc. The only store enhancer that ships with Redux
|
||
* is `applyMiddleware()`.
|
||
*
|
||
* @returns {Store} A Redux store that lets you read the state, dispatch actions
|
||
* and subscribe to changes.
|
||
*/
|
||
function createStore(reducer, preloadedState, enhancer) {
|
||
var _ref2;
|
||
|
||
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
||
enhancer = preloadedState;
|
||
preloadedState = undefined;
|
||
}
|
||
|
||
if (typeof enhancer !== 'undefined') {
|
||
if (typeof enhancer !== 'function') {
|
||
throw new Error('Expected the enhancer to be a function.');
|
||
}
|
||
|
||
return enhancer(createStore)(reducer, preloadedState);
|
||
}
|
||
|
||
if (typeof reducer !== 'function') {
|
||
throw new Error('Expected the reducer to be a function.');
|
||
}
|
||
|
||
var currentReducer = reducer;
|
||
var currentState = preloadedState;
|
||
var currentListeners = [];
|
||
var nextListeners = currentListeners;
|
||
var isDispatching = false;
|
||
|
||
function ensureCanMutateNextListeners() {
|
||
if (nextListeners === currentListeners) {
|
||
nextListeners = currentListeners.slice();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Reads the state tree managed by the store.
|
||
*
|
||
* @returns {any} The current state tree of your application.
|
||
*/
|
||
function getState() {
|
||
return currentState;
|
||
}
|
||
|
||
/**
|
||
* Adds a change listener. It will be called any time an action is dispatched,
|
||
* and some part of the state tree may potentially have changed. You may then
|
||
* call `getState()` to read the current state tree inside the callback.
|
||
*
|
||
* You may call `dispatch()` from a change listener, with the following
|
||
* caveats:
|
||
*
|
||
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
||
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
||
* will not have any effect on the `dispatch()` that is currently in progress.
|
||
* However, the next `dispatch()` call, whether nested or not, will use a more
|
||
* recent snapshot of the subscription list.
|
||
*
|
||
* 2. The listener should not expect to see all state changes, as the state
|
||
* might have been updated multiple times during a nested `dispatch()` before
|
||
* the listener is called. It is, however, guaranteed that all subscribers
|
||
* registered before the `dispatch()` started will be called with the latest
|
||
* state by the time it exits.
|
||
*
|
||
* @param {Function} listener A callback to be invoked on every dispatch.
|
||
* @returns {Function} A function to remove this change listener.
|
||
*/
|
||
function subscribe(listener) {
|
||
if (typeof listener !== 'function') {
|
||
throw new Error('Expected listener to be a function.');
|
||
}
|
||
|
||
var isSubscribed = true;
|
||
|
||
ensureCanMutateNextListeners();
|
||
nextListeners.push(listener);
|
||
|
||
return function unsubscribe() {
|
||
if (!isSubscribed) {
|
||
return;
|
||
}
|
||
|
||
isSubscribed = false;
|
||
|
||
ensureCanMutateNextListeners();
|
||
var index = nextListeners.indexOf(listener);
|
||
nextListeners.splice(index, 1);
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Dispatches an action. It is the only way to trigger a state change.
|
||
*
|
||
* The `reducer` function, used to create the store, will be called with the
|
||
* current state tree and the given `action`. Its return value will
|
||
* be considered the **next** state of the tree, and the change listeners
|
||
* will be notified.
|
||
*
|
||
* The base implementation only supports plain object actions. If you want to
|
||
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
||
* wrap your store creating function into the corresponding middleware. For
|
||
* example, see the documentation for the `redux-thunk` package. Even the
|
||
* middleware will eventually dispatch plain object actions using this method.
|
||
*
|
||
* @param {Object} action A plain object representing “what changed”. It is
|
||
* a good idea to keep actions serializable so you can record and replay user
|
||
* sessions, or use the time travelling `redux-devtools`. An action must have
|
||
* a `type` property which may not be `undefined`. It is a good idea to use
|
||
* string constants for action types.
|
||
*
|
||
* @returns {Object} For convenience, the same action object you dispatched.
|
||
*
|
||
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
||
* return something else (for example, a Promise you can await).
|
||
*/
|
||
function dispatch(action) {
|
||
if (!Object(lodash_es_isPlainObject__WEBPACK_IMPORTED_MODULE_0__["default"])(action)) {
|
||
throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
|
||
}
|
||
|
||
if (typeof action.type === 'undefined') {
|
||
throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
|
||
}
|
||
|
||
if (isDispatching) {
|
||
throw new Error('Reducers may not dispatch actions.');
|
||
}
|
||
|
||
try {
|
||
isDispatching = true;
|
||
currentState = currentReducer(currentState, action);
|
||
} finally {
|
||
isDispatching = false;
|
||
}
|
||
|
||
var listeners = currentListeners = nextListeners;
|
||
for (var i = 0; i < listeners.length; i++) {
|
||
listeners[i]();
|
||
}
|
||
|
||
return action;
|
||
}
|
||
|
||
/**
|
||
* Replaces the reducer currently used by the store to calculate the state.
|
||
*
|
||
* You might need this if your app implements code splitting and you want to
|
||
* load some of the reducers dynamically. You might also need this if you
|
||
* implement a hot reloading mechanism for Redux.
|
||
*
|
||
* @param {Function} nextReducer The reducer for the store to use instead.
|
||
* @returns {void}
|
||
*/
|
||
function replaceReducer(nextReducer) {
|
||
if (typeof nextReducer !== 'function') {
|
||
throw new Error('Expected the nextReducer to be a function.');
|
||
}
|
||
|
||
currentReducer = nextReducer;
|
||
dispatch({ type: ActionTypes.INIT });
|
||
}
|
||
|
||
/**
|
||
* Interoperability point for observable/reactive libraries.
|
||
* @returns {observable} A minimal observable of state changes.
|
||
* For more information, see the observable proposal:
|
||
* https://github.com/zenparsing/es-observable
|
||
*/
|
||
function observable() {
|
||
var _ref;
|
||
|
||
var outerSubscribe = subscribe;
|
||
return _ref = {
|
||
/**
|
||
* The minimal observable subscription method.
|
||
* @param {Object} observer Any object that can be used as an observer.
|
||
* The observer object should have a `next` method.
|
||
* @returns {subscription} An object with an `unsubscribe` method that can
|
||
* be used to unsubscribe the observable from the store, and prevent further
|
||
* emission of values from the observable.
|
||
*/
|
||
subscribe: function subscribe(observer) {
|
||
if (typeof observer !== 'object') {
|
||
throw new TypeError('Expected the observer to be an object.');
|
||
}
|
||
|
||
function observeState() {
|
||
if (observer.next) {
|
||
observer.next(getState());
|
||
}
|
||
}
|
||
|
||
observeState();
|
||
var unsubscribe = outerSubscribe(observeState);
|
||
return { unsubscribe: unsubscribe };
|
||
}
|
||
}, _ref[symbol_observable__WEBPACK_IMPORTED_MODULE_1__["default"]] = function () {
|
||
return this;
|
||
}, _ref;
|
||
}
|
||
|
||
// When a store is created, an "INIT" action is dispatched so that every
|
||
// reducer returns their initial state. This effectively populates
|
||
// the initial state tree.
|
||
dispatch({ type: ActionTypes.INIT });
|
||
|
||
return _ref2 = {
|
||
dispatch: dispatch,
|
||
subscribe: subscribe,
|
||
getState: getState,
|
||
replaceReducer: replaceReducer
|
||
}, _ref2[symbol_observable__WEBPACK_IMPORTED_MODULE_1__["default"]] = observable, _ref2;
|
||
}
|
||
|
||
/***/ }),
|
||
/* 85 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return compose; });
|
||
/**
|
||
* Composes single-argument functions from right to left. The rightmost
|
||
* function can take multiple arguments as it provides the signature for
|
||
* the resulting composite function.
|
||
*
|
||
* @param {...Function} funcs The functions to compose.
|
||
* @returns {Function} A function obtained by composing the argument functions
|
||
* from right to left. For example, compose(f, g, h) is identical to doing
|
||
* (...args) => f(g(h(...args))).
|
||
*/
|
||
|
||
function compose() {
|
||
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
||
funcs[_key] = arguments[_key];
|
||
}
|
||
|
||
if (funcs.length === 0) {
|
||
return function (arg) {
|
||
return arg;
|
||
};
|
||
}
|
||
|
||
if (funcs.length === 1) {
|
||
return funcs[0];
|
||
}
|
||
|
||
var last = funcs[funcs.length - 1];
|
||
var rest = funcs.slice(0, -1);
|
||
return function () {
|
||
return rest.reduceRight(function (composed, f) {
|
||
return f(composed);
|
||
}, last.apply(undefined, arguments));
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
/* 86 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.TRANSFORM_STYLE_PREFIXED = exports.TRANSFORM_PREFIXED = exports.FLEX_PREFIXED = exports.ELEMENT_MATCHES = exports.withBrowser = exports.IS_BROWSER_ENV = void 0;
|
||
|
||
var _find = _interopRequireDefault(__webpack_require__(136));
|
||
/* eslint-env browser */
|
||
|
||
|
||
var IS_BROWSER_ENV = typeof window !== 'undefined'; // $FlowFixMe
|
||
|
||
exports.IS_BROWSER_ENV = IS_BROWSER_ENV;
|
||
|
||
var withBrowser = function withBrowser(fn, fallback) {
|
||
if (IS_BROWSER_ENV) {
|
||
return fn();
|
||
}
|
||
|
||
return fallback;
|
||
};
|
||
|
||
exports.withBrowser = withBrowser;
|
||
var ELEMENT_MATCHES = withBrowser(function () {
|
||
return (0, _find["default"])(['matches', 'matchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector', 'webkitMatchesSelector'], function (key) {
|
||
return key in Element.prototype;
|
||
});
|
||
});
|
||
exports.ELEMENT_MATCHES = ELEMENT_MATCHES;
|
||
var FLEX_PREFIXED = withBrowser(function () {
|
||
var el = document.createElement('i');
|
||
var values = ['flex', '-webkit-flex', '-ms-flexbox', '-moz-box', '-webkit-box'];
|
||
var none = '';
|
||
|
||
try {
|
||
var length = values.length;
|
||
|
||
for (var i = 0; i < length; i++) {
|
||
var value = values[i];
|
||
el.style.display = value;
|
||
|
||
if (el.style.display === value) {
|
||
return value;
|
||
}
|
||
}
|
||
|
||
return none;
|
||
} catch (err) {
|
||
return none;
|
||
}
|
||
}, 'flex');
|
||
exports.FLEX_PREFIXED = FLEX_PREFIXED;
|
||
var TRANSFORM_PREFIXED = withBrowser(function () {
|
||
var el = document.createElement('i');
|
||
|
||
if (el.style.transform == null) {
|
||
var prefixes = ['Webkit', 'Moz', 'ms'];
|
||
var suffix = 'Transform';
|
||
var length = prefixes.length;
|
||
|
||
for (var i = 0; i < length; i++) {
|
||
var prop = prefixes[i] + suffix; // $FlowFixMe
|
||
|
||
if (el.style[prop] !== undefined) {
|
||
return prop;
|
||
}
|
||
}
|
||
}
|
||
|
||
return 'transform';
|
||
}, 'transform'); // $FlowFixMe
|
||
|
||
exports.TRANSFORM_PREFIXED = TRANSFORM_PREFIXED;
|
||
var TRANSFORM_PREFIX = TRANSFORM_PREFIXED.split('transform')[0];
|
||
var TRANSFORM_STYLE_PREFIXED = TRANSFORM_PREFIX ? TRANSFORM_PREFIX + 'TransformStyle' : 'transformStyle';
|
||
exports.TRANSFORM_STYLE_PREFIXED = TRANSFORM_STYLE_PREFIXED;
|
||
|
||
/***/ }),
|
||
/* 87 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.mediaQueriesDefined = exports.viewportWidthChanged = exports.actionListPlaybackChanged = exports.elementStateChanged = exports.instanceRemoved = exports.instanceStarted = exports.instanceAdded = exports.parameterChanged = exports.animationFrameChanged = exports.eventStateChanged = exports.testFrameRendered = exports.eventListenerAdded = exports.clearRequested = exports.stopRequested = exports.playbackRequested = exports.previewRequested = exports.sessionStopped = exports.sessionStarted = exports.sessionInitialized = exports.rawDataImported = void 0;
|
||
|
||
var _extends2 = _interopRequireDefault(__webpack_require__(31));
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _shared = __webpack_require__(30);
|
||
|
||
var _constants$IX2EngineA = _constants.IX2EngineActionTypes,
|
||
IX2_RAW_DATA_IMPORTED = _constants$IX2EngineA.IX2_RAW_DATA_IMPORTED,
|
||
IX2_SESSION_INITIALIZED = _constants$IX2EngineA.IX2_SESSION_INITIALIZED,
|
||
IX2_SESSION_STARTED = _constants$IX2EngineA.IX2_SESSION_STARTED,
|
||
IX2_SESSION_STOPPED = _constants$IX2EngineA.IX2_SESSION_STOPPED,
|
||
IX2_PREVIEW_REQUESTED = _constants$IX2EngineA.IX2_PREVIEW_REQUESTED,
|
||
IX2_PLAYBACK_REQUESTED = _constants$IX2EngineA.IX2_PLAYBACK_REQUESTED,
|
||
IX2_STOP_REQUESTED = _constants$IX2EngineA.IX2_STOP_REQUESTED,
|
||
IX2_CLEAR_REQUESTED = _constants$IX2EngineA.IX2_CLEAR_REQUESTED,
|
||
IX2_EVENT_LISTENER_ADDED = _constants$IX2EngineA.IX2_EVENT_LISTENER_ADDED,
|
||
IX2_TEST_FRAME_RENDERED = _constants$IX2EngineA.IX2_TEST_FRAME_RENDERED,
|
||
IX2_EVENT_STATE_CHANGED = _constants$IX2EngineA.IX2_EVENT_STATE_CHANGED,
|
||
IX2_ANIMATION_FRAME_CHANGED = _constants$IX2EngineA.IX2_ANIMATION_FRAME_CHANGED,
|
||
IX2_PARAMETER_CHANGED = _constants$IX2EngineA.IX2_PARAMETER_CHANGED,
|
||
IX2_INSTANCE_ADDED = _constants$IX2EngineA.IX2_INSTANCE_ADDED,
|
||
IX2_INSTANCE_STARTED = _constants$IX2EngineA.IX2_INSTANCE_STARTED,
|
||
IX2_INSTANCE_REMOVED = _constants$IX2EngineA.IX2_INSTANCE_REMOVED,
|
||
IX2_ELEMENT_STATE_CHANGED = _constants$IX2EngineA.IX2_ELEMENT_STATE_CHANGED,
|
||
IX2_ACTION_LIST_PLAYBACK_CHANGED = _constants$IX2EngineA.IX2_ACTION_LIST_PLAYBACK_CHANGED,
|
||
IX2_VIEWPORT_WIDTH_CHANGED = _constants$IX2EngineA.IX2_VIEWPORT_WIDTH_CHANGED,
|
||
IX2_MEDIA_QUERIES_DEFINED = _constants$IX2EngineA.IX2_MEDIA_QUERIES_DEFINED;
|
||
var reifyState = _shared.IX2VanillaUtils.reifyState; // TODO: Figure out what this is and elevate it
|
||
|
||
var rawDataImported = function rawDataImported(rawData) {
|
||
return {
|
||
type: IX2_RAW_DATA_IMPORTED,
|
||
payload: (0, _extends2["default"])({}, reifyState(rawData))
|
||
};
|
||
};
|
||
|
||
exports.rawDataImported = rawDataImported;
|
||
|
||
var sessionInitialized = function sessionInitialized(_ref) {
|
||
var hasBoundaryNodes = _ref.hasBoundaryNodes,
|
||
reducedMotion = _ref.reducedMotion;
|
||
return {
|
||
type: IX2_SESSION_INITIALIZED,
|
||
payload: {
|
||
hasBoundaryNodes: hasBoundaryNodes,
|
||
reducedMotion: reducedMotion
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.sessionInitialized = sessionInitialized;
|
||
|
||
var sessionStarted = function sessionStarted() {
|
||
return {
|
||
type: IX2_SESSION_STARTED
|
||
};
|
||
};
|
||
|
||
exports.sessionStarted = sessionStarted;
|
||
|
||
var sessionStopped = function sessionStopped() {
|
||
return {
|
||
type: IX2_SESSION_STOPPED
|
||
};
|
||
};
|
||
|
||
exports.sessionStopped = sessionStopped;
|
||
|
||
var previewRequested = function previewRequested(_ref2) {
|
||
var rawData = _ref2.rawData,
|
||
defer = _ref2.defer;
|
||
return {
|
||
type: IX2_PREVIEW_REQUESTED,
|
||
payload: {
|
||
defer: defer,
|
||
rawData: rawData
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.previewRequested = previewRequested;
|
||
|
||
var playbackRequested = function playbackRequested(_ref3) {
|
||
var _ref3$actionTypeId = _ref3.actionTypeId,
|
||
actionTypeId = _ref3$actionTypeId === void 0 ? _constants.ActionTypeConsts.GENERAL_START_ACTION : _ref3$actionTypeId,
|
||
actionListId = _ref3.actionListId,
|
||
actionItemId = _ref3.actionItemId,
|
||
eventId = _ref3.eventId,
|
||
allowEvents = _ref3.allowEvents,
|
||
immediate = _ref3.immediate,
|
||
testManual = _ref3.testManual,
|
||
verbose = _ref3.verbose,
|
||
rawData = _ref3.rawData;
|
||
return {
|
||
type: IX2_PLAYBACK_REQUESTED,
|
||
payload: {
|
||
actionTypeId: actionTypeId,
|
||
actionListId: actionListId,
|
||
actionItemId: actionItemId,
|
||
testManual: testManual,
|
||
eventId: eventId,
|
||
allowEvents: allowEvents,
|
||
immediate: immediate,
|
||
verbose: verbose,
|
||
rawData: rawData
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.playbackRequested = playbackRequested;
|
||
|
||
var stopRequested = function stopRequested(actionListId) {
|
||
return {
|
||
type: IX2_STOP_REQUESTED,
|
||
payload: {
|
||
actionListId: actionListId
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.stopRequested = stopRequested;
|
||
|
||
var clearRequested = function clearRequested() {
|
||
return {
|
||
type: IX2_CLEAR_REQUESTED
|
||
};
|
||
};
|
||
|
||
exports.clearRequested = clearRequested;
|
||
|
||
var eventListenerAdded = function eventListenerAdded(target, listenerParams) {
|
||
return {
|
||
type: IX2_EVENT_LISTENER_ADDED,
|
||
payload: {
|
||
target: target,
|
||
listenerParams: listenerParams
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.eventListenerAdded = eventListenerAdded;
|
||
|
||
var testFrameRendered = function testFrameRendered() {
|
||
var step = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
||
return {
|
||
type: IX2_TEST_FRAME_RENDERED,
|
||
payload: {
|
||
step: step
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.testFrameRendered = testFrameRendered;
|
||
|
||
var eventStateChanged = function eventStateChanged(stateKey, newState) {
|
||
return {
|
||
type: IX2_EVENT_STATE_CHANGED,
|
||
payload: {
|
||
stateKey: stateKey,
|
||
newState: newState
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.eventStateChanged = eventStateChanged;
|
||
|
||
var animationFrameChanged = function animationFrameChanged(now, parameters) {
|
||
return {
|
||
type: IX2_ANIMATION_FRAME_CHANGED,
|
||
payload: {
|
||
now: now,
|
||
parameters: parameters
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.animationFrameChanged = animationFrameChanged;
|
||
|
||
var parameterChanged = function parameterChanged(key, value) {
|
||
return {
|
||
type: IX2_PARAMETER_CHANGED,
|
||
payload: {
|
||
key: key,
|
||
value: value
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.parameterChanged = parameterChanged;
|
||
|
||
var instanceAdded = function instanceAdded(options) {
|
||
return {
|
||
type: IX2_INSTANCE_ADDED,
|
||
payload: (0, _extends2["default"])({}, options)
|
||
};
|
||
};
|
||
|
||
exports.instanceAdded = instanceAdded;
|
||
|
||
var instanceStarted = function instanceStarted(instanceId, time) {
|
||
return {
|
||
type: IX2_INSTANCE_STARTED,
|
||
payload: {
|
||
instanceId: instanceId,
|
||
time: time
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.instanceStarted = instanceStarted;
|
||
|
||
var instanceRemoved = function instanceRemoved(instanceId) {
|
||
return {
|
||
type: IX2_INSTANCE_REMOVED,
|
||
payload: {
|
||
instanceId: instanceId
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.instanceRemoved = instanceRemoved;
|
||
|
||
var elementStateChanged = function elementStateChanged(elementId, actionTypeId, current, actionItem) {
|
||
return {
|
||
type: IX2_ELEMENT_STATE_CHANGED,
|
||
payload: {
|
||
elementId: elementId,
|
||
actionTypeId: actionTypeId,
|
||
current: current,
|
||
actionItem: actionItem
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.elementStateChanged = elementStateChanged;
|
||
|
||
var actionListPlaybackChanged = function actionListPlaybackChanged(_ref4) {
|
||
var actionListId = _ref4.actionListId,
|
||
isPlaying = _ref4.isPlaying;
|
||
return {
|
||
type: IX2_ACTION_LIST_PLAYBACK_CHANGED,
|
||
payload: {
|
||
actionListId: actionListId,
|
||
isPlaying: isPlaying
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.actionListPlaybackChanged = actionListPlaybackChanged;
|
||
|
||
var viewportWidthChanged = function viewportWidthChanged(_ref5) {
|
||
var width = _ref5.width,
|
||
mediaQueries = _ref5.mediaQueries;
|
||
return {
|
||
type: IX2_VIEWPORT_WIDTH_CHANGED,
|
||
payload: {
|
||
width: width,
|
||
mediaQueries: mediaQueries
|
||
}
|
||
};
|
||
};
|
||
|
||
exports.viewportWidthChanged = viewportWidthChanged;
|
||
|
||
var mediaQueriesDefined = function mediaQueriesDefined() {
|
||
return {
|
||
type: IX2_MEDIA_QUERIES_DEFINED
|
||
};
|
||
};
|
||
|
||
exports.mediaQueriesDefined = mediaQueriesDefined;
|
||
|
||
/***/ }),
|
||
/* 88 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseCreate = __webpack_require__(149),
|
||
baseLodash = __webpack_require__(89);
|
||
|
||
/**
|
||
* The base constructor for creating `lodash` wrapper objects.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to wrap.
|
||
* @param {boolean} [chainAll] Enable explicit method chain sequences.
|
||
*/
|
||
function LodashWrapper(value, chainAll) {
|
||
this.__wrapped__ = value;
|
||
this.__actions__ = [];
|
||
this.__chain__ = !!chainAll;
|
||
this.__index__ = 0;
|
||
this.__values__ = undefined;
|
||
}
|
||
|
||
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
|
||
LodashWrapper.prototype.constructor = LodashWrapper;
|
||
|
||
module.exports = LodashWrapper;
|
||
|
||
|
||
/***/ }),
|
||
/* 89 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The function whose prototype chain sequence wrappers inherit from.
|
||
*
|
||
* @private
|
||
*/
|
||
function baseLodash() {
|
||
// No operation performed.
|
||
}
|
||
|
||
module.exports = baseLodash;
|
||
|
||
|
||
/***/ }),
|
||
/* 90 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseCreate = __webpack_require__(149),
|
||
baseLodash = __webpack_require__(89);
|
||
|
||
/** Used as references for the maximum length and index of an array. */
|
||
var MAX_ARRAY_LENGTH = 4294967295;
|
||
|
||
/**
|
||
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
|
||
*
|
||
* @private
|
||
* @constructor
|
||
* @param {*} value The value to wrap.
|
||
*/
|
||
function LazyWrapper(value) {
|
||
this.__wrapped__ = value;
|
||
this.__actions__ = [];
|
||
this.__dir__ = 1;
|
||
this.__filtered__ = false;
|
||
this.__iteratees__ = [];
|
||
this.__takeCount__ = MAX_ARRAY_LENGTH;
|
||
this.__views__ = [];
|
||
}
|
||
|
||
// Ensure `LazyWrapper` is an instance of `baseLodash`.
|
||
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
|
||
LazyWrapper.prototype.constructor = LazyWrapper;
|
||
|
||
module.exports = LazyWrapper;
|
||
|
||
|
||
/***/ }),
|
||
/* 91 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* eslint-disable eslint-comments/no-unlimited-disable */
|
||
|
||
/* eslint-disable */
|
||
|
||
/*!
|
||
* tram.js v0.8.2-global
|
||
* Cross-browser CSS3 transitions in JavaScript
|
||
* https://github.com/bkwld/tram
|
||
* MIT License
|
||
*/
|
||
|
||
/* prettier-ignore */
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
var _typeof2 = _interopRequireDefault(__webpack_require__(41));
|
||
|
||
window.tram = function (a) {
|
||
function b(a, b) {
|
||
var c = new M.Bare();
|
||
return c.init(a, b);
|
||
}
|
||
|
||
function c(a) {
|
||
return a.replace(/[A-Z]/g, function (a) {
|
||
return "-" + a.toLowerCase();
|
||
});
|
||
}
|
||
|
||
function d(a) {
|
||
var b = parseInt(a.slice(1), 16),
|
||
c = b >> 16 & 255,
|
||
d = b >> 8 & 255,
|
||
e = 255 & b;
|
||
return [c, d, e];
|
||
}
|
||
|
||
function e(a, b, c) {
|
||
return "#" + (1 << 24 | a << 16 | b << 8 | c).toString(16).slice(1);
|
||
}
|
||
|
||
function f() {}
|
||
|
||
function g(a, b) {
|
||
j("Type warning: Expected: [" + a + "] Got: [" + (0, _typeof2["default"])(b) + "] " + b);
|
||
}
|
||
|
||
function h(a, b, c) {
|
||
j("Units do not match [" + a + "]: " + b + ", " + c);
|
||
}
|
||
|
||
function i(a, b, c) {
|
||
if (void 0 !== b && (c = b), void 0 === a) return c;
|
||
var d = c;
|
||
return $.test(a) || !_.test(a) ? d = parseInt(a, 10) : _.test(a) && (d = 1e3 * parseFloat(a)), 0 > d && (d = 0), d === d ? d : c;
|
||
}
|
||
|
||
function j(a) {
|
||
U.debug && window && window.console.warn(a);
|
||
}
|
||
|
||
function k(a) {
|
||
for (var b = -1, c = a ? a.length : 0, d = []; ++b < c;) {
|
||
var e = a[b];
|
||
e && d.push(e);
|
||
}
|
||
|
||
return d;
|
||
}
|
||
|
||
var l = function (a, b, c) {
|
||
function d(a) {
|
||
return "object" == (0, _typeof2["default"])(a);
|
||
}
|
||
|
||
function e(a) {
|
||
return "function" == typeof a;
|
||
}
|
||
|
||
function f() {}
|
||
|
||
function g(h, i) {
|
||
function j() {
|
||
var a = new k();
|
||
return e(a.init) && a.init.apply(a, arguments), a;
|
||
}
|
||
|
||
function k() {}
|
||
|
||
i === c && (i = h, h = Object), j.Bare = k;
|
||
var l,
|
||
m = f[a] = h[a],
|
||
n = k[a] = j[a] = new f();
|
||
return n.constructor = j, j.mixin = function (b) {
|
||
return k[a] = j[a] = g(j, b)[a], j;
|
||
}, j.open = function (a) {
|
||
if (l = {}, e(a) ? l = a.call(j, n, m, j, h) : d(a) && (l = a), d(l)) for (var c in l) {
|
||
b.call(l, c) && (n[c] = l[c]);
|
||
}
|
||
return e(n.init) || (n.init = h), j;
|
||
}, j.open(i);
|
||
}
|
||
|
||
return g;
|
||
}("prototype", {}.hasOwnProperty),
|
||
m = {
|
||
ease: ["ease", function (a, b, c, d) {
|
||
var e = (a /= d) * a,
|
||
f = e * a;
|
||
return b + c * (-2.75 * f * e + 11 * e * e + -15.5 * f + 8 * e + .25 * a);
|
||
}],
|
||
"ease-in": ["ease-in", function (a, b, c, d) {
|
||
var e = (a /= d) * a,
|
||
f = e * a;
|
||
return b + c * (-1 * f * e + 3 * e * e + -3 * f + 2 * e);
|
||
}],
|
||
"ease-out": ["ease-out", function (a, b, c, d) {
|
||
var e = (a /= d) * a,
|
||
f = e * a;
|
||
return b + c * (.3 * f * e + -1.6 * e * e + 2.2 * f + -1.8 * e + 1.9 * a);
|
||
}],
|
||
"ease-in-out": ["ease-in-out", function (a, b, c, d) {
|
||
var e = (a /= d) * a,
|
||
f = e * a;
|
||
return b + c * (2 * f * e + -5 * e * e + 2 * f + 2 * e);
|
||
}],
|
||
linear: ["linear", function (a, b, c, d) {
|
||
return c * a / d + b;
|
||
}],
|
||
"ease-in-quad": ["cubic-bezier(0.550, 0.085, 0.680, 0.530)", function (a, b, c, d) {
|
||
return c * (a /= d) * a + b;
|
||
}],
|
||
"ease-out-quad": ["cubic-bezier(0.250, 0.460, 0.450, 0.940)", function (a, b, c, d) {
|
||
return -c * (a /= d) * (a - 2) + b;
|
||
}],
|
||
"ease-in-out-quad": ["cubic-bezier(0.455, 0.030, 0.515, 0.955)", function (a, b, c, d) {
|
||
return (a /= d / 2) < 1 ? c / 2 * a * a + b : -c / 2 * (--a * (a - 2) - 1) + b;
|
||
}],
|
||
"ease-in-cubic": ["cubic-bezier(0.550, 0.055, 0.675, 0.190)", function (a, b, c, d) {
|
||
return c * (a /= d) * a * a + b;
|
||
}],
|
||
"ease-out-cubic": ["cubic-bezier(0.215, 0.610, 0.355, 1)", function (a, b, c, d) {
|
||
return c * ((a = a / d - 1) * a * a + 1) + b;
|
||
}],
|
||
"ease-in-out-cubic": ["cubic-bezier(0.645, 0.045, 0.355, 1)", function (a, b, c, d) {
|
||
return (a /= d / 2) < 1 ? c / 2 * a * a * a + b : c / 2 * ((a -= 2) * a * a + 2) + b;
|
||
}],
|
||
"ease-in-quart": ["cubic-bezier(0.895, 0.030, 0.685, 0.220)", function (a, b, c, d) {
|
||
return c * (a /= d) * a * a * a + b;
|
||
}],
|
||
"ease-out-quart": ["cubic-bezier(0.165, 0.840, 0.440, 1)", function (a, b, c, d) {
|
||
return -c * ((a = a / d - 1) * a * a * a - 1) + b;
|
||
}],
|
||
"ease-in-out-quart": ["cubic-bezier(0.770, 0, 0.175, 1)", function (a, b, c, d) {
|
||
return (a /= d / 2) < 1 ? c / 2 * a * a * a * a + b : -c / 2 * ((a -= 2) * a * a * a - 2) + b;
|
||
}],
|
||
"ease-in-quint": ["cubic-bezier(0.755, 0.050, 0.855, 0.060)", function (a, b, c, d) {
|
||
return c * (a /= d) * a * a * a * a + b;
|
||
}],
|
||
"ease-out-quint": ["cubic-bezier(0.230, 1, 0.320, 1)", function (a, b, c, d) {
|
||
return c * ((a = a / d - 1) * a * a * a * a + 1) + b;
|
||
}],
|
||
"ease-in-out-quint": ["cubic-bezier(0.860, 0, 0.070, 1)", function (a, b, c, d) {
|
||
return (a /= d / 2) < 1 ? c / 2 * a * a * a * a * a + b : c / 2 * ((a -= 2) * a * a * a * a + 2) + b;
|
||
}],
|
||
"ease-in-sine": ["cubic-bezier(0.470, 0, 0.745, 0.715)", function (a, b, c, d) {
|
||
return -c * Math.cos(a / d * (Math.PI / 2)) + c + b;
|
||
}],
|
||
"ease-out-sine": ["cubic-bezier(0.390, 0.575, 0.565, 1)", function (a, b, c, d) {
|
||
return c * Math.sin(a / d * (Math.PI / 2)) + b;
|
||
}],
|
||
"ease-in-out-sine": ["cubic-bezier(0.445, 0.050, 0.550, 0.950)", function (a, b, c, d) {
|
||
return -c / 2 * (Math.cos(Math.PI * a / d) - 1) + b;
|
||
}],
|
||
"ease-in-expo": ["cubic-bezier(0.950, 0.050, 0.795, 0.035)", function (a, b, c, d) {
|
||
return 0 === a ? b : c * Math.pow(2, 10 * (a / d - 1)) + b;
|
||
}],
|
||
"ease-out-expo": ["cubic-bezier(0.190, 1, 0.220, 1)", function (a, b, c, d) {
|
||
return a === d ? b + c : c * (-Math.pow(2, -10 * a / d) + 1) + b;
|
||
}],
|
||
"ease-in-out-expo": ["cubic-bezier(1, 0, 0, 1)", function (a, b, c, d) {
|
||
return 0 === a ? b : a === d ? b + c : (a /= d / 2) < 1 ? c / 2 * Math.pow(2, 10 * (a - 1)) + b : c / 2 * (-Math.pow(2, -10 * --a) + 2) + b;
|
||
}],
|
||
"ease-in-circ": ["cubic-bezier(0.600, 0.040, 0.980, 0.335)", function (a, b, c, d) {
|
||
return -c * (Math.sqrt(1 - (a /= d) * a) - 1) + b;
|
||
}],
|
||
"ease-out-circ": ["cubic-bezier(0.075, 0.820, 0.165, 1)", function (a, b, c, d) {
|
||
return c * Math.sqrt(1 - (a = a / d - 1) * a) + b;
|
||
}],
|
||
"ease-in-out-circ": ["cubic-bezier(0.785, 0.135, 0.150, 0.860)", function (a, b, c, d) {
|
||
return (a /= d / 2) < 1 ? -c / 2 * (Math.sqrt(1 - a * a) - 1) + b : c / 2 * (Math.sqrt(1 - (a -= 2) * a) + 1) + b;
|
||
}],
|
||
"ease-in-back": ["cubic-bezier(0.600, -0.280, 0.735, 0.045)", function (a, b, c, d, e) {
|
||
return void 0 === e && (e = 1.70158), c * (a /= d) * a * ((e + 1) * a - e) + b;
|
||
}],
|
||
"ease-out-back": ["cubic-bezier(0.175, 0.885, 0.320, 1.275)", function (a, b, c, d, e) {
|
||
return void 0 === e && (e = 1.70158), c * ((a = a / d - 1) * a * ((e + 1) * a + e) + 1) + b;
|
||
}],
|
||
"ease-in-out-back": ["cubic-bezier(0.680, -0.550, 0.265, 1.550)", function (a, b, c, d, e) {
|
||
return void 0 === e && (e = 1.70158), (a /= d / 2) < 1 ? c / 2 * a * a * (((e *= 1.525) + 1) * a - e) + b : c / 2 * ((a -= 2) * a * (((e *= 1.525) + 1) * a + e) + 2) + b;
|
||
}]
|
||
},
|
||
n = {
|
||
"ease-in-back": "cubic-bezier(0.600, 0, 0.735, 0.045)",
|
||
"ease-out-back": "cubic-bezier(0.175, 0.885, 0.320, 1)",
|
||
"ease-in-out-back": "cubic-bezier(0.680, 0, 0.265, 1)"
|
||
},
|
||
o = document,
|
||
p = window,
|
||
q = "bkwld-tram",
|
||
r = /[\-\.0-9]/g,
|
||
s = /[A-Z]/,
|
||
t = "number",
|
||
u = /^(rgb|#)/,
|
||
v = /(em|cm|mm|in|pt|pc|px)$/,
|
||
w = /(em|cm|mm|in|pt|pc|px|%)$/,
|
||
x = /(deg|rad|turn)$/,
|
||
y = "unitless",
|
||
z = /(all|none) 0s ease 0s/,
|
||
A = /^(width|height)$/,
|
||
B = " ",
|
||
C = o.createElement("a"),
|
||
D = ["Webkit", "Moz", "O", "ms"],
|
||
E = ["-webkit-", "-moz-", "-o-", "-ms-"],
|
||
F = function F(a) {
|
||
if (a in C.style) return {
|
||
dom: a,
|
||
css: a
|
||
};
|
||
var b,
|
||
c,
|
||
d = "",
|
||
e = a.split("-");
|
||
|
||
for (b = 0; b < e.length; b++) {
|
||
d += e[b].charAt(0).toUpperCase() + e[b].slice(1);
|
||
}
|
||
|
||
for (b = 0; b < D.length; b++) {
|
||
if (c = D[b] + d, c in C.style) return {
|
||
dom: c,
|
||
css: E[b] + a
|
||
};
|
||
}
|
||
},
|
||
G = b.support = {
|
||
bind: Function.prototype.bind,
|
||
transform: F("transform"),
|
||
transition: F("transition"),
|
||
backface: F("backface-visibility"),
|
||
timing: F("transition-timing-function")
|
||
};
|
||
|
||
if (G.transition) {
|
||
var H = G.timing.dom;
|
||
if (C.style[H] = m["ease-in-back"][0], !C.style[H]) for (var I in n) {
|
||
m[I][0] = n[I];
|
||
}
|
||
}
|
||
|
||
var J = b.frame = function () {
|
||
var a = p.requestAnimationFrame || p.webkitRequestAnimationFrame || p.mozRequestAnimationFrame || p.oRequestAnimationFrame || p.msRequestAnimationFrame;
|
||
return a && G.bind ? a.bind(p) : function (a) {
|
||
p.setTimeout(a, 16);
|
||
};
|
||
}(),
|
||
K = b.now = function () {
|
||
var a = p.performance,
|
||
b = a && (a.now || a.webkitNow || a.msNow || a.mozNow);
|
||
return b && G.bind ? b.bind(a) : Date.now || function () {
|
||
return +new Date();
|
||
};
|
||
}(),
|
||
L = l(function (b) {
|
||
function d(a, b) {
|
||
var c = k(("" + a).split(B)),
|
||
d = c[0];
|
||
b = b || {};
|
||
var e = Y[d];
|
||
if (!e) return j("Unsupported property: " + d);
|
||
|
||
if (!b.weak || !this.props[d]) {
|
||
var f = e[0],
|
||
g = this.props[d];
|
||
return g || (g = this.props[d] = new f.Bare()), g.init(this.$el, c, e, b), g;
|
||
}
|
||
}
|
||
|
||
function e(a, b, c) {
|
||
if (a) {
|
||
var e = (0, _typeof2["default"])(a);
|
||
if (b || (this.timer && this.timer.destroy(), this.queue = [], this.active = !1), "number" == e && b) return this.timer = new S({
|
||
duration: a,
|
||
context: this,
|
||
complete: h
|
||
}), void (this.active = !0);
|
||
|
||
if ("string" == e && b) {
|
||
switch (a) {
|
||
case "hide":
|
||
o.call(this);
|
||
break;
|
||
|
||
case "stop":
|
||
l.call(this);
|
||
break;
|
||
|
||
case "redraw":
|
||
p.call(this);
|
||
break;
|
||
|
||
default:
|
||
d.call(this, a, c && c[1]);
|
||
}
|
||
|
||
return h.call(this);
|
||
}
|
||
|
||
if ("function" == e) return void a.call(this, this);
|
||
|
||
if ("object" == e) {
|
||
var f = 0;
|
||
u.call(this, a, function (a, b) {
|
||
a.span > f && (f = a.span), a.stop(), a.animate(b);
|
||
}, function (a) {
|
||
"wait" in a && (f = i(a.wait, 0));
|
||
}), t.call(this), f > 0 && (this.timer = new S({
|
||
duration: f,
|
||
context: this
|
||
}), this.active = !0, b && (this.timer.complete = h));
|
||
var g = this,
|
||
j = !1,
|
||
k = {};
|
||
J(function () {
|
||
u.call(g, a, function (a) {
|
||
a.active && (j = !0, k[a.name] = a.nextStyle);
|
||
}), j && g.$el.css(k);
|
||
});
|
||
}
|
||
}
|
||
}
|
||
|
||
function f(a) {
|
||
a = i(a, 0), this.active ? this.queue.push({
|
||
options: a
|
||
}) : (this.timer = new S({
|
||
duration: a,
|
||
context: this,
|
||
complete: h
|
||
}), this.active = !0);
|
||
}
|
||
|
||
function g(a) {
|
||
return this.active ? (this.queue.push({
|
||
options: a,
|
||
args: arguments
|
||
}), void (this.timer.complete = h)) : j("No active transition timer. Use start() or wait() before then().");
|
||
}
|
||
|
||
function h() {
|
||
if (this.timer && this.timer.destroy(), this.active = !1, this.queue.length) {
|
||
var a = this.queue.shift();
|
||
e.call(this, a.options, !0, a.args);
|
||
}
|
||
}
|
||
|
||
function l(a) {
|
||
this.timer && this.timer.destroy(), this.queue = [], this.active = !1;
|
||
var b;
|
||
"string" == typeof a ? (b = {}, b[a] = 1) : b = "object" == (0, _typeof2["default"])(a) && null != a ? a : this.props, u.call(this, b, v), t.call(this);
|
||
}
|
||
|
||
function m(a) {
|
||
l.call(this, a), u.call(this, a, w, x);
|
||
}
|
||
|
||
function n(a) {
|
||
"string" != typeof a && (a = "block"), this.el.style.display = a;
|
||
}
|
||
|
||
function o() {
|
||
l.call(this), this.el.style.display = "none";
|
||
}
|
||
|
||
function p() {
|
||
this.el.offsetHeight;
|
||
}
|
||
|
||
function r() {
|
||
l.call(this), a.removeData(this.el, q), this.$el = this.el = null;
|
||
}
|
||
|
||
function t() {
|
||
var a,
|
||
b,
|
||
c = [];
|
||
this.upstream && c.push(this.upstream);
|
||
|
||
for (a in this.props) {
|
||
b = this.props[a], b.active && c.push(b.string);
|
||
}
|
||
|
||
c = c.join(","), this.style !== c && (this.style = c, this.el.style[G.transition.dom] = c);
|
||
}
|
||
|
||
function u(a, b, e) {
|
||
var f,
|
||
g,
|
||
h,
|
||
i,
|
||
j = b !== v,
|
||
k = {};
|
||
|
||
for (f in a) {
|
||
h = a[f], f in Z ? (k.transform || (k.transform = {}), k.transform[f] = h) : (s.test(f) && (f = c(f)), f in Y ? k[f] = h : (i || (i = {}), i[f] = h));
|
||
}
|
||
|
||
for (f in k) {
|
||
if (h = k[f], g = this.props[f], !g) {
|
||
if (!j) continue;
|
||
g = d.call(this, f);
|
||
}
|
||
|
||
b.call(this, g, h);
|
||
}
|
||
|
||
e && i && e.call(this, i);
|
||
}
|
||
|
||
function v(a) {
|
||
a.stop();
|
||
}
|
||
|
||
function w(a, b) {
|
||
a.set(b);
|
||
}
|
||
|
||
function x(a) {
|
||
this.$el.css(a);
|
||
}
|
||
|
||
function y(a, c) {
|
||
b[a] = function () {
|
||
return this.children ? A.call(this, c, arguments) : (this.el && c.apply(this, arguments), this);
|
||
};
|
||
}
|
||
|
||
function A(a, b) {
|
||
var c,
|
||
d = this.children.length;
|
||
|
||
for (c = 0; d > c; c++) {
|
||
a.apply(this.children[c], b);
|
||
}
|
||
|
||
return this;
|
||
}
|
||
|
||
b.init = function (b) {
|
||
if (this.$el = a(b), this.el = this.$el[0], this.props = {}, this.queue = [], this.style = "", this.active = !1, U.keepInherited && !U.fallback) {
|
||
var c = W(this.el, "transition");
|
||
c && !z.test(c) && (this.upstream = c);
|
||
}
|
||
|
||
G.backface && U.hideBackface && V(this.el, G.backface.css, "hidden");
|
||
}, y("add", d), y("start", e), y("wait", f), y("then", g), y("next", h), y("stop", l), y("set", m), y("show", n), y("hide", o), y("redraw", p), y("destroy", r);
|
||
}),
|
||
M = l(L, function (b) {
|
||
function c(b, c) {
|
||
var d = a.data(b, q) || a.data(b, q, new L.Bare());
|
||
return d.el || d.init(b), c ? d.start(c) : d;
|
||
}
|
||
|
||
b.init = function (b, d) {
|
||
var e = a(b);
|
||
if (!e.length) return this;
|
||
if (1 === e.length) return c(e[0], d);
|
||
var f = [];
|
||
return e.each(function (a, b) {
|
||
f.push(c(b, d));
|
||
}), this.children = f, this;
|
||
};
|
||
}),
|
||
N = l(function (a) {
|
||
function b() {
|
||
var a = this.get();
|
||
this.update("auto");
|
||
var b = this.get();
|
||
return this.update(a), b;
|
||
}
|
||
|
||
function c(a, b, c) {
|
||
return void 0 !== b && (c = b), a in m ? a : c;
|
||
}
|
||
|
||
function d(a) {
|
||
var b = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(a);
|
||
return (b ? e(b[1], b[2], b[3]) : a).replace(/#(\w)(\w)(\w)$/, "#$1$1$2$2$3$3");
|
||
}
|
||
|
||
var f = {
|
||
duration: 500,
|
||
ease: "ease",
|
||
delay: 0
|
||
};
|
||
a.init = function (a, b, d, e) {
|
||
this.$el = a, this.el = a[0];
|
||
var g = b[0];
|
||
d[2] && (g = d[2]), X[g] && (g = X[g]), this.name = g, this.type = d[1], this.duration = i(b[1], this.duration, f.duration), this.ease = c(b[2], this.ease, f.ease), this.delay = i(b[3], this.delay, f.delay), this.span = this.duration + this.delay, this.active = !1, this.nextStyle = null, this.auto = A.test(this.name), this.unit = e.unit || this.unit || U.defaultUnit, this.angle = e.angle || this.angle || U.defaultAngle, U.fallback || e.fallback ? this.animate = this.fallback : (this.animate = this.transition, this.string = this.name + B + this.duration + "ms" + ("ease" != this.ease ? B + m[this.ease][0] : "") + (this.delay ? B + this.delay + "ms" : ""));
|
||
}, a.set = function (a) {
|
||
a = this.convert(a, this.type), this.update(a), this.redraw();
|
||
}, a.transition = function (a) {
|
||
this.active = !0, a = this.convert(a, this.type), this.auto && ("auto" == this.el.style[this.name] && (this.update(this.get()), this.redraw()), "auto" == a && (a = b.call(this))), this.nextStyle = a;
|
||
}, a.fallback = function (a) {
|
||
var c = this.el.style[this.name] || this.convert(this.get(), this.type);
|
||
a = this.convert(a, this.type), this.auto && ("auto" == c && (c = this.convert(this.get(), this.type)), "auto" == a && (a = b.call(this))), this.tween = new R({
|
||
from: c,
|
||
to: a,
|
||
duration: this.duration,
|
||
delay: this.delay,
|
||
ease: this.ease,
|
||
update: this.update,
|
||
context: this
|
||
});
|
||
}, a.get = function () {
|
||
return W(this.el, this.name);
|
||
}, a.update = function (a) {
|
||
V(this.el, this.name, a);
|
||
}, a.stop = function () {
|
||
(this.active || this.nextStyle) && (this.active = !1, this.nextStyle = null, V(this.el, this.name, this.get()));
|
||
var a = this.tween;
|
||
a && a.context && a.destroy();
|
||
}, a.convert = function (a, b) {
|
||
if ("auto" == a && this.auto) return a;
|
||
var c,
|
||
e = "number" == typeof a,
|
||
f = "string" == typeof a;
|
||
|
||
switch (b) {
|
||
case t:
|
||
if (e) return a;
|
||
if (f && "" === a.replace(r, "")) return +a;
|
||
c = "number(unitless)";
|
||
break;
|
||
|
||
case u:
|
||
if (f) {
|
||
if ("" === a && this.original) return this.original;
|
||
if (b.test(a)) return "#" == a.charAt(0) && 7 == a.length ? a : d(a);
|
||
}
|
||
|
||
c = "hex or rgb string";
|
||
break;
|
||
|
||
case v:
|
||
if (e) return a + this.unit;
|
||
if (f && b.test(a)) return a;
|
||
c = "number(px) or string(unit)";
|
||
break;
|
||
|
||
case w:
|
||
if (e) return a + this.unit;
|
||
if (f && b.test(a)) return a;
|
||
c = "number(px) or string(unit or %)";
|
||
break;
|
||
|
||
case x:
|
||
if (e) return a + this.angle;
|
||
if (f && b.test(a)) return a;
|
||
c = "number(deg) or string(angle)";
|
||
break;
|
||
|
||
case y:
|
||
if (e) return a;
|
||
if (f && w.test(a)) return a;
|
||
c = "number(unitless) or string(unit or %)";
|
||
}
|
||
|
||
return g(c, a), a;
|
||
}, a.redraw = function () {
|
||
this.el.offsetHeight;
|
||
};
|
||
}),
|
||
O = l(N, function (a, b) {
|
||
a.init = function () {
|
||
b.init.apply(this, arguments), this.original || (this.original = this.convert(this.get(), u));
|
||
};
|
||
}),
|
||
P = l(N, function (a, b) {
|
||
a.init = function () {
|
||
b.init.apply(this, arguments), this.animate = this.fallback;
|
||
}, a.get = function () {
|
||
return this.$el[this.name]();
|
||
}, a.update = function (a) {
|
||
this.$el[this.name](a);
|
||
};
|
||
}),
|
||
Q = l(N, function (a, b) {
|
||
function c(a, b) {
|
||
var c, d, e, f, g;
|
||
|
||
for (c in a) {
|
||
f = Z[c], e = f[0], d = f[1] || c, g = this.convert(a[c], e), b.call(this, d, g, e);
|
||
}
|
||
}
|
||
|
||
a.init = function () {
|
||
b.init.apply(this, arguments), this.current || (this.current = {}, Z.perspective && U.perspective && (this.current.perspective = U.perspective, V(this.el, this.name, this.style(this.current)), this.redraw()));
|
||
}, a.set = function (a) {
|
||
c.call(this, a, function (a, b) {
|
||
this.current[a] = b;
|
||
}), V(this.el, this.name, this.style(this.current)), this.redraw();
|
||
}, a.transition = function (a) {
|
||
var b = this.values(a);
|
||
this.tween = new T({
|
||
current: this.current,
|
||
values: b,
|
||
duration: this.duration,
|
||
delay: this.delay,
|
||
ease: this.ease
|
||
});
|
||
var c,
|
||
d = {};
|
||
|
||
for (c in this.current) {
|
||
d[c] = c in b ? b[c] : this.current[c];
|
||
}
|
||
|
||
this.active = !0, this.nextStyle = this.style(d);
|
||
}, a.fallback = function (a) {
|
||
var b = this.values(a);
|
||
this.tween = new T({
|
||
current: this.current,
|
||
values: b,
|
||
duration: this.duration,
|
||
delay: this.delay,
|
||
ease: this.ease,
|
||
update: this.update,
|
||
context: this
|
||
});
|
||
}, a.update = function () {
|
||
V(this.el, this.name, this.style(this.current));
|
||
}, a.style = function (a) {
|
||
var b,
|
||
c = "";
|
||
|
||
for (b in a) {
|
||
c += b + "(" + a[b] + ") ";
|
||
}
|
||
|
||
return c;
|
||
}, a.values = function (a) {
|
||
var b,
|
||
d = {};
|
||
return c.call(this, a, function (a, c, e) {
|
||
d[a] = c, void 0 === this.current[a] && (b = 0, ~a.indexOf("scale") && (b = 1), this.current[a] = this.convert(b, e));
|
||
}), d;
|
||
};
|
||
}),
|
||
R = l(function (b) {
|
||
function c(a) {
|
||
1 === n.push(a) && J(g);
|
||
}
|
||
|
||
function g() {
|
||
var a,
|
||
b,
|
||
c,
|
||
d = n.length;
|
||
if (d) for (J(g), b = K(), a = d; a--;) {
|
||
c = n[a], c && c.render(b);
|
||
}
|
||
}
|
||
|
||
function i(b) {
|
||
var c,
|
||
d = a.inArray(b, n);
|
||
d >= 0 && (c = n.slice(d + 1), n.length = d, c.length && (n = n.concat(c)));
|
||
}
|
||
|
||
function j(a) {
|
||
return Math.round(a * o) / o;
|
||
}
|
||
|
||
function k(a, b, c) {
|
||
return e(a[0] + c * (b[0] - a[0]), a[1] + c * (b[1] - a[1]), a[2] + c * (b[2] - a[2]));
|
||
}
|
||
|
||
var l = {
|
||
ease: m.ease[1],
|
||
from: 0,
|
||
to: 1
|
||
};
|
||
b.init = function (a) {
|
||
this.duration = a.duration || 0, this.delay = a.delay || 0;
|
||
var b = a.ease || l.ease;
|
||
m[b] && (b = m[b][1]), "function" != typeof b && (b = l.ease), this.ease = b, this.update = a.update || f, this.complete = a.complete || f, this.context = a.context || this, this.name = a.name;
|
||
var c = a.from,
|
||
d = a.to;
|
||
void 0 === c && (c = l.from), void 0 === d && (d = l.to), this.unit = a.unit || "", "number" == typeof c && "number" == typeof d ? (this.begin = c, this.change = d - c) : this.format(d, c), this.value = this.begin + this.unit, this.start = K(), a.autoplay !== !1 && this.play();
|
||
}, b.play = function () {
|
||
this.active || (this.start || (this.start = K()), this.active = !0, c(this));
|
||
}, b.stop = function () {
|
||
this.active && (this.active = !1, i(this));
|
||
}, b.render = function (a) {
|
||
var b,
|
||
c = a - this.start;
|
||
|
||
if (this.delay) {
|
||
if (c <= this.delay) return;
|
||
c -= this.delay;
|
||
}
|
||
|
||
if (c < this.duration) {
|
||
var d = this.ease(c, 0, 1, this.duration);
|
||
return b = this.startRGB ? k(this.startRGB, this.endRGB, d) : j(this.begin + d * this.change), this.value = b + this.unit, void this.update.call(this.context, this.value);
|
||
}
|
||
|
||
b = this.endHex || this.begin + this.change, this.value = b + this.unit, this.update.call(this.context, this.value), this.complete.call(this.context), this.destroy();
|
||
}, b.format = function (a, b) {
|
||
if (b += "", a += "", "#" == a.charAt(0)) return this.startRGB = d(b), this.endRGB = d(a), this.endHex = a, this.begin = 0, void (this.change = 1);
|
||
|
||
if (!this.unit) {
|
||
var c = b.replace(r, ""),
|
||
e = a.replace(r, "");
|
||
c !== e && h("tween", b, a), this.unit = c;
|
||
}
|
||
|
||
b = parseFloat(b), a = parseFloat(a), this.begin = this.value = b, this.change = a - b;
|
||
}, b.destroy = function () {
|
||
this.stop(), this.context = null, this.ease = this.update = this.complete = f;
|
||
};
|
||
var n = [],
|
||
o = 1e3;
|
||
}),
|
||
S = l(R, function (a) {
|
||
a.init = function (a) {
|
||
this.duration = a.duration || 0, this.complete = a.complete || f, this.context = a.context, this.play();
|
||
}, a.render = function (a) {
|
||
var b = a - this.start;
|
||
b < this.duration || (this.complete.call(this.context), this.destroy());
|
||
};
|
||
}),
|
||
T = l(R, function (a, b) {
|
||
a.init = function (a) {
|
||
this.context = a.context, this.update = a.update, this.tweens = [], this.current = a.current;
|
||
var b, c;
|
||
|
||
for (b in a.values) {
|
||
c = a.values[b], this.current[b] !== c && this.tweens.push(new R({
|
||
name: b,
|
||
from: this.current[b],
|
||
to: c,
|
||
duration: a.duration,
|
||
delay: a.delay,
|
||
ease: a.ease,
|
||
autoplay: !1
|
||
}));
|
||
}
|
||
|
||
this.play();
|
||
}, a.render = function (a) {
|
||
var b,
|
||
c,
|
||
d = this.tweens.length,
|
||
e = !1;
|
||
|
||
for (b = d; b--;) {
|
||
c = this.tweens[b], c.context && (c.render(a), this.current[c.name] = c.value, e = !0);
|
||
}
|
||
|
||
return e ? void (this.update && this.update.call(this.context)) : this.destroy();
|
||
}, a.destroy = function () {
|
||
if (b.destroy.call(this), this.tweens) {
|
||
var a,
|
||
c = this.tweens.length;
|
||
|
||
for (a = c; a--;) {
|
||
this.tweens[a].destroy();
|
||
}
|
||
|
||
this.tweens = null, this.current = null;
|
||
}
|
||
};
|
||
}),
|
||
U = b.config = {
|
||
debug: !1,
|
||
defaultUnit: "px",
|
||
defaultAngle: "deg",
|
||
keepInherited: !1,
|
||
hideBackface: !1,
|
||
perspective: "",
|
||
fallback: !G.transition,
|
||
agentTests: []
|
||
};
|
||
|
||
b.fallback = function (a) {
|
||
if (!G.transition) return U.fallback = !0;
|
||
U.agentTests.push("(" + a + ")");
|
||
var b = new RegExp(U.agentTests.join("|"), "i");
|
||
U.fallback = b.test(navigator.userAgent);
|
||
}, b.fallback("6.0.[2-5] Safari"), b.tween = function (a) {
|
||
return new R(a);
|
||
}, b.delay = function (a, b, c) {
|
||
return new S({
|
||
complete: b,
|
||
duration: a,
|
||
context: c
|
||
});
|
||
}, a.fn.tram = function (a) {
|
||
return b.call(null, this, a);
|
||
};
|
||
var V = a.style,
|
||
W = a.css,
|
||
X = {
|
||
transform: G.transform && G.transform.css
|
||
},
|
||
Y = {
|
||
color: [O, u],
|
||
background: [O, u, "background-color"],
|
||
"outline-color": [O, u],
|
||
"border-color": [O, u],
|
||
"border-top-color": [O, u],
|
||
"border-right-color": [O, u],
|
||
"border-bottom-color": [O, u],
|
||
"border-left-color": [O, u],
|
||
"border-width": [N, v],
|
||
"border-top-width": [N, v],
|
||
"border-right-width": [N, v],
|
||
"border-bottom-width": [N, v],
|
||
"border-left-width": [N, v],
|
||
"border-spacing": [N, v],
|
||
"letter-spacing": [N, v],
|
||
margin: [N, v],
|
||
"margin-top": [N, v],
|
||
"margin-right": [N, v],
|
||
"margin-bottom": [N, v],
|
||
"margin-left": [N, v],
|
||
padding: [N, v],
|
||
"padding-top": [N, v],
|
||
"padding-right": [N, v],
|
||
"padding-bottom": [N, v],
|
||
"padding-left": [N, v],
|
||
"outline-width": [N, v],
|
||
opacity: [N, t],
|
||
top: [N, w],
|
||
right: [N, w],
|
||
bottom: [N, w],
|
||
left: [N, w],
|
||
"font-size": [N, w],
|
||
"text-indent": [N, w],
|
||
"word-spacing": [N, w],
|
||
width: [N, w],
|
||
"min-width": [N, w],
|
||
"max-width": [N, w],
|
||
height: [N, w],
|
||
"min-height": [N, w],
|
||
"max-height": [N, w],
|
||
"line-height": [N, y],
|
||
"scroll-top": [P, t, "scrollTop"],
|
||
"scroll-left": [P, t, "scrollLeft"]
|
||
},
|
||
Z = {};
|
||
G.transform && (Y.transform = [Q], Z = {
|
||
x: [w, "translateX"],
|
||
y: [w, "translateY"],
|
||
rotate: [x],
|
||
rotateX: [x],
|
||
rotateY: [x],
|
||
scale: [t],
|
||
scaleX: [t],
|
||
scaleY: [t],
|
||
skew: [x],
|
||
skewX: [x],
|
||
skewY: [x]
|
||
}), G.transform && G.backface && (Z.z = [w, "translateZ"], Z.rotateZ = [x], Z.scaleZ = [t], Z.perspective = [v]);
|
||
var $ = /ms/,
|
||
_ = /s|\./;
|
||
return a.tram = b;
|
||
}(window.jQuery);
|
||
|
||
/***/ }),
|
||
/* 92 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseFindIndex = __webpack_require__(93),
|
||
baseIteratee = __webpack_require__(18),
|
||
toInteger = __webpack_require__(111);
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeMax = Math.max;
|
||
|
||
/**
|
||
* This method is like `_.find` except that it returns the index of the first
|
||
* element `predicate` returns truthy for instead of the element itself.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 1.1.0
|
||
* @category Array
|
||
* @param {Array} array The array to inspect.
|
||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||
* @param {number} [fromIndex=0] The index to search from.
|
||
* @returns {number} Returns the index of the found element, else `-1`.
|
||
* @example
|
||
*
|
||
* var users = [
|
||
* { 'user': 'barney', 'active': false },
|
||
* { 'user': 'fred', 'active': false },
|
||
* { 'user': 'pebbles', 'active': true }
|
||
* ];
|
||
*
|
||
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
||
* // => 0
|
||
*
|
||
* // The `_.matches` iteratee shorthand.
|
||
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
||
* // => 1
|
||
*
|
||
* // The `_.matchesProperty` iteratee shorthand.
|
||
* _.findIndex(users, ['active', false]);
|
||
* // => 0
|
||
*
|
||
* // The `_.property` iteratee shorthand.
|
||
* _.findIndex(users, 'active');
|
||
* // => 2
|
||
*/
|
||
function findIndex(array, predicate, fromIndex) {
|
||
var length = array == null ? 0 : array.length;
|
||
if (!length) {
|
||
return -1;
|
||
}
|
||
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
||
if (index < 0) {
|
||
index = nativeMax(length + index, 0);
|
||
}
|
||
return baseFindIndex(array, baseIteratee(predicate, 3), index);
|
||
}
|
||
|
||
module.exports = findIndex;
|
||
|
||
|
||
/***/ }),
|
||
/* 93 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
||
* support for iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Array} array The array to inspect.
|
||
* @param {Function} predicate The function invoked per iteration.
|
||
* @param {number} fromIndex The index to search from.
|
||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||
*/
|
||
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
||
var length = array.length,
|
||
index = fromIndex + (fromRight ? 1 : -1);
|
||
|
||
while ((fromRight ? index-- : ++index < length)) {
|
||
if (predicate(array[index], index, array)) {
|
||
return index;
|
||
}
|
||
}
|
||
return -1;
|
||
}
|
||
|
||
module.exports = baseFindIndex;
|
||
|
||
|
||
/***/ }),
|
||
/* 94 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var ListCache = __webpack_require__(42),
|
||
stackClear = __webpack_require__(165),
|
||
stackDelete = __webpack_require__(166),
|
||
stackGet = __webpack_require__(167),
|
||
stackHas = __webpack_require__(168),
|
||
stackSet = __webpack_require__(169);
|
||
|
||
/**
|
||
* Creates a stack cache object to store key-value pairs.
|
||
*
|
||
* @private
|
||
* @constructor
|
||
* @param {Array} [entries] The key-value pairs to cache.
|
||
*/
|
||
function Stack(entries) {
|
||
var data = this.__data__ = new ListCache(entries);
|
||
this.size = data.size;
|
||
}
|
||
|
||
// Add methods to `Stack`.
|
||
Stack.prototype.clear = stackClear;
|
||
Stack.prototype['delete'] = stackDelete;
|
||
Stack.prototype.get = stackGet;
|
||
Stack.prototype.has = stackHas;
|
||
Stack.prototype.set = stackSet;
|
||
|
||
module.exports = Stack;
|
||
|
||
|
||
/***/ }),
|
||
/* 95 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGetTag = __webpack_require__(25),
|
||
isObject = __webpack_require__(12);
|
||
|
||
/** `Object#toString` result references. */
|
||
var asyncTag = '[object AsyncFunction]',
|
||
funcTag = '[object Function]',
|
||
genTag = '[object GeneratorFunction]',
|
||
proxyTag = '[object Proxy]';
|
||
|
||
/**
|
||
* Checks if `value` is classified as a `Function` object.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
||
* @example
|
||
*
|
||
* _.isFunction(_);
|
||
* // => true
|
||
*
|
||
* _.isFunction(/abc/);
|
||
* // => false
|
||
*/
|
||
function isFunction(value) {
|
||
if (!isObject(value)) {
|
||
return false;
|
||
}
|
||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
||
var tag = baseGetTag(value);
|
||
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
||
}
|
||
|
||
module.exports = isFunction;
|
||
|
||
|
||
/***/ }),
|
||
/* 96 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
|
||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
||
|
||
module.exports = freeGlobal;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(44)))
|
||
|
||
/***/ }),
|
||
/* 97 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used for built-in method references. */
|
||
var funcProto = Function.prototype;
|
||
|
||
/** Used to resolve the decompiled source of functions. */
|
||
var funcToString = funcProto.toString;
|
||
|
||
/**
|
||
* Converts `func` to its source code.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to convert.
|
||
* @returns {string} Returns the source code.
|
||
*/
|
||
function toSource(func) {
|
||
if (func != null) {
|
||
try {
|
||
return funcToString.call(func);
|
||
} catch (e) {}
|
||
try {
|
||
return (func + '');
|
||
} catch (e) {}
|
||
}
|
||
return '';
|
||
}
|
||
|
||
module.exports = toSource;
|
||
|
||
|
||
/***/ }),
|
||
/* 98 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIsEqualDeep = __webpack_require__(188),
|
||
isObjectLike = __webpack_require__(20);
|
||
|
||
/**
|
||
* The base implementation of `_.isEqual` which supports partial comparisons
|
||
* and tracks traversed objects.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to compare.
|
||
* @param {*} other The other value to compare.
|
||
* @param {boolean} bitmask The bitmask flags.
|
||
* 1 - Unordered comparison
|
||
* 2 - Partial comparison
|
||
* @param {Function} [customizer] The function to customize comparisons.
|
||
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||
*/
|
||
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
||
if (value === other) {
|
||
return true;
|
||
}
|
||
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
||
return value !== value && other !== other;
|
||
}
|
||
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
||
}
|
||
|
||
module.exports = baseIsEqual;
|
||
|
||
|
||
/***/ }),
|
||
/* 99 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var SetCache = __webpack_require__(189),
|
||
arraySome = __webpack_require__(192),
|
||
cacheHas = __webpack_require__(193);
|
||
|
||
/** Used to compose bitmasks for value comparisons. */
|
||
var COMPARE_PARTIAL_FLAG = 1,
|
||
COMPARE_UNORDERED_FLAG = 2;
|
||
|
||
/**
|
||
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
||
* partial deep comparisons.
|
||
*
|
||
* @private
|
||
* @param {Array} array The array to compare.
|
||
* @param {Array} other The other array to compare.
|
||
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
||
* @param {Function} customizer The function to customize comparisons.
|
||
* @param {Function} equalFunc The function to determine equivalents of values.
|
||
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
||
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
||
*/
|
||
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
||
arrLength = array.length,
|
||
othLength = other.length;
|
||
|
||
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
||
return false;
|
||
}
|
||
// Check that cyclic values are equal.
|
||
var arrStacked = stack.get(array);
|
||
var othStacked = stack.get(other);
|
||
if (arrStacked && othStacked) {
|
||
return arrStacked == other && othStacked == array;
|
||
}
|
||
var index = -1,
|
||
result = true,
|
||
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
||
|
||
stack.set(array, other);
|
||
stack.set(other, array);
|
||
|
||
// Ignore non-index properties.
|
||
while (++index < arrLength) {
|
||
var arrValue = array[index],
|
||
othValue = other[index];
|
||
|
||
if (customizer) {
|
||
var compared = isPartial
|
||
? customizer(othValue, arrValue, index, other, array, stack)
|
||
: customizer(arrValue, othValue, index, array, other, stack);
|
||
}
|
||
if (compared !== undefined) {
|
||
if (compared) {
|
||
continue;
|
||
}
|
||
result = false;
|
||
break;
|
||
}
|
||
// Recursively compare arrays (susceptible to call stack limits).
|
||
if (seen) {
|
||
if (!arraySome(other, function(othValue, othIndex) {
|
||
if (!cacheHas(seen, othIndex) &&
|
||
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
||
return seen.push(othIndex);
|
||
}
|
||
})) {
|
||
result = false;
|
||
break;
|
||
}
|
||
} else if (!(
|
||
arrValue === othValue ||
|
||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
||
)) {
|
||
result = false;
|
||
break;
|
||
}
|
||
}
|
||
stack['delete'](array);
|
||
stack['delete'](other);
|
||
return result;
|
||
}
|
||
|
||
module.exports = equalArrays;
|
||
|
||
|
||
/***/ }),
|
||
/* 100 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayPush = __webpack_require__(60),
|
||
isArray = __webpack_require__(2);
|
||
|
||
/**
|
||
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
||
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
||
* symbols of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @param {Function} keysFunc The function to get the keys of `object`.
|
||
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
||
* @returns {Array} Returns the array of property names and symbols.
|
||
*/
|
||
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
||
var result = keysFunc(object);
|
||
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
||
}
|
||
|
||
module.exports = baseGetAllKeys;
|
||
|
||
|
||
/***/ }),
|
||
/* 101 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayFilter = __webpack_require__(200),
|
||
stubArray = __webpack_require__(102);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Built-in value references. */
|
||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
||
|
||
/**
|
||
* Creates an array of the own enumerable symbols of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of symbols.
|
||
*/
|
||
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
||
if (object == null) {
|
||
return [];
|
||
}
|
||
object = Object(object);
|
||
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
||
return propertyIsEnumerable.call(object, symbol);
|
||
});
|
||
};
|
||
|
||
module.exports = getSymbols;
|
||
|
||
|
||
/***/ }),
|
||
/* 102 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* This method returns a new empty array.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.13.0
|
||
* @category Util
|
||
* @returns {Array} Returns the new empty array.
|
||
* @example
|
||
*
|
||
* var arrays = _.times(2, _.stubArray);
|
||
*
|
||
* console.log(arrays);
|
||
* // => [[], []]
|
||
*
|
||
* console.log(arrays[0] === arrays[1]);
|
||
* // => false
|
||
*/
|
||
function stubArray() {
|
||
return [];
|
||
}
|
||
|
||
module.exports = stubArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 103 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseTimes = __webpack_require__(201),
|
||
isArguments = __webpack_require__(48),
|
||
isArray = __webpack_require__(2),
|
||
isBuffer = __webpack_require__(61),
|
||
isIndex = __webpack_require__(62),
|
||
isTypedArray = __webpack_require__(63);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Creates an array of the enumerable property names of the array-like `value`.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to query.
|
||
* @param {boolean} inherited Specify returning inherited property names.
|
||
* @returns {Array} Returns the array of property names.
|
||
*/
|
||
function arrayLikeKeys(value, inherited) {
|
||
var isArr = isArray(value),
|
||
isArg = !isArr && isArguments(value),
|
||
isBuff = !isArr && !isArg && isBuffer(value),
|
||
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
||
skipIndexes = isArr || isArg || isBuff || isType,
|
||
result = skipIndexes ? baseTimes(value.length, String) : [],
|
||
length = result.length;
|
||
|
||
for (var key in value) {
|
||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||
!(skipIndexes && (
|
||
// Safari 9 has enumerable `arguments.length` in strict mode.
|
||
key == 'length' ||
|
||
// Node.js 0.10 has enumerable non-index properties on buffers.
|
||
(isBuff && (key == 'offset' || key == 'parent')) ||
|
||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
||
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
||
// Skip index properties.
|
||
isIndex(key, length)
|
||
))) {
|
||
result.push(key);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = arrayLikeKeys;
|
||
|
||
|
||
/***/ }),
|
||
/* 104 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = function(module) {
|
||
if (!module.webpackPolyfill) {
|
||
module.deprecate = function() {};
|
||
module.paths = [];
|
||
// module.parent = undefined by default
|
||
if (!module.children) module.children = [];
|
||
Object.defineProperty(module, "loaded", {
|
||
enumerable: true,
|
||
get: function() {
|
||
return module.l;
|
||
}
|
||
});
|
||
Object.defineProperty(module, "id", {
|
||
enumerable: true,
|
||
get: function() {
|
||
return module.i;
|
||
}
|
||
});
|
||
module.webpackPolyfill = 1;
|
||
}
|
||
return module;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 105 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Creates a unary function that invokes `func` with its argument transformed.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to wrap.
|
||
* @param {Function} transform The argument transform.
|
||
* @returns {Function} Returns the new function.
|
||
*/
|
||
function overArg(func, transform) {
|
||
return function(arg) {
|
||
return func(transform(arg));
|
||
};
|
||
}
|
||
|
||
module.exports = overArg;
|
||
|
||
|
||
/***/ }),
|
||
/* 106 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getNative = __webpack_require__(19),
|
||
root = __webpack_require__(10);
|
||
|
||
/* Built-in method references that are verified to be native. */
|
||
var WeakMap = getNative(root, 'WeakMap');
|
||
|
||
module.exports = WeakMap;
|
||
|
||
|
||
/***/ }),
|
||
/* 107 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(12);
|
||
|
||
/**
|
||
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
||
* equality comparisons, else `false`.
|
||
*/
|
||
function isStrictComparable(value) {
|
||
return value === value && !isObject(value);
|
||
}
|
||
|
||
module.exports = isStrictComparable;
|
||
|
||
|
||
/***/ }),
|
||
/* 108 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* A specialized version of `matchesProperty` for source values suitable
|
||
* for strict equality comparisons, i.e. `===`.
|
||
*
|
||
* @private
|
||
* @param {string} key The key of the property to get.
|
||
* @param {*} srcValue The value to match.
|
||
* @returns {Function} Returns the new spec function.
|
||
*/
|
||
function matchesStrictComparable(key, srcValue) {
|
||
return function(object) {
|
||
if (object == null) {
|
||
return false;
|
||
}
|
||
return object[key] === srcValue &&
|
||
(srcValue !== undefined || (key in Object(object)));
|
||
};
|
||
}
|
||
|
||
module.exports = matchesStrictComparable;
|
||
|
||
|
||
/***/ }),
|
||
/* 109 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* A specialized version of `_.map` for arrays without support for iteratee
|
||
* shorthands.
|
||
*
|
||
* @private
|
||
* @param {Array} [array] The array to iterate over.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @returns {Array} Returns the new mapped array.
|
||
*/
|
||
function arrayMap(array, iteratee) {
|
||
var index = -1,
|
||
length = array == null ? 0 : array.length,
|
||
result = Array(length);
|
||
|
||
while (++index < length) {
|
||
result[index] = iteratee(array[index], index, array);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = arrayMap;
|
||
|
||
|
||
/***/ }),
|
||
/* 110 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The base implementation of `_.property` without support for deep paths.
|
||
*
|
||
* @private
|
||
* @param {string} key The key of the property to get.
|
||
* @returns {Function} Returns the new accessor function.
|
||
*/
|
||
function baseProperty(key) {
|
||
return function(object) {
|
||
return object == null ? undefined : object[key];
|
||
};
|
||
}
|
||
|
||
module.exports = baseProperty;
|
||
|
||
|
||
/***/ }),
|
||
/* 111 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var toFinite = __webpack_require__(223);
|
||
|
||
/**
|
||
* Converts `value` to an integer.
|
||
*
|
||
* **Note:** This method is loosely based on
|
||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to convert.
|
||
* @returns {number} Returns the converted integer.
|
||
* @example
|
||
*
|
||
* _.toInteger(3.2);
|
||
* // => 3
|
||
*
|
||
* _.toInteger(Number.MIN_VALUE);
|
||
* // => 0
|
||
*
|
||
* _.toInteger(Infinity);
|
||
* // => 1.7976931348623157e+308
|
||
*
|
||
* _.toInteger('3.2');
|
||
* // => 3
|
||
*/
|
||
function toInteger(value) {
|
||
var result = toFinite(value),
|
||
remainder = result % 1;
|
||
|
||
return result === result ? (remainder ? result - remainder : result) : 0;
|
||
}
|
||
|
||
module.exports = toInteger;
|
||
|
||
|
||
/***/ }),
|
||
/* 112 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var shared = __webpack_require__(51);
|
||
|
||
module.exports = shared('native-function-to-string', Function.toString);
|
||
|
||
|
||
/***/ }),
|
||
/* 113 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
var fails = __webpack_require__(8);
|
||
var createElement = __webpack_require__(114);
|
||
|
||
// Thank's IE8 for his funny defineProperty
|
||
module.exports = !DESCRIPTORS && !fails(function () {
|
||
return Object.defineProperty(createElement('div'), 'a', {
|
||
get: function () { return 7; }
|
||
}).a != 7;
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 114 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var isObject = __webpack_require__(16);
|
||
|
||
var document = global.document;
|
||
// typeof document.createElement is 'object' in old IE
|
||
var EXISTS = isObject(document) && isObject(document.createElement);
|
||
|
||
module.exports = function (it) {
|
||
return EXISTS ? document.createElement(it) : {};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 115 */
|
||
/***/ (function(module, exports) {
|
||
|
||
var id = 0;
|
||
var postfix = Math.random();
|
||
|
||
module.exports = function (key) {
|
||
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 116 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var createIteratorConstructor = __webpack_require__(237);
|
||
var getPrototypeOf = __webpack_require__(122);
|
||
var setPrototypeOf = __webpack_require__(243);
|
||
var setToStringTag = __webpack_require__(124);
|
||
var hide = __webpack_require__(21);
|
||
var redefine = __webpack_require__(118);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
var IS_PURE = __webpack_require__(77);
|
||
var Iterators = __webpack_require__(35);
|
||
var IteratorsCore = __webpack_require__(121);
|
||
|
||
var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
||
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
var KEYS = 'keys';
|
||
var VALUES = 'values';
|
||
var ENTRIES = 'entries';
|
||
|
||
var returnThis = function () { return this; };
|
||
|
||
module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
||
createIteratorConstructor(IteratorConstructor, NAME, next);
|
||
|
||
var getIterationMethod = function (KIND) {
|
||
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
||
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
||
switch (KIND) {
|
||
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
||
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
||
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
||
} return function () { return new IteratorConstructor(this); };
|
||
};
|
||
|
||
var TO_STRING_TAG = NAME + ' Iterator';
|
||
var INCORRECT_VALUES_NAME = false;
|
||
var IterablePrototype = Iterable.prototype;
|
||
var nativeIterator = IterablePrototype[ITERATOR]
|
||
|| IterablePrototype['@@iterator']
|
||
|| DEFAULT && IterablePrototype[DEFAULT];
|
||
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
||
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
||
var CurrentIteratorPrototype, methods, KEY;
|
||
|
||
// fix native
|
||
if (anyNativeIterator) {
|
||
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
|
||
if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
||
if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
||
if (setPrototypeOf) {
|
||
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
||
} else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
|
||
hide(CurrentIteratorPrototype, ITERATOR, returnThis);
|
||
}
|
||
}
|
||
// Set @@toStringTag to native iterators
|
||
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
||
if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
|
||
}
|
||
}
|
||
|
||
// fix Array#{values, @@iterator}.name in V8 / FF
|
||
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
||
INCORRECT_VALUES_NAME = true;
|
||
defaultIterator = function values() { return nativeIterator.call(this); };
|
||
}
|
||
|
||
// define iterator
|
||
if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
|
||
hide(IterablePrototype, ITERATOR, defaultIterator);
|
||
}
|
||
Iterators[NAME] = defaultIterator;
|
||
|
||
// export additional methods
|
||
if (DEFAULT) {
|
||
methods = {
|
||
values: getIterationMethod(VALUES),
|
||
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
||
entries: getIterationMethod(ENTRIES)
|
||
};
|
||
if (FORCED) for (KEY in methods) {
|
||
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
||
redefine(IterablePrototype, KEY, methods[KEY]);
|
||
}
|
||
} else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
||
}
|
||
|
||
return methods;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 117 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
var propertyIsEnumerableModule = __webpack_require__(231);
|
||
var createPropertyDescriptor = __webpack_require__(52);
|
||
var toIndexedObject = __webpack_require__(22);
|
||
var toPrimitive = __webpack_require__(76);
|
||
var has = __webpack_require__(17);
|
||
var IE8_DOM_DEFINE = __webpack_require__(113);
|
||
|
||
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||
|
||
// `Object.getOwnPropertyDescriptor` method
|
||
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
|
||
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
||
O = toIndexedObject(O);
|
||
P = toPrimitive(P, true);
|
||
if (IE8_DOM_DEFINE) try {
|
||
return nativeGetOwnPropertyDescriptor(O, P);
|
||
} catch (error) { /* empty */ }
|
||
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 118 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var shared = __webpack_require__(51);
|
||
var hide = __webpack_require__(21);
|
||
var has = __webpack_require__(17);
|
||
var setGlobal = __webpack_require__(75);
|
||
var nativeFunctionToString = __webpack_require__(112);
|
||
var InternalStateModule = __webpack_require__(74);
|
||
|
||
var getInternalState = InternalStateModule.get;
|
||
var enforceInternalState = InternalStateModule.enforce;
|
||
var TEMPLATE = String(nativeFunctionToString).split('toString');
|
||
|
||
shared('inspectSource', function (it) {
|
||
return nativeFunctionToString.call(it);
|
||
});
|
||
|
||
(module.exports = function (O, key, value, options) {
|
||
var unsafe = options ? !!options.unsafe : false;
|
||
var simple = options ? !!options.enumerable : false;
|
||
var noTargetGet = options ? !!options.noTargetGet : false;
|
||
if (typeof value == 'function') {
|
||
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
|
||
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
||
}
|
||
if (O === global) {
|
||
if (simple) O[key] = value;
|
||
else setGlobal(key, value);
|
||
return;
|
||
} else if (!unsafe) {
|
||
delete O[key];
|
||
} else if (!noTargetGet && O[key]) {
|
||
simple = true;
|
||
}
|
||
if (simple) O[key] = value;
|
||
else hide(O, key, value);
|
||
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
||
})(Function.prototype, 'toString', function toString() {
|
||
return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this);
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 119 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__(7);
|
||
|
||
|
||
/***/ }),
|
||
/* 120 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var has = __webpack_require__(17);
|
||
var toIndexedObject = __webpack_require__(22);
|
||
var indexOf = __webpack_require__(82).indexOf;
|
||
var hiddenKeys = __webpack_require__(79);
|
||
|
||
module.exports = function (object, names) {
|
||
var O = toIndexedObject(object);
|
||
var i = 0;
|
||
var result = [];
|
||
var key;
|
||
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
||
// Don't enum bug & hidden keys
|
||
while (names.length > i) if (has(O, key = names[i++])) {
|
||
~indexOf(result, key) || result.push(key);
|
||
}
|
||
return result;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 121 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var getPrototypeOf = __webpack_require__(122);
|
||
var hide = __webpack_require__(21);
|
||
var has = __webpack_require__(17);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
var IS_PURE = __webpack_require__(77);
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
var BUGGY_SAFARI_ITERATORS = false;
|
||
|
||
var returnThis = function () { return this; };
|
||
|
||
// `%IteratorPrototype%` object
|
||
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
|
||
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
||
|
||
if ([].keys) {
|
||
arrayIterator = [].keys();
|
||
// Safari 8 has buggy iterators w/o `next`
|
||
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
|
||
else {
|
||
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
|
||
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
||
}
|
||
}
|
||
|
||
if (IteratorPrototype == undefined) IteratorPrototype = {};
|
||
|
||
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
|
||
if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
|
||
|
||
module.exports = {
|
||
IteratorPrototype: IteratorPrototype,
|
||
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 122 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var has = __webpack_require__(17);
|
||
var toObject = __webpack_require__(4);
|
||
var sharedKey = __webpack_require__(78);
|
||
var CORRECT_PROTOTYPE_GETTER = __webpack_require__(238);
|
||
|
||
var IE_PROTO = sharedKey('IE_PROTO');
|
||
var ObjectPrototype = Object.prototype;
|
||
|
||
// `Object.getPrototypeOf` method
|
||
// https://tc39.github.io/ecma262/#sec-object.getprototypeof
|
||
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
|
||
O = toObject(O);
|
||
if (has(O, IE_PROTO)) return O[IE_PROTO];
|
||
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
||
return O.constructor.prototype;
|
||
} return O instanceof Object ? ObjectPrototype : null;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 123 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var anObject = __webpack_require__(28);
|
||
var defineProperties = __webpack_require__(240);
|
||
var enumBugKeys = __webpack_require__(83);
|
||
var hiddenKeys = __webpack_require__(79);
|
||
var html = __webpack_require__(242);
|
||
var documentCreateElement = __webpack_require__(114);
|
||
var sharedKey = __webpack_require__(78);
|
||
var IE_PROTO = sharedKey('IE_PROTO');
|
||
|
||
var PROTOTYPE = 'prototype';
|
||
var Empty = function () { /* empty */ };
|
||
|
||
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
||
var createDict = function () {
|
||
// Thrash, waste and sodomy: IE GC bug
|
||
var iframe = documentCreateElement('iframe');
|
||
var length = enumBugKeys.length;
|
||
var lt = '<';
|
||
var script = 'script';
|
||
var gt = '>';
|
||
var js = 'java' + script + ':';
|
||
var iframeDocument;
|
||
iframe.style.display = 'none';
|
||
html.appendChild(iframe);
|
||
iframe.src = String(js);
|
||
iframeDocument = iframe.contentWindow.document;
|
||
iframeDocument.open();
|
||
iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
|
||
iframeDocument.close();
|
||
createDict = iframeDocument.F;
|
||
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
||
return createDict();
|
||
};
|
||
|
||
// `Object.create` method
|
||
// https://tc39.github.io/ecma262/#sec-object.create
|
||
module.exports = Object.create || function create(O, Properties) {
|
||
var result;
|
||
if (O !== null) {
|
||
Empty[PROTOTYPE] = anObject(O);
|
||
result = new Empty();
|
||
Empty[PROTOTYPE] = null;
|
||
// add "__proto__" for Object.getPrototypeOf polyfill
|
||
result[IE_PROTO] = O;
|
||
} else result = createDict();
|
||
return Properties === undefined ? result : defineProperties(result, Properties);
|
||
};
|
||
|
||
hiddenKeys[IE_PROTO] = true;
|
||
|
||
|
||
/***/ }),
|
||
/* 124 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var defineProperty = __webpack_require__(15).f;
|
||
var has = __webpack_require__(17);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||
|
||
module.exports = function (it, TAG, STATIC) {
|
||
if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
|
||
defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 125 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var isArray = __webpack_require__(29);
|
||
var toLength = __webpack_require__(3);
|
||
var bind = __webpack_require__(54);
|
||
|
||
// `FlattenIntoArray` abstract operation
|
||
// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
|
||
var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
|
||
var targetIndex = start;
|
||
var sourceIndex = 0;
|
||
var mapFn = mapper ? bind(mapper, thisArg, 3) : false;
|
||
var element;
|
||
|
||
while (sourceIndex < sourceLen) {
|
||
if (sourceIndex in source) {
|
||
element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
|
||
|
||
if (depth > 0 && isArray(element)) {
|
||
targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
|
||
} else {
|
||
if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
|
||
target[targetIndex] = element;
|
||
}
|
||
|
||
targetIndex++;
|
||
}
|
||
sourceIndex++;
|
||
}
|
||
return targetIndex;
|
||
};
|
||
|
||
module.exports = flattenIntoArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 126 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $includes = __webpack_require__(82).includes;
|
||
var addToUnscopables = __webpack_require__(11);
|
||
|
||
// `Array.prototype.includes` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
|
||
$({ target: 'Array', proto: true }, {
|
||
includes: function includes(el /* , fromIndex = 0 */) {
|
||
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
||
addToUnscopables('includes');
|
||
|
||
|
||
/***/ }),
|
||
/* 127 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var aFunction = __webpack_require__(55);
|
||
var toObject = __webpack_require__(4);
|
||
var IndexedObject = __webpack_require__(53);
|
||
var toLength = __webpack_require__(3);
|
||
|
||
// `Array.prototype.{ reduce, reduceRight }` methods implementation
|
||
var createMethod = function (IS_RIGHT) {
|
||
return function (that, callbackfn, argumentsLength, memo) {
|
||
aFunction(callbackfn);
|
||
var O = toObject(that);
|
||
var self = IndexedObject(O);
|
||
var length = toLength(O.length);
|
||
var index = IS_RIGHT ? length - 1 : 0;
|
||
var i = IS_RIGHT ? -1 : 1;
|
||
if (argumentsLength < 2) while (true) {
|
||
if (index in self) {
|
||
memo = self[index];
|
||
index += i;
|
||
break;
|
||
}
|
||
index += i;
|
||
if (IS_RIGHT ? index < 0 : length <= index) {
|
||
throw TypeError('Reduce of empty array with no initial value');
|
||
}
|
||
}
|
||
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
|
||
memo = callbackfn(memo, self[index], index, O);
|
||
}
|
||
return memo;
|
||
};
|
||
};
|
||
|
||
module.exports = {
|
||
// `Array.prototype.reduce` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
|
||
left: createMethod(false),
|
||
// `Array.prototype.reduceRight` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
|
||
right: createMethod(true)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 128 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony import */ var _createStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(84);
|
||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createStore", function() { return _createStore__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
||
|
||
/* harmony import */ var _combineReducers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(131);
|
||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineReducers", function() { return _combineReducers__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
||
|
||
/* harmony import */ var _bindActionCreators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(133);
|
||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return _bindActionCreators__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
||
|
||
/* harmony import */ var _applyMiddleware__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(134);
|
||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return _applyMiddleware__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
||
|
||
/* harmony import */ var _compose__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(85);
|
||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return _compose__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
||
|
||
/* harmony import */ var _utils_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(132);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/*
|
||
* This is a dummy function to check if the function name has been altered by minification.
|
||
* If the function has been minified and NODE_ENV !== 'production', warn the user.
|
||
*/
|
||
function isCrushed() {}
|
||
|
||
if (false) {}
|
||
|
||
|
||
|
||
/***/ }),
|
||
/* 129 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony import */ var _baseGetTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(294);
|
||
/* harmony import */ var _getPrototype_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(299);
|
||
/* harmony import */ var _isObjectLike_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(301);
|
||
|
||
|
||
|
||
|
||
/** `Object#toString` result references. */
|
||
var objectTag = '[object Object]';
|
||
|
||
/** Used for built-in method references. */
|
||
var funcProto = Function.prototype,
|
||
objectProto = Object.prototype;
|
||
|
||
/** Used to resolve the decompiled source of functions. */
|
||
var funcToString = funcProto.toString;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/** Used to infer the `Object` constructor. */
|
||
var objectCtorString = funcToString.call(Object);
|
||
|
||
/**
|
||
* Checks if `value` is a plain object, that is, an object created by the
|
||
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.8.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
||
* @example
|
||
*
|
||
* function Foo() {
|
||
* this.a = 1;
|
||
* }
|
||
*
|
||
* _.isPlainObject(new Foo);
|
||
* // => false
|
||
*
|
||
* _.isPlainObject([1, 2, 3]);
|
||
* // => false
|
||
*
|
||
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
||
* // => true
|
||
*
|
||
* _.isPlainObject(Object.create(null));
|
||
* // => true
|
||
*/
|
||
function isPlainObject(value) {
|
||
if (!Object(_isObjectLike_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value) || Object(_baseGetTag_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value) != objectTag) {
|
||
return false;
|
||
}
|
||
var proto = Object(_getPrototype_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value);
|
||
if (proto === null) {
|
||
return true;
|
||
}
|
||
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
||
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
||
funcToString.call(Ctor) == objectCtorString;
|
||
}
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (isPlainObject);
|
||
|
||
|
||
/***/ }),
|
||
/* 130 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony import */ var _root_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(295);
|
||
|
||
|
||
/** Built-in value references. */
|
||
var Symbol = _root_js__WEBPACK_IMPORTED_MODULE_0__["default"].Symbol;
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (Symbol);
|
||
|
||
|
||
/***/ }),
|
||
/* 131 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return combineReducers; });
|
||
/* harmony import */ var _createStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(84);
|
||
/* harmony import */ var lodash_es_isPlainObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(129);
|
||
/* harmony import */ var _utils_warning__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(132);
|
||
|
||
|
||
|
||
|
||
function getUndefinedStateErrorMessage(key, action) {
|
||
var actionType = action && action.type;
|
||
var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
|
||
|
||
return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.';
|
||
}
|
||
|
||
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
||
var reducerKeys = Object.keys(reducers);
|
||
var argumentName = action && action.type === _createStore__WEBPACK_IMPORTED_MODULE_0__["ActionTypes"].INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
|
||
|
||
if (reducerKeys.length === 0) {
|
||
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
|
||
}
|
||
|
||
if (!Object(lodash_es_isPlainObject__WEBPACK_IMPORTED_MODULE_1__["default"])(inputState)) {
|
||
return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
|
||
}
|
||
|
||
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
||
return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
||
});
|
||
|
||
unexpectedKeys.forEach(function (key) {
|
||
unexpectedKeyCache[key] = true;
|
||
});
|
||
|
||
if (unexpectedKeys.length > 0) {
|
||
return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
|
||
}
|
||
}
|
||
|
||
function assertReducerSanity(reducers) {
|
||
Object.keys(reducers).forEach(function (key) {
|
||
var reducer = reducers[key];
|
||
var initialState = reducer(undefined, { type: _createStore__WEBPACK_IMPORTED_MODULE_0__["ActionTypes"].INIT });
|
||
|
||
if (typeof initialState === 'undefined') {
|
||
throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.');
|
||
}
|
||
|
||
var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
|
||
if (typeof reducer(undefined, { type: type }) === 'undefined') {
|
||
throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore__WEBPACK_IMPORTED_MODULE_0__["ActionTypes"].INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.');
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Turns an object whose values are different reducer functions, into a single
|
||
* reducer function. It will call every child reducer, and gather their results
|
||
* into a single state object, whose keys correspond to the keys of the passed
|
||
* reducer functions.
|
||
*
|
||
* @param {Object} reducers An object whose values correspond to different
|
||
* reducer functions that need to be combined into one. One handy way to obtain
|
||
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
|
||
* undefined for any action. Instead, they should return their initial state
|
||
* if the state passed to them was undefined, and the current state for any
|
||
* unrecognized action.
|
||
*
|
||
* @returns {Function} A reducer function that invokes every reducer inside the
|
||
* passed object, and builds a state object with the same shape.
|
||
*/
|
||
function combineReducers(reducers) {
|
||
var reducerKeys = Object.keys(reducers);
|
||
var finalReducers = {};
|
||
for (var i = 0; i < reducerKeys.length; i++) {
|
||
var key = reducerKeys[i];
|
||
|
||
if (false) {}
|
||
|
||
if (typeof reducers[key] === 'function') {
|
||
finalReducers[key] = reducers[key];
|
||
}
|
||
}
|
||
var finalReducerKeys = Object.keys(finalReducers);
|
||
|
||
if (false) { var unexpectedKeyCache; }
|
||
|
||
var sanityError;
|
||
try {
|
||
assertReducerSanity(finalReducers);
|
||
} catch (e) {
|
||
sanityError = e;
|
||
}
|
||
|
||
return function combination() {
|
||
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||
var action = arguments[1];
|
||
|
||
if (sanityError) {
|
||
throw sanityError;
|
||
}
|
||
|
||
if (false) { var warningMessage; }
|
||
|
||
var hasChanged = false;
|
||
var nextState = {};
|
||
for (var i = 0; i < finalReducerKeys.length; i++) {
|
||
var key = finalReducerKeys[i];
|
||
var reducer = finalReducers[key];
|
||
var previousStateForKey = state[key];
|
||
var nextStateForKey = reducer(previousStateForKey, action);
|
||
if (typeof nextStateForKey === 'undefined') {
|
||
var errorMessage = getUndefinedStateErrorMessage(key, action);
|
||
throw new Error(errorMessage);
|
||
}
|
||
nextState[key] = nextStateForKey;
|
||
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
||
}
|
||
return hasChanged ? nextState : state;
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
/* 132 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return warning; });
|
||
/**
|
||
* Prints a warning in the console if it exists.
|
||
*
|
||
* @param {String} message The warning message.
|
||
* @returns {void}
|
||
*/
|
||
function warning(message) {
|
||
/* eslint-disable no-console */
|
||
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
||
console.error(message);
|
||
}
|
||
/* eslint-enable no-console */
|
||
try {
|
||
// This error was thrown as a convenience so that if you enable
|
||
// "break on all exceptions" in your console,
|
||
// it would pause the execution at this line.
|
||
throw new Error(message);
|
||
/* eslint-disable no-empty */
|
||
} catch (e) {}
|
||
/* eslint-enable no-empty */
|
||
}
|
||
|
||
/***/ }),
|
||
/* 133 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return bindActionCreators; });
|
||
function bindActionCreator(actionCreator, dispatch) {
|
||
return function () {
|
||
return dispatch(actionCreator.apply(undefined, arguments));
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Turns an object whose values are action creators, into an object with the
|
||
* same keys, but with every function wrapped into a `dispatch` call so they
|
||
* may be invoked directly. This is just a convenience method, as you can call
|
||
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
|
||
*
|
||
* For convenience, you can also pass a single function as the first argument,
|
||
* and get a function in return.
|
||
*
|
||
* @param {Function|Object} actionCreators An object whose values are action
|
||
* creator functions. One handy way to obtain it is to use ES6 `import * as`
|
||
* syntax. You may also pass a single function.
|
||
*
|
||
* @param {Function} dispatch The `dispatch` function available on your Redux
|
||
* store.
|
||
*
|
||
* @returns {Function|Object} The object mimicking the original object, but with
|
||
* every action creator wrapped into the `dispatch` call. If you passed a
|
||
* function as `actionCreators`, the return value will also be a single
|
||
* function.
|
||
*/
|
||
function bindActionCreators(actionCreators, dispatch) {
|
||
if (typeof actionCreators === 'function') {
|
||
return bindActionCreator(actionCreators, dispatch);
|
||
}
|
||
|
||
if (typeof actionCreators !== 'object' || actionCreators === null) {
|
||
throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
|
||
}
|
||
|
||
var keys = Object.keys(actionCreators);
|
||
var boundActionCreators = {};
|
||
for (var i = 0; i < keys.length; i++) {
|
||
var key = keys[i];
|
||
var actionCreator = actionCreators[key];
|
||
if (typeof actionCreator === 'function') {
|
||
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
||
}
|
||
}
|
||
return boundActionCreators;
|
||
}
|
||
|
||
/***/ }),
|
||
/* 134 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return applyMiddleware; });
|
||
/* harmony import */ var _compose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85);
|
||
var _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; };
|
||
|
||
|
||
|
||
/**
|
||
* Creates a store enhancer that applies middleware to the dispatch method
|
||
* of the Redux store. This is handy for a variety of tasks, such as expressing
|
||
* asynchronous actions in a concise manner, or logging every action payload.
|
||
*
|
||
* See `redux-thunk` package as an example of the Redux middleware.
|
||
*
|
||
* Because middleware is potentially asynchronous, this should be the first
|
||
* store enhancer in the composition chain.
|
||
*
|
||
* Note that each middleware will be given the `dispatch` and `getState` functions
|
||
* as named arguments.
|
||
*
|
||
* @param {...Function} middlewares The middleware chain to be applied.
|
||
* @returns {Function} A store enhancer applying the middleware.
|
||
*/
|
||
function applyMiddleware() {
|
||
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
|
||
middlewares[_key] = arguments[_key];
|
||
}
|
||
|
||
return function (createStore) {
|
||
return function (reducer, preloadedState, enhancer) {
|
||
var store = createStore(reducer, preloadedState, enhancer);
|
||
var _dispatch = store.dispatch;
|
||
var chain = [];
|
||
|
||
var middlewareAPI = {
|
||
getState: store.getState,
|
||
dispatch: function dispatch(action) {
|
||
return _dispatch(action);
|
||
}
|
||
};
|
||
chain = middlewares.map(function (middleware) {
|
||
return middleware(middlewareAPI);
|
||
});
|
||
_dispatch = _compose__WEBPACK_IMPORTED_MODULE_0__["default"].apply(undefined, chain)(store.dispatch);
|
||
|
||
return _extends({}, store, {
|
||
dispatch: _dispatch
|
||
});
|
||
};
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
/* 135 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ActionAppliesTo = exports.ActionTypeConsts = void 0;
|
||
var ActionTypeConsts = {
|
||
TRANSFORM_MOVE: 'TRANSFORM_MOVE',
|
||
TRANSFORM_SCALE: 'TRANSFORM_SCALE',
|
||
TRANSFORM_ROTATE: 'TRANSFORM_ROTATE',
|
||
TRANSFORM_SKEW: 'TRANSFORM_SKEW',
|
||
STYLE_OPACITY: 'STYLE_OPACITY',
|
||
STYLE_SIZE: 'STYLE_SIZE',
|
||
STYLE_FILTER: 'STYLE_FILTER',
|
||
STYLE_BACKGROUND_COLOR: 'STYLE_BACKGROUND_COLOR',
|
||
STYLE_BORDER: 'STYLE_BORDER',
|
||
STYLE_TEXT_COLOR: 'STYLE_TEXT_COLOR',
|
||
PLUGIN_LOTTIE: 'PLUGIN_LOTTIE',
|
||
GENERAL_DISPLAY: 'GENERAL_DISPLAY',
|
||
GENERAL_START_ACTION: 'GENERAL_START_ACTION',
|
||
GENERAL_CONTINUOUS_ACTION: 'GENERAL_CONTINUOUS_ACTION',
|
||
// TODO: Clean these up below because they're not used at this time
|
||
GENERAL_COMBO_CLASS: 'GENERAL_COMBO_CLASS',
|
||
GENERAL_STOP_ACTION: 'GENERAL_STOP_ACTION',
|
||
GENERAL_LOOP: 'GENERAL_LOOP',
|
||
STYLE_BOX_SHADOW: 'STYLE_BOX_SHADOW'
|
||
};
|
||
exports.ActionTypeConsts = ActionTypeConsts;
|
||
var ActionAppliesTo = {
|
||
ELEMENT: 'ELEMENT',
|
||
ELEMENT_CLASS: 'ELEMENT_CLASS',
|
||
TRIGGER_ELEMENT: 'TRIGGER_ELEMENT'
|
||
};
|
||
exports.ActionAppliesTo = ActionAppliesTo;
|
||
|
||
/***/ }),
|
||
/* 136 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var createFind = __webpack_require__(137),
|
||
findIndex = __webpack_require__(92);
|
||
|
||
/**
|
||
* Iterates over elements of `collection`, returning the first element
|
||
* `predicate` returns truthy for. The predicate is invoked with three
|
||
* arguments: (value, index|key, collection).
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Collection
|
||
* @param {Array|Object} collection The collection to inspect.
|
||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||
* @param {number} [fromIndex=0] The index to search from.
|
||
* @returns {*} Returns the matched element, else `undefined`.
|
||
* @example
|
||
*
|
||
* var users = [
|
||
* { 'user': 'barney', 'age': 36, 'active': true },
|
||
* { 'user': 'fred', 'age': 40, 'active': false },
|
||
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
||
* ];
|
||
*
|
||
* _.find(users, function(o) { return o.age < 40; });
|
||
* // => object for 'barney'
|
||
*
|
||
* // The `_.matches` iteratee shorthand.
|
||
* _.find(users, { 'age': 1, 'active': true });
|
||
* // => object for 'pebbles'
|
||
*
|
||
* // The `_.matchesProperty` iteratee shorthand.
|
||
* _.find(users, ['active', false]);
|
||
* // => object for 'fred'
|
||
*
|
||
* // The `_.property` iteratee shorthand.
|
||
* _.find(users, 'active');
|
||
* // => object for 'barney'
|
||
*/
|
||
var find = createFind(findIndex);
|
||
|
||
module.exports = find;
|
||
|
||
|
||
/***/ }),
|
||
/* 137 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIteratee = __webpack_require__(18),
|
||
isArrayLike = __webpack_require__(26),
|
||
keys = __webpack_require__(47);
|
||
|
||
/**
|
||
* Creates a `_.find` or `_.findLast` function.
|
||
*
|
||
* @private
|
||
* @param {Function} findIndexFunc The function to find the collection index.
|
||
* @returns {Function} Returns the new find function.
|
||
*/
|
||
function createFind(findIndexFunc) {
|
||
return function(collection, predicate, fromIndex) {
|
||
var iterable = Object(collection);
|
||
if (!isArrayLike(collection)) {
|
||
var iteratee = baseIteratee(predicate, 3);
|
||
collection = keys(collection);
|
||
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
|
||
}
|
||
var index = findIndexFunc(collection, predicate, fromIndex);
|
||
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
||
};
|
||
}
|
||
|
||
module.exports = createFind;
|
||
|
||
|
||
/***/ }),
|
||
/* 138 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.inQuad = inQuad;
|
||
exports.outQuad = outQuad;
|
||
exports.inOutQuad = inOutQuad;
|
||
exports.inCubic = inCubic;
|
||
exports.outCubic = outCubic;
|
||
exports.inOutCubic = inOutCubic;
|
||
exports.inQuart = inQuart;
|
||
exports.outQuart = outQuart;
|
||
exports.inOutQuart = inOutQuart;
|
||
exports.inQuint = inQuint;
|
||
exports.outQuint = outQuint;
|
||
exports.inOutQuint = inOutQuint;
|
||
exports.inSine = inSine;
|
||
exports.outSine = outSine;
|
||
exports.inOutSine = inOutSine;
|
||
exports.inExpo = inExpo;
|
||
exports.outExpo = outExpo;
|
||
exports.inOutExpo = inOutExpo;
|
||
exports.inCirc = inCirc;
|
||
exports.outCirc = outCirc;
|
||
exports.inOutCirc = inOutCirc;
|
||
exports.outBounce = outBounce;
|
||
exports.inBack = inBack;
|
||
exports.outBack = outBack;
|
||
exports.inOutBack = inOutBack;
|
||
exports.inElastic = inElastic;
|
||
exports.outElastic = outElastic;
|
||
exports.inOutElastic = inOutElastic;
|
||
exports.swingFromTo = swingFromTo;
|
||
exports.swingFrom = swingFrom;
|
||
exports.swingTo = swingTo;
|
||
exports.bounce = bounce;
|
||
exports.bouncePast = bouncePast;
|
||
exports.easeInOut = exports.easeOut = exports.easeIn = exports.ease = void 0;
|
||
|
||
var _bezierEasing = _interopRequireDefault(__webpack_require__(139)); // Easing functions adapted from Thomas Fuchs & Jeremy Kahn
|
||
// Easing Equations (c) 2003 Robert Penner, BSD license
|
||
// https://raw.github.com/danro/easing-js/master/LICENSE
|
||
|
||
|
||
var magicSwing = 1.70158;
|
||
var ease = (0, _bezierEasing["default"])(0.25, 0.1, 0.25, 1.0);
|
||
exports.ease = ease;
|
||
var easeIn = (0, _bezierEasing["default"])(0.42, 0.0, 1.0, 1.0);
|
||
exports.easeIn = easeIn;
|
||
var easeOut = (0, _bezierEasing["default"])(0.0, 0.0, 0.58, 1.0);
|
||
exports.easeOut = easeOut;
|
||
var easeInOut = (0, _bezierEasing["default"])(0.42, 0.0, 0.58, 1.0);
|
||
exports.easeInOut = easeInOut;
|
||
|
||
function inQuad(pos) {
|
||
return Math.pow(pos, 2);
|
||
}
|
||
|
||
function outQuad(pos) {
|
||
return -(Math.pow(pos - 1, 2) - 1);
|
||
}
|
||
|
||
function inOutQuad(pos) {
|
||
if ((pos /= 0.5) < 1) {
|
||
return 0.5 * Math.pow(pos, 2);
|
||
}
|
||
|
||
return -0.5 * ((pos -= 2) * pos - 2);
|
||
}
|
||
|
||
function inCubic(pos) {
|
||
return Math.pow(pos, 3);
|
||
}
|
||
|
||
function outCubic(pos) {
|
||
return Math.pow(pos - 1, 3) + 1;
|
||
}
|
||
|
||
function inOutCubic(pos) {
|
||
if ((pos /= 0.5) < 1) {
|
||
return 0.5 * Math.pow(pos, 3);
|
||
}
|
||
|
||
return 0.5 * (Math.pow(pos - 2, 3) + 2);
|
||
}
|
||
|
||
function inQuart(pos) {
|
||
return Math.pow(pos, 4);
|
||
}
|
||
|
||
function outQuart(pos) {
|
||
return -(Math.pow(pos - 1, 4) - 1);
|
||
}
|
||
|
||
function inOutQuart(pos) {
|
||
if ((pos /= 0.5) < 1) {
|
||
return 0.5 * Math.pow(pos, 4);
|
||
}
|
||
|
||
return -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2);
|
||
}
|
||
|
||
function inQuint(pos) {
|
||
return Math.pow(pos, 5);
|
||
}
|
||
|
||
function outQuint(pos) {
|
||
return Math.pow(pos - 1, 5) + 1;
|
||
}
|
||
|
||
function inOutQuint(pos) {
|
||
if ((pos /= 0.5) < 1) {
|
||
return 0.5 * Math.pow(pos, 5);
|
||
}
|
||
|
||
return 0.5 * (Math.pow(pos - 2, 5) + 2);
|
||
}
|
||
|
||
function inSine(pos) {
|
||
return -Math.cos(pos * (Math.PI / 2)) + 1;
|
||
}
|
||
|
||
function outSine(pos) {
|
||
return Math.sin(pos * (Math.PI / 2));
|
||
}
|
||
|
||
function inOutSine(pos) {
|
||
return -0.5 * (Math.cos(Math.PI * pos) - 1);
|
||
}
|
||
|
||
function inExpo(pos) {
|
||
return pos === 0 ? 0 : Math.pow(2, 10 * (pos - 1));
|
||
}
|
||
|
||
function outExpo(pos) {
|
||
return pos === 1 ? 1 : -Math.pow(2, -10 * pos) + 1;
|
||
}
|
||
|
||
function inOutExpo(pos) {
|
||
if (pos === 0) {
|
||
return 0;
|
||
}
|
||
|
||
if (pos === 1) {
|
||
return 1;
|
||
}
|
||
|
||
if ((pos /= 0.5) < 1) {
|
||
return 0.5 * Math.pow(2, 10 * (pos - 1));
|
||
}
|
||
|
||
return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
|
||
}
|
||
|
||
function inCirc(pos) {
|
||
return -(Math.sqrt(1 - pos * pos) - 1);
|
||
}
|
||
|
||
function outCirc(pos) {
|
||
return Math.sqrt(1 - Math.pow(pos - 1, 2));
|
||
}
|
||
|
||
function inOutCirc(pos) {
|
||
if ((pos /= 0.5) < 1) {
|
||
return -0.5 * (Math.sqrt(1 - pos * pos) - 1);
|
||
}
|
||
|
||
return 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1);
|
||
}
|
||
|
||
function outBounce(pos) {
|
||
if (pos < 1 / 2.75) {
|
||
return 7.5625 * pos * pos;
|
||
} else if (pos < 2 / 2.75) {
|
||
return 7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75;
|
||
} else if (pos < 2.5 / 2.75) {
|
||
return 7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375;
|
||
} else {
|
||
return 7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375;
|
||
}
|
||
}
|
||
|
||
function inBack(pos) {
|
||
var s = magicSwing;
|
||
return pos * pos * ((s + 1) * pos - s);
|
||
}
|
||
|
||
function outBack(pos) {
|
||
var s = magicSwing;
|
||
return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;
|
||
}
|
||
|
||
function inOutBack(pos) {
|
||
var s = magicSwing;
|
||
|
||
if ((pos /= 0.5) < 1) {
|
||
return 0.5 * (pos * pos * (((s *= 1.525) + 1) * pos - s));
|
||
}
|
||
|
||
return 0.5 * ((pos -= 2) * pos * (((s *= 1.525) + 1) * pos + s) + 2);
|
||
}
|
||
|
||
function inElastic(pos) {
|
||
var s = magicSwing;
|
||
var p = 0;
|
||
var a = 1;
|
||
|
||
if (pos === 0) {
|
||
return 0;
|
||
}
|
||
|
||
if (pos === 1) {
|
||
return 1;
|
||
}
|
||
|
||
if (!p) {
|
||
p = 0.3;
|
||
}
|
||
|
||
if (a < 1) {
|
||
a = 1;
|
||
s = p / 4;
|
||
} else {
|
||
s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||
}
|
||
|
||
return -(a * Math.pow(2, 10 * (pos -= 1)) * Math.sin((pos - s) * (2 * Math.PI) / p));
|
||
}
|
||
|
||
function outElastic(pos) {
|
||
var s = magicSwing;
|
||
var p = 0;
|
||
var a = 1;
|
||
|
||
if (pos === 0) {
|
||
return 0;
|
||
}
|
||
|
||
if (pos === 1) {
|
||
return 1;
|
||
}
|
||
|
||
if (!p) {
|
||
p = 0.3;
|
||
}
|
||
|
||
if (a < 1) {
|
||
a = 1;
|
||
s = p / 4;
|
||
} else {
|
||
s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||
}
|
||
|
||
return a * Math.pow(2, -10 * pos) * Math.sin((pos - s) * (2 * Math.PI) / p) + 1;
|
||
}
|
||
|
||
function inOutElastic(pos) {
|
||
var s = magicSwing;
|
||
var p = 0;
|
||
var a = 1;
|
||
|
||
if (pos === 0) {
|
||
return 0;
|
||
}
|
||
|
||
if ((pos /= 1 / 2) === 2) {
|
||
return 1;
|
||
}
|
||
|
||
if (!p) {
|
||
p = 0.3 * 1.5;
|
||
}
|
||
|
||
if (a < 1) {
|
||
a = 1;
|
||
s = p / 4;
|
||
} else {
|
||
s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||
}
|
||
|
||
if (pos < 1) {
|
||
return -0.5 * (a * Math.pow(2, 10 * (pos -= 1)) * Math.sin((pos - s) * (2 * Math.PI) / p));
|
||
}
|
||
|
||
return a * Math.pow(2, -10 * (pos -= 1)) * Math.sin((pos - s) * (2 * Math.PI) / p) * 0.5 + 1;
|
||
}
|
||
|
||
function swingFromTo(pos) {
|
||
var s = magicSwing;
|
||
return (pos /= 0.5) < 1 ? 0.5 * (pos * pos * (((s *= 1.525) + 1) * pos - s)) : 0.5 * ((pos -= 2) * pos * (((s *= 1.525) + 1) * pos + s) + 2);
|
||
}
|
||
|
||
function swingFrom(pos) {
|
||
var s = magicSwing;
|
||
return pos * pos * ((s + 1) * pos - s);
|
||
}
|
||
|
||
function swingTo(pos) {
|
||
var s = magicSwing;
|
||
return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;
|
||
}
|
||
|
||
function bounce(pos) {
|
||
if (pos < 1 / 2.75) {
|
||
return 7.5625 * pos * pos;
|
||
} else if (pos < 2 / 2.75) {
|
||
return 7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75;
|
||
} else if (pos < 2.5 / 2.75) {
|
||
return 7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375;
|
||
} else {
|
||
return 7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375;
|
||
}
|
||
}
|
||
|
||
function bouncePast(pos) {
|
||
if (pos < 1 / 2.75) {
|
||
return 7.5625 * pos * pos;
|
||
} else if (pos < 2 / 2.75) {
|
||
return 2 - (7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75);
|
||
} else if (pos < 2.5 / 2.75) {
|
||
return 2 - (7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375);
|
||
} else {
|
||
return 2 - (7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375);
|
||
}
|
||
}
|
||
|
||
/***/ }),
|
||
/* 139 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* https://github.com/gre/bezier-easing
|
||
* BezierEasing - use bezier curve for transition easing function
|
||
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
||
*/
|
||
|
||
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
||
var NEWTON_ITERATIONS = 4;
|
||
var NEWTON_MIN_SLOPE = 0.001;
|
||
var SUBDIVISION_PRECISION = 0.0000001;
|
||
var SUBDIVISION_MAX_ITERATIONS = 10;
|
||
|
||
var kSplineTableSize = 11;
|
||
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
||
|
||
var float32ArraySupported = typeof Float32Array === 'function';
|
||
|
||
function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }
|
||
function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }
|
||
function C (aA1) { return 3.0 * aA1; }
|
||
|
||
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
||
function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; }
|
||
|
||
// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
||
function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); }
|
||
|
||
function binarySubdivide (aX, aA, aB, mX1, mX2) {
|
||
var currentX, currentT, i = 0;
|
||
do {
|
||
currentT = aA + (aB - aA) / 2.0;
|
||
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
||
if (currentX > 0.0) {
|
||
aB = currentT;
|
||
} else {
|
||
aA = currentT;
|
||
}
|
||
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
||
return currentT;
|
||
}
|
||
|
||
function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {
|
||
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
||
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
||
if (currentSlope === 0.0) {
|
||
return aGuessT;
|
||
}
|
||
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
||
aGuessT -= currentX / currentSlope;
|
||
}
|
||
return aGuessT;
|
||
}
|
||
|
||
module.exports = function bezier (mX1, mY1, mX2, mY2) {
|
||
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) {
|
||
throw new Error('bezier x values must be in [0, 1] range');
|
||
}
|
||
|
||
// Precompute samples table
|
||
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
||
if (mX1 !== mY1 || mX2 !== mY2) {
|
||
for (var i = 0; i < kSplineTableSize; ++i) {
|
||
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
||
}
|
||
}
|
||
|
||
function getTForX (aX) {
|
||
var intervalStart = 0.0;
|
||
var currentSample = 1;
|
||
var lastSample = kSplineTableSize - 1;
|
||
|
||
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
||
intervalStart += kSampleStepSize;
|
||
}
|
||
--currentSample;
|
||
|
||
// Interpolate to provide an initial guess for t
|
||
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
||
var guessForT = intervalStart + dist * kSampleStepSize;
|
||
|
||
var initialSlope = getSlope(guessForT, mX1, mX2);
|
||
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
||
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
||
} else if (initialSlope === 0.0) {
|
||
return guessForT;
|
||
} else {
|
||
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
||
}
|
||
}
|
||
|
||
return function BezierEasing (x) {
|
||
if (mX1 === mY1 && mX2 === mY2) {
|
||
return x; // linear
|
||
}
|
||
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
||
if (x === 0) {
|
||
return 0;
|
||
}
|
||
if (x === 1) {
|
||
return 1;
|
||
}
|
||
return calcBezier(getTForX(x), mY1, mY2);
|
||
};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 140 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault2 = __webpack_require__(1);
|
||
|
||
var _toConsumableArray2 = _interopRequireDefault2(__webpack_require__(141));
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
var _interopRequireWildcard = __webpack_require__(39);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.optimizeFloat = optimizeFloat;
|
||
exports.createBezierEasing = createBezierEasing;
|
||
exports.applyEasing = applyEasing;
|
||
|
||
var easings = _interopRequireWildcard(__webpack_require__(138));
|
||
|
||
var _bezierEasing = _interopRequireDefault(__webpack_require__(139));
|
||
|
||
function optimizeFloat(value) {
|
||
var digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
||
var base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
|
||
var pow = Math.pow(base, digits);
|
||
|
||
var _float = Number(Math.round(value * pow) / pow);
|
||
|
||
return Math.abs(_float) > 0.0001 ? _float : 0;
|
||
}
|
||
|
||
function createBezierEasing(easing) {
|
||
return (0, _bezierEasing["default"]).apply(void 0, (0, _toConsumableArray2["default"])(easing));
|
||
}
|
||
|
||
function applyEasing(easing, position, customEasingFn) {
|
||
if (position === 0) {
|
||
return 0;
|
||
}
|
||
|
||
if (position === 1) {
|
||
return 1;
|
||
}
|
||
|
||
if (customEasingFn) {
|
||
return optimizeFloat(position > 0 ? customEasingFn(position) : position);
|
||
}
|
||
|
||
return optimizeFloat(position > 0 && easing && easings[easing] ? easings[easing](position) : position);
|
||
}
|
||
|
||
/***/ }),
|
||
/* 141 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayWithoutHoles = __webpack_require__(314);
|
||
|
||
var iterableToArray = __webpack_require__(315);
|
||
|
||
var nonIterableSpread = __webpack_require__(316);
|
||
|
||
function _toConsumableArray(arr) {
|
||
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
|
||
}
|
||
|
||
module.exports = _toConsumableArray;
|
||
|
||
/***/ }),
|
||
/* 142 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
var _defineProperty2 = _interopRequireDefault(__webpack_require__(24));
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.isPluginType = isPluginType;
|
||
exports.clearPlugin = exports.renderPlugin = exports.createPluginInstance = exports.getPluginDestination = exports.getPluginDuration = exports.getPluginOrigin = exports.getPluginConfig = void 0;
|
||
|
||
var _IX2LottieUtils = __webpack_require__(318);
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _IX2BrowserSupport = __webpack_require__(86); // eslint-disable-next-line webflow/module-top-level-imports, webflow/packages-must-be-defined
|
||
|
||
|
||
var pluginMethodMap = (0, _defineProperty2["default"])({}, _constants.ActionTypeConsts.PLUGIN_LOTTIE, {
|
||
getConfig: _IX2LottieUtils.getPluginConfig,
|
||
getOrigin: _IX2LottieUtils.getPluginOrigin,
|
||
getDuration: _IX2LottieUtils.getPluginDuration,
|
||
getDestination: _IX2LottieUtils.getPluginDestination,
|
||
createInstance: _IX2LottieUtils.createPluginInstance,
|
||
render: _IX2LottieUtils.renderPlugin,
|
||
clear: _IX2LottieUtils.clearPlugin
|
||
});
|
||
|
||
function isPluginType(actionTypeId) {
|
||
return actionTypeId === _constants.ActionTypeConsts.PLUGIN_LOTTIE;
|
||
}
|
||
|
||
var pluginMethod = function pluginMethod(methodName) {
|
||
return function (actionTypeId) {
|
||
if (!_IX2BrowserSupport.IS_BROWSER_ENV) {
|
||
// IX2 plugins require browser libs for now
|
||
return function () {
|
||
return null;
|
||
};
|
||
}
|
||
|
||
var plugin = pluginMethodMap[actionTypeId];
|
||
|
||
if (!plugin) {
|
||
throw new Error("IX2 no plugin configured for: ".concat(actionTypeId));
|
||
}
|
||
|
||
var method = plugin[methodName];
|
||
|
||
if (!method) {
|
||
throw new Error("IX2 invalid plugin method: ".concat(methodName));
|
||
}
|
||
|
||
return method;
|
||
};
|
||
};
|
||
|
||
var getPluginConfig = pluginMethod('getConfig');
|
||
exports.getPluginConfig = getPluginConfig;
|
||
var getPluginOrigin = pluginMethod('getOrigin');
|
||
exports.getPluginOrigin = getPluginOrigin;
|
||
var getPluginDuration = pluginMethod('getDuration');
|
||
exports.getPluginDuration = getPluginDuration;
|
||
var getPluginDestination = pluginMethod('getDestination');
|
||
exports.getPluginDestination = getPluginDestination;
|
||
var createPluginInstance = pluginMethod('createInstance');
|
||
exports.createPluginInstance = createPluginInstance;
|
||
var renderPlugin = pluginMethod('render');
|
||
exports.renderPlugin = renderPlugin;
|
||
var clearPlugin = pluginMethod('clear');
|
||
exports.clearPlugin = clearPlugin;
|
||
|
||
/***/ }),
|
||
/* 143 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseForOwn = __webpack_require__(144),
|
||
createBaseEach = __webpack_require__(325);
|
||
|
||
/**
|
||
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Array|Object} collection The collection to iterate over.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @returns {Array|Object} Returns `collection`.
|
||
*/
|
||
var baseEach = createBaseEach(baseForOwn);
|
||
|
||
module.exports = baseEach;
|
||
|
||
|
||
/***/ }),
|
||
/* 144 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseFor = __webpack_require__(323),
|
||
keys = __webpack_require__(47);
|
||
|
||
/**
|
||
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to iterate over.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @returns {Object} Returns `object`.
|
||
*/
|
||
function baseForOwn(object, iteratee) {
|
||
return object && baseFor(object, iteratee, keys);
|
||
}
|
||
|
||
module.exports = baseForOwn;
|
||
|
||
|
||
/***/ }),
|
||
/* 145 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(329);
|
||
|
||
exports.__esModule = true;
|
||
exports.default = void 0;
|
||
|
||
var _shallowEqual = _interopRequireDefault(__webpack_require__(330));
|
||
|
||
var _default = _shallowEqual.default;
|
||
exports.default = _default;
|
||
|
||
/***/ }),
|
||
/* 146 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault2 = __webpack_require__(1);
|
||
|
||
var _toConsumableArray2 = _interopRequireDefault2(__webpack_require__(141));
|
||
|
||
var _interopRequireWildcard = __webpack_require__(39);
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.observeRequests = observeRequests;
|
||
exports.startEngine = startEngine;
|
||
exports.stopEngine = stopEngine;
|
||
exports.stopAllActionGroups = stopAllActionGroups;
|
||
exports.stopActionGroup = stopActionGroup;
|
||
exports.startActionGroup = startActionGroup;
|
||
|
||
var _extends2 = _interopRequireDefault(__webpack_require__(31));
|
||
|
||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(333));
|
||
|
||
var _find = _interopRequireDefault(__webpack_require__(136));
|
||
|
||
var _get = _interopRequireDefault(__webpack_require__(68));
|
||
|
||
var _size = _interopRequireDefault(__webpack_require__(334));
|
||
|
||
var _omitBy = _interopRequireDefault(__webpack_require__(340));
|
||
|
||
var _isEmpty = _interopRequireDefault(__webpack_require__(352));
|
||
|
||
var _mapValues = _interopRequireDefault(__webpack_require__(353));
|
||
|
||
var _forEach = _interopRequireDefault(__webpack_require__(354));
|
||
|
||
var _throttle = _interopRequireDefault(__webpack_require__(357));
|
||
|
||
var _shallowEqual = _interopRequireDefault(__webpack_require__(145));
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _shared = __webpack_require__(30);
|
||
|
||
var _IX2EngineActions = __webpack_require__(87);
|
||
|
||
var elementApi = _interopRequireWildcard(__webpack_require__(360));
|
||
|
||
var _IX2VanillaEvents = _interopRequireDefault(__webpack_require__(361));
|
||
/* eslint-env browser */
|
||
|
||
|
||
var QuickEffectsIdList = Object.keys(_constants.QuickEffectIds);
|
||
|
||
var isQuickEffect = function isQuickEffect(actionTypeId) {
|
||
return QuickEffectsIdList.includes(actionTypeId);
|
||
};
|
||
|
||
var _constants$IX2EngineC = _constants.IX2EngineConstants,
|
||
COLON_DELIMITER = _constants$IX2EngineC.COLON_DELIMITER,
|
||
BOUNDARY_SELECTOR = _constants$IX2EngineC.BOUNDARY_SELECTOR,
|
||
HTML_ELEMENT = _constants$IX2EngineC.HTML_ELEMENT,
|
||
RENDER_GENERAL = _constants$IX2EngineC.RENDER_GENERAL,
|
||
W_MOD_IX = _constants$IX2EngineC.W_MOD_IX;
|
||
var _shared$IX2VanillaUti = _shared.IX2VanillaUtils,
|
||
getAffectedElements = _shared$IX2VanillaUti.getAffectedElements,
|
||
getElementId = _shared$IX2VanillaUti.getElementId,
|
||
getDestinationValues = _shared$IX2VanillaUti.getDestinationValues,
|
||
observeStore = _shared$IX2VanillaUti.observeStore,
|
||
getInstanceId = _shared$IX2VanillaUti.getInstanceId,
|
||
renderHTMLElement = _shared$IX2VanillaUti.renderHTMLElement,
|
||
clearAllStyles = _shared$IX2VanillaUti.clearAllStyles,
|
||
getMaxDurationItemIndex = _shared$IX2VanillaUti.getMaxDurationItemIndex,
|
||
getComputedStyle = _shared$IX2VanillaUti.getComputedStyle,
|
||
getInstanceOrigin = _shared$IX2VanillaUti.getInstanceOrigin,
|
||
reduceListToGroup = _shared$IX2VanillaUti.reduceListToGroup,
|
||
shouldNamespaceEventParameter = _shared$IX2VanillaUti.shouldNamespaceEventParameter,
|
||
getNamespacedParameterId = _shared$IX2VanillaUti.getNamespacedParameterId,
|
||
shouldAllowMediaQuery = _shared$IX2VanillaUti.shouldAllowMediaQuery,
|
||
cleanupHTMLElement = _shared$IX2VanillaUti.cleanupHTMLElement,
|
||
stringifyTarget = _shared$IX2VanillaUti.stringifyTarget,
|
||
mediaQueriesEqual = _shared$IX2VanillaUti.mediaQueriesEqual;
|
||
var _shared$IX2VanillaPlu = _shared.IX2VanillaPlugins,
|
||
isPluginType = _shared$IX2VanillaPlu.isPluginType,
|
||
createPluginInstance = _shared$IX2VanillaPlu.createPluginInstance,
|
||
getPluginDuration = _shared$IX2VanillaPlu.getPluginDuration;
|
||
var ua = navigator.userAgent;
|
||
var IS_MOBILE_SAFARI = ua.match(/iPad/i) || ua.match(/iPhone/); // Keep throttled events at ~80fps to reduce reflows while maintaining render accuracy
|
||
|
||
var THROTTLED_EVENT_WAIT = 12; // $FlowFixMe
|
||
|
||
function observeRequests(store) {
|
||
observeStore({
|
||
store: store,
|
||
select: function select(_ref) {
|
||
var ixRequest = _ref.ixRequest;
|
||
return ixRequest.preview;
|
||
},
|
||
onChange: handlePreviewRequest
|
||
});
|
||
observeStore({
|
||
store: store,
|
||
select: function select(_ref2) {
|
||
var ixRequest = _ref2.ixRequest;
|
||
return ixRequest.playback;
|
||
},
|
||
onChange: handlePlaybackRequest
|
||
});
|
||
observeStore({
|
||
store: store,
|
||
select: function select(_ref3) {
|
||
var ixRequest = _ref3.ixRequest;
|
||
return ixRequest.stop;
|
||
},
|
||
onChange: handleStopRequest
|
||
});
|
||
observeStore({
|
||
store: store,
|
||
select: function select(_ref4) {
|
||
var ixRequest = _ref4.ixRequest;
|
||
return ixRequest.clear;
|
||
},
|
||
onChange: handleClearRequest
|
||
});
|
||
}
|
||
|
||
function observeMediaQueryChange(store) {
|
||
observeStore({
|
||
store: store,
|
||
select: function select(_ref5) {
|
||
var ixSession = _ref5.ixSession;
|
||
return ixSession.mediaQueryKey;
|
||
},
|
||
onChange: function onChange() {
|
||
stopEngine(store);
|
||
clearAllStyles({
|
||
store: store,
|
||
elementApi: elementApi
|
||
});
|
||
startEngine({
|
||
store: store,
|
||
allowEvents: true
|
||
});
|
||
dispatchPageUpdateEvent();
|
||
}
|
||
});
|
||
}
|
||
|
||
function observeOneRenderTick(store, onTick) {
|
||
var unsubscribe = observeStore({
|
||
store: store,
|
||
select: function select(_ref6) {
|
||
var ixSession = _ref6.ixSession;
|
||
return ixSession.tick;
|
||
},
|
||
onChange: function onChange(tick) {
|
||
onTick(tick);
|
||
unsubscribe();
|
||
}
|
||
});
|
||
}
|
||
|
||
function handlePreviewRequest(_ref7, store) {
|
||
var rawData = _ref7.rawData,
|
||
defer = _ref7.defer;
|
||
|
||
var start = function start() {
|
||
startEngine({
|
||
store: store,
|
||
rawData: rawData,
|
||
allowEvents: true
|
||
});
|
||
dispatchPageUpdateEvent();
|
||
};
|
||
|
||
defer ? setTimeout(start, 0) : start();
|
||
}
|
||
|
||
function dispatchPageUpdateEvent() {
|
||
document.dispatchEvent(new CustomEvent('IX2_PAGE_UPDATE'));
|
||
}
|
||
|
||
function handlePlaybackRequest(playback, store) {
|
||
var actionTypeId = playback.actionTypeId,
|
||
actionListId = playback.actionListId,
|
||
actionItemId = playback.actionItemId,
|
||
eventId = playback.eventId,
|
||
allowEvents = playback.allowEvents,
|
||
immediate = playback.immediate,
|
||
testManual = playback.testManual,
|
||
_playback$verbose = playback.verbose,
|
||
verbose = _playback$verbose === void 0 ? true : _playback$verbose;
|
||
var rawData = playback.rawData;
|
||
|
||
if (actionListId && actionItemId && rawData && immediate) {
|
||
var actionList = rawData.actionLists[actionListId];
|
||
|
||
if (actionList) {
|
||
rawData = reduceListToGroup({
|
||
actionList: actionList,
|
||
actionItemId: actionItemId,
|
||
rawData: rawData
|
||
});
|
||
}
|
||
}
|
||
|
||
startEngine({
|
||
store: store,
|
||
rawData: rawData,
|
||
allowEvents: allowEvents,
|
||
testManual: testManual
|
||
});
|
||
|
||
if (actionListId && actionTypeId === _constants.ActionTypeConsts.GENERAL_START_ACTION || isQuickEffect(actionTypeId)) {
|
||
stopActionGroup({
|
||
store: store,
|
||
actionListId: actionListId
|
||
});
|
||
renderInitialGroup({
|
||
store: store,
|
||
actionListId: actionListId,
|
||
eventId: eventId
|
||
});
|
||
var started = startActionGroup({
|
||
store: store,
|
||
eventId: eventId,
|
||
actionListId: actionListId,
|
||
immediate: immediate,
|
||
verbose: verbose
|
||
});
|
||
|
||
if (verbose && started) {
|
||
store.dispatch((0, _IX2EngineActions.actionListPlaybackChanged)({
|
||
actionListId: actionListId,
|
||
isPlaying: !immediate
|
||
}));
|
||
}
|
||
}
|
||
}
|
||
|
||
function handleStopRequest(_ref8, store) {
|
||
var actionListId = _ref8.actionListId;
|
||
|
||
if (actionListId) {
|
||
stopActionGroup({
|
||
store: store,
|
||
actionListId: actionListId
|
||
});
|
||
} else {
|
||
stopAllActionGroups({
|
||
store: store
|
||
});
|
||
}
|
||
|
||
stopEngine(store);
|
||
}
|
||
|
||
function handleClearRequest(state, store) {
|
||
stopEngine(store);
|
||
clearAllStyles({
|
||
store: store,
|
||
elementApi: elementApi
|
||
});
|
||
} // $FlowFixMe
|
||
|
||
|
||
function startEngine(_ref9) {
|
||
var store = _ref9.store,
|
||
rawData = _ref9.rawData,
|
||
allowEvents = _ref9.allowEvents,
|
||
testManual = _ref9.testManual;
|
||
|
||
var _store$getState = store.getState(),
|
||
ixSession = _store$getState.ixSession;
|
||
|
||
if (rawData) {
|
||
store.dispatch((0, _IX2EngineActions.rawDataImported)(rawData));
|
||
}
|
||
|
||
if (!ixSession.active) {
|
||
store.dispatch((0, _IX2EngineActions.sessionInitialized)({
|
||
hasBoundaryNodes: Boolean(document.querySelector(BOUNDARY_SELECTOR)),
|
||
reducedMotion: // $FlowFixMe - Remove this attribute on beta launch
|
||
document.body.hasAttribute('data-wf-ix-vacation') && window.matchMedia('(prefers-reduced-motion)').matches
|
||
}));
|
||
|
||
if (allowEvents) {
|
||
bindEvents(store);
|
||
addDocumentClass();
|
||
|
||
if (store.getState().ixSession.hasDefinedMediaQueries) {
|
||
observeMediaQueryChange(store);
|
||
}
|
||
}
|
||
|
||
store.dispatch((0, _IX2EngineActions.sessionStarted)());
|
||
startRenderLoop(store, testManual);
|
||
}
|
||
}
|
||
|
||
function addDocumentClass() {
|
||
var _document = document,
|
||
documentElement = _document.documentElement; // $FlowFixMe
|
||
|
||
if (documentElement.className.indexOf(W_MOD_IX) === -1) {
|
||
// $FlowFixMe
|
||
documentElement.className += " ".concat(W_MOD_IX);
|
||
}
|
||
}
|
||
|
||
function startRenderLoop(store, testManual) {
|
||
var handleFrame = function handleFrame(now) {
|
||
var _store$getState2 = store.getState(),
|
||
ixSession = _store$getState2.ixSession,
|
||
ixParameters = _store$getState2.ixParameters;
|
||
|
||
if (ixSession.active) {
|
||
store.dispatch((0, _IX2EngineActions.animationFrameChanged)(now, ixParameters));
|
||
|
||
if (testManual) {
|
||
observeOneRenderTick(store, handleFrame);
|
||
} else {
|
||
requestAnimationFrame(handleFrame);
|
||
}
|
||
}
|
||
};
|
||
|
||
handleFrame(window.performance.now());
|
||
} // $FlowFixMe
|
||
|
||
|
||
function stopEngine(store) {
|
||
var _store$getState3 = store.getState(),
|
||
ixSession = _store$getState3.ixSession;
|
||
|
||
if (ixSession.active) {
|
||
var eventListeners = ixSession.eventListeners;
|
||
eventListeners.forEach(clearEventListener);
|
||
store.dispatch((0, _IX2EngineActions.sessionStopped)());
|
||
}
|
||
}
|
||
|
||
function clearEventListener(_ref10) {
|
||
var target = _ref10.target,
|
||
listenerParams = _ref10.listenerParams;
|
||
target.removeEventListener.apply(target, listenerParams);
|
||
}
|
||
|
||
function createGroupInstances(_ref11) {
|
||
var store = _ref11.store,
|
||
eventStateKey = _ref11.eventStateKey,
|
||
eventTarget = _ref11.eventTarget,
|
||
eventId = _ref11.eventId,
|
||
eventConfig = _ref11.eventConfig,
|
||
actionListId = _ref11.actionListId,
|
||
parameterGroup = _ref11.parameterGroup,
|
||
smoothing = _ref11.smoothing,
|
||
restingValue = _ref11.restingValue;
|
||
|
||
var _store$getState4 = store.getState(),
|
||
ixData = _store$getState4.ixData,
|
||
ixSession = _store$getState4.ixSession;
|
||
|
||
var events = ixData.events;
|
||
var event = events[eventId];
|
||
var eventTypeId = event.eventTypeId;
|
||
var targetCache = {};
|
||
var instanceActionGroups = {};
|
||
var instanceConfigs = [];
|
||
var continuousActionGroups = parameterGroup.continuousActionGroups;
|
||
var parameterId = parameterGroup.id;
|
||
|
||
if (shouldNamespaceEventParameter(eventTypeId, eventConfig)) {
|
||
parameterId = getNamespacedParameterId(eventStateKey, parameterId);
|
||
} // Limit affected elements when event target is within a boundary node
|
||
|
||
|
||
var eventElementRoot = ixSession.hasBoundaryNodes && eventTarget ? elementApi.getClosestElement(eventTarget, BOUNDARY_SELECTOR) : null;
|
||
continuousActionGroups.forEach(function (actionGroup) {
|
||
var keyframe = actionGroup.keyframe,
|
||
actionItems = actionGroup.actionItems;
|
||
actionItems.forEach(function (actionItem) {
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
var target = actionItem.config.target;
|
||
|
||
if (!target) {
|
||
return;
|
||
}
|
||
|
||
var elementRoot = target.boundaryMode ? eventElementRoot : null;
|
||
var key = stringifyTarget(target) + COLON_DELIMITER + actionTypeId;
|
||
instanceActionGroups[key] = appendActionItem(instanceActionGroups[key], keyframe, actionItem);
|
||
|
||
if (!targetCache[key]) {
|
||
targetCache[key] = true;
|
||
var config = actionItem.config;
|
||
getAffectedElements({
|
||
config: config,
|
||
event: event,
|
||
eventTarget: eventTarget,
|
||
elementRoot: elementRoot,
|
||
elementApi: elementApi
|
||
}).forEach(function (element) {
|
||
instanceConfigs.push({
|
||
element: element,
|
||
key: key
|
||
});
|
||
});
|
||
}
|
||
});
|
||
});
|
||
instanceConfigs.forEach(function (_ref12) {
|
||
var element = _ref12.element,
|
||
key = _ref12.key;
|
||
var actionGroups = instanceActionGroups[key];
|
||
var actionItem = (0, _get["default"])(actionGroups, "[0].actionItems[0]", {});
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
var pluginInstance = isPluginType(actionTypeId) ? // $FlowFixMe
|
||
createPluginInstance(actionTypeId)(element, actionItem) : null;
|
||
var destination = getDestinationValues({
|
||
element: element,
|
||
actionItem: actionItem,
|
||
elementApi: elementApi
|
||
}, // $FlowFixMe
|
||
pluginInstance);
|
||
createInstance({
|
||
store: store,
|
||
element: element,
|
||
eventId: eventId,
|
||
actionListId: actionListId,
|
||
actionItem: actionItem,
|
||
destination: destination,
|
||
continuous: true,
|
||
parameterId: parameterId,
|
||
actionGroups: actionGroups,
|
||
smoothing: smoothing,
|
||
restingValue: restingValue,
|
||
pluginInstance: pluginInstance
|
||
});
|
||
});
|
||
}
|
||
|
||
function appendActionItem() {
|
||
var actionGroups = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||
var keyframe = arguments.length > 1 ? arguments[1] : undefined;
|
||
var actionItem = arguments.length > 2 ? arguments[2] : undefined;
|
||
var newActionGroups = (0, _toConsumableArray2["default"])(actionGroups);
|
||
var groupIndex;
|
||
newActionGroups.some(function (group, index) {
|
||
if (group.keyframe === keyframe) {
|
||
groupIndex = index;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
});
|
||
|
||
if (groupIndex == null) {
|
||
groupIndex = newActionGroups.length;
|
||
newActionGroups.push({
|
||
keyframe: keyframe,
|
||
actionItems: []
|
||
});
|
||
}
|
||
|
||
newActionGroups[groupIndex].actionItems.push(actionItem);
|
||
return newActionGroups;
|
||
}
|
||
|
||
function bindEvents(store) {
|
||
var _store$getState5 = store.getState(),
|
||
ixData = _store$getState5.ixData;
|
||
|
||
var eventTypeMap = ixData.eventTypeMap;
|
||
updateViewportWidth(store);
|
||
(0, _forEach["default"])(eventTypeMap, function (events, key) {
|
||
var logic = _IX2VanillaEvents["default"][key];
|
||
|
||
if (!logic) {
|
||
console.warn("IX2 event type not configured: ".concat(key));
|
||
return;
|
||
}
|
||
|
||
bindEventType({
|
||
logic: logic,
|
||
store: store,
|
||
events: events
|
||
});
|
||
});
|
||
|
||
var _store$getState6 = store.getState(),
|
||
ixSession = _store$getState6.ixSession;
|
||
|
||
if (ixSession.eventListeners.length) {
|
||
bindResizeEvents(store);
|
||
}
|
||
}
|
||
|
||
var WINDOW_RESIZE_EVENTS = ['resize', 'orientationchange'];
|
||
|
||
function bindResizeEvents(store) {
|
||
var handleResize = function handleResize() {
|
||
updateViewportWidth(store);
|
||
};
|
||
|
||
WINDOW_RESIZE_EVENTS.forEach(function (type) {
|
||
window.addEventListener(type, handleResize);
|
||
store.dispatch((0, _IX2EngineActions.eventListenerAdded)(window, [type, handleResize]));
|
||
});
|
||
handleResize();
|
||
}
|
||
|
||
function updateViewportWidth(store) {
|
||
var _store$getState7 = store.getState(),
|
||
ixSession = _store$getState7.ixSession,
|
||
ixData = _store$getState7.ixData;
|
||
|
||
var width = window.innerWidth;
|
||
|
||
if (width !== ixSession.viewportWidth) {
|
||
var mediaQueries = ixData.mediaQueries;
|
||
store.dispatch((0, _IX2EngineActions.viewportWidthChanged)({
|
||
width: width,
|
||
mediaQueries: mediaQueries
|
||
}));
|
||
}
|
||
}
|
||
|
||
var mapFoundValues = function mapFoundValues(object, iteratee) {
|
||
return (0, _omitBy["default"])((0, _mapValues["default"])(object, iteratee), _isEmpty["default"]);
|
||
};
|
||
|
||
var forEachEventTarget = function forEachEventTarget(eventTargets, eventCallback) {
|
||
(0, _forEach["default"])(eventTargets, function (elements, eventId) {
|
||
elements.forEach(function (element, index) {
|
||
var eventStateKey = eventId + COLON_DELIMITER + index;
|
||
eventCallback(element, eventId, eventStateKey);
|
||
});
|
||
});
|
||
};
|
||
|
||
var getAffectedForEvent = function getAffectedForEvent(event) {
|
||
var config = {
|
||
target: event.target,
|
||
targets: event.targets
|
||
};
|
||
return getAffectedElements({
|
||
config: config,
|
||
elementApi: elementApi
|
||
});
|
||
};
|
||
|
||
function bindEventType(_ref13) {
|
||
var logic = _ref13.logic,
|
||
store = _ref13.store,
|
||
events = _ref13.events;
|
||
injectBehaviorCSSFixes(events);
|
||
var eventTypes = logic.types,
|
||
eventHandler = logic.handler;
|
||
|
||
var _store$getState8 = store.getState(),
|
||
ixData = _store$getState8.ixData;
|
||
|
||
var actionLists = ixData.actionLists;
|
||
var eventTargets = mapFoundValues(events, getAffectedForEvent);
|
||
|
||
if (!(0, _size["default"])(eventTargets)) {
|
||
return;
|
||
}
|
||
|
||
(0, _forEach["default"])(eventTargets, function (elements, key) {
|
||
var event = events[key];
|
||
var eventAction = event.action,
|
||
eventId = event.id,
|
||
_event$mediaQueries = event.mediaQueries,
|
||
mediaQueries = _event$mediaQueries === void 0 ? ixData.mediaQueryKeys : _event$mediaQueries;
|
||
var actionListId = eventAction.config.actionListId;
|
||
|
||
if (!mediaQueriesEqual(mediaQueries, ixData.mediaQueryKeys)) {
|
||
store.dispatch((0, _IX2EngineActions.mediaQueriesDefined)());
|
||
}
|
||
|
||
if (eventAction.actionTypeId === _constants.ActionTypeConsts.GENERAL_CONTINUOUS_ACTION) {
|
||
var configs = Array.isArray(event.config) ? event.config : [event.config];
|
||
configs.forEach(function (eventConfig) {
|
||
var continuousParameterGroupId = eventConfig.continuousParameterGroupId;
|
||
var paramGroups = (0, _get["default"])(actionLists, "".concat(actionListId, ".continuousParameterGroups"), []);
|
||
var parameterGroup = (0, _find["default"])(paramGroups, function (_ref14) {
|
||
var id = _ref14.id;
|
||
return id === continuousParameterGroupId;
|
||
});
|
||
var smoothing = (eventConfig.smoothing || 0) / 100;
|
||
var restingValue = (eventConfig.restingState || 0) / 100;
|
||
|
||
if (!parameterGroup) {
|
||
return;
|
||
}
|
||
|
||
elements.forEach(function (eventTarget, index) {
|
||
var eventStateKey = eventId + COLON_DELIMITER + index;
|
||
createGroupInstances({
|
||
store: store,
|
||
eventStateKey: eventStateKey,
|
||
eventTarget: eventTarget,
|
||
eventId: eventId,
|
||
eventConfig: eventConfig,
|
||
actionListId: actionListId,
|
||
parameterGroup: parameterGroup,
|
||
smoothing: smoothing,
|
||
restingValue: restingValue
|
||
});
|
||
});
|
||
});
|
||
}
|
||
|
||
if (eventAction.actionTypeId === _constants.ActionTypeConsts.GENERAL_START_ACTION || isQuickEffect(eventAction.actionTypeId)) {
|
||
renderInitialGroup({
|
||
store: store,
|
||
actionListId: actionListId,
|
||
eventId: eventId
|
||
});
|
||
}
|
||
});
|
||
|
||
var handleEvent = function handleEvent(nativeEvent) {
|
||
var _store$getState9 = store.getState(),
|
||
ixSession = _store$getState9.ixSession;
|
||
|
||
forEachEventTarget(eventTargets, function (element, eventId, eventStateKey) {
|
||
var event = events[eventId];
|
||
var oldState = ixSession.eventState[eventStateKey];
|
||
var eventAction = event.action,
|
||
_event$mediaQueries2 = event.mediaQueries,
|
||
mediaQueries = _event$mediaQueries2 === void 0 ? ixData.mediaQueryKeys : _event$mediaQueries2; // Bypass event handler if current media query is not listed in event config
|
||
|
||
if (!shouldAllowMediaQuery(mediaQueries, ixSession.mediaQueryKey)) {
|
||
return;
|
||
}
|
||
|
||
var handleEventWithConfig = function handleEventWithConfig() {
|
||
var eventConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
var newState = eventHandler({
|
||
store: store,
|
||
element: element,
|
||
event: event,
|
||
eventConfig: eventConfig,
|
||
nativeEvent: nativeEvent,
|
||
eventStateKey: eventStateKey
|
||
}, oldState);
|
||
|
||
if (!(0, _shallowEqual["default"])(newState, oldState)) {
|
||
store.dispatch((0, _IX2EngineActions.eventStateChanged)(eventStateKey, newState));
|
||
}
|
||
};
|
||
|
||
if (eventAction.actionTypeId === _constants.ActionTypeConsts.GENERAL_CONTINUOUS_ACTION) {
|
||
var configs = Array.isArray(event.config) ? event.config : [event.config];
|
||
configs.forEach(handleEventWithConfig);
|
||
} else {
|
||
handleEventWithConfig();
|
||
}
|
||
});
|
||
};
|
||
|
||
var handleEventThrottled = (0, _throttle["default"])(handleEvent, THROTTLED_EVENT_WAIT);
|
||
|
||
var addListeners = function addListeners(_ref15) {
|
||
var _ref15$target = _ref15.target,
|
||
target = _ref15$target === void 0 ? document : _ref15$target,
|
||
types = _ref15.types,
|
||
shouldThrottle = _ref15.throttle;
|
||
types.split(' ').filter(Boolean).forEach(function (type) {
|
||
var handlerFunc = shouldThrottle ? handleEventThrottled : handleEvent; // $FlowFixMe
|
||
|
||
target.addEventListener(type, handlerFunc);
|
||
store.dispatch((0, _IX2EngineActions.eventListenerAdded)(target, [type, handlerFunc]));
|
||
});
|
||
};
|
||
|
||
if (Array.isArray(eventTypes)) {
|
||
eventTypes.forEach(addListeners);
|
||
} else if (typeof eventTypes === 'string') {
|
||
addListeners(logic);
|
||
}
|
||
}
|
||
/**
|
||
* Injects CSS into the document to fix behavior issues across
|
||
* different devices.
|
||
*/
|
||
|
||
|
||
function injectBehaviorCSSFixes(events) {
|
||
if (!IS_MOBILE_SAFARI) {
|
||
return;
|
||
}
|
||
|
||
var injectedSelectors = {};
|
||
var cssText = '';
|
||
|
||
for (var eventId in events) {
|
||
var _events$eventId = events[eventId],
|
||
eventTypeId = _events$eventId.eventTypeId,
|
||
target = _events$eventId.target;
|
||
var selector = elementApi.getQuerySelector(target); // $FlowFixMe
|
||
|
||
if (injectedSelectors[selector]) {
|
||
continue;
|
||
} // add a "cursor: pointer" style rule to ensure that CLICK events get fired for IOS devices
|
||
|
||
|
||
if (eventTypeId === _constants.EventTypeConsts.MOUSE_CLICK || eventTypeId === _constants.EventTypeConsts.MOUSE_SECOND_CLICK) {
|
||
// $FlowFixMe
|
||
injectedSelectors[selector] = true;
|
||
cssText += // $FlowFixMe
|
||
selector + '{' + 'cursor: pointer;' + 'touch-action: manipulation;' + '}';
|
||
}
|
||
}
|
||
|
||
if (cssText) {
|
||
var style = document.createElement('style');
|
||
style.textContent = cssText; // $FlowFixMe
|
||
|
||
document.body.appendChild(style);
|
||
}
|
||
}
|
||
|
||
function renderInitialGroup(_ref16) {
|
||
var store = _ref16.store,
|
||
actionListId = _ref16.actionListId,
|
||
eventId = _ref16.eventId;
|
||
|
||
var _store$getState10 = store.getState(),
|
||
ixData = _store$getState10.ixData,
|
||
ixSession = _store$getState10.ixSession;
|
||
|
||
var actionLists = ixData.actionLists,
|
||
events = ixData.events;
|
||
var event = events[eventId];
|
||
var actionList = actionLists[actionListId];
|
||
|
||
if (actionList && actionList.useFirstGroupAsInitialState) {
|
||
var initialStateItems = (0, _get["default"])(actionList, 'actionItemGroups[0].actionItems', []); // Bypass initial state render if current media query is not listed in event config
|
||
|
||
var mediaQueries = (0, _get["default"])(event, 'mediaQueries', ixData.mediaQueryKeys);
|
||
|
||
if (!shouldAllowMediaQuery(mediaQueries, ixSession.mediaQueryKey)) {
|
||
return;
|
||
}
|
||
|
||
initialStateItems.forEach(function (actionItem) {
|
||
var _itemConfig$target;
|
||
|
||
var itemConfig = actionItem.config,
|
||
actionTypeId = actionItem.actionTypeId;
|
||
var config = // When useEventTarget is explicitly true, use event target/targets to query elements
|
||
(itemConfig === null || itemConfig === void 0 ? void 0 : (_itemConfig$target = itemConfig.target) === null || _itemConfig$target === void 0 ? void 0 : _itemConfig$target.useEventTarget) === true ? {
|
||
target: event.target,
|
||
targets: event.targets
|
||
} : itemConfig;
|
||
var itemElements = getAffectedElements({
|
||
config: config,
|
||
event: event,
|
||
elementApi: elementApi
|
||
});
|
||
var shouldUsePlugin = isPluginType(actionTypeId);
|
||
itemElements.forEach(function (element) {
|
||
var pluginInstance = shouldUsePlugin ? // $FlowFixMe
|
||
createPluginInstance(actionTypeId)(element, actionItem) : null;
|
||
createInstance({
|
||
destination: getDestinationValues({
|
||
element: element,
|
||
actionItem: actionItem,
|
||
elementApi: elementApi
|
||
}, // $FlowFixMe
|
||
pluginInstance),
|
||
immediate: true,
|
||
store: store,
|
||
element: element,
|
||
eventId: eventId,
|
||
actionItem: actionItem,
|
||
actionListId: actionListId,
|
||
pluginInstance: pluginInstance
|
||
});
|
||
});
|
||
});
|
||
}
|
||
} // $FlowFixMe
|
||
|
||
|
||
function stopAllActionGroups(_ref17) {
|
||
var store = _ref17.store;
|
||
|
||
var _store$getState11 = store.getState(),
|
||
ixInstances = _store$getState11.ixInstances;
|
||
|
||
(0, _forEach["default"])(ixInstances, function (instance) {
|
||
if (!instance.continuous) {
|
||
var actionListId = instance.actionListId,
|
||
verbose = instance.verbose;
|
||
removeInstance(instance, store);
|
||
|
||
if (verbose) {
|
||
store.dispatch((0, _IX2EngineActions.actionListPlaybackChanged)({
|
||
actionListId: actionListId,
|
||
isPlaying: false
|
||
}));
|
||
}
|
||
}
|
||
});
|
||
} // $FlowFixMe
|
||
|
||
|
||
function stopActionGroup(_ref18) {
|
||
var store = _ref18.store,
|
||
eventId = _ref18.eventId,
|
||
eventTarget = _ref18.eventTarget,
|
||
eventStateKey = _ref18.eventStateKey,
|
||
actionListId = _ref18.actionListId;
|
||
|
||
var _store$getState12 = store.getState(),
|
||
ixInstances = _store$getState12.ixInstances,
|
||
ixSession = _store$getState12.ixSession; // Check for element boundary before stopping engine instances
|
||
|
||
|
||
var eventElementRoot = ixSession.hasBoundaryNodes && eventTarget ? elementApi.getClosestElement(eventTarget, BOUNDARY_SELECTOR) : null;
|
||
(0, _forEach["default"])(ixInstances, function (instance) {
|
||
var boundaryMode = (0, _get["default"])(instance, 'actionItem.config.target.boundaryMode'); // Validate event key if eventStateKey was provided, otherwise default to true
|
||
|
||
var validEventKey = eventStateKey ? instance.eventStateKey === eventStateKey : true; // Remove engine instances that match the required ids
|
||
|
||
if (instance.actionListId === actionListId && instance.eventId === eventId && validEventKey) {
|
||
// Avoid removal when root boundary does not contain instance element
|
||
if (eventElementRoot && boundaryMode && !elementApi.elementContains(eventElementRoot, instance.element)) {
|
||
return;
|
||
}
|
||
|
||
removeInstance(instance, store);
|
||
|
||
if (instance.verbose) {
|
||
store.dispatch((0, _IX2EngineActions.actionListPlaybackChanged)({
|
||
actionListId: actionListId,
|
||
isPlaying: false
|
||
}));
|
||
}
|
||
}
|
||
});
|
||
} // $FlowFixMe
|
||
|
||
|
||
function startActionGroup(_ref19) {
|
||
var store = _ref19.store,
|
||
eventId = _ref19.eventId,
|
||
eventTarget = _ref19.eventTarget,
|
||
eventStateKey = _ref19.eventStateKey,
|
||
actionListId = _ref19.actionListId,
|
||
_ref19$groupIndex = _ref19.groupIndex,
|
||
groupIndex = _ref19$groupIndex === void 0 ? 0 : _ref19$groupIndex,
|
||
immediate = _ref19.immediate,
|
||
verbose = _ref19.verbose;
|
||
|
||
var _event$action;
|
||
|
||
var _store$getState13 = store.getState(),
|
||
ixData = _store$getState13.ixData,
|
||
ixSession = _store$getState13.ixSession;
|
||
|
||
var events = ixData.events;
|
||
var event = events[eventId] || {};
|
||
var _event$mediaQueries3 = event.mediaQueries,
|
||
mediaQueries = _event$mediaQueries3 === void 0 ? ixData.mediaQueryKeys : _event$mediaQueries3;
|
||
var actionList = (0, _get["default"])(ixData, "actionLists.".concat(actionListId), {});
|
||
var actionItemGroups = actionList.actionItemGroups,
|
||
useFirstGroupAsInitialState = actionList.useFirstGroupAsInitialState; // Abort playback if no action groups
|
||
|
||
if (!actionItemGroups || !actionItemGroups.length) {
|
||
return false;
|
||
} // Reset to first group when event loop is configured
|
||
|
||
|
||
if (groupIndex >= actionItemGroups.length && (0, _get["default"])(event, 'config.loop')) {
|
||
groupIndex = 0;
|
||
} // Skip initial state group during action list playback, as it should already be applied
|
||
|
||
|
||
if (groupIndex === 0 && useFirstGroupAsInitialState) {
|
||
groupIndex++;
|
||
} // Identify first animated group and apply the initial QuickEffect delay
|
||
|
||
|
||
var isFirstGroup = groupIndex === 0 || groupIndex === 1 && useFirstGroupAsInitialState;
|
||
var instanceDelay = isFirstGroup && isQuickEffect((_event$action = event.action) === null || _event$action === void 0 ? void 0 : _event$action.actionTypeId) ? event.config.delay : undefined; // Abort playback if no action items exist at group index
|
||
|
||
var actionItems = (0, _get["default"])(actionItemGroups, [groupIndex, 'actionItems'], []);
|
||
|
||
if (!actionItems.length) {
|
||
return false;
|
||
} // Abort playback if current media query is not listed in event config
|
||
|
||
|
||
if (!shouldAllowMediaQuery(mediaQueries, ixSession.mediaQueryKey)) {
|
||
return false;
|
||
} // Limit affected elements when event target is within a boundary node
|
||
|
||
|
||
var eventElementRoot = ixSession.hasBoundaryNodes && eventTarget ? elementApi.getClosestElement(eventTarget, BOUNDARY_SELECTOR) : null;
|
||
var carrierIndex = getMaxDurationItemIndex(actionItems);
|
||
var groupStartResult = false;
|
||
actionItems.forEach(function (actionItem, actionIndex) {
|
||
var config = actionItem.config,
|
||
actionTypeId = actionItem.actionTypeId;
|
||
var shouldUsePlugin = isPluginType(actionTypeId);
|
||
var target = config.target;
|
||
|
||
if (!target) {
|
||
return;
|
||
}
|
||
|
||
var elementRoot = target.boundaryMode ? eventElementRoot : null;
|
||
var elements = getAffectedElements({
|
||
config: config,
|
||
event: event,
|
||
eventTarget: eventTarget,
|
||
elementRoot: elementRoot,
|
||
elementApi: elementApi
|
||
});
|
||
elements.forEach(function (element, elementIndex) {
|
||
var pluginInstance = shouldUsePlugin ? // $FlowFixMe
|
||
createPluginInstance(actionTypeId)(element, actionItem) : null;
|
||
var pluginDuration = shouldUsePlugin ? // $FlowFixMe
|
||
getPluginDuration(actionTypeId)(element, actionItem) : null;
|
||
groupStartResult = true;
|
||
var isCarrier = carrierIndex === actionIndex && elementIndex === 0;
|
||
var computedStyle = getComputedStyle({
|
||
element: element,
|
||
actionItem: actionItem
|
||
});
|
||
var destination = getDestinationValues({
|
||
element: element,
|
||
actionItem: actionItem,
|
||
elementApi: elementApi
|
||
}, // $FlowFixMe
|
||
pluginInstance);
|
||
createInstance({
|
||
store: store,
|
||
element: element,
|
||
actionItem: actionItem,
|
||
eventId: eventId,
|
||
eventTarget: eventTarget,
|
||
eventStateKey: eventStateKey,
|
||
actionListId: actionListId,
|
||
groupIndex: groupIndex,
|
||
isCarrier: isCarrier,
|
||
computedStyle: computedStyle,
|
||
destination: destination,
|
||
immediate: immediate,
|
||
verbose: verbose,
|
||
pluginInstance: pluginInstance,
|
||
pluginDuration: pluginDuration,
|
||
instanceDelay: instanceDelay
|
||
});
|
||
});
|
||
});
|
||
return groupStartResult;
|
||
}
|
||
|
||
function createInstance(options) {
|
||
var _ixData$events$eventI; // $FlowFixMe
|
||
|
||
|
||
var store = options.store,
|
||
computedStyle = options.computedStyle,
|
||
rest = (0, _objectWithoutPropertiesLoose2["default"])(options, ["store", "computedStyle"]);
|
||
var element = rest.element,
|
||
actionItem = rest.actionItem,
|
||
immediate = rest.immediate,
|
||
pluginInstance = rest.pluginInstance,
|
||
continuous = rest.continuous,
|
||
restingValue = rest.restingValue,
|
||
eventId = rest.eventId;
|
||
var autoStart = !continuous;
|
||
var instanceId = getInstanceId();
|
||
|
||
var _store$getState14 = store.getState(),
|
||
ixElements = _store$getState14.ixElements,
|
||
ixSession = _store$getState14.ixSession,
|
||
ixData = _store$getState14.ixData;
|
||
|
||
var elementId = getElementId(ixElements, element);
|
||
|
||
var _ref20 = ixElements[elementId] || {},
|
||
refState = _ref20.refState;
|
||
|
||
var refType = elementApi.getRefType(element);
|
||
var skipMotion = ixSession.reducedMotion && _constants.ReducedMotionTypes[actionItem.actionTypeId];
|
||
var skipToValue;
|
||
|
||
if (skipMotion && continuous) {
|
||
switch ((_ixData$events$eventI = ixData.events[eventId]) === null || _ixData$events$eventI === void 0 ? void 0 : _ixData$events$eventI.eventTypeId) {
|
||
case _constants.EventTypeConsts.MOUSE_MOVE:
|
||
case _constants.EventTypeConsts.MOUSE_MOVE_IN_VIEWPORT:
|
||
skipToValue = restingValue;
|
||
break;
|
||
|
||
default:
|
||
skipToValue = 0.5;
|
||
break;
|
||
}
|
||
}
|
||
|
||
var origin = getInstanceOrigin(element, refState, computedStyle, actionItem, elementApi, // $FlowFixMe
|
||
pluginInstance);
|
||
store.dispatch((0, _IX2EngineActions.instanceAdded)((0, _extends2["default"])({
|
||
instanceId: instanceId,
|
||
elementId: elementId,
|
||
origin: origin,
|
||
refType: refType,
|
||
skipMotion: skipMotion,
|
||
skipToValue: skipToValue
|
||
}, rest)));
|
||
dispatchCustomEvent(document.body, 'ix2-animation-started', instanceId);
|
||
|
||
if (immediate) {
|
||
renderImmediateInstance(store, instanceId);
|
||
return;
|
||
}
|
||
|
||
observeStore({
|
||
store: store,
|
||
select: function select(_ref21) {
|
||
var ixInstances = _ref21.ixInstances;
|
||
return ixInstances[instanceId];
|
||
},
|
||
onChange: handleInstanceChange
|
||
});
|
||
|
||
if (autoStart) {
|
||
store.dispatch((0, _IX2EngineActions.instanceStarted)(instanceId, ixSession.tick));
|
||
}
|
||
}
|
||
|
||
function removeInstance(instance, store) {
|
||
dispatchCustomEvent(document.body, 'ix2-animation-stopping', {
|
||
instanceId: instance.id,
|
||
state: store.getState()
|
||
});
|
||
var elementId = instance.elementId,
|
||
actionItem = instance.actionItem;
|
||
|
||
var _store$getState15 = store.getState(),
|
||
ixElements = _store$getState15.ixElements;
|
||
|
||
var _ref22 = ixElements[elementId] || {},
|
||
ref = _ref22.ref,
|
||
refType = _ref22.refType;
|
||
|
||
if (refType === HTML_ELEMENT) {
|
||
cleanupHTMLElement(ref, actionItem, elementApi);
|
||
}
|
||
|
||
store.dispatch((0, _IX2EngineActions.instanceRemoved)(instance.id));
|
||
}
|
||
|
||
function dispatchCustomEvent(element, eventName, detail) {
|
||
var event = document.createEvent('CustomEvent');
|
||
event.initCustomEvent(eventName, true, true, detail); // $FlowFixMe
|
||
|
||
element.dispatchEvent(event);
|
||
}
|
||
|
||
function renderImmediateInstance(store, instanceId) {
|
||
var _store$getState16 = store.getState(),
|
||
ixParameters = _store$getState16.ixParameters;
|
||
|
||
store.dispatch((0, _IX2EngineActions.instanceStarted)(instanceId, 0));
|
||
store.dispatch((0, _IX2EngineActions.animationFrameChanged)(performance.now(), ixParameters));
|
||
|
||
var _store$getState17 = store.getState(),
|
||
ixInstances = _store$getState17.ixInstances;
|
||
|
||
handleInstanceChange(ixInstances[instanceId], store);
|
||
}
|
||
|
||
function handleInstanceChange(instance, store) {
|
||
var active = instance.active,
|
||
continuous = instance.continuous,
|
||
complete = instance.complete,
|
||
elementId = instance.elementId,
|
||
actionItem = instance.actionItem,
|
||
actionTypeId = instance.actionTypeId,
|
||
renderType = instance.renderType,
|
||
current = instance.current,
|
||
groupIndex = instance.groupIndex,
|
||
eventId = instance.eventId,
|
||
eventTarget = instance.eventTarget,
|
||
eventStateKey = instance.eventStateKey,
|
||
actionListId = instance.actionListId,
|
||
isCarrier = instance.isCarrier,
|
||
styleProp = instance.styleProp,
|
||
verbose = instance.verbose,
|
||
pluginInstance = instance.pluginInstance; // Bypass render if current media query is not listed in event config
|
||
|
||
var _store$getState18 = store.getState(),
|
||
ixData = _store$getState18.ixData,
|
||
ixSession = _store$getState18.ixSession;
|
||
|
||
var events = ixData.events;
|
||
var event = events[eventId] || {};
|
||
var _event$mediaQueries4 = event.mediaQueries,
|
||
mediaQueries = _event$mediaQueries4 === void 0 ? ixData.mediaQueryKeys : _event$mediaQueries4;
|
||
|
||
if (!shouldAllowMediaQuery(mediaQueries, ixSession.mediaQueryKey)) {
|
||
return;
|
||
}
|
||
|
||
if (continuous || active || complete) {
|
||
if (current || renderType === RENDER_GENERAL && complete) {
|
||
// Render current values to ref state and grab latest
|
||
store.dispatch((0, _IX2EngineActions.elementStateChanged)(elementId, actionTypeId, current, actionItem));
|
||
|
||
var _store$getState19 = store.getState(),
|
||
ixElements = _store$getState19.ixElements;
|
||
|
||
var _ref23 = ixElements[elementId] || {},
|
||
ref = _ref23.ref,
|
||
refType = _ref23.refType,
|
||
refState = _ref23.refState;
|
||
|
||
var actionState = refState && refState[actionTypeId]; // Choose render based on ref type
|
||
|
||
switch (refType) {
|
||
case HTML_ELEMENT:
|
||
{
|
||
renderHTMLElement(ref, refState, actionState, eventId, actionItem, styleProp, elementApi, renderType, pluginInstance);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (complete) {
|
||
if (isCarrier) {
|
||
var started = startActionGroup({
|
||
store: store,
|
||
eventId: eventId,
|
||
eventTarget: eventTarget,
|
||
eventStateKey: eventStateKey,
|
||
actionListId: actionListId,
|
||
groupIndex: groupIndex + 1,
|
||
verbose: verbose
|
||
});
|
||
|
||
if (verbose && !started) {
|
||
store.dispatch((0, _IX2EngineActions.actionListPlaybackChanged)({
|
||
actionListId: actionListId,
|
||
isPlaying: false
|
||
}));
|
||
}
|
||
}
|
||
|
||
removeInstance(instance, store);
|
||
}
|
||
}
|
||
}
|
||
|
||
/***/ }),
|
||
/* 147 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var defineProperty = __webpack_require__(148);
|
||
|
||
/**
|
||
* The base implementation of `assignValue` and `assignMergeValue` without
|
||
* value checks.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to modify.
|
||
* @param {string} key The key of the property to assign.
|
||
* @param {*} value The value to assign.
|
||
*/
|
||
function baseAssignValue(object, key, value) {
|
||
if (key == '__proto__' && defineProperty) {
|
||
defineProperty(object, key, {
|
||
'configurable': true,
|
||
'enumerable': true,
|
||
'value': value,
|
||
'writable': true
|
||
});
|
||
} else {
|
||
object[key] = value;
|
||
}
|
||
}
|
||
|
||
module.exports = baseAssignValue;
|
||
|
||
|
||
/***/ }),
|
||
/* 148 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getNative = __webpack_require__(19);
|
||
|
||
var defineProperty = (function() {
|
||
try {
|
||
var func = getNative(Object, 'defineProperty');
|
||
func({}, '', {});
|
||
return func;
|
||
} catch (e) {}
|
||
}());
|
||
|
||
module.exports = defineProperty;
|
||
|
||
|
||
/***/ }),
|
||
/* 149 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(12);
|
||
|
||
/** Built-in value references. */
|
||
var objectCreate = Object.create;
|
||
|
||
/**
|
||
* The base implementation of `_.create` without support for assigning
|
||
* properties to the created object.
|
||
*
|
||
* @private
|
||
* @param {Object} proto The object to inherit from.
|
||
* @returns {Object} Returns the new object.
|
||
*/
|
||
var baseCreate = (function() {
|
||
function object() {}
|
||
return function(proto) {
|
||
if (!isObject(proto)) {
|
||
return {};
|
||
}
|
||
if (objectCreate) {
|
||
return objectCreate(proto);
|
||
}
|
||
object.prototype = proto;
|
||
var result = new object;
|
||
object.prototype = undefined;
|
||
return result;
|
||
};
|
||
}());
|
||
|
||
module.exports = baseCreate;
|
||
|
||
|
||
/***/ }),
|
||
/* 150 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var metaMap = __webpack_require__(374),
|
||
noop = __webpack_require__(375);
|
||
|
||
/**
|
||
* Gets metadata for `func`.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to query.
|
||
* @returns {*} Returns the metadata for `func`.
|
||
*/
|
||
var getData = !metaMap ? noop : function(func) {
|
||
return metaMap.get(func);
|
||
};
|
||
|
||
module.exports = getData;
|
||
|
||
|
||
/***/ }),
|
||
/* 151 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var realNames = __webpack_require__(376);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Gets the name of `func`.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to query.
|
||
* @returns {string} Returns the function name.
|
||
*/
|
||
function getFuncName(func) {
|
||
var result = (func.name + ''),
|
||
array = realNames[result],
|
||
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
|
||
|
||
while (length--) {
|
||
var data = array[length],
|
||
otherFunc = data.func;
|
||
if (otherFunc == null || otherFunc == func) {
|
||
return data.name;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = getFuncName;
|
||
|
||
|
||
/***/ }),
|
||
/* 152 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
__webpack_require__(153);
|
||
__webpack_require__(287);
|
||
__webpack_require__(56);
|
||
__webpack_require__(289);
|
||
__webpack_require__(383);
|
||
__webpack_require__(384);
|
||
__webpack_require__(385);
|
||
__webpack_require__(386);
|
||
__webpack_require__(387);
|
||
__webpack_require__(392);
|
||
module.exports = __webpack_require__(393);
|
||
|
||
|
||
/***/ }),
|
||
/* 153 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
var lottieSiteModule = __webpack_require__(155);
|
||
|
||
var lottie = __webpack_require__(286);
|
||
|
||
Webflow.define('lottie', module.exports = function () {
|
||
return {
|
||
lottie: lottie,
|
||
createInstance: lottieSiteModule.createInstance,
|
||
cleanupElement: lottieSiteModule.cleanupElement,
|
||
init: lottieSiteModule.init,
|
||
destroy: lottieSiteModule.destroy,
|
||
ready: lottieSiteModule.ready
|
||
};
|
||
});
|
||
|
||
/***/ }),
|
||
/* 154 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
// Include tram for frame-throttling
|
||
|
||
/* globals window */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
var $ = window.$;
|
||
var tram = __webpack_require__(91) && $.tram;
|
||
/*!
|
||
* Webflow._ (aka) Underscore.js 1.6.0 (custom build)
|
||
* _.each
|
||
* _.map
|
||
* _.find
|
||
* _.filter
|
||
* _.any
|
||
* _.contains
|
||
* _.delay
|
||
* _.defer
|
||
* _.throttle (webflow)
|
||
* _.debounce
|
||
* _.keys
|
||
* _.has
|
||
* _.now
|
||
*
|
||
* http://underscorejs.org
|
||
* (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
* Underscore may be freely distributed under the MIT license.
|
||
* @license MIT
|
||
*/
|
||
|
||
module.exports = function () {
|
||
var _ = {}; // Current version.
|
||
|
||
_.VERSION = '1.6.0-Webflow'; // Establish the object that gets returned to break out of a loop iteration.
|
||
|
||
var breaker = {}; // Save bytes in the minified (but not gzipped) version:
|
||
|
||
/* eslint-disable one-var */
|
||
|
||
var ArrayProto = Array.prototype,
|
||
ObjProto = Object.prototype,
|
||
FuncProto = Function.prototype;
|
||
/* eslint-enable one-var */
|
||
// Create quick reference variables for speed access to core prototypes.
|
||
|
||
/* eslint-disable one-var, no-unused-vars */
|
||
|
||
var push = ArrayProto.push,
|
||
slice = ArrayProto.slice,
|
||
concat = ArrayProto.concat,
|
||
toString = ObjProto.toString,
|
||
hasOwnProperty = ObjProto.hasOwnProperty;
|
||
/* eslint-enable one-var, no-unused-vars */
|
||
// All **ECMAScript 5** native function implementations that we hope to use
|
||
// are declared here.
|
||
|
||
/* eslint-disable one-var, no-unused-vars */
|
||
|
||
var nativeForEach = ArrayProto.forEach,
|
||
nativeMap = ArrayProto.map,
|
||
nativeReduce = ArrayProto.reduce,
|
||
nativeReduceRight = ArrayProto.reduceRight,
|
||
nativeFilter = ArrayProto.filter,
|
||
nativeEvery = ArrayProto.every,
|
||
nativeSome = ArrayProto.some,
|
||
nativeIndexOf = ArrayProto.indexOf,
|
||
nativeLastIndexOf = ArrayProto.lastIndexOf,
|
||
nativeIsArray = Array.isArray,
|
||
nativeKeys = Object.keys,
|
||
nativeBind = FuncProto.bind;
|
||
/* eslint-enable one-var, no-unused-vars */
|
||
// Collection Functions
|
||
// --------------------
|
||
// The cornerstone, an `each` implementation, aka `forEach`.
|
||
// Handles objects with the built-in `forEach`, arrays, and raw objects.
|
||
// Delegates to **ECMAScript 5**'s native `forEach` if available.
|
||
|
||
var each = _.each = _.forEach = function (obj, iterator, context) {
|
||
/* jshint shadow:true */
|
||
if (obj == null) return obj;
|
||
|
||
if (nativeForEach && obj.forEach === nativeForEach) {
|
||
obj.forEach(iterator, context); // eslint-disable-next-line no-implicit-coercion
|
||
} else if (obj.length === +obj.length) {
|
||
for (var i = 0, length = obj.length; i < length; i++) {
|
||
if (iterator.call(context, obj[i], i, obj) === breaker) return;
|
||
}
|
||
} else {
|
||
var keys = _.keys(obj); // eslint-disable-next-line no-redeclare
|
||
|
||
|
||
for (var i = 0, length = keys.length; i < length; i++) {
|
||
if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
|
||
}
|
||
}
|
||
|
||
return obj;
|
||
}; // Return the results of applying the iterator to each element.
|
||
// Delegates to **ECMAScript 5**'s native `map` if available.
|
||
|
||
|
||
_.map = _.collect = function (obj, iterator, context) {
|
||
var results = [];
|
||
if (obj == null) return results;
|
||
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
|
||
each(obj, function (value, index, list) {
|
||
results.push(iterator.call(context, value, index, list));
|
||
});
|
||
return results;
|
||
}; // Return the first value which passes a truth test. Aliased as `detect`.
|
||
|
||
|
||
_.find = _.detect = function (obj, predicate, context) {
|
||
var result;
|
||
any(obj, function (value, index, list) {
|
||
if (predicate.call(context, value, index, list)) {
|
||
result = value;
|
||
return true;
|
||
}
|
||
});
|
||
return result;
|
||
}; // Return all the elements that pass a truth test.
|
||
// Delegates to **ECMAScript 5**'s native `filter` if available.
|
||
// Aliased as `select`.
|
||
|
||
|
||
_.filter = _.select = function (obj, predicate, context) {
|
||
var results = [];
|
||
if (obj == null) return results;
|
||
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context);
|
||
each(obj, function (value, index, list) {
|
||
if (predicate.call(context, value, index, list)) results.push(value);
|
||
});
|
||
return results;
|
||
}; // Determine if at least one element in the object matches a truth test.
|
||
// Delegates to **ECMAScript 5**'s native `some` if available.
|
||
// Aliased as `any`.
|
||
|
||
|
||
var any = _.some = _.any = function (obj, predicate, context) {
|
||
predicate || (predicate = _.identity);
|
||
var result = false;
|
||
if (obj == null) return result;
|
||
if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context);
|
||
each(obj, function (value, index, list) {
|
||
if (result || (result = predicate.call(context, value, index, list))) return breaker;
|
||
});
|
||
return !!result; // eslint-disable-line no-implicit-coercion
|
||
}; // Determine if the array or object contains a given value (using `===`).
|
||
// Aliased as `include`.
|
||
|
||
|
||
_.contains = _.include = function (obj, target) {
|
||
if (obj == null) return false;
|
||
if (nativeIndexOf && obj.indexOf === nativeIndexOf) // eslint-disable-next-line eqeqeq
|
||
return obj.indexOf(target) != -1;
|
||
return any(obj, function (value) {
|
||
return value === target;
|
||
});
|
||
}; // Function (ahem) Functions
|
||
// --------------------
|
||
// Delays a function for the given number of milliseconds, and then calls
|
||
// it with the arguments supplied.
|
||
|
||
|
||
_.delay = function (func, wait) {
|
||
var args = slice.call(arguments, 2);
|
||
return setTimeout(function () {
|
||
return func.apply(null, args);
|
||
}, wait);
|
||
}; // Defers a function, scheduling it to run after the current call stack has
|
||
// cleared.
|
||
|
||
|
||
_.defer = function (func) {
|
||
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
|
||
}; // Returns a function, that, when invoked, will only be triggered once every
|
||
// browser animation frame - using tram's requestAnimationFrame polyfill.
|
||
|
||
|
||
_.throttle = function (func) {
|
||
// eslint-disable-next-line one-var
|
||
var wait, args, context;
|
||
return function () {
|
||
if (wait) return;
|
||
wait = true;
|
||
args = arguments;
|
||
context = this;
|
||
tram.frame(function () {
|
||
wait = false;
|
||
func.apply(context, args);
|
||
});
|
||
};
|
||
}; // Returns a function, that, as long as it continues to be invoked, will not
|
||
// be triggered. The function will be called after it stops being called for
|
||
// N milliseconds. If `immediate` is passed, trigger the function on the
|
||
// leading edge, instead of the trailing.
|
||
|
||
|
||
_.debounce = function (func, wait, immediate) {
|
||
// eslint-disable-next-line one-var
|
||
var timeout, args, context, timestamp, result;
|
||
|
||
var later = function later() {
|
||
var last = _.now() - timestamp;
|
||
|
||
if (last < wait) {
|
||
timeout = setTimeout(later, wait - last);
|
||
} else {
|
||
timeout = null;
|
||
|
||
if (!immediate) {
|
||
result = func.apply(context, args);
|
||
context = args = null;
|
||
}
|
||
}
|
||
};
|
||
|
||
return function () {
|
||
context = this;
|
||
args = arguments;
|
||
timestamp = _.now();
|
||
var callNow = immediate && !timeout;
|
||
|
||
if (!timeout) {
|
||
timeout = setTimeout(later, wait);
|
||
}
|
||
|
||
if (callNow) {
|
||
result = func.apply(context, args);
|
||
context = args = null;
|
||
}
|
||
|
||
return result;
|
||
};
|
||
}; // Object Functions
|
||
// ----------------
|
||
// Fill in a given object with default properties.
|
||
|
||
|
||
_.defaults = function (obj) {
|
||
if (!_.isObject(obj)) return obj;
|
||
|
||
for (var i = 1, length = arguments.length; i < length; i++) {
|
||
var source = arguments[i];
|
||
|
||
for (var prop in source) {
|
||
// eslint-disable-next-line no-void
|
||
if (obj[prop] === void 0) obj[prop] = source[prop];
|
||
}
|
||
}
|
||
|
||
return obj;
|
||
}; // Retrieve the names of an object's properties.
|
||
// Delegates to **ECMAScript 5**'s native `Object.keys`
|
||
|
||
|
||
_.keys = function (obj) {
|
||
if (!_.isObject(obj)) return [];
|
||
if (nativeKeys) return nativeKeys(obj);
|
||
var keys = [];
|
||
|
||
for (var key in obj) {
|
||
if (_.has(obj, key)) keys.push(key);
|
||
}
|
||
|
||
return keys;
|
||
}; // Shortcut function for checking if an object has a given property directly
|
||
// on itself (in other words, not on a prototype).
|
||
|
||
|
||
_.has = function (obj, key) {
|
||
return hasOwnProperty.call(obj, key);
|
||
}; // Is a given variable an object?
|
||
|
||
|
||
_.isObject = function (obj) {
|
||
return obj === Object(obj);
|
||
}; // Utility Functions
|
||
// -----------------
|
||
// A (possibly faster) way to get the current timestamp as an integer.
|
||
|
||
|
||
_.now = Date.now || function () {
|
||
return new Date().getTime();
|
||
}; // By default, Underscore uses ERB-style template delimiters, change the
|
||
// following template settings to use alternative delimiters.
|
||
|
||
|
||
_.templateSettings = {
|
||
evaluate: /<%([\s\S]+?)%>/g,
|
||
interpolate: /<%=([\s\S]+?)%>/g,
|
||
escape: /<%-([\s\S]+?)%>/g
|
||
}; // When customizing `templateSettings`, if you don't want to define an
|
||
// interpolation, evaluation or escaping regex, we need one that is
|
||
// guaranteed not to match.
|
||
|
||
var noMatch = /(.)^/; // Certain characters need to be escaped so that they can be put into a
|
||
// string literal.
|
||
|
||
var escapes = {
|
||
"'": "'",
|
||
'\\': '\\',
|
||
'\r': 'r',
|
||
'\n': 'n',
|
||
"\u2028": 'u2028',
|
||
"\u2029": 'u2029'
|
||
};
|
||
var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
|
||
|
||
var escapeChar = function escapeChar(match) {
|
||
return '\\' + escapes[match];
|
||
}; // JavaScript micro-templating, similar to John Resig's implementation.
|
||
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
||
// and correctly escapes quotes within interpolated code.
|
||
// NB: `oldSettings` only exists for backwards compatibility.
|
||
|
||
|
||
_.template = function (text, settings, oldSettings) {
|
||
if (!settings && oldSettings) settings = oldSettings;
|
||
settings = _.defaults({}, settings, _.templateSettings); // Combine delimiters into one regular expression via alternation.
|
||
|
||
var matcher = RegExp([(settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source].join('|') + '|$', 'g'); // Compile the template source, escaping string literals appropriately.
|
||
|
||
var index = 0;
|
||
var source = "__p+='";
|
||
text.replace(matcher, function (match, escape, interpolate, evaluate, offset) {
|
||
source += text.slice(index, offset).replace(escaper, escapeChar);
|
||
index = offset + match.length;
|
||
|
||
if (escape) {
|
||
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
|
||
} else if (interpolate) {
|
||
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
|
||
} else if (evaluate) {
|
||
source += "';\n" + evaluate + "\n__p+='";
|
||
} // Adobe VMs need the match returned to produce the correct offest.
|
||
|
||
|
||
return match;
|
||
});
|
||
source += "';\n"; // If a variable is not specified, place data values in local scope.
|
||
|
||
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
|
||
source = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + source + 'return __p;\n';
|
||
|
||
try {
|
||
// eslint-disable-next-line no-new-func
|
||
var render = new Function(settings.variable || 'obj', '_', source);
|
||
} catch (e) {
|
||
e.source = source;
|
||
throw e;
|
||
}
|
||
|
||
var template = function template(data) {
|
||
return render.call(this, data, _);
|
||
}; // Provide the compiled source as a convenience for precompilation.
|
||
|
||
|
||
var argument = settings.variable || 'obj';
|
||
template.source = 'function(' + argument + '){\n' + source + '}';
|
||
return template;
|
||
}; // Export underscore
|
||
|
||
|
||
return _;
|
||
}();
|
||
/* eslint-enable */
|
||
|
||
/***/ }),
|
||
/* 155 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault2 = __webpack_require__(1);
|
||
|
||
var _classCallCheck2 = _interopRequireDefault2(__webpack_require__(156));
|
||
|
||
var _createClass2 = _interopRequireDefault2(__webpack_require__(157));
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ready = exports.destroy = exports.init = exports.cleanupElement = exports.createInstance = void 0;
|
||
|
||
var _extends2 = _interopRequireDefault(__webpack_require__(31));
|
||
|
||
var _defineProperty2 = _interopRequireDefault(__webpack_require__(24));
|
||
|
||
var _findIndex = _interopRequireDefault(__webpack_require__(92));
|
||
|
||
__webpack_require__(226);
|
||
/* eslint-env browser */
|
||
|
||
|
||
var getLottieLibrary = function getLottieLibrary() {
|
||
return window.Webflow.require('lottie').lottie;
|
||
};
|
||
|
||
var isInDesigner = function isInDesigner() {
|
||
return Boolean(window.Webflow.env('design') || window.Webflow.env('preview'));
|
||
};
|
||
|
||
var PlayerState = {
|
||
Playing: 'playing',
|
||
Stopped: 'stopped'
|
||
};
|
||
|
||
var Cache =
|
||
/*#__PURE__*/
|
||
function () {
|
||
function Cache() {
|
||
(0, _classCallCheck2["default"])(this, Cache);
|
||
(0, _defineProperty2["default"])(this, "_cache", []);
|
||
}
|
||
|
||
(0, _createClass2["default"])(Cache, [{
|
||
key: "set",
|
||
value: function set(container, instance) {
|
||
var index = (0, _findIndex["default"])(this._cache, function (_ref) {
|
||
var wrapper = _ref.wrapper;
|
||
return wrapper === container;
|
||
});
|
||
if (index !== -1) this._cache.splice(index, 1);
|
||
|
||
this._cache.push({
|
||
wrapper: container,
|
||
instance: instance
|
||
});
|
||
}
|
||
}, {
|
||
key: "delete",
|
||
value: function _delete(container) {
|
||
var index = (0, _findIndex["default"])(this._cache, function (_ref2) {
|
||
var wrapper = _ref2.wrapper;
|
||
return wrapper === container;
|
||
});
|
||
if (index !== -1) this._cache.splice(index, 1);
|
||
}
|
||
}, {
|
||
key: "get",
|
||
value: function get(container) {
|
||
var index = (0, _findIndex["default"])(this._cache, function (_ref3) {
|
||
var wrapper = _ref3.wrapper;
|
||
return wrapper === container;
|
||
});
|
||
return index !== -1 ? this._cache[index].instance : null;
|
||
}
|
||
}]);
|
||
return Cache;
|
||
}();
|
||
|
||
var cache = new Cache();
|
||
var emptyObject = {};
|
||
|
||
var LottieInstance =
|
||
/*#__PURE__*/
|
||
function () {
|
||
function LottieInstance() {
|
||
(0, _classCallCheck2["default"])(this, LottieInstance);
|
||
(0, _defineProperty2["default"])(this, "config", null);
|
||
(0, _defineProperty2["default"])(this, "currentState", PlayerState.Stopped);
|
||
(0, _defineProperty2["default"])(this, "handlers", {
|
||
enterFrame: [],
|
||
complete: [],
|
||
loop: [],
|
||
dataReady: [],
|
||
destroy: [],
|
||
error: []
|
||
});
|
||
}
|
||
|
||
(0, _createClass2["default"])(LottieInstance, [{
|
||
key: "load",
|
||
value: function load(container) {
|
||
var _this = this;
|
||
|
||
var dataset = container.dataset || emptyObject;
|
||
var src = dataset.src || ''; // Available options here https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio
|
||
|
||
var preserveAspectRatio = dataset.preserveAspectRatio || 'xMidYMid meet';
|
||
var renderer = dataset.renderer || 'svg';
|
||
var loop = parseFloat(dataset.loop) === 1;
|
||
var direction = parseFloat(dataset.direction) || 1;
|
||
var autoplay = parseFloat(dataset.autoplay) === 1;
|
||
var duration = parseFloat(dataset.duration) || 0;
|
||
var hasIx2 = parseFloat(dataset.isIx2Target) === 1;
|
||
var ix2InitialValue = parseFloat(dataset.ix2InitialState);
|
||
|
||
if (isNaN(ix2InitialValue)) {
|
||
ix2InitialValue = null;
|
||
}
|
||
|
||
var config = {
|
||
src: src,
|
||
loop: loop,
|
||
autoplay: autoplay,
|
||
renderer: renderer,
|
||
direction: direction,
|
||
duration: duration,
|
||
hasIx2: hasIx2,
|
||
ix2InitialValue: ix2InitialValue,
|
||
preserveAspectRatio: preserveAspectRatio
|
||
}; // If it's the same path/src, don't destroy the animation
|
||
|
||
if (this.animationItem && this.config && this.config.src === src && renderer === this.config.renderer && preserveAspectRatio === this.config.preserveAspectRatio) {
|
||
if (loop !== this.config.loop) {
|
||
this.setLooping(loop);
|
||
}
|
||
|
||
if (!hasIx2) {
|
||
if (direction !== this.config.direction) {
|
||
this.setDirection(direction);
|
||
}
|
||
|
||
if (duration !== this.config.duration) {
|
||
if (duration > 0 && duration !== this.duration) {
|
||
this.setSpeed(this.duration / duration);
|
||
} else {
|
||
this.setSpeed(1);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (autoplay) {
|
||
this.play();
|
||
}
|
||
|
||
if (ix2InitialValue && ix2InitialValue !== this.config.ix2InitialValue) {
|
||
var percent = ix2InitialValue / 100;
|
||
this.goToFrame(this.frames * percent);
|
||
}
|
||
|
||
this.config = config;
|
||
return;
|
||
}
|
||
|
||
var options = {
|
||
container: container,
|
||
loop: loop,
|
||
autoplay: autoplay,
|
||
renderer: renderer,
|
||
rendererSettings: {
|
||
preserveAspectRatio: preserveAspectRatio,
|
||
progressiveLoad: true,
|
||
hideOnTransparent: true
|
||
}
|
||
};
|
||
|
||
try {
|
||
// Clear previous animation, if any
|
||
if (this.animationItem) {
|
||
this.destroy();
|
||
} // Initialize lottie player and load animation
|
||
|
||
|
||
this.animationItem = getLottieLibrary().loadAnimation((0, _extends2["default"])({}, options, {
|
||
path: src
|
||
}));
|
||
} catch (err) {
|
||
this.handlers.error.forEach(function (cb) {
|
||
return cb(err);
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (!this.animationItem) return;
|
||
|
||
if (isInDesigner()) {
|
||
// Calculate and save the current progress of the animation
|
||
this.animationItem.addEventListener('enterFrame', function () {
|
||
if (!_this.isPlaying) return;
|
||
var _this$animationItem = _this.animationItem,
|
||
currentFrame = _this$animationItem.currentFrame,
|
||
totalFrames = _this$animationItem.totalFrames,
|
||
playDirection = _this$animationItem.playDirection;
|
||
var toPercent = currentFrame / totalFrames * 100;
|
||
var percentage = Math.round(playDirection === 1 ? toPercent : 100 - toPercent);
|
||
|
||
_this.handlers.enterFrame.forEach(function (cb) {
|
||
return cb(percentage, currentFrame);
|
||
});
|
||
}); // Handle animation play complete
|
||
|
||
this.animationItem.addEventListener('complete', function () {
|
||
if (_this.currentState !== PlayerState.Playing) {
|
||
_this.handlers.complete.forEach(function (cb) {
|
||
return cb();
|
||
});
|
||
|
||
return;
|
||
}
|
||
|
||
if (!_this.animationItem.loop) {
|
||
_this.handlers.complete.forEach(function (cb) {
|
||
return cb();
|
||
});
|
||
|
||
return;
|
||
}
|
||
|
||
_this.currentState = PlayerState.Stopped;
|
||
}); // Handle animation play complete
|
||
|
||
this.animationItem.addEventListener('loopComplete', function (loopComplete) {
|
||
_this.handlers.loop.forEach(function (cb) {
|
||
return cb(loopComplete);
|
||
});
|
||
}); // Set error state when animation load fail event triggers
|
||
|
||
this.animationItem.addEventListener('data_failed', function (err) {
|
||
_this.handlers.error.forEach(function (cb) {
|
||
return cb(err);
|
||
});
|
||
}); // Set error state when animation load fail event triggers
|
||
|
||
this.animationItem.addEventListener('error', function (err) {
|
||
_this.handlers.error.forEach(function (cb) {
|
||
return cb(err);
|
||
});
|
||
});
|
||
}
|
||
|
||
if (this.isLoaded) {
|
||
this.handlers.dataReady.forEach(function (cb) {
|
||
return cb();
|
||
});
|
||
|
||
if (autoplay) {
|
||
this.play();
|
||
}
|
||
} else {
|
||
// Handle animation data load complete
|
||
this.animationItem.addEventListener('data_ready', function () {
|
||
_this.handlers.dataReady.forEach(function (cb) {
|
||
return cb();
|
||
}); // Only set the direction and speed if no IX2 is attached
|
||
|
||
|
||
if (!hasIx2) {
|
||
_this.setDirection(direction);
|
||
|
||
if (duration > 0 && duration !== _this.duration) {
|
||
_this.setSpeed(_this.duration / duration);
|
||
}
|
||
|
||
if (autoplay) {
|
||
_this.play();
|
||
}
|
||
} // Set the animation's initial state value from IX2
|
||
|
||
|
||
if (ix2InitialValue) {
|
||
var _percent = ix2InitialValue / 100;
|
||
|
||
_this.goToFrame(_this.frames * _percent);
|
||
}
|
||
});
|
||
}
|
||
|
||
cache.set(container, this);
|
||
this.container = container;
|
||
this.config = config;
|
||
}
|
||
}, {
|
||
key: "onFrameChange",
|
||
value: function onFrameChange(cb) {
|
||
if (this.handlers.enterFrame.indexOf(cb) === -1) {
|
||
this.handlers.enterFrame.push(cb);
|
||
}
|
||
}
|
||
}, {
|
||
key: "onPlaybackComplete",
|
||
value: function onPlaybackComplete(cb) {
|
||
if (this.handlers.complete.indexOf(cb) === -1) {
|
||
this.handlers.complete.push(cb);
|
||
}
|
||
}
|
||
}, {
|
||
key: "onLoopComplete",
|
||
value: function onLoopComplete(cb) {
|
||
if (this.handlers.loop.indexOf(cb) === -1) {
|
||
this.handlers.loop.push(cb);
|
||
}
|
||
}
|
||
}, {
|
||
key: "onDestroy",
|
||
value: function onDestroy(cb) {
|
||
if (this.handlers.destroy.indexOf(cb) === -1) {
|
||
this.handlers.destroy.push(cb);
|
||
}
|
||
}
|
||
}, {
|
||
key: "onDataReady",
|
||
value: function onDataReady(cb) {
|
||
if (this.handlers.dataReady.indexOf(cb) === -1) {
|
||
this.handlers.dataReady.push(cb);
|
||
}
|
||
}
|
||
}, {
|
||
key: "onError",
|
||
value: function onError(cb) {
|
||
if (this.handlers.error.indexOf(cb) === -1) {
|
||
this.handlers.error.push(cb);
|
||
}
|
||
}
|
||
}, {
|
||
key: "play",
|
||
value: function play() {
|
||
if (!this.animationItem) return;
|
||
var frame = this.animationItem.playDirection === 1 ? 0 : this.frames;
|
||
this.animationItem.goToAndPlay(frame, true);
|
||
this.currentState = PlayerState.Playing;
|
||
}
|
||
}, {
|
||
key: "stop",
|
||
value: function stop() {
|
||
if (!this.animationItem) return;
|
||
|
||
if (this.isPlaying) {
|
||
var playDirection = this.animationItem.playDirection;
|
||
var frame = playDirection === 1 ? 0 : this.frames;
|
||
this.animationItem.goToAndStop(frame, true);
|
||
}
|
||
|
||
this.currentState = PlayerState.Stopped;
|
||
}
|
||
}, {
|
||
key: "destroy",
|
||
value: function destroy() {
|
||
var _this2 = this;
|
||
|
||
if (!this.animationItem) return;
|
||
if (this.isPlaying) this.stop();
|
||
this.handlers.destroy.forEach(function (cb) {
|
||
return cb();
|
||
});
|
||
|
||
if (this.container) {
|
||
cache["delete"](this.container);
|
||
}
|
||
|
||
this.animationItem.destroy();
|
||
Object.keys(this.handlers).forEach(function (key) {
|
||
return _this2.handlers[key].length = 0;
|
||
});
|
||
this.animationItem = null;
|
||
this.container = null;
|
||
this.config = null;
|
||
}
|
||
}, {
|
||
key: "goToFrame",
|
||
value: function goToFrame(value) {
|
||
if (!this.animationItem) return;
|
||
this.animationItem.setCurrentRawFrameValue(value);
|
||
}
|
||
}, {
|
||
key: "setSubframe",
|
||
value: function setSubframe(value) {
|
||
if (!this.animationItem) return;
|
||
this.animationItem.setSubframe(value);
|
||
}
|
||
}, {
|
||
key: "setSpeed",
|
||
value: function setSpeed() {
|
||
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
||
if (!this.animationItem) return;
|
||
if (this.isPlaying) this.stop();
|
||
this.animationItem.setSpeed(value);
|
||
}
|
||
}, {
|
||
key: "setLooping",
|
||
value: function setLooping(value) {
|
||
if (!this.animationItem) return;
|
||
if (this.isPlaying) this.stop();
|
||
this.animationItem.loop = value;
|
||
}
|
||
}, {
|
||
key: "setDirection",
|
||
value: function setDirection(value) {
|
||
if (!this.animationItem) return;
|
||
if (this.isPlaying) this.stop();
|
||
this.animationItem.setDirection(value);
|
||
this.goToFrame(value === 1 ? 0 : this.frames);
|
||
}
|
||
}, {
|
||
key: "isPlaying",
|
||
get: function get() {
|
||
if (!this.animationItem) return false;
|
||
return !this.animationItem.isPaused;
|
||
}
|
||
}, {
|
||
key: "isPaused",
|
||
get: function get() {
|
||
if (!this.animationItem) return false;
|
||
return this.animationItem.isPaused;
|
||
}
|
||
}, {
|
||
key: "duration",
|
||
get: function get() {
|
||
if (!this.animationItem) return 0;
|
||
return this.animationItem.getDuration();
|
||
}
|
||
}, {
|
||
key: "frames",
|
||
get: function get() {
|
||
if (!this.animationItem) return 0;
|
||
return this.animationItem.totalFrames;
|
||
}
|
||
}, {
|
||
key: "direction",
|
||
get: function get() {
|
||
if (!this.animationItem) return 1;
|
||
return this.animationItem.playDirection;
|
||
}
|
||
}, {
|
||
key: "isLoaded",
|
||
get: function get() {
|
||
if (!this.animationItem) false;
|
||
return this.animationItem.isLoaded;
|
||
}
|
||
}, {
|
||
key: "ix2InitialValue",
|
||
get: function get() {
|
||
return this.config ? this.config.ix2InitialValue : null;
|
||
}
|
||
}]);
|
||
return LottieInstance;
|
||
}();
|
||
|
||
var getLottieElements = function getLottieElements() {
|
||
return Array.from(document.querySelectorAll('[data-animation-type="lottie"]'));
|
||
};
|
||
|
||
var createInstance = function createInstance(container) {
|
||
var lottieInstance = cache.get(container);
|
||
|
||
if (lottieInstance == null) {
|
||
lottieInstance = new LottieInstance();
|
||
}
|
||
|
||
lottieInstance.load(container);
|
||
return lottieInstance;
|
||
};
|
||
|
||
exports.createInstance = createInstance;
|
||
|
||
var cleanupElement = function cleanupElement(element) {
|
||
var lottieInstance = cache.get(element);
|
||
|
||
if (lottieInstance) {
|
||
lottieInstance.destroy();
|
||
}
|
||
};
|
||
|
||
exports.cleanupElement = cleanupElement;
|
||
|
||
var init = function init() {
|
||
getLottieElements().forEach(function (element) {
|
||
var hasIx2 = parseFloat(element.getAttribute('data-is-ix2-target')) === 1;
|
||
|
||
if (!hasIx2) {
|
||
cleanupElement(element);
|
||
}
|
||
|
||
createInstance(element);
|
||
});
|
||
};
|
||
|
||
exports.init = init;
|
||
|
||
var destroy = function destroy() {
|
||
getLottieElements().forEach(cleanupElement);
|
||
};
|
||
|
||
exports.destroy = destroy;
|
||
var ready = init;
|
||
exports.ready = ready;
|
||
|
||
/***/ }),
|
||
/* 156 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _classCallCheck(instance, Constructor) {
|
||
if (!(instance instanceof Constructor)) {
|
||
throw new TypeError("Cannot call a class as a function");
|
||
}
|
||
}
|
||
|
||
module.exports = _classCallCheck;
|
||
|
||
/***/ }),
|
||
/* 157 */
|
||
/***/ (function(module, exports) {
|
||
|
||
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;
|
||
}
|
||
|
||
module.exports = _createClass;
|
||
|
||
/***/ }),
|
||
/* 158 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIsMatch = __webpack_require__(159),
|
||
getMatchData = __webpack_require__(211),
|
||
matchesStrictComparable = __webpack_require__(108);
|
||
|
||
/**
|
||
* The base implementation of `_.matches` which doesn't clone `source`.
|
||
*
|
||
* @private
|
||
* @param {Object} source The object of property values to match.
|
||
* @returns {Function} Returns the new spec function.
|
||
*/
|
||
function baseMatches(source) {
|
||
var matchData = getMatchData(source);
|
||
if (matchData.length == 1 && matchData[0][2]) {
|
||
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
||
}
|
||
return function(object) {
|
||
return object === source || baseIsMatch(object, source, matchData);
|
||
};
|
||
}
|
||
|
||
module.exports = baseMatches;
|
||
|
||
|
||
/***/ }),
|
||
/* 159 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Stack = __webpack_require__(94),
|
||
baseIsEqual = __webpack_require__(98);
|
||
|
||
/** Used to compose bitmasks for value comparisons. */
|
||
var COMPARE_PARTIAL_FLAG = 1,
|
||
COMPARE_UNORDERED_FLAG = 2;
|
||
|
||
/**
|
||
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to inspect.
|
||
* @param {Object} source The object of property values to match.
|
||
* @param {Array} matchData The property names, values, and compare flags to match.
|
||
* @param {Function} [customizer] The function to customize comparisons.
|
||
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
||
*/
|
||
function baseIsMatch(object, source, matchData, customizer) {
|
||
var index = matchData.length,
|
||
length = index,
|
||
noCustomizer = !customizer;
|
||
|
||
if (object == null) {
|
||
return !length;
|
||
}
|
||
object = Object(object);
|
||
while (index--) {
|
||
var data = matchData[index];
|
||
if ((noCustomizer && data[2])
|
||
? data[1] !== object[data[0]]
|
||
: !(data[0] in object)
|
||
) {
|
||
return false;
|
||
}
|
||
}
|
||
while (++index < length) {
|
||
data = matchData[index];
|
||
var key = data[0],
|
||
objValue = object[key],
|
||
srcValue = data[1];
|
||
|
||
if (noCustomizer && data[2]) {
|
||
if (objValue === undefined && !(key in object)) {
|
||
return false;
|
||
}
|
||
} else {
|
||
var stack = new Stack;
|
||
if (customizer) {
|
||
var result = customizer(objValue, srcValue, key, object, source, stack);
|
||
}
|
||
if (!(result === undefined
|
||
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
|
||
: result
|
||
)) {
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
module.exports = baseIsMatch;
|
||
|
||
|
||
/***/ }),
|
||
/* 160 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Removes all key-value entries from the list cache.
|
||
*
|
||
* @private
|
||
* @name clear
|
||
* @memberOf ListCache
|
||
*/
|
||
function listCacheClear() {
|
||
this.__data__ = [];
|
||
this.size = 0;
|
||
}
|
||
|
||
module.exports = listCacheClear;
|
||
|
||
|
||
/***/ }),
|
||
/* 161 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var assocIndexOf = __webpack_require__(43);
|
||
|
||
/** Used for built-in method references. */
|
||
var arrayProto = Array.prototype;
|
||
|
||
/** Built-in value references. */
|
||
var splice = arrayProto.splice;
|
||
|
||
/**
|
||
* Removes `key` and its value from the list cache.
|
||
*
|
||
* @private
|
||
* @name delete
|
||
* @memberOf ListCache
|
||
* @param {string} key The key of the value to remove.
|
||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||
*/
|
||
function listCacheDelete(key) {
|
||
var data = this.__data__,
|
||
index = assocIndexOf(data, key);
|
||
|
||
if (index < 0) {
|
||
return false;
|
||
}
|
||
var lastIndex = data.length - 1;
|
||
if (index == lastIndex) {
|
||
data.pop();
|
||
} else {
|
||
splice.call(data, index, 1);
|
||
}
|
||
--this.size;
|
||
return true;
|
||
}
|
||
|
||
module.exports = listCacheDelete;
|
||
|
||
|
||
/***/ }),
|
||
/* 162 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var assocIndexOf = __webpack_require__(43);
|
||
|
||
/**
|
||
* Gets the list cache value for `key`.
|
||
*
|
||
* @private
|
||
* @name get
|
||
* @memberOf ListCache
|
||
* @param {string} key The key of the value to get.
|
||
* @returns {*} Returns the entry value.
|
||
*/
|
||
function listCacheGet(key) {
|
||
var data = this.__data__,
|
||
index = assocIndexOf(data, key);
|
||
|
||
return index < 0 ? undefined : data[index][1];
|
||
}
|
||
|
||
module.exports = listCacheGet;
|
||
|
||
|
||
/***/ }),
|
||
/* 163 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var assocIndexOf = __webpack_require__(43);
|
||
|
||
/**
|
||
* Checks if a list cache value for `key` exists.
|
||
*
|
||
* @private
|
||
* @name has
|
||
* @memberOf ListCache
|
||
* @param {string} key The key of the entry to check.
|
||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||
*/
|
||
function listCacheHas(key) {
|
||
return assocIndexOf(this.__data__, key) > -1;
|
||
}
|
||
|
||
module.exports = listCacheHas;
|
||
|
||
|
||
/***/ }),
|
||
/* 164 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var assocIndexOf = __webpack_require__(43);
|
||
|
||
/**
|
||
* Sets the list cache `key` to `value`.
|
||
*
|
||
* @private
|
||
* @name set
|
||
* @memberOf ListCache
|
||
* @param {string} key The key of the value to set.
|
||
* @param {*} value The value to set.
|
||
* @returns {Object} Returns the list cache instance.
|
||
*/
|
||
function listCacheSet(key, value) {
|
||
var data = this.__data__,
|
||
index = assocIndexOf(data, key);
|
||
|
||
if (index < 0) {
|
||
++this.size;
|
||
data.push([key, value]);
|
||
} else {
|
||
data[index][1] = value;
|
||
}
|
||
return this;
|
||
}
|
||
|
||
module.exports = listCacheSet;
|
||
|
||
|
||
/***/ }),
|
||
/* 165 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var ListCache = __webpack_require__(42);
|
||
|
||
/**
|
||
* Removes all key-value entries from the stack.
|
||
*
|
||
* @private
|
||
* @name clear
|
||
* @memberOf Stack
|
||
*/
|
||
function stackClear() {
|
||
this.__data__ = new ListCache;
|
||
this.size = 0;
|
||
}
|
||
|
||
module.exports = stackClear;
|
||
|
||
|
||
/***/ }),
|
||
/* 166 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Removes `key` and its value from the stack.
|
||
*
|
||
* @private
|
||
* @name delete
|
||
* @memberOf Stack
|
||
* @param {string} key The key of the value to remove.
|
||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||
*/
|
||
function stackDelete(key) {
|
||
var data = this.__data__,
|
||
result = data['delete'](key);
|
||
|
||
this.size = data.size;
|
||
return result;
|
||
}
|
||
|
||
module.exports = stackDelete;
|
||
|
||
|
||
/***/ }),
|
||
/* 167 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Gets the stack value for `key`.
|
||
*
|
||
* @private
|
||
* @name get
|
||
* @memberOf Stack
|
||
* @param {string} key The key of the value to get.
|
||
* @returns {*} Returns the entry value.
|
||
*/
|
||
function stackGet(key) {
|
||
return this.__data__.get(key);
|
||
}
|
||
|
||
module.exports = stackGet;
|
||
|
||
|
||
/***/ }),
|
||
/* 168 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks if a stack value for `key` exists.
|
||
*
|
||
* @private
|
||
* @name has
|
||
* @memberOf Stack
|
||
* @param {string} key The key of the entry to check.
|
||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||
*/
|
||
function stackHas(key) {
|
||
return this.__data__.has(key);
|
||
}
|
||
|
||
module.exports = stackHas;
|
||
|
||
|
||
/***/ }),
|
||
/* 169 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var ListCache = __webpack_require__(42),
|
||
Map = __webpack_require__(58),
|
||
MapCache = __webpack_require__(59);
|
||
|
||
/** Used as the size to enable large array optimizations. */
|
||
var LARGE_ARRAY_SIZE = 200;
|
||
|
||
/**
|
||
* Sets the stack `key` to `value`.
|
||
*
|
||
* @private
|
||
* @name set
|
||
* @memberOf Stack
|
||
* @param {string} key The key of the value to set.
|
||
* @param {*} value The value to set.
|
||
* @returns {Object} Returns the stack cache instance.
|
||
*/
|
||
function stackSet(key, value) {
|
||
var data = this.__data__;
|
||
if (data instanceof ListCache) {
|
||
var pairs = data.__data__;
|
||
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
||
pairs.push([key, value]);
|
||
this.size = ++data.size;
|
||
return this;
|
||
}
|
||
data = this.__data__ = new MapCache(pairs);
|
||
}
|
||
data.set(key, value);
|
||
this.size = data.size;
|
||
return this;
|
||
}
|
||
|
||
module.exports = stackSet;
|
||
|
||
|
||
/***/ }),
|
||
/* 170 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isFunction = __webpack_require__(95),
|
||
isMasked = __webpack_require__(173),
|
||
isObject = __webpack_require__(12),
|
||
toSource = __webpack_require__(97);
|
||
|
||
/**
|
||
* Used to match `RegExp`
|
||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||
*/
|
||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||
|
||
/** Used to detect host constructors (Safari). */
|
||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||
|
||
/** Used for built-in method references. */
|
||
var funcProto = Function.prototype,
|
||
objectProto = Object.prototype;
|
||
|
||
/** Used to resolve the decompiled source of functions. */
|
||
var funcToString = funcProto.toString;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/** Used to detect if a method is native. */
|
||
var reIsNative = RegExp('^' +
|
||
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||
);
|
||
|
||
/**
|
||
* The base implementation of `_.isNative` without bad shim checks.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a native function,
|
||
* else `false`.
|
||
*/
|
||
function baseIsNative(value) {
|
||
if (!isObject(value) || isMasked(value)) {
|
||
return false;
|
||
}
|
||
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
||
return pattern.test(toSource(value));
|
||
}
|
||
|
||
module.exports = baseIsNative;
|
||
|
||
|
||
/***/ }),
|
||
/* 171 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Symbol = __webpack_require__(32);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Used to resolve the
|
||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||
* of values.
|
||
*/
|
||
var nativeObjectToString = objectProto.toString;
|
||
|
||
/** Built-in value references. */
|
||
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
||
|
||
/**
|
||
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to query.
|
||
* @returns {string} Returns the raw `toStringTag`.
|
||
*/
|
||
function getRawTag(value) {
|
||
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
||
tag = value[symToStringTag];
|
||
|
||
try {
|
||
value[symToStringTag] = undefined;
|
||
var unmasked = true;
|
||
} catch (e) {}
|
||
|
||
var result = nativeObjectToString.call(value);
|
||
if (unmasked) {
|
||
if (isOwn) {
|
||
value[symToStringTag] = tag;
|
||
} else {
|
||
delete value[symToStringTag];
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = getRawTag;
|
||
|
||
|
||
/***/ }),
|
||
/* 172 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/**
|
||
* Used to resolve the
|
||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||
* of values.
|
||
*/
|
||
var nativeObjectToString = objectProto.toString;
|
||
|
||
/**
|
||
* Converts `value` to a string using `Object.prototype.toString`.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to convert.
|
||
* @returns {string} Returns the converted string.
|
||
*/
|
||
function objectToString(value) {
|
||
return nativeObjectToString.call(value);
|
||
}
|
||
|
||
module.exports = objectToString;
|
||
|
||
|
||
/***/ }),
|
||
/* 173 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var coreJsData = __webpack_require__(174);
|
||
|
||
/** Used to detect methods masquerading as native. */
|
||
var maskSrcKey = (function() {
|
||
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
||
return uid ? ('Symbol(src)_1.' + uid) : '';
|
||
}());
|
||
|
||
/**
|
||
* Checks if `func` has its source masked.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to check.
|
||
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
||
*/
|
||
function isMasked(func) {
|
||
return !!maskSrcKey && (maskSrcKey in func);
|
||
}
|
||
|
||
module.exports = isMasked;
|
||
|
||
|
||
/***/ }),
|
||
/* 174 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var root = __webpack_require__(10);
|
||
|
||
/** Used to detect overreaching core-js shims. */
|
||
var coreJsData = root['__core-js_shared__'];
|
||
|
||
module.exports = coreJsData;
|
||
|
||
|
||
/***/ }),
|
||
/* 175 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Gets the value at `key` of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} [object] The object to query.
|
||
* @param {string} key The key of the property to get.
|
||
* @returns {*} Returns the property value.
|
||
*/
|
||
function getValue(object, key) {
|
||
return object == null ? undefined : object[key];
|
||
}
|
||
|
||
module.exports = getValue;
|
||
|
||
|
||
/***/ }),
|
||
/* 176 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Hash = __webpack_require__(177),
|
||
ListCache = __webpack_require__(42),
|
||
Map = __webpack_require__(58);
|
||
|
||
/**
|
||
* Removes all key-value entries from the map.
|
||
*
|
||
* @private
|
||
* @name clear
|
||
* @memberOf MapCache
|
||
*/
|
||
function mapCacheClear() {
|
||
this.size = 0;
|
||
this.__data__ = {
|
||
'hash': new Hash,
|
||
'map': new (Map || ListCache),
|
||
'string': new Hash
|
||
};
|
||
}
|
||
|
||
module.exports = mapCacheClear;
|
||
|
||
|
||
/***/ }),
|
||
/* 177 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var hashClear = __webpack_require__(178),
|
||
hashDelete = __webpack_require__(179),
|
||
hashGet = __webpack_require__(180),
|
||
hashHas = __webpack_require__(181),
|
||
hashSet = __webpack_require__(182);
|
||
|
||
/**
|
||
* Creates a hash object.
|
||
*
|
||
* @private
|
||
* @constructor
|
||
* @param {Array} [entries] The key-value pairs to cache.
|
||
*/
|
||
function Hash(entries) {
|
||
var index = -1,
|
||
length = entries == null ? 0 : entries.length;
|
||
|
||
this.clear();
|
||
while (++index < length) {
|
||
var entry = entries[index];
|
||
this.set(entry[0], entry[1]);
|
||
}
|
||
}
|
||
|
||
// Add methods to `Hash`.
|
||
Hash.prototype.clear = hashClear;
|
||
Hash.prototype['delete'] = hashDelete;
|
||
Hash.prototype.get = hashGet;
|
||
Hash.prototype.has = hashHas;
|
||
Hash.prototype.set = hashSet;
|
||
|
||
module.exports = Hash;
|
||
|
||
|
||
/***/ }),
|
||
/* 178 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var nativeCreate = __webpack_require__(45);
|
||
|
||
/**
|
||
* Removes all key-value entries from the hash.
|
||
*
|
||
* @private
|
||
* @name clear
|
||
* @memberOf Hash
|
||
*/
|
||
function hashClear() {
|
||
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
||
this.size = 0;
|
||
}
|
||
|
||
module.exports = hashClear;
|
||
|
||
|
||
/***/ }),
|
||
/* 179 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Removes `key` and its value from the hash.
|
||
*
|
||
* @private
|
||
* @name delete
|
||
* @memberOf Hash
|
||
* @param {Object} hash The hash to modify.
|
||
* @param {string} key The key of the value to remove.
|
||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||
*/
|
||
function hashDelete(key) {
|
||
var result = this.has(key) && delete this.__data__[key];
|
||
this.size -= result ? 1 : 0;
|
||
return result;
|
||
}
|
||
|
||
module.exports = hashDelete;
|
||
|
||
|
||
/***/ }),
|
||
/* 180 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var nativeCreate = __webpack_require__(45);
|
||
|
||
/** Used to stand-in for `undefined` hash values. */
|
||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Gets the hash value for `key`.
|
||
*
|
||
* @private
|
||
* @name get
|
||
* @memberOf Hash
|
||
* @param {string} key The key of the value to get.
|
||
* @returns {*} Returns the entry value.
|
||
*/
|
||
function hashGet(key) {
|
||
var data = this.__data__;
|
||
if (nativeCreate) {
|
||
var result = data[key];
|
||
return result === HASH_UNDEFINED ? undefined : result;
|
||
}
|
||
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
||
}
|
||
|
||
module.exports = hashGet;
|
||
|
||
|
||
/***/ }),
|
||
/* 181 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var nativeCreate = __webpack_require__(45);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Checks if a hash value for `key` exists.
|
||
*
|
||
* @private
|
||
* @name has
|
||
* @memberOf Hash
|
||
* @param {string} key The key of the entry to check.
|
||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||
*/
|
||
function hashHas(key) {
|
||
var data = this.__data__;
|
||
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
||
}
|
||
|
||
module.exports = hashHas;
|
||
|
||
|
||
/***/ }),
|
||
/* 182 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var nativeCreate = __webpack_require__(45);
|
||
|
||
/** Used to stand-in for `undefined` hash values. */
|
||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||
|
||
/**
|
||
* Sets the hash `key` to `value`.
|
||
*
|
||
* @private
|
||
* @name set
|
||
* @memberOf Hash
|
||
* @param {string} key The key of the value to set.
|
||
* @param {*} value The value to set.
|
||
* @returns {Object} Returns the hash instance.
|
||
*/
|
||
function hashSet(key, value) {
|
||
var data = this.__data__;
|
||
this.size += this.has(key) ? 0 : 1;
|
||
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
||
return this;
|
||
}
|
||
|
||
module.exports = hashSet;
|
||
|
||
|
||
/***/ }),
|
||
/* 183 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getMapData = __webpack_require__(46);
|
||
|
||
/**
|
||
* Removes `key` and its value from the map.
|
||
*
|
||
* @private
|
||
* @name delete
|
||
* @memberOf MapCache
|
||
* @param {string} key The key of the value to remove.
|
||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||
*/
|
||
function mapCacheDelete(key) {
|
||
var result = getMapData(this, key)['delete'](key);
|
||
this.size -= result ? 1 : 0;
|
||
return result;
|
||
}
|
||
|
||
module.exports = mapCacheDelete;
|
||
|
||
|
||
/***/ }),
|
||
/* 184 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks if `value` is suitable for use as unique object key.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
||
*/
|
||
function isKeyable(value) {
|
||
var type = typeof value;
|
||
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
||
? (value !== '__proto__')
|
||
: (value === null);
|
||
}
|
||
|
||
module.exports = isKeyable;
|
||
|
||
|
||
/***/ }),
|
||
/* 185 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getMapData = __webpack_require__(46);
|
||
|
||
/**
|
||
* Gets the map value for `key`.
|
||
*
|
||
* @private
|
||
* @name get
|
||
* @memberOf MapCache
|
||
* @param {string} key The key of the value to get.
|
||
* @returns {*} Returns the entry value.
|
||
*/
|
||
function mapCacheGet(key) {
|
||
return getMapData(this, key).get(key);
|
||
}
|
||
|
||
module.exports = mapCacheGet;
|
||
|
||
|
||
/***/ }),
|
||
/* 186 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getMapData = __webpack_require__(46);
|
||
|
||
/**
|
||
* Checks if a map value for `key` exists.
|
||
*
|
||
* @private
|
||
* @name has
|
||
* @memberOf MapCache
|
||
* @param {string} key The key of the entry to check.
|
||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||
*/
|
||
function mapCacheHas(key) {
|
||
return getMapData(this, key).has(key);
|
||
}
|
||
|
||
module.exports = mapCacheHas;
|
||
|
||
|
||
/***/ }),
|
||
/* 187 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getMapData = __webpack_require__(46);
|
||
|
||
/**
|
||
* Sets the map `key` to `value`.
|
||
*
|
||
* @private
|
||
* @name set
|
||
* @memberOf MapCache
|
||
* @param {string} key The key of the value to set.
|
||
* @param {*} value The value to set.
|
||
* @returns {Object} Returns the map cache instance.
|
||
*/
|
||
function mapCacheSet(key, value) {
|
||
var data = getMapData(this, key),
|
||
size = data.size;
|
||
|
||
data.set(key, value);
|
||
this.size += data.size == size ? 0 : 1;
|
||
return this;
|
||
}
|
||
|
||
module.exports = mapCacheSet;
|
||
|
||
|
||
/***/ }),
|
||
/* 188 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Stack = __webpack_require__(94),
|
||
equalArrays = __webpack_require__(99),
|
||
equalByTag = __webpack_require__(194),
|
||
equalObjects = __webpack_require__(198),
|
||
getTag = __webpack_require__(67),
|
||
isArray = __webpack_require__(2),
|
||
isBuffer = __webpack_require__(61),
|
||
isTypedArray = __webpack_require__(63);
|
||
|
||
/** Used to compose bitmasks for value comparisons. */
|
||
var COMPARE_PARTIAL_FLAG = 1;
|
||
|
||
/** `Object#toString` result references. */
|
||
var argsTag = '[object Arguments]',
|
||
arrayTag = '[object Array]',
|
||
objectTag = '[object Object]';
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
||
* deep comparisons and tracks traversed objects enabling objects with circular
|
||
* references to be compared.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to compare.
|
||
* @param {Object} other The other object to compare.
|
||
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
||
* @param {Function} customizer The function to customize comparisons.
|
||
* @param {Function} equalFunc The function to determine equivalents of values.
|
||
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||
*/
|
||
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
||
var objIsArr = isArray(object),
|
||
othIsArr = isArray(other),
|
||
objTag = objIsArr ? arrayTag : getTag(object),
|
||
othTag = othIsArr ? arrayTag : getTag(other);
|
||
|
||
objTag = objTag == argsTag ? objectTag : objTag;
|
||
othTag = othTag == argsTag ? objectTag : othTag;
|
||
|
||
var objIsObj = objTag == objectTag,
|
||
othIsObj = othTag == objectTag,
|
||
isSameTag = objTag == othTag;
|
||
|
||
if (isSameTag && isBuffer(object)) {
|
||
if (!isBuffer(other)) {
|
||
return false;
|
||
}
|
||
objIsArr = true;
|
||
objIsObj = false;
|
||
}
|
||
if (isSameTag && !objIsObj) {
|
||
stack || (stack = new Stack);
|
||
return (objIsArr || isTypedArray(object))
|
||
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
||
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
||
}
|
||
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
||
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
||
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
||
|
||
if (objIsWrapped || othIsWrapped) {
|
||
var objUnwrapped = objIsWrapped ? object.value() : object,
|
||
othUnwrapped = othIsWrapped ? other.value() : other;
|
||
|
||
stack || (stack = new Stack);
|
||
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
||
}
|
||
}
|
||
if (!isSameTag) {
|
||
return false;
|
||
}
|
||
stack || (stack = new Stack);
|
||
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
||
}
|
||
|
||
module.exports = baseIsEqualDeep;
|
||
|
||
|
||
/***/ }),
|
||
/* 189 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var MapCache = __webpack_require__(59),
|
||
setCacheAdd = __webpack_require__(190),
|
||
setCacheHas = __webpack_require__(191);
|
||
|
||
/**
|
||
*
|
||
* Creates an array cache object to store unique values.
|
||
*
|
||
* @private
|
||
* @constructor
|
||
* @param {Array} [values] The values to cache.
|
||
*/
|
||
function SetCache(values) {
|
||
var index = -1,
|
||
length = values == null ? 0 : values.length;
|
||
|
||
this.__data__ = new MapCache;
|
||
while (++index < length) {
|
||
this.add(values[index]);
|
||
}
|
||
}
|
||
|
||
// Add methods to `SetCache`.
|
||
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
||
SetCache.prototype.has = setCacheHas;
|
||
|
||
module.exports = SetCache;
|
||
|
||
|
||
/***/ }),
|
||
/* 190 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used to stand-in for `undefined` hash values. */
|
||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||
|
||
/**
|
||
* Adds `value` to the array cache.
|
||
*
|
||
* @private
|
||
* @name add
|
||
* @memberOf SetCache
|
||
* @alias push
|
||
* @param {*} value The value to cache.
|
||
* @returns {Object} Returns the cache instance.
|
||
*/
|
||
function setCacheAdd(value) {
|
||
this.__data__.set(value, HASH_UNDEFINED);
|
||
return this;
|
||
}
|
||
|
||
module.exports = setCacheAdd;
|
||
|
||
|
||
/***/ }),
|
||
/* 191 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks if `value` is in the array cache.
|
||
*
|
||
* @private
|
||
* @name has
|
||
* @memberOf SetCache
|
||
* @param {*} value The value to search for.
|
||
* @returns {number} Returns `true` if `value` is found, else `false`.
|
||
*/
|
||
function setCacheHas(value) {
|
||
return this.__data__.has(value);
|
||
}
|
||
|
||
module.exports = setCacheHas;
|
||
|
||
|
||
/***/ }),
|
||
/* 192 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* A specialized version of `_.some` for arrays without support for iteratee
|
||
* shorthands.
|
||
*
|
||
* @private
|
||
* @param {Array} [array] The array to iterate over.
|
||
* @param {Function} predicate The function invoked per iteration.
|
||
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
||
* else `false`.
|
||
*/
|
||
function arraySome(array, predicate) {
|
||
var index = -1,
|
||
length = array == null ? 0 : array.length;
|
||
|
||
while (++index < length) {
|
||
if (predicate(array[index], index, array)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
module.exports = arraySome;
|
||
|
||
|
||
/***/ }),
|
||
/* 193 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks if a `cache` value for `key` exists.
|
||
*
|
||
* @private
|
||
* @param {Object} cache The cache to query.
|
||
* @param {string} key The key of the entry to check.
|
||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||
*/
|
||
function cacheHas(cache, key) {
|
||
return cache.has(key);
|
||
}
|
||
|
||
module.exports = cacheHas;
|
||
|
||
|
||
/***/ }),
|
||
/* 194 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Symbol = __webpack_require__(32),
|
||
Uint8Array = __webpack_require__(195),
|
||
eq = __webpack_require__(57),
|
||
equalArrays = __webpack_require__(99),
|
||
mapToArray = __webpack_require__(196),
|
||
setToArray = __webpack_require__(197);
|
||
|
||
/** Used to compose bitmasks for value comparisons. */
|
||
var COMPARE_PARTIAL_FLAG = 1,
|
||
COMPARE_UNORDERED_FLAG = 2;
|
||
|
||
/** `Object#toString` result references. */
|
||
var boolTag = '[object Boolean]',
|
||
dateTag = '[object Date]',
|
||
errorTag = '[object Error]',
|
||
mapTag = '[object Map]',
|
||
numberTag = '[object Number]',
|
||
regexpTag = '[object RegExp]',
|
||
setTag = '[object Set]',
|
||
stringTag = '[object String]',
|
||
symbolTag = '[object Symbol]';
|
||
|
||
var arrayBufferTag = '[object ArrayBuffer]',
|
||
dataViewTag = '[object DataView]';
|
||
|
||
/** Used to convert symbols to primitives and strings. */
|
||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
||
|
||
/**
|
||
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
||
* the same `toStringTag`.
|
||
*
|
||
* **Note:** This function only supports comparing values with tags of
|
||
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to compare.
|
||
* @param {Object} other The other object to compare.
|
||
* @param {string} tag The `toStringTag` of the objects to compare.
|
||
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
||
* @param {Function} customizer The function to customize comparisons.
|
||
* @param {Function} equalFunc The function to determine equivalents of values.
|
||
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||
*/
|
||
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
||
switch (tag) {
|
||
case dataViewTag:
|
||
if ((object.byteLength != other.byteLength) ||
|
||
(object.byteOffset != other.byteOffset)) {
|
||
return false;
|
||
}
|
||
object = object.buffer;
|
||
other = other.buffer;
|
||
|
||
case arrayBufferTag:
|
||
if ((object.byteLength != other.byteLength) ||
|
||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
||
return false;
|
||
}
|
||
return true;
|
||
|
||
case boolTag:
|
||
case dateTag:
|
||
case numberTag:
|
||
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
||
// Invalid dates are coerced to `NaN`.
|
||
return eq(+object, +other);
|
||
|
||
case errorTag:
|
||
return object.name == other.name && object.message == other.message;
|
||
|
||
case regexpTag:
|
||
case stringTag:
|
||
// Coerce regexes to strings and treat strings, primitives and objects,
|
||
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
||
// for more details.
|
||
return object == (other + '');
|
||
|
||
case mapTag:
|
||
var convert = mapToArray;
|
||
|
||
case setTag:
|
||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
||
convert || (convert = setToArray);
|
||
|
||
if (object.size != other.size && !isPartial) {
|
||
return false;
|
||
}
|
||
// Assume cyclic values are equal.
|
||
var stacked = stack.get(object);
|
||
if (stacked) {
|
||
return stacked == other;
|
||
}
|
||
bitmask |= COMPARE_UNORDERED_FLAG;
|
||
|
||
// Recursively compare objects (susceptible to call stack limits).
|
||
stack.set(object, other);
|
||
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
||
stack['delete'](object);
|
||
return result;
|
||
|
||
case symbolTag:
|
||
if (symbolValueOf) {
|
||
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
module.exports = equalByTag;
|
||
|
||
|
||
/***/ }),
|
||
/* 195 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var root = __webpack_require__(10);
|
||
|
||
/** Built-in value references. */
|
||
var Uint8Array = root.Uint8Array;
|
||
|
||
module.exports = Uint8Array;
|
||
|
||
|
||
/***/ }),
|
||
/* 196 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Converts `map` to its key-value pairs.
|
||
*
|
||
* @private
|
||
* @param {Object} map The map to convert.
|
||
* @returns {Array} Returns the key-value pairs.
|
||
*/
|
||
function mapToArray(map) {
|
||
var index = -1,
|
||
result = Array(map.size);
|
||
|
||
map.forEach(function(value, key) {
|
||
result[++index] = [key, value];
|
||
});
|
||
return result;
|
||
}
|
||
|
||
module.exports = mapToArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 197 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Converts `set` to an array of its values.
|
||
*
|
||
* @private
|
||
* @param {Object} set The set to convert.
|
||
* @returns {Array} Returns the values.
|
||
*/
|
||
function setToArray(set) {
|
||
var index = -1,
|
||
result = Array(set.size);
|
||
|
||
set.forEach(function(value) {
|
||
result[++index] = value;
|
||
});
|
||
return result;
|
||
}
|
||
|
||
module.exports = setToArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 198 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getAllKeys = __webpack_require__(199);
|
||
|
||
/** Used to compose bitmasks for value comparisons. */
|
||
var COMPARE_PARTIAL_FLAG = 1;
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* A specialized version of `baseIsEqualDeep` for objects with support for
|
||
* partial deep comparisons.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to compare.
|
||
* @param {Object} other The other object to compare.
|
||
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
||
* @param {Function} customizer The function to customize comparisons.
|
||
* @param {Function} equalFunc The function to determine equivalents of values.
|
||
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||
*/
|
||
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
||
objProps = getAllKeys(object),
|
||
objLength = objProps.length,
|
||
othProps = getAllKeys(other),
|
||
othLength = othProps.length;
|
||
|
||
if (objLength != othLength && !isPartial) {
|
||
return false;
|
||
}
|
||
var index = objLength;
|
||
while (index--) {
|
||
var key = objProps[index];
|
||
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
||
return false;
|
||
}
|
||
}
|
||
// Check that cyclic values are equal.
|
||
var objStacked = stack.get(object);
|
||
var othStacked = stack.get(other);
|
||
if (objStacked && othStacked) {
|
||
return objStacked == other && othStacked == object;
|
||
}
|
||
var result = true;
|
||
stack.set(object, other);
|
||
stack.set(other, object);
|
||
|
||
var skipCtor = isPartial;
|
||
while (++index < objLength) {
|
||
key = objProps[index];
|
||
var objValue = object[key],
|
||
othValue = other[key];
|
||
|
||
if (customizer) {
|
||
var compared = isPartial
|
||
? customizer(othValue, objValue, key, other, object, stack)
|
||
: customizer(objValue, othValue, key, object, other, stack);
|
||
}
|
||
// Recursively compare objects (susceptible to call stack limits).
|
||
if (!(compared === undefined
|
||
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
||
: compared
|
||
)) {
|
||
result = false;
|
||
break;
|
||
}
|
||
skipCtor || (skipCtor = key == 'constructor');
|
||
}
|
||
if (result && !skipCtor) {
|
||
var objCtor = object.constructor,
|
||
othCtor = other.constructor;
|
||
|
||
// Non `Object` object instances with different constructors are not equal.
|
||
if (objCtor != othCtor &&
|
||
('constructor' in object && 'constructor' in other) &&
|
||
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
||
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
||
result = false;
|
||
}
|
||
}
|
||
stack['delete'](object);
|
||
stack['delete'](other);
|
||
return result;
|
||
}
|
||
|
||
module.exports = equalObjects;
|
||
|
||
|
||
/***/ }),
|
||
/* 199 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGetAllKeys = __webpack_require__(100),
|
||
getSymbols = __webpack_require__(101),
|
||
keys = __webpack_require__(47);
|
||
|
||
/**
|
||
* Creates an array of own enumerable property names and symbols of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of property names and symbols.
|
||
*/
|
||
function getAllKeys(object) {
|
||
return baseGetAllKeys(object, keys, getSymbols);
|
||
}
|
||
|
||
module.exports = getAllKeys;
|
||
|
||
|
||
/***/ }),
|
||
/* 200 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* A specialized version of `_.filter` for arrays without support for
|
||
* iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Array} [array] The array to iterate over.
|
||
* @param {Function} predicate The function invoked per iteration.
|
||
* @returns {Array} Returns the new filtered array.
|
||
*/
|
||
function arrayFilter(array, predicate) {
|
||
var index = -1,
|
||
length = array == null ? 0 : array.length,
|
||
resIndex = 0,
|
||
result = [];
|
||
|
||
while (++index < length) {
|
||
var value = array[index];
|
||
if (predicate(value, index, array)) {
|
||
result[resIndex++] = value;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = arrayFilter;
|
||
|
||
|
||
/***/ }),
|
||
/* 201 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The base implementation of `_.times` without support for iteratee shorthands
|
||
* or max array length checks.
|
||
*
|
||
* @private
|
||
* @param {number} n The number of times to invoke `iteratee`.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @returns {Array} Returns the array of results.
|
||
*/
|
||
function baseTimes(n, iteratee) {
|
||
var index = -1,
|
||
result = Array(n);
|
||
|
||
while (++index < n) {
|
||
result[index] = iteratee(index);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = baseTimes;
|
||
|
||
|
||
/***/ }),
|
||
/* 202 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGetTag = __webpack_require__(25),
|
||
isObjectLike = __webpack_require__(20);
|
||
|
||
/** `Object#toString` result references. */
|
||
var argsTag = '[object Arguments]';
|
||
|
||
/**
|
||
* The base implementation of `_.isArguments`.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
||
*/
|
||
function baseIsArguments(value) {
|
||
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
||
}
|
||
|
||
module.exports = baseIsArguments;
|
||
|
||
|
||
/***/ }),
|
||
/* 203 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* This method returns `false`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.13.0
|
||
* @category Util
|
||
* @returns {boolean} Returns `false`.
|
||
* @example
|
||
*
|
||
* _.times(2, _.stubFalse);
|
||
* // => [false, false]
|
||
*/
|
||
function stubFalse() {
|
||
return false;
|
||
}
|
||
|
||
module.exports = stubFalse;
|
||
|
||
|
||
/***/ }),
|
||
/* 204 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGetTag = __webpack_require__(25),
|
||
isLength = __webpack_require__(64),
|
||
isObjectLike = __webpack_require__(20);
|
||
|
||
/** `Object#toString` result references. */
|
||
var argsTag = '[object Arguments]',
|
||
arrayTag = '[object Array]',
|
||
boolTag = '[object Boolean]',
|
||
dateTag = '[object Date]',
|
||
errorTag = '[object Error]',
|
||
funcTag = '[object Function]',
|
||
mapTag = '[object Map]',
|
||
numberTag = '[object Number]',
|
||
objectTag = '[object Object]',
|
||
regexpTag = '[object RegExp]',
|
||
setTag = '[object Set]',
|
||
stringTag = '[object String]',
|
||
weakMapTag = '[object WeakMap]';
|
||
|
||
var arrayBufferTag = '[object ArrayBuffer]',
|
||
dataViewTag = '[object DataView]',
|
||
float32Tag = '[object Float32Array]',
|
||
float64Tag = '[object Float64Array]',
|
||
int8Tag = '[object Int8Array]',
|
||
int16Tag = '[object Int16Array]',
|
||
int32Tag = '[object Int32Array]',
|
||
uint8Tag = '[object Uint8Array]',
|
||
uint8ClampedTag = '[object Uint8ClampedArray]',
|
||
uint16Tag = '[object Uint16Array]',
|
||
uint32Tag = '[object Uint32Array]';
|
||
|
||
/** Used to identify `toStringTag` values of typed arrays. */
|
||
var typedArrayTags = {};
|
||
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
||
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
||
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
||
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
||
typedArrayTags[uint32Tag] = true;
|
||
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
||
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
||
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
||
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
||
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
||
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
||
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
||
typedArrayTags[weakMapTag] = false;
|
||
|
||
/**
|
||
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
||
*/
|
||
function baseIsTypedArray(value) {
|
||
return isObjectLike(value) &&
|
||
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
||
}
|
||
|
||
module.exports = baseIsTypedArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 205 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The base implementation of `_.unary` without support for storing metadata.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to cap arguments for.
|
||
* @returns {Function} Returns the new capped function.
|
||
*/
|
||
function baseUnary(func) {
|
||
return function(value) {
|
||
return func(value);
|
||
};
|
||
}
|
||
|
||
module.exports = baseUnary;
|
||
|
||
|
||
/***/ }),
|
||
/* 206 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(96);
|
||
|
||
/** Detect free variable `exports`. */
|
||
var freeExports = true && exports && !exports.nodeType && exports;
|
||
|
||
/** Detect free variable `module`. */
|
||
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
||
|
||
/** Detect the popular CommonJS extension `module.exports`. */
|
||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||
|
||
/** Detect free variable `process` from Node.js. */
|
||
var freeProcess = moduleExports && freeGlobal.process;
|
||
|
||
/** Used to access faster Node.js helpers. */
|
||
var nodeUtil = (function() {
|
||
try {
|
||
// Use `util.types` for Node.js 10+.
|
||
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
||
|
||
if (types) {
|
||
return types;
|
||
}
|
||
|
||
// Legacy `process.binding('util')` for Node.js < 10.
|
||
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
||
} catch (e) {}
|
||
}());
|
||
|
||
module.exports = nodeUtil;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(104)(module)))
|
||
|
||
/***/ }),
|
||
/* 207 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var overArg = __webpack_require__(105);
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeKeys = overArg(Object.keys, Object);
|
||
|
||
module.exports = nativeKeys;
|
||
|
||
|
||
/***/ }),
|
||
/* 208 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getNative = __webpack_require__(19),
|
||
root = __webpack_require__(10);
|
||
|
||
/* Built-in method references that are verified to be native. */
|
||
var DataView = getNative(root, 'DataView');
|
||
|
||
module.exports = DataView;
|
||
|
||
|
||
/***/ }),
|
||
/* 209 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getNative = __webpack_require__(19),
|
||
root = __webpack_require__(10);
|
||
|
||
/* Built-in method references that are verified to be native. */
|
||
var Promise = getNative(root, 'Promise');
|
||
|
||
module.exports = Promise;
|
||
|
||
|
||
/***/ }),
|
||
/* 210 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getNative = __webpack_require__(19),
|
||
root = __webpack_require__(10);
|
||
|
||
/* Built-in method references that are verified to be native. */
|
||
var Set = getNative(root, 'Set');
|
||
|
||
module.exports = Set;
|
||
|
||
|
||
/***/ }),
|
||
/* 211 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isStrictComparable = __webpack_require__(107),
|
||
keys = __webpack_require__(47);
|
||
|
||
/**
|
||
* Gets the property names, values, and compare flags of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the match data of `object`.
|
||
*/
|
||
function getMatchData(object) {
|
||
var result = keys(object),
|
||
length = result.length;
|
||
|
||
while (length--) {
|
||
var key = result[length],
|
||
value = object[key];
|
||
|
||
result[length] = [key, value, isStrictComparable(value)];
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = getMatchData;
|
||
|
||
|
||
/***/ }),
|
||
/* 212 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIsEqual = __webpack_require__(98),
|
||
get = __webpack_require__(68),
|
||
hasIn = __webpack_require__(218),
|
||
isKey = __webpack_require__(70),
|
||
isStrictComparable = __webpack_require__(107),
|
||
matchesStrictComparable = __webpack_require__(108),
|
||
toKey = __webpack_require__(33);
|
||
|
||
/** Used to compose bitmasks for value comparisons. */
|
||
var COMPARE_PARTIAL_FLAG = 1,
|
||
COMPARE_UNORDERED_FLAG = 2;
|
||
|
||
/**
|
||
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
||
*
|
||
* @private
|
||
* @param {string} path The path of the property to get.
|
||
* @param {*} srcValue The value to match.
|
||
* @returns {Function} Returns the new spec function.
|
||
*/
|
||
function baseMatchesProperty(path, srcValue) {
|
||
if (isKey(path) && isStrictComparable(srcValue)) {
|
||
return matchesStrictComparable(toKey(path), srcValue);
|
||
}
|
||
return function(object) {
|
||
var objValue = get(object, path);
|
||
return (objValue === undefined && objValue === srcValue)
|
||
? hasIn(object, path)
|
||
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
||
};
|
||
}
|
||
|
||
module.exports = baseMatchesProperty;
|
||
|
||
|
||
/***/ }),
|
||
/* 213 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var memoizeCapped = __webpack_require__(214);
|
||
|
||
/** Used to match property names within property paths. */
|
||
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
||
|
||
/** Used to match backslashes in property paths. */
|
||
var reEscapeChar = /\\(\\)?/g;
|
||
|
||
/**
|
||
* Converts `string` to a property path array.
|
||
*
|
||
* @private
|
||
* @param {string} string The string to convert.
|
||
* @returns {Array} Returns the property path array.
|
||
*/
|
||
var stringToPath = memoizeCapped(function(string) {
|
||
var result = [];
|
||
if (string.charCodeAt(0) === 46 /* . */) {
|
||
result.push('');
|
||
}
|
||
string.replace(rePropName, function(match, number, quote, subString) {
|
||
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
||
});
|
||
return result;
|
||
});
|
||
|
||
module.exports = stringToPath;
|
||
|
||
|
||
/***/ }),
|
||
/* 214 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var memoize = __webpack_require__(215);
|
||
|
||
/** Used as the maximum memoize cache size. */
|
||
var MAX_MEMOIZE_SIZE = 500;
|
||
|
||
/**
|
||
* A specialized version of `_.memoize` which clears the memoized function's
|
||
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to have its output memoized.
|
||
* @returns {Function} Returns the new memoized function.
|
||
*/
|
||
function memoizeCapped(func) {
|
||
var result = memoize(func, function(key) {
|
||
if (cache.size === MAX_MEMOIZE_SIZE) {
|
||
cache.clear();
|
||
}
|
||
return key;
|
||
});
|
||
|
||
var cache = result.cache;
|
||
return result;
|
||
}
|
||
|
||
module.exports = memoizeCapped;
|
||
|
||
|
||
/***/ }),
|
||
/* 215 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var MapCache = __webpack_require__(59);
|
||
|
||
/** Error message constants. */
|
||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||
|
||
/**
|
||
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||
* provided, it determines the cache key for storing the result based on the
|
||
* arguments provided to the memoized function. By default, the first argument
|
||
* provided to the memoized function is used as the map cache key. The `func`
|
||
* is invoked with the `this` binding of the memoized function.
|
||
*
|
||
* **Note:** The cache is exposed as the `cache` property on the memoized
|
||
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
||
* constructor with one whose instances implement the
|
||
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
||
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Function
|
||
* @param {Function} func The function to have its output memoized.
|
||
* @param {Function} [resolver] The function to resolve the cache key.
|
||
* @returns {Function} Returns the new memoized function.
|
||
* @example
|
||
*
|
||
* var object = { 'a': 1, 'b': 2 };
|
||
* var other = { 'c': 3, 'd': 4 };
|
||
*
|
||
* var values = _.memoize(_.values);
|
||
* values(object);
|
||
* // => [1, 2]
|
||
*
|
||
* values(other);
|
||
* // => [3, 4]
|
||
*
|
||
* object.a = 2;
|
||
* values(object);
|
||
* // => [1, 2]
|
||
*
|
||
* // Modify the result cache.
|
||
* values.cache.set(object, ['a', 'b']);
|
||
* values(object);
|
||
* // => ['a', 'b']
|
||
*
|
||
* // Replace `_.memoize.Cache`.
|
||
* _.memoize.Cache = WeakMap;
|
||
*/
|
||
function memoize(func, resolver) {
|
||
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
||
throw new TypeError(FUNC_ERROR_TEXT);
|
||
}
|
||
var memoized = function() {
|
||
var args = arguments,
|
||
key = resolver ? resolver.apply(this, args) : args[0],
|
||
cache = memoized.cache;
|
||
|
||
if (cache.has(key)) {
|
||
return cache.get(key);
|
||
}
|
||
var result = func.apply(this, args);
|
||
memoized.cache = cache.set(key, result) || cache;
|
||
return result;
|
||
};
|
||
memoized.cache = new (memoize.Cache || MapCache);
|
||
return memoized;
|
||
}
|
||
|
||
// Expose `MapCache`.
|
||
memoize.Cache = MapCache;
|
||
|
||
module.exports = memoize;
|
||
|
||
|
||
/***/ }),
|
||
/* 216 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseToString = __webpack_require__(217);
|
||
|
||
/**
|
||
* Converts `value` to a string. An empty string is returned for `null`
|
||
* and `undefined` values. The sign of `-0` is preserved.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to convert.
|
||
* @returns {string} Returns the converted string.
|
||
* @example
|
||
*
|
||
* _.toString(null);
|
||
* // => ''
|
||
*
|
||
* _.toString(-0);
|
||
* // => '-0'
|
||
*
|
||
* _.toString([1, 2, 3]);
|
||
* // => '1,2,3'
|
||
*/
|
||
function toString(value) {
|
||
return value == null ? '' : baseToString(value);
|
||
}
|
||
|
||
module.exports = toString;
|
||
|
||
|
||
/***/ }),
|
||
/* 217 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Symbol = __webpack_require__(32),
|
||
arrayMap = __webpack_require__(109),
|
||
isArray = __webpack_require__(2),
|
||
isSymbol = __webpack_require__(50);
|
||
|
||
/** Used as references for various `Number` constants. */
|
||
var INFINITY = 1 / 0;
|
||
|
||
/** Used to convert symbols to primitives and strings. */
|
||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
||
|
||
/**
|
||
* The base implementation of `_.toString` which doesn't convert nullish
|
||
* values to empty strings.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to process.
|
||
* @returns {string} Returns the string.
|
||
*/
|
||
function baseToString(value) {
|
||
// Exit early for strings to avoid a performance hit in some environments.
|
||
if (typeof value == 'string') {
|
||
return value;
|
||
}
|
||
if (isArray(value)) {
|
||
// Recursively convert values (susceptible to call stack limits).
|
||
return arrayMap(value, baseToString) + '';
|
||
}
|
||
if (isSymbol(value)) {
|
||
return symbolToString ? symbolToString.call(value) : '';
|
||
}
|
||
var result = (value + '');
|
||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
||
}
|
||
|
||
module.exports = baseToString;
|
||
|
||
|
||
/***/ }),
|
||
/* 218 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseHasIn = __webpack_require__(219),
|
||
hasPath = __webpack_require__(220);
|
||
|
||
/**
|
||
* Checks if `path` is a direct or inherited property of `object`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Object
|
||
* @param {Object} object The object to query.
|
||
* @param {Array|string} path The path to check.
|
||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||
* @example
|
||
*
|
||
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
||
*
|
||
* _.hasIn(object, 'a');
|
||
* // => true
|
||
*
|
||
* _.hasIn(object, 'a.b');
|
||
* // => true
|
||
*
|
||
* _.hasIn(object, ['a', 'b']);
|
||
* // => true
|
||
*
|
||
* _.hasIn(object, 'b');
|
||
* // => false
|
||
*/
|
||
function hasIn(object, path) {
|
||
return object != null && hasPath(object, path, baseHasIn);
|
||
}
|
||
|
||
module.exports = hasIn;
|
||
|
||
|
||
/***/ }),
|
||
/* 219 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The base implementation of `_.hasIn` without support for deep paths.
|
||
*
|
||
* @private
|
||
* @param {Object} [object] The object to query.
|
||
* @param {Array|string} key The key to check.
|
||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||
*/
|
||
function baseHasIn(object, key) {
|
||
return object != null && key in Object(object);
|
||
}
|
||
|
||
module.exports = baseHasIn;
|
||
|
||
|
||
/***/ }),
|
||
/* 220 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var castPath = __webpack_require__(49),
|
||
isArguments = __webpack_require__(48),
|
||
isArray = __webpack_require__(2),
|
||
isIndex = __webpack_require__(62),
|
||
isLength = __webpack_require__(64),
|
||
toKey = __webpack_require__(33);
|
||
|
||
/**
|
||
* Checks if `path` exists on `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @param {Array|string} path The path to check.
|
||
* @param {Function} hasFunc The function to check properties.
|
||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||
*/
|
||
function hasPath(object, path, hasFunc) {
|
||
path = castPath(path, object);
|
||
|
||
var index = -1,
|
||
length = path.length,
|
||
result = false;
|
||
|
||
while (++index < length) {
|
||
var key = toKey(path[index]);
|
||
if (!(result = object != null && hasFunc(object, key))) {
|
||
break;
|
||
}
|
||
object = object[key];
|
||
}
|
||
if (result || ++index != length) {
|
||
return result;
|
||
}
|
||
length = object == null ? 0 : object.length;
|
||
return !!length && isLength(length) && isIndex(key, length) &&
|
||
(isArray(object) || isArguments(object));
|
||
}
|
||
|
||
module.exports = hasPath;
|
||
|
||
|
||
/***/ }),
|
||
/* 221 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseProperty = __webpack_require__(110),
|
||
basePropertyDeep = __webpack_require__(222),
|
||
isKey = __webpack_require__(70),
|
||
toKey = __webpack_require__(33);
|
||
|
||
/**
|
||
* Creates a function that returns the value at `path` of a given object.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 2.4.0
|
||
* @category Util
|
||
* @param {Array|string} path The path of the property to get.
|
||
* @returns {Function} Returns the new accessor function.
|
||
* @example
|
||
*
|
||
* var objects = [
|
||
* { 'a': { 'b': 2 } },
|
||
* { 'a': { 'b': 1 } }
|
||
* ];
|
||
*
|
||
* _.map(objects, _.property('a.b'));
|
||
* // => [2, 1]
|
||
*
|
||
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
||
* // => [1, 2]
|
||
*/
|
||
function property(path) {
|
||
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
||
}
|
||
|
||
module.exports = property;
|
||
|
||
|
||
/***/ }),
|
||
/* 222 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGet = __webpack_require__(69);
|
||
|
||
/**
|
||
* A specialized version of `baseProperty` which supports deep paths.
|
||
*
|
||
* @private
|
||
* @param {Array|string} path The path of the property to get.
|
||
* @returns {Function} Returns the new accessor function.
|
||
*/
|
||
function basePropertyDeep(path) {
|
||
return function(object) {
|
||
return baseGet(object, path);
|
||
};
|
||
}
|
||
|
||
module.exports = basePropertyDeep;
|
||
|
||
|
||
/***/ }),
|
||
/* 223 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var toNumber = __webpack_require__(72);
|
||
|
||
/** Used as references for various `Number` constants. */
|
||
var INFINITY = 1 / 0,
|
||
MAX_INTEGER = 1.7976931348623157e+308;
|
||
|
||
/**
|
||
* Converts `value` to a finite number.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.12.0
|
||
* @category Lang
|
||
* @param {*} value The value to convert.
|
||
* @returns {number} Returns the converted number.
|
||
* @example
|
||
*
|
||
* _.toFinite(3.2);
|
||
* // => 3.2
|
||
*
|
||
* _.toFinite(Number.MIN_VALUE);
|
||
* // => 5e-324
|
||
*
|
||
* _.toFinite(Infinity);
|
||
* // => 1.7976931348623157e+308
|
||
*
|
||
* _.toFinite('3.2');
|
||
* // => 3.2
|
||
*/
|
||
function toFinite(value) {
|
||
if (!value) {
|
||
return value === 0 ? value : 0;
|
||
}
|
||
value = toNumber(value);
|
||
if (value === INFINITY || value === -INFINITY) {
|
||
var sign = (value < 0 ? -1 : 1);
|
||
return sign * MAX_INTEGER;
|
||
}
|
||
return value === value ? value : 0;
|
||
}
|
||
|
||
module.exports = toFinite;
|
||
|
||
|
||
/***/ }),
|
||
/* 224 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var trimmedEndIndex = __webpack_require__(225);
|
||
|
||
/** Used to match leading whitespace. */
|
||
var reTrimStart = /^\s+/;
|
||
|
||
/**
|
||
* The base implementation of `_.trim`.
|
||
*
|
||
* @private
|
||
* @param {string} string The string to trim.
|
||
* @returns {string} Returns the trimmed string.
|
||
*/
|
||
function baseTrim(string) {
|
||
return string
|
||
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
||
: string;
|
||
}
|
||
|
||
module.exports = baseTrim;
|
||
|
||
|
||
/***/ }),
|
||
/* 225 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used to match a single whitespace character. */
|
||
var reWhitespace = /\s/;
|
||
|
||
/**
|
||
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
||
* character of `string`.
|
||
*
|
||
* @private
|
||
* @param {string} string The string to inspect.
|
||
* @returns {number} Returns the index of the last non-whitespace character.
|
||
*/
|
||
function trimmedEndIndex(string) {
|
||
var index = string.length;
|
||
|
||
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
||
return index;
|
||
}
|
||
|
||
module.exports = trimmedEndIndex;
|
||
|
||
|
||
/***/ }),
|
||
/* 226 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__(227);
|
||
|
||
__webpack_require__(284);
|
||
__webpack_require__(285);
|
||
|
||
|
||
/***/ }),
|
||
/* 227 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
__webpack_require__(228);
|
||
__webpack_require__(245);
|
||
__webpack_require__(252);
|
||
__webpack_require__(253);
|
||
__webpack_require__(254);
|
||
__webpack_require__(255);
|
||
__webpack_require__(257);
|
||
__webpack_require__(258);
|
||
__webpack_require__(260);
|
||
__webpack_require__(261);
|
||
__webpack_require__(262);
|
||
__webpack_require__(263);
|
||
__webpack_require__(264);
|
||
__webpack_require__(265);
|
||
__webpack_require__(126);
|
||
__webpack_require__(267);
|
||
__webpack_require__(268);
|
||
__webpack_require__(269);
|
||
__webpack_require__(270);
|
||
__webpack_require__(272);
|
||
__webpack_require__(273);
|
||
__webpack_require__(274);
|
||
__webpack_require__(275);
|
||
__webpack_require__(276);
|
||
__webpack_require__(277);
|
||
__webpack_require__(278);
|
||
__webpack_require__(279);
|
||
__webpack_require__(281);
|
||
__webpack_require__(282);
|
||
__webpack_require__(283);
|
||
var path = __webpack_require__(119);
|
||
|
||
module.exports = path.Array;
|
||
|
||
|
||
/***/ }),
|
||
/* 228 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var charAt = __webpack_require__(229).charAt;
|
||
var InternalStateModule = __webpack_require__(74);
|
||
var defineIterator = __webpack_require__(116);
|
||
|
||
var STRING_ITERATOR = 'String Iterator';
|
||
var setInternalState = InternalStateModule.set;
|
||
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
|
||
|
||
// `String.prototype[@@iterator]` method
|
||
// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
|
||
defineIterator(String, 'String', function (iterated) {
|
||
setInternalState(this, {
|
||
type: STRING_ITERATOR,
|
||
string: String(iterated),
|
||
index: 0
|
||
});
|
||
// `%StringIteratorPrototype%.next` method
|
||
// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
|
||
}, function next() {
|
||
var state = getInternalState(this);
|
||
var string = state.string;
|
||
var index = state.index;
|
||
var point;
|
||
if (index >= string.length) return { value: undefined, done: true };
|
||
point = charAt(string, index);
|
||
state.index += point.length;
|
||
return { value: point, done: false };
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 229 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var toInteger = __webpack_require__(27);
|
||
var requireObjectCoercible = __webpack_require__(73);
|
||
|
||
// `String.prototype.{ codePointAt, at }` methods implementation
|
||
var createMethod = function (CONVERT_TO_STRING) {
|
||
return function ($this, pos) {
|
||
var S = String(requireObjectCoercible($this));
|
||
var position = toInteger(pos);
|
||
var size = S.length;
|
||
var first, second;
|
||
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
||
first = S.charCodeAt(position);
|
||
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
||
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
||
? CONVERT_TO_STRING ? S.charAt(position) : first
|
||
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
||
};
|
||
};
|
||
|
||
module.exports = {
|
||
// `String.prototype.codePointAt` method
|
||
// https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
|
||
codeAt: createMethod(false),
|
||
// `String.prototype.at` method
|
||
// https://github.com/mathiasbynens/String.prototype.at
|
||
charAt: createMethod(true)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 230 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var nativeFunctionToString = __webpack_require__(112);
|
||
|
||
var WeakMap = global.WeakMap;
|
||
|
||
module.exports = typeof WeakMap === 'function' && /native code/.test(nativeFunctionToString.call(WeakMap));
|
||
|
||
|
||
/***/ }),
|
||
/* 231 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||
|
||
// Nashorn ~ JDK8 bug
|
||
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
||
|
||
// `Object.prototype.propertyIsEnumerable` method implementation
|
||
// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
|
||
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
||
var descriptor = getOwnPropertyDescriptor(this, V);
|
||
return !!descriptor && descriptor.enumerable;
|
||
} : nativePropertyIsEnumerable;
|
||
|
||
|
||
/***/ }),
|
||
/* 232 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var has = __webpack_require__(17);
|
||
var ownKeys = __webpack_require__(233);
|
||
var getOwnPropertyDescriptorModule = __webpack_require__(117);
|
||
var definePropertyModule = __webpack_require__(15);
|
||
|
||
module.exports = function (target, source) {
|
||
var keys = ownKeys(source);
|
||
var defineProperty = definePropertyModule.f;
|
||
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
||
for (var i = 0; i < keys.length; i++) {
|
||
var key = keys[i];
|
||
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 233 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getBuiltIn = __webpack_require__(81);
|
||
var getOwnPropertyNamesModule = __webpack_require__(234);
|
||
var getOwnPropertySymbolsModule = __webpack_require__(235);
|
||
var anObject = __webpack_require__(28);
|
||
|
||
// all object keys, includes non-enumerable and symbols
|
||
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
||
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
||
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
||
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 234 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var internalObjectKeys = __webpack_require__(120);
|
||
var enumBugKeys = __webpack_require__(83);
|
||
|
||
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
||
|
||
// `Object.getOwnPropertyNames` method
|
||
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
|
||
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
||
return internalObjectKeys(O, hiddenKeys);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 235 */
|
||
/***/ (function(module, exports) {
|
||
|
||
exports.f = Object.getOwnPropertySymbols;
|
||
|
||
|
||
/***/ }),
|
||
/* 236 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var fails = __webpack_require__(8);
|
||
|
||
var replacement = /#|\.prototype\./;
|
||
|
||
var isForced = function (feature, detection) {
|
||
var value = data[normalize(feature)];
|
||
return value == POLYFILL ? true
|
||
: value == NATIVE ? false
|
||
: typeof detection == 'function' ? fails(detection)
|
||
: !!detection;
|
||
};
|
||
|
||
var normalize = isForced.normalize = function (string) {
|
||
return String(string).replace(replacement, '.').toLowerCase();
|
||
};
|
||
|
||
var data = isForced.data = {};
|
||
var NATIVE = isForced.NATIVE = 'N';
|
||
var POLYFILL = isForced.POLYFILL = 'P';
|
||
|
||
module.exports = isForced;
|
||
|
||
|
||
/***/ }),
|
||
/* 237 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var IteratorPrototype = __webpack_require__(121).IteratorPrototype;
|
||
var create = __webpack_require__(123);
|
||
var createPropertyDescriptor = __webpack_require__(52);
|
||
var setToStringTag = __webpack_require__(124);
|
||
var Iterators = __webpack_require__(35);
|
||
|
||
var returnThis = function () { return this; };
|
||
|
||
module.exports = function (IteratorConstructor, NAME, next) {
|
||
var TO_STRING_TAG = NAME + ' Iterator';
|
||
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
|
||
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
|
||
Iterators[TO_STRING_TAG] = returnThis;
|
||
return IteratorConstructor;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 238 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var fails = __webpack_require__(8);
|
||
|
||
module.exports = !fails(function () {
|
||
function F() { /* empty */ }
|
||
F.prototype.constructor = null;
|
||
return Object.getPrototypeOf(new F()) !== F.prototype;
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 239 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var fails = __webpack_require__(8);
|
||
|
||
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
|
||
// Chrome 38 Symbol has incorrect toString conversion
|
||
// eslint-disable-next-line no-undef
|
||
return !String(Symbol());
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 240 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
var definePropertyModule = __webpack_require__(15);
|
||
var anObject = __webpack_require__(28);
|
||
var objectKeys = __webpack_require__(241);
|
||
|
||
// `Object.defineProperties` method
|
||
// https://tc39.github.io/ecma262/#sec-object.defineproperties
|
||
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
|
||
anObject(O);
|
||
var keys = objectKeys(Properties);
|
||
var length = keys.length;
|
||
var index = 0;
|
||
var key;
|
||
while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
|
||
return O;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 241 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var internalObjectKeys = __webpack_require__(120);
|
||
var enumBugKeys = __webpack_require__(83);
|
||
|
||
// `Object.keys` method
|
||
// https://tc39.github.io/ecma262/#sec-object.keys
|
||
module.exports = Object.keys || function keys(O) {
|
||
return internalObjectKeys(O, enumBugKeys);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 242 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var getBuiltIn = __webpack_require__(81);
|
||
|
||
module.exports = getBuiltIn('document', 'documentElement');
|
||
|
||
|
||
/***/ }),
|
||
/* 243 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var anObject = __webpack_require__(28);
|
||
var aPossiblePrototype = __webpack_require__(244);
|
||
|
||
// `Object.setPrototypeOf` method
|
||
// https://tc39.github.io/ecma262/#sec-object.setprototypeof
|
||
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
||
/* eslint-disable no-proto */
|
||
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
||
var CORRECT_SETTER = false;
|
||
var test = {};
|
||
var setter;
|
||
try {
|
||
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
||
setter.call(test, []);
|
||
CORRECT_SETTER = test instanceof Array;
|
||
} catch (error) { /* empty */ }
|
||
return function setPrototypeOf(O, proto) {
|
||
anObject(O);
|
||
aPossiblePrototype(proto);
|
||
if (CORRECT_SETTER) setter.call(O, proto);
|
||
else O.__proto__ = proto;
|
||
return O;
|
||
};
|
||
}() : undefined);
|
||
|
||
|
||
/***/ }),
|
||
/* 244 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(16);
|
||
|
||
module.exports = function (it) {
|
||
if (!isObject(it) && it !== null) {
|
||
throw TypeError("Can't set " + String(it) + ' as a prototype');
|
||
} return it;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 245 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var $ = __webpack_require__(0);
|
||
var from = __webpack_require__(246);
|
||
var checkCorrectnessOfIteration = __webpack_require__(251);
|
||
|
||
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
|
||
Array.from(iterable);
|
||
});
|
||
|
||
// `Array.from` method
|
||
// https://tc39.github.io/ecma262/#sec-array.from
|
||
$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
|
||
from: from
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 246 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var bind = __webpack_require__(54);
|
||
var toObject = __webpack_require__(4);
|
||
var callWithSafeIterationClosing = __webpack_require__(247);
|
||
var isArrayIteratorMethod = __webpack_require__(248);
|
||
var toLength = __webpack_require__(3);
|
||
var createProperty = __webpack_require__(36);
|
||
var getIteratorMethod = __webpack_require__(249);
|
||
|
||
// `Array.from` method implementation
|
||
// https://tc39.github.io/ecma262/#sec-array.from
|
||
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
|
||
var O = toObject(arrayLike);
|
||
var C = typeof this == 'function' ? this : Array;
|
||
var argumentsLength = arguments.length;
|
||
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
||
var mapping = mapfn !== undefined;
|
||
var index = 0;
|
||
var iteratorMethod = getIteratorMethod(O);
|
||
var length, result, step, iterator;
|
||
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
|
||
// if the target is not iterable or it's an array with the default iterator - use a simple case
|
||
if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
|
||
iterator = iteratorMethod.call(O);
|
||
result = new C();
|
||
for (;!(step = iterator.next()).done; index++) {
|
||
createProperty(result, index, mapping
|
||
? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true)
|
||
: step.value
|
||
);
|
||
}
|
||
} else {
|
||
length = toLength(O.length);
|
||
result = new C(length);
|
||
for (;length > index; index++) {
|
||
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
|
||
}
|
||
}
|
||
result.length = index;
|
||
return result;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 247 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var anObject = __webpack_require__(28);
|
||
|
||
// call something on iterator step with safe closing on error
|
||
module.exports = function (iterator, fn, value, ENTRIES) {
|
||
try {
|
||
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
||
// 7.4.6 IteratorClose(iterator, completion)
|
||
} catch (error) {
|
||
var returnMethod = iterator['return'];
|
||
if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
|
||
throw error;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 248 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
var Iterators = __webpack_require__(35);
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
var ArrayPrototype = Array.prototype;
|
||
|
||
// check on default Array iterator
|
||
module.exports = function (it) {
|
||
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 249 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var classof = __webpack_require__(250);
|
||
var Iterators = __webpack_require__(35);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
|
||
module.exports = function (it) {
|
||
if (it != undefined) return it[ITERATOR]
|
||
|| it['@@iterator']
|
||
|| Iterators[classof(it)];
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 250 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var classofRaw = __webpack_require__(80);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||
// ES3 wrong here
|
||
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
||
|
||
// fallback for IE11 Script Access Denied error
|
||
var tryGet = function (it, key) {
|
||
try {
|
||
return it[key];
|
||
} catch (error) { /* empty */ }
|
||
};
|
||
|
||
// getting tag from ES6+ `Object.prototype.toString`
|
||
module.exports = function (it) {
|
||
var O, tag, result;
|
||
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
||
// @@toStringTag case
|
||
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
|
||
// builtinTag case
|
||
: CORRECT_ARGUMENTS ? classofRaw(O)
|
||
// ES3 arguments fallback
|
||
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 251 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
var SAFE_CLOSING = false;
|
||
|
||
try {
|
||
var called = 0;
|
||
var iteratorWithReturn = {
|
||
next: function () {
|
||
return { done: !!called++ };
|
||
},
|
||
'return': function () {
|
||
SAFE_CLOSING = true;
|
||
}
|
||
};
|
||
iteratorWithReturn[ITERATOR] = function () {
|
||
return this;
|
||
};
|
||
// eslint-disable-next-line no-throw-literal
|
||
Array.from(iteratorWithReturn, function () { throw 2; });
|
||
} catch (error) { /* empty */ }
|
||
|
||
module.exports = function (exec, SKIP_CLOSING) {
|
||
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
||
var ITERATION_SUPPORT = false;
|
||
try {
|
||
var object = {};
|
||
object[ITERATOR] = function () {
|
||
return {
|
||
next: function () {
|
||
return { done: ITERATION_SUPPORT = true };
|
||
}
|
||
};
|
||
};
|
||
exec(object);
|
||
} catch (error) { /* empty */ }
|
||
return ITERATION_SUPPORT;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 252 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var $ = __webpack_require__(0);
|
||
var isArray = __webpack_require__(29);
|
||
|
||
// `Array.isArray` method
|
||
// https://tc39.github.io/ecma262/#sec-array.isarray
|
||
$({ target: 'Array', stat: true }, {
|
||
isArray: isArray
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 253 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var fails = __webpack_require__(8);
|
||
var createProperty = __webpack_require__(36);
|
||
|
||
var ISNT_GENERIC = fails(function () {
|
||
function F() { /* empty */ }
|
||
return !(Array.of.call(F) instanceof F);
|
||
});
|
||
|
||
// `Array.of` method
|
||
// https://tc39.github.io/ecma262/#sec-array.of
|
||
// WebKit Array.of isn't generic
|
||
$({ target: 'Array', stat: true, forced: ISNT_GENERIC }, {
|
||
of: function of(/* ...args */) {
|
||
var index = 0;
|
||
var argumentsLength = arguments.length;
|
||
var result = new (typeof this == 'function' ? this : Array)(argumentsLength);
|
||
while (argumentsLength > index) createProperty(result, index, arguments[index++]);
|
||
result.length = argumentsLength;
|
||
return result;
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 254 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var fails = __webpack_require__(8);
|
||
var isArray = __webpack_require__(29);
|
||
var isObject = __webpack_require__(16);
|
||
var toObject = __webpack_require__(4);
|
||
var toLength = __webpack_require__(3);
|
||
var createProperty = __webpack_require__(36);
|
||
var arraySpeciesCreate = __webpack_require__(37);
|
||
var arrayMethodHasSpeciesSupport = __webpack_require__(38);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
||
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
||
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
||
|
||
var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
|
||
var array = [];
|
||
array[IS_CONCAT_SPREADABLE] = false;
|
||
return array.concat()[0] !== array;
|
||
});
|
||
|
||
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
||
|
||
var isConcatSpreadable = function (O) {
|
||
if (!isObject(O)) return false;
|
||
var spreadable = O[IS_CONCAT_SPREADABLE];
|
||
return spreadable !== undefined ? !!spreadable : isArray(O);
|
||
};
|
||
|
||
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
||
|
||
// `Array.prototype.concat` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.concat
|
||
// with adding support of @@isConcatSpreadable and @@species
|
||
$({ target: 'Array', proto: true, forced: FORCED }, {
|
||
concat: function concat(arg) { // eslint-disable-line no-unused-vars
|
||
var O = toObject(this);
|
||
var A = arraySpeciesCreate(O, 0);
|
||
var n = 0;
|
||
var i, k, length, len, E;
|
||
for (i = -1, length = arguments.length; i < length; i++) {
|
||
E = i === -1 ? O : arguments[i];
|
||
if (isConcatSpreadable(E)) {
|
||
len = toLength(E.length);
|
||
if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
||
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
||
} else {
|
||
if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
||
createProperty(A, n++, E);
|
||
}
|
||
}
|
||
A.length = n;
|
||
return A;
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 255 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var $ = __webpack_require__(0);
|
||
var copyWithin = __webpack_require__(256);
|
||
var addToUnscopables = __webpack_require__(11);
|
||
|
||
// `Array.prototype.copyWithin` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin
|
||
$({ target: 'Array', proto: true }, {
|
||
copyWithin: copyWithin
|
||
});
|
||
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
||
addToUnscopables('copyWithin');
|
||
|
||
|
||
/***/ }),
|
||
/* 256 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var toObject = __webpack_require__(4);
|
||
var toAbsoluteIndex = __webpack_require__(34);
|
||
var toLength = __webpack_require__(3);
|
||
|
||
var min = Math.min;
|
||
|
||
// `Array.prototype.copyWithin` method implementation
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin
|
||
module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
|
||
var O = toObject(this);
|
||
var len = toLength(O.length);
|
||
var to = toAbsoluteIndex(target, len);
|
||
var from = toAbsoluteIndex(start, len);
|
||
var end = arguments.length > 2 ? arguments[2] : undefined;
|
||
var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
|
||
var inc = 1;
|
||
if (from < to && to < from + count) {
|
||
inc = -1;
|
||
from += count - 1;
|
||
to += count - 1;
|
||
}
|
||
while (count-- > 0) {
|
||
if (from in O) O[to] = O[from];
|
||
else delete O[to];
|
||
to += inc;
|
||
from += inc;
|
||
} return O;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 257 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $every = __webpack_require__(23).every;
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
// `Array.prototype.every` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.every
|
||
$({ target: 'Array', proto: true, forced: sloppyArrayMethod('every') }, {
|
||
every: function every(callbackfn /* , thisArg */) {
|
||
return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 258 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var $ = __webpack_require__(0);
|
||
var fill = __webpack_require__(259);
|
||
var addToUnscopables = __webpack_require__(11);
|
||
|
||
// `Array.prototype.fill` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.fill
|
||
$({ target: 'Array', proto: true }, {
|
||
fill: fill
|
||
});
|
||
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
||
addToUnscopables('fill');
|
||
|
||
|
||
/***/ }),
|
||
/* 259 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var toObject = __webpack_require__(4);
|
||
var toAbsoluteIndex = __webpack_require__(34);
|
||
var toLength = __webpack_require__(3);
|
||
|
||
// `Array.prototype.fill` method implementation
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.fill
|
||
module.exports = function fill(value /* , start = 0, end = @length */) {
|
||
var O = toObject(this);
|
||
var length = toLength(O.length);
|
||
var argumentsLength = arguments.length;
|
||
var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
|
||
var end = argumentsLength > 2 ? arguments[2] : undefined;
|
||
var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
|
||
while (endPos > index) O[index++] = value;
|
||
return O;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 260 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $filter = __webpack_require__(23).filter;
|
||
var arrayMethodHasSpeciesSupport = __webpack_require__(38);
|
||
|
||
// `Array.prototype.filter` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
|
||
// with adding support of @@species
|
||
$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
|
||
filter: function filter(callbackfn /* , thisArg */) {
|
||
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 261 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $find = __webpack_require__(23).find;
|
||
var addToUnscopables = __webpack_require__(11);
|
||
|
||
var FIND = 'find';
|
||
var SKIPS_HOLES = true;
|
||
|
||
// Shouldn't skip holes
|
||
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
||
|
||
// `Array.prototype.find` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.find
|
||
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
||
find: function find(callbackfn /* , that = undefined */) {
|
||
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
||
addToUnscopables(FIND);
|
||
|
||
|
||
/***/ }),
|
||
/* 262 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $findIndex = __webpack_require__(23).findIndex;
|
||
var addToUnscopables = __webpack_require__(11);
|
||
|
||
var FIND_INDEX = 'findIndex';
|
||
var SKIPS_HOLES = true;
|
||
|
||
// Shouldn't skip holes
|
||
if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
|
||
|
||
// `Array.prototype.findIndex` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.findindex
|
||
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
||
findIndex: function findIndex(callbackfn /* , that = undefined */) {
|
||
return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
||
addToUnscopables(FIND_INDEX);
|
||
|
||
|
||
/***/ }),
|
||
/* 263 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var flattenIntoArray = __webpack_require__(125);
|
||
var toObject = __webpack_require__(4);
|
||
var toLength = __webpack_require__(3);
|
||
var toInteger = __webpack_require__(27);
|
||
var arraySpeciesCreate = __webpack_require__(37);
|
||
|
||
// `Array.prototype.flat` method
|
||
// https://github.com/tc39/proposal-flatMap
|
||
$({ target: 'Array', proto: true }, {
|
||
flat: function flat(/* depthArg = 1 */) {
|
||
var depthArg = arguments.length ? arguments[0] : undefined;
|
||
var O = toObject(this);
|
||
var sourceLen = toLength(O.length);
|
||
var A = arraySpeciesCreate(O, 0);
|
||
A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
|
||
return A;
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 264 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var flattenIntoArray = __webpack_require__(125);
|
||
var toObject = __webpack_require__(4);
|
||
var toLength = __webpack_require__(3);
|
||
var aFunction = __webpack_require__(55);
|
||
var arraySpeciesCreate = __webpack_require__(37);
|
||
|
||
// `Array.prototype.flatMap` method
|
||
// https://github.com/tc39/proposal-flatMap
|
||
$({ target: 'Array', proto: true }, {
|
||
flatMap: function flatMap(callbackfn /* , thisArg */) {
|
||
var O = toObject(this);
|
||
var sourceLen = toLength(O.length);
|
||
var A;
|
||
aFunction(callbackfn);
|
||
A = arraySpeciesCreate(O, 0);
|
||
A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
return A;
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 265 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var forEach = __webpack_require__(266);
|
||
|
||
// `Array.prototype.forEach` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
|
||
$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {
|
||
forEach: forEach
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 266 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $forEach = __webpack_require__(23).forEach;
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
// `Array.prototype.forEach` method implementation
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
|
||
module.exports = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
|
||
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
} : [].forEach;
|
||
|
||
|
||
/***/ }),
|
||
/* 267 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $indexOf = __webpack_require__(82).indexOf;
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
var nativeIndexOf = [].indexOf;
|
||
|
||
var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
|
||
var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
|
||
|
||
// `Array.prototype.indexOf` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
|
||
$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
|
||
indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
|
||
return NEGATIVE_ZERO
|
||
// convert -0 to +0
|
||
? nativeIndexOf.apply(this, arguments) || 0
|
||
: $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 268 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var toIndexedObject = __webpack_require__(22);
|
||
var addToUnscopables = __webpack_require__(11);
|
||
var Iterators = __webpack_require__(35);
|
||
var InternalStateModule = __webpack_require__(74);
|
||
var defineIterator = __webpack_require__(116);
|
||
|
||
var ARRAY_ITERATOR = 'Array Iterator';
|
||
var setInternalState = InternalStateModule.set;
|
||
var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
|
||
|
||
// `Array.prototype.entries` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.entries
|
||
// `Array.prototype.keys` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.keys
|
||
// `Array.prototype.values` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.values
|
||
// `Array.prototype[@@iterator]` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
|
||
// `CreateArrayIterator` internal method
|
||
// https://tc39.github.io/ecma262/#sec-createarrayiterator
|
||
module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
|
||
setInternalState(this, {
|
||
type: ARRAY_ITERATOR,
|
||
target: toIndexedObject(iterated), // target
|
||
index: 0, // next index
|
||
kind: kind // kind
|
||
});
|
||
// `%ArrayIteratorPrototype%.next` method
|
||
// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
|
||
}, function () {
|
||
var state = getInternalState(this);
|
||
var target = state.target;
|
||
var kind = state.kind;
|
||
var index = state.index++;
|
||
if (!target || index >= target.length) {
|
||
state.target = undefined;
|
||
return { value: undefined, done: true };
|
||
}
|
||
if (kind == 'keys') return { value: index, done: false };
|
||
if (kind == 'values') return { value: target[index], done: false };
|
||
return { value: [index, target[index]], done: false };
|
||
}, 'values');
|
||
|
||
// argumentsList[@@iterator] is %ArrayProto_values%
|
||
// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
|
||
// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
|
||
Iterators.Arguments = Iterators.Array;
|
||
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
||
addToUnscopables('keys');
|
||
addToUnscopables('values');
|
||
addToUnscopables('entries');
|
||
|
||
|
||
/***/ }),
|
||
/* 269 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var IndexedObject = __webpack_require__(53);
|
||
var toIndexedObject = __webpack_require__(22);
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
var nativeJoin = [].join;
|
||
|
||
var ES3_STRINGS = IndexedObject != Object;
|
||
var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
|
||
|
||
// `Array.prototype.join` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.join
|
||
$({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
|
||
join: function join(separator) {
|
||
return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 270 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var $ = __webpack_require__(0);
|
||
var lastIndexOf = __webpack_require__(271);
|
||
|
||
// `Array.prototype.lastIndexOf` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
|
||
$({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, {
|
||
lastIndexOf: lastIndexOf
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 271 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var toIndexedObject = __webpack_require__(22);
|
||
var toInteger = __webpack_require__(27);
|
||
var toLength = __webpack_require__(3);
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
var min = Math.min;
|
||
var nativeLastIndexOf = [].lastIndexOf;
|
||
var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
|
||
var SLOPPY_METHOD = sloppyArrayMethod('lastIndexOf');
|
||
|
||
// `Array.prototype.lastIndexOf` method implementation
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
|
||
module.exports = (NEGATIVE_ZERO || SLOPPY_METHOD) ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
|
||
// convert -0 to +0
|
||
if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;
|
||
var O = toIndexedObject(this);
|
||
var length = toLength(O.length);
|
||
var index = length - 1;
|
||
if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
|
||
if (index < 0) index = length + index;
|
||
for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
|
||
return -1;
|
||
} : nativeLastIndexOf;
|
||
|
||
|
||
/***/ }),
|
||
/* 272 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $map = __webpack_require__(23).map;
|
||
var arrayMethodHasSpeciesSupport = __webpack_require__(38);
|
||
|
||
// `Array.prototype.map` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.map
|
||
// with adding support of @@species
|
||
$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, {
|
||
map: function map(callbackfn /* , thisArg */) {
|
||
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 273 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $reduce = __webpack_require__(127).left;
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
// `Array.prototype.reduce` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
|
||
$({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduce') }, {
|
||
reduce: function reduce(callbackfn /* , initialValue */) {
|
||
return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 274 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $reduceRight = __webpack_require__(127).right;
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
// `Array.prototype.reduceRight` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
|
||
$({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduceRight') }, {
|
||
reduceRight: function reduceRight(callbackfn /* , initialValue */) {
|
||
return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 275 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var isArray = __webpack_require__(29);
|
||
|
||
var nativeReverse = [].reverse;
|
||
var test = [1, 2];
|
||
|
||
// `Array.prototype.reverse` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.reverse
|
||
// fix for Safari 12.0 bug
|
||
// https://bugs.webkit.org/show_bug.cgi?id=188794
|
||
$({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
|
||
reverse: function reverse() {
|
||
if (isArray(this)) this.length = this.length;
|
||
return nativeReverse.call(this);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 276 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var isObject = __webpack_require__(16);
|
||
var isArray = __webpack_require__(29);
|
||
var toAbsoluteIndex = __webpack_require__(34);
|
||
var toLength = __webpack_require__(3);
|
||
var toIndexedObject = __webpack_require__(22);
|
||
var createProperty = __webpack_require__(36);
|
||
var arrayMethodHasSpeciesSupport = __webpack_require__(38);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
|
||
var SPECIES = wellKnownSymbol('species');
|
||
var nativeSlice = [].slice;
|
||
var max = Math.max;
|
||
|
||
// `Array.prototype.slice` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.slice
|
||
// fallback for not array-like ES3 strings and DOM objects
|
||
$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
|
||
slice: function slice(start, end) {
|
||
var O = toIndexedObject(this);
|
||
var length = toLength(O.length);
|
||
var k = toAbsoluteIndex(start, length);
|
||
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
||
// inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
|
||
var Constructor, result, n;
|
||
if (isArray(O)) {
|
||
Constructor = O.constructor;
|
||
// cross-realm fallback
|
||
if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
|
||
Constructor = undefined;
|
||
} else if (isObject(Constructor)) {
|
||
Constructor = Constructor[SPECIES];
|
||
if (Constructor === null) Constructor = undefined;
|
||
}
|
||
if (Constructor === Array || Constructor === undefined) {
|
||
return nativeSlice.call(O, k, fin);
|
||
}
|
||
}
|
||
result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
|
||
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
|
||
result.length = n;
|
||
return result;
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 277 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var $some = __webpack_require__(23).some;
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
// `Array.prototype.some` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.some
|
||
$({ target: 'Array', proto: true, forced: sloppyArrayMethod('some') }, {
|
||
some: function some(callbackfn /* , thisArg */) {
|
||
return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 278 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var aFunction = __webpack_require__(55);
|
||
var toObject = __webpack_require__(4);
|
||
var fails = __webpack_require__(8);
|
||
var sloppyArrayMethod = __webpack_require__(13);
|
||
|
||
var nativeSort = [].sort;
|
||
var test = [1, 2, 3];
|
||
|
||
// IE8-
|
||
var FAILS_ON_UNDEFINED = fails(function () {
|
||
test.sort(undefined);
|
||
});
|
||
// V8 bug
|
||
var FAILS_ON_NULL = fails(function () {
|
||
test.sort(null);
|
||
});
|
||
// Old WebKit
|
||
var SLOPPY_METHOD = sloppyArrayMethod('sort');
|
||
|
||
var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD;
|
||
|
||
// `Array.prototype.sort` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.sort
|
||
$({ target: 'Array', proto: true, forced: FORCED }, {
|
||
sort: function sort(comparefn) {
|
||
return comparefn === undefined
|
||
? nativeSort.call(toObject(this))
|
||
: nativeSort.call(toObject(this), aFunction(comparefn));
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 279 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var setSpecies = __webpack_require__(280);
|
||
|
||
// `Array[@@species]` getter
|
||
// https://tc39.github.io/ecma262/#sec-get-array-@@species
|
||
setSpecies('Array');
|
||
|
||
|
||
/***/ }),
|
||
/* 280 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var getBuiltIn = __webpack_require__(81);
|
||
var definePropertyModule = __webpack_require__(15);
|
||
var wellKnownSymbol = __webpack_require__(5);
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
|
||
var SPECIES = wellKnownSymbol('species');
|
||
|
||
module.exports = function (CONSTRUCTOR_NAME) {
|
||
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
||
var defineProperty = definePropertyModule.f;
|
||
|
||
if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
|
||
defineProperty(Constructor, SPECIES, {
|
||
configurable: true,
|
||
get: function () { return this; }
|
||
});
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 281 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var $ = __webpack_require__(0);
|
||
var toAbsoluteIndex = __webpack_require__(34);
|
||
var toInteger = __webpack_require__(27);
|
||
var toLength = __webpack_require__(3);
|
||
var toObject = __webpack_require__(4);
|
||
var arraySpeciesCreate = __webpack_require__(37);
|
||
var createProperty = __webpack_require__(36);
|
||
var arrayMethodHasSpeciesSupport = __webpack_require__(38);
|
||
|
||
var max = Math.max;
|
||
var min = Math.min;
|
||
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
||
var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
|
||
|
||
// `Array.prototype.splice` method
|
||
// https://tc39.github.io/ecma262/#sec-array.prototype.splice
|
||
// with adding support of @@species
|
||
$({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, {
|
||
splice: function splice(start, deleteCount /* , ...items */) {
|
||
var O = toObject(this);
|
||
var len = toLength(O.length);
|
||
var actualStart = toAbsoluteIndex(start, len);
|
||
var argumentsLength = arguments.length;
|
||
var insertCount, actualDeleteCount, A, k, from, to;
|
||
if (argumentsLength === 0) {
|
||
insertCount = actualDeleteCount = 0;
|
||
} else if (argumentsLength === 1) {
|
||
insertCount = 0;
|
||
actualDeleteCount = len - actualStart;
|
||
} else {
|
||
insertCount = argumentsLength - 2;
|
||
actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
|
||
}
|
||
if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
|
||
throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
|
||
}
|
||
A = arraySpeciesCreate(O, actualDeleteCount);
|
||
for (k = 0; k < actualDeleteCount; k++) {
|
||
from = actualStart + k;
|
||
if (from in O) createProperty(A, k, O[from]);
|
||
}
|
||
A.length = actualDeleteCount;
|
||
if (insertCount < actualDeleteCount) {
|
||
for (k = actualStart; k < len - actualDeleteCount; k++) {
|
||
from = k + actualDeleteCount;
|
||
to = k + insertCount;
|
||
if (from in O) O[to] = O[from];
|
||
else delete O[to];
|
||
}
|
||
for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
|
||
} else if (insertCount > actualDeleteCount) {
|
||
for (k = len - actualDeleteCount; k > actualStart; k--) {
|
||
from = k + actualDeleteCount - 1;
|
||
to = k + insertCount - 1;
|
||
if (from in O) O[to] = O[from];
|
||
else delete O[to];
|
||
}
|
||
}
|
||
for (k = 0; k < insertCount; k++) {
|
||
O[k + actualStart] = arguments[k + 2];
|
||
}
|
||
O.length = len - actualDeleteCount + insertCount;
|
||
return A;
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 282 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
// this method was added to unscopables after implementation
|
||
// in popular engines, so it's moved to a separate module
|
||
var addToUnscopables = __webpack_require__(11);
|
||
|
||
addToUnscopables('flat');
|
||
|
||
|
||
/***/ }),
|
||
/* 283 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
// this method was added to unscopables after implementation
|
||
// in popular engines, so it's moved to a separate module
|
||
var addToUnscopables = __webpack_require__(11);
|
||
|
||
addToUnscopables('flatMap');
|
||
|
||
|
||
/***/ }),
|
||
/* 284 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
var addToUnscopables = __webpack_require__(11);
|
||
var toObject = __webpack_require__(4);
|
||
var toLength = __webpack_require__(3);
|
||
var defineProperty = __webpack_require__(15).f;
|
||
|
||
// `Array.prototype.lastIndex` accessor
|
||
// https://github.com/keithamus/proposal-array-last
|
||
if (DESCRIPTORS && !('lastItem' in [])) {
|
||
defineProperty(Array.prototype, 'lastItem', {
|
||
configurable: true,
|
||
get: function lastItem() {
|
||
var O = toObject(this);
|
||
var len = toLength(O.length);
|
||
return len == 0 ? undefined : O[len - 1];
|
||
},
|
||
set: function lastItem(value) {
|
||
var O = toObject(this);
|
||
var len = toLength(O.length);
|
||
return O[len == 0 ? 0 : len - 1] = value;
|
||
}
|
||
});
|
||
|
||
addToUnscopables('lastItem');
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
/* 285 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var DESCRIPTORS = __webpack_require__(14);
|
||
var addToUnscopables = __webpack_require__(11);
|
||
var toObject = __webpack_require__(4);
|
||
var toLength = __webpack_require__(3);
|
||
var defineProperty = __webpack_require__(15).f;
|
||
|
||
// `Array.prototype.lastIndex` getter
|
||
// https://github.com/keithamus/proposal-array-last
|
||
if (DESCRIPTORS && !('lastIndex' in [])) {
|
||
defineProperty(Array.prototype, 'lastIndex', {
|
||
configurable: true,
|
||
get: function lastIndex() {
|
||
var O = toObject(this);
|
||
var len = toLength(O.length);
|
||
return len == 0 ? 0 : len - 1;
|
||
}
|
||
});
|
||
|
||
addToUnscopables('lastIndex');
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
/* 286 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var __WEBPACK_AMD_DEFINE_RESULT__;(typeof navigator !== "undefined") && (function(root, factory) {
|
||
if (true) {
|
||
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
|
||
return factory(root);
|
||
}).call(exports, __webpack_require__, exports, module),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||
} else {}
|
||
}((window || {}), function(window) {
|
||
/* global locationHref:writable, animationManager, subframeEnabled:writable, defaultCurveSegments:writable, roundValues,
|
||
expressionsPlugin:writable, PropertyFactory, ShapePropertyFactory, Matrix, idPrefix:writable */
|
||
/* exported locationHref, subframeEnabled, expressionsPlugin, idPrefix */
|
||
|
||
'use strict';
|
||
|
||
/* exported svgNS, locationHref, initialDefaultFrame */
|
||
|
||
var svgNS = 'http://www.w3.org/2000/svg';
|
||
|
||
var locationHref = '';
|
||
|
||
var initialDefaultFrame = -999999;
|
||
|
||
/* global createSizedArray */
|
||
/* exported subframeEnabled, expressionsPlugin, isSafari, cachedColors, bmPow, bmSqrt, bmFloor, bmMax, bmMin, ProjectInterface,
|
||
defaultCurveSegments, degToRads, roundCorner, bmRnd, styleDiv, BMEnterFrameEvent, BMCompleteEvent, BMCompleteLoopEvent,
|
||
BMSegmentStartEvent, BMDestroyEvent, BMRenderFrameErrorEvent, BMConfigErrorEvent, BMAnimationConfigErrorEvent, createElementID,
|
||
addSaturationToRGB, addBrightnessToRGB, addHueToRGB, rgbToHex */
|
||
|
||
var subframeEnabled = true;
|
||
var idPrefix = '';
|
||
var expressionsPlugin;
|
||
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||
var cachedColors = {};
|
||
var bmRnd;
|
||
var bmPow = Math.pow;
|
||
var bmSqrt = Math.sqrt;
|
||
var bmFloor = Math.floor;
|
||
var bmMax = Math.max;
|
||
var bmMin = Math.min;
|
||
|
||
var BMMath = {};
|
||
(function () {
|
||
var propertyNames = ['abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'atan2', 'ceil', 'cbrt', 'expm1', 'clz32', 'cos', 'cosh', 'exp', 'floor', 'fround', 'hypot', 'imul', 'log', 'log1p', 'log2', 'log10', 'max', 'min', 'pow', 'random', 'round', 'sign', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2'];
|
||
var i;
|
||
var len = propertyNames.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
BMMath[propertyNames[i]] = Math[propertyNames[i]];
|
||
}
|
||
}());
|
||
|
||
function ProjectInterface() { return {}; }
|
||
|
||
BMMath.random = Math.random;
|
||
BMMath.abs = function (val) {
|
||
var tOfVal = typeof val;
|
||
if (tOfVal === 'object' && val.length) {
|
||
var absArr = createSizedArray(val.length);
|
||
var i;
|
||
var len = val.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
absArr[i] = Math.abs(val[i]);
|
||
}
|
||
return absArr;
|
||
}
|
||
return Math.abs(val);
|
||
};
|
||
var defaultCurveSegments = 150;
|
||
var degToRads = Math.PI / 180;
|
||
var roundCorner = 0.5519;
|
||
|
||
function roundValues(flag) {
|
||
if (flag) {
|
||
bmRnd = Math.round;
|
||
} else {
|
||
bmRnd = function (val) {
|
||
return val;
|
||
};
|
||
}
|
||
}
|
||
roundValues(false);
|
||
|
||
function styleDiv(element) {
|
||
element.style.position = 'absolute';
|
||
element.style.top = 0;
|
||
element.style.left = 0;
|
||
element.style.display = 'block';
|
||
element.style.transformOrigin = '0 0';
|
||
element.style.webkitTransformOrigin = '0 0';
|
||
element.style.backfaceVisibility = 'visible';
|
||
element.style.webkitBackfaceVisibility = 'visible';
|
||
element.style.transformStyle = 'preserve-3d';
|
||
element.style.webkitTransformStyle = 'preserve-3d';
|
||
element.style.mozTransformStyle = 'preserve-3d';
|
||
}
|
||
|
||
function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {
|
||
this.type = type;
|
||
this.currentTime = currentTime;
|
||
this.totalTime = totalTime;
|
||
this.direction = frameMultiplier < 0 ? -1 : 1;
|
||
}
|
||
|
||
function BMCompleteEvent(type, frameMultiplier) {
|
||
this.type = type;
|
||
this.direction = frameMultiplier < 0 ? -1 : 1;
|
||
}
|
||
|
||
function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {
|
||
this.type = type;
|
||
this.currentLoop = currentLoop;
|
||
this.totalLoops = totalLoops;
|
||
this.direction = frameMultiplier < 0 ? -1 : 1;
|
||
}
|
||
|
||
function BMSegmentStartEvent(type, firstFrame, totalFrames) {
|
||
this.type = type;
|
||
this.firstFrame = firstFrame;
|
||
this.totalFrames = totalFrames;
|
||
}
|
||
|
||
function BMDestroyEvent(type, target) {
|
||
this.type = type;
|
||
this.target = target;
|
||
}
|
||
|
||
function BMRenderFrameErrorEvent(nativeError, currentTime) {
|
||
this.type = 'renderFrameError';
|
||
this.nativeError = nativeError;
|
||
this.currentTime = currentTime;
|
||
}
|
||
|
||
function BMConfigErrorEvent(nativeError) {
|
||
this.type = 'configError';
|
||
this.nativeError = nativeError;
|
||
}
|
||
|
||
function BMAnimationConfigErrorEvent(type, nativeError) {
|
||
this.type = type;
|
||
this.nativeError = nativeError;
|
||
}
|
||
|
||
var createElementID = (function () {
|
||
var _count = 0;
|
||
return function createID() {
|
||
_count += 1;
|
||
return idPrefix + '__lottie_element_' + _count;
|
||
};
|
||
}());
|
||
|
||
function HSVtoRGB(h, s, v) {
|
||
var r;
|
||
var g;
|
||
var b;
|
||
var i;
|
||
var f;
|
||
var p;
|
||
var q;
|
||
var t;
|
||
i = Math.floor(h * 6);
|
||
f = h * 6 - i;
|
||
p = v * (1 - s);
|
||
q = v * (1 - f * s);
|
||
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;
|
||
default: break;
|
||
}
|
||
return [r,
|
||
g,
|
||
b];
|
||
}
|
||
|
||
function RGBtoHSV(r, g, b) {
|
||
var max = Math.max(r, g, b);
|
||
var min = Math.min(r, g, b);
|
||
var d = max - min;
|
||
var h;
|
||
var s = (max === 0 ? 0 : d / max);
|
||
var v = max / 255;
|
||
|
||
switch (max) {
|
||
case min: h = 0; break;
|
||
case r: h = (g - b) + d * (g < b ? 6 : 0); h /= 6 * d; break;
|
||
case g: h = (b - r) + d * 2; h /= 6 * d; break;
|
||
case b: h = (r - g) + d * 4; h /= 6 * d; break;
|
||
default: break;
|
||
}
|
||
|
||
return [
|
||
h,
|
||
s,
|
||
v,
|
||
];
|
||
}
|
||
|
||
function addSaturationToRGB(color, offset) {
|
||
var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
|
||
hsv[1] += offset;
|
||
if (hsv[1] > 1) {
|
||
hsv[1] = 1;
|
||
} else if (hsv[1] <= 0) {
|
||
hsv[1] = 0;
|
||
}
|
||
return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
|
||
}
|
||
|
||
function addBrightnessToRGB(color, offset) {
|
||
var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
|
||
hsv[2] += offset;
|
||
if (hsv[2] > 1) {
|
||
hsv[2] = 1;
|
||
} else if (hsv[2] < 0) {
|
||
hsv[2] = 0;
|
||
}
|
||
return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
|
||
}
|
||
|
||
function addHueToRGB(color, offset) {
|
||
var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
|
||
hsv[0] += offset / 360;
|
||
if (hsv[0] > 1) {
|
||
hsv[0] -= 1;
|
||
} else if (hsv[0] < 0) {
|
||
hsv[0] += 1;
|
||
}
|
||
return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
|
||
}
|
||
|
||
var rgbToHex = (function () {
|
||
var colorMap = [];
|
||
var i;
|
||
var hex;
|
||
for (i = 0; i < 256; i += 1) {
|
||
hex = i.toString(16);
|
||
colorMap[i] = hex.length === 1 ? '0' + hex : hex;
|
||
}
|
||
|
||
return function (r, g, b) {
|
||
if (r < 0) {
|
||
r = 0;
|
||
}
|
||
if (g < 0) {
|
||
g = 0;
|
||
}
|
||
if (b < 0) {
|
||
b = 0;
|
||
}
|
||
return '#' + colorMap[r] + colorMap[g] + colorMap[b];
|
||
};
|
||
}());
|
||
|
||
function BaseEvent() {}
|
||
BaseEvent.prototype = {
|
||
triggerEvent: function (eventName, args) {
|
||
if (this._cbs[eventName]) {
|
||
var callbacks = this._cbs[eventName];
|
||
for (var i = 0; i < callbacks.length; i += 1) {
|
||
callbacks[i](args);
|
||
}
|
||
}
|
||
},
|
||
addEventListener: function (eventName, callback) {
|
||
if (!this._cbs[eventName]) {
|
||
this._cbs[eventName] = [];
|
||
}
|
||
this._cbs[eventName].push(callback);
|
||
|
||
return function () {
|
||
this.removeEventListener(eventName, callback);
|
||
}.bind(this);
|
||
},
|
||
removeEventListener: function (eventName, callback) {
|
||
if (!callback) {
|
||
this._cbs[eventName] = null;
|
||
} else if (this._cbs[eventName]) {
|
||
var i = 0;
|
||
var len = this._cbs[eventName].length;
|
||
while (i < len) {
|
||
if (this._cbs[eventName][i] === callback) {
|
||
this._cbs[eventName].splice(i, 1);
|
||
i -= 1;
|
||
len -= 1;
|
||
}
|
||
i += 1;
|
||
}
|
||
if (!this._cbs[eventName].length) {
|
||
this._cbs[eventName] = null;
|
||
}
|
||
}
|
||
},
|
||
};
|
||
|
||
/* exported createTypedArray, createSizedArray */
|
||
|
||
var createTypedArray = (function () {
|
||
function createRegularArray(type, len) {
|
||
var i = 0;
|
||
var arr = [];
|
||
var value;
|
||
switch (type) {
|
||
case 'int16':
|
||
case 'uint8c':
|
||
value = 1;
|
||
break;
|
||
default:
|
||
value = 1.1;
|
||
break;
|
||
}
|
||
for (i = 0; i < len; i += 1) {
|
||
arr.push(value);
|
||
}
|
||
return arr;
|
||
}
|
||
function createTypedArrayFactory(type, len) {
|
||
if (type === 'float32') {
|
||
return new Float32Array(len);
|
||
} if (type === 'int16') {
|
||
return new Int16Array(len);
|
||
} if (type === 'uint8c') {
|
||
return new Uint8ClampedArray(len);
|
||
}
|
||
return createRegularArray(type, len);
|
||
}
|
||
if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {
|
||
return createTypedArrayFactory;
|
||
}
|
||
return createRegularArray;
|
||
}());
|
||
|
||
function createSizedArray(len) {
|
||
return Array.apply(null, { length: len });
|
||
}
|
||
|
||
/* global svgNS */
|
||
/* exported createNS */
|
||
|
||
function createNS(type) {
|
||
// return {appendChild:function(){},setAttribute:function(){},style:{}}
|
||
return document.createElementNS(svgNS, type);
|
||
}
|
||
|
||
/* exported createTag */
|
||
|
||
function createTag(type) {
|
||
// return {appendChild:function(){},setAttribute:function(){},style:{}}
|
||
return document.createElement(type);
|
||
}
|
||
|
||
function DynamicPropertyContainer() {}
|
||
DynamicPropertyContainer.prototype = {
|
||
addDynamicProperty: function (prop) {
|
||
if (this.dynamicProperties.indexOf(prop) === -1) {
|
||
this.dynamicProperties.push(prop);
|
||
this.container.addDynamicProperty(this);
|
||
this._isAnimated = true;
|
||
}
|
||
},
|
||
iterateDynamicProperties: function () {
|
||
this._mdf = false;
|
||
var i;
|
||
var len = this.dynamicProperties.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.dynamicProperties[i].getValue();
|
||
if (this.dynamicProperties[i]._mdf) {
|
||
this._mdf = true;
|
||
}
|
||
}
|
||
},
|
||
initDynamicPropertyContainer: function (container) {
|
||
this.container = container;
|
||
this.dynamicProperties = [];
|
||
this._mdf = false;
|
||
this._isAnimated = false;
|
||
},
|
||
};
|
||
|
||
/* exported getBlendMode */
|
||
|
||
var getBlendMode = (function () {
|
||
var blendModeEnums = {
|
||
0: 'source-over',
|
||
1: 'multiply',
|
||
2: 'screen',
|
||
3: 'overlay',
|
||
4: 'darken',
|
||
5: 'lighten',
|
||
6: 'color-dodge',
|
||
7: 'color-burn',
|
||
8: 'hard-light',
|
||
9: 'soft-light',
|
||
10: 'difference',
|
||
11: 'exclusion',
|
||
12: 'hue',
|
||
13: 'saturation',
|
||
14: 'color',
|
||
15: 'luminosity',
|
||
};
|
||
|
||
return function (mode) {
|
||
return blendModeEnums[mode] || '';
|
||
};
|
||
}());
|
||
|
||
/* exported lineCapEnum, lineJoinEnum */
|
||
|
||
var lineCapEnum = {
|
||
1: 'butt',
|
||
2: 'round',
|
||
3: 'square',
|
||
};
|
||
|
||
var lineJoinEnum = {
|
||
1: 'miter',
|
||
2: 'round',
|
||
3: 'bevel',
|
||
};
|
||
|
||
/* global createTypedArray */
|
||
|
||
/*!
|
||
Transformation Matrix v2.0
|
||
(c) Epistemex 2014-2015
|
||
www.epistemex.com
|
||
By Ken Fyrstenberg
|
||
Contributions by leeoniya.
|
||
License: MIT, header required.
|
||
*/
|
||
|
||
/**
|
||
* 2D transformation matrix object initialized with identity matrix.
|
||
*
|
||
* The matrix can synchronize a canvas context by supplying the context
|
||
* as an argument, or later apply current absolute transform to an
|
||
* existing context.
|
||
*
|
||
* All values are handled as floating point values.
|
||
*
|
||
* @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix
|
||
* @prop {number} a - scale x
|
||
* @prop {number} b - shear y
|
||
* @prop {number} c - shear x
|
||
* @prop {number} d - scale y
|
||
* @prop {number} e - translate x
|
||
* @prop {number} f - translate y
|
||
* @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context
|
||
* @constructor
|
||
*/
|
||
|
||
var Matrix = (function () {
|
||
var _cos = Math.cos;
|
||
var _sin = Math.sin;
|
||
var _tan = Math.tan;
|
||
var _rnd = Math.round;
|
||
|
||
function reset() {
|
||
this.props[0] = 1;
|
||
this.props[1] = 0;
|
||
this.props[2] = 0;
|
||
this.props[3] = 0;
|
||
this.props[4] = 0;
|
||
this.props[5] = 1;
|
||
this.props[6] = 0;
|
||
this.props[7] = 0;
|
||
this.props[8] = 0;
|
||
this.props[9] = 0;
|
||
this.props[10] = 1;
|
||
this.props[11] = 0;
|
||
this.props[12] = 0;
|
||
this.props[13] = 0;
|
||
this.props[14] = 0;
|
||
this.props[15] = 1;
|
||
return this;
|
||
}
|
||
|
||
function rotate(angle) {
|
||
if (angle === 0) {
|
||
return this;
|
||
}
|
||
var mCos = _cos(angle);
|
||
var mSin = _sin(angle);
|
||
return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||
}
|
||
|
||
function rotateX(angle) {
|
||
if (angle === 0) {
|
||
return this;
|
||
}
|
||
var mCos = _cos(angle);
|
||
var mSin = _sin(angle);
|
||
return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);
|
||
}
|
||
|
||
function rotateY(angle) {
|
||
if (angle === 0) {
|
||
return this;
|
||
}
|
||
var mCos = _cos(angle);
|
||
var mSin = _sin(angle);
|
||
return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);
|
||
}
|
||
|
||
function rotateZ(angle) {
|
||
if (angle === 0) {
|
||
return this;
|
||
}
|
||
var mCos = _cos(angle);
|
||
var mSin = _sin(angle);
|
||
return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||
}
|
||
|
||
function shear(sx, sy) {
|
||
return this._t(1, sy, sx, 1, 0, 0);
|
||
}
|
||
|
||
function skew(ax, ay) {
|
||
return this.shear(_tan(ax), _tan(ay));
|
||
}
|
||
|
||
function skewFromAxis(ax, angle) {
|
||
var mCos = _cos(angle);
|
||
var mSin = _sin(angle);
|
||
return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
|
||
._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
|
||
._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||
// return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);
|
||
}
|
||
|
||
function scale(sx, sy, sz) {
|
||
if (!sz && sz !== 0) {
|
||
sz = 1;
|
||
}
|
||
if (sx === 1 && sy === 1 && sz === 1) {
|
||
return this;
|
||
}
|
||
return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);
|
||
}
|
||
|
||
function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
|
||
this.props[0] = a;
|
||
this.props[1] = b;
|
||
this.props[2] = c;
|
||
this.props[3] = d;
|
||
this.props[4] = e;
|
||
this.props[5] = f;
|
||
this.props[6] = g;
|
||
this.props[7] = h;
|
||
this.props[8] = i;
|
||
this.props[9] = j;
|
||
this.props[10] = k;
|
||
this.props[11] = l;
|
||
this.props[12] = m;
|
||
this.props[13] = n;
|
||
this.props[14] = o;
|
||
this.props[15] = p;
|
||
return this;
|
||
}
|
||
|
||
function translate(tx, ty, tz) {
|
||
tz = tz || 0;
|
||
if (tx !== 0 || ty !== 0 || tz !== 0) {
|
||
return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1);
|
||
}
|
||
return this;
|
||
}
|
||
|
||
function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {
|
||
var _p = this.props;
|
||
|
||
if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) {
|
||
// NOTE: commenting this condition because TurboFan deoptimizes code when present
|
||
// if(m2 !== 0 || n2 !== 0 || o2 !== 0){
|
||
_p[12] = _p[12] * a2 + _p[15] * m2;
|
||
_p[13] = _p[13] * f2 + _p[15] * n2;
|
||
_p[14] = _p[14] * k2 + _p[15] * o2;
|
||
_p[15] *= p2;
|
||
// }
|
||
this._identityCalculated = false;
|
||
return this;
|
||
}
|
||
|
||
var a1 = _p[0];
|
||
var b1 = _p[1];
|
||
var c1 = _p[2];
|
||
var d1 = _p[3];
|
||
var e1 = _p[4];
|
||
var f1 = _p[5];
|
||
var g1 = _p[6];
|
||
var h1 = _p[7];
|
||
var i1 = _p[8];
|
||
var j1 = _p[9];
|
||
var k1 = _p[10];
|
||
var l1 = _p[11];
|
||
var m1 = _p[12];
|
||
var n1 = _p[13];
|
||
var o1 = _p[14];
|
||
var p1 = _p[15];
|
||
|
||
/* matrix order (canvas compatible):
|
||
* ace
|
||
* bdf
|
||
* 001
|
||
*/
|
||
_p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;
|
||
_p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2;
|
||
_p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2;
|
||
_p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2;
|
||
|
||
_p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2;
|
||
_p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2;
|
||
_p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2;
|
||
_p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2;
|
||
|
||
_p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2;
|
||
_p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2;
|
||
_p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2;
|
||
_p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2;
|
||
|
||
_p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2;
|
||
_p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2;
|
||
_p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2;
|
||
_p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2;
|
||
|
||
this._identityCalculated = false;
|
||
return this;
|
||
}
|
||
|
||
function isIdentity() {
|
||
if (!this._identityCalculated) {
|
||
this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1);
|
||
this._identityCalculated = true;
|
||
}
|
||
return this._identity;
|
||
}
|
||
|
||
function equals(matr) {
|
||
var i = 0;
|
||
while (i < 16) {
|
||
if (matr.props[i] !== this.props[i]) {
|
||
return false;
|
||
}
|
||
i += 1;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function clone(matr) {
|
||
var i;
|
||
for (i = 0; i < 16; i += 1) {
|
||
matr.props[i] = this.props[i];
|
||
}
|
||
return matr;
|
||
}
|
||
|
||
function cloneFromProps(props) {
|
||
var i;
|
||
for (i = 0; i < 16; i += 1) {
|
||
this.props[i] = props[i];
|
||
}
|
||
}
|
||
|
||
function applyToPoint(x, y, z) {
|
||
return {
|
||
x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
|
||
y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
|
||
z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],
|
||
};
|
||
/* return {
|
||
x: x * me.a + y * me.c + me.e,
|
||
y: x * me.b + y * me.d + me.f
|
||
}; */
|
||
}
|
||
function applyToX(x, y, z) {
|
||
return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];
|
||
}
|
||
function applyToY(x, y, z) {
|
||
return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];
|
||
}
|
||
function applyToZ(x, y, z) {
|
||
return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];
|
||
}
|
||
|
||
function getInverseMatrix() {
|
||
var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];
|
||
var a = this.props[5] / determinant;
|
||
var b = -this.props[1] / determinant;
|
||
var c = -this.props[4] / determinant;
|
||
var d = this.props[0] / determinant;
|
||
var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant;
|
||
var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant;
|
||
var inverseMatrix = new Matrix();
|
||
inverseMatrix.props[0] = a;
|
||
inverseMatrix.props[1] = b;
|
||
inverseMatrix.props[4] = c;
|
||
inverseMatrix.props[5] = d;
|
||
inverseMatrix.props[12] = e;
|
||
inverseMatrix.props[13] = f;
|
||
return inverseMatrix;
|
||
}
|
||
|
||
function inversePoint(pt) {
|
||
var inverseMatrix = this.getInverseMatrix();
|
||
return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0);
|
||
}
|
||
|
||
function inversePoints(pts) {
|
||
var i;
|
||
var len = pts.length;
|
||
var retPts = [];
|
||
for (i = 0; i < len; i += 1) {
|
||
retPts[i] = inversePoint(pts[i]);
|
||
}
|
||
return retPts;
|
||
}
|
||
|
||
function applyToTriplePoints(pt1, pt2, pt3) {
|
||
var arr = createTypedArray('float32', 6);
|
||
if (this.isIdentity()) {
|
||
arr[0] = pt1[0];
|
||
arr[1] = pt1[1];
|
||
arr[2] = pt2[0];
|
||
arr[3] = pt2[1];
|
||
arr[4] = pt3[0];
|
||
arr[5] = pt3[1];
|
||
} else {
|
||
var p0 = this.props[0];
|
||
var p1 = this.props[1];
|
||
var p4 = this.props[4];
|
||
var p5 = this.props[5];
|
||
var p12 = this.props[12];
|
||
var p13 = this.props[13];
|
||
arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;
|
||
arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;
|
||
arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;
|
||
arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;
|
||
arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;
|
||
arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;
|
||
}
|
||
return arr;
|
||
}
|
||
|
||
function applyToPointArray(x, y, z) {
|
||
var arr;
|
||
if (this.isIdentity()) {
|
||
arr = [x, y, z];
|
||
} else {
|
||
arr = [
|
||
x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
|
||
x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
|
||
x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],
|
||
];
|
||
}
|
||
return arr;
|
||
}
|
||
|
||
function applyToPointStringified(x, y) {
|
||
if (this.isIdentity()) {
|
||
return x + ',' + y;
|
||
}
|
||
var _p = this.props;
|
||
return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;
|
||
}
|
||
|
||
function toCSS() {
|
||
// Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
|
||
/* if(this.isIdentity()) {
|
||
return '';
|
||
} */
|
||
var i = 0;
|
||
var props = this.props;
|
||
var cssValue = 'matrix3d(';
|
||
var v = 10000;
|
||
while (i < 16) {
|
||
cssValue += _rnd(props[i] * v) / v;
|
||
cssValue += i === 15 ? ')' : ',';
|
||
i += 1;
|
||
}
|
||
return cssValue;
|
||
}
|
||
|
||
function roundMatrixProperty(val) {
|
||
var v = 10000;
|
||
if ((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {
|
||
return _rnd(val * v) / v;
|
||
}
|
||
return val;
|
||
}
|
||
|
||
function to2dCSS() {
|
||
// Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
|
||
/* if(this.isIdentity()) {
|
||
return '';
|
||
} */
|
||
var props = this.props;
|
||
var _a = roundMatrixProperty(props[0]);
|
||
var _b = roundMatrixProperty(props[1]);
|
||
var _c = roundMatrixProperty(props[4]);
|
||
var _d = roundMatrixProperty(props[5]);
|
||
var _e = roundMatrixProperty(props[12]);
|
||
var _f = roundMatrixProperty(props[13]);
|
||
return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')';
|
||
}
|
||
|
||
return function () {
|
||
this.reset = reset;
|
||
this.rotate = rotate;
|
||
this.rotateX = rotateX;
|
||
this.rotateY = rotateY;
|
||
this.rotateZ = rotateZ;
|
||
this.skew = skew;
|
||
this.skewFromAxis = skewFromAxis;
|
||
this.shear = shear;
|
||
this.scale = scale;
|
||
this.setTransform = setTransform;
|
||
this.translate = translate;
|
||
this.transform = transform;
|
||
this.applyToPoint = applyToPoint;
|
||
this.applyToX = applyToX;
|
||
this.applyToY = applyToY;
|
||
this.applyToZ = applyToZ;
|
||
this.applyToPointArray = applyToPointArray;
|
||
this.applyToTriplePoints = applyToTriplePoints;
|
||
this.applyToPointStringified = applyToPointStringified;
|
||
this.toCSS = toCSS;
|
||
this.to2dCSS = to2dCSS;
|
||
this.clone = clone;
|
||
this.cloneFromProps = cloneFromProps;
|
||
this.equals = equals;
|
||
this.inversePoints = inversePoints;
|
||
this.inversePoint = inversePoint;
|
||
this.getInverseMatrix = getInverseMatrix;
|
||
this._t = this.transform;
|
||
this.isIdentity = isIdentity;
|
||
this._identity = true;
|
||
this._identityCalculated = false;
|
||
|
||
this.props = createTypedArray('float32', 16);
|
||
this.reset();
|
||
};
|
||
}());
|
||
|
||
/* eslint-disable */
|
||
/*
|
||
Copyright 2014 David Bau.
|
||
|
||
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.
|
||
|
||
*/
|
||
|
||
(function (pool, math) {
|
||
//
|
||
// The following constants are related to IEEE 754 limits.
|
||
//
|
||
var global = this,
|
||
width = 256, // each RC4 output is 0 <= x < 256
|
||
chunks = 6, // at least six RC4 outputs for each double
|
||
digits = 52, // there are 52 significant digits in a double
|
||
rngname = 'random', // rngname: name for Math.random and Math.seedrandom
|
||
startdenom = math.pow(width, chunks),
|
||
significance = math.pow(2, digits),
|
||
overflow = significance * 2,
|
||
mask = width - 1,
|
||
nodecrypto; // node.js crypto module, initialized at the bottom.
|
||
|
||
//
|
||
// seedrandom()
|
||
// This is the seedrandom function described above.
|
||
//
|
||
function seedrandom(seed, options, callback) {
|
||
var key = [];
|
||
options = (options === true) ? { entropy: true } : (options || {});
|
||
|
||
// Flatten the seed string or build one from local entropy if needed.
|
||
var shortseed = mixkey(flatten(
|
||
options.entropy ? [seed, tostring(pool)] :
|
||
(seed === null) ? autoseed() : seed, 3), key);
|
||
|
||
// Use the seed to initialize an ARC4 generator.
|
||
var arc4 = new ARC4(key);
|
||
|
||
// This function returns a random double in [0, 1) that contains
|
||
// randomness in every bit of the mantissa of the IEEE 754 value.
|
||
var prng = function() {
|
||
var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
|
||
d = startdenom, // and denominator d = 2 ^ 48.
|
||
x = 0; // and no 'extra last byte'.
|
||
while (n < significance) { // Fill up all significant digits by
|
||
n = (n + x) * width; // shifting numerator and
|
||
d *= width; // denominator and generating a
|
||
x = arc4.g(1); // new least-significant-byte.
|
||
}
|
||
while (n >= overflow) { // To avoid rounding up, before adding
|
||
n /= 2; // last byte, shift everything
|
||
d /= 2; // right using integer math until
|
||
x >>>= 1; // we have exactly the desired bits.
|
||
}
|
||
return (n + x) / d; // Form the number within [0, 1).
|
||
};
|
||
|
||
prng.int32 = function() { return arc4.g(4) | 0; };
|
||
prng.quick = function() { return arc4.g(4) / 0x100000000; };
|
||
prng.double = prng;
|
||
|
||
// Mix the randomness into accumulated entropy.
|
||
mixkey(tostring(arc4.S), pool);
|
||
|
||
// Calling convention: what to return as a function of prng, seed, is_math.
|
||
return (options.pass || callback ||
|
||
function(prng, seed, is_math_call, state) {
|
||
if (state) {
|
||
// Load the arc4 state from the given state if it has an S array.
|
||
if (state.S) { copy(state, arc4); }
|
||
// Only provide the .state method if requested via options.state.
|
||
prng.state = function() { return copy(arc4, {}); };
|
||
}
|
||
|
||
// If called as a method of Math (Math.seedrandom()), mutate
|
||
// Math.random because that is how seedrandom.js has worked since v1.0.
|
||
if (is_math_call) { math[rngname] = prng; return seed; }
|
||
|
||
// Otherwise, it is a newer calling convention, so return the
|
||
// prng directly.
|
||
else return prng;
|
||
})(
|
||
prng,
|
||
shortseed,
|
||
'global' in options ? options.global : (this == math),
|
||
options.state);
|
||
}
|
||
math['seed' + rngname] = seedrandom;
|
||
|
||
//
|
||
// ARC4
|
||
//
|
||
// An ARC4 implementation. The constructor takes a key in the form of
|
||
// an array of at most (width) integers that should be 0 <= x < (width).
|
||
//
|
||
// The g(count) method returns a pseudorandom integer that concatenates
|
||
// the next (count) outputs from ARC4. Its return value is a number x
|
||
// that is in the range 0 <= x < (width ^ count).
|
||
//
|
||
function ARC4(key) {
|
||
var t, keylen = key.length,
|
||
me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
|
||
|
||
// The empty key [] is treated as [0].
|
||
if (!keylen) { key = [keylen++]; }
|
||
|
||
// Set up S using the standard key scheduling algorithm.
|
||
while (i < width) {
|
||
s[i] = i++;
|
||
}
|
||
for (i = 0; i < width; i++) {
|
||
s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
|
||
s[j] = t;
|
||
}
|
||
|
||
// The "g" method returns the next (count) outputs as one number.
|
||
me.g = function(count) {
|
||
// Using instance members instead of closure state nearly doubles speed.
|
||
var t, r = 0,
|
||
i = me.i, j = me.j, s = me.S;
|
||
while (count--) {
|
||
t = s[i = mask & (i + 1)];
|
||
r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
|
||
}
|
||
me.i = i; me.j = j;
|
||
return r;
|
||
// For robust unpredictability, the function call below automatically
|
||
// discards an initial batch of values. This is called RC4-drop[256].
|
||
// See http://google.com/search?q=rsa+fluhrer+response&btnI
|
||
};
|
||
}
|
||
|
||
//
|
||
// copy()
|
||
// Copies internal state of ARC4 to or from a plain object.
|
||
//
|
||
function copy(f, t) {
|
||
t.i = f.i;
|
||
t.j = f.j;
|
||
t.S = f.S.slice();
|
||
return t;
|
||
}
|
||
|
||
//
|
||
// flatten()
|
||
// Converts an object tree to nested arrays of strings.
|
||
//
|
||
function flatten(obj, depth) {
|
||
var result = [], typ = (typeof obj), prop;
|
||
if (depth && typ == 'object') {
|
||
for (prop in obj) {
|
||
try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
|
||
}
|
||
}
|
||
return (result.length ? result : typ == 'string' ? obj : obj + '\0');
|
||
}
|
||
|
||
//
|
||
// mixkey()
|
||
// Mixes a string seed into a key that is an array of integers, and
|
||
// returns a shortened string seed that is equivalent to the result key.
|
||
//
|
||
function mixkey(seed, key) {
|
||
var stringseed = seed + '', smear, j = 0;
|
||
while (j < stringseed.length) {
|
||
key[mask & j] =
|
||
mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
|
||
}
|
||
return tostring(key);
|
||
}
|
||
|
||
//
|
||
// autoseed()
|
||
// Returns an object for autoseeding, using window.crypto and Node crypto
|
||
// module if available.
|
||
//
|
||
function autoseed() {
|
||
try {
|
||
if (nodecrypto) { return tostring(nodecrypto.randomBytes(width)); }
|
||
var out = new Uint8Array(width);
|
||
(global.crypto || global.msCrypto).getRandomValues(out);
|
||
return tostring(out);
|
||
} catch (e) {
|
||
var browser = global.navigator,
|
||
plugins = browser && browser.plugins;
|
||
return [+new Date(), global, plugins, global.screen, tostring(pool)];
|
||
}
|
||
}
|
||
|
||
//
|
||
// tostring()
|
||
// Converts an array of charcodes to a string
|
||
//
|
||
function tostring(a) {
|
||
return String.fromCharCode.apply(0, a);
|
||
}
|
||
|
||
//
|
||
// When seedrandom.js is loaded, we immediately mix a few bits
|
||
// from the built-in RNG into the entropy pool. Because we do
|
||
// not want to interfere with deterministic PRNG state later,
|
||
// seedrandom will not call math.random on its own again after
|
||
// initialization.
|
||
//
|
||
mixkey(math.random(), pool);
|
||
|
||
//
|
||
// Nodejs and AMD support: export the implementation as a module using
|
||
// either convention.
|
||
//
|
||
|
||
// End anonymous scope, and pass initial values.
|
||
})(
|
||
[], // pool: entropy pool starts empty
|
||
BMMath // math: package containing random, pow, and seedrandom
|
||
);
|
||
/* eslint-disable */
|
||
var BezierFactory = (function () {
|
||
/**
|
||
* BezierEasing - use bezier curve for transition easing function
|
||
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
||
*
|
||
* Credits: is based on Firefox's nsSMILKeySpline.cpp
|
||
* Usage:
|
||
* var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])
|
||
* spline.get(x) => returns the easing value | x must be in [0, 1] range
|
||
*
|
||
*/
|
||
|
||
var ob = {};
|
||
ob.getBezierEasing = getBezierEasing;
|
||
var beziers = {};
|
||
|
||
function getBezierEasing(a, b, c, d, nm) {
|
||
var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\./g, 'p');
|
||
if (beziers[str]) {
|
||
return beziers[str];
|
||
}
|
||
var bezEasing = new BezierEasing([a, b, c, d]);
|
||
beziers[str] = bezEasing;
|
||
return bezEasing;
|
||
}
|
||
|
||
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
||
var NEWTON_ITERATIONS = 4;
|
||
var NEWTON_MIN_SLOPE = 0.001;
|
||
var SUBDIVISION_PRECISION = 0.0000001;
|
||
var SUBDIVISION_MAX_ITERATIONS = 10;
|
||
|
||
var kSplineTableSize = 11;
|
||
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
||
|
||
var float32ArraySupported = typeof Float32Array === 'function';
|
||
|
||
function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }
|
||
function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }
|
||
function C(aA1) { return 3.0 * aA1; }
|
||
|
||
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
||
function calcBezier(aT, aA1, aA2) {
|
||
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
||
}
|
||
|
||
// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
||
function getSlope(aT, aA1, aA2) {
|
||
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
||
}
|
||
|
||
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
||
var currentX,
|
||
currentT,
|
||
i = 0;
|
||
do {
|
||
currentT = aA + (aB - aA) / 2.0;
|
||
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
||
if (currentX > 0.0) {
|
||
aB = currentT;
|
||
} else {
|
||
aA = currentT;
|
||
}
|
||
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
||
return currentT;
|
||
}
|
||
|
||
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
||
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
||
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
||
if (currentSlope === 0.0) return aGuessT;
|
||
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
||
aGuessT -= currentX / currentSlope;
|
||
}
|
||
return aGuessT;
|
||
}
|
||
|
||
/**
|
||
* points is an array of [ mX1, mY1, mX2, mY2 ]
|
||
*/
|
||
function BezierEasing(points) {
|
||
this._p = points;
|
||
this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
||
this._precomputed = false;
|
||
|
||
this.get = this.get.bind(this);
|
||
}
|
||
|
||
BezierEasing.prototype = {
|
||
|
||
get: function (x) {
|
||
var mX1 = this._p[0],
|
||
mY1 = this._p[1],
|
||
mX2 = this._p[2],
|
||
mY2 = this._p[3];
|
||
if (!this._precomputed) this._precompute();
|
||
if (mX1 === mY1 && mX2 === mY2) return x; // linear
|
||
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
||
if (x === 0) return 0;
|
||
if (x === 1) return 1;
|
||
return calcBezier(this._getTForX(x), mY1, mY2);
|
||
},
|
||
|
||
// Private part
|
||
|
||
_precompute: function () {
|
||
var mX1 = this._p[0],
|
||
mY1 = this._p[1],
|
||
mX2 = this._p[2],
|
||
mY2 = this._p[3];
|
||
this._precomputed = true;
|
||
if (mX1 !== mY1 || mX2 !== mY2) { this._calcSampleValues(); }
|
||
},
|
||
|
||
_calcSampleValues: function () {
|
||
var mX1 = this._p[0],
|
||
mX2 = this._p[2];
|
||
for (var i = 0; i < kSplineTableSize; ++i) {
|
||
this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.
|
||
*/
|
||
_getTForX: function (aX) {
|
||
var mX1 = this._p[0],
|
||
mX2 = this._p[2],
|
||
mSampleValues = this._mSampleValues;
|
||
|
||
var intervalStart = 0.0;
|
||
var currentSample = 1;
|
||
var lastSample = kSplineTableSize - 1;
|
||
|
||
for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {
|
||
intervalStart += kSampleStepSize;
|
||
}
|
||
--currentSample;
|
||
|
||
// Interpolate to provide an initial guess for t
|
||
var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]);
|
||
var guessForT = intervalStart + dist * kSampleStepSize;
|
||
|
||
var initialSlope = getSlope(guessForT, mX1, mX2);
|
||
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
||
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
||
} if (initialSlope === 0.0) {
|
||
return guessForT;
|
||
}
|
||
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
||
},
|
||
};
|
||
|
||
return ob;
|
||
}());
|
||
|
||
(function () {
|
||
var lastTime = 0;
|
||
var vendors = ['ms', 'moz', 'webkit', 'o'];
|
||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { // eslint-disable-line no-plusplus
|
||
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
||
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
|
||
}
|
||
if (!window.requestAnimationFrame) {
|
||
window.requestAnimationFrame = function (callback) {
|
||
var currTime = new Date().getTime();
|
||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||
var id = setTimeout(function () {
|
||
callback(currTime + timeToCall);
|
||
},
|
||
timeToCall);
|
||
lastTime = currTime + timeToCall;
|
||
return id;
|
||
};
|
||
}
|
||
if (!window.cancelAnimationFrame) {
|
||
window.cancelAnimationFrame = function (id) {
|
||
clearTimeout(id);
|
||
};
|
||
}
|
||
}());
|
||
|
||
/* exported extendPrototype, getDescriptor, createProxyFunction */
|
||
|
||
function extendPrototype(sources, destination) {
|
||
var i;
|
||
var len = sources.length;
|
||
var sourcePrototype;
|
||
for (i = 0; i < len; i += 1) {
|
||
sourcePrototype = sources[i].prototype;
|
||
for (var attr in sourcePrototype) {
|
||
if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr)) destination.prototype[attr] = sourcePrototype[attr];
|
||
}
|
||
}
|
||
}
|
||
|
||
function getDescriptor(object, prop) {
|
||
return Object.getOwnPropertyDescriptor(object, prop);
|
||
}
|
||
|
||
function createProxyFunction(prototype) {
|
||
function ProxyFunction() {}
|
||
ProxyFunction.prototype = prototype;
|
||
return ProxyFunction;
|
||
}
|
||
|
||
/* global segmentsLengthPool, defaultCurveSegments, createSizedArray, bmPow, bmSqrt, bmFloor, createTypedArray, bezierLengthPool */
|
||
/* exported bez */
|
||
|
||
function bezFunction() {
|
||
var math = Math;
|
||
|
||
function pointOnLine2D(x1, y1, x2, y2, x3, y3) {
|
||
var det1 = (x1 * y2) + (y1 * x3) + (x2 * y3) - (x3 * y2) - (y3 * x1) - (x2 * y1);
|
||
return det1 > -0.001 && det1 < 0.001;
|
||
}
|
||
|
||
function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {
|
||
if (z1 === 0 && z2 === 0 && z3 === 0) {
|
||
return pointOnLine2D(x1, y1, x2, y2, x3, y3);
|
||
}
|
||
var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2));
|
||
var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2));
|
||
var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2));
|
||
var diffDist;
|
||
if (dist1 > dist2) {
|
||
if (dist1 > dist3) {
|
||
diffDist = dist1 - dist2 - dist3;
|
||
} else {
|
||
diffDist = dist3 - dist2 - dist1;
|
||
}
|
||
} else if (dist3 > dist2) {
|
||
diffDist = dist3 - dist2 - dist1;
|
||
} else {
|
||
diffDist = dist2 - dist1 - dist3;
|
||
}
|
||
return diffDist > -0.0001 && diffDist < 0.0001;
|
||
}
|
||
|
||
var getBezierLength = (function () {
|
||
return function (pt1, pt2, pt3, pt4) {
|
||
var curveSegments = defaultCurveSegments;
|
||
var k;
|
||
var i;
|
||
var len;
|
||
var ptCoord;
|
||
var perc;
|
||
var addedLength = 0;
|
||
var ptDistance;
|
||
var point = [];
|
||
var lastPoint = [];
|
||
var lengthData = bezierLengthPool.newElement();
|
||
len = pt3.length;
|
||
for (k = 0; k < curveSegments; k += 1) {
|
||
perc = k / (curveSegments - 1);
|
||
ptDistance = 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] + bmPow(perc, 3) * pt2[i];
|
||
point[i] = ptCoord;
|
||
if (lastPoint[i] !== null) {
|
||
ptDistance += bmPow(point[i] - lastPoint[i], 2);
|
||
}
|
||
lastPoint[i] = point[i];
|
||
}
|
||
if (ptDistance) {
|
||
ptDistance = bmSqrt(ptDistance);
|
||
addedLength += ptDistance;
|
||
}
|
||
lengthData.percents[k] = perc;
|
||
lengthData.lengths[k] = addedLength;
|
||
}
|
||
lengthData.addedLength = addedLength;
|
||
return lengthData;
|
||
};
|
||
}());
|
||
|
||
function getSegmentsLength(shapeData) {
|
||
var segmentsLength = segmentsLengthPool.newElement();
|
||
var closed = shapeData.c;
|
||
var pathV = shapeData.v;
|
||
var pathO = shapeData.o;
|
||
var pathI = shapeData.i;
|
||
var i;
|
||
var len = shapeData._length;
|
||
var lengths = segmentsLength.lengths;
|
||
var totalLength = 0;
|
||
for (i = 0; i < len - 1; i += 1) {
|
||
lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]);
|
||
totalLength += lengths[i].addedLength;
|
||
}
|
||
if (closed && len) {
|
||
lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]);
|
||
totalLength += lengths[i].addedLength;
|
||
}
|
||
segmentsLength.totalLength = totalLength;
|
||
return segmentsLength;
|
||
}
|
||
|
||
function BezierData(length) {
|
||
this.segmentLength = 0;
|
||
this.points = new Array(length);
|
||
}
|
||
|
||
function PointData(partial, point) {
|
||
this.partialLength = partial;
|
||
this.point = point;
|
||
}
|
||
|
||
var buildBezierData = (function () {
|
||
var storedData = {};
|
||
|
||
return function (pt1, pt2, pt3, pt4) {
|
||
var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\./g, 'p');
|
||
if (!storedData[bezierName]) {
|
||
var curveSegments = defaultCurveSegments;
|
||
var k;
|
||
var i;
|
||
var len;
|
||
var ptCoord;
|
||
var perc;
|
||
var addedLength = 0;
|
||
var ptDistance;
|
||
var point;
|
||
var lastPoint = null;
|
||
if (pt1.length === 2 && (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) {
|
||
curveSegments = 2;
|
||
}
|
||
var bezierData = new BezierData(curveSegments);
|
||
len = pt3.length;
|
||
for (k = 0; k < curveSegments; k += 1) {
|
||
point = createSizedArray(len);
|
||
perc = k / (curveSegments - 1);
|
||
ptDistance = 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) + bmPow(perc, 3) * pt2[i];
|
||
point[i] = ptCoord;
|
||
if (lastPoint !== null) {
|
||
ptDistance += bmPow(point[i] - lastPoint[i], 2);
|
||
}
|
||
}
|
||
ptDistance = bmSqrt(ptDistance);
|
||
addedLength += ptDistance;
|
||
bezierData.points[k] = new PointData(ptDistance, point);
|
||
lastPoint = point;
|
||
}
|
||
bezierData.segmentLength = addedLength;
|
||
storedData[bezierName] = bezierData;
|
||
}
|
||
return storedData[bezierName];
|
||
};
|
||
}());
|
||
|
||
function getDistancePerc(perc, bezierData) {
|
||
var percents = bezierData.percents;
|
||
var lengths = bezierData.lengths;
|
||
var len = percents.length;
|
||
var initPos = bmFloor((len - 1) * perc);
|
||
var lengthPos = perc * bezierData.addedLength;
|
||
var lPerc = 0;
|
||
if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {
|
||
return percents[initPos];
|
||
}
|
||
var dir = lengths[initPos] > lengthPos ? -1 : 1;
|
||
var flag = true;
|
||
while (flag) {
|
||
if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {
|
||
lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]);
|
||
flag = false;
|
||
} else {
|
||
initPos += dir;
|
||
}
|
||
if (initPos < 0 || initPos >= len - 1) {
|
||
// FIX for TypedArrays that don't store floating point values with enough accuracy
|
||
if (initPos === len - 1) {
|
||
return percents[initPos];
|
||
}
|
||
flag = false;
|
||
}
|
||
}
|
||
return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc;
|
||
}
|
||
|
||
function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {
|
||
var t1 = getDistancePerc(percent, bezierData);
|
||
var u1 = 1 - t1;
|
||
var ptX = math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000;
|
||
var ptY = math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000;
|
||
return [ptX, ptY];
|
||
}
|
||
|
||
var bezierSegmentPoints = createTypedArray('float32', 8);
|
||
|
||
function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {
|
||
if (startPerc < 0) {
|
||
startPerc = 0;
|
||
} else if (startPerc > 1) {
|
||
startPerc = 1;
|
||
}
|
||
var t0 = getDistancePerc(startPerc, bezierData);
|
||
endPerc = endPerc > 1 ? 1 : endPerc;
|
||
var t1 = getDistancePerc(endPerc, bezierData);
|
||
var i;
|
||
var len = pt1.length;
|
||
var u0 = 1 - t0;
|
||
var u1 = 1 - t1;
|
||
var u0u0u0 = u0 * u0 * u0;
|
||
var t0u0u0_3 = t0 * u0 * u0 * 3; // eslint-disable-line camelcase
|
||
var t0t0u0_3 = t0 * t0 * u0 * 3; // eslint-disable-line camelcase
|
||
var t0t0t0 = t0 * t0 * t0;
|
||
//
|
||
var u0u0u1 = u0 * u0 * u1;
|
||
var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1; // eslint-disable-line camelcase
|
||
var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1; // eslint-disable-line camelcase
|
||
var t0t0t1 = t0 * t0 * t1;
|
||
//
|
||
var u0u1u1 = u0 * u1 * u1;
|
||
var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1; // eslint-disable-line camelcase
|
||
var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1; // eslint-disable-line camelcase
|
||
var t0t1t1 = t0 * t1 * t1;
|
||
//
|
||
var u1u1u1 = u1 * u1 * u1;
|
||
var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1; // eslint-disable-line camelcase
|
||
var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1; // eslint-disable-line camelcase
|
||
var t1t1t1 = t1 * t1 * t1;
|
||
for (i = 0; i < len; i += 1) {
|
||
bezierSegmentPoints[i * 4] = math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase
|
||
bezierSegmentPoints[i * 4 + 1] = math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase
|
||
bezierSegmentPoints[i * 4 + 2] = math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase
|
||
bezierSegmentPoints[i * 4 + 3] = math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase
|
||
}
|
||
|
||
return bezierSegmentPoints;
|
||
}
|
||
|
||
return {
|
||
getSegmentsLength: getSegmentsLength,
|
||
getNewSegment: getNewSegment,
|
||
getPointInSegment: getPointInSegment,
|
||
buildBezierData: buildBezierData,
|
||
pointOnLine2D: pointOnLine2D,
|
||
pointOnLine3D: pointOnLine3D,
|
||
};
|
||
}
|
||
|
||
var bez = bezFunction();
|
||
|
||
/* exported dataManager */
|
||
|
||
function dataFunctionManager() {
|
||
// var tCanvasHelper = createTag('canvas').getContext('2d');
|
||
|
||
function completeLayers(layers, comps, fontManager) {
|
||
var layerData;
|
||
var i;
|
||
var len = layers.length;
|
||
var j;
|
||
var jLen;
|
||
var k;
|
||
var kLen;
|
||
for (i = 0; i < len; i += 1) {
|
||
layerData = layers[i];
|
||
if (('ks' in layerData) && !layerData.completed) {
|
||
layerData.completed = true;
|
||
if (layerData.tt) {
|
||
layers[i - 1].td = layerData.tt;
|
||
}
|
||
if (layerData.hasMask) {
|
||
var maskProps = layerData.masksProperties;
|
||
jLen = maskProps.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
if (maskProps[j].pt.k.i) {
|
||
convertPathsToAbsoluteValues(maskProps[j].pt.k);
|
||
} else {
|
||
kLen = maskProps[j].pt.k.length;
|
||
for (k = 0; k < kLen; k += 1) {
|
||
if (maskProps[j].pt.k[k].s) {
|
||
convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);
|
||
}
|
||
if (maskProps[j].pt.k[k].e) {
|
||
convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (layerData.ty === 0) {
|
||
layerData.layers = findCompLayers(layerData.refId, comps);
|
||
completeLayers(layerData.layers, comps, fontManager);
|
||
} else if (layerData.ty === 4) {
|
||
completeShapes(layerData.shapes);
|
||
} else if (layerData.ty === 5) {
|
||
completeText(layerData, fontManager);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function findCompLayers(id, comps) {
|
||
var i = 0;
|
||
var len = comps.length;
|
||
while (i < len) {
|
||
if (comps[i].id === id) {
|
||
if (!comps[i].layers.__used) {
|
||
comps[i].layers.__used = true;
|
||
return comps[i].layers;
|
||
}
|
||
return JSON.parse(JSON.stringify(comps[i].layers));
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
function completeShapes(arr) {
|
||
var i;
|
||
var len = arr.length;
|
||
var j;
|
||
var jLen;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (arr[i].ty === 'sh') {
|
||
if (arr[i].ks.k.i) {
|
||
convertPathsToAbsoluteValues(arr[i].ks.k);
|
||
} else {
|
||
jLen = arr[i].ks.k.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
if (arr[i].ks.k[j].s) {
|
||
convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);
|
||
}
|
||
if (arr[i].ks.k[j].e) {
|
||
convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);
|
||
}
|
||
}
|
||
}
|
||
} else if (arr[i].ty === 'gr') {
|
||
completeShapes(arr[i].it);
|
||
}
|
||
}
|
||
}
|
||
|
||
function convertPathsToAbsoluteValues(path) {
|
||
var i;
|
||
var len = path.i.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
path.i[i][0] += path.v[i][0];
|
||
path.i[i][1] += path.v[i][1];
|
||
path.o[i][0] += path.v[i][0];
|
||
path.o[i][1] += path.v[i][1];
|
||
}
|
||
}
|
||
|
||
function checkVersion(minimum, animVersionString) {
|
||
var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100];
|
||
if (minimum[0] > animVersion[0]) {
|
||
return true;
|
||
} if (animVersion[0] > minimum[0]) {
|
||
return false;
|
||
}
|
||
if (minimum[1] > animVersion[1]) {
|
||
return true;
|
||
} if (animVersion[1] > minimum[1]) {
|
||
return false;
|
||
}
|
||
if (minimum[2] > animVersion[2]) {
|
||
return true;
|
||
} if (animVersion[2] > minimum[2]) {
|
||
return false;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
var checkText = (function () {
|
||
var minimumVersion = [4, 4, 14];
|
||
|
||
function updateTextLayer(textLayer) {
|
||
var documentData = textLayer.t.d;
|
||
textLayer.t.d = {
|
||
k: [
|
||
{
|
||
s: documentData,
|
||
t: 0,
|
||
},
|
||
],
|
||
};
|
||
}
|
||
|
||
function iterateLayers(layers) {
|
||
var i;
|
||
var len = layers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (layers[i].ty === 5) {
|
||
updateTextLayer(layers[i]);
|
||
}
|
||
}
|
||
}
|
||
|
||
return function (animationData) {
|
||
if (checkVersion(minimumVersion, animationData.v)) {
|
||
iterateLayers(animationData.layers);
|
||
if (animationData.assets) {
|
||
var i;
|
||
var len = animationData.assets.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (animationData.assets[i].layers) {
|
||
iterateLayers(animationData.assets[i].layers);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
}());
|
||
|
||
var checkChars = (function () {
|
||
var minimumVersion = [4, 7, 99];
|
||
return function (animationData) {
|
||
if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {
|
||
var i;
|
||
var len = animationData.chars.length;
|
||
var j;
|
||
var jLen;
|
||
var pathData;
|
||
var paths;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (animationData.chars[i].data && animationData.chars[i].data.shapes) {
|
||
paths = animationData.chars[i].data.shapes[0].it;
|
||
jLen = paths.length;
|
||
|
||
for (j = 0; j < jLen; j += 1) {
|
||
pathData = paths[j].ks.k;
|
||
if (!pathData.__converted) {
|
||
convertPathsToAbsoluteValues(paths[j].ks.k);
|
||
pathData.__converted = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
}());
|
||
|
||
var checkColors = (function () {
|
||
var minimumVersion = [4, 1, 9];
|
||
|
||
function iterateShapes(shapes) {
|
||
var i;
|
||
var len = shapes.length;
|
||
var j;
|
||
var jLen;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (shapes[i].ty === 'gr') {
|
||
iterateShapes(shapes[i].it);
|
||
} else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {
|
||
if (shapes[i].c.k && shapes[i].c.k[0].i) {
|
||
jLen = shapes[i].c.k.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
if (shapes[i].c.k[j].s) {
|
||
shapes[i].c.k[j].s[0] /= 255;
|
||
shapes[i].c.k[j].s[1] /= 255;
|
||
shapes[i].c.k[j].s[2] /= 255;
|
||
shapes[i].c.k[j].s[3] /= 255;
|
||
}
|
||
if (shapes[i].c.k[j].e) {
|
||
shapes[i].c.k[j].e[0] /= 255;
|
||
shapes[i].c.k[j].e[1] /= 255;
|
||
shapes[i].c.k[j].e[2] /= 255;
|
||
shapes[i].c.k[j].e[3] /= 255;
|
||
}
|
||
}
|
||
} else {
|
||
shapes[i].c.k[0] /= 255;
|
||
shapes[i].c.k[1] /= 255;
|
||
shapes[i].c.k[2] /= 255;
|
||
shapes[i].c.k[3] /= 255;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function iterateLayers(layers) {
|
||
var i;
|
||
var len = layers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (layers[i].ty === 4) {
|
||
iterateShapes(layers[i].shapes);
|
||
}
|
||
}
|
||
}
|
||
|
||
return function (animationData) {
|
||
if (checkVersion(minimumVersion, animationData.v)) {
|
||
iterateLayers(animationData.layers);
|
||
if (animationData.assets) {
|
||
var i;
|
||
var len = animationData.assets.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (animationData.assets[i].layers) {
|
||
iterateLayers(animationData.assets[i].layers);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
}());
|
||
|
||
var checkShapes = (function () {
|
||
var minimumVersion = [4, 4, 18];
|
||
|
||
function completeClosingShapes(arr) {
|
||
var i;
|
||
var len = arr.length;
|
||
var j;
|
||
var jLen;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (arr[i].ty === 'sh') {
|
||
if (arr[i].ks.k.i) {
|
||
arr[i].ks.k.c = arr[i].closed;
|
||
} else {
|
||
jLen = arr[i].ks.k.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
if (arr[i].ks.k[j].s) {
|
||
arr[i].ks.k[j].s[0].c = arr[i].closed;
|
||
}
|
||
if (arr[i].ks.k[j].e) {
|
||
arr[i].ks.k[j].e[0].c = arr[i].closed;
|
||
}
|
||
}
|
||
}
|
||
} else if (arr[i].ty === 'gr') {
|
||
completeClosingShapes(arr[i].it);
|
||
}
|
||
}
|
||
}
|
||
|
||
function iterateLayers(layers) {
|
||
var layerData;
|
||
var i;
|
||
var len = layers.length;
|
||
var j;
|
||
var jLen;
|
||
var k;
|
||
var kLen;
|
||
for (i = 0; i < len; i += 1) {
|
||
layerData = layers[i];
|
||
if (layerData.hasMask) {
|
||
var maskProps = layerData.masksProperties;
|
||
jLen = maskProps.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
if (maskProps[j].pt.k.i) {
|
||
maskProps[j].pt.k.c = maskProps[j].cl;
|
||
} else {
|
||
kLen = maskProps[j].pt.k.length;
|
||
for (k = 0; k < kLen; k += 1) {
|
||
if (maskProps[j].pt.k[k].s) {
|
||
maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;
|
||
}
|
||
if (maskProps[j].pt.k[k].e) {
|
||
maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (layerData.ty === 4) {
|
||
completeClosingShapes(layerData.shapes);
|
||
}
|
||
}
|
||
}
|
||
|
||
return function (animationData) {
|
||
if (checkVersion(minimumVersion, animationData.v)) {
|
||
iterateLayers(animationData.layers);
|
||
if (animationData.assets) {
|
||
var i;
|
||
var len = animationData.assets.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (animationData.assets[i].layers) {
|
||
iterateLayers(animationData.assets[i].layers);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
}());
|
||
|
||
function completeData(animationData, fontManager) {
|
||
if (animationData.__complete) {
|
||
return;
|
||
}
|
||
checkColors(animationData);
|
||
checkText(animationData);
|
||
checkChars(animationData);
|
||
checkShapes(animationData);
|
||
completeLayers(animationData.layers, animationData.assets, fontManager);
|
||
animationData.__complete = true;
|
||
}
|
||
|
||
function completeText(data) {
|
||
if (data.t.a.length === 0 && !('m' in data.t.p)) {
|
||
data.singleShape = true;
|
||
}
|
||
}
|
||
|
||
var moduleOb = {};
|
||
moduleOb.completeData = completeData;
|
||
moduleOb.checkColors = checkColors;
|
||
moduleOb.checkChars = checkChars;
|
||
moduleOb.checkShapes = checkShapes;
|
||
moduleOb.completeLayers = completeLayers;
|
||
|
||
return moduleOb;
|
||
}
|
||
|
||
var dataManager = dataFunctionManager();
|
||
|
||
/* exported getFontProperties */
|
||
|
||
function getFontProperties(fontData) {
|
||
var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];
|
||
|
||
var fWeight = 'normal'; var
|
||
fStyle = 'normal';
|
||
var len = styles.length;
|
||
var styleName;
|
||
for (var i = 0; i < len; i += 1) {
|
||
styleName = styles[i].toLowerCase();
|
||
switch (styleName) {
|
||
case 'italic':
|
||
fStyle = 'italic';
|
||
break;
|
||
case 'bold':
|
||
fWeight = '700';
|
||
break;
|
||
case 'black':
|
||
fWeight = '900';
|
||
break;
|
||
case 'medium':
|
||
fWeight = '500';
|
||
break;
|
||
case 'regular':
|
||
case 'normal':
|
||
fWeight = '400';
|
||
break;
|
||
case 'light':
|
||
case 'thin':
|
||
fWeight = '200';
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
return {
|
||
style: fStyle,
|
||
weight: fontData.fWeight || fWeight,
|
||
};
|
||
}
|
||
|
||
/* global createNS, createTag, getFontProperties */
|
||
/* exported FontManager */
|
||
|
||
var FontManager = (function () {
|
||
var maxWaitingTime = 5000;
|
||
var emptyChar = {
|
||
w: 0,
|
||
size: 0,
|
||
shapes: [],
|
||
};
|
||
var combinedCharacters = [];
|
||
// Hindi characters
|
||
combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366,
|
||
2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379,
|
||
2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);
|
||
|
||
var surrogateModifiers = [
|
||
'd83cdffb',
|
||
'd83cdffc',
|
||
'd83cdffd',
|
||
'd83cdffe',
|
||
'd83cdfff',
|
||
];
|
||
|
||
var zeroWidthJoiner = [65039, 8205];
|
||
|
||
function trimFontOptions(font) {
|
||
var familyArray = font.split(',');
|
||
var i;
|
||
var len = familyArray.length;
|
||
var enabledFamilies = [];
|
||
for (i = 0; i < len; i += 1) {
|
||
if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {
|
||
enabledFamilies.push(familyArray[i]);
|
||
}
|
||
}
|
||
return enabledFamilies.join(',');
|
||
}
|
||
|
||
function setUpNode(font, family) {
|
||
var parentNode = createTag('span');
|
||
// Node is invisible to screen readers.
|
||
parentNode.setAttribute('aria-hidden', true);
|
||
parentNode.style.fontFamily = family;
|
||
var node = createTag('span');
|
||
// Characters that vary significantly among different fonts
|
||
node.innerText = 'giItT1WQy@!-/#';
|
||
// Visible - so we can measure it - but not on the screen
|
||
parentNode.style.position = 'absolute';
|
||
parentNode.style.left = '-10000px';
|
||
parentNode.style.top = '-10000px';
|
||
// Large font size makes even subtle changes obvious
|
||
parentNode.style.fontSize = '300px';
|
||
// Reset any font properties
|
||
parentNode.style.fontVariant = 'normal';
|
||
parentNode.style.fontStyle = 'normal';
|
||
parentNode.style.fontWeight = 'normal';
|
||
parentNode.style.letterSpacing = '0';
|
||
parentNode.appendChild(node);
|
||
document.body.appendChild(parentNode);
|
||
|
||
// Remember width with no applied web font
|
||
var width = node.offsetWidth;
|
||
node.style.fontFamily = trimFontOptions(font) + ', ' + family;
|
||
return { node: node, w: width, parent: parentNode };
|
||
}
|
||
|
||
function checkLoadedFonts() {
|
||
var i;
|
||
var len = this.fonts.length;
|
||
var node;
|
||
var w;
|
||
var loadedCount = len;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.fonts[i].loaded) {
|
||
loadedCount -= 1;
|
||
} else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {
|
||
this.fonts[i].loaded = true;
|
||
} else {
|
||
node = this.fonts[i].monoCase.node;
|
||
w = this.fonts[i].monoCase.w;
|
||
if (node.offsetWidth !== w) {
|
||
loadedCount -= 1;
|
||
this.fonts[i].loaded = true;
|
||
} else {
|
||
node = this.fonts[i].sansCase.node;
|
||
w = this.fonts[i].sansCase.w;
|
||
if (node.offsetWidth !== w) {
|
||
loadedCount -= 1;
|
||
this.fonts[i].loaded = true;
|
||
}
|
||
}
|
||
if (this.fonts[i].loaded) {
|
||
this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);
|
||
this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {
|
||
setTimeout(this.checkLoadedFontsBinded, 20);
|
||
} else {
|
||
setTimeout(this.setIsLoadedBinded, 10);
|
||
}
|
||
}
|
||
|
||
function createHelper(def, fontData) {
|
||
var tHelper = createNS('text');
|
||
tHelper.style.fontSize = '100px';
|
||
// tHelper.style.fontFamily = fontData.fFamily;
|
||
|
||
var fontProps = getFontProperties(fontData);
|
||
tHelper.setAttribute('font-family', fontData.fFamily);
|
||
tHelper.setAttribute('font-style', fontProps.style);
|
||
tHelper.setAttribute('font-weight', fontProps.weight);
|
||
tHelper.textContent = '1';
|
||
if (fontData.fClass) {
|
||
tHelper.style.fontFamily = 'inherit';
|
||
tHelper.setAttribute('class', fontData.fClass);
|
||
} else {
|
||
tHelper.style.fontFamily = fontData.fFamily;
|
||
}
|
||
def.appendChild(tHelper);
|
||
var tCanvasHelper = createTag('canvas').getContext('2d');
|
||
tCanvasHelper.font = fontData.fWeight + ' ' + fontData.fStyle + ' 100px ' + fontData.fFamily;
|
||
// tCanvasHelper.font = ' 100px '+ fontData.fFamily;
|
||
return tHelper;
|
||
}
|
||
|
||
function addFonts(fontData, defs) {
|
||
if (!fontData) {
|
||
this.isLoaded = true;
|
||
return;
|
||
}
|
||
if (this.chars) {
|
||
this.isLoaded = true;
|
||
this.fonts = fontData.list;
|
||
return;
|
||
}
|
||
|
||
var fontArr = fontData.list;
|
||
var i;
|
||
var len = fontArr.length;
|
||
var _pendingFonts = len;
|
||
for (i = 0; i < len; i += 1) {
|
||
var shouldLoadFont = true;
|
||
var loadedSelector;
|
||
var j;
|
||
fontArr[i].loaded = false;
|
||
fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace');
|
||
fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif');
|
||
if (!fontArr[i].fPath) {
|
||
fontArr[i].loaded = true;
|
||
_pendingFonts -= 1;
|
||
} else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {
|
||
loadedSelector = document.querySelectorAll('style[f-forigin="p"][f-family="' + fontArr[i].fFamily + '"], style[f-origin="3"][f-family="' + fontArr[i].fFamily + '"]');
|
||
|
||
if (loadedSelector.length > 0) {
|
||
shouldLoadFont = false;
|
||
}
|
||
|
||
if (shouldLoadFont) {
|
||
var s = createTag('style');
|
||
s.setAttribute('f-forigin', fontArr[i].fOrigin);
|
||
s.setAttribute('f-origin', fontArr[i].origin);
|
||
s.setAttribute('f-family', fontArr[i].fFamily);
|
||
s.type = 'text/css';
|
||
s.innerText = '@font-face {font-family: ' + fontArr[i].fFamily + "; font-style: normal; src: url('" + fontArr[i].fPath + "');}";
|
||
defs.appendChild(s);
|
||
}
|
||
} else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {
|
||
loadedSelector = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]');
|
||
|
||
for (j = 0; j < loadedSelector.length; j += 1) {
|
||
if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {
|
||
// Font is already loaded
|
||
shouldLoadFont = false;
|
||
}
|
||
}
|
||
|
||
if (shouldLoadFont) {
|
||
var l = createTag('link');
|
||
l.setAttribute('f-forigin', fontArr[i].fOrigin);
|
||
l.setAttribute('f-origin', fontArr[i].origin);
|
||
l.type = 'text/css';
|
||
l.rel = 'stylesheet';
|
||
l.href = fontArr[i].fPath;
|
||
document.body.appendChild(l);
|
||
}
|
||
} else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {
|
||
loadedSelector = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]');
|
||
|
||
for (j = 0; j < loadedSelector.length; j += 1) {
|
||
if (fontArr[i].fPath === loadedSelector[j].src) {
|
||
// Font is already loaded
|
||
shouldLoadFont = false;
|
||
}
|
||
}
|
||
|
||
if (shouldLoadFont) {
|
||
var sc = createTag('link');
|
||
sc.setAttribute('f-forigin', fontArr[i].fOrigin);
|
||
sc.setAttribute('f-origin', fontArr[i].origin);
|
||
sc.setAttribute('rel', 'stylesheet');
|
||
sc.setAttribute('href', fontArr[i].fPath);
|
||
defs.appendChild(sc);
|
||
}
|
||
}
|
||
fontArr[i].helper = createHelper(defs, fontArr[i]);
|
||
fontArr[i].cache = {};
|
||
this.fonts.push(fontArr[i]);
|
||
}
|
||
if (_pendingFonts === 0) {
|
||
this.isLoaded = true;
|
||
} else {
|
||
// On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.
|
||
// Adding this timeout seems to fix it
|
||
setTimeout(this.checkLoadedFonts.bind(this), 100);
|
||
}
|
||
}
|
||
|
||
function addChars(chars) {
|
||
if (!chars) {
|
||
return;
|
||
}
|
||
if (!this.chars) {
|
||
this.chars = [];
|
||
}
|
||
var i;
|
||
var len = chars.length;
|
||
var j;
|
||
var jLen = this.chars.length;
|
||
var found;
|
||
for (i = 0; i < len; i += 1) {
|
||
j = 0;
|
||
found = false;
|
||
while (j < jLen) {
|
||
if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) {
|
||
found = true;
|
||
}
|
||
j += 1;
|
||
}
|
||
if (!found) {
|
||
this.chars.push(chars[i]);
|
||
jLen += 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
function getCharData(char, style, font) {
|
||
var i = 0;
|
||
var len = this.chars.length;
|
||
while (i < len) {
|
||
if (this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font) {
|
||
return this.chars[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
if (((typeof char === 'string' && char.charCodeAt(0) !== 13) || !char)
|
||
&& console
|
||
&& console.warn // eslint-disable-line no-console
|
||
&& !this._warned
|
||
) {
|
||
this._warned = true;
|
||
console.warn('Missing character from exported characters list: ', char, style, font); // eslint-disable-line no-console
|
||
}
|
||
return emptyChar;
|
||
}
|
||
|
||
function measureText(char, fontName, size) {
|
||
var fontData = this.getFontByName(fontName);
|
||
var index = char.charCodeAt(0);
|
||
if (!fontData.cache[index + 1]) {
|
||
var tHelper = fontData.helper;
|
||
// Canvas version
|
||
// fontData.cache[index] = tHelper.measureText(char).width / 100;
|
||
// SVG version
|
||
// console.log(tHelper.getBBox().width)
|
||
if (char === ' ') {
|
||
tHelper.textContent = '|' + char + '|';
|
||
var doubleSize = tHelper.getComputedTextLength();
|
||
tHelper.textContent = '||';
|
||
var singleSize = tHelper.getComputedTextLength();
|
||
fontData.cache[index + 1] = (doubleSize - singleSize) / 100;
|
||
} else {
|
||
tHelper.textContent = char;
|
||
fontData.cache[index + 1] = (tHelper.getComputedTextLength()) / 100;
|
||
}
|
||
}
|
||
return fontData.cache[index + 1] * size;
|
||
}
|
||
|
||
function getFontByName(name) {
|
||
var i = 0;
|
||
var len = this.fonts.length;
|
||
while (i < len) {
|
||
if (this.fonts[i].fName === name) {
|
||
return this.fonts[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return this.fonts[0];
|
||
}
|
||
|
||
function isModifier(firstCharCode, secondCharCode) {
|
||
var sum = firstCharCode.toString(16) + secondCharCode.toString(16);
|
||
return surrogateModifiers.indexOf(sum) !== -1;
|
||
}
|
||
|
||
function isZeroWidthJoiner(firstCharCode, secondCharCode) {
|
||
if (!secondCharCode) {
|
||
return firstCharCode === zeroWidthJoiner[1];
|
||
}
|
||
return firstCharCode === zeroWidthJoiner[0] && secondCharCode === zeroWidthJoiner[1];
|
||
}
|
||
|
||
function isCombinedCharacter(char) {
|
||
return combinedCharacters.indexOf(char) !== -1;
|
||
}
|
||
|
||
function setIsLoaded() {
|
||
this.isLoaded = true;
|
||
}
|
||
|
||
var Font = function () {
|
||
this.fonts = [];
|
||
this.chars = null;
|
||
this.typekitLoaded = 0;
|
||
this.isLoaded = false;
|
||
this._warned = false;
|
||
this.initTime = Date.now();
|
||
this.setIsLoadedBinded = this.setIsLoaded.bind(this);
|
||
this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this);
|
||
};
|
||
Font.isModifier = isModifier;
|
||
Font.isZeroWidthJoiner = isZeroWidthJoiner;
|
||
Font.isCombinedCharacter = isCombinedCharacter;
|
||
|
||
var fontPrototype = {
|
||
addChars: addChars,
|
||
addFonts: addFonts,
|
||
getCharData: getCharData,
|
||
getFontByName: getFontByName,
|
||
measureText: measureText,
|
||
checkLoadedFonts: checkLoadedFonts,
|
||
setIsLoaded: setIsLoaded,
|
||
};
|
||
|
||
Font.prototype = fontPrototype;
|
||
|
||
return Font;
|
||
}());
|
||
|
||
/* global initialDefaultFrame, BezierFactory, degToRads, bez, createTypedArray */
|
||
/* exported PropertyFactory */
|
||
|
||
var PropertyFactory = (function () {
|
||
var initFrame = initialDefaultFrame;
|
||
var mathAbs = Math.abs;
|
||
|
||
function interpolateValue(frameNum, caching) {
|
||
var offsetTime = this.offsetTime;
|
||
var newValue;
|
||
if (this.propType === 'multidimensional') {
|
||
newValue = createTypedArray('float32', this.pv.length);
|
||
}
|
||
var iterationIndex = caching.lastIndex;
|
||
var i = iterationIndex;
|
||
var len = this.keyframes.length - 1;
|
||
var flag = true;
|
||
var keyData;
|
||
var nextKeyData;
|
||
|
||
while (flag) {
|
||
keyData = this.keyframes[i];
|
||
nextKeyData = this.keyframes[i + 1];
|
||
if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {
|
||
if (keyData.h) {
|
||
keyData = nextKeyData;
|
||
}
|
||
iterationIndex = 0;
|
||
break;
|
||
}
|
||
if ((nextKeyData.t - offsetTime) > frameNum) {
|
||
iterationIndex = i;
|
||
break;
|
||
}
|
||
if (i < len - 1) {
|
||
i += 1;
|
||
} else {
|
||
iterationIndex = 0;
|
||
flag = false;
|
||
}
|
||
}
|
||
|
||
var k;
|
||
var kLen;
|
||
var perc;
|
||
var jLen;
|
||
var j;
|
||
var fnc;
|
||
var nextKeyTime = nextKeyData.t - offsetTime;
|
||
var keyTime = keyData.t - offsetTime;
|
||
var endValue;
|
||
if (keyData.to) {
|
||
if (!keyData.bezierData) {
|
||
keyData.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);
|
||
}
|
||
var bezierData = keyData.bezierData;
|
||
if (frameNum >= nextKeyTime || frameNum < keyTime) {
|
||
var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;
|
||
kLen = bezierData.points[ind].point.length;
|
||
for (k = 0; k < kLen; k += 1) {
|
||
newValue[k] = bezierData.points[ind].point[k];
|
||
}
|
||
// caching._lastKeyframeIndex = -1;
|
||
} else {
|
||
if (keyData.__fnct) {
|
||
fnc = keyData.__fnct;
|
||
} else {
|
||
fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;
|
||
keyData.__fnct = fnc;
|
||
}
|
||
perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
|
||
var distanceInLine = bezierData.segmentLength * perc;
|
||
|
||
var segmentPerc;
|
||
var addedLength = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastAddedLength : 0;
|
||
j = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastPoint : 0;
|
||
flag = true;
|
||
jLen = bezierData.points.length;
|
||
while (flag) {
|
||
addedLength += bezierData.points[j].partialLength;
|
||
if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {
|
||
kLen = bezierData.points[j].point.length;
|
||
for (k = 0; k < kLen; k += 1) {
|
||
newValue[k] = bezierData.points[j].point[k];
|
||
}
|
||
break;
|
||
} else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {
|
||
segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;
|
||
kLen = bezierData.points[j].point.length;
|
||
for (k = 0; k < kLen; k += 1) {
|
||
newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;
|
||
}
|
||
break;
|
||
}
|
||
if (j < jLen - 1) {
|
||
j += 1;
|
||
} else {
|
||
flag = false;
|
||
}
|
||
}
|
||
caching._lastPoint = j;
|
||
caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;
|
||
caching._lastKeyframeIndex = i;
|
||
}
|
||
} else {
|
||
var outX;
|
||
var outY;
|
||
var inX;
|
||
var inY;
|
||
var keyValue;
|
||
len = keyData.s.length;
|
||
endValue = nextKeyData.s || keyData.e;
|
||
if (this.sh && keyData.h !== 1) {
|
||
if (frameNum >= nextKeyTime) {
|
||
newValue[0] = endValue[0];
|
||
newValue[1] = endValue[1];
|
||
newValue[2] = endValue[2];
|
||
} else if (frameNum <= keyTime) {
|
||
newValue[0] = keyData.s[0];
|
||
newValue[1] = keyData.s[1];
|
||
newValue[2] = keyData.s[2];
|
||
} else {
|
||
var quatStart = createQuaternion(keyData.s);
|
||
var quatEnd = createQuaternion(endValue);
|
||
var time = (frameNum - keyTime) / (nextKeyTime - keyTime);
|
||
quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));
|
||
}
|
||
} else {
|
||
for (i = 0; i < len; i += 1) {
|
||
if (keyData.h !== 1) {
|
||
if (frameNum >= nextKeyTime) {
|
||
perc = 1;
|
||
} else if (frameNum < keyTime) {
|
||
perc = 0;
|
||
} else {
|
||
if (keyData.o.x.constructor === Array) {
|
||
if (!keyData.__fnct) {
|
||
keyData.__fnct = [];
|
||
}
|
||
if (!keyData.__fnct[i]) {
|
||
outX = (typeof keyData.o.x[i] === 'undefined') ? keyData.o.x[0] : keyData.o.x[i];
|
||
outY = (typeof keyData.o.y[i] === 'undefined') ? keyData.o.y[0] : keyData.o.y[i];
|
||
inX = (typeof keyData.i.x[i] === 'undefined') ? keyData.i.x[0] : keyData.i.x[i];
|
||
inY = (typeof keyData.i.y[i] === 'undefined') ? keyData.i.y[0] : keyData.i.y[i];
|
||
fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
|
||
keyData.__fnct[i] = fnc;
|
||
} else {
|
||
fnc = keyData.__fnct[i];
|
||
}
|
||
} else if (!keyData.__fnct) {
|
||
outX = keyData.o.x;
|
||
outY = keyData.o.y;
|
||
inX = keyData.i.x;
|
||
inY = keyData.i.y;
|
||
fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
|
||
keyData.__fnct = fnc;
|
||
} else {
|
||
fnc = keyData.__fnct;
|
||
}
|
||
perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
|
||
}
|
||
}
|
||
|
||
endValue = nextKeyData.s || keyData.e;
|
||
keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;
|
||
|
||
if (this.propType === 'multidimensional') {
|
||
newValue[i] = keyValue;
|
||
} else {
|
||
newValue = keyValue;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
caching.lastIndex = iterationIndex;
|
||
return newValue;
|
||
}
|
||
|
||
// based on @Toji's https://github.com/toji/gl-matrix/
|
||
function slerp(a, b, t) {
|
||
var out = [];
|
||
var ax = a[0];
|
||
var ay = a[1];
|
||
var az = a[2];
|
||
var aw = a[3];
|
||
var bx = b[0];
|
||
var by = b[1];
|
||
var bz = b[2];
|
||
var bw = b[3];
|
||
|
||
var omega;
|
||
var cosom;
|
||
var sinom;
|
||
var scale0;
|
||
var scale1;
|
||
|
||
cosom = ax * bx + ay * by + az * bz + aw * bw;
|
||
if (cosom < 0.0) {
|
||
cosom = -cosom;
|
||
bx = -bx;
|
||
by = -by;
|
||
bz = -bz;
|
||
bw = -bw;
|
||
}
|
||
if ((1.0 - cosom) > 0.000001) {
|
||
omega = Math.acos(cosom);
|
||
sinom = Math.sin(omega);
|
||
scale0 = Math.sin((1.0 - t) * omega) / sinom;
|
||
scale1 = Math.sin(t * omega) / sinom;
|
||
} else {
|
||
scale0 = 1.0 - t;
|
||
scale1 = t;
|
||
}
|
||
out[0] = scale0 * ax + scale1 * bx;
|
||
out[1] = scale0 * ay + scale1 * by;
|
||
out[2] = scale0 * az + scale1 * bz;
|
||
out[3] = scale0 * aw + scale1 * bw;
|
||
|
||
return out;
|
||
}
|
||
|
||
function quaternionToEuler(out, quat) {
|
||
var qx = quat[0];
|
||
var qy = quat[1];
|
||
var qz = quat[2];
|
||
var qw = quat[3];
|
||
var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz);
|
||
var attitude = Math.asin(2 * qx * qy + 2 * qz * qw);
|
||
var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz);
|
||
out[0] = heading / degToRads;
|
||
out[1] = attitude / degToRads;
|
||
out[2] = bank / degToRads;
|
||
}
|
||
|
||
function createQuaternion(values) {
|
||
var heading = values[0] * degToRads;
|
||
var attitude = values[1] * degToRads;
|
||
var bank = values[2] * degToRads;
|
||
var c1 = Math.cos(heading / 2);
|
||
var c2 = Math.cos(attitude / 2);
|
||
var c3 = Math.cos(bank / 2);
|
||
var s1 = Math.sin(heading / 2);
|
||
var s2 = Math.sin(attitude / 2);
|
||
var s3 = Math.sin(bank / 2);
|
||
var w = c1 * c2 * c3 - s1 * s2 * s3;
|
||
var x = s1 * s2 * c3 + c1 * c2 * s3;
|
||
var y = s1 * c2 * c3 + c1 * s2 * s3;
|
||
var z = c1 * s2 * c3 - s1 * c2 * s3;
|
||
|
||
return [x, y, z, w];
|
||
}
|
||
|
||
function getValueAtCurrentTime() {
|
||
var frameNum = this.comp.renderedFrame - this.offsetTime;
|
||
var initTime = this.keyframes[0].t - this.offsetTime;
|
||
var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
|
||
if (!(frameNum === this._caching.lastFrame || (this._caching.lastFrame !== initFrame && ((this._caching.lastFrame >= endTime && frameNum >= endTime) || (this._caching.lastFrame < initTime && frameNum < initTime))))) {
|
||
if (this._caching.lastFrame >= frameNum) {
|
||
this._caching._lastKeyframeIndex = -1;
|
||
this._caching.lastIndex = 0;
|
||
}
|
||
|
||
var renderResult = this.interpolateValue(frameNum, this._caching);
|
||
this.pv = renderResult;
|
||
}
|
||
this._caching.lastFrame = frameNum;
|
||
return this.pv;
|
||
}
|
||
|
||
function setVValue(val) {
|
||
var multipliedValue;
|
||
if (this.propType === 'unidimensional') {
|
||
multipliedValue = val * this.mult;
|
||
if (mathAbs(this.v - multipliedValue) > 0.00001) {
|
||
this.v = multipliedValue;
|
||
this._mdf = true;
|
||
}
|
||
} else {
|
||
var i = 0;
|
||
var len = this.v.length;
|
||
while (i < len) {
|
||
multipliedValue = val[i] * this.mult;
|
||
if (mathAbs(this.v[i] - multipliedValue) > 0.00001) {
|
||
this.v[i] = multipliedValue;
|
||
this._mdf = true;
|
||
}
|
||
i += 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
function processEffectsSequence() {
|
||
if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {
|
||
return;
|
||
}
|
||
if (this.lock) {
|
||
this.setVValue(this.pv);
|
||
return;
|
||
}
|
||
this.lock = true;
|
||
this._mdf = this._isFirstFrame;
|
||
var i;
|
||
var len = this.effectsSequence.length;
|
||
var finalValue = this.kf ? this.pv : this.data.k;
|
||
for (i = 0; i < len; i += 1) {
|
||
finalValue = this.effectsSequence[i](finalValue);
|
||
}
|
||
this.setVValue(finalValue);
|
||
this._isFirstFrame = false;
|
||
this.lock = false;
|
||
this.frameId = this.elem.globalData.frameId;
|
||
}
|
||
|
||
function addEffect(effectFunction) {
|
||
this.effectsSequence.push(effectFunction);
|
||
this.container.addDynamicProperty(this);
|
||
}
|
||
|
||
function ValueProperty(elem, data, mult, container) {
|
||
this.propType = 'unidimensional';
|
||
this.mult = mult || 1;
|
||
this.data = data;
|
||
this.v = mult ? data.k * mult : data.k;
|
||
this.pv = data.k;
|
||
this._mdf = false;
|
||
this.elem = elem;
|
||
this.container = container;
|
||
this.comp = elem.comp;
|
||
this.k = false;
|
||
this.kf = false;
|
||
this.vel = 0;
|
||
this.effectsSequence = [];
|
||
this._isFirstFrame = true;
|
||
this.getValue = processEffectsSequence;
|
||
this.setVValue = setVValue;
|
||
this.addEffect = addEffect;
|
||
}
|
||
|
||
function MultiDimensionalProperty(elem, data, mult, container) {
|
||
this.propType = 'multidimensional';
|
||
this.mult = mult || 1;
|
||
this.data = data;
|
||
this._mdf = false;
|
||
this.elem = elem;
|
||
this.container = container;
|
||
this.comp = elem.comp;
|
||
this.k = false;
|
||
this.kf = false;
|
||
this.frameId = -1;
|
||
var i;
|
||
var len = data.k.length;
|
||
this.v = createTypedArray('float32', len);
|
||
this.pv = createTypedArray('float32', len);
|
||
this.vel = createTypedArray('float32', len);
|
||
for (i = 0; i < len; i += 1) {
|
||
this.v[i] = data.k[i] * this.mult;
|
||
this.pv[i] = data.k[i];
|
||
}
|
||
this._isFirstFrame = true;
|
||
this.effectsSequence = [];
|
||
this.getValue = processEffectsSequence;
|
||
this.setVValue = setVValue;
|
||
this.addEffect = addEffect;
|
||
}
|
||
|
||
function KeyframedValueProperty(elem, data, mult, container) {
|
||
this.propType = 'unidimensional';
|
||
this.keyframes = data.k;
|
||
this.offsetTime = elem.data.st;
|
||
this.frameId = -1;
|
||
this._caching = {
|
||
lastFrame: initFrame, lastIndex: 0, value: 0, _lastKeyframeIndex: -1,
|
||
};
|
||
this.k = true;
|
||
this.kf = true;
|
||
this.data = data;
|
||
this.mult = mult || 1;
|
||
this.elem = elem;
|
||
this.container = container;
|
||
this.comp = elem.comp;
|
||
this.v = initFrame;
|
||
this.pv = initFrame;
|
||
this._isFirstFrame = true;
|
||
this.getValue = processEffectsSequence;
|
||
this.setVValue = setVValue;
|
||
this.interpolateValue = interpolateValue;
|
||
this.effectsSequence = [getValueAtCurrentTime.bind(this)];
|
||
this.addEffect = addEffect;
|
||
}
|
||
|
||
function KeyframedMultidimensionalProperty(elem, data, mult, container) {
|
||
this.propType = 'multidimensional';
|
||
var i;
|
||
var len = data.k.length;
|
||
var s;
|
||
var e;
|
||
var to;
|
||
var ti;
|
||
for (i = 0; i < len - 1; i += 1) {
|
||
if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {
|
||
s = data.k[i].s;
|
||
e = data.k[i + 1].s;
|
||
to = data.k[i].to;
|
||
ti = data.k[i].ti;
|
||
if ((s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1])) || (s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2]))) {
|
||
data.k[i].to = null;
|
||
data.k[i].ti = null;
|
||
}
|
||
if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {
|
||
if (s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {
|
||
data.k[i].to = null;
|
||
data.k[i].ti = null;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
this.effectsSequence = [getValueAtCurrentTime.bind(this)];
|
||
this.data = data;
|
||
this.keyframes = data.k;
|
||
this.offsetTime = elem.data.st;
|
||
this.k = true;
|
||
this.kf = true;
|
||
this._isFirstFrame = true;
|
||
this.mult = mult || 1;
|
||
this.elem = elem;
|
||
this.container = container;
|
||
this.comp = elem.comp;
|
||
this.getValue = processEffectsSequence;
|
||
this.setVValue = setVValue;
|
||
this.interpolateValue = interpolateValue;
|
||
this.frameId = -1;
|
||
var arrLen = data.k[0].s.length;
|
||
this.v = createTypedArray('float32', arrLen);
|
||
this.pv = createTypedArray('float32', arrLen);
|
||
for (i = 0; i < arrLen; i += 1) {
|
||
this.v[i] = initFrame;
|
||
this.pv[i] = initFrame;
|
||
}
|
||
this._caching = { lastFrame: initFrame, lastIndex: 0, value: createTypedArray('float32', arrLen) };
|
||
this.addEffect = addEffect;
|
||
}
|
||
|
||
function getProp(elem, data, type, mult, container) {
|
||
var p;
|
||
if (!data.k.length) {
|
||
p = new ValueProperty(elem, data, mult, container);
|
||
} else if (typeof (data.k[0]) === 'number') {
|
||
p = new MultiDimensionalProperty(elem, data, mult, container);
|
||
} else {
|
||
switch (type) {
|
||
case 0:
|
||
p = new KeyframedValueProperty(elem, data, mult, container);
|
||
break;
|
||
case 1:
|
||
p = new KeyframedMultidimensionalProperty(elem, data, mult, container);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
if (p.effectsSequence.length) {
|
||
container.addDynamicProperty(p);
|
||
}
|
||
return p;
|
||
}
|
||
|
||
var ob = {
|
||
getProp: getProp,
|
||
};
|
||
return ob;
|
||
}());
|
||
|
||
/* global Matrix, degToRads, PropertyFactory, extendPrototype, DynamicPropertyContainer */
|
||
/* exported TransformPropertyFactory */
|
||
|
||
var TransformPropertyFactory = (function () {
|
||
var defaultVector = [0, 0];
|
||
|
||
function applyToMatrix(mat) {
|
||
var _mdf = this._mdf;
|
||
this.iterateDynamicProperties();
|
||
this._mdf = this._mdf || _mdf;
|
||
if (this.a) {
|
||
mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
|
||
}
|
||
if (this.s) {
|
||
mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
|
||
}
|
||
if (this.sk) {
|
||
mat.skewFromAxis(-this.sk.v, this.sa.v);
|
||
}
|
||
if (this.r) {
|
||
mat.rotate(-this.r.v);
|
||
} else {
|
||
mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2])
|
||
.rotateY(this.or.v[1])
|
||
.rotateX(this.or.v[0]);
|
||
}
|
||
if (this.data.p.s) {
|
||
if (this.data.p.z) {
|
||
mat.translate(this.px.v, this.py.v, -this.pz.v);
|
||
} else {
|
||
mat.translate(this.px.v, this.py.v, 0);
|
||
}
|
||
} else {
|
||
mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
|
||
}
|
||
}
|
||
function processKeys(forceRender) {
|
||
if (this.elem.globalData.frameId === this.frameId) {
|
||
return;
|
||
}
|
||
if (this._isDirty) {
|
||
this.precalculateMatrix();
|
||
this._isDirty = false;
|
||
}
|
||
|
||
this.iterateDynamicProperties();
|
||
|
||
if (this._mdf || forceRender) {
|
||
var frameRate;
|
||
this.v.cloneFromProps(this.pre.props);
|
||
if (this.appliedTransformations < 1) {
|
||
this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
|
||
}
|
||
if (this.appliedTransformations < 2) {
|
||
this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
|
||
}
|
||
if (this.sk && this.appliedTransformations < 3) {
|
||
this.v.skewFromAxis(-this.sk.v, this.sa.v);
|
||
}
|
||
if (this.r && this.appliedTransformations < 4) {
|
||
this.v.rotate(-this.r.v);
|
||
} else if (!this.r && this.appliedTransformations < 4) {
|
||
this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2])
|
||
.rotateY(this.or.v[1])
|
||
.rotateX(this.or.v[0]);
|
||
}
|
||
if (this.autoOriented) {
|
||
var v1;
|
||
var v2;
|
||
frameRate = this.elem.globalData.frameRate;
|
||
if (this.p && this.p.keyframes && this.p.getValueAtTime) {
|
||
if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {
|
||
v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0);
|
||
v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);
|
||
} else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {
|
||
v1 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t / frameRate), 0);
|
||
v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0);
|
||
} else {
|
||
v1 = this.p.pv;
|
||
v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);
|
||
}
|
||
} else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {
|
||
v1 = [];
|
||
v2 = [];
|
||
var px = this.px;
|
||
var py = this.py;
|
||
if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {
|
||
v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0);
|
||
v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0);
|
||
v2[0] = px.getValueAtTime((px.keyframes[0].t) / frameRate, 0);
|
||
v2[1] = py.getValueAtTime((py.keyframes[0].t) / frameRate, 0);
|
||
} else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {
|
||
v1[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t / frameRate), 0);
|
||
v1[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t / frameRate), 0);
|
||
v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0);
|
||
v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0);
|
||
} else {
|
||
v1 = [px.pv, py.pv];
|
||
v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime);
|
||
v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime);
|
||
}
|
||
} else {
|
||
v2 = defaultVector;
|
||
v1 = v2;
|
||
}
|
||
this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));
|
||
}
|
||
if (this.data.p && this.data.p.s) {
|
||
if (this.data.p.z) {
|
||
this.v.translate(this.px.v, this.py.v, -this.pz.v);
|
||
} else {
|
||
this.v.translate(this.px.v, this.py.v, 0);
|
||
}
|
||
} else {
|
||
this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
|
||
}
|
||
}
|
||
this.frameId = this.elem.globalData.frameId;
|
||
}
|
||
|
||
function precalculateMatrix() {
|
||
if (!this.a.k) {
|
||
this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
|
||
this.appliedTransformations = 1;
|
||
} else {
|
||
return;
|
||
}
|
||
if (!this.s.effectsSequence.length) {
|
||
this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
|
||
this.appliedTransformations = 2;
|
||
} else {
|
||
return;
|
||
}
|
||
if (this.sk) {
|
||
if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {
|
||
this.pre.skewFromAxis(-this.sk.v, this.sa.v);
|
||
this.appliedTransformations = 3;
|
||
} else {
|
||
return;
|
||
}
|
||
}
|
||
if (this.r) {
|
||
if (!this.r.effectsSequence.length) {
|
||
this.pre.rotate(-this.r.v);
|
||
this.appliedTransformations = 4;
|
||
}
|
||
} else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {
|
||
this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2])
|
||
.rotateY(this.or.v[1])
|
||
.rotateX(this.or.v[0]);
|
||
this.appliedTransformations = 4;
|
||
}
|
||
}
|
||
|
||
function autoOrient() {
|
||
//
|
||
// var prevP = this.getValueAtTime();
|
||
}
|
||
|
||
function addDynamicProperty(prop) {
|
||
this._addDynamicProperty(prop);
|
||
this.elem.addDynamicProperty(prop);
|
||
this._isDirty = true;
|
||
}
|
||
|
||
function TransformProperty(elem, data, container) {
|
||
this.elem = elem;
|
||
this.frameId = -1;
|
||
this.propType = 'transform';
|
||
this.data = data;
|
||
this.v = new Matrix();
|
||
// Precalculated matrix with non animated properties
|
||
this.pre = new Matrix();
|
||
this.appliedTransformations = 0;
|
||
this.initDynamicPropertyContainer(container || elem);
|
||
if (data.p && data.p.s) {
|
||
this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this);
|
||
this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this);
|
||
if (data.p.z) {
|
||
this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this);
|
||
}
|
||
} else {
|
||
this.p = PropertyFactory.getProp(elem, data.p || { k: [0, 0, 0] }, 1, 0, this);
|
||
}
|
||
if (data.rx) {
|
||
this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);
|
||
this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);
|
||
this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);
|
||
if (data.or.k[0].ti) {
|
||
var i;
|
||
var len = data.or.k.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
data.or.k[i].to = null;
|
||
data.or.k[i].ti = null;
|
||
}
|
||
}
|
||
this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this);
|
||
// sh Indicates it needs to be capped between -180 and 180
|
||
this.or.sh = true;
|
||
} else {
|
||
this.r = PropertyFactory.getProp(elem, data.r || { k: 0 }, 0, degToRads, this);
|
||
}
|
||
if (data.sk) {
|
||
this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);
|
||
this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);
|
||
}
|
||
this.a = PropertyFactory.getProp(elem, data.a || { k: [0, 0, 0] }, 1, 0, this);
|
||
this.s = PropertyFactory.getProp(elem, data.s || { k: [100, 100, 100] }, 1, 0.01, this);
|
||
// Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.
|
||
if (data.o) {
|
||
this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem);
|
||
} else {
|
||
this.o = { _mdf: false, v: 1 };
|
||
}
|
||
this._isDirty = true;
|
||
if (!this.dynamicProperties.length) {
|
||
this.getValue(true);
|
||
}
|
||
}
|
||
|
||
TransformProperty.prototype = {
|
||
applyToMatrix: applyToMatrix,
|
||
getValue: processKeys,
|
||
precalculateMatrix: precalculateMatrix,
|
||
autoOrient: autoOrient,
|
||
};
|
||
|
||
extendPrototype([DynamicPropertyContainer], TransformProperty);
|
||
TransformProperty.prototype.addDynamicProperty = addDynamicProperty;
|
||
TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;
|
||
|
||
function getTransformProperty(elem, data, container) {
|
||
return new TransformProperty(elem, data, container);
|
||
}
|
||
|
||
return {
|
||
getTransformProperty: getTransformProperty,
|
||
};
|
||
}());
|
||
|
||
/* global createSizedArray, createSizedArray, pointPool */
|
||
|
||
function ShapePath() {
|
||
this.c = false;
|
||
this._length = 0;
|
||
this._maxLength = 8;
|
||
this.v = createSizedArray(this._maxLength);
|
||
this.o = createSizedArray(this._maxLength);
|
||
this.i = createSizedArray(this._maxLength);
|
||
}
|
||
|
||
ShapePath.prototype.setPathData = function (closed, len) {
|
||
this.c = closed;
|
||
this.setLength(len);
|
||
var i = 0;
|
||
while (i < len) {
|
||
this.v[i] = pointPool.newElement();
|
||
this.o[i] = pointPool.newElement();
|
||
this.i[i] = pointPool.newElement();
|
||
i += 1;
|
||
}
|
||
};
|
||
|
||
ShapePath.prototype.setLength = function (len) {
|
||
while (this._maxLength < len) {
|
||
this.doubleArrayLength();
|
||
}
|
||
this._length = len;
|
||
};
|
||
|
||
ShapePath.prototype.doubleArrayLength = function () {
|
||
this.v = this.v.concat(createSizedArray(this._maxLength));
|
||
this.i = this.i.concat(createSizedArray(this._maxLength));
|
||
this.o = this.o.concat(createSizedArray(this._maxLength));
|
||
this._maxLength *= 2;
|
||
};
|
||
|
||
ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {
|
||
var arr;
|
||
this._length = Math.max(this._length, pos + 1);
|
||
if (this._length >= this._maxLength) {
|
||
this.doubleArrayLength();
|
||
}
|
||
switch (type) {
|
||
case 'v':
|
||
arr = this.v;
|
||
break;
|
||
case 'i':
|
||
arr = this.i;
|
||
break;
|
||
case 'o':
|
||
arr = this.o;
|
||
break;
|
||
default:
|
||
arr = [];
|
||
break;
|
||
}
|
||
if (!arr[pos] || (arr[pos] && !replace)) {
|
||
arr[pos] = pointPool.newElement();
|
||
}
|
||
arr[pos][0] = x;
|
||
arr[pos][1] = y;
|
||
};
|
||
|
||
ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {
|
||
this.setXYAt(vX, vY, 'v', pos, replace);
|
||
this.setXYAt(oX, oY, 'o', pos, replace);
|
||
this.setXYAt(iX, iY, 'i', pos, replace);
|
||
};
|
||
|
||
ShapePath.prototype.reverse = function () {
|
||
var newPath = new ShapePath();
|
||
newPath.setPathData(this.c, this._length);
|
||
var vertices = this.v;
|
||
var outPoints = this.o;
|
||
var inPoints = this.i;
|
||
var init = 0;
|
||
if (this.c) {
|
||
newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);
|
||
init = 1;
|
||
}
|
||
var cnt = this._length - 1;
|
||
var len = this._length;
|
||
|
||
var i;
|
||
for (i = init; i < len; i += 1) {
|
||
newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);
|
||
cnt -= 1;
|
||
}
|
||
return newPath;
|
||
};
|
||
|
||
/* global extendPrototype, roundCorner, BezierFactory, shapePool, degToRads,
|
||
shapeCollectionPool, PropertyFactory, bmMin, DynamicPropertyContainer */
|
||
/* exported ShapePropertyFactory */
|
||
|
||
var ShapePropertyFactory = (function () {
|
||
var initFrame = -999999;
|
||
|
||
function interpolateShape(frameNum, previousValue, caching) {
|
||
var iterationIndex = caching.lastIndex;
|
||
var keyPropS;
|
||
var keyPropE;
|
||
var isHold;
|
||
var j;
|
||
var k;
|
||
var jLen;
|
||
var kLen;
|
||
var perc;
|
||
var vertexValue;
|
||
var kf = this.keyframes;
|
||
if (frameNum < kf[0].t - this.offsetTime) {
|
||
keyPropS = kf[0].s[0];
|
||
isHold = true;
|
||
iterationIndex = 0;
|
||
} else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {
|
||
keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];
|
||
/* if(kf[kf.length - 1].s){
|
||
keyPropS = kf[kf.length - 1].s[0];
|
||
}else{
|
||
keyPropS = kf[kf.length - 2].e[0];
|
||
} */
|
||
isHold = true;
|
||
} else {
|
||
var i = iterationIndex;
|
||
var len = kf.length - 1;
|
||
var flag = true;
|
||
var keyData;
|
||
var nextKeyData;
|
||
while (flag) {
|
||
keyData = kf[i];
|
||
nextKeyData = kf[i + 1];
|
||
if ((nextKeyData.t - this.offsetTime) > frameNum) {
|
||
break;
|
||
}
|
||
if (i < len - 1) {
|
||
i += 1;
|
||
} else {
|
||
flag = false;
|
||
}
|
||
}
|
||
isHold = keyData.h === 1;
|
||
iterationIndex = i;
|
||
if (!isHold) {
|
||
if (frameNum >= nextKeyData.t - this.offsetTime) {
|
||
perc = 1;
|
||
} else if (frameNum < keyData.t - this.offsetTime) {
|
||
perc = 0;
|
||
} else {
|
||
var fnc;
|
||
if (keyData.__fnct) {
|
||
fnc = keyData.__fnct;
|
||
} else {
|
||
fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get;
|
||
keyData.__fnct = fnc;
|
||
}
|
||
perc = fnc((frameNum - (keyData.t - this.offsetTime)) / ((nextKeyData.t - this.offsetTime) - (keyData.t - this.offsetTime)));
|
||
}
|
||
keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];
|
||
}
|
||
keyPropS = keyData.s[0];
|
||
}
|
||
jLen = previousValue._length;
|
||
kLen = keyPropS.i[0].length;
|
||
caching.lastIndex = iterationIndex;
|
||
|
||
for (j = 0; j < jLen; j += 1) {
|
||
for (k = 0; k < kLen; k += 1) {
|
||
vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc;
|
||
previousValue.i[j][k] = vertexValue;
|
||
vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc;
|
||
previousValue.o[j][k] = vertexValue;
|
||
vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc;
|
||
previousValue.v[j][k] = vertexValue;
|
||
}
|
||
}
|
||
}
|
||
|
||
function interpolateShapeCurrentTime() {
|
||
var frameNum = this.comp.renderedFrame - this.offsetTime;
|
||
var initTime = this.keyframes[0].t - this.offsetTime;
|
||
var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
|
||
var lastFrame = this._caching.lastFrame;
|
||
if (!(lastFrame !== initFrame && ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime)))) {
|
||
/// /
|
||
this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;
|
||
this.interpolateShape(frameNum, this.pv, this._caching);
|
||
/// /
|
||
}
|
||
this._caching.lastFrame = frameNum;
|
||
return this.pv;
|
||
}
|
||
|
||
function resetShape() {
|
||
this.paths = this.localShapeCollection;
|
||
}
|
||
|
||
function shapesEqual(shape1, shape2) {
|
||
if (shape1._length !== shape2._length || shape1.c !== shape2.c) {
|
||
return false;
|
||
}
|
||
var i;
|
||
var len = shape1._length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (shape1.v[i][0] !== shape2.v[i][0]
|
||
|| shape1.v[i][1] !== shape2.v[i][1]
|
||
|| shape1.o[i][0] !== shape2.o[i][0]
|
||
|| shape1.o[i][1] !== shape2.o[i][1]
|
||
|| shape1.i[i][0] !== shape2.i[i][0]
|
||
|| shape1.i[i][1] !== shape2.i[i][1]) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function setVValue(newPath) {
|
||
if (!shapesEqual(this.v, newPath)) {
|
||
this.v = shapePool.clone(newPath);
|
||
this.localShapeCollection.releaseShapes();
|
||
this.localShapeCollection.addShape(this.v);
|
||
this._mdf = true;
|
||
this.paths = this.localShapeCollection;
|
||
}
|
||
}
|
||
|
||
function processEffectsSequence() {
|
||
if (this.elem.globalData.frameId === this.frameId) {
|
||
return;
|
||
} if (!this.effectsSequence.length) {
|
||
this._mdf = false;
|
||
return;
|
||
}
|
||
if (this.lock) {
|
||
this.setVValue(this.pv);
|
||
return;
|
||
}
|
||
this.lock = true;
|
||
this._mdf = false;
|
||
var finalValue;
|
||
if (this.kf) {
|
||
finalValue = this.pv;
|
||
} else if (this.data.ks) {
|
||
finalValue = this.data.ks.k;
|
||
} else {
|
||
finalValue = this.data.pt.k;
|
||
}
|
||
var i;
|
||
var len = this.effectsSequence.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
finalValue = this.effectsSequence[i](finalValue);
|
||
}
|
||
this.setVValue(finalValue);
|
||
this.lock = false;
|
||
this.frameId = this.elem.globalData.frameId;
|
||
}
|
||
|
||
function ShapeProperty(elem, data, type) {
|
||
this.propType = 'shape';
|
||
this.comp = elem.comp;
|
||
this.container = elem;
|
||
this.elem = elem;
|
||
this.data = data;
|
||
this.k = false;
|
||
this.kf = false;
|
||
this._mdf = false;
|
||
var pathData = type === 3 ? data.pt.k : data.ks.k;
|
||
this.v = shapePool.clone(pathData);
|
||
this.pv = shapePool.clone(this.v);
|
||
this.localShapeCollection = shapeCollectionPool.newShapeCollection();
|
||
this.paths = this.localShapeCollection;
|
||
this.paths.addShape(this.v);
|
||
this.reset = resetShape;
|
||
this.effectsSequence = [];
|
||
}
|
||
|
||
function addEffect(effectFunction) {
|
||
this.effectsSequence.push(effectFunction);
|
||
this.container.addDynamicProperty(this);
|
||
}
|
||
|
||
ShapeProperty.prototype.interpolateShape = interpolateShape;
|
||
ShapeProperty.prototype.getValue = processEffectsSequence;
|
||
ShapeProperty.prototype.setVValue = setVValue;
|
||
ShapeProperty.prototype.addEffect = addEffect;
|
||
|
||
function KeyframedShapeProperty(elem, data, type) {
|
||
this.propType = 'shape';
|
||
this.comp = elem.comp;
|
||
this.elem = elem;
|
||
this.container = elem;
|
||
this.offsetTime = elem.data.st;
|
||
this.keyframes = type === 3 ? data.pt.k : data.ks.k;
|
||
this.k = true;
|
||
this.kf = true;
|
||
var len = this.keyframes[0].s[0].i.length;
|
||
this.v = shapePool.newElement();
|
||
this.v.setPathData(this.keyframes[0].s[0].c, len);
|
||
this.pv = shapePool.clone(this.v);
|
||
this.localShapeCollection = shapeCollectionPool.newShapeCollection();
|
||
this.paths = this.localShapeCollection;
|
||
this.paths.addShape(this.v);
|
||
this.lastFrame = initFrame;
|
||
this.reset = resetShape;
|
||
this._caching = { lastFrame: initFrame, lastIndex: 0 };
|
||
this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];
|
||
}
|
||
KeyframedShapeProperty.prototype.getValue = processEffectsSequence;
|
||
KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;
|
||
KeyframedShapeProperty.prototype.setVValue = setVValue;
|
||
KeyframedShapeProperty.prototype.addEffect = addEffect;
|
||
|
||
var EllShapeProperty = (function () {
|
||
var cPoint = roundCorner;
|
||
|
||
function EllShapePropertyFactory(elem, data) {
|
||
/* this.v = {
|
||
v: createSizedArray(4),
|
||
i: createSizedArray(4),
|
||
o: createSizedArray(4),
|
||
c: true
|
||
}; */
|
||
this.v = shapePool.newElement();
|
||
this.v.setPathData(true, 4);
|
||
this.localShapeCollection = shapeCollectionPool.newShapeCollection();
|
||
this.paths = this.localShapeCollection;
|
||
this.localShapeCollection.addShape(this.v);
|
||
this.d = data.d;
|
||
this.elem = elem;
|
||
this.comp = elem.comp;
|
||
this.frameId = -1;
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
|
||
this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);
|
||
if (this.dynamicProperties.length) {
|
||
this.k = true;
|
||
} else {
|
||
this.k = false;
|
||
this.convertEllToPath();
|
||
}
|
||
}
|
||
|
||
EllShapePropertyFactory.prototype = {
|
||
reset: resetShape,
|
||
getValue: function () {
|
||
if (this.elem.globalData.frameId === this.frameId) {
|
||
return;
|
||
}
|
||
this.frameId = this.elem.globalData.frameId;
|
||
this.iterateDynamicProperties();
|
||
|
||
if (this._mdf) {
|
||
this.convertEllToPath();
|
||
}
|
||
},
|
||
convertEllToPath: function () {
|
||
var p0 = this.p.v[0];
|
||
var p1 = this.p.v[1];
|
||
var s0 = this.s.v[0] / 2;
|
||
var s1 = this.s.v[1] / 2;
|
||
var _cw = this.d !== 3;
|
||
var _v = this.v;
|
||
_v.v[0][0] = p0;
|
||
_v.v[0][1] = p1 - s1;
|
||
_v.v[1][0] = _cw ? p0 + s0 : p0 - s0;
|
||
_v.v[1][1] = p1;
|
||
_v.v[2][0] = p0;
|
||
_v.v[2][1] = p1 + s1;
|
||
_v.v[3][0] = _cw ? p0 - s0 : p0 + s0;
|
||
_v.v[3][1] = p1;
|
||
_v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
|
||
_v.i[0][1] = p1 - s1;
|
||
_v.i[1][0] = _cw ? p0 + s0 : p0 - s0;
|
||
_v.i[1][1] = p1 - s1 * cPoint;
|
||
_v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
|
||
_v.i[2][1] = p1 + s1;
|
||
_v.i[3][0] = _cw ? p0 - s0 : p0 + s0;
|
||
_v.i[3][1] = p1 + s1 * cPoint;
|
||
_v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
|
||
_v.o[0][1] = p1 - s1;
|
||
_v.o[1][0] = _cw ? p0 + s0 : p0 - s0;
|
||
_v.o[1][1] = p1 + s1 * cPoint;
|
||
_v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
|
||
_v.o[2][1] = p1 + s1;
|
||
_v.o[3][0] = _cw ? p0 - s0 : p0 + s0;
|
||
_v.o[3][1] = p1 - s1 * cPoint;
|
||
},
|
||
};
|
||
|
||
extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory);
|
||
|
||
return EllShapePropertyFactory;
|
||
}());
|
||
|
||
var StarShapeProperty = (function () {
|
||
function StarShapePropertyFactory(elem, data) {
|
||
this.v = shapePool.newElement();
|
||
this.v.setPathData(true, 0);
|
||
this.elem = elem;
|
||
this.comp = elem.comp;
|
||
this.data = data;
|
||
this.frameId = -1;
|
||
this.d = data.d;
|
||
this.initDynamicPropertyContainer(elem);
|
||
if (data.sy === 1) {
|
||
this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this);
|
||
this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this);
|
||
this.convertToPath = this.convertStarToPath;
|
||
} else {
|
||
this.convertToPath = this.convertPolygonToPath;
|
||
}
|
||
this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this);
|
||
this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
|
||
this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this);
|
||
this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this);
|
||
this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this);
|
||
this.localShapeCollection = shapeCollectionPool.newShapeCollection();
|
||
this.localShapeCollection.addShape(this.v);
|
||
this.paths = this.localShapeCollection;
|
||
if (this.dynamicProperties.length) {
|
||
this.k = true;
|
||
} else {
|
||
this.k = false;
|
||
this.convertToPath();
|
||
}
|
||
}
|
||
|
||
StarShapePropertyFactory.prototype = {
|
||
reset: resetShape,
|
||
getValue: function () {
|
||
if (this.elem.globalData.frameId === this.frameId) {
|
||
return;
|
||
}
|
||
this.frameId = this.elem.globalData.frameId;
|
||
this.iterateDynamicProperties();
|
||
if (this._mdf) {
|
||
this.convertToPath();
|
||
}
|
||
},
|
||
convertStarToPath: function () {
|
||
var numPts = Math.floor(this.pt.v) * 2;
|
||
var angle = (Math.PI * 2) / numPts;
|
||
/* this.v.v.length = numPts;
|
||
this.v.i.length = numPts;
|
||
this.v.o.length = numPts; */
|
||
var longFlag = true;
|
||
var longRad = this.or.v;
|
||
var shortRad = this.ir.v;
|
||
var longRound = this.os.v;
|
||
var shortRound = this.is.v;
|
||
var longPerimSegment = (2 * Math.PI * longRad) / (numPts * 2);
|
||
var shortPerimSegment = (2 * Math.PI * shortRad) / (numPts * 2);
|
||
var i;
|
||
var rad;
|
||
var roundness;
|
||
var perimSegment;
|
||
var currentAng = -Math.PI / 2;
|
||
currentAng += this.r.v;
|
||
var dir = this.data.d === 3 ? -1 : 1;
|
||
this.v._length = 0;
|
||
for (i = 0; i < numPts; i += 1) {
|
||
rad = longFlag ? longRad : shortRad;
|
||
roundness = longFlag ? longRound : shortRound;
|
||
perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
||
var x = rad * Math.cos(currentAng);
|
||
var y = rad * Math.sin(currentAng);
|
||
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
||
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
||
x += +this.p.v[0];
|
||
y += +this.p.v[1];
|
||
this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);
|
||
|
||
/* this.v.v[i] = [x,y];
|
||
this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];
|
||
this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];
|
||
this.v._length = numPts; */
|
||
longFlag = !longFlag;
|
||
currentAng += angle * dir;
|
||
}
|
||
},
|
||
convertPolygonToPath: function () {
|
||
var numPts = Math.floor(this.pt.v);
|
||
var angle = (Math.PI * 2) / numPts;
|
||
var rad = this.or.v;
|
||
var roundness = this.os.v;
|
||
var perimSegment = (2 * Math.PI * rad) / (numPts * 4);
|
||
var i;
|
||
var currentAng = -Math.PI * 0.5;
|
||
var dir = this.data.d === 3 ? -1 : 1;
|
||
currentAng += this.r.v;
|
||
this.v._length = 0;
|
||
for (i = 0; i < numPts; i += 1) {
|
||
var x = rad * Math.cos(currentAng);
|
||
var y = rad * Math.sin(currentAng);
|
||
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
||
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
||
x += +this.p.v[0];
|
||
y += +this.p.v[1];
|
||
this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);
|
||
currentAng += angle * dir;
|
||
}
|
||
this.paths.length = 0;
|
||
this.paths[0] = this.v;
|
||
},
|
||
|
||
};
|
||
extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory);
|
||
|
||
return StarShapePropertyFactory;
|
||
}());
|
||
|
||
var RectShapeProperty = (function () {
|
||
function RectShapePropertyFactory(elem, data) {
|
||
this.v = shapePool.newElement();
|
||
this.v.c = true;
|
||
this.localShapeCollection = shapeCollectionPool.newShapeCollection();
|
||
this.localShapeCollection.addShape(this.v);
|
||
this.paths = this.localShapeCollection;
|
||
this.elem = elem;
|
||
this.comp = elem.comp;
|
||
this.frameId = -1;
|
||
this.d = data.d;
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
|
||
this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);
|
||
this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this);
|
||
if (this.dynamicProperties.length) {
|
||
this.k = true;
|
||
} else {
|
||
this.k = false;
|
||
this.convertRectToPath();
|
||
}
|
||
}
|
||
|
||
RectShapePropertyFactory.prototype = {
|
||
convertRectToPath: function () {
|
||
var p0 = this.p.v[0];
|
||
var p1 = this.p.v[1];
|
||
var v0 = this.s.v[0] / 2;
|
||
var v1 = this.s.v[1] / 2;
|
||
var round = bmMin(v0, v1, this.r.v);
|
||
var cPoint = round * (1 - roundCorner);
|
||
this.v._length = 0;
|
||
|
||
if (this.d === 2 || this.d === 1) {
|
||
this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true);
|
||
this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true);
|
||
if (round !== 0) {
|
||
this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true);
|
||
this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true);
|
||
this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true);
|
||
this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true);
|
||
this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true);
|
||
this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true);
|
||
} else {
|
||
this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2);
|
||
this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3);
|
||
}
|
||
} else {
|
||
this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true);
|
||
if (round !== 0) {
|
||
this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true);
|
||
this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true);
|
||
this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true);
|
||
this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true);
|
||
this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true);
|
||
this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true);
|
||
this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true);
|
||
} else {
|
||
this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true);
|
||
this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true);
|
||
this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true);
|
||
}
|
||
}
|
||
},
|
||
getValue: function () {
|
||
if (this.elem.globalData.frameId === this.frameId) {
|
||
return;
|
||
}
|
||
this.frameId = this.elem.globalData.frameId;
|
||
this.iterateDynamicProperties();
|
||
if (this._mdf) {
|
||
this.convertRectToPath();
|
||
}
|
||
},
|
||
reset: resetShape,
|
||
};
|
||
extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory);
|
||
|
||
return RectShapePropertyFactory;
|
||
}());
|
||
|
||
function getShapeProp(elem, data, type) {
|
||
var prop;
|
||
if (type === 3 || type === 4) {
|
||
var dataProp = type === 3 ? data.pt : data.ks;
|
||
var keys = dataProp.k;
|
||
if (keys.length) {
|
||
prop = new KeyframedShapeProperty(elem, data, type);
|
||
} else {
|
||
prop = new ShapeProperty(elem, data, type);
|
||
}
|
||
} else if (type === 5) {
|
||
prop = new RectShapeProperty(elem, data);
|
||
} else if (type === 6) {
|
||
prop = new EllShapeProperty(elem, data);
|
||
} else if (type === 7) {
|
||
prop = new StarShapeProperty(elem, data);
|
||
}
|
||
if (prop.k) {
|
||
elem.addDynamicProperty(prop);
|
||
}
|
||
return prop;
|
||
}
|
||
|
||
function getConstructorFunction() {
|
||
return ShapeProperty;
|
||
}
|
||
|
||
function getKeyframedConstructorFunction() {
|
||
return KeyframedShapeProperty;
|
||
}
|
||
|
||
var ob = {};
|
||
ob.getShapeProp = getShapeProp;
|
||
ob.getConstructorFunction = getConstructorFunction;
|
||
ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;
|
||
return ob;
|
||
}());
|
||
|
||
/* global shapeCollectionPool, initialDefaultFrame, extendPrototype, DynamicPropertyContainer */
|
||
/* exported ShapeModifiers */
|
||
|
||
var ShapeModifiers = (function () {
|
||
var ob = {};
|
||
var modifiers = {};
|
||
ob.registerModifier = registerModifier;
|
||
ob.getModifier = getModifier;
|
||
|
||
function registerModifier(nm, factory) {
|
||
if (!modifiers[nm]) {
|
||
modifiers[nm] = factory;
|
||
}
|
||
}
|
||
|
||
function getModifier(nm, elem, data) {
|
||
return new modifiers[nm](elem, data);
|
||
}
|
||
|
||
return ob;
|
||
}());
|
||
|
||
function ShapeModifier() {}
|
||
ShapeModifier.prototype.initModifierProperties = function () {};
|
||
ShapeModifier.prototype.addShapeToModifier = function () {};
|
||
ShapeModifier.prototype.addShape = function (data) {
|
||
if (!this.closed) {
|
||
// Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.
|
||
data.sh.container.addDynamicProperty(data.sh);
|
||
var shapeData = { shape: data.sh, data: data, localShapeCollection: shapeCollectionPool.newShapeCollection() };
|
||
this.shapes.push(shapeData);
|
||
this.addShapeToModifier(shapeData);
|
||
if (this._isAnimated) {
|
||
data.setAsAnimated();
|
||
}
|
||
}
|
||
};
|
||
ShapeModifier.prototype.init = function (elem, data) {
|
||
this.shapes = [];
|
||
this.elem = elem;
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.initModifierProperties(elem, data);
|
||
this.frameId = initialDefaultFrame;
|
||
this.closed = false;
|
||
this.k = false;
|
||
if (this.dynamicProperties.length) {
|
||
this.k = true;
|
||
} else {
|
||
this.getValue(true);
|
||
}
|
||
};
|
||
ShapeModifier.prototype.processKeys = function () {
|
||
if (this.elem.globalData.frameId === this.frameId) {
|
||
return;
|
||
}
|
||
this.frameId = this.elem.globalData.frameId;
|
||
this.iterateDynamicProperties();
|
||
};
|
||
|
||
extendPrototype([DynamicPropertyContainer], ShapeModifier);
|
||
|
||
/* global extendPrototype, ShapeModifier, PropertyFactory, segmentsLengthPool, bez, shapePool, ShapeModifiers */
|
||
|
||
function TrimModifier() {
|
||
}
|
||
extendPrototype([ShapeModifier], TrimModifier);
|
||
TrimModifier.prototype.initModifierProperties = function (elem, data) {
|
||
this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);
|
||
this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);
|
||
this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);
|
||
this.sValue = 0;
|
||
this.eValue = 0;
|
||
this.getValue = this.processKeys;
|
||
this.m = data.m;
|
||
this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;
|
||
};
|
||
|
||
TrimModifier.prototype.addShapeToModifier = function (shapeData) {
|
||
shapeData.pathsData = [];
|
||
};
|
||
|
||
TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {
|
||
var segments = [];
|
||
if (e <= 1) {
|
||
segments.push({
|
||
s: s,
|
||
e: e,
|
||
});
|
||
} else if (s >= 1) {
|
||
segments.push({
|
||
s: s - 1,
|
||
e: e - 1,
|
||
});
|
||
} else {
|
||
segments.push({
|
||
s: s,
|
||
e: 1,
|
||
});
|
||
segments.push({
|
||
s: 0,
|
||
e: e - 1,
|
||
});
|
||
}
|
||
var shapeSegments = [];
|
||
var i;
|
||
var len = segments.length;
|
||
var segmentOb;
|
||
for (i = 0; i < len; i += 1) {
|
||
segmentOb = segments[i];
|
||
if (!(segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength)) {
|
||
var shapeS;
|
||
var shapeE;
|
||
if (segmentOb.s * totalModifierLength <= addedLength) {
|
||
shapeS = 0;
|
||
} else {
|
||
shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;
|
||
}
|
||
if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {
|
||
shapeE = 1;
|
||
} else {
|
||
shapeE = ((segmentOb.e * totalModifierLength - addedLength) / shapeLength);
|
||
}
|
||
shapeSegments.push([shapeS, shapeE]);
|
||
}
|
||
}
|
||
if (!shapeSegments.length) {
|
||
shapeSegments.push([0, 0]);
|
||
}
|
||
return shapeSegments;
|
||
};
|
||
|
||
TrimModifier.prototype.releasePathsData = function (pathsData) {
|
||
var i;
|
||
var len = pathsData.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
segmentsLengthPool.release(pathsData[i]);
|
||
}
|
||
pathsData.length = 0;
|
||
return pathsData;
|
||
};
|
||
|
||
TrimModifier.prototype.processShapes = function (_isFirstFrame) {
|
||
var s;
|
||
var e;
|
||
if (this._mdf || _isFirstFrame) {
|
||
var o = (this.o.v % 360) / 360;
|
||
if (o < 0) {
|
||
o += 1;
|
||
}
|
||
if (this.s.v > 1) {
|
||
s = 1 + o;
|
||
} else if (this.s.v < 0) {
|
||
s = 0 + o;
|
||
} else {
|
||
s = this.s.v + o;
|
||
}
|
||
if (this.e.v > 1) {
|
||
e = 1 + o;
|
||
} else if (this.e.v < 0) {
|
||
e = 0 + o;
|
||
} else {
|
||
e = this.e.v + o;
|
||
}
|
||
|
||
if (s > e) {
|
||
var _s = s;
|
||
s = e;
|
||
e = _s;
|
||
}
|
||
s = Math.round(s * 10000) * 0.0001;
|
||
e = Math.round(e * 10000) * 0.0001;
|
||
this.sValue = s;
|
||
this.eValue = e;
|
||
} else {
|
||
s = this.sValue;
|
||
e = this.eValue;
|
||
}
|
||
var shapePaths;
|
||
var i;
|
||
var len = this.shapes.length;
|
||
var j;
|
||
var jLen;
|
||
var pathsData;
|
||
var pathData;
|
||
var totalShapeLength;
|
||
var totalModifierLength = 0;
|
||
|
||
if (e === s) {
|
||
for (i = 0; i < len; i += 1) {
|
||
this.shapes[i].localShapeCollection.releaseShapes();
|
||
this.shapes[i].shape._mdf = true;
|
||
this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;
|
||
if (this._mdf) {
|
||
this.shapes[i].pathsData.length = 0;
|
||
}
|
||
}
|
||
} else if (!((e === 1 && s === 0) || (e === 0 && s === 1))) {
|
||
var segments = [];
|
||
var shapeData;
|
||
var localShapeCollection;
|
||
for (i = 0; i < len; i += 1) {
|
||
shapeData = this.shapes[i];
|
||
// if shape hasn't changed and trim properties haven't changed, cached previous path can be used
|
||
if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {
|
||
shapeData.shape.paths = shapeData.localShapeCollection;
|
||
} else {
|
||
shapePaths = shapeData.shape.paths;
|
||
jLen = shapePaths._length;
|
||
totalShapeLength = 0;
|
||
if (!shapeData.shape._mdf && shapeData.pathsData.length) {
|
||
totalShapeLength = shapeData.totalShapeLength;
|
||
} else {
|
||
pathsData = this.releasePathsData(shapeData.pathsData);
|
||
for (j = 0; j < jLen; j += 1) {
|
||
pathData = bez.getSegmentsLength(shapePaths.shapes[j]);
|
||
pathsData.push(pathData);
|
||
totalShapeLength += pathData.totalLength;
|
||
}
|
||
shapeData.totalShapeLength = totalShapeLength;
|
||
shapeData.pathsData = pathsData;
|
||
}
|
||
|
||
totalModifierLength += totalShapeLength;
|
||
shapeData.shape._mdf = true;
|
||
}
|
||
}
|
||
var shapeS = s;
|
||
var shapeE = e;
|
||
var addedLength = 0;
|
||
var edges;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
shapeData = this.shapes[i];
|
||
if (shapeData.shape._mdf) {
|
||
localShapeCollection = shapeData.localShapeCollection;
|
||
localShapeCollection.releaseShapes();
|
||
// if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group
|
||
if (this.m === 2 && len > 1) {
|
||
edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);
|
||
addedLength += shapeData.totalShapeLength;
|
||
} else {
|
||
edges = [[shapeS, shapeE]];
|
||
}
|
||
jLen = edges.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
shapeS = edges[j][0];
|
||
shapeE = edges[j][1];
|
||
segments.length = 0;
|
||
if (shapeE <= 1) {
|
||
segments.push({
|
||
s: shapeData.totalShapeLength * shapeS,
|
||
e: shapeData.totalShapeLength * shapeE,
|
||
});
|
||
} else if (shapeS >= 1) {
|
||
segments.push({
|
||
s: shapeData.totalShapeLength * (shapeS - 1),
|
||
e: shapeData.totalShapeLength * (shapeE - 1),
|
||
});
|
||
} else {
|
||
segments.push({
|
||
s: shapeData.totalShapeLength * shapeS,
|
||
e: shapeData.totalShapeLength,
|
||
});
|
||
segments.push({
|
||
s: 0,
|
||
e: shapeData.totalShapeLength * (shapeE - 1),
|
||
});
|
||
}
|
||
var newShapesData = this.addShapes(shapeData, segments[0]);
|
||
if (segments[0].s !== segments[0].e) {
|
||
if (segments.length > 1) {
|
||
var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];
|
||
if (lastShapeInCollection.c) {
|
||
var lastShape = newShapesData.pop();
|
||
this.addPaths(newShapesData, localShapeCollection);
|
||
newShapesData = this.addShapes(shapeData, segments[1], lastShape);
|
||
} else {
|
||
this.addPaths(newShapesData, localShapeCollection);
|
||
newShapesData = this.addShapes(shapeData, segments[1]);
|
||
}
|
||
}
|
||
this.addPaths(newShapesData, localShapeCollection);
|
||
}
|
||
}
|
||
shapeData.shape.paths = localShapeCollection;
|
||
}
|
||
}
|
||
} else if (this._mdf) {
|
||
for (i = 0; i < len; i += 1) {
|
||
// Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.
|
||
// Don't remove this even if it's losing cached info.
|
||
this.shapes[i].pathsData.length = 0;
|
||
this.shapes[i].shape._mdf = true;
|
||
}
|
||
}
|
||
};
|
||
|
||
TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {
|
||
var i;
|
||
var len = newPaths.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
localShapeCollection.addShape(newPaths[i]);
|
||
}
|
||
};
|
||
|
||
TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {
|
||
shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);
|
||
shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);
|
||
if (newShape) {
|
||
shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);
|
||
}
|
||
shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);
|
||
};
|
||
|
||
TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {
|
||
shapePath.setXYAt(points[1], points[5], 'o', pos);
|
||
shapePath.setXYAt(points[2], points[6], 'i', pos + 1);
|
||
if (newShape) {
|
||
shapePath.setXYAt(points[0], points[4], 'v', pos);
|
||
}
|
||
shapePath.setXYAt(points[3], points[7], 'v', pos + 1);
|
||
};
|
||
|
||
TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {
|
||
var pathsData = shapeData.pathsData;
|
||
var shapePaths = shapeData.shape.paths.shapes;
|
||
var i;
|
||
var len = shapeData.shape.paths._length;
|
||
var j;
|
||
var jLen;
|
||
var addedLength = 0;
|
||
var currentLengthData;
|
||
var segmentCount;
|
||
var lengths;
|
||
var segment;
|
||
var shapes = [];
|
||
var initPos;
|
||
var newShape = true;
|
||
if (!shapePath) {
|
||
shapePath = shapePool.newElement();
|
||
segmentCount = 0;
|
||
initPos = 0;
|
||
} else {
|
||
segmentCount = shapePath._length;
|
||
initPos = shapePath._length;
|
||
}
|
||
shapes.push(shapePath);
|
||
for (i = 0; i < len; i += 1) {
|
||
lengths = pathsData[i].lengths;
|
||
shapePath.c = shapePaths[i].c;
|
||
jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;
|
||
for (j = 1; j < jLen; j += 1) {
|
||
currentLengthData = lengths[j - 1];
|
||
if (addedLength + currentLengthData.addedLength < shapeSegment.s) {
|
||
addedLength += currentLengthData.addedLength;
|
||
shapePath.c = false;
|
||
} else if (addedLength > shapeSegment.e) {
|
||
shapePath.c = false;
|
||
break;
|
||
} else {
|
||
if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {
|
||
this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);
|
||
newShape = false;
|
||
} else {
|
||
segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]);
|
||
this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
|
||
// this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
|
||
newShape = false;
|
||
shapePath.c = false;
|
||
}
|
||
addedLength += currentLengthData.addedLength;
|
||
segmentCount += 1;
|
||
}
|
||
}
|
||
if (shapePaths[i].c && lengths.length) {
|
||
currentLengthData = lengths[j - 1];
|
||
if (addedLength <= shapeSegment.e) {
|
||
var segmentLength = lengths[j - 1].addedLength;
|
||
if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {
|
||
this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);
|
||
newShape = false;
|
||
} else {
|
||
segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);
|
||
this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
|
||
// this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
|
||
newShape = false;
|
||
shapePath.c = false;
|
||
}
|
||
} else {
|
||
shapePath.c = false;
|
||
}
|
||
addedLength += currentLengthData.addedLength;
|
||
segmentCount += 1;
|
||
}
|
||
if (shapePath._length) {
|
||
shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);
|
||
shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1);
|
||
}
|
||
if (addedLength > shapeSegment.e) {
|
||
break;
|
||
}
|
||
if (i < len - 1) {
|
||
shapePath = shapePool.newElement();
|
||
newShape = true;
|
||
shapes.push(shapePath);
|
||
segmentCount = 0;
|
||
}
|
||
}
|
||
return shapes;
|
||
};
|
||
|
||
ShapeModifiers.registerModifier('tm', TrimModifier);
|
||
|
||
/* global extendPrototype, ShapeModifier, PropertyFactory, shapePool, roundCorner, ShapeModifiers */
|
||
|
||
function RoundCornersModifier() {}
|
||
extendPrototype([ShapeModifier], RoundCornersModifier);
|
||
RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {
|
||
this.getValue = this.processKeys;
|
||
this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this);
|
||
this._isAnimated = !!this.rd.effectsSequence.length;
|
||
};
|
||
|
||
RoundCornersModifier.prototype.processPath = function (path, round) {
|
||
var clonedPath = shapePool.newElement();
|
||
clonedPath.c = path.c;
|
||
var i;
|
||
var len = path._length;
|
||
var currentV;
|
||
var currentI;
|
||
var currentO;
|
||
var closerV;
|
||
var distance;
|
||
var newPosPerc;
|
||
var index = 0;
|
||
var vX;
|
||
var vY;
|
||
var oX;
|
||
var oY;
|
||
var iX;
|
||
var iY;
|
||
for (i = 0; i < len; i += 1) {
|
||
currentV = path.v[i];
|
||
currentO = path.o[i];
|
||
currentI = path.i[i];
|
||
if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) {
|
||
if ((i === 0 || i === len - 1) && !path.c) {
|
||
clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index);
|
||
/* clonedPath.v[index] = currentV;
|
||
clonedPath.o[index] = currentO;
|
||
clonedPath.i[index] = currentI; */
|
||
index += 1;
|
||
} else {
|
||
if (i === 0) {
|
||
closerV = path.v[len - 1];
|
||
} else {
|
||
closerV = path.v[i - 1];
|
||
}
|
||
distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));
|
||
newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;
|
||
iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;
|
||
vX = iX;
|
||
iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc;
|
||
vY = iY;
|
||
oX = vX - (vX - currentV[0]) * roundCorner;
|
||
oY = vY - (vY - currentV[1]) * roundCorner;
|
||
clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);
|
||
index += 1;
|
||
|
||
if (i === len - 1) {
|
||
closerV = path.v[0];
|
||
} else {
|
||
closerV = path.v[i + 1];
|
||
}
|
||
distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));
|
||
newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;
|
||
oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;
|
||
vX = oX;
|
||
oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc;
|
||
vY = oY;
|
||
iX = vX - (vX - currentV[0]) * roundCorner;
|
||
iY = vY - (vY - currentV[1]) * roundCorner;
|
||
clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);
|
||
index += 1;
|
||
}
|
||
} else {
|
||
clonedPath.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index);
|
||
index += 1;
|
||
}
|
||
}
|
||
return clonedPath;
|
||
};
|
||
|
||
RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {
|
||
var shapePaths;
|
||
var i;
|
||
var len = this.shapes.length;
|
||
var j;
|
||
var jLen;
|
||
var rd = this.rd.v;
|
||
|
||
if (rd !== 0) {
|
||
var shapeData;
|
||
var localShapeCollection;
|
||
for (i = 0; i < len; i += 1) {
|
||
shapeData = this.shapes[i];
|
||
localShapeCollection = shapeData.localShapeCollection;
|
||
if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {
|
||
localShapeCollection.releaseShapes();
|
||
shapeData.shape._mdf = true;
|
||
shapePaths = shapeData.shape.paths.shapes;
|
||
jLen = shapeData.shape.paths._length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
localShapeCollection.addShape(this.processPath(shapePaths[j], rd));
|
||
}
|
||
}
|
||
shapeData.shape.paths = shapeData.localShapeCollection;
|
||
}
|
||
}
|
||
if (!this.dynamicProperties.length) {
|
||
this._mdf = false;
|
||
}
|
||
};
|
||
|
||
ShapeModifiers.registerModifier('rd', RoundCornersModifier);
|
||
|
||
/* global extendPrototype, ShapeModifier, PropertyFactory, shapePool, ShapeModifiers */
|
||
|
||
function PuckerAndBloatModifier() {}
|
||
extendPrototype([ShapeModifier], PuckerAndBloatModifier);
|
||
PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {
|
||
this.getValue = this.processKeys;
|
||
this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);
|
||
this._isAnimated = !!this.amount.effectsSequence.length;
|
||
};
|
||
|
||
PuckerAndBloatModifier.prototype.processPath = function (path, amount) {
|
||
var percent = amount / 100;
|
||
var centerPoint = [0, 0];
|
||
var pathLength = path._length;
|
||
var i = 0;
|
||
for (i = 0; i < pathLength; i += 1) {
|
||
centerPoint[0] += path.v[i][0];
|
||
centerPoint[1] += path.v[i][1];
|
||
}
|
||
centerPoint[0] /= pathLength;
|
||
centerPoint[1] /= pathLength;
|
||
var clonedPath = shapePool.newElement();
|
||
clonedPath.c = path.c;
|
||
var vX;
|
||
var vY;
|
||
var oX;
|
||
var oY;
|
||
var iX;
|
||
var iY;
|
||
for (i = 0; i < pathLength; i += 1) {
|
||
vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent;
|
||
vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent;
|
||
oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent;
|
||
oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent;
|
||
iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent;
|
||
iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent;
|
||
clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i);
|
||
}
|
||
return clonedPath;
|
||
};
|
||
|
||
PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {
|
||
var shapePaths;
|
||
var i;
|
||
var len = this.shapes.length;
|
||
var j;
|
||
var jLen;
|
||
var amount = this.amount.v;
|
||
|
||
if (amount !== 0) {
|
||
var shapeData;
|
||
var localShapeCollection;
|
||
for (i = 0; i < len; i += 1) {
|
||
shapeData = this.shapes[i];
|
||
localShapeCollection = shapeData.localShapeCollection;
|
||
if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {
|
||
localShapeCollection.releaseShapes();
|
||
shapeData.shape._mdf = true;
|
||
shapePaths = shapeData.shape.paths.shapes;
|
||
jLen = shapeData.shape.paths._length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
localShapeCollection.addShape(this.processPath(shapePaths[j], amount));
|
||
}
|
||
}
|
||
shapeData.shape.paths = shapeData.localShapeCollection;
|
||
}
|
||
}
|
||
if (!this.dynamicProperties.length) {
|
||
this._mdf = false;
|
||
}
|
||
};
|
||
ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier);
|
||
|
||
/* global extendPrototype, ShapeModifier, TransformPropertyFactory, PropertyFactory, Matrix, ShapeModifiers */
|
||
|
||
function RepeaterModifier() {}
|
||
extendPrototype([ShapeModifier], RepeaterModifier);
|
||
|
||
RepeaterModifier.prototype.initModifierProperties = function (elem, data) {
|
||
this.getValue = this.processKeys;
|
||
this.c = PropertyFactory.getProp(elem, data.c, 0, null, this);
|
||
this.o = PropertyFactory.getProp(elem, data.o, 0, null, this);
|
||
this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this);
|
||
this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this);
|
||
this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this);
|
||
this.data = data;
|
||
if (!this.dynamicProperties.length) {
|
||
this.getValue(true);
|
||
}
|
||
this._isAnimated = !!this.dynamicProperties.length;
|
||
this.pMatrix = new Matrix();
|
||
this.rMatrix = new Matrix();
|
||
this.sMatrix = new Matrix();
|
||
this.tMatrix = new Matrix();
|
||
this.matrix = new Matrix();
|
||
};
|
||
|
||
RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {
|
||
var dir = inv ? -1 : 1;
|
||
var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);
|
||
var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);
|
||
pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);
|
||
rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
|
||
rMatrix.rotate(-transform.r.v * dir * perc);
|
||
rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
|
||
sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
|
||
sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY);
|
||
sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
|
||
};
|
||
|
||
RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {
|
||
this.elem = elem;
|
||
this.arr = arr;
|
||
this.pos = pos;
|
||
this.elemsData = elemsData;
|
||
this._currentCopies = 0;
|
||
this._elements = [];
|
||
this._groups = [];
|
||
this.frameId = -1;
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.initModifierProperties(elem, arr[pos]);
|
||
while (pos > 0) {
|
||
pos -= 1;
|
||
// this._elements.unshift(arr.splice(pos,1)[0]);
|
||
this._elements.unshift(arr[pos]);
|
||
}
|
||
if (this.dynamicProperties.length) {
|
||
this.k = true;
|
||
} else {
|
||
this.getValue(true);
|
||
}
|
||
};
|
||
|
||
RepeaterModifier.prototype.resetElements = function (elements) {
|
||
var i;
|
||
var len = elements.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
elements[i]._processed = false;
|
||
if (elements[i].ty === 'gr') {
|
||
this.resetElements(elements[i].it);
|
||
}
|
||
}
|
||
};
|
||
|
||
RepeaterModifier.prototype.cloneElements = function (elements) {
|
||
var newElements = JSON.parse(JSON.stringify(elements));
|
||
this.resetElements(newElements);
|
||
return newElements;
|
||
};
|
||
|
||
RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {
|
||
var i;
|
||
var len = elements.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
elements[i]._render = renderFlag;
|
||
if (elements[i].ty === 'gr') {
|
||
this.changeGroupRender(elements[i].it, renderFlag);
|
||
}
|
||
}
|
||
};
|
||
|
||
RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {
|
||
var items;
|
||
var itemsTransform;
|
||
var i;
|
||
var dir;
|
||
var cont;
|
||
var hasReloaded = false;
|
||
if (this._mdf || _isFirstFrame) {
|
||
var copies = Math.ceil(this.c.v);
|
||
if (this._groups.length < copies) {
|
||
while (this._groups.length < copies) {
|
||
var group = {
|
||
it: this.cloneElements(this._elements),
|
||
ty: 'gr',
|
||
};
|
||
group.it.push({
|
||
a: { a: 0, ix: 1, k: [0, 0] }, nm: 'Transform', o: { a: 0, ix: 7, k: 100 }, p: { a: 0, ix: 2, k: [0, 0] }, r: { a: 1, ix: 6, k: [{ s: 0, e: 0, t: 0 }, { s: 0, e: 0, t: 1 }] }, s: { a: 0, ix: 3, k: [100, 100] }, sa: { a: 0, ix: 5, k: 0 }, sk: { a: 0, ix: 4, k: 0 }, ty: 'tr',
|
||
});
|
||
|
||
this.arr.splice(0, 0, group);
|
||
this._groups.splice(0, 0, group);
|
||
this._currentCopies += 1;
|
||
}
|
||
this.elem.reloadShapes();
|
||
hasReloaded = true;
|
||
}
|
||
cont = 0;
|
||
var renderFlag;
|
||
for (i = 0; i <= this._groups.length - 1; i += 1) {
|
||
renderFlag = cont < copies;
|
||
this._groups[i]._render = renderFlag;
|
||
this.changeGroupRender(this._groups[i].it, renderFlag);
|
||
if (!renderFlag) {
|
||
var elems = this.elemsData[i].it;
|
||
var transformData = elems[elems.length - 1];
|
||
if (transformData.transform.op.v !== 0) {
|
||
transformData.transform.op._mdf = true;
|
||
transformData.transform.op.v = 0;
|
||
} else {
|
||
transformData.transform.op._mdf = false;
|
||
}
|
||
}
|
||
cont += 1;
|
||
}
|
||
|
||
this._currentCopies = copies;
|
||
/// /
|
||
|
||
var offset = this.o.v;
|
||
var offsetModulo = offset % 1;
|
||
var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);
|
||
var pProps = this.pMatrix.props;
|
||
var rProps = this.rMatrix.props;
|
||
var sProps = this.sMatrix.props;
|
||
this.pMatrix.reset();
|
||
this.rMatrix.reset();
|
||
this.sMatrix.reset();
|
||
this.tMatrix.reset();
|
||
this.matrix.reset();
|
||
var iteration = 0;
|
||
|
||
if (offset > 0) {
|
||
while (iteration < roundOffset) {
|
||
this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
|
||
iteration += 1;
|
||
}
|
||
if (offsetModulo) {
|
||
this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);
|
||
iteration += offsetModulo;
|
||
}
|
||
} else if (offset < 0) {
|
||
while (iteration > roundOffset) {
|
||
this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);
|
||
iteration -= 1;
|
||
}
|
||
if (offsetModulo) {
|
||
this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true);
|
||
iteration -= offsetModulo;
|
||
}
|
||
}
|
||
i = this.data.m === 1 ? 0 : this._currentCopies - 1;
|
||
dir = this.data.m === 1 ? 1 : -1;
|
||
cont = this._currentCopies;
|
||
var j;
|
||
var jLen;
|
||
while (cont) {
|
||
items = this.elemsData[i].it;
|
||
itemsTransform = items[items.length - 1].transform.mProps.v.props;
|
||
jLen = itemsTransform.length;
|
||
items[items.length - 1].transform.mProps._mdf = true;
|
||
items[items.length - 1].transform.op._mdf = true;
|
||
items[items.length - 1].transform.op.v = this._currentCopies === 1
|
||
? this.so.v
|
||
: this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));
|
||
|
||
if (iteration !== 0) {
|
||
if ((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)) {
|
||
this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
|
||
}
|
||
this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]);
|
||
this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]);
|
||
this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]);
|
||
|
||
for (j = 0; j < jLen; j += 1) {
|
||
itemsTransform[j] = this.matrix.props[j];
|
||
}
|
||
this.matrix.reset();
|
||
} else {
|
||
this.matrix.reset();
|
||
for (j = 0; j < jLen; j += 1) {
|
||
itemsTransform[j] = this.matrix.props[j];
|
||
}
|
||
}
|
||
iteration += 1;
|
||
cont -= 1;
|
||
i += dir;
|
||
}
|
||
} else {
|
||
cont = this._currentCopies;
|
||
i = 0;
|
||
dir = 1;
|
||
while (cont) {
|
||
items = this.elemsData[i].it;
|
||
itemsTransform = items[items.length - 1].transform.mProps.v.props;
|
||
items[items.length - 1].transform.mProps._mdf = false;
|
||
items[items.length - 1].transform.op._mdf = false;
|
||
cont -= 1;
|
||
i += dir;
|
||
}
|
||
}
|
||
return hasReloaded;
|
||
};
|
||
|
||
RepeaterModifier.prototype.addShape = function () {};
|
||
|
||
ShapeModifiers.registerModifier('rp', RepeaterModifier);
|
||
|
||
/* global createSizedArray, shapePool */
|
||
|
||
function ShapeCollection() {
|
||
this._length = 0;
|
||
this._maxLength = 4;
|
||
this.shapes = createSizedArray(this._maxLength);
|
||
}
|
||
|
||
ShapeCollection.prototype.addShape = function (shapeData) {
|
||
if (this._length === this._maxLength) {
|
||
this.shapes = this.shapes.concat(createSizedArray(this._maxLength));
|
||
this._maxLength *= 2;
|
||
}
|
||
this.shapes[this._length] = shapeData;
|
||
this._length += 1;
|
||
};
|
||
|
||
ShapeCollection.prototype.releaseShapes = function () {
|
||
var i;
|
||
for (i = 0; i < this._length; i += 1) {
|
||
shapePool.release(this.shapes[i]);
|
||
}
|
||
this._length = 0;
|
||
};
|
||
|
||
/* global createSizedArray, createTypedArray, PropertyFactory, extendPrototype, DynamicPropertyContainer */
|
||
|
||
function DashProperty(elem, data, renderer, container) {
|
||
this.elem = elem;
|
||
this.frameId = -1;
|
||
this.dataProps = createSizedArray(data.length);
|
||
this.renderer = renderer;
|
||
this.k = false;
|
||
this.dashStr = '';
|
||
this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);
|
||
this.dashoffset = createTypedArray('float32', 1);
|
||
this.initDynamicPropertyContainer(container);
|
||
var i;
|
||
var len = data.length || 0;
|
||
var prop;
|
||
for (i = 0; i < len; i += 1) {
|
||
prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this);
|
||
this.k = prop.k || this.k;
|
||
this.dataProps[i] = { n: data[i].n, p: prop };
|
||
}
|
||
if (!this.k) {
|
||
this.getValue(true);
|
||
}
|
||
this._isAnimated = this.k;
|
||
}
|
||
|
||
DashProperty.prototype.getValue = function (forceRender) {
|
||
if (this.elem.globalData.frameId === this.frameId && !forceRender) {
|
||
return;
|
||
}
|
||
this.frameId = this.elem.globalData.frameId;
|
||
this.iterateDynamicProperties();
|
||
this._mdf = this._mdf || forceRender;
|
||
if (this._mdf) {
|
||
var i = 0;
|
||
var len = this.dataProps.length;
|
||
if (this.renderer === 'svg') {
|
||
this.dashStr = '';
|
||
}
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.dataProps[i].n !== 'o') {
|
||
if (this.renderer === 'svg') {
|
||
this.dashStr += ' ' + this.dataProps[i].p.v;
|
||
} else {
|
||
this.dashArray[i] = this.dataProps[i].p.v;
|
||
}
|
||
} else {
|
||
this.dashoffset[0] = this.dataProps[i].p.v;
|
||
}
|
||
}
|
||
}
|
||
};
|
||
extendPrototype([DynamicPropertyContainer], DashProperty);
|
||
|
||
/* global createTypedArray, PropertyFactory, extendPrototype, DynamicPropertyContainer */
|
||
function GradientProperty(elem, data, container) {
|
||
this.data = data;
|
||
this.c = createTypedArray('uint8c', data.p * 4);
|
||
var cLength = data.k.k[0].s ? (data.k.k[0].s.length - data.p * 4) : data.k.k.length - data.p * 4;
|
||
this.o = createTypedArray('float32', cLength);
|
||
this._cmdf = false;
|
||
this._omdf = false;
|
||
this._collapsable = this.checkCollapsable();
|
||
this._hasOpacity = cLength;
|
||
this.initDynamicPropertyContainer(container);
|
||
this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this);
|
||
this.k = this.prop.k;
|
||
this.getValue(true);
|
||
}
|
||
|
||
GradientProperty.prototype.comparePoints = function (values, points) {
|
||
var i = 0;
|
||
var len = this.o.length / 2;
|
||
var diff;
|
||
while (i < len) {
|
||
diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]);
|
||
if (diff > 0.01) {
|
||
return false;
|
||
}
|
||
i += 1;
|
||
}
|
||
return true;
|
||
};
|
||
|
||
GradientProperty.prototype.checkCollapsable = function () {
|
||
if (this.o.length / 2 !== this.c.length / 4) {
|
||
return false;
|
||
}
|
||
if (this.data.k.k[0].s) {
|
||
var i = 0;
|
||
var len = this.data.k.k.length;
|
||
while (i < len) {
|
||
if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {
|
||
return false;
|
||
}
|
||
i += 1;
|
||
}
|
||
} else if (!this.comparePoints(this.data.k.k, this.data.p)) {
|
||
return false;
|
||
}
|
||
return true;
|
||
};
|
||
|
||
GradientProperty.prototype.getValue = function (forceRender) {
|
||
this.prop.getValue();
|
||
this._mdf = false;
|
||
this._cmdf = false;
|
||
this._omdf = false;
|
||
if (this.prop._mdf || forceRender) {
|
||
var i;
|
||
var len = this.data.p * 4;
|
||
var mult;
|
||
var val;
|
||
for (i = 0; i < len; i += 1) {
|
||
mult = i % 4 === 0 ? 100 : 255;
|
||
val = Math.round(this.prop.v[i] * mult);
|
||
if (this.c[i] !== val) {
|
||
this.c[i] = val;
|
||
this._cmdf = !forceRender;
|
||
}
|
||
}
|
||
if (this.o.length) {
|
||
len = this.prop.v.length;
|
||
for (i = this.data.p * 4; i < len; i += 1) {
|
||
mult = i % 2 === 0 ? 100 : 1;
|
||
val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i];
|
||
if (this.o[i - this.data.p * 4] !== val) {
|
||
this.o[i - this.data.p * 4] = val;
|
||
this._omdf = !forceRender;
|
||
}
|
||
}
|
||
}
|
||
this._mdf = !forceRender;
|
||
}
|
||
};
|
||
|
||
extendPrototype([DynamicPropertyContainer], GradientProperty);
|
||
|
||
/* exported buildShapeString */
|
||
|
||
var buildShapeString = function (pathNodes, length, closed, mat) {
|
||
if (length === 0) {
|
||
return '';
|
||
}
|
||
var _o = pathNodes.o;
|
||
var _i = pathNodes.i;
|
||
var _v = pathNodes.v;
|
||
var i;
|
||
var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1]);
|
||
for (i = 1; i < length; i += 1) {
|
||
shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[i][0], _i[i][1]) + ' ' + mat.applyToPointStringified(_v[i][0], _v[i][1]);
|
||
}
|
||
if (closed && length) {
|
||
shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[0][0], _i[0][1]) + ' ' + mat.applyToPointStringified(_v[0][0], _v[0][1]);
|
||
shapeString += 'z';
|
||
}
|
||
return shapeString;
|
||
};
|
||
|
||
/* global Howl */
|
||
/* exported audioControllerFactory */
|
||
|
||
var audioControllerFactory = (function () {
|
||
function AudioController(audioFactory) {
|
||
this.audios = [];
|
||
this.audioFactory = audioFactory;
|
||
this._volume = 1;
|
||
this._isMuted = false;
|
||
}
|
||
|
||
AudioController.prototype = {
|
||
addAudio: function (audio) {
|
||
this.audios.push(audio);
|
||
},
|
||
pause: function () {
|
||
var i;
|
||
var len = this.audios.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.audios[i].pause();
|
||
}
|
||
},
|
||
resume: function () {
|
||
var i;
|
||
var len = this.audios.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.audios[i].resume();
|
||
}
|
||
},
|
||
setRate: function (rateValue) {
|
||
var i;
|
||
var len = this.audios.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.audios[i].setRate(rateValue);
|
||
}
|
||
},
|
||
createAudio: function (assetPath) {
|
||
if (this.audioFactory) {
|
||
return this.audioFactory(assetPath);
|
||
} if (Howl) {
|
||
return new Howl({
|
||
src: [assetPath],
|
||
});
|
||
}
|
||
return {
|
||
isPlaying: false,
|
||
play: function () { this.isPlaying = true; },
|
||
seek: function () { this.isPlaying = false; },
|
||
playing: function () {},
|
||
rate: function () {},
|
||
setVolume: function () {},
|
||
};
|
||
},
|
||
setAudioFactory: function (audioFactory) {
|
||
this.audioFactory = audioFactory;
|
||
},
|
||
setVolume: function (value) {
|
||
this._volume = value;
|
||
this._updateVolume();
|
||
},
|
||
mute: function () {
|
||
this._isMuted = true;
|
||
this._updateVolume();
|
||
},
|
||
unmute: function () {
|
||
this._isMuted = false;
|
||
this._updateVolume();
|
||
},
|
||
getVolume: function () {
|
||
return this._volume;
|
||
},
|
||
_updateVolume: function () {
|
||
var i;
|
||
var len = this.audios.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1));
|
||
}
|
||
},
|
||
};
|
||
|
||
return function () {
|
||
return new AudioController();
|
||
};
|
||
}());
|
||
|
||
/* global createTag, createNS, isSafari, assetLoader */
|
||
/* exported ImagePreloader */
|
||
|
||
var ImagePreloader = (function () {
|
||
var proxyImage = (function () {
|
||
var canvas = createTag('canvas');
|
||
canvas.width = 1;
|
||
canvas.height = 1;
|
||
var ctx = canvas.getContext('2d');
|
||
ctx.fillStyle = 'rgba(0,0,0,0)';
|
||
ctx.fillRect(0, 0, 1, 1);
|
||
return canvas;
|
||
}());
|
||
|
||
function imageLoaded() {
|
||
this.loadedAssets += 1;
|
||
if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {
|
||
if (this.imagesLoadedCb) {
|
||
this.imagesLoadedCb(null);
|
||
}
|
||
}
|
||
}
|
||
function footageLoaded() {
|
||
this.loadedFootagesCount += 1;
|
||
if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {
|
||
if (this.imagesLoadedCb) {
|
||
this.imagesLoadedCb(null);
|
||
}
|
||
}
|
||
}
|
||
|
||
function getAssetsPath(assetData, assetsPath, originalPath) {
|
||
var path = '';
|
||
if (assetData.e) {
|
||
path = assetData.p;
|
||
} else if (assetsPath) {
|
||
var imagePath = assetData.p;
|
||
if (imagePath.indexOf('images/') !== -1) {
|
||
imagePath = imagePath.split('/')[1];
|
||
}
|
||
path = assetsPath + imagePath;
|
||
} else {
|
||
path = originalPath;
|
||
path += assetData.u ? assetData.u : '';
|
||
path += assetData.p;
|
||
}
|
||
return path;
|
||
}
|
||
|
||
function testImageLoaded(img) {
|
||
var _count = 0;
|
||
var intervalId = setInterval(function () {
|
||
var box = img.getBBox();
|
||
if (box.width || _count > 500) {
|
||
this._imageLoaded();
|
||
clearInterval(intervalId);
|
||
}
|
||
_count += 1;
|
||
}.bind(this), 50);
|
||
}
|
||
|
||
function createImageData(assetData) {
|
||
var path = getAssetsPath(assetData, this.assetsPath, this.path);
|
||
var img = createNS('image');
|
||
if (isSafari) {
|
||
this.testImageLoaded(img);
|
||
} else {
|
||
img.addEventListener('load', this._imageLoaded, false);
|
||
}
|
||
img.addEventListener('error', function () {
|
||
ob.img = proxyImage;
|
||
this._imageLoaded();
|
||
}.bind(this), false);
|
||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);
|
||
if (this._elementHelper.append) {
|
||
this._elementHelper.append(img);
|
||
} else {
|
||
this._elementHelper.appendChild(img);
|
||
}
|
||
var ob = {
|
||
img: img,
|
||
assetData: assetData,
|
||
};
|
||
return ob;
|
||
}
|
||
|
||
function createImgData(assetData) {
|
||
var path = getAssetsPath(assetData, this.assetsPath, this.path);
|
||
var img = createTag('img');
|
||
img.crossOrigin = 'anonymous';
|
||
img.addEventListener('load', this._imageLoaded, false);
|
||
img.addEventListener('error', function () {
|
||
ob.img = proxyImage;
|
||
this._imageLoaded();
|
||
}.bind(this), false);
|
||
img.src = path;
|
||
var ob = {
|
||
img: img,
|
||
assetData: assetData,
|
||
};
|
||
return ob;
|
||
}
|
||
|
||
function createFootageData(data) {
|
||
var ob = {
|
||
assetData: data,
|
||
};
|
||
var path = getAssetsPath(data, this.assetsPath, this.path);
|
||
assetLoader.load(path, function (footageData) {
|
||
ob.img = footageData;
|
||
this._footageLoaded();
|
||
}.bind(this), function () {
|
||
ob.img = {};
|
||
this._footageLoaded();
|
||
}.bind(this));
|
||
return ob;
|
||
}
|
||
|
||
function loadAssets(assets, cb) {
|
||
this.imagesLoadedCb = cb;
|
||
var i;
|
||
var len = assets.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (!assets[i].layers) {
|
||
if (!assets[i].t || assets[i].t === 'seq') {
|
||
this.totalImages += 1;
|
||
this.images.push(this._createImageData(assets[i]));
|
||
} else if (assets[i].t === 3) {
|
||
this.totalFootages += 1;
|
||
this.images.push(this.createFootageData(assets[i]));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function setPath(path) {
|
||
this.path = path || '';
|
||
}
|
||
|
||
function setAssetsPath(path) {
|
||
this.assetsPath = path || '';
|
||
}
|
||
|
||
function getAsset(assetData) {
|
||
var i = 0;
|
||
var len = this.images.length;
|
||
while (i < len) {
|
||
if (this.images[i].assetData === assetData) {
|
||
return this.images[i].img;
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
function destroy() {
|
||
this.imagesLoadedCb = null;
|
||
this.images.length = 0;
|
||
}
|
||
|
||
function loadedImages() {
|
||
return this.totalImages === this.loadedAssets;
|
||
}
|
||
|
||
function loadedFootages() {
|
||
return this.totalFootages === this.loadedFootagesCount;
|
||
}
|
||
|
||
function setCacheType(type, elementHelper) {
|
||
if (type === 'svg') {
|
||
this._elementHelper = elementHelper;
|
||
this._createImageData = this.createImageData.bind(this);
|
||
} else {
|
||
this._createImageData = this.createImgData.bind(this);
|
||
}
|
||
}
|
||
|
||
function ImagePreloaderFactory() {
|
||
this._imageLoaded = imageLoaded.bind(this);
|
||
this._footageLoaded = footageLoaded.bind(this);
|
||
this.testImageLoaded = testImageLoaded.bind(this);
|
||
this.createFootageData = createFootageData.bind(this);
|
||
this.assetsPath = '';
|
||
this.path = '';
|
||
this.totalImages = 0;
|
||
this.totalFootages = 0;
|
||
this.loadedAssets = 0;
|
||
this.loadedFootagesCount = 0;
|
||
this.imagesLoadedCb = null;
|
||
this.images = [];
|
||
}
|
||
|
||
ImagePreloaderFactory.prototype = {
|
||
loadAssets: loadAssets,
|
||
setAssetsPath: setAssetsPath,
|
||
setPath: setPath,
|
||
loadedImages: loadedImages,
|
||
loadedFootages: loadedFootages,
|
||
destroy: destroy,
|
||
getAsset: getAsset,
|
||
createImgData: createImgData,
|
||
createImageData: createImageData,
|
||
imageLoaded: imageLoaded,
|
||
footageLoaded: footageLoaded,
|
||
setCacheType: setCacheType,
|
||
};
|
||
|
||
return ImagePreloaderFactory;
|
||
}());
|
||
|
||
/* exported featureSupport */
|
||
|
||
var featureSupport = (function () {
|
||
var ob = {
|
||
maskType: true,
|
||
};
|
||
if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) {
|
||
ob.maskType = false;
|
||
}
|
||
return ob;
|
||
}());
|
||
|
||
/* global createNS */
|
||
/* exported filtersFactory */
|
||
|
||
var filtersFactory = (function () {
|
||
var ob = {};
|
||
ob.createFilter = createFilter;
|
||
ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;
|
||
|
||
function createFilter(filId, skipCoordinates) {
|
||
var fil = createNS('filter');
|
||
fil.setAttribute('id', filId);
|
||
if (skipCoordinates !== true) {
|
||
fil.setAttribute('filterUnits', 'objectBoundingBox');
|
||
fil.setAttribute('x', '0%');
|
||
fil.setAttribute('y', '0%');
|
||
fil.setAttribute('width', '100%');
|
||
fil.setAttribute('height', '100%');
|
||
}
|
||
return fil;
|
||
}
|
||
|
||
function createAlphaToLuminanceFilter() {
|
||
var feColorMatrix = createNS('feColorMatrix');
|
||
feColorMatrix.setAttribute('type', 'matrix');
|
||
feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
|
||
feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1');
|
||
return feColorMatrix;
|
||
}
|
||
|
||
return ob;
|
||
}());
|
||
|
||
/* exported assetLoader */
|
||
|
||
var assetLoader = (function () {
|
||
function formatResponse(xhr) {
|
||
if (xhr.response && typeof xhr.response === 'object') {
|
||
return xhr.response;
|
||
} if (xhr.response && typeof xhr.response === 'string') {
|
||
return JSON.parse(xhr.response);
|
||
} if (xhr.responseText) {
|
||
return JSON.parse(xhr.responseText);
|
||
}
|
||
return null;
|
||
}
|
||
|
||
function loadAsset(path, callback, errorCallback) {
|
||
var response;
|
||
var xhr = new XMLHttpRequest();
|
||
// set responseType after calling open or IE will break.
|
||
try {
|
||
// This crashes on Android WebView prior to KitKat
|
||
xhr.responseType = 'json';
|
||
} catch (err) {} // eslint-disable-line no-empty
|
||
xhr.onreadystatechange = function () {
|
||
if (xhr.readyState === 4) {
|
||
if (xhr.status === 200) {
|
||
response = formatResponse(xhr);
|
||
callback(response);
|
||
} else {
|
||
try {
|
||
response = formatResponse(xhr);
|
||
callback(response);
|
||
} catch (err) {
|
||
if (errorCallback) {
|
||
errorCallback(err);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
xhr.open('GET', path, true);
|
||
xhr.send();
|
||
}
|
||
return {
|
||
load: loadAsset,
|
||
};
|
||
}());
|
||
|
||
/* global createSizedArray, PropertyFactory, TextAnimatorDataProperty, bez, addHueToRGB,
|
||
addSaturationToRGB, addBrightnessToRGB, LetterProps, Matrix, extendPrototype, DynamicPropertyContainer */
|
||
|
||
function TextAnimatorProperty(textData, renderType, elem) {
|
||
this._isFirstFrame = true;
|
||
this._hasMaskedPath = false;
|
||
this._frameId = -1;
|
||
this._textData = textData;
|
||
this._renderType = renderType;
|
||
this._elem = elem;
|
||
this._animatorsData = createSizedArray(this._textData.a.length);
|
||
this._pathData = {};
|
||
this._moreOptions = {
|
||
alignment: {},
|
||
};
|
||
this.renderedLetters = [];
|
||
this.lettersChangedFlag = false;
|
||
this.initDynamicPropertyContainer(elem);
|
||
}
|
||
|
||
TextAnimatorProperty.prototype.searchProperties = function () {
|
||
var i;
|
||
var len = this._textData.a.length;
|
||
var animatorProps;
|
||
var getProp = PropertyFactory.getProp;
|
||
for (i = 0; i < len; i += 1) {
|
||
animatorProps = this._textData.a[i];
|
||
this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);
|
||
}
|
||
if (this._textData.p && 'm' in this._textData.p) {
|
||
this._pathData = {
|
||
f: getProp(this._elem, this._textData.p.f, 0, 0, this),
|
||
l: getProp(this._elem, this._textData.p.l, 0, 0, this),
|
||
r: this._textData.p.r,
|
||
m: this._elem.maskManager.getMaskProperty(this._textData.p.m),
|
||
};
|
||
this._hasMaskedPath = true;
|
||
} else {
|
||
this._hasMaskedPath = false;
|
||
}
|
||
this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this);
|
||
};
|
||
|
||
TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {
|
||
this.lettersChangedFlag = lettersChangedFlag;
|
||
if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {
|
||
return;
|
||
}
|
||
this._isFirstFrame = false;
|
||
var alignment = this._moreOptions.alignment.v;
|
||
var animators = this._animatorsData;
|
||
var textData = this._textData;
|
||
var matrixHelper = this.mHelper;
|
||
var renderType = this._renderType;
|
||
var renderedLettersCount = this.renderedLetters.length;
|
||
var xPos;
|
||
var yPos;
|
||
var i;
|
||
var len;
|
||
var letters = documentData.l;
|
||
var pathInfo;
|
||
var currentLength;
|
||
var currentPoint;
|
||
var segmentLength;
|
||
var flag;
|
||
var pointInd;
|
||
var segmentInd;
|
||
var prevPoint;
|
||
var points;
|
||
var segments;
|
||
var partialLength;
|
||
var totalLength;
|
||
var perc;
|
||
var tanAngle;
|
||
var mask;
|
||
if (this._hasMaskedPath) {
|
||
mask = this._pathData.m;
|
||
if (!this._pathData.n || this._pathData._mdf) {
|
||
var paths = mask.v;
|
||
if (this._pathData.r) {
|
||
paths = paths.reverse();
|
||
}
|
||
// TODO: release bezier data cached from previous pathInfo: this._pathData.pi
|
||
pathInfo = {
|
||
tLength: 0,
|
||
segments: [],
|
||
};
|
||
len = paths._length - 1;
|
||
var bezierData;
|
||
totalLength = 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
bezierData = bez.buildBezierData(paths.v[i],
|
||
paths.v[i + 1],
|
||
[paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],
|
||
[paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);
|
||
pathInfo.tLength += bezierData.segmentLength;
|
||
pathInfo.segments.push(bezierData);
|
||
totalLength += bezierData.segmentLength;
|
||
}
|
||
i = len;
|
||
if (mask.v.c) {
|
||
bezierData = bez.buildBezierData(paths.v[i],
|
||
paths.v[0],
|
||
[paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],
|
||
[paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);
|
||
pathInfo.tLength += bezierData.segmentLength;
|
||
pathInfo.segments.push(bezierData);
|
||
totalLength += bezierData.segmentLength;
|
||
}
|
||
this._pathData.pi = pathInfo;
|
||
}
|
||
pathInfo = this._pathData.pi;
|
||
|
||
currentLength = this._pathData.f.v;
|
||
segmentInd = 0;
|
||
pointInd = 1;
|
||
segmentLength = 0;
|
||
flag = true;
|
||
segments = pathInfo.segments;
|
||
if (currentLength < 0 && mask.v.c) {
|
||
if (pathInfo.tLength < Math.abs(currentLength)) {
|
||
currentLength = -Math.abs(currentLength) % pathInfo.tLength;
|
||
}
|
||
segmentInd = segments.length - 1;
|
||
points = segments[segmentInd].points;
|
||
pointInd = points.length - 1;
|
||
while (currentLength < 0) {
|
||
currentLength += points[pointInd].partialLength;
|
||
pointInd -= 1;
|
||
if (pointInd < 0) {
|
||
segmentInd -= 1;
|
||
points = segments[segmentInd].points;
|
||
pointInd = points.length - 1;
|
||
}
|
||
}
|
||
}
|
||
points = segments[segmentInd].points;
|
||
prevPoint = points[pointInd - 1];
|
||
currentPoint = points[pointInd];
|
||
partialLength = currentPoint.partialLength;
|
||
}
|
||
|
||
len = letters.length;
|
||
xPos = 0;
|
||
yPos = 0;
|
||
var yOff = documentData.finalSize * 1.2 * 0.714;
|
||
var firstLine = true;
|
||
var animatorProps;
|
||
var animatorSelector;
|
||
var j;
|
||
var jLen;
|
||
var letterValue;
|
||
|
||
jLen = animators.length;
|
||
|
||
var mult;
|
||
var ind = -1;
|
||
var offf;
|
||
var xPathPos;
|
||
var yPathPos;
|
||
var initPathPos = currentLength;
|
||
var initSegmentInd = segmentInd;
|
||
var initPointInd = pointInd;
|
||
var currentLine = -1;
|
||
var elemOpacity;
|
||
var sc;
|
||
var sw;
|
||
var fc;
|
||
var k;
|
||
var letterSw;
|
||
var letterSc;
|
||
var letterFc;
|
||
var letterM = '';
|
||
var letterP = this.defaultPropsArray;
|
||
var letterO;
|
||
|
||
//
|
||
if (documentData.j === 2 || documentData.j === 1) {
|
||
var animatorJustifyOffset = 0;
|
||
var animatorFirstCharOffset = 0;
|
||
var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;
|
||
var lastIndex = 0;
|
||
var isNewLine = true;
|
||
|
||
for (i = 0; i < len; i += 1) {
|
||
if (letters[i].n) {
|
||
if (animatorJustifyOffset) {
|
||
animatorJustifyOffset += animatorFirstCharOffset;
|
||
}
|
||
while (lastIndex < i) {
|
||
letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
|
||
lastIndex += 1;
|
||
}
|
||
animatorJustifyOffset = 0;
|
||
isNewLine = true;
|
||
} else {
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorProps = animators[j].a;
|
||
if (animatorProps.t.propType) {
|
||
if (isNewLine && documentData.j === 2) {
|
||
animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;
|
||
}
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
if (mult.length) {
|
||
animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult;
|
||
} else {
|
||
animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult;
|
||
}
|
||
}
|
||
}
|
||
isNewLine = false;
|
||
}
|
||
}
|
||
if (animatorJustifyOffset) {
|
||
animatorJustifyOffset += animatorFirstCharOffset;
|
||
}
|
||
while (lastIndex < i) {
|
||
letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
|
||
lastIndex += 1;
|
||
}
|
||
}
|
||
//
|
||
|
||
for (i = 0; i < len; i += 1) {
|
||
matrixHelper.reset();
|
||
elemOpacity = 1;
|
||
if (letters[i].n) {
|
||
xPos = 0;
|
||
yPos += documentData.yOffset;
|
||
yPos += firstLine ? 1 : 0;
|
||
currentLength = initPathPos;
|
||
firstLine = false;
|
||
if (this._hasMaskedPath) {
|
||
segmentInd = initSegmentInd;
|
||
pointInd = initPointInd;
|
||
points = segments[segmentInd].points;
|
||
prevPoint = points[pointInd - 1];
|
||
currentPoint = points[pointInd];
|
||
partialLength = currentPoint.partialLength;
|
||
segmentLength = 0;
|
||
}
|
||
letterM = '';
|
||
letterFc = '';
|
||
letterSw = '';
|
||
letterO = '';
|
||
letterP = this.defaultPropsArray;
|
||
} else {
|
||
if (this._hasMaskedPath) {
|
||
if (currentLine !== letters[i].line) {
|
||
switch (documentData.j) {
|
||
case 1:
|
||
currentLength += totalLength - documentData.lineWidths[letters[i].line];
|
||
break;
|
||
case 2:
|
||
currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
currentLine = letters[i].line;
|
||
}
|
||
if (ind !== letters[i].ind) {
|
||
if (letters[ind]) {
|
||
currentLength += letters[ind].extra;
|
||
}
|
||
currentLength += letters[i].an / 2;
|
||
ind = letters[i].ind;
|
||
}
|
||
currentLength += (alignment[0] * letters[i].an) * 0.005;
|
||
var animatorOffset = 0;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorProps = animators[j].a;
|
||
if (animatorProps.p.propType) {
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
if (mult.length) {
|
||
animatorOffset += animatorProps.p.v[0] * mult[0];
|
||
} else {
|
||
animatorOffset += animatorProps.p.v[0] * mult;
|
||
}
|
||
}
|
||
if (animatorProps.a.propType) {
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
if (mult.length) {
|
||
animatorOffset += animatorProps.a.v[0] * mult[0];
|
||
} else {
|
||
animatorOffset += animatorProps.a.v[0] * mult;
|
||
}
|
||
}
|
||
}
|
||
flag = true;
|
||
while (flag) {
|
||
if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {
|
||
perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;
|
||
xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;
|
||
yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;
|
||
matrixHelper.translate((-alignment[0] * letters[i].an) * 0.005, -(alignment[1] * yOff) * 0.01);
|
||
flag = false;
|
||
} else if (points) {
|
||
segmentLength += currentPoint.partialLength;
|
||
pointInd += 1;
|
||
if (pointInd >= points.length) {
|
||
pointInd = 0;
|
||
segmentInd += 1;
|
||
if (!segments[segmentInd]) {
|
||
if (mask.v.c) {
|
||
pointInd = 0;
|
||
segmentInd = 0;
|
||
points = segments[segmentInd].points;
|
||
} else {
|
||
segmentLength -= currentPoint.partialLength;
|
||
points = null;
|
||
}
|
||
} else {
|
||
points = segments[segmentInd].points;
|
||
}
|
||
}
|
||
if (points) {
|
||
prevPoint = currentPoint;
|
||
currentPoint = points[pointInd];
|
||
partialLength = currentPoint.partialLength;
|
||
}
|
||
}
|
||
}
|
||
offf = letters[i].an / 2 - letters[i].add;
|
||
matrixHelper.translate(-offf, 0, 0);
|
||
} else {
|
||
offf = letters[i].an / 2 - letters[i].add;
|
||
matrixHelper.translate(-offf, 0, 0);
|
||
|
||
// Grouping alignment
|
||
matrixHelper.translate((-alignment[0] * letters[i].an) * 0.005, (-alignment[1] * yOff) * 0.01, 0);
|
||
}
|
||
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorProps = animators[j].a;
|
||
if (animatorProps.t.propType) {
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
// This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean "isNewLine"
|
||
if (xPos !== 0 || documentData.j !== 0) {
|
||
if (this._hasMaskedPath) {
|
||
if (mult.length) {
|
||
currentLength += animatorProps.t.v * mult[0];
|
||
} else {
|
||
currentLength += animatorProps.t.v * mult;
|
||
}
|
||
} else if (mult.length) {
|
||
xPos += animatorProps.t.v * mult[0];
|
||
} else {
|
||
xPos += animatorProps.t.v * mult;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (documentData.strokeWidthAnim) {
|
||
sw = documentData.sw || 0;
|
||
}
|
||
if (documentData.strokeColorAnim) {
|
||
if (documentData.sc) {
|
||
sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];
|
||
} else {
|
||
sc = [0, 0, 0];
|
||
}
|
||
}
|
||
if (documentData.fillColorAnim && documentData.fc) {
|
||
fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];
|
||
}
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorProps = animators[j].a;
|
||
if (animatorProps.a.propType) {
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
|
||
if (mult.length) {
|
||
matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]);
|
||
} else {
|
||
matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult);
|
||
}
|
||
}
|
||
}
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorProps = animators[j].a;
|
||
if (animatorProps.s.propType) {
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
if (mult.length) {
|
||
matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult[0]), 1 + ((animatorProps.s.v[1] - 1) * mult[1]), 1);
|
||
} else {
|
||
matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult), 1 + ((animatorProps.s.v[1] - 1) * mult), 1);
|
||
}
|
||
}
|
||
}
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorProps = animators[j].a;
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
if (animatorProps.sk.propType) {
|
||
if (mult.length) {
|
||
matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);
|
||
} else {
|
||
matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);
|
||
}
|
||
}
|
||
if (animatorProps.r.propType) {
|
||
if (mult.length) {
|
||
matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);
|
||
} else {
|
||
matrixHelper.rotateZ(-animatorProps.r.v * mult);
|
||
}
|
||
}
|
||
if (animatorProps.ry.propType) {
|
||
if (mult.length) {
|
||
matrixHelper.rotateY(animatorProps.ry.v * mult[1]);
|
||
} else {
|
||
matrixHelper.rotateY(animatorProps.ry.v * mult);
|
||
}
|
||
}
|
||
if (animatorProps.rx.propType) {
|
||
if (mult.length) {
|
||
matrixHelper.rotateX(animatorProps.rx.v * mult[0]);
|
||
} else {
|
||
matrixHelper.rotateX(animatorProps.rx.v * mult);
|
||
}
|
||
}
|
||
if (animatorProps.o.propType) {
|
||
if (mult.length) {
|
||
elemOpacity += ((animatorProps.o.v) * mult[0] - elemOpacity) * mult[0];
|
||
} else {
|
||
elemOpacity += ((animatorProps.o.v) * mult - elemOpacity) * mult;
|
||
}
|
||
}
|
||
if (documentData.strokeWidthAnim && animatorProps.sw.propType) {
|
||
if (mult.length) {
|
||
sw += animatorProps.sw.v * mult[0];
|
||
} else {
|
||
sw += animatorProps.sw.v * mult;
|
||
}
|
||
}
|
||
if (documentData.strokeColorAnim && animatorProps.sc.propType) {
|
||
for (k = 0; k < 3; k += 1) {
|
||
if (mult.length) {
|
||
sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0];
|
||
} else {
|
||
sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult;
|
||
}
|
||
}
|
||
}
|
||
if (documentData.fillColorAnim && documentData.fc) {
|
||
if (animatorProps.fc.propType) {
|
||
for (k = 0; k < 3; k += 1) {
|
||
if (mult.length) {
|
||
fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0];
|
||
} else {
|
||
fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult;
|
||
}
|
||
}
|
||
}
|
||
if (animatorProps.fh.propType) {
|
||
if (mult.length) {
|
||
fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]);
|
||
} else {
|
||
fc = addHueToRGB(fc, animatorProps.fh.v * mult);
|
||
}
|
||
}
|
||
if (animatorProps.fs.propType) {
|
||
if (mult.length) {
|
||
fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]);
|
||
} else {
|
||
fc = addSaturationToRGB(fc, animatorProps.fs.v * mult);
|
||
}
|
||
}
|
||
if (animatorProps.fb.propType) {
|
||
if (mult.length) {
|
||
fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]);
|
||
} else {
|
||
fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorProps = animators[j].a;
|
||
|
||
if (animatorProps.p.propType) {
|
||
animatorSelector = animators[j].s;
|
||
mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
||
if (this._hasMaskedPath) {
|
||
if (mult.length) {
|
||
matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);
|
||
} else {
|
||
matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
|
||
}
|
||
} else if (mult.length) {
|
||
matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);
|
||
} else {
|
||
matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
|
||
}
|
||
}
|
||
}
|
||
if (documentData.strokeWidthAnim) {
|
||
letterSw = sw < 0 ? 0 : sw;
|
||
}
|
||
if (documentData.strokeColorAnim) {
|
||
letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')';
|
||
}
|
||
if (documentData.fillColorAnim && documentData.fc) {
|
||
letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')';
|
||
}
|
||
|
||
if (this._hasMaskedPath) {
|
||
matrixHelper.translate(0, -documentData.ls);
|
||
|
||
matrixHelper.translate(0, (alignment[1] * yOff) * 0.01 + yPos, 0);
|
||
if (textData.p.p) {
|
||
tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);
|
||
var rot = (Math.atan(tanAngle) * 180) / Math.PI;
|
||
if (currentPoint.point[0] < prevPoint.point[0]) {
|
||
rot += 180;
|
||
}
|
||
matrixHelper.rotate((-rot * Math.PI) / 180);
|
||
}
|
||
matrixHelper.translate(xPathPos, yPathPos, 0);
|
||
currentLength -= (alignment[0] * letters[i].an) * 0.005;
|
||
if (letters[i + 1] && ind !== letters[i + 1].ind) {
|
||
currentLength += letters[i].an / 2;
|
||
currentLength += (documentData.tr * 0.001) * documentData.finalSize;
|
||
}
|
||
} else {
|
||
matrixHelper.translate(xPos, yPos, 0);
|
||
|
||
if (documentData.ps) {
|
||
// matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);
|
||
matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);
|
||
}
|
||
switch (documentData.j) {
|
||
case 1:
|
||
matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0);
|
||
break;
|
||
case 2:
|
||
matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
matrixHelper.translate(0, -documentData.ls);
|
||
matrixHelper.translate(offf, 0, 0);
|
||
matrixHelper.translate((alignment[0] * letters[i].an) * 0.005, (alignment[1] * yOff) * 0.01, 0);
|
||
xPos += letters[i].l + (documentData.tr * 0.001) * documentData.finalSize;
|
||
}
|
||
if (renderType === 'html') {
|
||
letterM = matrixHelper.toCSS();
|
||
} else if (renderType === 'svg') {
|
||
letterM = matrixHelper.to2dCSS();
|
||
} else {
|
||
letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]];
|
||
}
|
||
letterO = elemOpacity;
|
||
}
|
||
|
||
if (renderedLettersCount <= i) {
|
||
letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP);
|
||
this.renderedLetters.push(letterValue);
|
||
renderedLettersCount += 1;
|
||
this.lettersChangedFlag = true;
|
||
} else {
|
||
letterValue = this.renderedLetters[i];
|
||
this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;
|
||
}
|
||
}
|
||
};
|
||
|
||
TextAnimatorProperty.prototype.getValue = function () {
|
||
if (this._elem.globalData.frameId === this._frameId) {
|
||
return;
|
||
}
|
||
this._frameId = this._elem.globalData.frameId;
|
||
this.iterateDynamicProperties();
|
||
};
|
||
|
||
TextAnimatorProperty.prototype.mHelper = new Matrix();
|
||
TextAnimatorProperty.prototype.defaultPropsArray = [];
|
||
extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);
|
||
|
||
/* global PropertyFactory, degToRads, TextSelectorProp */
|
||
/* exported TextAnimatorDataProperty */
|
||
|
||
function TextAnimatorDataProperty(elem, animatorProps, container) {
|
||
var defaultData = { propType: false };
|
||
var getProp = PropertyFactory.getProp;
|
||
var textAnimatorAnimatables = animatorProps.a;
|
||
this.a = {
|
||
r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData,
|
||
rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData,
|
||
ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData,
|
||
sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData,
|
||
sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData,
|
||
s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData,
|
||
a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData,
|
||
o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData,
|
||
p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData,
|
||
sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData,
|
||
sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData,
|
||
fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData,
|
||
fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData,
|
||
fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData,
|
||
fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData,
|
||
t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData,
|
||
};
|
||
|
||
this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container);
|
||
this.s.t = animatorProps.s.t;
|
||
}
|
||
|
||
function LetterProps(o, sw, sc, fc, m, p) {
|
||
this.o = o;
|
||
this.sw = sw;
|
||
this.sc = sc;
|
||
this.fc = fc;
|
||
this.m = m;
|
||
this.p = p;
|
||
this._mdf = {
|
||
o: true,
|
||
sw: !!sw,
|
||
sc: !!sc,
|
||
fc: !!fc,
|
||
m: true,
|
||
p: true,
|
||
};
|
||
}
|
||
|
||
LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {
|
||
this._mdf.o = false;
|
||
this._mdf.sw = false;
|
||
this._mdf.sc = false;
|
||
this._mdf.fc = false;
|
||
this._mdf.m = false;
|
||
this._mdf.p = false;
|
||
var updated = false;
|
||
|
||
if (this.o !== o) {
|
||
this.o = o;
|
||
this._mdf.o = true;
|
||
updated = true;
|
||
}
|
||
if (this.sw !== sw) {
|
||
this.sw = sw;
|
||
this._mdf.sw = true;
|
||
updated = true;
|
||
}
|
||
if (this.sc !== sc) {
|
||
this.sc = sc;
|
||
this._mdf.sc = true;
|
||
updated = true;
|
||
}
|
||
if (this.fc !== fc) {
|
||
this.fc = fc;
|
||
this._mdf.fc = true;
|
||
updated = true;
|
||
}
|
||
if (this.m !== m) {
|
||
this.m = m;
|
||
this._mdf.m = true;
|
||
updated = true;
|
||
}
|
||
if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {
|
||
this.p = p;
|
||
this._mdf.p = true;
|
||
updated = true;
|
||
}
|
||
return updated;
|
||
};
|
||
|
||
/* global FontManager, initialDefaultFrame, getFontProperties */
|
||
/* exported TextProperty */
|
||
|
||
function TextProperty(elem, data) {
|
||
this._frameId = initialDefaultFrame;
|
||
this.pv = '';
|
||
this.v = '';
|
||
this.kf = false;
|
||
this._isFirstFrame = true;
|
||
this._mdf = false;
|
||
this.data = data;
|
||
this.elem = elem;
|
||
this.comp = this.elem.comp;
|
||
this.keysIndex = 0;
|
||
this.canResize = false;
|
||
this.minimumFontSize = 1;
|
||
this.effectsSequence = [];
|
||
this.currentData = {
|
||
ascent: 0,
|
||
boxWidth: this.defaultBoxWidth,
|
||
f: '',
|
||
fStyle: '',
|
||
fWeight: '',
|
||
fc: '',
|
||
j: '',
|
||
justifyOffset: '',
|
||
l: [],
|
||
lh: 0,
|
||
lineWidths: [],
|
||
ls: '',
|
||
of: '',
|
||
s: '',
|
||
sc: '',
|
||
sw: 0,
|
||
t: 0,
|
||
tr: 0,
|
||
sz: 0,
|
||
ps: null,
|
||
fillColorAnim: false,
|
||
strokeColorAnim: false,
|
||
strokeWidthAnim: false,
|
||
yOffset: 0,
|
||
finalSize: 0,
|
||
finalText: [],
|
||
finalLineHeight: 0,
|
||
__complete: false,
|
||
|
||
};
|
||
this.copyData(this.currentData, this.data.d.k[0].s);
|
||
|
||
if (!this.searchProperty()) {
|
||
this.completeTextData(this.currentData);
|
||
}
|
||
}
|
||
|
||
TextProperty.prototype.defaultBoxWidth = [0, 0];
|
||
|
||
TextProperty.prototype.copyData = function (obj, data) {
|
||
for (var s in data) {
|
||
if (Object.prototype.hasOwnProperty.call(data, s)) {
|
||
obj[s] = data[s];
|
||
}
|
||
}
|
||
return obj;
|
||
};
|
||
|
||
TextProperty.prototype.setCurrentData = function (data) {
|
||
if (!data.__complete) {
|
||
this.completeTextData(data);
|
||
}
|
||
this.currentData = data;
|
||
this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;
|
||
this._mdf = true;
|
||
};
|
||
|
||
TextProperty.prototype.searchProperty = function () {
|
||
return this.searchKeyframes();
|
||
};
|
||
|
||
TextProperty.prototype.searchKeyframes = function () {
|
||
this.kf = this.data.d.k.length > 1;
|
||
if (this.kf) {
|
||
this.addEffect(this.getKeyframeValue.bind(this));
|
||
}
|
||
return this.kf;
|
||
};
|
||
|
||
TextProperty.prototype.addEffect = function (effectFunction) {
|
||
this.effectsSequence.push(effectFunction);
|
||
this.elem.addDynamicProperty(this);
|
||
};
|
||
|
||
TextProperty.prototype.getValue = function (_finalValue) {
|
||
if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {
|
||
return;
|
||
}
|
||
this.currentData.t = this.data.d.k[this.keysIndex].s.t;
|
||
var currentValue = this.currentData;
|
||
var currentIndex = this.keysIndex;
|
||
if (this.lock) {
|
||
this.setCurrentData(this.currentData);
|
||
return;
|
||
}
|
||
this.lock = true;
|
||
this._mdf = false;
|
||
var i; var
|
||
len = this.effectsSequence.length;
|
||
var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;
|
||
for (i = 0; i < len; i += 1) {
|
||
// Checking if index changed to prevent creating a new object every time the expression updates.
|
||
if (currentIndex !== this.keysIndex) {
|
||
finalValue = this.effectsSequence[i](finalValue, finalValue.t);
|
||
} else {
|
||
finalValue = this.effectsSequence[i](this.currentData, finalValue.t);
|
||
}
|
||
}
|
||
if (currentValue !== finalValue) {
|
||
this.setCurrentData(finalValue);
|
||
}
|
||
this.v = this.currentData;
|
||
this.pv = this.v;
|
||
this.lock = false;
|
||
this.frameId = this.elem.globalData.frameId;
|
||
};
|
||
|
||
TextProperty.prototype.getKeyframeValue = function () {
|
||
var textKeys = this.data.d.k;
|
||
var frameNum = this.elem.comp.renderedFrame;
|
||
var i = 0; var
|
||
len = textKeys.length;
|
||
while (i <= len - 1) {
|
||
if (i === len - 1 || textKeys[i + 1].t > frameNum) {
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
if (this.keysIndex !== i) {
|
||
this.keysIndex = i;
|
||
}
|
||
return this.data.d.k[this.keysIndex].s;
|
||
};
|
||
|
||
TextProperty.prototype.buildFinalText = function (text) {
|
||
var charactersArray = [];
|
||
var i = 0;
|
||
var len = text.length;
|
||
var charCode;
|
||
var secondCharCode;
|
||
var shouldCombine = false;
|
||
while (i < len) {
|
||
charCode = text.charCodeAt(i);
|
||
if (FontManager.isCombinedCharacter(charCode)) {
|
||
charactersArray[charactersArray.length - 1] += text.charAt(i);
|
||
} else if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
||
secondCharCode = text.charCodeAt(i + 1);
|
||
if (secondCharCode >= 0xDC00 && secondCharCode <= 0xDFFF) {
|
||
if (shouldCombine || FontManager.isModifier(charCode, secondCharCode)) {
|
||
charactersArray[charactersArray.length - 1] += text.substr(i, 2);
|
||
shouldCombine = false;
|
||
} else {
|
||
charactersArray.push(text.substr(i, 2));
|
||
}
|
||
i += 1;
|
||
} else {
|
||
charactersArray.push(text.charAt(i));
|
||
}
|
||
} else if (charCode > 0xDBFF) {
|
||
secondCharCode = text.charCodeAt(i + 1);
|
||
if (FontManager.isZeroWidthJoiner(charCode, secondCharCode)) {
|
||
shouldCombine = true;
|
||
charactersArray[charactersArray.length - 1] += text.substr(i, 2);
|
||
i += 1;
|
||
} else {
|
||
charactersArray.push(text.charAt(i));
|
||
}
|
||
} else if (FontManager.isZeroWidthJoiner(charCode)) {
|
||
charactersArray[charactersArray.length - 1] += text.charAt(i);
|
||
shouldCombine = true;
|
||
} else {
|
||
charactersArray.push(text.charAt(i));
|
||
}
|
||
i += 1;
|
||
}
|
||
return charactersArray;
|
||
};
|
||
|
||
TextProperty.prototype.completeTextData = function (documentData) {
|
||
documentData.__complete = true;
|
||
var fontManager = this.elem.globalData.fontManager;
|
||
var data = this.data;
|
||
var letters = [];
|
||
var i; var
|
||
len;
|
||
var newLineFlag; var index = 0; var
|
||
val;
|
||
var anchorGrouping = data.m.g;
|
||
var currentSize = 0; var currentPos = 0; var currentLine = 0; var
|
||
lineWidths = [];
|
||
var lineWidth = 0;
|
||
var maxLineWidth = 0;
|
||
var j; var
|
||
jLen;
|
||
var fontData = fontManager.getFontByName(documentData.f);
|
||
var charData; var
|
||
cLength = 0;
|
||
|
||
var fontProps = getFontProperties(fontData);
|
||
documentData.fWeight = fontProps.weight;
|
||
documentData.fStyle = fontProps.style;
|
||
documentData.finalSize = documentData.s;
|
||
documentData.finalText = this.buildFinalText(documentData.t);
|
||
len = documentData.finalText.length;
|
||
documentData.finalLineHeight = documentData.lh;
|
||
var trackingOffset = (documentData.tr / 1000) * documentData.finalSize;
|
||
var charCode;
|
||
if (documentData.sz) {
|
||
var flag = true;
|
||
var boxWidth = documentData.sz[0];
|
||
var boxHeight = documentData.sz[1];
|
||
var currentHeight; var
|
||
finalText;
|
||
while (flag) {
|
||
finalText = this.buildFinalText(documentData.t);
|
||
currentHeight = 0;
|
||
lineWidth = 0;
|
||
len = finalText.length;
|
||
trackingOffset = (documentData.tr / 1000) * documentData.finalSize;
|
||
var lastSpaceIndex = -1;
|
||
for (i = 0; i < len; i += 1) {
|
||
charCode = finalText[i].charCodeAt(0);
|
||
newLineFlag = false;
|
||
if (finalText[i] === ' ') {
|
||
lastSpaceIndex = i;
|
||
} else if (charCode === 13 || charCode === 3) {
|
||
lineWidth = 0;
|
||
newLineFlag = true;
|
||
currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;
|
||
}
|
||
if (fontManager.chars) {
|
||
charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);
|
||
cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100;
|
||
} else {
|
||
// tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;
|
||
cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);
|
||
}
|
||
if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {
|
||
if (lastSpaceIndex === -1) {
|
||
len += 1;
|
||
} else {
|
||
i = lastSpaceIndex;
|
||
}
|
||
currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;
|
||
finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\r');
|
||
// finalText = finalText.substr(0,i) + "\r" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);
|
||
lastSpaceIndex = -1;
|
||
lineWidth = 0;
|
||
} else {
|
||
lineWidth += cLength;
|
||
lineWidth += trackingOffset;
|
||
}
|
||
}
|
||
currentHeight += (fontData.ascent * documentData.finalSize) / 100;
|
||
if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {
|
||
documentData.finalSize -= 1;
|
||
documentData.finalLineHeight = (documentData.finalSize * documentData.lh) / documentData.s;
|
||
} else {
|
||
documentData.finalText = finalText;
|
||
len = documentData.finalText.length;
|
||
flag = false;
|
||
}
|
||
}
|
||
}
|
||
lineWidth = -trackingOffset;
|
||
cLength = 0;
|
||
var uncollapsedSpaces = 0;
|
||
var currentChar;
|
||
for (i = 0; i < len; i += 1) {
|
||
newLineFlag = false;
|
||
currentChar = documentData.finalText[i];
|
||
charCode = currentChar.charCodeAt(0);
|
||
if (charCode === 13 || charCode === 3) {
|
||
uncollapsedSpaces = 0;
|
||
lineWidths.push(lineWidth);
|
||
maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
|
||
lineWidth = -2 * trackingOffset;
|
||
val = '';
|
||
newLineFlag = true;
|
||
currentLine += 1;
|
||
} else {
|
||
val = currentChar;
|
||
}
|
||
if (fontManager.chars) {
|
||
charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);
|
||
cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100;
|
||
} else {
|
||
// var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);
|
||
// tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;
|
||
cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);
|
||
}
|
||
|
||
//
|
||
if (currentChar === ' ') {
|
||
uncollapsedSpaces += cLength + trackingOffset;
|
||
} else {
|
||
lineWidth += cLength + trackingOffset + uncollapsedSpaces;
|
||
uncollapsedSpaces = 0;
|
||
}
|
||
letters.push({
|
||
l: cLength, an: cLength, add: currentSize, n: newLineFlag, anIndexes: [], val: val, line: currentLine, animatorJustifyOffset: 0,
|
||
});
|
||
if (anchorGrouping == 2) { // eslint-disable-line eqeqeq
|
||
currentSize += cLength;
|
||
if (val === '' || val === ' ' || i === len - 1) {
|
||
if (val === '' || val === ' ') {
|
||
currentSize -= cLength;
|
||
}
|
||
while (currentPos <= i) {
|
||
letters[currentPos].an = currentSize;
|
||
letters[currentPos].ind = index;
|
||
letters[currentPos].extra = cLength;
|
||
currentPos += 1;
|
||
}
|
||
index += 1;
|
||
currentSize = 0;
|
||
}
|
||
} else if (anchorGrouping == 3) { // eslint-disable-line eqeqeq
|
||
currentSize += cLength;
|
||
if (val === '' || i === len - 1) {
|
||
if (val === '') {
|
||
currentSize -= cLength;
|
||
}
|
||
while (currentPos <= i) {
|
||
letters[currentPos].an = currentSize;
|
||
letters[currentPos].ind = index;
|
||
letters[currentPos].extra = cLength;
|
||
currentPos += 1;
|
||
}
|
||
currentSize = 0;
|
||
index += 1;
|
||
}
|
||
} else {
|
||
letters[index].ind = index;
|
||
letters[index].extra = 0;
|
||
index += 1;
|
||
}
|
||
}
|
||
documentData.l = letters;
|
||
maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
|
||
lineWidths.push(lineWidth);
|
||
if (documentData.sz) {
|
||
documentData.boxWidth = documentData.sz[0];
|
||
documentData.justifyOffset = 0;
|
||
} else {
|
||
documentData.boxWidth = maxLineWidth;
|
||
switch (documentData.j) {
|
||
case 1:
|
||
documentData.justifyOffset = -documentData.boxWidth;
|
||
break;
|
||
case 2:
|
||
documentData.justifyOffset = -documentData.boxWidth / 2;
|
||
break;
|
||
default:
|
||
documentData.justifyOffset = 0;
|
||
}
|
||
}
|
||
documentData.lineWidths = lineWidths;
|
||
|
||
var animators = data.a; var animatorData; var
|
||
letterData;
|
||
jLen = animators.length;
|
||
var based; var ind; var
|
||
indexes = [];
|
||
for (j = 0; j < jLen; j += 1) {
|
||
animatorData = animators[j];
|
||
if (animatorData.a.sc) {
|
||
documentData.strokeColorAnim = true;
|
||
}
|
||
if (animatorData.a.sw) {
|
||
documentData.strokeWidthAnim = true;
|
||
}
|
||
if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {
|
||
documentData.fillColorAnim = true;
|
||
}
|
||
ind = 0;
|
||
based = animatorData.s.b;
|
||
for (i = 0; i < len; i += 1) {
|
||
letterData = letters[i];
|
||
letterData.anIndexes[j] = ind;
|
||
if ((based == 1 && letterData.val !== '') || (based == 2 && letterData.val !== '' && letterData.val !== ' ') || (based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1)) || (based == 4 && (letterData.n || i == len - 1))) { // eslint-disable-line eqeqeq
|
||
if (animatorData.s.rn === 1) {
|
||
indexes.push(ind);
|
||
}
|
||
ind += 1;
|
||
}
|
||
}
|
||
data.a[j].s.totalChars = ind;
|
||
var currentInd = -1; var
|
||
newInd;
|
||
if (animatorData.s.rn === 1) {
|
||
for (i = 0; i < len; i += 1) {
|
||
letterData = letters[i];
|
||
if (currentInd != letterData.anIndexes[j]) { // eslint-disable-line eqeqeq
|
||
currentInd = letterData.anIndexes[j];
|
||
newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0];
|
||
}
|
||
letterData.anIndexes[j] = newInd;
|
||
}
|
||
}
|
||
}
|
||
documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2;
|
||
documentData.ls = documentData.ls || 0;
|
||
documentData.ascent = (fontData.ascent * documentData.finalSize) / 100;
|
||
};
|
||
|
||
TextProperty.prototype.updateDocumentData = function (newData, index) {
|
||
index = index === undefined ? this.keysIndex : index;
|
||
var dData = this.copyData({}, this.data.d.k[index].s);
|
||
dData = this.copyData(dData, newData);
|
||
this.data.d.k[index].s = dData;
|
||
this.recalculate(index);
|
||
this.elem.addDynamicProperty(this);
|
||
};
|
||
|
||
TextProperty.prototype.recalculate = function (index) {
|
||
var dData = this.data.d.k[index].s;
|
||
dData.__complete = false;
|
||
this.keysIndex = 0;
|
||
this._isFirstFrame = true;
|
||
this.getValue(dData);
|
||
};
|
||
|
||
TextProperty.prototype.canResizeFont = function (_canResize) {
|
||
this.canResize = _canResize;
|
||
this.recalculate(this.keysIndex);
|
||
this.elem.addDynamicProperty(this);
|
||
};
|
||
|
||
TextProperty.prototype.setMinimumFontSize = function (_fontValue) {
|
||
this.minimumFontSize = Math.floor(_fontValue) || 1;
|
||
this.recalculate(this.keysIndex);
|
||
this.elem.addDynamicProperty(this);
|
||
};
|
||
|
||
/* global extendPrototype, BezierFactory, PropertyFactory, DynamicPropertyContainer */
|
||
/* exported TextSelectorProp */
|
||
|
||
var TextSelectorProp = (function () {
|
||
var max = Math.max;
|
||
var min = Math.min;
|
||
var floor = Math.floor;
|
||
|
||
function TextSelectorPropFactory(elem, data) {
|
||
this._currentTextLength = -1;
|
||
this.k = false;
|
||
this.data = data;
|
||
this.elem = elem;
|
||
this.comp = elem.comp;
|
||
this.finalS = 0;
|
||
this.finalE = 0;
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.s = PropertyFactory.getProp(elem, data.s || { k: 0 }, 0, 0, this);
|
||
if ('e' in data) {
|
||
this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this);
|
||
} else {
|
||
this.e = { v: 100 };
|
||
}
|
||
this.o = PropertyFactory.getProp(elem, data.o || { k: 0 }, 0, 0, this);
|
||
this.xe = PropertyFactory.getProp(elem, data.xe || { k: 0 }, 0, 0, this);
|
||
this.ne = PropertyFactory.getProp(elem, data.ne || { k: 0 }, 0, 0, this);
|
||
this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this);
|
||
if (!this.dynamicProperties.length) {
|
||
this.getValue();
|
||
}
|
||
}
|
||
|
||
TextSelectorPropFactory.prototype = {
|
||
getMult: function (ind) {
|
||
if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {
|
||
this.getValue();
|
||
}
|
||
// var easer = bez.getEasingCurve(this.ne.v/100,0,1-this.xe.v/100,1);
|
||
var x1 = 0;
|
||
var y1 = 0;
|
||
var x2 = 1;
|
||
var y2 = 1;
|
||
if (this.ne.v > 0) {
|
||
x1 = this.ne.v / 100.0;
|
||
} else {
|
||
y1 = -this.ne.v / 100.0;
|
||
}
|
||
if (this.xe.v > 0) {
|
||
x2 = 1.0 - this.xe.v / 100.0;
|
||
} else {
|
||
y2 = 1.0 + this.xe.v / 100.0;
|
||
}
|
||
var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get;
|
||
|
||
var mult = 0;
|
||
var s = this.finalS;
|
||
var e = this.finalE;
|
||
var type = this.data.sh;
|
||
if (type === 2) {
|
||
if (e === s) {
|
||
mult = ind >= e ? 1 : 0;
|
||
} else {
|
||
mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
|
||
}
|
||
mult = easer(mult);
|
||
} else if (type === 3) {
|
||
if (e === s) {
|
||
mult = ind >= e ? 0 : 1;
|
||
} else {
|
||
mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
|
||
}
|
||
|
||
mult = easer(mult);
|
||
} else if (type === 4) {
|
||
if (e === s) {
|
||
mult = 0;
|
||
} else {
|
||
mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
|
||
if (mult < 0.5) {
|
||
mult *= 2;
|
||
} else {
|
||
mult = 1 - 2 * (mult - 0.5);
|
||
}
|
||
}
|
||
mult = easer(mult);
|
||
} else if (type === 5) {
|
||
if (e === s) {
|
||
mult = 0;
|
||
} else {
|
||
var tot = e - s;
|
||
/* ind += 0.5;
|
||
mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */
|
||
ind = min(max(0, ind + 0.5 - s), e - s);
|
||
var x = -tot / 2 + ind;
|
||
var a = tot / 2;
|
||
mult = Math.sqrt(1 - (x * x) / (a * a));
|
||
}
|
||
mult = easer(mult);
|
||
} else if (type === 6) {
|
||
if (e === s) {
|
||
mult = 0;
|
||
} else {
|
||
ind = min(max(0, ind + 0.5 - s), e - s);
|
||
mult = (1 + (Math.cos((Math.PI + Math.PI * 2 * (ind) / (e - s))))) / 2; // eslint-disable-line
|
||
}
|
||
mult = easer(mult);
|
||
} else {
|
||
if (ind >= floor(s)) {
|
||
if (ind - s < 0) {
|
||
mult = max(0, min(min(e, 1) - (s - ind), 1));
|
||
} else {
|
||
mult = max(0, min(e - ind, 1));
|
||
}
|
||
}
|
||
mult = easer(mult);
|
||
}
|
||
return mult * this.a.v;
|
||
},
|
||
getValue: function (newCharsFlag) {
|
||
this.iterateDynamicProperties();
|
||
this._mdf = newCharsFlag || this._mdf;
|
||
this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;
|
||
if (newCharsFlag && this.data.r === 2) {
|
||
this.e.v = this._currentTextLength;
|
||
}
|
||
var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;
|
||
var o = this.o.v / divisor;
|
||
var s = this.s.v / divisor + o;
|
||
var e = (this.e.v / divisor) + o;
|
||
if (s > e) {
|
||
var _s = s;
|
||
s = e;
|
||
e = _s;
|
||
}
|
||
this.finalS = s;
|
||
this.finalE = e;
|
||
},
|
||
};
|
||
extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory);
|
||
|
||
function getTextSelectorProp(elem, data, arr) {
|
||
return new TextSelectorPropFactory(elem, data, arr);
|
||
}
|
||
|
||
return {
|
||
getTextSelectorProp: getTextSelectorProp,
|
||
};
|
||
}());
|
||
|
||
/* global createSizedArray, pooling */
|
||
/* exported poolFactory */
|
||
|
||
var poolFactory = (function () {
|
||
return function (initialLength, _create, _release) {
|
||
var _length = 0;
|
||
var _maxLength = initialLength;
|
||
var pool = createSizedArray(_maxLength);
|
||
|
||
var ob = {
|
||
newElement: newElement,
|
||
release: release,
|
||
};
|
||
|
||
function newElement() {
|
||
var element;
|
||
if (_length) {
|
||
_length -= 1;
|
||
element = pool[_length];
|
||
} else {
|
||
element = _create();
|
||
}
|
||
return element;
|
||
}
|
||
|
||
function release(element) {
|
||
if (_length === _maxLength) {
|
||
pool = pooling.double(pool);
|
||
_maxLength *= 2;
|
||
}
|
||
if (_release) {
|
||
_release(element);
|
||
}
|
||
pool[_length] = element;
|
||
_length += 1;
|
||
}
|
||
|
||
return ob;
|
||
};
|
||
}());
|
||
|
||
/* global createSizedArray */
|
||
/* exported pooling */
|
||
|
||
var pooling = (function () {
|
||
function double(arr) {
|
||
return arr.concat(createSizedArray(arr.length));
|
||
}
|
||
|
||
return {
|
||
double: double,
|
||
};
|
||
}());
|
||
|
||
/* global createTypedArray, poolFactory */
|
||
/* exported pointPool */
|
||
|
||
var pointPool = (function () {
|
||
function create() {
|
||
return createTypedArray('float32', 2);
|
||
}
|
||
return poolFactory(8, create);
|
||
}());
|
||
|
||
/* global ShapePath, pointPool, poolFactory */
|
||
/* exported shapePool */
|
||
|
||
var shapePool = (function () {
|
||
function create() {
|
||
return new ShapePath();
|
||
}
|
||
|
||
function release(shapePath) {
|
||
var len = shapePath._length;
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
pointPool.release(shapePath.v[i]);
|
||
pointPool.release(shapePath.i[i]);
|
||
pointPool.release(shapePath.o[i]);
|
||
shapePath.v[i] = null;
|
||
shapePath.i[i] = null;
|
||
shapePath.o[i] = null;
|
||
}
|
||
shapePath._length = 0;
|
||
shapePath.c = false;
|
||
}
|
||
|
||
function clone(shape) {
|
||
var cloned = factory.newElement();
|
||
var i;
|
||
var len = shape._length === undefined ? shape.v.length : shape._length;
|
||
cloned.setLength(len);
|
||
cloned.c = shape.c;
|
||
|
||
for (i = 0; i < len; i += 1) {
|
||
cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i);
|
||
}
|
||
return cloned;
|
||
}
|
||
|
||
var factory = poolFactory(4, create, release);
|
||
factory.clone = clone;
|
||
|
||
return factory;
|
||
}());
|
||
|
||
/* global createSizedArray, ShapeCollection, shapePool, pooling */
|
||
/* exported shapeCollectionPool */
|
||
|
||
var shapeCollectionPool = (function () {
|
||
var ob = {
|
||
newShapeCollection: newShapeCollection,
|
||
release: release,
|
||
};
|
||
|
||
var _length = 0;
|
||
var _maxLength = 4;
|
||
var pool = createSizedArray(_maxLength);
|
||
|
||
function newShapeCollection() {
|
||
var shapeCollection;
|
||
if (_length) {
|
||
_length -= 1;
|
||
shapeCollection = pool[_length];
|
||
} else {
|
||
shapeCollection = new ShapeCollection();
|
||
}
|
||
return shapeCollection;
|
||
}
|
||
|
||
function release(shapeCollection) {
|
||
var i;
|
||
var len = shapeCollection._length;
|
||
for (i = 0; i < len; i += 1) {
|
||
shapePool.release(shapeCollection.shapes[i]);
|
||
}
|
||
shapeCollection._length = 0;
|
||
|
||
if (_length === _maxLength) {
|
||
pool = pooling.double(pool);
|
||
_maxLength *= 2;
|
||
}
|
||
pool[_length] = shapeCollection;
|
||
_length += 1;
|
||
}
|
||
|
||
return ob;
|
||
}());
|
||
|
||
/* global poolFactory, bezierLengthPool */
|
||
/* exported segmentsLengthPool */
|
||
|
||
var segmentsLengthPool = (function () {
|
||
function create() {
|
||
return {
|
||
lengths: [],
|
||
totalLength: 0,
|
||
};
|
||
}
|
||
|
||
function release(element) {
|
||
var i;
|
||
var len = element.lengths.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
bezierLengthPool.release(element.lengths[i]);
|
||
}
|
||
element.lengths.length = 0;
|
||
}
|
||
|
||
return poolFactory(8, create, release);
|
||
}());
|
||
|
||
/* global createTypedArray, defaultCurveSegments, poolFactory */
|
||
/* exported bezierLengthPool */
|
||
|
||
var bezierLengthPool = (function () {
|
||
function create() {
|
||
return {
|
||
addedLength: 0,
|
||
percents: createTypedArray('float32', defaultCurveSegments),
|
||
lengths: createTypedArray('float32', defaultCurveSegments),
|
||
};
|
||
}
|
||
return poolFactory(8, create);
|
||
}());
|
||
|
||
/* exported markerParser */
|
||
|
||
var markerParser = (
|
||
|
||
function () {
|
||
function parsePayloadLines(payload) {
|
||
var lines = payload.split('\r\n');
|
||
var keys = {};
|
||
var line;
|
||
var keysCount = 0;
|
||
for (var i = 0; i < lines.length; i += 1) {
|
||
line = lines[i].split(':');
|
||
if (line.length === 2) {
|
||
keys[line[0]] = line[1].trim();
|
||
keysCount += 1;
|
||
}
|
||
}
|
||
if (keysCount === 0) {
|
||
throw new Error();
|
||
}
|
||
return keys;
|
||
}
|
||
|
||
return function (_markers) {
|
||
var markers = [];
|
||
for (var i = 0; i < _markers.length; i += 1) {
|
||
var _marker = _markers[i];
|
||
var markerData = {
|
||
time: _marker.tm,
|
||
duration: _marker.dr,
|
||
};
|
||
try {
|
||
markerData.payload = JSON.parse(_markers[i].cm);
|
||
} catch (_) {
|
||
try {
|
||
markerData.payload = parsePayloadLines(_markers[i].cm);
|
||
} catch (__) {
|
||
markerData.payload = {
|
||
name: _markers[i],
|
||
};
|
||
}
|
||
}
|
||
markers.push(markerData);
|
||
}
|
||
return markers;
|
||
};
|
||
}());
|
||
|
||
/* global AudioElement, FootageElement, FontManager */
|
||
|
||
function BaseRenderer() {}
|
||
BaseRenderer.prototype.checkLayers = function (num) {
|
||
var i;
|
||
var len = this.layers.length;
|
||
var data;
|
||
this.completeLayers = true;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (!this.elements[i]) {
|
||
data = this.layers[i];
|
||
if (data.ip - data.st <= (num - this.layers[i].st) && data.op - data.st > (num - this.layers[i].st)) {
|
||
this.buildItem(i);
|
||
}
|
||
}
|
||
this.completeLayers = this.elements[i] ? this.completeLayers : false;
|
||
}
|
||
this.checkPendingElements();
|
||
};
|
||
|
||
BaseRenderer.prototype.createItem = function (layer) {
|
||
switch (layer.ty) {
|
||
case 2:
|
||
return this.createImage(layer);
|
||
case 0:
|
||
return this.createComp(layer);
|
||
case 1:
|
||
return this.createSolid(layer);
|
||
case 3:
|
||
return this.createNull(layer);
|
||
case 4:
|
||
return this.createShape(layer);
|
||
case 5:
|
||
return this.createText(layer);
|
||
case 6:
|
||
return this.createAudio(layer);
|
||
case 13:
|
||
return this.createCamera(layer);
|
||
case 15:
|
||
return this.createFootage(layer);
|
||
default:
|
||
return this.createNull(layer);
|
||
}
|
||
};
|
||
|
||
BaseRenderer.prototype.createCamera = function () {
|
||
throw new Error('You\'re using a 3d camera. Try the html renderer.');
|
||
};
|
||
|
||
BaseRenderer.prototype.createAudio = function (data) {
|
||
return new AudioElement(data, this.globalData, this);
|
||
};
|
||
|
||
BaseRenderer.prototype.createFootage = function (data) {
|
||
return new FootageElement(data, this.globalData, this);
|
||
};
|
||
|
||
BaseRenderer.prototype.buildAllItems = function () {
|
||
var i;
|
||
var len = this.layers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.buildItem(i);
|
||
}
|
||
this.checkPendingElements();
|
||
};
|
||
|
||
BaseRenderer.prototype.includeLayers = function (newLayers) {
|
||
this.completeLayers = false;
|
||
var i;
|
||
var len = newLayers.length;
|
||
var j;
|
||
var jLen = this.layers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
j = 0;
|
||
while (j < jLen) {
|
||
if (this.layers[j].id === newLayers[i].id) {
|
||
this.layers[j] = newLayers[i];
|
||
break;
|
||
}
|
||
j += 1;
|
||
}
|
||
}
|
||
};
|
||
|
||
BaseRenderer.prototype.setProjectInterface = function (pInterface) {
|
||
this.globalData.projectInterface = pInterface;
|
||
};
|
||
|
||
BaseRenderer.prototype.initItems = function () {
|
||
if (!this.globalData.progressiveLoad) {
|
||
this.buildAllItems();
|
||
}
|
||
};
|
||
BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {
|
||
var elements = this.elements;
|
||
var layers = this.layers;
|
||
var i = 0;
|
||
var len = layers.length;
|
||
while (i < len) {
|
||
if (layers[i].ind == parentName) { // eslint-disable-line eqeqeq
|
||
if (!elements[i] || elements[i] === true) {
|
||
this.buildItem(i);
|
||
this.addPendingElement(element);
|
||
} else {
|
||
hierarchy.push(elements[i]);
|
||
elements[i].setAsParent();
|
||
if (layers[i].parent !== undefined) {
|
||
this.buildElementParenting(element, layers[i].parent, hierarchy);
|
||
} else {
|
||
element.setHierarchy(hierarchy);
|
||
}
|
||
}
|
||
}
|
||
i += 1;
|
||
}
|
||
};
|
||
|
||
BaseRenderer.prototype.addPendingElement = function (element) {
|
||
this.pendingElements.push(element);
|
||
};
|
||
|
||
BaseRenderer.prototype.searchExtraCompositions = function (assets) {
|
||
var i;
|
||
var len = assets.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (assets[i].xt) {
|
||
var comp = this.createComp(assets[i]);
|
||
comp.initExpressions();
|
||
this.globalData.projectInterface.registerComposition(comp);
|
||
}
|
||
}
|
||
};
|
||
|
||
BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {
|
||
this.globalData.fontManager = new FontManager();
|
||
this.globalData.fontManager.addChars(animData.chars);
|
||
this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);
|
||
this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);
|
||
this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);
|
||
this.globalData.imageLoader = this.animationItem.imagePreloader;
|
||
this.globalData.audioController = this.animationItem.audioController;
|
||
this.globalData.frameId = 0;
|
||
this.globalData.frameRate = animData.fr;
|
||
this.globalData.nm = animData.nm;
|
||
this.globalData.compSize = {
|
||
w: animData.w,
|
||
h: animData.h,
|
||
};
|
||
};
|
||
|
||
/* global createElementID, extendPrototype, BaseRenderer, NullElement, SVGShapeElement, SVGTextLottieElement,
|
||
IImageElement, SVGCompElement, ISolidElement, createNS, locationHref, createSizedArray, expressionsPlugin */
|
||
|
||
function SVGRenderer(animationItem, config) {
|
||
this.animationItem = animationItem;
|
||
this.layers = null;
|
||
this.renderedFrame = -1;
|
||
this.svgElement = createNS('svg');
|
||
var ariaLabel = '';
|
||
if (config && config.title) {
|
||
var titleElement = createNS('title');
|
||
var titleId = createElementID();
|
||
titleElement.setAttribute('id', titleId);
|
||
titleElement.textContent = config.title;
|
||
this.svgElement.appendChild(titleElement);
|
||
ariaLabel += titleId;
|
||
}
|
||
if (config && config.description) {
|
||
var descElement = createNS('desc');
|
||
var descId = createElementID();
|
||
descElement.setAttribute('id', descId);
|
||
descElement.textContent = config.description;
|
||
this.svgElement.appendChild(descElement);
|
||
ariaLabel += ' ' + descId;
|
||
}
|
||
if (ariaLabel) {
|
||
this.svgElement.setAttribute('aria-labelledby', ariaLabel);
|
||
}
|
||
var defs = createNS('defs');
|
||
this.svgElement.appendChild(defs);
|
||
var maskElement = createNS('g');
|
||
this.svgElement.appendChild(maskElement);
|
||
this.layerElement = maskElement;
|
||
this.renderConfig = {
|
||
preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
|
||
imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
|
||
progressiveLoad: (config && config.progressiveLoad) || false,
|
||
hideOnTransparent: !((config && config.hideOnTransparent === false)),
|
||
viewBoxOnly: (config && config.viewBoxOnly) || false,
|
||
viewBoxSize: (config && config.viewBoxSize) || false,
|
||
className: (config && config.className) || '',
|
||
id: (config && config.id) || '',
|
||
focusable: config && config.focusable,
|
||
filterSize: {
|
||
width: (config && config.filterSize && config.filterSize.width) || '100%',
|
||
height: (config && config.filterSize && config.filterSize.height) || '100%',
|
||
x: (config && config.filterSize && config.filterSize.x) || '0%',
|
||
y: (config && config.filterSize && config.filterSize.y) || '0%',
|
||
},
|
||
};
|
||
|
||
this.globalData = {
|
||
_mdf: false,
|
||
frameNum: -1,
|
||
defs: defs,
|
||
renderConfig: this.renderConfig,
|
||
};
|
||
this.elements = [];
|
||
this.pendingElements = [];
|
||
this.destroyed = false;
|
||
this.rendererType = 'svg';
|
||
}
|
||
|
||
extendPrototype([BaseRenderer], SVGRenderer);
|
||
|
||
SVGRenderer.prototype.createNull = function (data) {
|
||
return new NullElement(data, this.globalData, this);
|
||
};
|
||
|
||
SVGRenderer.prototype.createShape = function (data) {
|
||
return new SVGShapeElement(data, this.globalData, this);
|
||
};
|
||
|
||
SVGRenderer.prototype.createText = function (data) {
|
||
return new SVGTextLottieElement(data, this.globalData, this);
|
||
};
|
||
|
||
SVGRenderer.prototype.createImage = function (data) {
|
||
return new IImageElement(data, this.globalData, this);
|
||
};
|
||
|
||
SVGRenderer.prototype.createComp = function (data) {
|
||
return new SVGCompElement(data, this.globalData, this);
|
||
};
|
||
|
||
SVGRenderer.prototype.createSolid = function (data) {
|
||
return new ISolidElement(data, this.globalData, this);
|
||
};
|
||
|
||
SVGRenderer.prototype.configAnimation = function (animData) {
|
||
this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
||
if (this.renderConfig.viewBoxSize) {
|
||
this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);
|
||
} else {
|
||
this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h);
|
||
}
|
||
|
||
if (!this.renderConfig.viewBoxOnly) {
|
||
this.svgElement.setAttribute('width', animData.w);
|
||
this.svgElement.setAttribute('height', animData.h);
|
||
this.svgElement.style.width = '100%';
|
||
this.svgElement.style.height = '100%';
|
||
this.svgElement.style.transform = 'translate3d(0,0,0)';
|
||
}
|
||
if (this.renderConfig.className) {
|
||
this.svgElement.setAttribute('class', this.renderConfig.className);
|
||
}
|
||
if (this.renderConfig.id) {
|
||
this.svgElement.setAttribute('id', this.renderConfig.id);
|
||
}
|
||
if (this.renderConfig.focusable !== undefined) {
|
||
this.svgElement.setAttribute('focusable', this.renderConfig.focusable);
|
||
}
|
||
this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio);
|
||
// this.layerElement.style.transform = 'translate3d(0,0,0)';
|
||
// this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = "0px 0px 0px";
|
||
this.animationItem.wrapper.appendChild(this.svgElement);
|
||
// Mask animation
|
||
var defs = this.globalData.defs;
|
||
|
||
this.setupGlobalData(animData, defs);
|
||
this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
|
||
this.data = animData;
|
||
|
||
var maskElement = createNS('clipPath');
|
||
var rect = createNS('rect');
|
||
rect.setAttribute('width', animData.w);
|
||
rect.setAttribute('height', animData.h);
|
||
rect.setAttribute('x', 0);
|
||
rect.setAttribute('y', 0);
|
||
var maskId = createElementID();
|
||
maskElement.setAttribute('id', maskId);
|
||
maskElement.appendChild(rect);
|
||
this.layerElement.setAttribute('clip-path', 'url(' + locationHref + '#' + maskId + ')');
|
||
|
||
defs.appendChild(maskElement);
|
||
this.layers = animData.layers;
|
||
this.elements = createSizedArray(animData.layers.length);
|
||
};
|
||
|
||
SVGRenderer.prototype.destroy = function () {
|
||
if (this.animationItem.wrapper) {
|
||
this.animationItem.wrapper.innerText = '';
|
||
}
|
||
this.layerElement = null;
|
||
this.globalData.defs = null;
|
||
var i;
|
||
var len = this.layers ? this.layers.length : 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.elements[i]) {
|
||
this.elements[i].destroy();
|
||
}
|
||
}
|
||
this.elements.length = 0;
|
||
this.destroyed = true;
|
||
this.animationItem = null;
|
||
};
|
||
|
||
SVGRenderer.prototype.updateContainerSize = function () {
|
||
};
|
||
|
||
SVGRenderer.prototype.buildItem = function (pos) {
|
||
var elements = this.elements;
|
||
if (elements[pos] || this.layers[pos].ty === 99) {
|
||
return;
|
||
}
|
||
elements[pos] = true;
|
||
var element = this.createItem(this.layers[pos]);
|
||
|
||
elements[pos] = element;
|
||
if (expressionsPlugin) {
|
||
if (this.layers[pos].ty === 0) {
|
||
this.globalData.projectInterface.registerComposition(element);
|
||
}
|
||
element.initExpressions();
|
||
}
|
||
this.appendElementInPos(element, pos);
|
||
if (this.layers[pos].tt) {
|
||
if (!this.elements[pos - 1] || this.elements[pos - 1] === true) {
|
||
this.buildItem(pos - 1);
|
||
this.addPendingElement(element);
|
||
} else {
|
||
element.setMatte(elements[pos - 1].layerId);
|
||
}
|
||
}
|
||
};
|
||
|
||
SVGRenderer.prototype.checkPendingElements = function () {
|
||
while (this.pendingElements.length) {
|
||
var element = this.pendingElements.pop();
|
||
element.checkParenting();
|
||
if (element.data.tt) {
|
||
var i = 0;
|
||
var len = this.elements.length;
|
||
while (i < len) {
|
||
if (this.elements[i] === element) {
|
||
element.setMatte(this.elements[i - 1].layerId);
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
SVGRenderer.prototype.renderFrame = function (num) {
|
||
if (this.renderedFrame === num || this.destroyed) {
|
||
return;
|
||
}
|
||
if (num === null) {
|
||
num = this.renderedFrame;
|
||
} else {
|
||
this.renderedFrame = num;
|
||
}
|
||
// console.log('-------');
|
||
// console.log('FRAME ',num);
|
||
this.globalData.frameNum = num;
|
||
this.globalData.frameId += 1;
|
||
this.globalData.projectInterface.currentFrame = num;
|
||
this.globalData._mdf = false;
|
||
var i;
|
||
var len = this.layers.length;
|
||
if (!this.completeLayers) {
|
||
this.checkLayers(num);
|
||
}
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (this.completeLayers || this.elements[i]) {
|
||
this.elements[i].prepareFrame(num - this.layers[i].st);
|
||
}
|
||
}
|
||
if (this.globalData._mdf) {
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.completeLayers || this.elements[i]) {
|
||
this.elements[i].renderFrame();
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
SVGRenderer.prototype.appendElementInPos = function (element, pos) {
|
||
var newElement = element.getBaseElement();
|
||
if (!newElement) {
|
||
return;
|
||
}
|
||
var i = 0;
|
||
var nextElement;
|
||
while (i < pos) {
|
||
if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {
|
||
nextElement = this.elements[i].getBaseElement();
|
||
}
|
||
i += 1;
|
||
}
|
||
if (nextElement) {
|
||
this.layerElement.insertBefore(newElement, nextElement);
|
||
} else {
|
||
this.layerElement.appendChild(newElement);
|
||
}
|
||
};
|
||
|
||
SVGRenderer.prototype.hide = function () {
|
||
this.layerElement.style.display = 'none';
|
||
};
|
||
|
||
SVGRenderer.prototype.show = function () {
|
||
this.layerElement.style.display = 'block';
|
||
};
|
||
|
||
/* global CVContextData, Matrix, extendPrototype, BaseRenderer, CVShapeElement, CVTextElement,
|
||
CVImageElement, CVCompElement, CVSolidElement, SVGRenderer, createTag, createSizedArray */
|
||
|
||
function CanvasRenderer(animationItem, config) {
|
||
this.animationItem = animationItem;
|
||
this.renderConfig = {
|
||
clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true,
|
||
context: (config && config.context) || null,
|
||
progressiveLoad: (config && config.progressiveLoad) || false,
|
||
preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
|
||
imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
|
||
className: (config && config.className) || '',
|
||
id: (config && config.id) || '',
|
||
};
|
||
this.renderConfig.dpr = (config && config.dpr) || 1;
|
||
if (this.animationItem.wrapper) {
|
||
this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1;
|
||
}
|
||
this.renderedFrame = -1;
|
||
this.globalData = {
|
||
frameNum: -1,
|
||
_mdf: false,
|
||
renderConfig: this.renderConfig,
|
||
currentGlobalAlpha: -1,
|
||
};
|
||
this.contextData = new CVContextData();
|
||
this.elements = [];
|
||
this.pendingElements = [];
|
||
this.transformMat = new Matrix();
|
||
this.completeLayers = false;
|
||
this.rendererType = 'canvas';
|
||
}
|
||
extendPrototype([BaseRenderer], CanvasRenderer);
|
||
|
||
CanvasRenderer.prototype.createShape = function (data) {
|
||
return new CVShapeElement(data, this.globalData, this);
|
||
};
|
||
|
||
CanvasRenderer.prototype.createText = function (data) {
|
||
return new CVTextElement(data, this.globalData, this);
|
||
};
|
||
|
||
CanvasRenderer.prototype.createImage = function (data) {
|
||
return new CVImageElement(data, this.globalData, this);
|
||
};
|
||
|
||
CanvasRenderer.prototype.createComp = function (data) {
|
||
return new CVCompElement(data, this.globalData, this);
|
||
};
|
||
|
||
CanvasRenderer.prototype.createSolid = function (data) {
|
||
return new CVSolidElement(data, this.globalData, this);
|
||
};
|
||
|
||
CanvasRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
|
||
|
||
CanvasRenderer.prototype.ctxTransform = function (props) {
|
||
if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {
|
||
return;
|
||
}
|
||
if (!this.renderConfig.clearCanvas) {
|
||
this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]);
|
||
return;
|
||
}
|
||
this.transformMat.cloneFromProps(props);
|
||
var cProps = this.contextData.cTr.props;
|
||
this.transformMat.transform(cProps[0], cProps[1], cProps[2], cProps[3], cProps[4], cProps[5], cProps[6], cProps[7], cProps[8], cProps[9], cProps[10], cProps[11], cProps[12], cProps[13], cProps[14], cProps[15]);
|
||
// this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);
|
||
this.contextData.cTr.cloneFromProps(this.transformMat.props);
|
||
var trProps = this.contextData.cTr.props;
|
||
this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]);
|
||
};
|
||
|
||
CanvasRenderer.prototype.ctxOpacity = function (op) {
|
||
/* if(op === 1){
|
||
return;
|
||
} */
|
||
if (!this.renderConfig.clearCanvas) {
|
||
this.canvasContext.globalAlpha *= op < 0 ? 0 : op;
|
||
this.globalData.currentGlobalAlpha = this.contextData.cO;
|
||
return;
|
||
}
|
||
this.contextData.cO *= op < 0 ? 0 : op;
|
||
if (this.globalData.currentGlobalAlpha !== this.contextData.cO) {
|
||
this.canvasContext.globalAlpha = this.contextData.cO;
|
||
this.globalData.currentGlobalAlpha = this.contextData.cO;
|
||
}
|
||
};
|
||
|
||
CanvasRenderer.prototype.reset = function () {
|
||
if (!this.renderConfig.clearCanvas) {
|
||
this.canvasContext.restore();
|
||
return;
|
||
}
|
||
this.contextData.reset();
|
||
};
|
||
|
||
CanvasRenderer.prototype.save = function (actionFlag) {
|
||
if (!this.renderConfig.clearCanvas) {
|
||
this.canvasContext.save();
|
||
return;
|
||
}
|
||
if (actionFlag) {
|
||
this.canvasContext.save();
|
||
}
|
||
var props = this.contextData.cTr.props;
|
||
if (this.contextData._length <= this.contextData.cArrPos) {
|
||
this.contextData.duplicate();
|
||
}
|
||
var i;
|
||
var arr = this.contextData.saved[this.contextData.cArrPos];
|
||
for (i = 0; i < 16; i += 1) {
|
||
arr[i] = props[i];
|
||
}
|
||
this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO;
|
||
this.contextData.cArrPos += 1;
|
||
};
|
||
|
||
CanvasRenderer.prototype.restore = function (actionFlag) {
|
||
if (!this.renderConfig.clearCanvas) {
|
||
this.canvasContext.restore();
|
||
return;
|
||
}
|
||
if (actionFlag) {
|
||
this.canvasContext.restore();
|
||
this.globalData.blendMode = 'source-over';
|
||
}
|
||
this.contextData.cArrPos -= 1;
|
||
var popped = this.contextData.saved[this.contextData.cArrPos];
|
||
var i;
|
||
var arr = this.contextData.cTr.props;
|
||
for (i = 0; i < 16; i += 1) {
|
||
arr[i] = popped[i];
|
||
}
|
||
this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13]);
|
||
popped = this.contextData.savedOp[this.contextData.cArrPos];
|
||
this.contextData.cO = popped;
|
||
if (this.globalData.currentGlobalAlpha !== popped) {
|
||
this.canvasContext.globalAlpha = popped;
|
||
this.globalData.currentGlobalAlpha = popped;
|
||
}
|
||
};
|
||
|
||
CanvasRenderer.prototype.configAnimation = function (animData) {
|
||
if (this.animationItem.wrapper) {
|
||
this.animationItem.container = createTag('canvas');
|
||
var containerStyle = this.animationItem.container.style;
|
||
containerStyle.width = '100%';
|
||
containerStyle.height = '100%';
|
||
var origin = '0px 0px 0px';
|
||
containerStyle.transformOrigin = origin;
|
||
containerStyle.mozTransformOrigin = origin;
|
||
containerStyle.webkitTransformOrigin = origin;
|
||
containerStyle['-webkit-transform'] = origin;
|
||
this.animationItem.wrapper.appendChild(this.animationItem.container);
|
||
this.canvasContext = this.animationItem.container.getContext('2d');
|
||
if (this.renderConfig.className) {
|
||
this.animationItem.container.setAttribute('class', this.renderConfig.className);
|
||
}
|
||
if (this.renderConfig.id) {
|
||
this.animationItem.container.setAttribute('id', this.renderConfig.id);
|
||
}
|
||
} else {
|
||
this.canvasContext = this.renderConfig.context;
|
||
}
|
||
this.data = animData;
|
||
this.layers = animData.layers;
|
||
this.transformCanvas = {
|
||
w: animData.w,
|
||
h: animData.h,
|
||
sx: 0,
|
||
sy: 0,
|
||
tx: 0,
|
||
ty: 0,
|
||
};
|
||
this.setupGlobalData(animData, document.body);
|
||
this.globalData.canvasContext = this.canvasContext;
|
||
this.globalData.renderer = this;
|
||
this.globalData.isDashed = false;
|
||
this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
|
||
this.globalData.transformCanvas = this.transformCanvas;
|
||
this.elements = createSizedArray(animData.layers.length);
|
||
|
||
this.updateContainerSize();
|
||
};
|
||
|
||
CanvasRenderer.prototype.updateContainerSize = function () {
|
||
this.reset();
|
||
var elementWidth;
|
||
var elementHeight;
|
||
if (this.animationItem.wrapper && this.animationItem.container) {
|
||
elementWidth = this.animationItem.wrapper.offsetWidth;
|
||
elementHeight = this.animationItem.wrapper.offsetHeight;
|
||
this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr);
|
||
this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr);
|
||
} else {
|
||
elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr;
|
||
elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr;
|
||
}
|
||
var elementRel;
|
||
var animationRel;
|
||
if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {
|
||
var par = this.renderConfig.preserveAspectRatio.split(' ');
|
||
var fillType = par[1] || 'meet';
|
||
var pos = par[0] || 'xMidYMid';
|
||
var xPos = pos.substr(0, 4);
|
||
var yPos = pos.substr(4);
|
||
elementRel = elementWidth / elementHeight;
|
||
animationRel = this.transformCanvas.w / this.transformCanvas.h;
|
||
if ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice')) {
|
||
this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
|
||
this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
|
||
} else {
|
||
this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
|
||
this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
|
||
}
|
||
|
||
if (xPos === 'xMid' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {
|
||
this.transformCanvas.tx = ((elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2) * this.renderConfig.dpr;
|
||
} else if (xPos === 'xMax' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {
|
||
this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr;
|
||
} else {
|
||
this.transformCanvas.tx = 0;
|
||
}
|
||
if (yPos === 'YMid' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {
|
||
this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2) * this.renderConfig.dpr;
|
||
} else if (yPos === 'YMax' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {
|
||
this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w))) * this.renderConfig.dpr;
|
||
} else {
|
||
this.transformCanvas.ty = 0;
|
||
}
|
||
} else if (this.renderConfig.preserveAspectRatio === 'none') {
|
||
this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
|
||
this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
|
||
this.transformCanvas.tx = 0;
|
||
this.transformCanvas.ty = 0;
|
||
} else {
|
||
this.transformCanvas.sx = this.renderConfig.dpr;
|
||
this.transformCanvas.sy = this.renderConfig.dpr;
|
||
this.transformCanvas.tx = 0;
|
||
this.transformCanvas.ty = 0;
|
||
}
|
||
this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1];
|
||
/* var i, len = this.elements.length;
|
||
for(i=0;i<len;i+=1){
|
||
if(this.elements[i] && this.elements[i].data.ty === 0){
|
||
this.elements[i].resize(this.globalData.transformCanvas);
|
||
}
|
||
} */
|
||
this.ctxTransform(this.transformCanvas.props);
|
||
this.canvasContext.beginPath();
|
||
this.canvasContext.rect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
|
||
this.canvasContext.closePath();
|
||
this.canvasContext.clip();
|
||
|
||
this.renderFrame(this.renderedFrame, true);
|
||
};
|
||
|
||
CanvasRenderer.prototype.destroy = function () {
|
||
if (this.renderConfig.clearCanvas && this.animationItem.wrapper) {
|
||
this.animationItem.wrapper.innerText = '';
|
||
}
|
||
var i;
|
||
var len = this.layers ? this.layers.length : 0;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (this.elements[i]) {
|
||
this.elements[i].destroy();
|
||
}
|
||
}
|
||
this.elements.length = 0;
|
||
this.globalData.canvasContext = null;
|
||
this.animationItem.container = null;
|
||
this.destroyed = true;
|
||
};
|
||
|
||
CanvasRenderer.prototype.renderFrame = function (num, forceRender) {
|
||
if ((this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) || this.destroyed || num === -1) {
|
||
return;
|
||
}
|
||
this.renderedFrame = num;
|
||
this.globalData.frameNum = num - this.animationItem._isFirstFrame;
|
||
this.globalData.frameId += 1;
|
||
this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;
|
||
this.globalData.projectInterface.currentFrame = num;
|
||
|
||
// console.log('--------');
|
||
// console.log('NEW: ',num);
|
||
var i;
|
||
var len = this.layers.length;
|
||
if (!this.completeLayers) {
|
||
this.checkLayers(num);
|
||
}
|
||
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.completeLayers || this.elements[i]) {
|
||
this.elements[i].prepareFrame(num - this.layers[i].st);
|
||
}
|
||
}
|
||
if (this.globalData._mdf) {
|
||
if (this.renderConfig.clearCanvas === true) {
|
||
this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
|
||
} else {
|
||
this.save();
|
||
}
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (this.completeLayers || this.elements[i]) {
|
||
this.elements[i].renderFrame();
|
||
}
|
||
}
|
||
if (this.renderConfig.clearCanvas !== true) {
|
||
this.restore();
|
||
}
|
||
}
|
||
};
|
||
|
||
CanvasRenderer.prototype.buildItem = function (pos) {
|
||
var elements = this.elements;
|
||
if (elements[pos] || this.layers[pos].ty === 99) {
|
||
return;
|
||
}
|
||
var element = this.createItem(this.layers[pos], this, this.globalData);
|
||
elements[pos] = element;
|
||
element.initExpressions();
|
||
/* if(this.layers[pos].ty === 0){
|
||
element.resize(this.globalData.transformCanvas);
|
||
} */
|
||
};
|
||
|
||
CanvasRenderer.prototype.checkPendingElements = function () {
|
||
while (this.pendingElements.length) {
|
||
var element = this.pendingElements.pop();
|
||
element.checkParenting();
|
||
}
|
||
};
|
||
|
||
CanvasRenderer.prototype.hide = function () {
|
||
this.animationItem.container.style.display = 'none';
|
||
};
|
||
|
||
CanvasRenderer.prototype.show = function () {
|
||
this.animationItem.container.style.display = 'block';
|
||
};
|
||
|
||
/* global extendPrototype, BaseRenderer, SVGRenderer, SVGShapeElement, HShapeElement, SVGTextLottieElement,
|
||
HTextElement, HCameraElement, IImageElement, HImageElement, SVGCompElement, HCompElement, ISolidElement,
|
||
HSolidElement, styleDiv, createTag, createNS */
|
||
|
||
function HybridRenderer(animationItem, config) {
|
||
this.animationItem = animationItem;
|
||
this.layers = null;
|
||
this.renderedFrame = -1;
|
||
this.renderConfig = {
|
||
className: (config && config.className) || '',
|
||
imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
|
||
hideOnTransparent: !(config && config.hideOnTransparent === false),
|
||
filterSize: {
|
||
width: (config && config.filterSize && config.filterSize.width) || '400%',
|
||
height: (config && config.filterSize && config.filterSize.height) || '400%',
|
||
x: (config && config.filterSize && config.filterSize.x) || '-100%',
|
||
y: (config && config.filterSize && config.filterSize.y) || '-100%',
|
||
},
|
||
};
|
||
this.globalData = {
|
||
_mdf: false,
|
||
frameNum: -1,
|
||
renderConfig: this.renderConfig,
|
||
};
|
||
this.pendingElements = [];
|
||
this.elements = [];
|
||
this.threeDElements = [];
|
||
this.destroyed = false;
|
||
this.camera = null;
|
||
this.supports3d = true;
|
||
this.rendererType = 'html';
|
||
}
|
||
|
||
extendPrototype([BaseRenderer], HybridRenderer);
|
||
|
||
HybridRenderer.prototype.buildItem = SVGRenderer.prototype.buildItem;
|
||
|
||
HybridRenderer.prototype.checkPendingElements = function () {
|
||
while (this.pendingElements.length) {
|
||
var element = this.pendingElements.pop();
|
||
element.checkParenting();
|
||
}
|
||
};
|
||
|
||
HybridRenderer.prototype.appendElementInPos = function (element, pos) {
|
||
var newDOMElement = element.getBaseElement();
|
||
if (!newDOMElement) {
|
||
return;
|
||
}
|
||
var layer = this.layers[pos];
|
||
if (!layer.ddd || !this.supports3d) {
|
||
if (this.threeDElements) {
|
||
this.addTo3dContainer(newDOMElement, pos);
|
||
} else {
|
||
var i = 0;
|
||
var nextDOMElement;
|
||
var nextLayer;
|
||
var tmpDOMElement;
|
||
while (i < pos) {
|
||
if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement) {
|
||
nextLayer = this.elements[i];
|
||
tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();
|
||
nextDOMElement = tmpDOMElement || nextDOMElement;
|
||
}
|
||
i += 1;
|
||
}
|
||
if (nextDOMElement) {
|
||
if (!layer.ddd || !this.supports3d) {
|
||
this.layerElement.insertBefore(newDOMElement, nextDOMElement);
|
||
}
|
||
} else if (!layer.ddd || !this.supports3d) {
|
||
this.layerElement.appendChild(newDOMElement);
|
||
}
|
||
}
|
||
} else {
|
||
this.addTo3dContainer(newDOMElement, pos);
|
||
}
|
||
};
|
||
|
||
HybridRenderer.prototype.createShape = function (data) {
|
||
if (!this.supports3d) {
|
||
return new SVGShapeElement(data, this.globalData, this);
|
||
}
|
||
return new HShapeElement(data, this.globalData, this);
|
||
};
|
||
|
||
HybridRenderer.prototype.createText = function (data) {
|
||
if (!this.supports3d) {
|
||
return new SVGTextLottieElement(data, this.globalData, this);
|
||
}
|
||
return new HTextElement(data, this.globalData, this);
|
||
};
|
||
|
||
HybridRenderer.prototype.createCamera = function (data) {
|
||
this.camera = new HCameraElement(data, this.globalData, this);
|
||
return this.camera;
|
||
};
|
||
|
||
HybridRenderer.prototype.createImage = function (data) {
|
||
if (!this.supports3d) {
|
||
return new IImageElement(data, this.globalData, this);
|
||
}
|
||
return new HImageElement(data, this.globalData, this);
|
||
};
|
||
|
||
HybridRenderer.prototype.createComp = function (data) {
|
||
if (!this.supports3d) {
|
||
return new SVGCompElement(data, this.globalData, this);
|
||
}
|
||
return new HCompElement(data, this.globalData, this);
|
||
};
|
||
|
||
HybridRenderer.prototype.createSolid = function (data) {
|
||
if (!this.supports3d) {
|
||
return new ISolidElement(data, this.globalData, this);
|
||
}
|
||
return new HSolidElement(data, this.globalData, this);
|
||
};
|
||
|
||
HybridRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
|
||
|
||
HybridRenderer.prototype.getThreeDContainerByPos = function (pos) {
|
||
var i = 0;
|
||
var len = this.threeDElements.length;
|
||
while (i < len) {
|
||
if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {
|
||
return this.threeDElements[i].perspectiveElem;
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
};
|
||
|
||
HybridRenderer.prototype.createThreeDContainer = function (pos, type) {
|
||
var perspectiveElem = createTag('div');
|
||
var style;
|
||
var containerStyle;
|
||
styleDiv(perspectiveElem);
|
||
var container = createTag('div');
|
||
styleDiv(container);
|
||
if (type === '3d') {
|
||
style = perspectiveElem.style;
|
||
style.width = this.globalData.compSize.w + 'px';
|
||
style.height = this.globalData.compSize.h + 'px';
|
||
var center = '50% 50%';
|
||
style.webkitTransformOrigin = center;
|
||
style.mozTransformOrigin = center;
|
||
style.transformOrigin = center;
|
||
containerStyle = container.style;
|
||
var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
|
||
containerStyle.transform = matrix;
|
||
containerStyle.webkitTransform = matrix;
|
||
}
|
||
|
||
perspectiveElem.appendChild(container);
|
||
// this.resizerElem.appendChild(perspectiveElem);
|
||
var threeDContainerData = {
|
||
container: container,
|
||
perspectiveElem: perspectiveElem,
|
||
startPos: pos,
|
||
endPos: pos,
|
||
type: type,
|
||
};
|
||
this.threeDElements.push(threeDContainerData);
|
||
return threeDContainerData;
|
||
};
|
||
|
||
HybridRenderer.prototype.build3dContainers = function () {
|
||
var i;
|
||
var len = this.layers.length;
|
||
var lastThreeDContainerData;
|
||
var currentContainer = '';
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.layers[i].ddd && this.layers[i].ty !== 3) {
|
||
if (currentContainer !== '3d') {
|
||
currentContainer = '3d';
|
||
lastThreeDContainerData = this.createThreeDContainer(i, '3d');
|
||
}
|
||
lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);
|
||
} else {
|
||
if (currentContainer !== '2d') {
|
||
currentContainer = '2d';
|
||
lastThreeDContainerData = this.createThreeDContainer(i, '2d');
|
||
}
|
||
lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);
|
||
}
|
||
}
|
||
len = this.threeDElements.length;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);
|
||
}
|
||
};
|
||
|
||
HybridRenderer.prototype.addTo3dContainer = function (elem, pos) {
|
||
var i = 0;
|
||
var len = this.threeDElements.length;
|
||
while (i < len) {
|
||
if (pos <= this.threeDElements[i].endPos) {
|
||
var j = this.threeDElements[i].startPos;
|
||
var nextElement;
|
||
while (j < pos) {
|
||
if (this.elements[j] && this.elements[j].getBaseElement) {
|
||
nextElement = this.elements[j].getBaseElement();
|
||
}
|
||
j += 1;
|
||
}
|
||
if (nextElement) {
|
||
this.threeDElements[i].container.insertBefore(elem, nextElement);
|
||
} else {
|
||
this.threeDElements[i].container.appendChild(elem);
|
||
}
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
};
|
||
|
||
HybridRenderer.prototype.configAnimation = function (animData) {
|
||
var resizerElem = createTag('div');
|
||
var wrapper = this.animationItem.wrapper;
|
||
var style = resizerElem.style;
|
||
style.width = animData.w + 'px';
|
||
style.height = animData.h + 'px';
|
||
this.resizerElem = resizerElem;
|
||
styleDiv(resizerElem);
|
||
style.transformStyle = 'flat';
|
||
style.mozTransformStyle = 'flat';
|
||
style.webkitTransformStyle = 'flat';
|
||
if (this.renderConfig.className) {
|
||
resizerElem.setAttribute('class', this.renderConfig.className);
|
||
}
|
||
wrapper.appendChild(resizerElem);
|
||
|
||
style.overflow = 'hidden';
|
||
var svg = createNS('svg');
|
||
svg.setAttribute('width', '1');
|
||
svg.setAttribute('height', '1');
|
||
styleDiv(svg);
|
||
this.resizerElem.appendChild(svg);
|
||
var defs = createNS('defs');
|
||
svg.appendChild(defs);
|
||
this.data = animData;
|
||
// Mask animation
|
||
this.setupGlobalData(animData, svg);
|
||
this.globalData.defs = defs;
|
||
this.layers = animData.layers;
|
||
this.layerElement = this.resizerElem;
|
||
this.build3dContainers();
|
||
this.updateContainerSize();
|
||
};
|
||
|
||
HybridRenderer.prototype.destroy = function () {
|
||
if (this.animationItem.wrapper) {
|
||
this.animationItem.wrapper.innerText = '';
|
||
}
|
||
this.animationItem.container = null;
|
||
this.globalData.defs = null;
|
||
var i;
|
||
var len = this.layers ? this.layers.length : 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.elements[i].destroy();
|
||
}
|
||
this.elements.length = 0;
|
||
this.destroyed = true;
|
||
this.animationItem = null;
|
||
};
|
||
|
||
HybridRenderer.prototype.updateContainerSize = function () {
|
||
var elementWidth = this.animationItem.wrapper.offsetWidth;
|
||
var elementHeight = this.animationItem.wrapper.offsetHeight;
|
||
var elementRel = elementWidth / elementHeight;
|
||
var animationRel = this.globalData.compSize.w / this.globalData.compSize.h;
|
||
var sx;
|
||
var sy;
|
||
var tx;
|
||
var ty;
|
||
if (animationRel > elementRel) {
|
||
sx = elementWidth / (this.globalData.compSize.w);
|
||
sy = elementWidth / (this.globalData.compSize.w);
|
||
tx = 0;
|
||
ty = ((elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2);
|
||
} else {
|
||
sx = elementHeight / (this.globalData.compSize.h);
|
||
sy = elementHeight / (this.globalData.compSize.h);
|
||
tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2;
|
||
ty = 0;
|
||
}
|
||
var style = this.resizerElem.style;
|
||
style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)';
|
||
style.transform = style.webkitTransform;
|
||
};
|
||
|
||
HybridRenderer.prototype.renderFrame = SVGRenderer.prototype.renderFrame;
|
||
|
||
HybridRenderer.prototype.hide = function () {
|
||
this.resizerElem.style.display = 'none';
|
||
};
|
||
|
||
HybridRenderer.prototype.show = function () {
|
||
this.resizerElem.style.display = 'block';
|
||
};
|
||
|
||
HybridRenderer.prototype.initItems = function () {
|
||
this.buildAllItems();
|
||
if (this.camera) {
|
||
this.camera.setup();
|
||
} else {
|
||
var cWidth = this.globalData.compSize.w;
|
||
var cHeight = this.globalData.compSize.h;
|
||
var i;
|
||
var len = this.threeDElements.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
var style = this.threeDElements[i].perspectiveElem.style;
|
||
style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px';
|
||
style.perspective = style.webkitPerspective;
|
||
}
|
||
}
|
||
};
|
||
|
||
HybridRenderer.prototype.searchExtraCompositions = function (assets) {
|
||
var i;
|
||
var len = assets.length;
|
||
var floatingContainer = createTag('div');
|
||
for (i = 0; i < len; i += 1) {
|
||
if (assets[i].xt) {
|
||
var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null);
|
||
comp.initExpressions();
|
||
this.globalData.projectInterface.registerComposition(comp);
|
||
}
|
||
}
|
||
};
|
||
|
||
/* global createSizedArray, createElementID, PropertyFactory, ShapePropertyFactory, createNS, locationHref */
|
||
|
||
function MaskElement(data, element, globalData) {
|
||
this.data = data;
|
||
this.element = element;
|
||
this.globalData = globalData;
|
||
this.storedData = [];
|
||
this.masksProperties = this.data.masksProperties || [];
|
||
this.maskElement = null;
|
||
var defs = this.globalData.defs;
|
||
var i;
|
||
var len = this.masksProperties ? this.masksProperties.length : 0;
|
||
this.viewData = createSizedArray(len);
|
||
this.solidPath = '';
|
||
|
||
var path;
|
||
var properties = this.masksProperties;
|
||
var count = 0;
|
||
var currentMasks = [];
|
||
var j;
|
||
var jLen;
|
||
var layerId = createElementID();
|
||
var rect;
|
||
var expansor;
|
||
var feMorph;
|
||
var x;
|
||
var maskType = 'clipPath';
|
||
var maskRef = 'clip-path';
|
||
for (i = 0; i < len; i += 1) {
|
||
if ((properties[i].mode !== 'a' && properties[i].mode !== 'n') || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) {
|
||
maskType = 'mask';
|
||
maskRef = 'mask';
|
||
}
|
||
|
||
if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) {
|
||
rect = createNS('rect');
|
||
rect.setAttribute('fill', '#ffffff');
|
||
rect.setAttribute('width', this.element.comp.data.w || 0);
|
||
rect.setAttribute('height', this.element.comp.data.h || 0);
|
||
currentMasks.push(rect);
|
||
} else {
|
||
rect = null;
|
||
}
|
||
|
||
path = createNS('path');
|
||
if (properties[i].mode === 'n') {
|
||
// TODO move this to a factory or to a constructor
|
||
this.viewData[i] = {
|
||
op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),
|
||
prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),
|
||
elem: path,
|
||
lastPath: '',
|
||
};
|
||
defs.appendChild(path);
|
||
} else {
|
||
count += 1;
|
||
|
||
path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff');
|
||
path.setAttribute('clip-rule', 'nonzero');
|
||
var filterID;
|
||
|
||
if (properties[i].x.k !== 0) {
|
||
maskType = 'mask';
|
||
maskRef = 'mask';
|
||
x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element);
|
||
filterID = createElementID();
|
||
expansor = createNS('filter');
|
||
expansor.setAttribute('id', filterID);
|
||
feMorph = createNS('feMorphology');
|
||
feMorph.setAttribute('operator', 'erode');
|
||
feMorph.setAttribute('in', 'SourceGraphic');
|
||
feMorph.setAttribute('radius', '0');
|
||
expansor.appendChild(feMorph);
|
||
defs.appendChild(expansor);
|
||
path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff');
|
||
} else {
|
||
feMorph = null;
|
||
x = null;
|
||
}
|
||
|
||
// TODO move this to a factory or to a constructor
|
||
this.storedData[i] = {
|
||
elem: path,
|
||
x: x,
|
||
expan: feMorph,
|
||
lastPath: '',
|
||
lastOperator: '',
|
||
filterId: filterID,
|
||
lastRadius: 0,
|
||
};
|
||
if (properties[i].mode === 'i') {
|
||
jLen = currentMasks.length;
|
||
var g = createNS('g');
|
||
for (j = 0; j < jLen; j += 1) {
|
||
g.appendChild(currentMasks[j]);
|
||
}
|
||
var mask = createNS('mask');
|
||
mask.setAttribute('mask-type', 'alpha');
|
||
mask.setAttribute('id', layerId + '_' + count);
|
||
mask.appendChild(path);
|
||
defs.appendChild(mask);
|
||
g.setAttribute('mask', 'url(' + locationHref + '#' + layerId + '_' + count + ')');
|
||
|
||
currentMasks.length = 0;
|
||
currentMasks.push(g);
|
||
} else {
|
||
currentMasks.push(path);
|
||
}
|
||
if (properties[i].inv && !this.solidPath) {
|
||
this.solidPath = this.createLayerSolidPath();
|
||
}
|
||
// TODO move this to a factory or to a constructor
|
||
this.viewData[i] = {
|
||
elem: path,
|
||
lastPath: '',
|
||
op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),
|
||
prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),
|
||
invRect: rect,
|
||
};
|
||
if (!this.viewData[i].prop.k) {
|
||
this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]);
|
||
}
|
||
}
|
||
}
|
||
|
||
this.maskElement = createNS(maskType);
|
||
|
||
len = currentMasks.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.maskElement.appendChild(currentMasks[i]);
|
||
}
|
||
|
||
if (count > 0) {
|
||
this.maskElement.setAttribute('id', layerId);
|
||
this.element.maskedElement.setAttribute(maskRef, 'url(' + locationHref + '#' + layerId + ')');
|
||
defs.appendChild(this.maskElement);
|
||
}
|
||
if (this.viewData.length) {
|
||
this.element.addRenderableComponent(this);
|
||
}
|
||
}
|
||
|
||
MaskElement.prototype.getMaskProperty = function (pos) {
|
||
return this.viewData[pos].prop;
|
||
};
|
||
|
||
MaskElement.prototype.renderFrame = function (isFirstFrame) {
|
||
var finalMat = this.element.finalTransform.mat;
|
||
var i;
|
||
var len = this.masksProperties.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.viewData[i].prop._mdf || isFirstFrame) {
|
||
this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]);
|
||
}
|
||
if (this.viewData[i].op._mdf || isFirstFrame) {
|
||
this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v);
|
||
}
|
||
if (this.masksProperties[i].mode !== 'n') {
|
||
if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {
|
||
this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS());
|
||
}
|
||
if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {
|
||
var feMorph = this.storedData[i].expan;
|
||
if (this.storedData[i].x.v < 0) {
|
||
if (this.storedData[i].lastOperator !== 'erode') {
|
||
this.storedData[i].lastOperator = 'erode';
|
||
this.storedData[i].elem.setAttribute('filter', 'url(' + locationHref + '#' + this.storedData[i].filterId + ')');
|
||
}
|
||
feMorph.setAttribute('radius', -this.storedData[i].x.v);
|
||
} else {
|
||
if (this.storedData[i].lastOperator !== 'dilate') {
|
||
this.storedData[i].lastOperator = 'dilate';
|
||
this.storedData[i].elem.setAttribute('filter', null);
|
||
}
|
||
this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
MaskElement.prototype.getMaskelement = function () {
|
||
return this.maskElement;
|
||
};
|
||
|
||
MaskElement.prototype.createLayerSolidPath = function () {
|
||
var path = 'M0,0 ';
|
||
path += ' h' + this.globalData.compSize.w;
|
||
path += ' v' + this.globalData.compSize.h;
|
||
path += ' h-' + this.globalData.compSize.w;
|
||
path += ' v-' + this.globalData.compSize.h + ' ';
|
||
return path;
|
||
};
|
||
|
||
MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {
|
||
var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];
|
||
var i;
|
||
var len;
|
||
len = pathNodes._length;
|
||
for (i = 1; i < len; i += 1) {
|
||
// pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[i][0]+','+pathNodes.i[i][1] + " "+pathNodes.v[i][0]+','+pathNodes.v[i][1];
|
||
pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + ' ' + pathNodes.v[i][0] + ',' + pathNodes.v[i][1];
|
||
}
|
||
// pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[0][0]+','+pathNodes.i[0][1] + " "+pathNodes.v[0][0]+','+pathNodes.v[0][1];
|
||
if (pathNodes.c && len > 1) {
|
||
pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + ' ' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];
|
||
}
|
||
// pathNodes.__renderedString = pathString;
|
||
|
||
if (viewData.lastPath !== pathString) {
|
||
var pathShapeValue = '';
|
||
if (viewData.elem) {
|
||
if (pathNodes.c) {
|
||
pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;
|
||
}
|
||
viewData.elem.setAttribute('d', pathShapeValue);
|
||
}
|
||
viewData.lastPath = pathString;
|
||
}
|
||
};
|
||
|
||
MaskElement.prototype.destroy = function () {
|
||
this.element = null;
|
||
this.globalData = null;
|
||
this.maskElement = null;
|
||
this.data = null;
|
||
this.masksProperties = null;
|
||
};
|
||
|
||
/**
|
||
* @file
|
||
* Handles AE's layer parenting property.
|
||
*
|
||
*/
|
||
|
||
function HierarchyElement() {}
|
||
|
||
HierarchyElement.prototype = {
|
||
/**
|
||
* @function
|
||
* Initializes hierarchy properties
|
||
*
|
||
*/
|
||
initHierarchy: function () {
|
||
// element's parent list
|
||
this.hierarchy = [];
|
||
// if element is parent of another layer _isParent will be true
|
||
this._isParent = false;
|
||
this.checkParenting();
|
||
},
|
||
/**
|
||
* @function
|
||
* Sets layer's hierarchy.
|
||
* @param {array} hierarch
|
||
* layer's parent list
|
||
*
|
||
*/
|
||
setHierarchy: function (hierarchy) {
|
||
this.hierarchy = hierarchy;
|
||
},
|
||
/**
|
||
* @function
|
||
* Sets layer as parent.
|
||
*
|
||
*/
|
||
setAsParent: function () {
|
||
this._isParent = true;
|
||
},
|
||
/**
|
||
* @function
|
||
* Searches layer's parenting chain
|
||
*
|
||
*/
|
||
checkParenting: function () {
|
||
if (this.data.parent !== undefined) {
|
||
this.comp.buildElementParenting(this, this.data.parent, []);
|
||
}
|
||
},
|
||
};
|
||
|
||
/**
|
||
* @file
|
||
* Handles element's layer frame update.
|
||
* Checks layer in point and out point
|
||
*
|
||
*/
|
||
|
||
function FrameElement() {}
|
||
|
||
FrameElement.prototype = {
|
||
/**
|
||
* @function
|
||
* Initializes frame related properties.
|
||
*
|
||
*/
|
||
initFrame: function () {
|
||
// set to true when inpoint is rendered
|
||
this._isFirstFrame = false;
|
||
// list of animated properties
|
||
this.dynamicProperties = [];
|
||
// If layer has been modified in current tick this will be true
|
||
this._mdf = false;
|
||
},
|
||
/**
|
||
* @function
|
||
* Calculates all dynamic values
|
||
*
|
||
* @param {number} num
|
||
* current frame number in Layer's time
|
||
* @param {boolean} isVisible
|
||
* if layers is currently in range
|
||
*
|
||
*/
|
||
prepareProperties: function (num, isVisible) {
|
||
var i;
|
||
var len = this.dynamicProperties.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {
|
||
this.dynamicProperties[i].getValue();
|
||
if (this.dynamicProperties[i]._mdf) {
|
||
this.globalData._mdf = true;
|
||
this._mdf = true;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
addDynamicProperty: function (prop) {
|
||
if (this.dynamicProperties.indexOf(prop) === -1) {
|
||
this.dynamicProperties.push(prop);
|
||
}
|
||
},
|
||
};
|
||
|
||
/* global TransformPropertyFactory, Matrix */
|
||
|
||
function TransformElement() {}
|
||
|
||
TransformElement.prototype = {
|
||
initTransform: function () {
|
||
this.finalTransform = {
|
||
mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { o: 0 },
|
||
_matMdf: false,
|
||
_opMdf: false,
|
||
mat: new Matrix(),
|
||
};
|
||
if (this.data.ao) {
|
||
this.finalTransform.mProp.autoOriented = true;
|
||
}
|
||
|
||
// TODO: check TYPE 11: Guided elements
|
||
if (this.data.ty !== 11) {
|
||
// this.createElements();
|
||
}
|
||
},
|
||
renderTransform: function () {
|
||
this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;
|
||
this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;
|
||
|
||
if (this.hierarchy) {
|
||
var mat;
|
||
var finalMat = this.finalTransform.mat;
|
||
var i = 0;
|
||
var len = this.hierarchy.length;
|
||
// Checking if any of the transformation matrices in the hierarchy chain has changed.
|
||
if (!this.finalTransform._matMdf) {
|
||
while (i < len) {
|
||
if (this.hierarchy[i].finalTransform.mProp._mdf) {
|
||
this.finalTransform._matMdf = true;
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
}
|
||
|
||
if (this.finalTransform._matMdf) {
|
||
mat = this.finalTransform.mProp.v.props;
|
||
finalMat.cloneFromProps(mat);
|
||
for (i = 0; i < len; i += 1) {
|
||
mat = this.hierarchy[i].finalTransform.mProp.v.props;
|
||
finalMat.transform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
globalToLocal: function (pt) {
|
||
var transforms = [];
|
||
transforms.push(this.finalTransform);
|
||
var flag = true;
|
||
var comp = this.comp;
|
||
while (flag) {
|
||
if (comp.finalTransform) {
|
||
if (comp.data.hasMask) {
|
||
transforms.splice(0, 0, comp.finalTransform);
|
||
}
|
||
comp = comp.comp;
|
||
} else {
|
||
flag = false;
|
||
}
|
||
}
|
||
var i;
|
||
var len = transforms.length;
|
||
var ptNew;
|
||
for (i = 0; i < len; i += 1) {
|
||
ptNew = transforms[i].mat.applyToPointArray(0, 0, 0);
|
||
// ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);
|
||
pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];
|
||
}
|
||
return pt;
|
||
},
|
||
mHelper: new Matrix(),
|
||
};
|
||
|
||
function RenderableElement() {
|
||
|
||
}
|
||
|
||
RenderableElement.prototype = {
|
||
initRenderable: function () {
|
||
// layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange
|
||
this.isInRange = false;
|
||
// layer's display state
|
||
this.hidden = false;
|
||
// If layer's transparency equals 0, it can be hidden
|
||
this.isTransparent = false;
|
||
// list of animated components
|
||
this.renderableComponents = [];
|
||
},
|
||
addRenderableComponent: function (component) {
|
||
if (this.renderableComponents.indexOf(component) === -1) {
|
||
this.renderableComponents.push(component);
|
||
}
|
||
},
|
||
removeRenderableComponent: function (component) {
|
||
if (this.renderableComponents.indexOf(component) !== -1) {
|
||
this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);
|
||
}
|
||
},
|
||
prepareRenderableFrame: function (num) {
|
||
this.checkLayerLimits(num);
|
||
},
|
||
checkTransparency: function () {
|
||
if (this.finalTransform.mProp.o.v <= 0) {
|
||
if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {
|
||
this.isTransparent = true;
|
||
this.hide();
|
||
}
|
||
} else if (this.isTransparent) {
|
||
this.isTransparent = false;
|
||
this.show();
|
||
}
|
||
},
|
||
/**
|
||
* @function
|
||
* Initializes frame related properties.
|
||
*
|
||
* @param {number} num
|
||
* current frame number in Layer's time
|
||
*
|
||
*/
|
||
checkLayerLimits: function (num) {
|
||
if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {
|
||
if (this.isInRange !== true) {
|
||
this.globalData._mdf = true;
|
||
this._mdf = true;
|
||
this.isInRange = true;
|
||
this.show();
|
||
}
|
||
} else if (this.isInRange !== false) {
|
||
this.globalData._mdf = true;
|
||
this.isInRange = false;
|
||
this.hide();
|
||
}
|
||
},
|
||
renderRenderable: function () {
|
||
var i;
|
||
var len = this.renderableComponents.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.renderableComponents[i].renderFrame(this._isFirstFrame);
|
||
}
|
||
/* this.maskManager.renderFrame(this.finalTransform.mat);
|
||
this.renderableEffectsManager.renderFrame(this._isFirstFrame); */
|
||
},
|
||
sourceRectAtTime: function () {
|
||
return {
|
||
top: 0,
|
||
left: 0,
|
||
width: 100,
|
||
height: 100,
|
||
};
|
||
},
|
||
getLayerSize: function () {
|
||
if (this.data.ty === 5) {
|
||
return { w: this.data.textData.width, h: this.data.textData.height };
|
||
}
|
||
return { w: this.data.width, h: this.data.height };
|
||
},
|
||
};
|
||
|
||
/* global extendPrototype, RenderableElement, createProxyFunction */
|
||
|
||
function RenderableDOMElement() {}
|
||
|
||
(function () {
|
||
var _prototype = {
|
||
initElement: function (data, globalData, comp) {
|
||
this.initFrame();
|
||
this.initBaseData(data, globalData, comp);
|
||
this.initTransform(data, globalData, comp);
|
||
this.initHierarchy();
|
||
this.initRenderable();
|
||
this.initRendererElement();
|
||
this.createContainerElements();
|
||
this.createRenderableComponents();
|
||
this.createContent();
|
||
this.hide();
|
||
},
|
||
hide: function () {
|
||
if (!this.hidden && (!this.isInRange || this.isTransparent)) {
|
||
var elem = this.baseElement || this.layerElement;
|
||
elem.style.display = 'none';
|
||
this.hidden = true;
|
||
}
|
||
},
|
||
show: function () {
|
||
if (this.isInRange && !this.isTransparent) {
|
||
if (!this.data.hd) {
|
||
var elem = this.baseElement || this.layerElement;
|
||
elem.style.display = 'block';
|
||
}
|
||
this.hidden = false;
|
||
this._isFirstFrame = true;
|
||
}
|
||
},
|
||
renderFrame: function () {
|
||
// If it is exported as hidden (data.hd === true) no need to render
|
||
// If it is not visible no need to render
|
||
if (this.data.hd || this.hidden) {
|
||
return;
|
||
}
|
||
this.renderTransform();
|
||
this.renderRenderable();
|
||
this.renderElement();
|
||
this.renderInnerContent();
|
||
if (this._isFirstFrame) {
|
||
this._isFirstFrame = false;
|
||
}
|
||
},
|
||
renderInnerContent: function () {},
|
||
prepareFrame: function (num) {
|
||
this._mdf = false;
|
||
this.prepareRenderableFrame(num);
|
||
this.prepareProperties(num, this.isInRange);
|
||
this.checkTransparency();
|
||
},
|
||
destroy: function () {
|
||
this.innerElem = null;
|
||
this.destroyBaseElement();
|
||
},
|
||
};
|
||
extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);
|
||
}());
|
||
|
||
/* exported ProcessedElement */
|
||
|
||
function ProcessedElement(element, position) {
|
||
this.elem = element;
|
||
this.pos = position;
|
||
}
|
||
|
||
/* global createNS */
|
||
|
||
function SVGStyleData(data, level) {
|
||
this.data = data;
|
||
this.type = data.ty;
|
||
this.d = '';
|
||
this.lvl = level;
|
||
this._mdf = false;
|
||
this.closed = data.hd === true;
|
||
this.pElem = createNS('path');
|
||
this.msElem = null;
|
||
}
|
||
|
||
SVGStyleData.prototype.reset = function () {
|
||
this.d = '';
|
||
this._mdf = false;
|
||
};
|
||
|
||
function SVGShapeData(transformers, level, shape) {
|
||
this.caches = [];
|
||
this.styles = [];
|
||
this.transformers = transformers;
|
||
this.lStr = '';
|
||
this.sh = shape;
|
||
this.lvl = level;
|
||
// TODO find if there are some cases where _isAnimated can be false.
|
||
// For now, since shapes add up with other shapes. They have to be calculated every time.
|
||
// One way of finding out is checking if all styles associated to this shape depend only of this shape
|
||
this._isAnimated = !!shape.k;
|
||
// TODO: commenting this for now since all shapes are animated
|
||
var i = 0;
|
||
var len = transformers.length;
|
||
while (i < len) {
|
||
if (transformers[i].mProps.dynamicProperties.length) {
|
||
this._isAnimated = true;
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
}
|
||
|
||
SVGShapeData.prototype.setAsAnimated = function () {
|
||
this._isAnimated = true;
|
||
};
|
||
|
||
/* exported SVGTransformData */
|
||
|
||
function SVGTransformData(mProps, op, container) {
|
||
this.transform = {
|
||
mProps: mProps,
|
||
op: op,
|
||
container: container,
|
||
};
|
||
this.elements = [];
|
||
this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;
|
||
}
|
||
|
||
/* global DashProperty, PropertyFactory, extendPrototype, DynamicPropertyContainer */
|
||
|
||
function SVGStrokeStyleData(elem, data, styleOb) {
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.getValue = this.iterateDynamicProperties;
|
||
this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
|
||
this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);
|
||
this.d = new DashProperty(elem, data.d || {}, 'svg', this);
|
||
this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);
|
||
this.style = styleOb;
|
||
this._isAnimated = !!this._isAnimated;
|
||
}
|
||
|
||
extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);
|
||
|
||
/* global PropertyFactory, extendPrototype, DynamicPropertyContainer */
|
||
|
||
function SVGFillStyleData(elem, data, styleOb) {
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.getValue = this.iterateDynamicProperties;
|
||
this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
|
||
this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);
|
||
this.style = styleOb;
|
||
}
|
||
|
||
extendPrototype([DynamicPropertyContainer], SVGFillStyleData);
|
||
|
||
/* global PropertyFactory, degToRads, GradientProperty, createElementID, createNS, locationHref,
|
||
extendPrototype, DynamicPropertyContainer, lineCapEnum, lineJoinEnum */
|
||
|
||
function SVGGradientFillStyleData(elem, data, styleOb) {
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.getValue = this.iterateDynamicProperties;
|
||
this.initGradientData(elem, data, styleOb);
|
||
}
|
||
|
||
SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {
|
||
this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
|
||
this.s = PropertyFactory.getProp(elem, data.s, 1, null, this);
|
||
this.e = PropertyFactory.getProp(elem, data.e, 1, null, this);
|
||
this.h = PropertyFactory.getProp(elem, data.h || { k: 0 }, 0, 0.01, this);
|
||
this.a = PropertyFactory.getProp(elem, data.a || { k: 0 }, 0, degToRads, this);
|
||
this.g = new GradientProperty(elem, data.g, this);
|
||
this.style = styleOb;
|
||
this.stops = [];
|
||
this.setGradientData(styleOb.pElem, data);
|
||
this.setGradientOpacity(data, styleOb);
|
||
this._isAnimated = !!this._isAnimated;
|
||
};
|
||
|
||
SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {
|
||
var gradientId = createElementID();
|
||
var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
|
||
gfill.setAttribute('id', gradientId);
|
||
gfill.setAttribute('spreadMethod', 'pad');
|
||
gfill.setAttribute('gradientUnits', 'userSpaceOnUse');
|
||
var stops = [];
|
||
var stop;
|
||
var j;
|
||
var jLen;
|
||
jLen = data.g.p * 4;
|
||
for (j = 0; j < jLen; j += 4) {
|
||
stop = createNS('stop');
|
||
gfill.appendChild(stop);
|
||
stops.push(stop);
|
||
}
|
||
pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + gradientId + ')');
|
||
this.gf = gfill;
|
||
this.cst = stops;
|
||
};
|
||
|
||
SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {
|
||
if (this.g._hasOpacity && !this.g._collapsable) {
|
||
var stop;
|
||
var j;
|
||
var jLen;
|
||
var mask = createNS('mask');
|
||
var maskElement = createNS('path');
|
||
mask.appendChild(maskElement);
|
||
var opacityId = createElementID();
|
||
var maskId = createElementID();
|
||
mask.setAttribute('id', maskId);
|
||
var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
|
||
opFill.setAttribute('id', opacityId);
|
||
opFill.setAttribute('spreadMethod', 'pad');
|
||
opFill.setAttribute('gradientUnits', 'userSpaceOnUse');
|
||
jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;
|
||
var stops = this.stops;
|
||
for (j = data.g.p * 4; j < jLen; j += 2) {
|
||
stop = createNS('stop');
|
||
stop.setAttribute('stop-color', 'rgb(255,255,255)');
|
||
opFill.appendChild(stop);
|
||
stops.push(stop);
|
||
}
|
||
maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + opacityId + ')');
|
||
if (data.ty === 'gs') {
|
||
maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);
|
||
maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);
|
||
if (data.lj === 1) {
|
||
maskElement.setAttribute('stroke-miterlimit', data.ml);
|
||
}
|
||
}
|
||
this.of = opFill;
|
||
this.ms = mask;
|
||
this.ost = stops;
|
||
this.maskId = maskId;
|
||
styleOb.msElem = maskElement;
|
||
}
|
||
};
|
||
|
||
extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);
|
||
|
||
/* global PropertyFactory, DashProperty, extendPrototype, SVGGradientFillStyleData, DynamicPropertyContainer */
|
||
|
||
function SVGGradientStrokeStyleData(elem, data, styleOb) {
|
||
this.initDynamicPropertyContainer(elem);
|
||
this.getValue = this.iterateDynamicProperties;
|
||
this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);
|
||
this.d = new DashProperty(elem, data.d || {}, 'svg', this);
|
||
this.initGradientData(elem, data, styleOb);
|
||
this._isAnimated = !!this._isAnimated;
|
||
}
|
||
|
||
extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);
|
||
|
||
/* global createNS */
|
||
/* exported ShapeGroupData */
|
||
|
||
function ShapeGroupData() {
|
||
this.it = [];
|
||
this.prevViewData = [];
|
||
this.gr = createNS('g');
|
||
}
|
||
|
||
/* global Matrix, buildShapeString, bmFloor */
|
||
/* exported SVGElementsRenderer */
|
||
|
||
var SVGElementsRenderer = (function () {
|
||
var _identityMatrix = new Matrix();
|
||
var _matrixHelper = new Matrix();
|
||
|
||
var ob = {
|
||
createRenderFunction: createRenderFunction,
|
||
};
|
||
|
||
function createRenderFunction(data) {
|
||
switch (data.ty) {
|
||
case 'fl':
|
||
return renderFill;
|
||
case 'gf':
|
||
return renderGradient;
|
||
case 'gs':
|
||
return renderGradientStroke;
|
||
case 'st':
|
||
return renderStroke;
|
||
case 'sh':
|
||
case 'el':
|
||
case 'rc':
|
||
case 'sr':
|
||
return renderPath;
|
||
case 'tr':
|
||
return renderContentTransform;
|
||
default:
|
||
return null;
|
||
}
|
||
}
|
||
|
||
function renderContentTransform(styleData, itemData, isFirstFrame) {
|
||
if (isFirstFrame || itemData.transform.op._mdf) {
|
||
itemData.transform.container.setAttribute('opacity', itemData.transform.op.v);
|
||
}
|
||
if (isFirstFrame || itemData.transform.mProps._mdf) {
|
||
itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS());
|
||
}
|
||
}
|
||
|
||
function renderPath(styleData, itemData, isFirstFrame) {
|
||
var j;
|
||
var jLen;
|
||
var pathStringTransformed;
|
||
var redraw;
|
||
var pathNodes;
|
||
var l;
|
||
var lLen = itemData.styles.length;
|
||
var lvl = itemData.lvl;
|
||
var paths;
|
||
var mat;
|
||
var props;
|
||
var iterations;
|
||
var k;
|
||
for (l = 0; l < lLen; l += 1) {
|
||
redraw = itemData.sh._mdf || isFirstFrame;
|
||
if (itemData.styles[l].lvl < lvl) {
|
||
mat = _matrixHelper.reset();
|
||
iterations = lvl - itemData.styles[l].lvl;
|
||
k = itemData.transformers.length - 1;
|
||
while (!redraw && iterations > 0) {
|
||
redraw = itemData.transformers[k].mProps._mdf || redraw;
|
||
iterations -= 1;
|
||
k -= 1;
|
||
}
|
||
if (redraw) {
|
||
iterations = lvl - itemData.styles[l].lvl;
|
||
k = itemData.transformers.length - 1;
|
||
while (iterations > 0) {
|
||
props = itemData.transformers[k].mProps.v.props;
|
||
mat.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);
|
||
iterations -= 1;
|
||
k -= 1;
|
||
}
|
||
}
|
||
} else {
|
||
mat = _identityMatrix;
|
||
}
|
||
paths = itemData.sh.paths;
|
||
jLen = paths._length;
|
||
if (redraw) {
|
||
pathStringTransformed = '';
|
||
for (j = 0; j < jLen; j += 1) {
|
||
pathNodes = paths.shapes[j];
|
||
if (pathNodes && pathNodes._length) {
|
||
pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);
|
||
}
|
||
}
|
||
itemData.caches[l] = pathStringTransformed;
|
||
} else {
|
||
pathStringTransformed = itemData.caches[l];
|
||
}
|
||
itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;
|
||
itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;
|
||
}
|
||
}
|
||
|
||
function renderFill(styleData, itemData, isFirstFrame) {
|
||
var styleElem = itemData.style;
|
||
|
||
if (itemData.c._mdf || isFirstFrame) {
|
||
styleElem.pElem.setAttribute('fill', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');
|
||
}
|
||
if (itemData.o._mdf || isFirstFrame) {
|
||
styleElem.pElem.setAttribute('fill-opacity', itemData.o.v);
|
||
}
|
||
}
|
||
|
||
function renderGradientStroke(styleData, itemData, isFirstFrame) {
|
||
renderGradient(styleData, itemData, isFirstFrame);
|
||
renderStroke(styleData, itemData, isFirstFrame);
|
||
}
|
||
|
||
function renderGradient(styleData, itemData, isFirstFrame) {
|
||
var gfill = itemData.gf;
|
||
var hasOpacity = itemData.g._hasOpacity;
|
||
var pt1 = itemData.s.v;
|
||
var pt2 = itemData.e.v;
|
||
|
||
if (itemData.o._mdf || isFirstFrame) {
|
||
var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';
|
||
itemData.style.pElem.setAttribute(attr, itemData.o.v);
|
||
}
|
||
if (itemData.s._mdf || isFirstFrame) {
|
||
var attr1 = styleData.t === 1 ? 'x1' : 'cx';
|
||
var attr2 = attr1 === 'x1' ? 'y1' : 'cy';
|
||
gfill.setAttribute(attr1, pt1[0]);
|
||
gfill.setAttribute(attr2, pt1[1]);
|
||
if (hasOpacity && !itemData.g._collapsable) {
|
||
itemData.of.setAttribute(attr1, pt1[0]);
|
||
itemData.of.setAttribute(attr2, pt1[1]);
|
||
}
|
||
}
|
||
var stops;
|
||
var i;
|
||
var len;
|
||
var stop;
|
||
if (itemData.g._cmdf || isFirstFrame) {
|
||
stops = itemData.cst;
|
||
var cValues = itemData.g.c;
|
||
len = stops.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
stop = stops[i];
|
||
stop.setAttribute('offset', cValues[i * 4] + '%');
|
||
stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')');
|
||
}
|
||
}
|
||
if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {
|
||
var oValues = itemData.g.o;
|
||
if (itemData.g._collapsable) {
|
||
stops = itemData.cst;
|
||
} else {
|
||
stops = itemData.ost;
|
||
}
|
||
len = stops.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
stop = stops[i];
|
||
if (!itemData.g._collapsable) {
|
||
stop.setAttribute('offset', oValues[i * 2] + '%');
|
||
}
|
||
stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);
|
||
}
|
||
}
|
||
if (styleData.t === 1) {
|
||
if (itemData.e._mdf || isFirstFrame) {
|
||
gfill.setAttribute('x2', pt2[0]);
|
||
gfill.setAttribute('y2', pt2[1]);
|
||
if (hasOpacity && !itemData.g._collapsable) {
|
||
itemData.of.setAttribute('x2', pt2[0]);
|
||
itemData.of.setAttribute('y2', pt2[1]);
|
||
}
|
||
}
|
||
} else {
|
||
var rad;
|
||
if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {
|
||
rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
|
||
gfill.setAttribute('r', rad);
|
||
if (hasOpacity && !itemData.g._collapsable) {
|
||
itemData.of.setAttribute('r', rad);
|
||
}
|
||
}
|
||
if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {
|
||
if (!rad) {
|
||
rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
|
||
}
|
||
var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
|
||
|
||
var percent = itemData.h.v;
|
||
if (percent >= 1) {
|
||
percent = 0.99;
|
||
} else if (percent <= -1) {
|
||
percent = -0.99;
|
||
}
|
||
var dist = rad * percent;
|
||
var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
|
||
var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
|
||
gfill.setAttribute('fx', x);
|
||
gfill.setAttribute('fy', y);
|
||
if (hasOpacity && !itemData.g._collapsable) {
|
||
itemData.of.setAttribute('fx', x);
|
||
itemData.of.setAttribute('fy', y);
|
||
}
|
||
}
|
||
// gfill.setAttribute('fy','200');
|
||
}
|
||
}
|
||
|
||
function renderStroke(styleData, itemData, isFirstFrame) {
|
||
var styleElem = itemData.style;
|
||
var d = itemData.d;
|
||
if (d && (d._mdf || isFirstFrame) && d.dashStr) {
|
||
styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);
|
||
styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);
|
||
}
|
||
if (itemData.c && (itemData.c._mdf || isFirstFrame)) {
|
||
styleElem.pElem.setAttribute('stroke', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');
|
||
}
|
||
if (itemData.o._mdf || isFirstFrame) {
|
||
styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);
|
||
}
|
||
if (itemData.w._mdf || isFirstFrame) {
|
||
styleElem.pElem.setAttribute('stroke-width', itemData.w.v);
|
||
if (styleElem.msElem) {
|
||
styleElem.msElem.setAttribute('stroke-width', itemData.w.v);
|
||
}
|
||
}
|
||
}
|
||
|
||
return ob;
|
||
}());
|
||
|
||
/* global Matrix */
|
||
|
||
function ShapeTransformManager() {
|
||
this.sequences = {};
|
||
this.sequenceList = [];
|
||
this.transform_key_count = 0;
|
||
}
|
||
|
||
ShapeTransformManager.prototype = {
|
||
addTransformSequence: function (transforms) {
|
||
var i;
|
||
var len = transforms.length;
|
||
var key = '_';
|
||
for (i = 0; i < len; i += 1) {
|
||
key += transforms[i].transform.key + '_';
|
||
}
|
||
var sequence = this.sequences[key];
|
||
if (!sequence) {
|
||
sequence = {
|
||
transforms: [].concat(transforms),
|
||
finalTransform: new Matrix(),
|
||
_mdf: false,
|
||
};
|
||
this.sequences[key] = sequence;
|
||
this.sequenceList.push(sequence);
|
||
}
|
||
return sequence;
|
||
},
|
||
processSequence: function (sequence, isFirstFrame) {
|
||
var i = 0;
|
||
var len = sequence.transforms.length;
|
||
var _mdf = isFirstFrame;
|
||
while (i < len && !isFirstFrame) {
|
||
if (sequence.transforms[i].transform.mProps._mdf) {
|
||
_mdf = true;
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
if (_mdf) {
|
||
var props;
|
||
sequence.finalTransform.reset();
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
props = sequence.transforms[i].transform.mProps.v.props;
|
||
sequence.finalTransform.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);
|
||
}
|
||
}
|
||
sequence._mdf = _mdf;
|
||
},
|
||
processSequences: function (isFirstFrame) {
|
||
var i;
|
||
var len = this.sequenceList.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.processSequence(this.sequenceList[i], isFirstFrame);
|
||
}
|
||
},
|
||
getNewKey: function () {
|
||
this.transform_key_count += 1;
|
||
return '_' + this.transform_key_count;
|
||
},
|
||
};
|
||
|
||
/* global ShapePropertyFactory, SVGShapeData */
|
||
|
||
function CVShapeData(element, data, styles, transformsManager) {
|
||
this.styledShapes = [];
|
||
this.tr = [0, 0, 0, 0, 0, 0];
|
||
var ty = 4;
|
||
if (data.ty === 'rc') {
|
||
ty = 5;
|
||
} else if (data.ty === 'el') {
|
||
ty = 6;
|
||
} else if (data.ty === 'sr') {
|
||
ty = 7;
|
||
}
|
||
this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);
|
||
var i;
|
||
var len = styles.length;
|
||
var styledShape;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (!styles[i].closed) {
|
||
styledShape = {
|
||
transforms: transformsManager.addTransformSequence(styles[i].transforms),
|
||
trNodes: [],
|
||
};
|
||
this.styledShapes.push(styledShape);
|
||
styles[i].elements.push(styledShape);
|
||
}
|
||
}
|
||
}
|
||
|
||
CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;
|
||
|
||
/* global LayerExpressionInterface, EffectsExpressionInterface, CompExpressionInterface, ShapeExpressionInterface,
|
||
TextExpressionInterface, getBlendMode,createElementID, EffectsManager */
|
||
|
||
function BaseElement() {
|
||
}
|
||
|
||
BaseElement.prototype = {
|
||
checkMasks: function () {
|
||
if (!this.data.hasMask) {
|
||
return false;
|
||
}
|
||
var i = 0;
|
||
var len = this.data.masksProperties.length;
|
||
while (i < len) {
|
||
if ((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) {
|
||
return true;
|
||
}
|
||
i += 1;
|
||
}
|
||
return false;
|
||
},
|
||
initExpressions: function () {
|
||
this.layerInterface = LayerExpressionInterface(this);
|
||
if (this.data.hasMask && this.maskManager) {
|
||
this.layerInterface.registerMaskInterface(this.maskManager);
|
||
}
|
||
var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface);
|
||
this.layerInterface.registerEffectsInterface(effectsInterface);
|
||
|
||
if (this.data.ty === 0 || this.data.xt) {
|
||
this.compInterface = CompExpressionInterface(this);
|
||
} else if (this.data.ty === 4) {
|
||
this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface);
|
||
this.layerInterface.content = this.layerInterface.shapeInterface;
|
||
} else if (this.data.ty === 5) {
|
||
this.layerInterface.textInterface = TextExpressionInterface(this);
|
||
this.layerInterface.text = this.layerInterface.textInterface;
|
||
}
|
||
},
|
||
setBlendMode: function () {
|
||
var blendModeValue = getBlendMode(this.data.bm);
|
||
var elem = this.baseElement || this.layerElement;
|
||
|
||
elem.style['mix-blend-mode'] = blendModeValue;
|
||
},
|
||
initBaseData: function (data, globalData, comp) {
|
||
this.globalData = globalData;
|
||
this.comp = comp;
|
||
this.data = data;
|
||
this.layerId = createElementID();
|
||
|
||
// Stretch factor for old animations missing this property.
|
||
if (!this.data.sr) {
|
||
this.data.sr = 1;
|
||
}
|
||
// effects manager
|
||
this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties);
|
||
},
|
||
getType: function () {
|
||
return this.type;
|
||
},
|
||
sourceRectAtTime: function () {},
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, HierarchyElement, FrameElement */
|
||
|
||
function NullElement(data, globalData, comp) {
|
||
this.initFrame();
|
||
this.initBaseData(data, globalData, comp);
|
||
this.initFrame();
|
||
this.initTransform(data, globalData, comp);
|
||
this.initHierarchy();
|
||
}
|
||
|
||
NullElement.prototype.prepareFrame = function (num) {
|
||
this.prepareProperties(num, true);
|
||
};
|
||
|
||
NullElement.prototype.renderFrame = function () {
|
||
};
|
||
|
||
NullElement.prototype.getBaseElement = function () {
|
||
return null;
|
||
};
|
||
|
||
NullElement.prototype.destroy = function () {
|
||
};
|
||
|
||
NullElement.prototype.sourceRectAtTime = function () {
|
||
};
|
||
|
||
NullElement.prototype.hide = function () {
|
||
};
|
||
|
||
extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement);
|
||
|
||
/* global filtersFactory, featureSupport, filtersFactory, createElementID, createNS, MaskElement, SVGEffects, locationHref */
|
||
|
||
function SVGBaseElement() {
|
||
}
|
||
|
||
SVGBaseElement.prototype = {
|
||
initRendererElement: function () {
|
||
this.layerElement = createNS('g');
|
||
},
|
||
createContainerElements: function () {
|
||
this.matteElement = createNS('g');
|
||
this.transformedElement = this.layerElement;
|
||
this.maskedElement = this.layerElement;
|
||
this._sizeChanged = false;
|
||
var layerElementParent = null;
|
||
// If this layer acts as a mask for the following layer
|
||
var filId;
|
||
var fil;
|
||
var gg;
|
||
if (this.data.td) {
|
||
if (this.data.td == 3 || this.data.td == 1) { // eslint-disable-line eqeqeq
|
||
var masker = createNS('mask');
|
||
masker.setAttribute('id', this.layerId);
|
||
masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha'); // eslint-disable-line eqeqeq
|
||
masker.appendChild(this.layerElement);
|
||
layerElementParent = masker;
|
||
this.globalData.defs.appendChild(masker);
|
||
// This is only for IE and Edge when mask if of type alpha
|
||
if (!featureSupport.maskType && this.data.td == 1) { // eslint-disable-line eqeqeq
|
||
masker.setAttribute('mask-type', 'luminance');
|
||
filId = createElementID();
|
||
fil = filtersFactory.createFilter(filId);
|
||
this.globalData.defs.appendChild(fil);
|
||
fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
|
||
gg = createNS('g');
|
||
gg.appendChild(this.layerElement);
|
||
layerElementParent = gg;
|
||
masker.appendChild(gg);
|
||
gg.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
|
||
}
|
||
} else if (this.data.td == 2) { // eslint-disable-line eqeqeq
|
||
var maskGroup = createNS('mask');
|
||
maskGroup.setAttribute('id', this.layerId);
|
||
maskGroup.setAttribute('mask-type', 'alpha');
|
||
var maskGrouper = createNS('g');
|
||
maskGroup.appendChild(maskGrouper);
|
||
filId = createElementID();
|
||
fil = filtersFactory.createFilter(filId);
|
||
/// /
|
||
|
||
// This solution doesn't work on Android when meta tag with viewport attribute is set
|
||
/* var feColorMatrix = createNS('feColorMatrix');
|
||
feColorMatrix.setAttribute('type', 'matrix');
|
||
feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
|
||
feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');
|
||
fil.appendChild(feColorMatrix); */
|
||
/// /
|
||
var feCTr = createNS('feComponentTransfer');
|
||
feCTr.setAttribute('in', 'SourceGraphic');
|
||
fil.appendChild(feCTr);
|
||
var feFunc = createNS('feFuncA');
|
||
feFunc.setAttribute('type', 'table');
|
||
feFunc.setAttribute('tableValues', '1.0 0.0');
|
||
feCTr.appendChild(feFunc);
|
||
/// /
|
||
this.globalData.defs.appendChild(fil);
|
||
var alphaRect = createNS('rect');
|
||
alphaRect.setAttribute('width', this.comp.data.w);
|
||
alphaRect.setAttribute('height', this.comp.data.h);
|
||
alphaRect.setAttribute('x', '0');
|
||
alphaRect.setAttribute('y', '0');
|
||
alphaRect.setAttribute('fill', '#ffffff');
|
||
alphaRect.setAttribute('opacity', '0');
|
||
maskGrouper.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
|
||
maskGrouper.appendChild(alphaRect);
|
||
maskGrouper.appendChild(this.layerElement);
|
||
layerElementParent = maskGrouper;
|
||
if (!featureSupport.maskType) {
|
||
maskGroup.setAttribute('mask-type', 'luminance');
|
||
fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
|
||
gg = createNS('g');
|
||
maskGrouper.appendChild(alphaRect);
|
||
gg.appendChild(this.layerElement);
|
||
layerElementParent = gg;
|
||
maskGrouper.appendChild(gg);
|
||
}
|
||
this.globalData.defs.appendChild(maskGroup);
|
||
}
|
||
} else if (this.data.tt) {
|
||
this.matteElement.appendChild(this.layerElement);
|
||
layerElementParent = this.matteElement;
|
||
this.baseElement = this.matteElement;
|
||
} else {
|
||
this.baseElement = this.layerElement;
|
||
}
|
||
if (this.data.ln) {
|
||
this.layerElement.setAttribute('id', this.data.ln);
|
||
}
|
||
if (this.data.cl) {
|
||
this.layerElement.setAttribute('class', this.data.cl);
|
||
}
|
||
// Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped
|
||
if (this.data.ty === 0 && !this.data.hd) {
|
||
var cp = createNS('clipPath');
|
||
var pt = createNS('path');
|
||
pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');
|
||
var clipId = createElementID();
|
||
cp.setAttribute('id', clipId);
|
||
cp.appendChild(pt);
|
||
this.globalData.defs.appendChild(cp);
|
||
|
||
if (this.checkMasks()) {
|
||
var cpGroup = createNS('g');
|
||
cpGroup.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');
|
||
cpGroup.appendChild(this.layerElement);
|
||
this.transformedElement = cpGroup;
|
||
if (layerElementParent) {
|
||
layerElementParent.appendChild(this.transformedElement);
|
||
} else {
|
||
this.baseElement = this.transformedElement;
|
||
}
|
||
} else {
|
||
this.layerElement.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');
|
||
}
|
||
}
|
||
if (this.data.bm !== 0) {
|
||
this.setBlendMode();
|
||
}
|
||
},
|
||
renderElement: function () {
|
||
if (this.finalTransform._matMdf) {
|
||
this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS());
|
||
}
|
||
if (this.finalTransform._opMdf) {
|
||
this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v);
|
||
}
|
||
},
|
||
destroyBaseElement: function () {
|
||
this.layerElement = null;
|
||
this.matteElement = null;
|
||
this.maskManager.destroy();
|
||
},
|
||
getBaseElement: function () {
|
||
if (this.data.hd) {
|
||
return null;
|
||
}
|
||
return this.baseElement;
|
||
},
|
||
createRenderableComponents: function () {
|
||
this.maskManager = new MaskElement(this.data, this, this.globalData);
|
||
this.renderableEffectsManager = new SVGEffects(this);
|
||
},
|
||
setMatte: function (id) {
|
||
if (!this.matteElement) {
|
||
return;
|
||
}
|
||
this.matteElement.setAttribute('mask', 'url(' + locationHref + '#' + id + ')');
|
||
},
|
||
};
|
||
|
||
/* global ProcessedElement */
|
||
|
||
function IShapeElement() {
|
||
}
|
||
|
||
IShapeElement.prototype = {
|
||
addShapeToModifiers: function (data) {
|
||
var i;
|
||
var len = this.shapeModifiers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.shapeModifiers[i].addShape(data);
|
||
}
|
||
},
|
||
isShapeInAnimatedModifiers: function (data) {
|
||
var i = 0;
|
||
var len = this.shapeModifiers.length;
|
||
while (i < len) {
|
||
if (this.shapeModifiers[i].isAnimatedWithShape(data)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
},
|
||
renderModifiers: function () {
|
||
if (!this.shapeModifiers.length) {
|
||
return;
|
||
}
|
||
var i;
|
||
var len = this.shapes.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.shapes[i].sh.reset();
|
||
}
|
||
|
||
len = this.shapeModifiers.length;
|
||
var shouldBreakProcess;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame);
|
||
// workaround to fix cases where a repeater resets the shape so the following processes get called twice
|
||
// TODO: find a better solution for this
|
||
if (shouldBreakProcess) {
|
||
break;
|
||
}
|
||
}
|
||
},
|
||
|
||
searchProcessedElement: function (elem) {
|
||
var elements = this.processedElements;
|
||
var i = 0;
|
||
var len = elements.length;
|
||
while (i < len) {
|
||
if (elements[i].elem === elem) {
|
||
return elements[i].pos;
|
||
}
|
||
i += 1;
|
||
}
|
||
return 0;
|
||
},
|
||
addProcessedElement: function (elem, pos) {
|
||
var elements = this.processedElements;
|
||
var i = elements.length;
|
||
while (i) {
|
||
i -= 1;
|
||
if (elements[i].elem === elem) {
|
||
elements[i].pos = pos;
|
||
return;
|
||
}
|
||
}
|
||
elements.push(new ProcessedElement(elem, pos));
|
||
},
|
||
prepareFrame: function (num) {
|
||
this.prepareRenderableFrame(num);
|
||
this.prepareProperties(num, this.isInRange);
|
||
},
|
||
};
|
||
|
||
/* global TextProperty, TextAnimatorProperty, buildShapeString, LetterProps */
|
||
|
||
function ITextElement() {
|
||
}
|
||
|
||
ITextElement.prototype.initElement = function (data, globalData, comp) {
|
||
this.lettersChangedFlag = true;
|
||
this.initFrame();
|
||
this.initBaseData(data, globalData, comp);
|
||
this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);
|
||
this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);
|
||
this.initTransform(data, globalData, comp);
|
||
this.initHierarchy();
|
||
this.initRenderable();
|
||
this.initRendererElement();
|
||
this.createContainerElements();
|
||
this.createRenderableComponents();
|
||
this.createContent();
|
||
this.hide();
|
||
this.textAnimator.searchProperties(this.dynamicProperties);
|
||
};
|
||
|
||
ITextElement.prototype.prepareFrame = function (num) {
|
||
this._mdf = false;
|
||
this.prepareRenderableFrame(num);
|
||
this.prepareProperties(num, this.isInRange);
|
||
if (this.textProperty._mdf || this.textProperty._isFirstFrame) {
|
||
this.buildNewText();
|
||
this.textProperty._isFirstFrame = false;
|
||
this.textProperty._mdf = false;
|
||
}
|
||
};
|
||
|
||
ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {
|
||
var j;
|
||
var jLen = shapes.length;
|
||
var pathNodes;
|
||
var shapeStr = '';
|
||
for (j = 0; j < jLen; j += 1) {
|
||
pathNodes = shapes[j].ks.k;
|
||
shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);
|
||
}
|
||
return shapeStr;
|
||
};
|
||
|
||
ITextElement.prototype.updateDocumentData = function (newData, index) {
|
||
this.textProperty.updateDocumentData(newData, index);
|
||
};
|
||
|
||
ITextElement.prototype.canResizeFont = function (_canResize) {
|
||
this.textProperty.canResizeFont(_canResize);
|
||
};
|
||
|
||
ITextElement.prototype.setMinimumFontSize = function (_fontSize) {
|
||
this.textProperty.setMinimumFontSize(_fontSize);
|
||
};
|
||
|
||
ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {
|
||
if (documentData.ps) {
|
||
matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);
|
||
}
|
||
matrixHelper.translate(0, -documentData.ls, 0);
|
||
switch (documentData.j) {
|
||
case 1:
|
||
matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0);
|
||
break;
|
||
case 2:
|
||
matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
matrixHelper.translate(xPos, yPos, 0);
|
||
};
|
||
|
||
ITextElement.prototype.buildColor = function (colorData) {
|
||
return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')';
|
||
};
|
||
|
||
ITextElement.prototype.emptyProp = new LetterProps();
|
||
|
||
ITextElement.prototype.destroy = function () {
|
||
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement */
|
||
|
||
function ICompElement() {}
|
||
|
||
extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);
|
||
|
||
ICompElement.prototype.initElement = function (data, globalData, comp) {
|
||
this.initFrame();
|
||
this.initBaseData(data, globalData, comp);
|
||
this.initTransform(data, globalData, comp);
|
||
this.initRenderable();
|
||
this.initHierarchy();
|
||
this.initRendererElement();
|
||
this.createContainerElements();
|
||
this.createRenderableComponents();
|
||
if (this.data.xt || !globalData.progressiveLoad) {
|
||
this.buildAllItems();
|
||
}
|
||
this.hide();
|
||
};
|
||
|
||
/* ICompElement.prototype.hide = function(){
|
||
if(!this.hidden){
|
||
this.hideElement();
|
||
var i,len = this.elements.length;
|
||
for( i = 0; i < len; i+=1 ){
|
||
if(this.elements[i]){
|
||
this.elements[i].hide();
|
||
}
|
||
}
|
||
}
|
||
}; */
|
||
|
||
ICompElement.prototype.prepareFrame = function (num) {
|
||
this._mdf = false;
|
||
this.prepareRenderableFrame(num);
|
||
this.prepareProperties(num, this.isInRange);
|
||
if (!this.isInRange && !this.data.xt) {
|
||
return;
|
||
}
|
||
|
||
if (!this.tm._placeholder) {
|
||
var timeRemapped = this.tm.v;
|
||
if (timeRemapped === this.data.op) {
|
||
timeRemapped = this.data.op - 1;
|
||
}
|
||
this.renderedFrame = timeRemapped;
|
||
} else {
|
||
this.renderedFrame = num / this.data.sr;
|
||
}
|
||
var i;
|
||
var len = this.elements.length;
|
||
if (!this.completeLayers) {
|
||
this.checkLayers(this.renderedFrame);
|
||
}
|
||
// This iteration needs to be backwards because of how expressions connect between each other
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (this.completeLayers || this.elements[i]) {
|
||
this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);
|
||
if (this.elements[i]._mdf) {
|
||
this._mdf = true;
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
ICompElement.prototype.renderInnerContent = function () {
|
||
var i;
|
||
var len = this.layers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.completeLayers || this.elements[i]) {
|
||
this.elements[i].renderFrame();
|
||
}
|
||
}
|
||
};
|
||
|
||
ICompElement.prototype.setElements = function (elems) {
|
||
this.elements = elems;
|
||
};
|
||
|
||
ICompElement.prototype.getElements = function () {
|
||
return this.elements;
|
||
};
|
||
|
||
ICompElement.prototype.destroyElements = function () {
|
||
var i;
|
||
var len = this.layers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.elements[i]) {
|
||
this.elements[i].destroy();
|
||
}
|
||
}
|
||
};
|
||
|
||
ICompElement.prototype.destroy = function () {
|
||
this.destroyElements();
|
||
this.destroyBaseElement();
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, createNS */
|
||
|
||
function IImageElement(data, globalData, comp) {
|
||
this.assetData = globalData.getAssetData(data.refId);
|
||
this.initElement(data, globalData, comp);
|
||
this.sourceRect = {
|
||
top: 0, left: 0, width: this.assetData.w, height: this.assetData.h,
|
||
};
|
||
}
|
||
|
||
extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement);
|
||
|
||
IImageElement.prototype.createContent = function () {
|
||
var assetPath = this.globalData.getAssetsPath(this.assetData);
|
||
|
||
this.innerElem = createNS('image');
|
||
this.innerElem.setAttribute('width', this.assetData.w + 'px');
|
||
this.innerElem.setAttribute('height', this.assetData.h + 'px');
|
||
this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);
|
||
this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);
|
||
|
||
this.layerElement.appendChild(this.innerElem);
|
||
};
|
||
|
||
IImageElement.prototype.sourceRectAtTime = function () {
|
||
return this.sourceRect;
|
||
};
|
||
|
||
/* global extendPrototype, IImageElement, createNS */
|
||
|
||
function ISolidElement(data, globalData, comp) {
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
extendPrototype([IImageElement], ISolidElement);
|
||
|
||
ISolidElement.prototype.createContent = function () {
|
||
var rect = createNS('rect');
|
||
/// /rect.style.width = this.data.sw;
|
||
/// /rect.style.height = this.data.sh;
|
||
/// /rect.style.fill = this.data.sc;
|
||
rect.setAttribute('width', this.data.sw);
|
||
rect.setAttribute('height', this.data.sh);
|
||
rect.setAttribute('fill', this.data.sc);
|
||
this.layerElement.appendChild(rect);
|
||
};
|
||
|
||
/* global PropertyFactory, extendPrototype, RenderableElement, BaseElement, FrameElement */
|
||
|
||
function AudioElement(data, globalData, comp) {
|
||
this.initFrame();
|
||
this.initRenderable();
|
||
this.assetData = globalData.getAssetData(data.refId);
|
||
this.initBaseData(data, globalData, comp);
|
||
this._isPlaying = false;
|
||
this._canPlay = false;
|
||
var assetPath = this.globalData.getAssetsPath(this.assetData);
|
||
this.audio = this.globalData.audioController.createAudio(assetPath);
|
||
this._currentTime = 0;
|
||
this.globalData.audioController.addAudio(this);
|
||
this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };
|
||
}
|
||
|
||
AudioElement.prototype.prepareFrame = function (num) {
|
||
this.prepareRenderableFrame(num, true);
|
||
this.prepareProperties(num, true);
|
||
if (!this.tm._placeholder) {
|
||
var timeRemapped = this.tm.v;
|
||
this._currentTime = timeRemapped;
|
||
} else {
|
||
this._currentTime = num / this.data.sr;
|
||
}
|
||
};
|
||
|
||
extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement);
|
||
|
||
AudioElement.prototype.renderFrame = function () {
|
||
if (this.isInRange && this._canPlay) {
|
||
if (!this._isPlaying) {
|
||
this.audio.play();
|
||
this.audio.seek(this._currentTime / this.globalData.frameRate);
|
||
this._isPlaying = true;
|
||
} else if (!this.audio.playing()
|
||
|| Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1
|
||
) {
|
||
this.audio.seek(this._currentTime / this.globalData.frameRate);
|
||
}
|
||
}
|
||
};
|
||
|
||
AudioElement.prototype.show = function () {
|
||
// this.audio.play()
|
||
};
|
||
|
||
AudioElement.prototype.hide = function () {
|
||
this.audio.pause();
|
||
this._isPlaying = false;
|
||
};
|
||
|
||
AudioElement.prototype.pause = function () {
|
||
this.audio.pause();
|
||
this._isPlaying = false;
|
||
this._canPlay = false;
|
||
};
|
||
|
||
AudioElement.prototype.resume = function () {
|
||
this._canPlay = true;
|
||
};
|
||
|
||
AudioElement.prototype.setRate = function (rateValue) {
|
||
this.audio.rate(rateValue);
|
||
};
|
||
|
||
AudioElement.prototype.volume = function (volumeValue) {
|
||
this.audio.volume(volumeValue);
|
||
};
|
||
|
||
AudioElement.prototype.getBaseElement = function () {
|
||
return null;
|
||
};
|
||
|
||
AudioElement.prototype.destroy = function () {
|
||
};
|
||
|
||
AudioElement.prototype.sourceRectAtTime = function () {
|
||
};
|
||
|
||
AudioElement.prototype.initExpressions = function () {
|
||
};
|
||
|
||
/* global extendPrototype, RenderableElement, BaseElement, FrameElement, FootageInterface */
|
||
|
||
function FootageElement(data, globalData, comp) {
|
||
this.initFrame();
|
||
this.initRenderable();
|
||
this.assetData = globalData.getAssetData(data.refId);
|
||
this.footageData = globalData.imageLoader.getAsset(this.assetData);
|
||
this.initBaseData(data, globalData, comp);
|
||
}
|
||
|
||
FootageElement.prototype.prepareFrame = function () {
|
||
};
|
||
|
||
extendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement);
|
||
|
||
FootageElement.prototype.getBaseElement = function () {
|
||
return null;
|
||
};
|
||
|
||
FootageElement.prototype.renderFrame = function () {
|
||
};
|
||
|
||
FootageElement.prototype.destroy = function () {
|
||
};
|
||
|
||
FootageElement.prototype.initExpressions = function () {
|
||
this.layerInterface = FootageInterface(this);
|
||
};
|
||
|
||
FootageElement.prototype.getFootageData = function () {
|
||
return this.footageData;
|
||
};
|
||
|
||
/* global createSizedArray, PropertyFactory, extendPrototype, SVGRenderer, ICompElement, SVGBaseElement */
|
||
|
||
function SVGCompElement(data, globalData, comp) {
|
||
this.layers = data.layers;
|
||
this.supports3d = true;
|
||
this.completeLayers = false;
|
||
this.pendingElements = [];
|
||
this.elements = this.layers ? createSizedArray(this.layers.length) : [];
|
||
// this.layerElement = createNS('g');
|
||
this.initElement(data, globalData, comp);
|
||
this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };
|
||
}
|
||
|
||
extendPrototype([SVGRenderer, ICompElement, SVGBaseElement], SVGCompElement);
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement,
|
||
RenderableDOMElement, ITextElement, createSizedArray, createNS */
|
||
|
||
function SVGTextLottieElement(data, globalData, comp) {
|
||
this.textSpans = [];
|
||
this.renderType = 'svg';
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
|
||
extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextLottieElement);
|
||
|
||
SVGTextLottieElement.prototype.createContent = function () {
|
||
if (this.data.singleShape && !this.globalData.fontManager.chars) {
|
||
this.textContainer = createNS('text');
|
||
}
|
||
};
|
||
|
||
SVGTextLottieElement.prototype.buildTextContents = function (textArray) {
|
||
var i = 0;
|
||
var len = textArray.length;
|
||
var textContents = [];
|
||
var currentTextContent = '';
|
||
while (i < len) {
|
||
if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {
|
||
textContents.push(currentTextContent);
|
||
currentTextContent = '';
|
||
} else {
|
||
currentTextContent += textArray[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
textContents.push(currentTextContent);
|
||
return textContents;
|
||
};
|
||
|
||
SVGTextLottieElement.prototype.buildNewText = function () {
|
||
var i;
|
||
var len;
|
||
|
||
var documentData = this.textProperty.currentData;
|
||
this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);
|
||
if (documentData.fc) {
|
||
this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));
|
||
} else {
|
||
this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');
|
||
}
|
||
if (documentData.sc) {
|
||
this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));
|
||
this.layerElement.setAttribute('stroke-width', documentData.sw);
|
||
}
|
||
this.layerElement.setAttribute('font-size', documentData.finalSize);
|
||
var fontData = this.globalData.fontManager.getFontByName(documentData.f);
|
||
if (fontData.fClass) {
|
||
this.layerElement.setAttribute('class', fontData.fClass);
|
||
} else {
|
||
this.layerElement.setAttribute('font-family', fontData.fFamily);
|
||
var fWeight = documentData.fWeight;
|
||
var fStyle = documentData.fStyle;
|
||
this.layerElement.setAttribute('font-style', fStyle);
|
||
this.layerElement.setAttribute('font-weight', fWeight);
|
||
}
|
||
this.layerElement.setAttribute('aria-label', documentData.t);
|
||
|
||
var letters = documentData.l || [];
|
||
var usesGlyphs = !!this.globalData.fontManager.chars;
|
||
len = letters.length;
|
||
|
||
var tSpan;
|
||
var matrixHelper = this.mHelper;
|
||
var shapes;
|
||
var shapeStr = '';
|
||
var singleShape = this.data.singleShape;
|
||
var xPos = 0;
|
||
var yPos = 0;
|
||
var firstLine = true;
|
||
var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;
|
||
if (singleShape && !usesGlyphs && !documentData.sz) {
|
||
var tElement = this.textContainer;
|
||
var justify = 'start';
|
||
switch (documentData.j) {
|
||
case 1:
|
||
justify = 'end';
|
||
break;
|
||
case 2:
|
||
justify = 'middle';
|
||
break;
|
||
default:
|
||
justify = 'start';
|
||
break;
|
||
}
|
||
tElement.setAttribute('text-anchor', justify);
|
||
tElement.setAttribute('letter-spacing', trackingOffset);
|
||
var textContent = this.buildTextContents(documentData.finalText);
|
||
len = textContent.length;
|
||
yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
tSpan = this.textSpans[i] || createNS('tspan');
|
||
tSpan.textContent = textContent[i];
|
||
tSpan.setAttribute('x', 0);
|
||
tSpan.setAttribute('y', yPos);
|
||
tSpan.style.display = 'inherit';
|
||
tElement.appendChild(tSpan);
|
||
this.textSpans[i] = tSpan;
|
||
yPos += documentData.finalLineHeight;
|
||
}
|
||
|
||
this.layerElement.appendChild(tElement);
|
||
} else {
|
||
var cachedSpansLength = this.textSpans.length;
|
||
var shapeData;
|
||
var charData;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (!usesGlyphs || !singleShape || i === 0) {
|
||
tSpan = cachedSpansLength > i ? this.textSpans[i] : createNS(usesGlyphs ? 'path' : 'text');
|
||
if (cachedSpansLength <= i) {
|
||
tSpan.setAttribute('stroke-linecap', 'butt');
|
||
tSpan.setAttribute('stroke-linejoin', 'round');
|
||
tSpan.setAttribute('stroke-miterlimit', '4');
|
||
this.textSpans[i] = tSpan;
|
||
this.layerElement.appendChild(tSpan);
|
||
}
|
||
tSpan.style.display = 'inherit';
|
||
}
|
||
|
||
matrixHelper.reset();
|
||
matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
|
||
if (singleShape) {
|
||
if (letters[i].n) {
|
||
xPos = -trackingOffset;
|
||
yPos += documentData.yOffset;
|
||
yPos += firstLine ? 1 : 0;
|
||
firstLine = false;
|
||
}
|
||
this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
|
||
xPos += letters[i].l || 0;
|
||
// xPos += letters[i].val === ' ' ? 0 : trackingOffset;
|
||
xPos += trackingOffset;
|
||
}
|
||
if (usesGlyphs) {
|
||
charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
|
||
shapeData = (charData && charData.data) || {};
|
||
shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
|
||
if (!singleShape) {
|
||
tSpan.setAttribute('d', this.createPathShape(matrixHelper, shapes));
|
||
} else {
|
||
shapeStr += this.createPathShape(matrixHelper, shapes);
|
||
}
|
||
} else {
|
||
if (singleShape) {
|
||
tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')');
|
||
}
|
||
tSpan.textContent = letters[i].val;
|
||
tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||
}
|
||
//
|
||
}
|
||
if (singleShape && tSpan) {
|
||
tSpan.setAttribute('d', shapeStr);
|
||
}
|
||
}
|
||
while (i < this.textSpans.length) {
|
||
this.textSpans[i].style.display = 'none';
|
||
i += 1;
|
||
}
|
||
|
||
this._sizeChanged = true;
|
||
};
|
||
|
||
SVGTextLottieElement.prototype.sourceRectAtTime = function () {
|
||
this.prepareFrame(this.comp.renderedFrame - this.data.st);
|
||
this.renderInnerContent();
|
||
if (this._sizeChanged) {
|
||
this._sizeChanged = false;
|
||
var textBox = this.layerElement.getBBox();
|
||
this.bbox = {
|
||
top: textBox.y,
|
||
left: textBox.x,
|
||
width: textBox.width,
|
||
height: textBox.height,
|
||
};
|
||
}
|
||
return this.bbox;
|
||
};
|
||
|
||
SVGTextLottieElement.prototype.renderInnerContent = function () {
|
||
if (!this.data.singleShape) {
|
||
this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
|
||
if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {
|
||
this._sizeChanged = true;
|
||
var i;
|
||
var len;
|
||
var renderedLetters = this.textAnimator.renderedLetters;
|
||
|
||
var letters = this.textProperty.currentData.l;
|
||
|
||
len = letters.length;
|
||
var renderedLetter;
|
||
var textSpan;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (!letters[i].n) {
|
||
renderedLetter = renderedLetters[i];
|
||
textSpan = this.textSpans[i];
|
||
if (renderedLetter._mdf.m) {
|
||
textSpan.setAttribute('transform', renderedLetter.m);
|
||
}
|
||
if (renderedLetter._mdf.o) {
|
||
textSpan.setAttribute('opacity', renderedLetter.o);
|
||
}
|
||
if (renderedLetter._mdf.sw) {
|
||
textSpan.setAttribute('stroke-width', renderedLetter.sw);
|
||
}
|
||
if (renderedLetter._mdf.sc) {
|
||
textSpan.setAttribute('stroke', renderedLetter.sc);
|
||
}
|
||
if (renderedLetter._mdf.fc) {
|
||
textSpan.setAttribute('fill', renderedLetter.fc);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement,
|
||
FrameElement, RenderableDOMElement, Matrix, SVGStyleData, SVGStrokeStyleData, SVGFillStyleData,
|
||
SVGGradientFillStyleData, SVGGradientStrokeStyleData, locationHref, getBlendMode, ShapeGroupData,
|
||
TransformPropertyFactory, SVGTransformData, ShapePropertyFactory, SVGShapeData, SVGElementsRenderer, ShapeModifiers,
|
||
lineCapEnum, lineJoinEnum */
|
||
|
||
function SVGShapeElement(data, globalData, comp) {
|
||
// List of drawable elements
|
||
this.shapes = [];
|
||
// Full shape data
|
||
this.shapesData = data.shapes;
|
||
// List of styles that will be applied to shapes
|
||
this.stylesList = [];
|
||
// List of modifiers that will be applied to shapes
|
||
this.shapeModifiers = [];
|
||
// List of items in shape tree
|
||
this.itemsData = [];
|
||
// List of items in previous shape tree
|
||
this.processedElements = [];
|
||
// List of animated components
|
||
this.animatedContents = [];
|
||
this.initElement(data, globalData, comp);
|
||
// Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
|
||
// List of elements that have been created
|
||
this.prevViewData = [];
|
||
// Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
|
||
}
|
||
|
||
extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement);
|
||
|
||
SVGShapeElement.prototype.initSecondaryElement = function () {
|
||
};
|
||
|
||
SVGShapeElement.prototype.identityMatrix = new Matrix();
|
||
|
||
SVGShapeElement.prototype.buildExpressionInterface = function () {};
|
||
|
||
SVGShapeElement.prototype.createContent = function () {
|
||
this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);
|
||
this.filterUniqueShapes();
|
||
};
|
||
|
||
/*
|
||
This method searches for multiple shapes that affect a single element and one of them is animated
|
||
*/
|
||
SVGShapeElement.prototype.filterUniqueShapes = function () {
|
||
var i;
|
||
var len = this.shapes.length;
|
||
var shape;
|
||
var j;
|
||
var jLen = this.stylesList.length;
|
||
var style;
|
||
var tempShapes = [];
|
||
var areAnimated = false;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
style = this.stylesList[j];
|
||
areAnimated = false;
|
||
tempShapes.length = 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
shape = this.shapes[i];
|
||
if (shape.styles.indexOf(style) !== -1) {
|
||
tempShapes.push(shape);
|
||
areAnimated = shape._isAnimated || areAnimated;
|
||
}
|
||
}
|
||
if (tempShapes.length > 1 && areAnimated) {
|
||
this.setShapesAsAnimated(tempShapes);
|
||
}
|
||
}
|
||
};
|
||
|
||
SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {
|
||
var i;
|
||
var len = shapes.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
shapes[i].setAsAnimated();
|
||
}
|
||
};
|
||
|
||
SVGShapeElement.prototype.createStyleElement = function (data, level) {
|
||
// TODO: prevent drawing of hidden styles
|
||
var elementData;
|
||
var styleOb = new SVGStyleData(data, level);
|
||
|
||
var pathElement = styleOb.pElem;
|
||
if (data.ty === 'st') {
|
||
elementData = new SVGStrokeStyleData(this, data, styleOb);
|
||
} else if (data.ty === 'fl') {
|
||
elementData = new SVGFillStyleData(this, data, styleOb);
|
||
} else if (data.ty === 'gf' || data.ty === 'gs') {
|
||
var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;
|
||
elementData = new GradientConstructor(this, data, styleOb);
|
||
this.globalData.defs.appendChild(elementData.gf);
|
||
if (elementData.maskId) {
|
||
this.globalData.defs.appendChild(elementData.ms);
|
||
this.globalData.defs.appendChild(elementData.of);
|
||
pathElement.setAttribute('mask', 'url(' + locationHref + '#' + elementData.maskId + ')');
|
||
}
|
||
}
|
||
|
||
if (data.ty === 'st' || data.ty === 'gs') {
|
||
pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);
|
||
pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);
|
||
pathElement.setAttribute('fill-opacity', '0');
|
||
if (data.lj === 1) {
|
||
pathElement.setAttribute('stroke-miterlimit', data.ml);
|
||
}
|
||
}
|
||
|
||
if (data.r === 2) {
|
||
pathElement.setAttribute('fill-rule', 'evenodd');
|
||
}
|
||
|
||
if (data.ln) {
|
||
pathElement.setAttribute('id', data.ln);
|
||
}
|
||
if (data.cl) {
|
||
pathElement.setAttribute('class', data.cl);
|
||
}
|
||
if (data.bm) {
|
||
pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);
|
||
}
|
||
this.stylesList.push(styleOb);
|
||
this.addToAnimatedContents(data, elementData);
|
||
return elementData;
|
||
};
|
||
|
||
SVGShapeElement.prototype.createGroupElement = function (data) {
|
||
var elementData = new ShapeGroupData();
|
||
if (data.ln) {
|
||
elementData.gr.setAttribute('id', data.ln);
|
||
}
|
||
if (data.cl) {
|
||
elementData.gr.setAttribute('class', data.cl);
|
||
}
|
||
if (data.bm) {
|
||
elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);
|
||
}
|
||
return elementData;
|
||
};
|
||
|
||
SVGShapeElement.prototype.createTransformElement = function (data, container) {
|
||
var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this);
|
||
var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);
|
||
this.addToAnimatedContents(data, elementData);
|
||
return elementData;
|
||
};
|
||
|
||
SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {
|
||
var ty = 4;
|
||
if (data.ty === 'rc') {
|
||
ty = 5;
|
||
} else if (data.ty === 'el') {
|
||
ty = 6;
|
||
} else if (data.ty === 'sr') {
|
||
ty = 7;
|
||
}
|
||
var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this);
|
||
var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);
|
||
this.shapes.push(elementData);
|
||
this.addShapeToModifiers(elementData);
|
||
this.addToAnimatedContents(data, elementData);
|
||
return elementData;
|
||
};
|
||
|
||
SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {
|
||
var i = 0;
|
||
var len = this.animatedContents.length;
|
||
while (i < len) {
|
||
if (this.animatedContents[i].element === element) {
|
||
return;
|
||
}
|
||
i += 1;
|
||
}
|
||
this.animatedContents.push({
|
||
fn: SVGElementsRenderer.createRenderFunction(data),
|
||
element: element,
|
||
data: data,
|
||
});
|
||
};
|
||
|
||
SVGShapeElement.prototype.setElementStyles = function (elementData) {
|
||
var arr = elementData.styles;
|
||
var j;
|
||
var jLen = this.stylesList.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
if (!this.stylesList[j].closed) {
|
||
arr.push(this.stylesList[j]);
|
||
}
|
||
}
|
||
};
|
||
|
||
SVGShapeElement.prototype.reloadShapes = function () {
|
||
this._isFirstFrame = true;
|
||
var i;
|
||
var len = this.itemsData.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.prevViewData[i] = this.itemsData[i];
|
||
}
|
||
this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);
|
||
this.filterUniqueShapes();
|
||
len = this.dynamicProperties.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.dynamicProperties[i].getValue();
|
||
}
|
||
this.renderModifiers();
|
||
};
|
||
|
||
SVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) {
|
||
var ownTransformers = [].concat(transformers);
|
||
var i;
|
||
var len = arr.length - 1;
|
||
var j;
|
||
var jLen;
|
||
var ownStyles = [];
|
||
var ownModifiers = [];
|
||
var currentTransform;
|
||
var modifier;
|
||
var processedPos;
|
||
for (i = len; i >= 0; i -= 1) {
|
||
processedPos = this.searchProcessedElement(arr[i]);
|
||
if (!processedPos) {
|
||
arr[i]._render = render;
|
||
} else {
|
||
itemsData[i] = prevViewData[processedPos - 1];
|
||
}
|
||
if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {
|
||
if (!processedPos) {
|
||
itemsData[i] = this.createStyleElement(arr[i], level);
|
||
} else {
|
||
itemsData[i].style.closed = false;
|
||
}
|
||
if (arr[i]._render) {
|
||
container.appendChild(itemsData[i].style.pElem);
|
||
}
|
||
ownStyles.push(itemsData[i].style);
|
||
} else if (arr[i].ty === 'gr') {
|
||
if (!processedPos) {
|
||
itemsData[i] = this.createGroupElement(arr[i]);
|
||
} else {
|
||
jLen = itemsData[i].it.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
itemsData[i].prevViewData[j] = itemsData[i].it[j];
|
||
}
|
||
}
|
||
this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render);
|
||
if (arr[i]._render) {
|
||
container.appendChild(itemsData[i].gr);
|
||
}
|
||
} else if (arr[i].ty === 'tr') {
|
||
if (!processedPos) {
|
||
itemsData[i] = this.createTransformElement(arr[i], container);
|
||
}
|
||
currentTransform = itemsData[i].transform;
|
||
ownTransformers.push(currentTransform);
|
||
} else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {
|
||
if (!processedPos) {
|
||
itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);
|
||
}
|
||
this.setElementStyles(itemsData[i]);
|
||
} else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb') {
|
||
if (!processedPos) {
|
||
modifier = ShapeModifiers.getModifier(arr[i].ty);
|
||
modifier.init(this, arr[i]);
|
||
itemsData[i] = modifier;
|
||
this.shapeModifiers.push(modifier);
|
||
} else {
|
||
modifier = itemsData[i];
|
||
modifier.closed = false;
|
||
}
|
||
ownModifiers.push(modifier);
|
||
} else if (arr[i].ty === 'rp') {
|
||
if (!processedPos) {
|
||
modifier = ShapeModifiers.getModifier(arr[i].ty);
|
||
itemsData[i] = modifier;
|
||
modifier.init(this, arr, i, itemsData);
|
||
this.shapeModifiers.push(modifier);
|
||
render = false;
|
||
} else {
|
||
modifier = itemsData[i];
|
||
modifier.closed = true;
|
||
}
|
||
ownModifiers.push(modifier);
|
||
}
|
||
this.addProcessedElement(arr[i], i + 1);
|
||
}
|
||
len = ownStyles.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
ownStyles[i].closed = true;
|
||
}
|
||
len = ownModifiers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
ownModifiers[i].closed = true;
|
||
}
|
||
};
|
||
|
||
SVGShapeElement.prototype.renderInnerContent = function () {
|
||
this.renderModifiers();
|
||
var i;
|
||
var len = this.stylesList.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.stylesList[i].reset();
|
||
}
|
||
this.renderShape();
|
||
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.stylesList[i]._mdf || this._isFirstFrame) {
|
||
if (this.stylesList[i].msElem) {
|
||
this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d);
|
||
// Adding M0 0 fixes same mask bug on all browsers
|
||
this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;
|
||
}
|
||
this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');
|
||
}
|
||
}
|
||
};
|
||
|
||
SVGShapeElement.prototype.renderShape = function () {
|
||
var i;
|
||
var len = this.animatedContents.length;
|
||
var animatedContent;
|
||
for (i = 0; i < len; i += 1) {
|
||
animatedContent = this.animatedContents[i];
|
||
if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {
|
||
animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);
|
||
}
|
||
}
|
||
};
|
||
|
||
SVGShapeElement.prototype.destroy = function () {
|
||
this.destroyBaseElement();
|
||
this.shapesData = null;
|
||
this.itemsData = null;
|
||
};
|
||
|
||
/* global createNS */
|
||
|
||
function SVGTintFilter(filter, filterManager) {
|
||
this.filterManager = filterManager;
|
||
var feColorMatrix = createNS('feColorMatrix');
|
||
feColorMatrix.setAttribute('type', 'matrix');
|
||
feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');
|
||
feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
|
||
feColorMatrix.setAttribute('result', 'f1');
|
||
filter.appendChild(feColorMatrix);
|
||
feColorMatrix = createNS('feColorMatrix');
|
||
feColorMatrix.setAttribute('type', 'matrix');
|
||
feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
|
||
feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
|
||
feColorMatrix.setAttribute('result', 'f2');
|
||
filter.appendChild(feColorMatrix);
|
||
this.matrixFilter = feColorMatrix;
|
||
if (filterManager.effectElements[2].p.v !== 100 || filterManager.effectElements[2].p.k) {
|
||
var feMerge = createNS('feMerge');
|
||
filter.appendChild(feMerge);
|
||
var feMergeNode;
|
||
feMergeNode = createNS('feMergeNode');
|
||
feMergeNode.setAttribute('in', 'SourceGraphic');
|
||
feMerge.appendChild(feMergeNode);
|
||
feMergeNode = createNS('feMergeNode');
|
||
feMergeNode.setAttribute('in', 'f2');
|
||
feMerge.appendChild(feMergeNode);
|
||
}
|
||
}
|
||
|
||
SVGTintFilter.prototype.renderFrame = function (forceRender) {
|
||
if (forceRender || this.filterManager._mdf) {
|
||
var colorBlack = this.filterManager.effectElements[0].p.v;
|
||
var colorWhite = this.filterManager.effectElements[1].p.v;
|
||
var opacity = this.filterManager.effectElements[2].p.v / 100;
|
||
this.matrixFilter.setAttribute('values', (colorWhite[0] - colorBlack[0]) + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 ' + opacity + ' 0');
|
||
}
|
||
};
|
||
|
||
/* global createNS */
|
||
|
||
function SVGFillFilter(filter, filterManager) {
|
||
this.filterManager = filterManager;
|
||
var feColorMatrix = createNS('feColorMatrix');
|
||
feColorMatrix.setAttribute('type', 'matrix');
|
||
feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
|
||
feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
|
||
filter.appendChild(feColorMatrix);
|
||
this.matrixFilter = feColorMatrix;
|
||
}
|
||
SVGFillFilter.prototype.renderFrame = function (forceRender) {
|
||
if (forceRender || this.filterManager._mdf) {
|
||
var color = this.filterManager.effectElements[2].p.v;
|
||
var opacity = this.filterManager.effectElements[6].p.v;
|
||
this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0');
|
||
}
|
||
};
|
||
|
||
/* global createNS */
|
||
|
||
function SVGGaussianBlurEffect(filter, filterManager) {
|
||
// Outset the filter region by 100% on all sides to accommodate blur expansion.
|
||
filter.setAttribute('x', '-100%');
|
||
filter.setAttribute('y', '-100%');
|
||
filter.setAttribute('width', '300%');
|
||
filter.setAttribute('height', '300%');
|
||
|
||
this.filterManager = filterManager;
|
||
var feGaussianBlur = createNS('feGaussianBlur');
|
||
filter.appendChild(feGaussianBlur);
|
||
this.feGaussianBlur = feGaussianBlur;
|
||
}
|
||
|
||
SVGGaussianBlurEffect.prototype.renderFrame = function (forceRender) {
|
||
if (forceRender || this.filterManager._mdf) {
|
||
// Empirical value, matching AE's blur appearance.
|
||
var kBlurrinessToSigma = 0.3;
|
||
var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma;
|
||
|
||
// Dimensions mapping:
|
||
//
|
||
// 1 -> horizontal & vertical
|
||
// 2 -> horizontal only
|
||
// 3 -> vertical only
|
||
//
|
||
var dimensions = this.filterManager.effectElements[1].p.v;
|
||
var sigmaX = (dimensions == 3) ? 0 : sigma; // eslint-disable-line eqeqeq
|
||
var sigmaY = (dimensions == 2) ? 0 : sigma; // eslint-disable-line eqeqeq
|
||
|
||
this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + ' ' + sigmaY);
|
||
|
||
// Repeat edges mapping:
|
||
//
|
||
// 0 -> off -> duplicate
|
||
// 1 -> on -> wrap
|
||
var edgeMode = (this.filterManager.effectElements[2].p.v == 1) ? 'wrap' : 'duplicate'; // eslint-disable-line eqeqeq
|
||
this.feGaussianBlur.setAttribute('edgeMode', edgeMode);
|
||
}
|
||
};
|
||
|
||
/* global createNS, createElementID, locationHref, bmFloor */
|
||
|
||
function SVGStrokeEffect(elem, filterManager) {
|
||
this.initialized = false;
|
||
this.filterManager = filterManager;
|
||
this.elem = elem;
|
||
this.paths = [];
|
||
}
|
||
|
||
SVGStrokeEffect.prototype.initialize = function () {
|
||
var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
|
||
var path;
|
||
var groupPath;
|
||
var i;
|
||
var len;
|
||
if (this.filterManager.effectElements[1].p.v === 1) {
|
||
len = this.elem.maskManager.masksProperties.length;
|
||
i = 0;
|
||
} else {
|
||
i = this.filterManager.effectElements[0].p.v - 1;
|
||
len = i + 1;
|
||
}
|
||
groupPath = createNS('g');
|
||
groupPath.setAttribute('fill', 'none');
|
||
groupPath.setAttribute('stroke-linecap', 'round');
|
||
groupPath.setAttribute('stroke-dashoffset', 1);
|
||
for (i; i < len; i += 1) {
|
||
path = createNS('path');
|
||
groupPath.appendChild(path);
|
||
this.paths.push({ p: path, m: i });
|
||
}
|
||
if (this.filterManager.effectElements[10].p.v === 3) {
|
||
var mask = createNS('mask');
|
||
var id = createElementID();
|
||
mask.setAttribute('id', id);
|
||
mask.setAttribute('mask-type', 'alpha');
|
||
mask.appendChild(groupPath);
|
||
this.elem.globalData.defs.appendChild(mask);
|
||
var g = createNS('g');
|
||
g.setAttribute('mask', 'url(' + locationHref + '#' + id + ')');
|
||
while (elemChildren[0]) {
|
||
g.appendChild(elemChildren[0]);
|
||
}
|
||
this.elem.layerElement.appendChild(g);
|
||
this.masker = mask;
|
||
groupPath.setAttribute('stroke', '#fff');
|
||
} else if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {
|
||
if (this.filterManager.effectElements[10].p.v === 2) {
|
||
elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
|
||
while (elemChildren.length) {
|
||
this.elem.layerElement.removeChild(elemChildren[0]);
|
||
}
|
||
}
|
||
this.elem.layerElement.appendChild(groupPath);
|
||
this.elem.layerElement.removeAttribute('mask');
|
||
groupPath.setAttribute('stroke', '#fff');
|
||
}
|
||
this.initialized = true;
|
||
this.pathMasker = groupPath;
|
||
};
|
||
|
||
SVGStrokeEffect.prototype.renderFrame = function (forceRender) {
|
||
if (!this.initialized) {
|
||
this.initialize();
|
||
}
|
||
var i;
|
||
var len = this.paths.length;
|
||
var mask;
|
||
var path;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.paths[i].m !== -1) {
|
||
mask = this.elem.maskManager.viewData[this.paths[i].m];
|
||
path = this.paths[i].p;
|
||
if (forceRender || this.filterManager._mdf || mask.prop._mdf) {
|
||
path.setAttribute('d', mask.lastPath);
|
||
}
|
||
if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) {
|
||
var dasharrayValue;
|
||
if (this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100) {
|
||
var s = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;
|
||
var e = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;
|
||
var l = path.getTotalLength();
|
||
dasharrayValue = '0 0 0 ' + l * s + ' ';
|
||
var lineLength = l * (e - s);
|
||
var segment = 1 + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;
|
||
var units = Math.floor(lineLength / segment);
|
||
var j;
|
||
for (j = 0; j < units; j += 1) {
|
||
dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01 + ' ';
|
||
}
|
||
dasharrayValue += '0 ' + l * 10 + ' 0 0';
|
||
} else {
|
||
dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;
|
||
}
|
||
path.setAttribute('stroke-dasharray', dasharrayValue);
|
||
}
|
||
}
|
||
}
|
||
if (forceRender || this.filterManager.effectElements[4].p._mdf) {
|
||
this.pathMasker.setAttribute('stroke-width', this.filterManager.effectElements[4].p.v * 2);
|
||
}
|
||
|
||
if (forceRender || this.filterManager.effectElements[6].p._mdf) {
|
||
this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v);
|
||
}
|
||
if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {
|
||
if (forceRender || this.filterManager.effectElements[3].p._mdf) {
|
||
var color = this.filterManager.effectElements[3].p.v;
|
||
this.pathMasker.setAttribute('stroke', 'rgb(' + bmFloor(color[0] * 255) + ',' + bmFloor(color[1] * 255) + ',' + bmFloor(color[2] * 255) + ')');
|
||
}
|
||
}
|
||
};
|
||
|
||
/* global createNS */
|
||
|
||
function SVGTritoneFilter(filter, filterManager) {
|
||
this.filterManager = filterManager;
|
||
var feColorMatrix = createNS('feColorMatrix');
|
||
feColorMatrix.setAttribute('type', 'matrix');
|
||
feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');
|
||
feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
|
||
feColorMatrix.setAttribute('result', 'f1');
|
||
filter.appendChild(feColorMatrix);
|
||
var feComponentTransfer = createNS('feComponentTransfer');
|
||
feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
|
||
filter.appendChild(feComponentTransfer);
|
||
this.matrixFilter = feComponentTransfer;
|
||
var feFuncR = createNS('feFuncR');
|
||
feFuncR.setAttribute('type', 'table');
|
||
feComponentTransfer.appendChild(feFuncR);
|
||
this.feFuncR = feFuncR;
|
||
var feFuncG = createNS('feFuncG');
|
||
feFuncG.setAttribute('type', 'table');
|
||
feComponentTransfer.appendChild(feFuncG);
|
||
this.feFuncG = feFuncG;
|
||
var feFuncB = createNS('feFuncB');
|
||
feFuncB.setAttribute('type', 'table');
|
||
feComponentTransfer.appendChild(feFuncB);
|
||
this.feFuncB = feFuncB;
|
||
}
|
||
|
||
SVGTritoneFilter.prototype.renderFrame = function (forceRender) {
|
||
if (forceRender || this.filterManager._mdf) {
|
||
var color1 = this.filterManager.effectElements[0].p.v;
|
||
var color2 = this.filterManager.effectElements[1].p.v;
|
||
var color3 = this.filterManager.effectElements[2].p.v;
|
||
var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];
|
||
var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];
|
||
var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];
|
||
this.feFuncR.setAttribute('tableValues', tableR);
|
||
this.feFuncG.setAttribute('tableValues', tableG);
|
||
this.feFuncB.setAttribute('tableValues', tableB);
|
||
// var opacity = this.filterManager.effectElements[2].p.v/100;
|
||
// this.matrixFilter.setAttribute('values',(colorWhite[0]- colorBlack[0])+' 0 0 0 '+ colorBlack[0] +' '+ (colorWhite[1]- colorBlack[1]) +' 0 0 0 '+ colorBlack[1] +' '+ (colorWhite[2]- colorBlack[2]) +' 0 0 0 '+ colorBlack[2] +' 0 0 0 ' + opacity + ' 0');
|
||
}
|
||
};
|
||
|
||
/* global createNS */
|
||
|
||
function SVGProLevelsFilter(filter, filterManager) {
|
||
this.filterManager = filterManager;
|
||
var effectElements = this.filterManager.effectElements;
|
||
var feComponentTransfer = createNS('feComponentTransfer');
|
||
|
||
if (effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1) {
|
||
this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);
|
||
}
|
||
if (effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1) {
|
||
this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);
|
||
}
|
||
if (effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1) {
|
||
this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);
|
||
}
|
||
if (effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1) {
|
||
this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);
|
||
}
|
||
|
||
if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) {
|
||
feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
|
||
filter.appendChild(feComponentTransfer);
|
||
feComponentTransfer = createNS('feComponentTransfer');
|
||
}
|
||
|
||
if (effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1) {
|
||
feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
|
||
filter.appendChild(feComponentTransfer);
|
||
this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);
|
||
this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);
|
||
this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);
|
||
}
|
||
}
|
||
|
||
SVGProLevelsFilter.prototype.createFeFunc = function (type, feComponentTransfer) {
|
||
var feFunc = createNS(type);
|
||
feFunc.setAttribute('type', 'table');
|
||
feComponentTransfer.appendChild(feFunc);
|
||
return feFunc;
|
||
};
|
||
|
||
SVGProLevelsFilter.prototype.getTableValue = function (inputBlack, inputWhite, gamma, outputBlack, outputWhite) {
|
||
var cnt = 0;
|
||
var segments = 256;
|
||
var perc;
|
||
var min = Math.min(inputBlack, inputWhite);
|
||
var max = Math.max(inputBlack, inputWhite);
|
||
var table = Array.call(null, { length: segments });
|
||
var colorValue;
|
||
var pos = 0;
|
||
var outputDelta = outputWhite - outputBlack;
|
||
var inputDelta = inputWhite - inputBlack;
|
||
while (cnt <= 256) {
|
||
perc = cnt / 256;
|
||
if (perc <= min) {
|
||
colorValue = inputDelta < 0 ? outputWhite : outputBlack;
|
||
} else if (perc >= max) {
|
||
colorValue = inputDelta < 0 ? outputBlack : outputWhite;
|
||
} else {
|
||
colorValue = (outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma));
|
||
}
|
||
table[pos] = colorValue;
|
||
pos += 1;
|
||
cnt += 256 / (segments - 1);
|
||
}
|
||
return table.join(' ');
|
||
};
|
||
|
||
SVGProLevelsFilter.prototype.renderFrame = function (forceRender) {
|
||
if (forceRender || this.filterManager._mdf) {
|
||
var val;
|
||
var effectElements = this.filterManager.effectElements;
|
||
if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) {
|
||
val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v);
|
||
this.feFuncRComposed.setAttribute('tableValues', val);
|
||
this.feFuncGComposed.setAttribute('tableValues', val);
|
||
this.feFuncBComposed.setAttribute('tableValues', val);
|
||
}
|
||
|
||
if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) {
|
||
val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v);
|
||
this.feFuncR.setAttribute('tableValues', val);
|
||
}
|
||
|
||
if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) {
|
||
val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v);
|
||
this.feFuncG.setAttribute('tableValues', val);
|
||
}
|
||
|
||
if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) {
|
||
val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v);
|
||
this.feFuncB.setAttribute('tableValues', val);
|
||
}
|
||
|
||
if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) {
|
||
val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v);
|
||
this.feFuncA.setAttribute('tableValues', val);
|
||
}
|
||
}
|
||
};
|
||
|
||
/* global createNS, rgbToHex, degToRads */
|
||
|
||
function SVGDropShadowEffect(filter, filterManager) {
|
||
var filterSize = filterManager.container.globalData.renderConfig.filterSize;
|
||
filter.setAttribute('x', filterSize.x);
|
||
filter.setAttribute('y', filterSize.y);
|
||
filter.setAttribute('width', filterSize.width);
|
||
filter.setAttribute('height', filterSize.height);
|
||
this.filterManager = filterManager;
|
||
|
||
var feGaussianBlur = createNS('feGaussianBlur');
|
||
feGaussianBlur.setAttribute('in', 'SourceAlpha');
|
||
feGaussianBlur.setAttribute('result', 'drop_shadow_1');
|
||
feGaussianBlur.setAttribute('stdDeviation', '0');
|
||
this.feGaussianBlur = feGaussianBlur;
|
||
filter.appendChild(feGaussianBlur);
|
||
|
||
var feOffset = createNS('feOffset');
|
||
feOffset.setAttribute('dx', '25');
|
||
feOffset.setAttribute('dy', '0');
|
||
feOffset.setAttribute('in', 'drop_shadow_1');
|
||
feOffset.setAttribute('result', 'drop_shadow_2');
|
||
this.feOffset = feOffset;
|
||
filter.appendChild(feOffset);
|
||
var feFlood = createNS('feFlood');
|
||
feFlood.setAttribute('flood-color', '#00ff00');
|
||
feFlood.setAttribute('flood-opacity', '1');
|
||
feFlood.setAttribute('result', 'drop_shadow_3');
|
||
this.feFlood = feFlood;
|
||
filter.appendChild(feFlood);
|
||
|
||
var feComposite = createNS('feComposite');
|
||
feComposite.setAttribute('in', 'drop_shadow_3');
|
||
feComposite.setAttribute('in2', 'drop_shadow_2');
|
||
feComposite.setAttribute('operator', 'in');
|
||
feComposite.setAttribute('result', 'drop_shadow_4');
|
||
filter.appendChild(feComposite);
|
||
|
||
var feMerge = createNS('feMerge');
|
||
filter.appendChild(feMerge);
|
||
var feMergeNode;
|
||
feMergeNode = createNS('feMergeNode');
|
||
feMerge.appendChild(feMergeNode);
|
||
feMergeNode = createNS('feMergeNode');
|
||
feMergeNode.setAttribute('in', 'SourceGraphic');
|
||
this.feMergeNode = feMergeNode;
|
||
this.feMerge = feMerge;
|
||
this.originalNodeAdded = false;
|
||
feMerge.appendChild(feMergeNode);
|
||
}
|
||
|
||
SVGDropShadowEffect.prototype.renderFrame = function (forceRender) {
|
||
if (forceRender || this.filterManager._mdf) {
|
||
if (forceRender || this.filterManager.effectElements[4].p._mdf) {
|
||
this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);
|
||
}
|
||
if (forceRender || this.filterManager.effectElements[0].p._mdf) {
|
||
var col = this.filterManager.effectElements[0].p.v;
|
||
this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(col[0] * 255), Math.round(col[1] * 255), Math.round(col[2] * 255)));
|
||
}
|
||
if (forceRender || this.filterManager.effectElements[1].p._mdf) {
|
||
this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255);
|
||
}
|
||
if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) {
|
||
var distance = this.filterManager.effectElements[3].p.v;
|
||
var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;
|
||
var x = distance * Math.cos(angle);
|
||
var y = distance * Math.sin(angle);
|
||
this.feOffset.setAttribute('dx', x);
|
||
this.feOffset.setAttribute('dy', y);
|
||
}
|
||
/* if(forceRender || this.filterManager.effectElements[5].p._mdf){
|
||
if(this.filterManager.effectElements[5].p.v === 1 && this.originalNodeAdded) {
|
||
this.feMerge.removeChild(this.feMergeNode);
|
||
this.originalNodeAdded = false;
|
||
} else if(this.filterManager.effectElements[5].p.v === 0 && !this.originalNodeAdded) {
|
||
this.feMerge.appendChild(this.feMergeNode);
|
||
this.originalNodeAdded = true;
|
||
}
|
||
} */
|
||
}
|
||
};
|
||
|
||
/* global createElementID, createNS */
|
||
|
||
var _svgMatteSymbols = [];
|
||
|
||
function SVGMatte3Effect(filterElem, filterManager, elem) {
|
||
this.initialized = false;
|
||
this.filterManager = filterManager;
|
||
this.filterElem = filterElem;
|
||
this.elem = elem;
|
||
elem.matteElement = createNS('g');
|
||
elem.matteElement.appendChild(elem.layerElement);
|
||
elem.matteElement.appendChild(elem.transformedElement);
|
||
elem.baseElement = elem.matteElement;
|
||
}
|
||
|
||
SVGMatte3Effect.prototype.findSymbol = function (mask) {
|
||
var i = 0;
|
||
var len = _svgMatteSymbols.length;
|
||
while (i < len) {
|
||
if (_svgMatteSymbols[i] === mask) {
|
||
return _svgMatteSymbols[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
};
|
||
|
||
SVGMatte3Effect.prototype.replaceInParent = function (mask, symbolId) {
|
||
var parentNode = mask.layerElement.parentNode;
|
||
if (!parentNode) {
|
||
return;
|
||
}
|
||
var children = parentNode.children;
|
||
var i = 0;
|
||
var len = children.length;
|
||
while (i < len) {
|
||
if (children[i] === mask.layerElement) {
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
var nextChild;
|
||
if (i <= len - 2) {
|
||
nextChild = children[i + 1];
|
||
}
|
||
var useElem = createNS('use');
|
||
useElem.setAttribute('href', '#' + symbolId);
|
||
if (nextChild) {
|
||
parentNode.insertBefore(useElem, nextChild);
|
||
} else {
|
||
parentNode.appendChild(useElem);
|
||
}
|
||
};
|
||
|
||
SVGMatte3Effect.prototype.setElementAsMask = function (elem, mask) {
|
||
if (!this.findSymbol(mask)) {
|
||
var symbolId = createElementID();
|
||
var masker = createNS('mask');
|
||
masker.setAttribute('id', mask.layerId);
|
||
masker.setAttribute('mask-type', 'alpha');
|
||
_svgMatteSymbols.push(mask);
|
||
var defs = elem.globalData.defs;
|
||
defs.appendChild(masker);
|
||
var symbol = createNS('symbol');
|
||
symbol.setAttribute('id', symbolId);
|
||
this.replaceInParent(mask, symbolId);
|
||
symbol.appendChild(mask.layerElement);
|
||
defs.appendChild(symbol);
|
||
var useElem = createNS('use');
|
||
useElem.setAttribute('href', '#' + symbolId);
|
||
masker.appendChild(useElem);
|
||
mask.data.hd = false;
|
||
mask.show();
|
||
}
|
||
elem.setMatte(mask.layerId);
|
||
};
|
||
|
||
SVGMatte3Effect.prototype.initialize = function () {
|
||
var ind = this.filterManager.effectElements[0].p.v;
|
||
var elements = this.elem.comp.elements;
|
||
var i = 0;
|
||
var len = elements.length;
|
||
while (i < len) {
|
||
if (elements[i] && elements[i].data.ind === ind) {
|
||
this.setElementAsMask(this.elem, elements[i]);
|
||
}
|
||
i += 1;
|
||
}
|
||
this.initialized = true;
|
||
};
|
||
|
||
SVGMatte3Effect.prototype.renderFrame = function () {
|
||
if (!this.initialized) {
|
||
this.initialize();
|
||
}
|
||
};
|
||
|
||
/* global createElementID, filtersFactory, SVGTintFilter, SVGFillFilter, SVGStrokeEffect, SVGTritoneFilter,
|
||
SVGProLevelsFilter, SVGDropShadowEffect, SVGMatte3Effect, SVGGaussianBlurEffect, locationHref */
|
||
|
||
function SVGEffects(elem) {
|
||
var i;
|
||
var len = elem.data.ef ? elem.data.ef.length : 0;
|
||
var filId = createElementID();
|
||
var fil = filtersFactory.createFilter(filId, true);
|
||
var count = 0;
|
||
this.filters = [];
|
||
var filterManager;
|
||
for (i = 0; i < len; i += 1) {
|
||
filterManager = null;
|
||
if (elem.data.ef[i].ty === 20) {
|
||
count += 1;
|
||
filterManager = new SVGTintFilter(fil, elem.effectsManager.effectElements[i]);
|
||
} else if (elem.data.ef[i].ty === 21) {
|
||
count += 1;
|
||
filterManager = new SVGFillFilter(fil, elem.effectsManager.effectElements[i]);
|
||
} else if (elem.data.ef[i].ty === 22) {
|
||
filterManager = new SVGStrokeEffect(elem, elem.effectsManager.effectElements[i]);
|
||
} else if (elem.data.ef[i].ty === 23) {
|
||
count += 1;
|
||
filterManager = new SVGTritoneFilter(fil, elem.effectsManager.effectElements[i]);
|
||
} else if (elem.data.ef[i].ty === 24) {
|
||
count += 1;
|
||
filterManager = new SVGProLevelsFilter(fil, elem.effectsManager.effectElements[i]);
|
||
} else if (elem.data.ef[i].ty === 25) {
|
||
count += 1;
|
||
filterManager = new SVGDropShadowEffect(fil, elem.effectsManager.effectElements[i]);
|
||
} else if (elem.data.ef[i].ty === 28) {
|
||
// count += 1;
|
||
filterManager = new SVGMatte3Effect(fil, elem.effectsManager.effectElements[i], elem);
|
||
} else if (elem.data.ef[i].ty === 29) {
|
||
count += 1;
|
||
filterManager = new SVGGaussianBlurEffect(fil, elem.effectsManager.effectElements[i]);
|
||
}
|
||
if (filterManager) {
|
||
this.filters.push(filterManager);
|
||
}
|
||
}
|
||
if (count) {
|
||
elem.globalData.defs.appendChild(fil);
|
||
elem.layerElement.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
|
||
}
|
||
if (this.filters.length) {
|
||
elem.addRenderableComponent(this);
|
||
}
|
||
}
|
||
|
||
SVGEffects.prototype.renderFrame = function (_isFirstFrame) {
|
||
var i;
|
||
var len = this.filters.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.filters[i].renderFrame(_isFirstFrame);
|
||
}
|
||
};
|
||
|
||
/* global Matrix, createTypedArray */
|
||
|
||
function CVContextData() {
|
||
this.saved = [];
|
||
this.cArrPos = 0;
|
||
this.cTr = new Matrix();
|
||
this.cO = 1;
|
||
var i;
|
||
var len = 15;
|
||
this.savedOp = createTypedArray('float32', len);
|
||
for (i = 0; i < len; i += 1) {
|
||
this.saved[i] = createTypedArray('float32', 16);
|
||
}
|
||
this._length = len;
|
||
}
|
||
|
||
CVContextData.prototype.duplicate = function () {
|
||
var newLength = this._length * 2;
|
||
var currentSavedOp = this.savedOp;
|
||
this.savedOp = createTypedArray('float32', newLength);
|
||
this.savedOp.set(currentSavedOp);
|
||
var i = 0;
|
||
for (i = this._length; i < newLength; i += 1) {
|
||
this.saved[i] = createTypedArray('float32', 16);
|
||
}
|
||
this._length = newLength;
|
||
};
|
||
|
||
CVContextData.prototype.reset = function () {
|
||
this.cArrPos = 0;
|
||
this.cTr.reset();
|
||
this.cO = 1;
|
||
};
|
||
|
||
/* global CVEffects, getBlendMode, CVMaskElement, Matrix */
|
||
|
||
function CVBaseElement() {
|
||
}
|
||
|
||
CVBaseElement.prototype = {
|
||
createElements: function () {},
|
||
initRendererElement: function () {},
|
||
createContainerElements: function () {
|
||
this.canvasContext = this.globalData.canvasContext;
|
||
this.renderableEffectsManager = new CVEffects(this);
|
||
},
|
||
createContent: function () {},
|
||
setBlendMode: function () {
|
||
var globalData = this.globalData;
|
||
if (globalData.blendMode !== this.data.bm) {
|
||
globalData.blendMode = this.data.bm;
|
||
var blendModeValue = getBlendMode(this.data.bm);
|
||
globalData.canvasContext.globalCompositeOperation = blendModeValue;
|
||
}
|
||
},
|
||
createRenderableComponents: function () {
|
||
this.maskManager = new CVMaskElement(this.data, this);
|
||
},
|
||
hideElement: function () {
|
||
if (!this.hidden && (!this.isInRange || this.isTransparent)) {
|
||
this.hidden = true;
|
||
}
|
||
},
|
||
showElement: function () {
|
||
if (this.isInRange && !this.isTransparent) {
|
||
this.hidden = false;
|
||
this._isFirstFrame = true;
|
||
this.maskManager._isFirstFrame = true;
|
||
}
|
||
},
|
||
renderFrame: function () {
|
||
if (this.hidden || this.data.hd) {
|
||
return;
|
||
}
|
||
this.renderTransform();
|
||
this.renderRenderable();
|
||
this.setBlendMode();
|
||
var forceRealStack = this.data.ty === 0;
|
||
this.globalData.renderer.save(forceRealStack);
|
||
this.globalData.renderer.ctxTransform(this.finalTransform.mat.props);
|
||
this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v);
|
||
this.renderInnerContent();
|
||
this.globalData.renderer.restore(forceRealStack);
|
||
if (this.maskManager.hasMasks) {
|
||
this.globalData.renderer.restore(true);
|
||
}
|
||
if (this._isFirstFrame) {
|
||
this._isFirstFrame = false;
|
||
}
|
||
},
|
||
destroy: function () {
|
||
this.canvasContext = null;
|
||
this.data = null;
|
||
this.globalData = null;
|
||
this.maskManager.destroy();
|
||
},
|
||
mHelper: new Matrix(),
|
||
};
|
||
CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;
|
||
CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, CVBaseElement,HierarchyElement, FrameElement,
|
||
RenderableElement, SVGShapeElement, IImageElement, createTag */
|
||
|
||
function CVImageElement(data, globalData, comp) {
|
||
this.assetData = globalData.getAssetData(data.refId);
|
||
this.img = globalData.imageLoader.getAsset(this.assetData);
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);
|
||
|
||
CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;
|
||
CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
|
||
|
||
CVImageElement.prototype.createContent = function () {
|
||
if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {
|
||
var canvas = createTag('canvas');
|
||
canvas.width = this.assetData.w;
|
||
canvas.height = this.assetData.h;
|
||
var ctx = canvas.getContext('2d');
|
||
|
||
var imgW = this.img.width;
|
||
var imgH = this.img.height;
|
||
var imgRel = imgW / imgH;
|
||
var canvasRel = this.assetData.w / this.assetData.h;
|
||
var widthCrop;
|
||
var heightCrop;
|
||
var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;
|
||
if ((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {
|
||
heightCrop = imgH;
|
||
widthCrop = heightCrop * canvasRel;
|
||
} else {
|
||
widthCrop = imgW;
|
||
heightCrop = widthCrop / canvasRel;
|
||
}
|
||
ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h);
|
||
this.img = canvas;
|
||
}
|
||
};
|
||
|
||
CVImageElement.prototype.renderInnerContent = function () {
|
||
this.canvasContext.drawImage(this.img, 0, 0);
|
||
};
|
||
|
||
CVImageElement.prototype.destroy = function () {
|
||
this.img = null;
|
||
};
|
||
|
||
/* global createSizedArray, PropertyFactory, extendPrototype, CanvasRenderer, ICompElement, CVBaseElement */
|
||
|
||
function CVCompElement(data, globalData, comp) {
|
||
this.completeLayers = false;
|
||
this.layers = data.layers;
|
||
this.pendingElements = [];
|
||
this.elements = createSizedArray(this.layers.length);
|
||
this.initElement(data, globalData, comp);
|
||
this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };
|
||
}
|
||
|
||
extendPrototype([CanvasRenderer, ICompElement, CVBaseElement], CVCompElement);
|
||
|
||
CVCompElement.prototype.renderInnerContent = function () {
|
||
var ctx = this.canvasContext;
|
||
ctx.beginPath();
|
||
ctx.moveTo(0, 0);
|
||
ctx.lineTo(this.data.w, 0);
|
||
ctx.lineTo(this.data.w, this.data.h);
|
||
ctx.lineTo(0, this.data.h);
|
||
ctx.lineTo(0, 0);
|
||
ctx.clip();
|
||
var i;
|
||
var len = this.layers.length;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (this.completeLayers || this.elements[i]) {
|
||
this.elements[i].renderFrame();
|
||
}
|
||
}
|
||
};
|
||
|
||
CVCompElement.prototype.destroy = function () {
|
||
var i;
|
||
var len = this.layers.length;
|
||
for (i = len - 1; i >= 0; i -= 1) {
|
||
if (this.elements[i]) {
|
||
this.elements[i].destroy();
|
||
}
|
||
}
|
||
this.layers = null;
|
||
this.elements = null;
|
||
};
|
||
|
||
/* global createSizedArray, ShapePropertyFactory, MaskElement */
|
||
|
||
function CVMaskElement(data, element) {
|
||
this.data = data;
|
||
this.element = element;
|
||
this.masksProperties = this.data.masksProperties || [];
|
||
this.viewData = createSizedArray(this.masksProperties.length);
|
||
var i;
|
||
var len = this.masksProperties.length;
|
||
var hasMasks = false;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.masksProperties[i].mode !== 'n') {
|
||
hasMasks = true;
|
||
}
|
||
this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3);
|
||
}
|
||
this.hasMasks = hasMasks;
|
||
if (hasMasks) {
|
||
this.element.addRenderableComponent(this);
|
||
}
|
||
}
|
||
|
||
CVMaskElement.prototype.renderFrame = function () {
|
||
if (!this.hasMasks) {
|
||
return;
|
||
}
|
||
var transform = this.element.finalTransform.mat;
|
||
var ctx = this.element.canvasContext;
|
||
var i;
|
||
var len = this.masksProperties.length;
|
||
var pt;
|
||
var pts;
|
||
var data;
|
||
ctx.beginPath();
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.masksProperties[i].mode !== 'n') {
|
||
if (this.masksProperties[i].inv) {
|
||
ctx.moveTo(0, 0);
|
||
ctx.lineTo(this.element.globalData.compSize.w, 0);
|
||
ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);
|
||
ctx.lineTo(0, this.element.globalData.compSize.h);
|
||
ctx.lineTo(0, 0);
|
||
}
|
||
data = this.viewData[i].v;
|
||
pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0);
|
||
ctx.moveTo(pt[0], pt[1]);
|
||
var j;
|
||
var jLen = data._length;
|
||
for (j = 1; j < jLen; j += 1) {
|
||
pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);
|
||
ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
|
||
}
|
||
pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);
|
||
ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
|
||
}
|
||
}
|
||
this.element.globalData.renderer.save(true);
|
||
ctx.clip();
|
||
};
|
||
|
||
CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;
|
||
|
||
CVMaskElement.prototype.destroy = function () {
|
||
this.element = null;
|
||
};
|
||
|
||
/* global ShapeTransformManager, extendPrototype, BaseElement, TransformElement, CVBaseElement, IShapeElement,
|
||
HierarchyElement, FrameElement, RenderableElement, RenderableDOMElement, PropertyFactory, degToRads, GradientProperty,
|
||
DashProperty, TransformPropertyFactory, CVShapeData, ShapeModifiers, bmFloor, lineCapEnum, lineJoinEnum */
|
||
|
||
function CVShapeElement(data, globalData, comp) {
|
||
this.shapes = [];
|
||
this.shapesData = data.shapes;
|
||
this.stylesList = [];
|
||
this.itemsData = [];
|
||
this.prevViewData = [];
|
||
this.shapeModifiers = [];
|
||
this.processedElements = [];
|
||
this.transformsManager = new ShapeTransformManager();
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
|
||
extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement);
|
||
|
||
CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;
|
||
|
||
CVShapeElement.prototype.transformHelper = { opacity: 1, _opMdf: false };
|
||
|
||
CVShapeElement.prototype.dashResetter = [];
|
||
|
||
CVShapeElement.prototype.createContent = function () {
|
||
this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);
|
||
};
|
||
|
||
CVShapeElement.prototype.createStyleElement = function (data, transforms) {
|
||
var styleElem = {
|
||
data: data,
|
||
type: data.ty,
|
||
preTransforms: this.transformsManager.addTransformSequence(transforms),
|
||
transforms: [],
|
||
elements: [],
|
||
closed: data.hd === true,
|
||
};
|
||
var elementData = {};
|
||
if (data.ty === 'fl' || data.ty === 'st') {
|
||
elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this);
|
||
if (!elementData.c.k) {
|
||
styleElem.co = 'rgb(' + bmFloor(elementData.c.v[0]) + ',' + bmFloor(elementData.c.v[1]) + ',' + bmFloor(elementData.c.v[2]) + ')';
|
||
}
|
||
} else if (data.ty === 'gf' || data.ty === 'gs') {
|
||
elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this);
|
||
elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this);
|
||
elementData.h = PropertyFactory.getProp(this, data.h || { k: 0 }, 0, 0.01, this);
|
||
elementData.a = PropertyFactory.getProp(this, data.a || { k: 0 }, 0, degToRads, this);
|
||
elementData.g = new GradientProperty(this, data.g, this);
|
||
}
|
||
elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this);
|
||
if (data.ty === 'st' || data.ty === 'gs') {
|
||
styleElem.lc = lineCapEnum[data.lc || 2];
|
||
styleElem.lj = lineJoinEnum[data.lj || 2];
|
||
if (data.lj == 1) { // eslint-disable-line eqeqeq
|
||
styleElem.ml = data.ml;
|
||
}
|
||
elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this);
|
||
if (!elementData.w.k) {
|
||
styleElem.wi = elementData.w.v;
|
||
}
|
||
if (data.d) {
|
||
var d = new DashProperty(this, data.d, 'canvas', this);
|
||
elementData.d = d;
|
||
if (!elementData.d.k) {
|
||
styleElem.da = elementData.d.dashArray;
|
||
styleElem.do = elementData.d.dashoffset[0];
|
||
}
|
||
}
|
||
} else {
|
||
styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';
|
||
}
|
||
this.stylesList.push(styleElem);
|
||
elementData.style = styleElem;
|
||
return elementData;
|
||
};
|
||
|
||
CVShapeElement.prototype.createGroupElement = function () {
|
||
var elementData = {
|
||
it: [],
|
||
prevViewData: [],
|
||
};
|
||
return elementData;
|
||
};
|
||
|
||
CVShapeElement.prototype.createTransformElement = function (data) {
|
||
var elementData = {
|
||
transform: {
|
||
opacity: 1,
|
||
_opMdf: false,
|
||
key: this.transformsManager.getNewKey(),
|
||
op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),
|
||
mProps: TransformPropertyFactory.getTransformProperty(this, data, this),
|
||
},
|
||
};
|
||
return elementData;
|
||
};
|
||
|
||
CVShapeElement.prototype.createShapeElement = function (data) {
|
||
var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);
|
||
|
||
this.shapes.push(elementData);
|
||
this.addShapeToModifiers(elementData);
|
||
return elementData;
|
||
};
|
||
|
||
CVShapeElement.prototype.reloadShapes = function () {
|
||
this._isFirstFrame = true;
|
||
var i;
|
||
var len = this.itemsData.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.prevViewData[i] = this.itemsData[i];
|
||
}
|
||
this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);
|
||
len = this.dynamicProperties.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.dynamicProperties[i].getValue();
|
||
}
|
||
this.renderModifiers();
|
||
this.transformsManager.processSequences(this._isFirstFrame);
|
||
};
|
||
|
||
CVShapeElement.prototype.addTransformToStyleList = function (transform) {
|
||
var i;
|
||
var len = this.stylesList.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (!this.stylesList[i].closed) {
|
||
this.stylesList[i].transforms.push(transform);
|
||
}
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.removeTransformFromStyleList = function () {
|
||
var i;
|
||
var len = this.stylesList.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (!this.stylesList[i].closed) {
|
||
this.stylesList[i].transforms.pop();
|
||
}
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.closeStyles = function (styles) {
|
||
var i;
|
||
var len = styles.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
styles[i].closed = true;
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {
|
||
var i;
|
||
var len = arr.length - 1;
|
||
var j;
|
||
var jLen;
|
||
var ownStyles = [];
|
||
var ownModifiers = [];
|
||
var processedPos;
|
||
var modifier;
|
||
var currentTransform;
|
||
var ownTransforms = [].concat(transforms);
|
||
for (i = len; i >= 0; i -= 1) {
|
||
processedPos = this.searchProcessedElement(arr[i]);
|
||
if (!processedPos) {
|
||
arr[i]._shouldRender = shouldRender;
|
||
} else {
|
||
itemsData[i] = prevViewData[processedPos - 1];
|
||
}
|
||
if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {
|
||
if (!processedPos) {
|
||
itemsData[i] = this.createStyleElement(arr[i], ownTransforms);
|
||
} else {
|
||
itemsData[i].style.closed = false;
|
||
}
|
||
|
||
ownStyles.push(itemsData[i].style);
|
||
} else if (arr[i].ty === 'gr') {
|
||
if (!processedPos) {
|
||
itemsData[i] = this.createGroupElement(arr[i]);
|
||
} else {
|
||
jLen = itemsData[i].it.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
itemsData[i].prevViewData[j] = itemsData[i].it[j];
|
||
}
|
||
}
|
||
this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms);
|
||
} else if (arr[i].ty === 'tr') {
|
||
if (!processedPos) {
|
||
currentTransform = this.createTransformElement(arr[i]);
|
||
itemsData[i] = currentTransform;
|
||
}
|
||
ownTransforms.push(itemsData[i]);
|
||
this.addTransformToStyleList(itemsData[i]);
|
||
} else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {
|
||
if (!processedPos) {
|
||
itemsData[i] = this.createShapeElement(arr[i]);
|
||
}
|
||
} else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb') {
|
||
if (!processedPos) {
|
||
modifier = ShapeModifiers.getModifier(arr[i].ty);
|
||
modifier.init(this, arr[i]);
|
||
itemsData[i] = modifier;
|
||
this.shapeModifiers.push(modifier);
|
||
} else {
|
||
modifier = itemsData[i];
|
||
modifier.closed = false;
|
||
}
|
||
ownModifiers.push(modifier);
|
||
} else if (arr[i].ty === 'rp') {
|
||
if (!processedPos) {
|
||
modifier = ShapeModifiers.getModifier(arr[i].ty);
|
||
itemsData[i] = modifier;
|
||
modifier.init(this, arr, i, itemsData);
|
||
this.shapeModifiers.push(modifier);
|
||
shouldRender = false;
|
||
} else {
|
||
modifier = itemsData[i];
|
||
modifier.closed = true;
|
||
}
|
||
ownModifiers.push(modifier);
|
||
}
|
||
this.addProcessedElement(arr[i], i + 1);
|
||
}
|
||
this.removeTransformFromStyleList();
|
||
this.closeStyles(ownStyles);
|
||
len = ownModifiers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
ownModifiers[i].closed = true;
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.renderInnerContent = function () {
|
||
this.transformHelper.opacity = 1;
|
||
this.transformHelper._opMdf = false;
|
||
this.renderModifiers();
|
||
this.transformsManager.processSequences(this._isFirstFrame);
|
||
this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true);
|
||
};
|
||
|
||
CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {
|
||
if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {
|
||
groupTransform.opacity = parentTransform.opacity;
|
||
groupTransform.opacity *= groupTransform.op.v;
|
||
groupTransform._opMdf = true;
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.drawLayer = function () {
|
||
var i;
|
||
var len = this.stylesList.length;
|
||
var j;
|
||
var jLen;
|
||
var k;
|
||
var kLen;
|
||
var elems;
|
||
var nodes;
|
||
var renderer = this.globalData.renderer;
|
||
var ctx = this.globalData.canvasContext;
|
||
var type;
|
||
var currentStyle;
|
||
for (i = 0; i < len; i += 1) {
|
||
currentStyle = this.stylesList[i];
|
||
type = currentStyle.type;
|
||
|
||
// Skipping style when
|
||
// Stroke width equals 0
|
||
// style should not be rendered (extra unused repeaters)
|
||
// current opacity equals 0
|
||
// global opacity equals 0
|
||
if (!(((type === 'st' || type === 'gs') && currentStyle.wi === 0) || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0)) {
|
||
renderer.save();
|
||
elems = currentStyle.elements;
|
||
if (type === 'st' || type === 'gs') {
|
||
ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;
|
||
ctx.lineWidth = currentStyle.wi;
|
||
ctx.lineCap = currentStyle.lc;
|
||
ctx.lineJoin = currentStyle.lj;
|
||
ctx.miterLimit = currentStyle.ml || 0;
|
||
} else {
|
||
ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;
|
||
}
|
||
renderer.ctxOpacity(currentStyle.coOp);
|
||
if (type !== 'st' && type !== 'gs') {
|
||
ctx.beginPath();
|
||
}
|
||
renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);
|
||
jLen = elems.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
if (type === 'st' || type === 'gs') {
|
||
ctx.beginPath();
|
||
if (currentStyle.da) {
|
||
ctx.setLineDash(currentStyle.da);
|
||
ctx.lineDashOffset = currentStyle.do;
|
||
}
|
||
}
|
||
nodes = elems[j].trNodes;
|
||
kLen = nodes.length;
|
||
|
||
for (k = 0; k < kLen; k += 1) {
|
||
if (nodes[k].t === 'm') {
|
||
ctx.moveTo(nodes[k].p[0], nodes[k].p[1]);
|
||
} else if (nodes[k].t === 'c') {
|
||
ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]);
|
||
} else {
|
||
ctx.closePath();
|
||
}
|
||
}
|
||
if (type === 'st' || type === 'gs') {
|
||
ctx.stroke();
|
||
if (currentStyle.da) {
|
||
ctx.setLineDash(this.dashResetter);
|
||
}
|
||
}
|
||
}
|
||
if (type !== 'st' && type !== 'gs') {
|
||
ctx.fill(currentStyle.r);
|
||
}
|
||
renderer.restore();
|
||
}
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {
|
||
var i;
|
||
var len = items.length - 1;
|
||
var groupTransform;
|
||
groupTransform = parentTransform;
|
||
for (i = len; i >= 0; i -= 1) {
|
||
if (items[i].ty === 'tr') {
|
||
groupTransform = data[i].transform;
|
||
this.renderShapeTransform(parentTransform, groupTransform);
|
||
} else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') {
|
||
this.renderPath(items[i], data[i]);
|
||
} else if (items[i].ty === 'fl') {
|
||
this.renderFill(items[i], data[i], groupTransform);
|
||
} else if (items[i].ty === 'st') {
|
||
this.renderStroke(items[i], data[i], groupTransform);
|
||
} else if (items[i].ty === 'gf' || items[i].ty === 'gs') {
|
||
this.renderGradientFill(items[i], data[i], groupTransform);
|
||
} else if (items[i].ty === 'gr') {
|
||
this.renderShape(groupTransform, items[i].it, data[i].it);
|
||
} else if (items[i].ty === 'tm') {
|
||
//
|
||
}
|
||
}
|
||
if (isMain) {
|
||
this.drawLayer();
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {
|
||
if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {
|
||
var shapeNodes = styledShape.trNodes;
|
||
var paths = shape.paths;
|
||
var i;
|
||
var len;
|
||
var j;
|
||
var jLen = paths._length;
|
||
shapeNodes.length = 0;
|
||
var groupTransformMat = styledShape.transforms.finalTransform;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
var pathNodes = paths.shapes[j];
|
||
if (pathNodes && pathNodes.v) {
|
||
len = pathNodes._length;
|
||
for (i = 1; i < len; i += 1) {
|
||
if (i === 1) {
|
||
shapeNodes.push({
|
||
t: 'm',
|
||
p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),
|
||
});
|
||
}
|
||
shapeNodes.push({
|
||
t: 'c',
|
||
pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i]),
|
||
});
|
||
}
|
||
if (len === 1) {
|
||
shapeNodes.push({
|
||
t: 'm',
|
||
p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),
|
||
});
|
||
}
|
||
if (pathNodes.c && len) {
|
||
shapeNodes.push({
|
||
t: 'c',
|
||
pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0]),
|
||
});
|
||
shapeNodes.push({
|
||
t: 'z',
|
||
});
|
||
}
|
||
}
|
||
}
|
||
styledShape.trNodes = shapeNodes;
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.renderPath = function (pathData, itemData) {
|
||
if (pathData.hd !== true && pathData._shouldRender) {
|
||
var i;
|
||
var len = itemData.styledShapes.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.renderStyledShape(itemData.styledShapes[i], itemData.sh);
|
||
}
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {
|
||
var styleElem = itemData.style;
|
||
|
||
if (itemData.c._mdf || this._isFirstFrame) {
|
||
styleElem.co = 'rgb('
|
||
+ bmFloor(itemData.c.v[0]) + ','
|
||
+ bmFloor(itemData.c.v[1]) + ','
|
||
+ bmFloor(itemData.c.v[2]) + ')';
|
||
}
|
||
if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
|
||
styleElem.coOp = itemData.o.v * groupTransform.opacity;
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {
|
||
var styleElem = itemData.style;
|
||
var grd;
|
||
if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))) {
|
||
var ctx = this.globalData.canvasContext;
|
||
var pt1 = itemData.s.v;
|
||
var pt2 = itemData.e.v;
|
||
if (styleData.t === 1) {
|
||
grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);
|
||
} else {
|
||
var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
|
||
var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
|
||
|
||
var percent = itemData.h.v;
|
||
if (percent >= 1) {
|
||
percent = 0.99;
|
||
} else if (percent <= -1) {
|
||
percent = -0.99;
|
||
}
|
||
var dist = rad * percent;
|
||
var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
|
||
var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
|
||
grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);
|
||
}
|
||
|
||
var i;
|
||
var len = styleData.g.p;
|
||
var cValues = itemData.g.c;
|
||
var opacity = 1;
|
||
|
||
for (i = 0; i < len; i += 1) {
|
||
if (itemData.g._hasOpacity && itemData.g._collapsable) {
|
||
opacity = itemData.g.o[i * 2 + 1];
|
||
}
|
||
grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')');
|
||
}
|
||
styleElem.grd = grd;
|
||
}
|
||
styleElem.coOp = itemData.o.v * groupTransform.opacity;
|
||
};
|
||
|
||
CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {
|
||
var styleElem = itemData.style;
|
||
var d = itemData.d;
|
||
if (d && (d._mdf || this._isFirstFrame)) {
|
||
styleElem.da = d.dashArray;
|
||
styleElem.do = d.dashoffset[0];
|
||
}
|
||
if (itemData.c._mdf || this._isFirstFrame) {
|
||
styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';
|
||
}
|
||
if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
|
||
styleElem.coOp = itemData.o.v * groupTransform.opacity;
|
||
}
|
||
if (itemData.w._mdf || this._isFirstFrame) {
|
||
styleElem.wi = itemData.w.v;
|
||
}
|
||
};
|
||
|
||
CVShapeElement.prototype.destroy = function () {
|
||
this.shapesData = null;
|
||
this.globalData = null;
|
||
this.canvasContext = null;
|
||
this.stylesList.length = 0;
|
||
this.itemsData.length = 0;
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement,
|
||
SVGShapeElement, IImageElement */
|
||
|
||
function CVSolidElement(data, globalData, comp) {
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);
|
||
|
||
CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;
|
||
CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
|
||
|
||
CVSolidElement.prototype.renderInnerContent = function () {
|
||
var ctx = this.canvasContext;
|
||
ctx.fillStyle = this.data.sc;
|
||
ctx.fillRect(0, 0, this.data.sw, this.data.sh);
|
||
//
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement,
|
||
RenderableElement, ITextElement, createTag, createSizedArray */
|
||
|
||
function CVTextElement(data, globalData, comp) {
|
||
this.textSpans = [];
|
||
this.yOffset = 0;
|
||
this.fillColorAnim = false;
|
||
this.strokeColorAnim = false;
|
||
this.strokeWidthAnim = false;
|
||
this.stroke = false;
|
||
this.fill = false;
|
||
this.justifyOffset = 0;
|
||
this.currentRender = null;
|
||
this.renderType = 'canvas';
|
||
this.values = {
|
||
fill: 'rgba(0,0,0,0)',
|
||
stroke: 'rgba(0,0,0,0)',
|
||
sWidth: 0,
|
||
fValue: '',
|
||
};
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement);
|
||
|
||
CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');
|
||
|
||
CVTextElement.prototype.buildNewText = function () {
|
||
var documentData = this.textProperty.currentData;
|
||
this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
|
||
|
||
var hasFill = false;
|
||
if (documentData.fc) {
|
||
hasFill = true;
|
||
this.values.fill = this.buildColor(documentData.fc);
|
||
} else {
|
||
this.values.fill = 'rgba(0,0,0,0)';
|
||
}
|
||
this.fill = hasFill;
|
||
var hasStroke = false;
|
||
if (documentData.sc) {
|
||
hasStroke = true;
|
||
this.values.stroke = this.buildColor(documentData.sc);
|
||
this.values.sWidth = documentData.sw;
|
||
}
|
||
var fontData = this.globalData.fontManager.getFontByName(documentData.f);
|
||
var i;
|
||
var len;
|
||
var letters = documentData.l;
|
||
var matrixHelper = this.mHelper;
|
||
this.stroke = hasStroke;
|
||
this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily;
|
||
len = documentData.finalText.length;
|
||
// this.tHelper.font = this.values.fValue;
|
||
var charData;
|
||
var shapeData;
|
||
var k;
|
||
var kLen;
|
||
var shapes;
|
||
var j;
|
||
var jLen;
|
||
var pathNodes;
|
||
var commands;
|
||
var pathArr;
|
||
var singleShape = this.data.singleShape;
|
||
var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;
|
||
var xPos = 0;
|
||
var yPos = 0;
|
||
var firstLine = true;
|
||
var cnt = 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
|
||
shapeData = (charData && charData.data) || {};
|
||
matrixHelper.reset();
|
||
if (singleShape && letters[i].n) {
|
||
xPos = -trackingOffset;
|
||
yPos += documentData.yOffset;
|
||
yPos += firstLine ? 1 : 0;
|
||
firstLine = false;
|
||
}
|
||
|
||
shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
|
||
jLen = shapes.length;
|
||
matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
|
||
if (singleShape) {
|
||
this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
|
||
}
|
||
commands = createSizedArray(jLen);
|
||
for (j = 0; j < jLen; j += 1) {
|
||
kLen = shapes[j].ks.k.i.length;
|
||
pathNodes = shapes[j].ks.k;
|
||
pathArr = [];
|
||
for (k = 1; k < kLen; k += 1) {
|
||
if (k === 1) {
|
||
pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));
|
||
}
|
||
pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0));
|
||
}
|
||
pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));
|
||
commands[j] = pathArr;
|
||
}
|
||
if (singleShape) {
|
||
xPos += letters[i].l;
|
||
xPos += trackingOffset;
|
||
}
|
||
if (this.textSpans[cnt]) {
|
||
this.textSpans[cnt].elem = commands;
|
||
} else {
|
||
this.textSpans[cnt] = { elem: commands };
|
||
}
|
||
cnt += 1;
|
||
}
|
||
};
|
||
|
||
CVTextElement.prototype.renderInnerContent = function () {
|
||
var ctx = this.canvasContext;
|
||
ctx.font = this.values.fValue;
|
||
ctx.lineCap = 'butt';
|
||
ctx.lineJoin = 'miter';
|
||
ctx.miterLimit = 4;
|
||
|
||
if (!this.data.singleShape) {
|
||
this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
|
||
}
|
||
|
||
var i;
|
||
var len;
|
||
var j;
|
||
var jLen;
|
||
var k;
|
||
var kLen;
|
||
var renderedLetters = this.textAnimator.renderedLetters;
|
||
|
||
var letters = this.textProperty.currentData.l;
|
||
|
||
len = letters.length;
|
||
var renderedLetter;
|
||
var lastFill = null;
|
||
var lastStroke = null;
|
||
var lastStrokeW = null;
|
||
var commands;
|
||
var pathArr;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (!letters[i].n) {
|
||
renderedLetter = renderedLetters[i];
|
||
if (renderedLetter) {
|
||
this.globalData.renderer.save();
|
||
this.globalData.renderer.ctxTransform(renderedLetter.p);
|
||
this.globalData.renderer.ctxOpacity(renderedLetter.o);
|
||
}
|
||
if (this.fill) {
|
||
if (renderedLetter && renderedLetter.fc) {
|
||
if (lastFill !== renderedLetter.fc) {
|
||
lastFill = renderedLetter.fc;
|
||
ctx.fillStyle = renderedLetter.fc;
|
||
}
|
||
} else if (lastFill !== this.values.fill) {
|
||
lastFill = this.values.fill;
|
||
ctx.fillStyle = this.values.fill;
|
||
}
|
||
commands = this.textSpans[i].elem;
|
||
jLen = commands.length;
|
||
this.globalData.canvasContext.beginPath();
|
||
for (j = 0; j < jLen; j += 1) {
|
||
pathArr = commands[j];
|
||
kLen = pathArr.length;
|
||
this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
|
||
for (k = 2; k < kLen; k += 6) {
|
||
this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
|
||
}
|
||
}
|
||
this.globalData.canvasContext.closePath();
|
||
this.globalData.canvasContext.fill();
|
||
/// ctx.fillText(this.textSpans[i].val,0,0);
|
||
}
|
||
if (this.stroke) {
|
||
if (renderedLetter && renderedLetter.sw) {
|
||
if (lastStrokeW !== renderedLetter.sw) {
|
||
lastStrokeW = renderedLetter.sw;
|
||
ctx.lineWidth = renderedLetter.sw;
|
||
}
|
||
} else if (lastStrokeW !== this.values.sWidth) {
|
||
lastStrokeW = this.values.sWidth;
|
||
ctx.lineWidth = this.values.sWidth;
|
||
}
|
||
if (renderedLetter && renderedLetter.sc) {
|
||
if (lastStroke !== renderedLetter.sc) {
|
||
lastStroke = renderedLetter.sc;
|
||
ctx.strokeStyle = renderedLetter.sc;
|
||
}
|
||
} else if (lastStroke !== this.values.stroke) {
|
||
lastStroke = this.values.stroke;
|
||
ctx.strokeStyle = this.values.stroke;
|
||
}
|
||
commands = this.textSpans[i].elem;
|
||
jLen = commands.length;
|
||
this.globalData.canvasContext.beginPath();
|
||
for (j = 0; j < jLen; j += 1) {
|
||
pathArr = commands[j];
|
||
kLen = pathArr.length;
|
||
this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
|
||
for (k = 2; k < kLen; k += 6) {
|
||
this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
|
||
}
|
||
}
|
||
this.globalData.canvasContext.closePath();
|
||
this.globalData.canvasContext.stroke();
|
||
/// ctx.strokeText(letters[i].val,0,0);
|
||
}
|
||
if (renderedLetter) {
|
||
this.globalData.renderer.restore();
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
function CVEffects() {
|
||
|
||
}
|
||
CVEffects.prototype.renderFrame = function () {};
|
||
|
||
/* global createTag, createNS, styleDiv, CVEffects, MaskElement, SVGBaseElement, HybridRenderer */
|
||
|
||
function HBaseElement() {}
|
||
HBaseElement.prototype = {
|
||
checkBlendMode: function () {},
|
||
initRendererElement: function () {
|
||
this.baseElement = createTag(this.data.tg || 'div');
|
||
if (this.data.hasMask) {
|
||
this.svgElement = createNS('svg');
|
||
this.layerElement = createNS('g');
|
||
this.maskedElement = this.layerElement;
|
||
this.svgElement.appendChild(this.layerElement);
|
||
this.baseElement.appendChild(this.svgElement);
|
||
} else {
|
||
this.layerElement = this.baseElement;
|
||
}
|
||
styleDiv(this.baseElement);
|
||
},
|
||
createContainerElements: function () {
|
||
this.renderableEffectsManager = new CVEffects(this);
|
||
this.transformedElement = this.baseElement;
|
||
this.maskedElement = this.layerElement;
|
||
if (this.data.ln) {
|
||
this.layerElement.setAttribute('id', this.data.ln);
|
||
}
|
||
if (this.data.cl) {
|
||
this.layerElement.setAttribute('class', this.data.cl);
|
||
}
|
||
if (this.data.bm !== 0) {
|
||
this.setBlendMode();
|
||
}
|
||
},
|
||
renderElement: function () {
|
||
var transformedElementStyle = this.transformedElement ? this.transformedElement.style : {};
|
||
if (this.finalTransform._matMdf) {
|
||
var matrixValue = this.finalTransform.mat.toCSS();
|
||
transformedElementStyle.transform = matrixValue;
|
||
transformedElementStyle.webkitTransform = matrixValue;
|
||
}
|
||
if (this.finalTransform._opMdf) {
|
||
transformedElementStyle.opacity = this.finalTransform.mProp.o.v;
|
||
}
|
||
},
|
||
renderFrame: function () {
|
||
// If it is exported as hidden (data.hd === true) no need to render
|
||
// If it is not visible no need to render
|
||
if (this.data.hd || this.hidden) {
|
||
return;
|
||
}
|
||
this.renderTransform();
|
||
this.renderRenderable();
|
||
this.renderElement();
|
||
this.renderInnerContent();
|
||
if (this._isFirstFrame) {
|
||
this._isFirstFrame = false;
|
||
}
|
||
},
|
||
destroy: function () {
|
||
this.layerElement = null;
|
||
this.transformedElement = null;
|
||
if (this.matteElement) {
|
||
this.matteElement = null;
|
||
}
|
||
if (this.maskManager) {
|
||
this.maskManager.destroy();
|
||
this.maskManager = null;
|
||
}
|
||
},
|
||
createRenderableComponents: function () {
|
||
this.maskManager = new MaskElement(this.data, this, this.globalData);
|
||
},
|
||
addEffects: function () {
|
||
},
|
||
setMatte: function () {},
|
||
};
|
||
HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;
|
||
HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;
|
||
HBaseElement.prototype.buildElementParenting = HybridRenderer.prototype.buildElementParenting;
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement,
|
||
RenderableDOMElement, createNS, createTag */
|
||
|
||
function HSolidElement(data, globalData, comp) {
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement);
|
||
|
||
HSolidElement.prototype.createContent = function () {
|
||
var rect;
|
||
if (this.data.hasMask) {
|
||
rect = createNS('rect');
|
||
rect.setAttribute('width', this.data.sw);
|
||
rect.setAttribute('height', this.data.sh);
|
||
rect.setAttribute('fill', this.data.sc);
|
||
this.svgElement.setAttribute('width', this.data.sw);
|
||
this.svgElement.setAttribute('height', this.data.sh);
|
||
} else {
|
||
rect = createTag('div');
|
||
rect.style.width = this.data.sw + 'px';
|
||
rect.style.height = this.data.sh + 'px';
|
||
rect.style.backgroundColor = this.data.sc;
|
||
}
|
||
this.layerElement.appendChild(rect);
|
||
};
|
||
|
||
/* global createSizedArray, PropertyFactory, extendPrototype, HybridRenderer, ICompElement, HBaseElement */
|
||
|
||
function HCompElement(data, globalData, comp) {
|
||
this.layers = data.layers;
|
||
this.supports3d = !data.hasMask;
|
||
this.completeLayers = false;
|
||
this.pendingElements = [];
|
||
this.elements = this.layers ? createSizedArray(this.layers.length) : [];
|
||
this.initElement(data, globalData, comp);
|
||
this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };
|
||
}
|
||
|
||
extendPrototype([HybridRenderer, ICompElement, HBaseElement], HCompElement);
|
||
HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;
|
||
|
||
HCompElement.prototype.createContainerElements = function () {
|
||
this._createBaseContainerElements();
|
||
// divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';
|
||
if (this.data.hasMask) {
|
||
this.svgElement.setAttribute('width', this.data.w);
|
||
this.svgElement.setAttribute('height', this.data.h);
|
||
this.transformedElement = this.baseElement;
|
||
} else {
|
||
this.transformedElement = this.layerElement;
|
||
}
|
||
};
|
||
|
||
HCompElement.prototype.addTo3dContainer = function (elem, pos) {
|
||
var j = 0;
|
||
var nextElement;
|
||
while (j < pos) {
|
||
if (this.elements[j] && this.elements[j].getBaseElement) {
|
||
nextElement = this.elements[j].getBaseElement();
|
||
}
|
||
j += 1;
|
||
}
|
||
if (nextElement) {
|
||
this.layerElement.insertBefore(elem, nextElement);
|
||
} else {
|
||
this.layerElement.appendChild(elem);
|
||
}
|
||
};
|
||
|
||
/* global createNS, extendPrototype, BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement,
|
||
HierarchyElement, FrameElement, RenderableElement, createNS, bmMin, bmSqrt, bmMin, bmMax, bmPow */
|
||
|
||
function HShapeElement(data, globalData, comp) {
|
||
// List of drawable elements
|
||
this.shapes = [];
|
||
// Full shape data
|
||
this.shapesData = data.shapes;
|
||
// List of styles that will be applied to shapes
|
||
this.stylesList = [];
|
||
// List of modifiers that will be applied to shapes
|
||
this.shapeModifiers = [];
|
||
// List of items in shape tree
|
||
this.itemsData = [];
|
||
// List of items in previous shape tree
|
||
this.processedElements = [];
|
||
// List of animated components
|
||
this.animatedContents = [];
|
||
this.shapesContainer = createNS('g');
|
||
this.initElement(data, globalData, comp);
|
||
// Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
|
||
// List of elements that have been created
|
||
this.prevViewData = [];
|
||
this.currentBBox = {
|
||
x: 999999,
|
||
y: -999999,
|
||
h: 0,
|
||
w: 0,
|
||
};
|
||
}
|
||
extendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement);
|
||
HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;
|
||
|
||
HShapeElement.prototype.createContent = function () {
|
||
var cont;
|
||
this.baseElement.style.fontSize = 0;
|
||
if (this.data.hasMask) {
|
||
this.layerElement.appendChild(this.shapesContainer);
|
||
cont = this.svgElement;
|
||
} else {
|
||
cont = createNS('svg');
|
||
var size = this.comp.data ? this.comp.data : this.globalData.compSize;
|
||
cont.setAttribute('width', size.w);
|
||
cont.setAttribute('height', size.h);
|
||
cont.appendChild(this.shapesContainer);
|
||
this.layerElement.appendChild(cont);
|
||
}
|
||
|
||
this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true);
|
||
this.filterUniqueShapes();
|
||
this.shapeCont = cont;
|
||
};
|
||
|
||
HShapeElement.prototype.getTransformedPoint = function (transformers, point) {
|
||
var i;
|
||
var len = transformers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);
|
||
}
|
||
return point;
|
||
};
|
||
|
||
HShapeElement.prototype.calculateShapeBoundingBox = function (item, boundingBox) {
|
||
var shape = item.sh.v;
|
||
var transformers = item.transformers;
|
||
var i;
|
||
var len = shape._length;
|
||
var vPoint;
|
||
var oPoint;
|
||
var nextIPoint;
|
||
var nextVPoint;
|
||
if (len <= 1) {
|
||
return;
|
||
}
|
||
for (i = 0; i < len - 1; i += 1) {
|
||
vPoint = this.getTransformedPoint(transformers, shape.v[i]);
|
||
oPoint = this.getTransformedPoint(transformers, shape.o[i]);
|
||
nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);
|
||
nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);
|
||
this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
|
||
}
|
||
if (shape.c) {
|
||
vPoint = this.getTransformedPoint(transformers, shape.v[i]);
|
||
oPoint = this.getTransformedPoint(transformers, shape.o[i]);
|
||
nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);
|
||
nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);
|
||
this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
|
||
}
|
||
};
|
||
|
||
HShapeElement.prototype.checkBounds = function (vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {
|
||
this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);
|
||
var bounds = this.shapeBoundingBox;
|
||
boundingBox.x = bmMin(bounds.left, boundingBox.x);
|
||
boundingBox.xMax = bmMax(bounds.right, boundingBox.xMax);
|
||
boundingBox.y = bmMin(bounds.top, boundingBox.y);
|
||
boundingBox.yMax = bmMax(bounds.bottom, boundingBox.yMax);
|
||
};
|
||
|
||
HShapeElement.prototype.shapeBoundingBox = {
|
||
left: 0,
|
||
right: 0,
|
||
top: 0,
|
||
bottom: 0,
|
||
};
|
||
|
||
HShapeElement.prototype.tempBoundingBox = {
|
||
x: 0,
|
||
xMax: 0,
|
||
y: 0,
|
||
yMax: 0,
|
||
width: 0,
|
||
height: 0,
|
||
};
|
||
|
||
HShapeElement.prototype.getBoundsOfCurve = function (p0, p1, p2, p3) {
|
||
var bounds = [[p0[0], p3[0]], [p0[1], p3[1]]];
|
||
|
||
for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) { // eslint-disable-line no-plusplus
|
||
b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
|
||
a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
|
||
c = 3 * p1[i] - 3 * p0[i];
|
||
|
||
b |= 0; // eslint-disable-line no-bitwise
|
||
a |= 0; // eslint-disable-line no-bitwise
|
||
c |= 0; // eslint-disable-line no-bitwise
|
||
|
||
if (a === 0 && b === 0) {
|
||
//
|
||
} else if (a === 0) {
|
||
t = -c / b;
|
||
|
||
if (t > 0 && t < 1) {
|
||
bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i));
|
||
}
|
||
} else {
|
||
b2ac = b * b - 4 * c * a;
|
||
|
||
if (b2ac >= 0) {
|
||
t1 = (-b + bmSqrt(b2ac)) / (2 * a);
|
||
if (t1 > 0 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i));
|
||
t2 = (-b - bmSqrt(b2ac)) / (2 * a);
|
||
if (t2 > 0 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i));
|
||
}
|
||
}
|
||
}
|
||
|
||
this.shapeBoundingBox.left = bmMin.apply(null, bounds[0]);
|
||
this.shapeBoundingBox.top = bmMin.apply(null, bounds[1]);
|
||
this.shapeBoundingBox.right = bmMax.apply(null, bounds[0]);
|
||
this.shapeBoundingBox.bottom = bmMax.apply(null, bounds[1]);
|
||
};
|
||
|
||
HShapeElement.prototype.calculateF = function (t, p0, p1, p2, p3, i) {
|
||
return bmPow(1 - t, 3) * p0[i]
|
||
+ 3 * bmPow(1 - t, 2) * t * p1[i]
|
||
+ 3 * (1 - t) * bmPow(t, 2) * p2[i]
|
||
+ bmPow(t, 3) * p3[i];
|
||
};
|
||
|
||
HShapeElement.prototype.calculateBoundingBox = function (itemsData, boundingBox) {
|
||
var i;
|
||
var len = itemsData.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (itemsData[i] && itemsData[i].sh) {
|
||
this.calculateShapeBoundingBox(itemsData[i], boundingBox);
|
||
} else if (itemsData[i] && itemsData[i].it) {
|
||
this.calculateBoundingBox(itemsData[i].it, boundingBox);
|
||
}
|
||
}
|
||
};
|
||
|
||
HShapeElement.prototype.currentBoxContains = function (box) {
|
||
return this.currentBBox.x <= box.x
|
||
&& this.currentBBox.y <= box.y
|
||
&& this.currentBBox.width + this.currentBBox.x >= box.x + box.width
|
||
&& this.currentBBox.height + this.currentBBox.y >= box.y + box.height;
|
||
};
|
||
|
||
HShapeElement.prototype.renderInnerContent = function () {
|
||
this._renderShapeFrame();
|
||
|
||
if (!this.hidden && (this._isFirstFrame || this._mdf)) {
|
||
var tempBoundingBox = this.tempBoundingBox;
|
||
var max = 999999;
|
||
tempBoundingBox.x = max;
|
||
tempBoundingBox.xMax = -max;
|
||
tempBoundingBox.y = max;
|
||
tempBoundingBox.yMax = -max;
|
||
this.calculateBoundingBox(this.itemsData, tempBoundingBox);
|
||
tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;
|
||
tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y;
|
||
// var tempBoundingBox = this.shapeCont.getBBox();
|
||
if (this.currentBoxContains(tempBoundingBox)) {
|
||
return;
|
||
}
|
||
var changed = false;
|
||
if (this.currentBBox.w !== tempBoundingBox.width) {
|
||
this.currentBBox.w = tempBoundingBox.width;
|
||
this.shapeCont.setAttribute('width', tempBoundingBox.width);
|
||
changed = true;
|
||
}
|
||
if (this.currentBBox.h !== tempBoundingBox.height) {
|
||
this.currentBBox.h = tempBoundingBox.height;
|
||
this.shapeCont.setAttribute('height', tempBoundingBox.height);
|
||
changed = true;
|
||
}
|
||
if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) {
|
||
this.currentBBox.w = tempBoundingBox.width;
|
||
this.currentBBox.h = tempBoundingBox.height;
|
||
this.currentBBox.x = tempBoundingBox.x;
|
||
this.currentBBox.y = tempBoundingBox.y;
|
||
|
||
this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);
|
||
var shapeStyle = this.shapeCont.style;
|
||
var shapeTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
|
||
shapeStyle.transform = shapeTransform;
|
||
shapeStyle.webkitTransform = shapeTransform;
|
||
}
|
||
}
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement,
|
||
RenderableDOMElement, ITextElement, createSizedArray, createTag, styleDiv, createNS, lineJoinEnum, lineCapEnum */
|
||
|
||
function HTextElement(data, globalData, comp) {
|
||
this.textSpans = [];
|
||
this.textPaths = [];
|
||
this.currentBBox = {
|
||
x: 999999,
|
||
y: -999999,
|
||
h: 0,
|
||
w: 0,
|
||
};
|
||
this.renderType = 'svg';
|
||
this.isMasked = false;
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement);
|
||
|
||
HTextElement.prototype.createContent = function () {
|
||
this.isMasked = this.checkMasks();
|
||
if (this.isMasked) {
|
||
this.renderType = 'svg';
|
||
this.compW = this.comp.data.w;
|
||
this.compH = this.comp.data.h;
|
||
this.svgElement.setAttribute('width', this.compW);
|
||
this.svgElement.setAttribute('height', this.compH);
|
||
var g = createNS('g');
|
||
this.maskedElement.appendChild(g);
|
||
this.innerElem = g;
|
||
} else {
|
||
this.renderType = 'html';
|
||
this.innerElem = this.layerElement;
|
||
}
|
||
|
||
this.checkParenting();
|
||
};
|
||
|
||
HTextElement.prototype.buildNewText = function () {
|
||
var documentData = this.textProperty.currentData;
|
||
this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
|
||
var innerElemStyle = this.innerElem.style;
|
||
var textColor = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';
|
||
innerElemStyle.fill = textColor;
|
||
innerElemStyle.color = textColor;
|
||
if (documentData.sc) {
|
||
innerElemStyle.stroke = this.buildColor(documentData.sc);
|
||
innerElemStyle.strokeWidth = documentData.sw + 'px';
|
||
}
|
||
var fontData = this.globalData.fontManager.getFontByName(documentData.f);
|
||
if (!this.globalData.fontManager.chars) {
|
||
innerElemStyle.fontSize = documentData.finalSize + 'px';
|
||
innerElemStyle.lineHeight = documentData.finalSize + 'px';
|
||
if (fontData.fClass) {
|
||
this.innerElem.className = fontData.fClass;
|
||
} else {
|
||
innerElemStyle.fontFamily = fontData.fFamily;
|
||
var fWeight = documentData.fWeight;
|
||
var fStyle = documentData.fStyle;
|
||
innerElemStyle.fontStyle = fStyle;
|
||
innerElemStyle.fontWeight = fWeight;
|
||
}
|
||
}
|
||
var i;
|
||
var len;
|
||
|
||
var letters = documentData.l;
|
||
len = letters.length;
|
||
var tSpan;
|
||
var tParent;
|
||
var tCont;
|
||
var matrixHelper = this.mHelper;
|
||
var shapes;
|
||
var shapeStr = '';
|
||
var cnt = 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (this.globalData.fontManager.chars) {
|
||
if (!this.textPaths[cnt]) {
|
||
tSpan = createNS('path');
|
||
tSpan.setAttribute('stroke-linecap', lineCapEnum[1]);
|
||
tSpan.setAttribute('stroke-linejoin', lineJoinEnum[2]);
|
||
tSpan.setAttribute('stroke-miterlimit', '4');
|
||
} else {
|
||
tSpan = this.textPaths[cnt];
|
||
}
|
||
if (!this.isMasked) {
|
||
if (this.textSpans[cnt]) {
|
||
tParent = this.textSpans[cnt];
|
||
tCont = tParent.children[0];
|
||
} else {
|
||
tParent = createTag('div');
|
||
tParent.style.lineHeight = 0;
|
||
tCont = createNS('svg');
|
||
tCont.appendChild(tSpan);
|
||
styleDiv(tParent);
|
||
}
|
||
}
|
||
} else if (!this.isMasked) {
|
||
if (this.textSpans[cnt]) {
|
||
tParent = this.textSpans[cnt];
|
||
tSpan = this.textPaths[cnt];
|
||
} else {
|
||
tParent = createTag('span');
|
||
styleDiv(tParent);
|
||
tSpan = createTag('span');
|
||
styleDiv(tSpan);
|
||
tParent.appendChild(tSpan);
|
||
}
|
||
} else {
|
||
tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');
|
||
}
|
||
// tSpan.setAttribute('visibility', 'hidden');
|
||
if (this.globalData.fontManager.chars) {
|
||
var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
|
||
var shapeData;
|
||
if (charData) {
|
||
shapeData = charData.data;
|
||
} else {
|
||
shapeData = null;
|
||
}
|
||
matrixHelper.reset();
|
||
if (shapeData && shapeData.shapes) {
|
||
shapes = shapeData.shapes[0].it;
|
||
matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
|
||
shapeStr = this.createPathShape(matrixHelper, shapes);
|
||
tSpan.setAttribute('d', shapeStr);
|
||
}
|
||
if (!this.isMasked) {
|
||
this.innerElem.appendChild(tParent);
|
||
if (shapeData && shapeData.shapes) {
|
||
// document.body.appendChild is needed to get exact measure of shape
|
||
document.body.appendChild(tCont);
|
||
var boundingBox = tCont.getBBox();
|
||
tCont.setAttribute('width', boundingBox.width + 2);
|
||
tCont.setAttribute('height', boundingBox.height + 2);
|
||
tCont.setAttribute('viewBox', (boundingBox.x - 1) + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2));
|
||
var tContStyle = tCont.style;
|
||
var tContTranslation = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)';
|
||
tContStyle.transform = tContTranslation;
|
||
tContStyle.webkitTransform = tContTranslation;
|
||
|
||
letters[i].yOffset = boundingBox.y - 1;
|
||
} else {
|
||
tCont.setAttribute('width', 1);
|
||
tCont.setAttribute('height', 1);
|
||
}
|
||
tParent.appendChild(tCont);
|
||
} else {
|
||
this.innerElem.appendChild(tSpan);
|
||
}
|
||
} else {
|
||
tSpan.textContent = letters[i].val;
|
||
tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||
if (!this.isMasked) {
|
||
this.innerElem.appendChild(tParent);
|
||
//
|
||
var tStyle = tSpan.style;
|
||
var tSpanTranslation = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)';
|
||
tStyle.transform = tSpanTranslation;
|
||
tStyle.webkitTransform = tSpanTranslation;
|
||
} else {
|
||
this.innerElem.appendChild(tSpan);
|
||
}
|
||
}
|
||
//
|
||
if (!this.isMasked) {
|
||
this.textSpans[cnt] = tParent;
|
||
} else {
|
||
this.textSpans[cnt] = tSpan;
|
||
}
|
||
this.textSpans[cnt].style.display = 'block';
|
||
this.textPaths[cnt] = tSpan;
|
||
cnt += 1;
|
||
}
|
||
while (cnt < this.textSpans.length) {
|
||
this.textSpans[cnt].style.display = 'none';
|
||
cnt += 1;
|
||
}
|
||
};
|
||
|
||
HTextElement.prototype.renderInnerContent = function () {
|
||
var svgStyle;
|
||
if (this.data.singleShape) {
|
||
if (!this._isFirstFrame && !this.lettersChangedFlag) {
|
||
return;
|
||
} if (this.isMasked && this.finalTransform._matMdf) {
|
||
// Todo Benchmark if using this is better than getBBox
|
||
this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH);
|
||
svgStyle = this.svgElement.style;
|
||
var translation = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';
|
||
svgStyle.transform = translation;
|
||
svgStyle.webkitTransform = translation;
|
||
}
|
||
}
|
||
|
||
this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
|
||
if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) {
|
||
return;
|
||
}
|
||
var i;
|
||
var len;
|
||
var count = 0;
|
||
var renderedLetters = this.textAnimator.renderedLetters;
|
||
|
||
var letters = this.textProperty.currentData.l;
|
||
|
||
len = letters.length;
|
||
var renderedLetter;
|
||
var textSpan;
|
||
var textPath;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (letters[i].n) {
|
||
count += 1;
|
||
} else {
|
||
textSpan = this.textSpans[i];
|
||
textPath = this.textPaths[i];
|
||
renderedLetter = renderedLetters[count];
|
||
count += 1;
|
||
if (renderedLetter._mdf.m) {
|
||
if (!this.isMasked) {
|
||
textSpan.style.webkitTransform = renderedLetter.m;
|
||
textSpan.style.transform = renderedLetter.m;
|
||
} else {
|
||
textSpan.setAttribute('transform', renderedLetter.m);
|
||
}
|
||
}
|
||
/// /textSpan.setAttribute('opacity',renderedLetter.o);
|
||
textSpan.style.opacity = renderedLetter.o;
|
||
if (renderedLetter.sw && renderedLetter._mdf.sw) {
|
||
textPath.setAttribute('stroke-width', renderedLetter.sw);
|
||
}
|
||
if (renderedLetter.sc && renderedLetter._mdf.sc) {
|
||
textPath.setAttribute('stroke', renderedLetter.sc);
|
||
}
|
||
if (renderedLetter.fc && renderedLetter._mdf.fc) {
|
||
textPath.setAttribute('fill', renderedLetter.fc);
|
||
textPath.style.color = renderedLetter.fc;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) {
|
||
var boundingBox = this.innerElem.getBBox();
|
||
|
||
if (this.currentBBox.w !== boundingBox.width) {
|
||
this.currentBBox.w = boundingBox.width;
|
||
this.svgElement.setAttribute('width', boundingBox.width);
|
||
}
|
||
if (this.currentBBox.h !== boundingBox.height) {
|
||
this.currentBBox.h = boundingBox.height;
|
||
this.svgElement.setAttribute('height', boundingBox.height);
|
||
}
|
||
|
||
var margin = 1;
|
||
if (this.currentBBox.w !== (boundingBox.width + margin * 2) || this.currentBBox.h !== (boundingBox.height + margin * 2) || this.currentBBox.x !== (boundingBox.x - margin) || this.currentBBox.y !== (boundingBox.y - margin)) {
|
||
this.currentBBox.w = boundingBox.width + margin * 2;
|
||
this.currentBBox.h = boundingBox.height + margin * 2;
|
||
this.currentBBox.x = boundingBox.x - margin;
|
||
this.currentBBox.y = boundingBox.y - margin;
|
||
|
||
this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);
|
||
svgStyle = this.svgElement.style;
|
||
var svgTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
|
||
svgStyle.transform = svgTransform;
|
||
svgStyle.webkitTransform = svgTransform;
|
||
}
|
||
}
|
||
};
|
||
|
||
/* global extendPrototype, BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement,
|
||
FrameElement, RenderableElement, createNS */
|
||
|
||
function HImageElement(data, globalData, comp) {
|
||
this.assetData = globalData.getAssetData(data.refId);
|
||
this.initElement(data, globalData, comp);
|
||
}
|
||
|
||
extendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement);
|
||
|
||
HImageElement.prototype.createContent = function () {
|
||
var assetPath = this.globalData.getAssetsPath(this.assetData);
|
||
var img = new Image();
|
||
|
||
if (this.data.hasMask) {
|
||
this.imageElem = createNS('image');
|
||
this.imageElem.setAttribute('width', this.assetData.w + 'px');
|
||
this.imageElem.setAttribute('height', this.assetData.h + 'px');
|
||
this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);
|
||
this.layerElement.appendChild(this.imageElem);
|
||
this.baseElement.setAttribute('width', this.assetData.w);
|
||
this.baseElement.setAttribute('height', this.assetData.h);
|
||
} else {
|
||
this.layerElement.appendChild(img);
|
||
}
|
||
img.crossOrigin = 'anonymous';
|
||
img.src = assetPath;
|
||
if (this.data.ln) {
|
||
this.baseElement.setAttribute('id', this.data.ln);
|
||
}
|
||
};
|
||
|
||
/* global PropertyFactory, degToRads, Matrix, extendPrototype, BaseElement, FrameElement, HierarchyElement */
|
||
|
||
function HCameraElement(data, globalData, comp) {
|
||
this.initFrame();
|
||
this.initBaseData(data, globalData, comp);
|
||
this.initHierarchy();
|
||
var getProp = PropertyFactory.getProp;
|
||
this.pe = getProp(this, data.pe, 0, 0, this);
|
||
if (data.ks.p.s) {
|
||
this.px = getProp(this, data.ks.p.x, 1, 0, this);
|
||
this.py = getProp(this, data.ks.p.y, 1, 0, this);
|
||
this.pz = getProp(this, data.ks.p.z, 1, 0, this);
|
||
} else {
|
||
this.p = getProp(this, data.ks.p, 1, 0, this);
|
||
}
|
||
if (data.ks.a) {
|
||
this.a = getProp(this, data.ks.a, 1, 0, this);
|
||
}
|
||
if (data.ks.or.k.length && data.ks.or.k[0].to) {
|
||
var i;
|
||
var len = data.ks.or.k.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
data.ks.or.k[i].to = null;
|
||
data.ks.or.k[i].ti = null;
|
||
}
|
||
}
|
||
this.or = getProp(this, data.ks.or, 1, degToRads, this);
|
||
this.or.sh = true;
|
||
this.rx = getProp(this, data.ks.rx, 0, degToRads, this);
|
||
this.ry = getProp(this, data.ks.ry, 0, degToRads, this);
|
||
this.rz = getProp(this, data.ks.rz, 0, degToRads, this);
|
||
this.mat = new Matrix();
|
||
this._prevMat = new Matrix();
|
||
this._isFirstFrame = true;
|
||
|
||
// TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.
|
||
this.finalTransform = {
|
||
mProp: this,
|
||
};
|
||
}
|
||
extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);
|
||
|
||
HCameraElement.prototype.setup = function () {
|
||
var i;
|
||
var len = this.comp.threeDElements.length;
|
||
var comp;
|
||
var perspectiveStyle;
|
||
var containerStyle;
|
||
for (i = 0; i < len; i += 1) {
|
||
// [perspectiveElem,container]
|
||
comp = this.comp.threeDElements[i];
|
||
if (comp.type === '3d') {
|
||
perspectiveStyle = comp.perspectiveElem.style;
|
||
containerStyle = comp.container.style;
|
||
var perspective = this.pe.v + 'px';
|
||
var origin = '0px 0px 0px';
|
||
var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
|
||
perspectiveStyle.perspective = perspective;
|
||
perspectiveStyle.webkitPerspective = perspective;
|
||
containerStyle.transformOrigin = origin;
|
||
containerStyle.mozTransformOrigin = origin;
|
||
containerStyle.webkitTransformOrigin = origin;
|
||
perspectiveStyle.transform = matrix;
|
||
perspectiveStyle.webkitTransform = matrix;
|
||
}
|
||
}
|
||
};
|
||
|
||
HCameraElement.prototype.createElements = function () {
|
||
};
|
||
|
||
HCameraElement.prototype.hide = function () {
|
||
};
|
||
|
||
HCameraElement.prototype.renderFrame = function () {
|
||
var _mdf = this._isFirstFrame;
|
||
var i;
|
||
var len;
|
||
if (this.hierarchy) {
|
||
len = this.hierarchy.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
_mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;
|
||
}
|
||
}
|
||
if (_mdf || this.pe._mdf || (this.p && this.p._mdf) || (this.px && (this.px._mdf || this.py._mdf || this.pz._mdf)) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || (this.a && this.a._mdf)) {
|
||
this.mat.reset();
|
||
|
||
if (this.hierarchy) {
|
||
len = this.hierarchy.length - 1;
|
||
for (i = len; i >= 0; i -= 1) {
|
||
var mTransf = this.hierarchy[i].finalTransform.mProp;
|
||
this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]);
|
||
this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);
|
||
this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);
|
||
this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]);
|
||
this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]);
|
||
}
|
||
}
|
||
if (this.p) {
|
||
this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]);
|
||
} else {
|
||
this.mat.translate(-this.px.v, -this.py.v, this.pz.v);
|
||
}
|
||
if (this.a) {
|
||
var diffVector;
|
||
if (this.p) {
|
||
diffVector = [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]];
|
||
} else {
|
||
diffVector = [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]];
|
||
}
|
||
var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2));
|
||
// var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));
|
||
var lookDir = [diffVector[0] / mag, diffVector[1] / mag, diffVector[2] / mag];
|
||
var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]);
|
||
var mRotationX = (Math.atan2(lookDir[1], lookLengthOnXZ));
|
||
var mRotationY = (Math.atan2(lookDir[0], -lookDir[2]));
|
||
this.mat.rotateY(mRotationY).rotateX(-mRotationX);
|
||
}
|
||
this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);
|
||
this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);
|
||
this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0);
|
||
this.mat.translate(0, 0, this.pe.v);
|
||
|
||
var hasMatrixChanged = !this._prevMat.equals(this.mat);
|
||
if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {
|
||
len = this.comp.threeDElements.length;
|
||
var comp;
|
||
var perspectiveStyle;
|
||
var containerStyle;
|
||
for (i = 0; i < len; i += 1) {
|
||
comp = this.comp.threeDElements[i];
|
||
if (comp.type === '3d') {
|
||
if (hasMatrixChanged) {
|
||
var matValue = this.mat.toCSS();
|
||
containerStyle = comp.container.style;
|
||
containerStyle.transform = matValue;
|
||
containerStyle.webkitTransform = matValue;
|
||
}
|
||
if (this.pe._mdf) {
|
||
perspectiveStyle = comp.perspectiveElem.style;
|
||
perspectiveStyle.perspective = this.pe.v + 'px';
|
||
perspectiveStyle.webkitPerspective = this.pe.v + 'px';
|
||
}
|
||
}
|
||
}
|
||
this.mat.clone(this._prevMat);
|
||
}
|
||
}
|
||
this._isFirstFrame = false;
|
||
};
|
||
|
||
HCameraElement.prototype.prepareFrame = function (num) {
|
||
this.prepareProperties(num, true);
|
||
};
|
||
|
||
HCameraElement.prototype.destroy = function () {
|
||
};
|
||
HCameraElement.prototype.getBaseElement = function () { return null; };
|
||
|
||
function HEffects() {
|
||
}
|
||
HEffects.prototype.renderFrame = function () {};
|
||
|
||
/* global createTag, AnimationItem */
|
||
/* exported animationManager */
|
||
|
||
var animationManager = (function () {
|
||
var moduleOb = {};
|
||
var registeredAnimations = [];
|
||
var initTime = 0;
|
||
var len = 0;
|
||
var playingAnimationsNum = 0;
|
||
var _stopped = true;
|
||
var _isFrozen = false;
|
||
|
||
function removeElement(ev) {
|
||
var i = 0;
|
||
var animItem = ev.target;
|
||
while (i < len) {
|
||
if (registeredAnimations[i].animation === animItem) {
|
||
registeredAnimations.splice(i, 1);
|
||
i -= 1;
|
||
len -= 1;
|
||
if (!animItem.isPaused) {
|
||
subtractPlayingCount();
|
||
}
|
||
}
|
||
i += 1;
|
||
}
|
||
}
|
||
|
||
function registerAnimation(element, animationData) {
|
||
if (!element) {
|
||
return null;
|
||
}
|
||
var i = 0;
|
||
while (i < len) {
|
||
if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) {
|
||
return registeredAnimations[i].animation;
|
||
}
|
||
i += 1;
|
||
}
|
||
var animItem = new AnimationItem();
|
||
setupAnimation(animItem, element);
|
||
animItem.setData(element, animationData);
|
||
return animItem;
|
||
}
|
||
|
||
function getRegisteredAnimations() {
|
||
var i;
|
||
var lenAnims = registeredAnimations.length;
|
||
var animations = [];
|
||
for (i = 0; i < lenAnims; i += 1) {
|
||
animations.push(registeredAnimations[i].animation);
|
||
}
|
||
return animations;
|
||
}
|
||
|
||
function addPlayingCount() {
|
||
playingAnimationsNum += 1;
|
||
activate();
|
||
}
|
||
|
||
function subtractPlayingCount() {
|
||
playingAnimationsNum -= 1;
|
||
}
|
||
|
||
function setupAnimation(animItem, element) {
|
||
animItem.addEventListener('destroy', removeElement);
|
||
animItem.addEventListener('_active', addPlayingCount);
|
||
animItem.addEventListener('_idle', subtractPlayingCount);
|
||
registeredAnimations.push({ elem: element, animation: animItem });
|
||
len += 1;
|
||
}
|
||
|
||
function loadAnimation(params) {
|
||
var animItem = new AnimationItem();
|
||
setupAnimation(animItem, null);
|
||
animItem.setParams(params);
|
||
return animItem;
|
||
}
|
||
|
||
function setSpeed(val, animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.setSpeed(val, animation);
|
||
}
|
||
}
|
||
|
||
function setDirection(val, animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.setDirection(val, animation);
|
||
}
|
||
}
|
||
|
||
function play(animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.play(animation);
|
||
}
|
||
}
|
||
function resume(nowTime) {
|
||
var elapsedTime = nowTime - initTime;
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.advanceTime(elapsedTime);
|
||
}
|
||
initTime = nowTime;
|
||
if (playingAnimationsNum && !_isFrozen) {
|
||
window.requestAnimationFrame(resume);
|
||
} else {
|
||
_stopped = true;
|
||
}
|
||
}
|
||
|
||
function first(nowTime) {
|
||
initTime = nowTime;
|
||
window.requestAnimationFrame(resume);
|
||
}
|
||
|
||
function pause(animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.pause(animation);
|
||
}
|
||
}
|
||
|
||
function goToAndStop(value, isFrame, animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.goToAndStop(value, isFrame, animation);
|
||
}
|
||
}
|
||
|
||
function stop(animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.stop(animation);
|
||
}
|
||
}
|
||
|
||
function togglePause(animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.togglePause(animation);
|
||
}
|
||
}
|
||
|
||
function destroy(animation) {
|
||
var i;
|
||
for (i = (len - 1); i >= 0; i -= 1) {
|
||
registeredAnimations[i].animation.destroy(animation);
|
||
}
|
||
}
|
||
|
||
function searchAnimations(animationData, standalone, renderer) {
|
||
var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')),
|
||
[].slice.call(document.getElementsByClassName('bodymovin')));
|
||
var i;
|
||
var lenAnims = animElements.length;
|
||
for (i = 0; i < lenAnims; i += 1) {
|
||
if (renderer) {
|
||
animElements[i].setAttribute('data-bm-type', renderer);
|
||
}
|
||
registerAnimation(animElements[i], animationData);
|
||
}
|
||
if (standalone && lenAnims === 0) {
|
||
if (!renderer) {
|
||
renderer = 'svg';
|
||
}
|
||
var body = document.getElementsByTagName('body')[0];
|
||
body.innerText = '';
|
||
var div = createTag('div');
|
||
div.style.width = '100%';
|
||
div.style.height = '100%';
|
||
div.setAttribute('data-bm-type', renderer);
|
||
body.appendChild(div);
|
||
registerAnimation(div, animationData);
|
||
}
|
||
}
|
||
|
||
function resize() {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.resize();
|
||
}
|
||
}
|
||
|
||
function activate() {
|
||
if (!_isFrozen && playingAnimationsNum) {
|
||
if (_stopped) {
|
||
window.requestAnimationFrame(first);
|
||
_stopped = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
function freeze() {
|
||
_isFrozen = true;
|
||
}
|
||
|
||
function unfreeze() {
|
||
_isFrozen = false;
|
||
activate();
|
||
}
|
||
|
||
function setVolume(val, animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.setVolume(val, animation);
|
||
}
|
||
}
|
||
|
||
function mute(animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.mute(animation);
|
||
}
|
||
}
|
||
|
||
function unmute(animation) {
|
||
var i;
|
||
for (i = 0; i < len; i += 1) {
|
||
registeredAnimations[i].animation.unmute(animation);
|
||
}
|
||
}
|
||
|
||
moduleOb.registerAnimation = registerAnimation;
|
||
moduleOb.loadAnimation = loadAnimation;
|
||
moduleOb.setSpeed = setSpeed;
|
||
moduleOb.setDirection = setDirection;
|
||
moduleOb.play = play;
|
||
moduleOb.pause = pause;
|
||
moduleOb.stop = stop;
|
||
moduleOb.togglePause = togglePause;
|
||
moduleOb.searchAnimations = searchAnimations;
|
||
moduleOb.resize = resize;
|
||
// moduleOb.start = start;
|
||
moduleOb.goToAndStop = goToAndStop;
|
||
moduleOb.destroy = destroy;
|
||
moduleOb.freeze = freeze;
|
||
moduleOb.unfreeze = unfreeze;
|
||
moduleOb.setVolume = setVolume;
|
||
moduleOb.mute = mute;
|
||
moduleOb.unmute = unmute;
|
||
moduleOb.getRegisteredAnimations = getRegisteredAnimations;
|
||
return moduleOb;
|
||
}());
|
||
|
||
/* global createElementID, subframeEnabled, ProjectInterface, ImagePreloader, audioControllerFactory, extendPrototype, BaseEvent,
|
||
CanvasRenderer, SVGRenderer, HybridRenderer, assetLoader, dataManager, expressionsPlugin, BMEnterFrameEvent, BMCompleteLoopEvent,
|
||
BMCompleteEvent, BMSegmentStartEvent, BMDestroyEvent, BMEnterFrameEvent, BMCompleteLoopEvent, BMCompleteEvent, BMSegmentStartEvent,
|
||
BMDestroyEvent, BMRenderFrameErrorEvent, BMConfigErrorEvent, markerParser */
|
||
|
||
var AnimationItem = function () {
|
||
this._cbs = [];
|
||
this.name = '';
|
||
this.path = '';
|
||
this.isLoaded = false;
|
||
this.currentFrame = 0;
|
||
this.currentRawFrame = 0;
|
||
this.firstFrame = 0;
|
||
this.totalFrames = 0;
|
||
this.frameRate = 0;
|
||
this.frameMult = 0;
|
||
this.playSpeed = 1;
|
||
this.playDirection = 1;
|
||
this.playCount = 0;
|
||
this.animationData = {};
|
||
this.assets = [];
|
||
this.isPaused = true;
|
||
this.autoplay = false;
|
||
this.loop = true;
|
||
this.renderer = null;
|
||
this.animationID = createElementID();
|
||
this.assetsPath = '';
|
||
this.timeCompleted = 0;
|
||
this.segmentPos = 0;
|
||
this.isSubframeEnabled = subframeEnabled;
|
||
this.segments = [];
|
||
this._idle = true;
|
||
this._completedLoop = false;
|
||
this.projectInterface = ProjectInterface();
|
||
this.imagePreloader = new ImagePreloader();
|
||
this.audioController = audioControllerFactory();
|
||
this.markers = [];
|
||
};
|
||
|
||
extendPrototype([BaseEvent], AnimationItem);
|
||
|
||
AnimationItem.prototype.setParams = function (params) {
|
||
if (params.wrapper || params.container) {
|
||
this.wrapper = params.wrapper || params.container;
|
||
}
|
||
var animType = 'svg';
|
||
if (params.animType) {
|
||
animType = params.animType;
|
||
} else if (params.renderer) {
|
||
animType = params.renderer;
|
||
}
|
||
switch (animType) {
|
||
case 'canvas':
|
||
this.renderer = new CanvasRenderer(this, params.rendererSettings);
|
||
break;
|
||
case 'svg':
|
||
this.renderer = new SVGRenderer(this, params.rendererSettings);
|
||
break;
|
||
default:
|
||
this.renderer = new HybridRenderer(this, params.rendererSettings);
|
||
break;
|
||
}
|
||
this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs);
|
||
this.renderer.setProjectInterface(this.projectInterface);
|
||
this.animType = animType;
|
||
if (params.loop === ''
|
||
|| params.loop === null
|
||
|| params.loop === undefined
|
||
|| params.loop === true) {
|
||
this.loop = true;
|
||
} else if (params.loop === false) {
|
||
this.loop = false;
|
||
} else {
|
||
this.loop = parseInt(params.loop, 10);
|
||
}
|
||
this.autoplay = 'autoplay' in params ? params.autoplay : true;
|
||
this.name = params.name ? params.name : '';
|
||
this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments') ? params.autoloadSegments : true;
|
||
this.assetsPath = params.assetsPath;
|
||
this.initialSegment = params.initialSegment;
|
||
if (params.audioFactory) {
|
||
this.audioController.setAudioFactory(params.audioFactory);
|
||
}
|
||
if (params.animationData) {
|
||
this.configAnimation(params.animationData);
|
||
} else if (params.path) {
|
||
if (params.path.lastIndexOf('\\') !== -1) {
|
||
this.path = params.path.substr(0, params.path.lastIndexOf('\\') + 1);
|
||
} else {
|
||
this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1);
|
||
}
|
||
this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1);
|
||
this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'));
|
||
|
||
assetLoader.load(params.path, this.configAnimation.bind(this), function () {
|
||
this.trigger('data_failed');
|
||
}.bind(this));
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.setData = function (wrapper, animationData) {
|
||
if (animationData) {
|
||
if (typeof animationData !== 'object') {
|
||
animationData = JSON.parse(animationData);
|
||
}
|
||
}
|
||
var params = {
|
||
wrapper: wrapper,
|
||
animationData: animationData,
|
||
};
|
||
var wrapperAttributes = wrapper.attributes;
|
||
|
||
params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-animation-path').value
|
||
: wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-bm-path').value
|
||
: wrapperAttributes.getNamedItem('bm-path')
|
||
? wrapperAttributes.getNamedItem('bm-path').value
|
||
: '';
|
||
params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-anim-type').value
|
||
: wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-bm-type').value
|
||
: wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('bm-type').value
|
||
: wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-bm-renderer').value
|
||
: wrapperAttributes.getNamedItem('bm-renderer')
|
||
? wrapperAttributes.getNamedItem('bm-renderer').value
|
||
: 'canvas';
|
||
|
||
var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-anim-loop').value
|
||
: wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-bm-loop').value
|
||
: wrapperAttributes.getNamedItem('bm-loop')
|
||
? wrapperAttributes.getNamedItem('bm-loop').value
|
||
: '';
|
||
if (loop === 'false') {
|
||
params.loop = false;
|
||
} else if (loop === 'true') {
|
||
params.loop = true;
|
||
} else if (loop !== '') {
|
||
params.loop = parseInt(loop, 10);
|
||
}
|
||
var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-anim-autoplay').value
|
||
: wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-bm-autoplay').value
|
||
: wrapperAttributes.getNamedItem('bm-autoplay')
|
||
? wrapperAttributes.getNamedItem('bm-autoplay').value
|
||
: true;
|
||
params.autoplay = autoplay !== 'false';
|
||
|
||
params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-name').value
|
||
: wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-bm-name').value
|
||
: wrapperAttributes.getNamedItem('bm-name')
|
||
? wrapperAttributes.getNamedItem('bm-name').value
|
||
: '';
|
||
var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-anim-prerender').value
|
||
: wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary
|
||
? wrapperAttributes.getNamedItem('data-bm-prerender').value
|
||
: wrapperAttributes.getNamedItem('bm-prerender')
|
||
? wrapperAttributes.getNamedItem('bm-prerender').value
|
||
: '';
|
||
|
||
if (prerender === 'false') {
|
||
params.prerender = false;
|
||
}
|
||
this.setParams(params);
|
||
};
|
||
|
||
AnimationItem.prototype.includeLayers = function (data) {
|
||
if (data.op > this.animationData.op) {
|
||
this.animationData.op = data.op;
|
||
this.totalFrames = Math.floor(data.op - this.animationData.ip);
|
||
}
|
||
var layers = this.animationData.layers;
|
||
var i;
|
||
var len = layers.length;
|
||
var newLayers = data.layers;
|
||
var j;
|
||
var jLen = newLayers.length;
|
||
for (j = 0; j < jLen; j += 1) {
|
||
i = 0;
|
||
while (i < len) {
|
||
if (layers[i].id === newLayers[j].id) {
|
||
layers[i] = newLayers[j];
|
||
break;
|
||
}
|
||
i += 1;
|
||
}
|
||
}
|
||
if (data.chars || data.fonts) {
|
||
this.renderer.globalData.fontManager.addChars(data.chars);
|
||
this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);
|
||
}
|
||
if (data.assets) {
|
||
len = data.assets.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.animationData.assets.push(data.assets[i]);
|
||
}
|
||
}
|
||
this.animationData.__complete = false;
|
||
dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
|
||
this.renderer.includeLayers(data.layers);
|
||
if (expressionsPlugin) {
|
||
expressionsPlugin.initExpressions(this);
|
||
}
|
||
this.loadNextSegment();
|
||
};
|
||
|
||
AnimationItem.prototype.loadNextSegment = function () {
|
||
var segments = this.animationData.segments;
|
||
if (!segments || segments.length === 0 || !this.autoloadSegments) {
|
||
this.trigger('data_ready');
|
||
this.timeCompleted = this.totalFrames;
|
||
return;
|
||
}
|
||
var segment = segments.shift();
|
||
this.timeCompleted = segment.time * this.frameRate;
|
||
var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json';
|
||
this.segmentPos += 1;
|
||
assetLoader.load(segmentPath, this.includeLayers.bind(this), function () {
|
||
this.trigger('data_failed');
|
||
}.bind(this));
|
||
};
|
||
|
||
AnimationItem.prototype.loadSegments = function () {
|
||
var segments = this.animationData.segments;
|
||
if (!segments) {
|
||
this.timeCompleted = this.totalFrames;
|
||
}
|
||
this.loadNextSegment();
|
||
};
|
||
|
||
AnimationItem.prototype.imagesLoaded = function () {
|
||
this.trigger('loaded_images');
|
||
this.checkLoaded();
|
||
};
|
||
|
||
AnimationItem.prototype.preloadImages = function () {
|
||
this.imagePreloader.setAssetsPath(this.assetsPath);
|
||
this.imagePreloader.setPath(this.path);
|
||
this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));
|
||
};
|
||
|
||
AnimationItem.prototype.configAnimation = function (animData) {
|
||
if (!this.renderer) {
|
||
return;
|
||
}
|
||
try {
|
||
this.animationData = animData;
|
||
|
||
if (this.initialSegment) {
|
||
this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]);
|
||
this.firstFrame = Math.round(this.initialSegment[0]);
|
||
} else {
|
||
this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);
|
||
this.firstFrame = Math.round(this.animationData.ip);
|
||
}
|
||
this.renderer.configAnimation(animData);
|
||
if (!animData.assets) {
|
||
animData.assets = [];
|
||
}
|
||
|
||
this.assets = this.animationData.assets;
|
||
this.frameRate = this.animationData.fr;
|
||
this.frameMult = this.animationData.fr / 1000;
|
||
this.renderer.searchExtraCompositions(animData.assets);
|
||
this.markers = markerParser(animData.markers || []);
|
||
this.trigger('config_ready');
|
||
this.preloadImages();
|
||
this.loadSegments();
|
||
this.updaFrameModifier();
|
||
this.waitForFontsLoaded();
|
||
if (this.isPaused) {
|
||
this.audioController.pause();
|
||
}
|
||
} catch (error) {
|
||
this.triggerConfigError(error);
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.waitForFontsLoaded = function () {
|
||
if (!this.renderer) {
|
||
return;
|
||
}
|
||
if (this.renderer.globalData.fontManager.isLoaded) {
|
||
this.checkLoaded();
|
||
} else {
|
||
setTimeout(this.waitForFontsLoaded.bind(this), 20);
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.checkLoaded = function () {
|
||
if (!this.isLoaded
|
||
&& this.renderer.globalData.fontManager.isLoaded
|
||
&& (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas')
|
||
&& (this.imagePreloader.loadedFootages())
|
||
) {
|
||
this.isLoaded = true;
|
||
dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
|
||
if (expressionsPlugin) {
|
||
expressionsPlugin.initExpressions(this);
|
||
}
|
||
this.renderer.initItems();
|
||
setTimeout(function () {
|
||
this.trigger('DOMLoaded');
|
||
}.bind(this), 0);
|
||
this.gotoFrame();
|
||
if (this.autoplay) {
|
||
this.play();
|
||
}
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.resize = function () {
|
||
this.renderer.updateContainerSize();
|
||
};
|
||
|
||
AnimationItem.prototype.setSubframe = function (flag) {
|
||
this.isSubframeEnabled = !!flag;
|
||
};
|
||
|
||
AnimationItem.prototype.gotoFrame = function () {
|
||
this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame; // eslint-disable-line no-bitwise
|
||
|
||
if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {
|
||
this.currentFrame = this.timeCompleted;
|
||
}
|
||
this.trigger('enterFrame');
|
||
this.renderFrame();
|
||
};
|
||
|
||
AnimationItem.prototype.renderFrame = function () {
|
||
if (this.isLoaded === false || !this.renderer) {
|
||
return;
|
||
}
|
||
try {
|
||
this.renderer.renderFrame(this.currentFrame + this.firstFrame);
|
||
} catch (error) {
|
||
this.triggerRenderFrameError(error);
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.play = function (name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
if (this.isPaused === true) {
|
||
this.isPaused = false;
|
||
this.audioController.resume();
|
||
if (this._idle) {
|
||
this._idle = false;
|
||
this.trigger('_active');
|
||
}
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.pause = function (name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
if (this.isPaused === false) {
|
||
this.isPaused = true;
|
||
this._idle = true;
|
||
this.trigger('_idle');
|
||
this.audioController.pause();
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.togglePause = function (name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
if (this.isPaused === true) {
|
||
this.play();
|
||
} else {
|
||
this.pause();
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.stop = function (name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
this.pause();
|
||
this.playCount = 0;
|
||
this._completedLoop = false;
|
||
this.setCurrentRawFrameValue(0);
|
||
};
|
||
|
||
AnimationItem.prototype.getMarkerData = function (markerName) {
|
||
var marker;
|
||
for (var i = 0; i < this.markers.length; i += 1) {
|
||
marker = this.markers[i];
|
||
if (marker.payload && marker.payload.name === markerName) {
|
||
return marker;
|
||
}
|
||
}
|
||
return null;
|
||
};
|
||
|
||
AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
var numValue = Number(value);
|
||
if (isNaN(numValue)) {
|
||
var marker = this.getMarkerData(value);
|
||
if (marker) {
|
||
this.goToAndStop(marker.time, true);
|
||
}
|
||
} else if (isFrame) {
|
||
this.setCurrentRawFrameValue(value);
|
||
} else {
|
||
this.setCurrentRawFrameValue(value * this.frameModifier);
|
||
}
|
||
this.pause();
|
||
};
|
||
|
||
AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
var numValue = Number(value);
|
||
if (isNaN(numValue)) {
|
||
var marker = this.getMarkerData(value);
|
||
if (marker) {
|
||
if (!marker.duration) {
|
||
this.goToAndStop(marker.time, true);
|
||
} else {
|
||
this.playSegments([marker.time, marker.time + marker.duration], true);
|
||
}
|
||
}
|
||
} else {
|
||
this.goToAndStop(numValue, isFrame, name);
|
||
}
|
||
this.play();
|
||
};
|
||
|
||
AnimationItem.prototype.advanceTime = function (value) {
|
||
if (this.isPaused === true || this.isLoaded === false) {
|
||
return;
|
||
}
|
||
var nextValue = this.currentRawFrame + value * this.frameModifier;
|
||
var _isComplete = false;
|
||
// Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.
|
||
// If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.
|
||
if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {
|
||
if (!this.loop || this.playCount === this.loop) {
|
||
if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {
|
||
_isComplete = true;
|
||
nextValue = this.totalFrames - 1;
|
||
}
|
||
} else if (nextValue >= this.totalFrames) {
|
||
this.playCount += 1;
|
||
if (!this.checkSegments(nextValue % this.totalFrames)) {
|
||
this.setCurrentRawFrameValue(nextValue % this.totalFrames);
|
||
this._completedLoop = true;
|
||
this.trigger('loopComplete');
|
||
}
|
||
} else {
|
||
this.setCurrentRawFrameValue(nextValue);
|
||
}
|
||
} else if (nextValue < 0) {
|
||
if (!this.checkSegments(nextValue % this.totalFrames)) {
|
||
if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) { // eslint-disable-line no-plusplus
|
||
this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames));
|
||
if (!this._completedLoop) {
|
||
this._completedLoop = true;
|
||
} else {
|
||
this.trigger('loopComplete');
|
||
}
|
||
} else {
|
||
_isComplete = true;
|
||
nextValue = 0;
|
||
}
|
||
}
|
||
} else {
|
||
this.setCurrentRawFrameValue(nextValue);
|
||
}
|
||
if (_isComplete) {
|
||
this.setCurrentRawFrameValue(nextValue);
|
||
this.pause();
|
||
this.trigger('complete');
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.adjustSegment = function (arr, offset) {
|
||
this.playCount = 0;
|
||
if (arr[1] < arr[0]) {
|
||
if (this.frameModifier > 0) {
|
||
if (this.playSpeed < 0) {
|
||
this.setSpeed(-this.playSpeed);
|
||
} else {
|
||
this.setDirection(-1);
|
||
}
|
||
}
|
||
this.totalFrames = arr[0] - arr[1];
|
||
this.timeCompleted = this.totalFrames;
|
||
this.firstFrame = arr[1];
|
||
this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);
|
||
} else if (arr[1] > arr[0]) {
|
||
if (this.frameModifier < 0) {
|
||
if (this.playSpeed < 0) {
|
||
this.setSpeed(-this.playSpeed);
|
||
} else {
|
||
this.setDirection(1);
|
||
}
|
||
}
|
||
this.totalFrames = arr[1] - arr[0];
|
||
this.timeCompleted = this.totalFrames;
|
||
this.firstFrame = arr[0];
|
||
this.setCurrentRawFrameValue(0.001 + offset);
|
||
}
|
||
this.trigger('segmentStart');
|
||
};
|
||
AnimationItem.prototype.setSegment = function (init, end) {
|
||
var pendingFrame = -1;
|
||
if (this.isPaused) {
|
||
if (this.currentRawFrame + this.firstFrame < init) {
|
||
pendingFrame = init;
|
||
} else if (this.currentRawFrame + this.firstFrame > end) {
|
||
pendingFrame = end - init;
|
||
}
|
||
}
|
||
|
||
this.firstFrame = init;
|
||
this.totalFrames = end - init;
|
||
this.timeCompleted = this.totalFrames;
|
||
if (pendingFrame !== -1) {
|
||
this.goToAndStop(pendingFrame, true);
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.playSegments = function (arr, forceFlag) {
|
||
if (forceFlag) {
|
||
this.segments.length = 0;
|
||
}
|
||
if (typeof arr[0] === 'object') {
|
||
var i;
|
||
var len = arr.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this.segments.push(arr[i]);
|
||
}
|
||
} else {
|
||
this.segments.push(arr);
|
||
}
|
||
if (this.segments.length && forceFlag) {
|
||
this.adjustSegment(this.segments.shift(), 0);
|
||
}
|
||
if (this.isPaused) {
|
||
this.play();
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.resetSegments = function (forceFlag) {
|
||
this.segments.length = 0;
|
||
this.segments.push([this.animationData.ip, this.animationData.op]);
|
||
// this.segments.push([this.animationData.ip*this.frameRate,Math.floor(this.animationData.op - this.animationData.ip+this.animationData.ip*this.frameRate)]);
|
||
if (forceFlag) {
|
||
this.checkSegments(0);
|
||
}
|
||
};
|
||
AnimationItem.prototype.checkSegments = function (offset) {
|
||
if (this.segments.length) {
|
||
this.adjustSegment(this.segments.shift(), offset);
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
AnimationItem.prototype.destroy = function (name) {
|
||
if ((name && this.name !== name) || !this.renderer) {
|
||
return;
|
||
}
|
||
this.renderer.destroy();
|
||
this.imagePreloader.destroy();
|
||
this.trigger('destroy');
|
||
this._cbs = null;
|
||
this.onEnterFrame = null;
|
||
this.onLoopComplete = null;
|
||
this.onComplete = null;
|
||
this.onSegmentStart = null;
|
||
this.onDestroy = null;
|
||
this.renderer = null;
|
||
this.renderer = null;
|
||
this.imagePreloader = null;
|
||
this.projectInterface = null;
|
||
};
|
||
|
||
AnimationItem.prototype.setCurrentRawFrameValue = function (value) {
|
||
this.currentRawFrame = value;
|
||
this.gotoFrame();
|
||
};
|
||
|
||
AnimationItem.prototype.setSpeed = function (val) {
|
||
this.playSpeed = val;
|
||
this.updaFrameModifier();
|
||
};
|
||
|
||
AnimationItem.prototype.setDirection = function (val) {
|
||
this.playDirection = val < 0 ? -1 : 1;
|
||
this.updaFrameModifier();
|
||
};
|
||
|
||
AnimationItem.prototype.setVolume = function (val, name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
this.audioController.setVolume(val);
|
||
};
|
||
|
||
AnimationItem.prototype.getVolume = function () {
|
||
return this.audioController.getVolume();
|
||
};
|
||
|
||
AnimationItem.prototype.mute = function (name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
this.audioController.mute();
|
||
};
|
||
|
||
AnimationItem.prototype.unmute = function (name) {
|
||
if (name && this.name !== name) {
|
||
return;
|
||
}
|
||
this.audioController.unmute();
|
||
};
|
||
|
||
AnimationItem.prototype.updaFrameModifier = function () {
|
||
this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;
|
||
this.audioController.setRate(this.playSpeed * this.playDirection);
|
||
};
|
||
|
||
AnimationItem.prototype.getPath = function () {
|
||
return this.path;
|
||
};
|
||
|
||
AnimationItem.prototype.getAssetsPath = function (assetData) {
|
||
var path = '';
|
||
if (assetData.e) {
|
||
path = assetData.p;
|
||
} else if (this.assetsPath) {
|
||
var imagePath = assetData.p;
|
||
if (imagePath.indexOf('images/') !== -1) {
|
||
imagePath = imagePath.split('/')[1];
|
||
}
|
||
path = this.assetsPath + imagePath;
|
||
} else {
|
||
path = this.path;
|
||
path += assetData.u ? assetData.u : '';
|
||
path += assetData.p;
|
||
}
|
||
return path;
|
||
};
|
||
|
||
AnimationItem.prototype.getAssetData = function (id) {
|
||
var i = 0;
|
||
var len = this.assets.length;
|
||
while (i < len) {
|
||
if (id === this.assets[i].id) {
|
||
return this.assets[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
};
|
||
|
||
AnimationItem.prototype.hide = function () {
|
||
this.renderer.hide();
|
||
};
|
||
|
||
AnimationItem.prototype.show = function () {
|
||
this.renderer.show();
|
||
};
|
||
|
||
AnimationItem.prototype.getDuration = function (isFrame) {
|
||
return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;
|
||
};
|
||
|
||
AnimationItem.prototype.trigger = function (name) {
|
||
if (this._cbs && this._cbs[name]) {
|
||
switch (name) {
|
||
case 'enterFrame':
|
||
this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier));
|
||
break;
|
||
case 'loopComplete':
|
||
this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));
|
||
break;
|
||
case 'complete':
|
||
this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult));
|
||
break;
|
||
case 'segmentStart':
|
||
this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));
|
||
break;
|
||
case 'destroy':
|
||
this.triggerEvent(name, new BMDestroyEvent(name, this));
|
||
break;
|
||
default:
|
||
this.triggerEvent(name);
|
||
}
|
||
}
|
||
if (name === 'enterFrame' && this.onEnterFrame) {
|
||
this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult));
|
||
}
|
||
if (name === 'loopComplete' && this.onLoopComplete) {
|
||
this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));
|
||
}
|
||
if (name === 'complete' && this.onComplete) {
|
||
this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult));
|
||
}
|
||
if (name === 'segmentStart' && this.onSegmentStart) {
|
||
this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));
|
||
}
|
||
if (name === 'destroy' && this.onDestroy) {
|
||
this.onDestroy.call(this, new BMDestroyEvent(name, this));
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {
|
||
var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame);
|
||
this.triggerEvent('error', error);
|
||
|
||
if (this.onError) {
|
||
this.onError.call(this, error);
|
||
}
|
||
};
|
||
|
||
AnimationItem.prototype.triggerConfigError = function (nativeError) {
|
||
var error = new BMConfigErrorEvent(nativeError, this.currentFrame);
|
||
this.triggerEvent('error', error);
|
||
|
||
if (this.onError) {
|
||
this.onError.call(this, error);
|
||
}
|
||
};
|
||
|
||
/* global CompExpressionInterface, expressionsPlugin: writable */
|
||
/* exported expressionsPlugin */
|
||
|
||
var Expressions = (function () {
|
||
var ob = {};
|
||
ob.initExpressions = initExpressions;
|
||
|
||
function initExpressions(animation) {
|
||
var stackCount = 0;
|
||
var registers = [];
|
||
|
||
function pushExpression() {
|
||
stackCount += 1;
|
||
}
|
||
|
||
function popExpression() {
|
||
stackCount -= 1;
|
||
if (stackCount === 0) {
|
||
releaseInstances();
|
||
}
|
||
}
|
||
|
||
function registerExpressionProperty(expression) {
|
||
if (registers.indexOf(expression) === -1) {
|
||
registers.push(expression);
|
||
}
|
||
}
|
||
|
||
function releaseInstances() {
|
||
var i;
|
||
var len = registers.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
registers[i].release();
|
||
}
|
||
registers.length = 0;
|
||
}
|
||
|
||
animation.renderer.compInterface = CompExpressionInterface(animation.renderer);
|
||
animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);
|
||
animation.renderer.globalData.pushExpression = pushExpression;
|
||
animation.renderer.globalData.popExpression = popExpression;
|
||
animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;
|
||
}
|
||
return ob;
|
||
}());
|
||
|
||
expressionsPlugin = Expressions;
|
||
|
||
/* eslint-disable camelcase, no-unused-vars */
|
||
/* global BMMath, BezierFactory, createTypedArray, degToRads, shapePool */
|
||
|
||
var ExpressionManager = (function () {
|
||
'use strict';
|
||
|
||
var ob = {};
|
||
var Math = BMMath;
|
||
var window = null;
|
||
var document = null;
|
||
var XMLHttpRequest = null;
|
||
var fetch = null;
|
||
|
||
function $bm_isInstanceOfArray(arr) {
|
||
return arr.constructor === Array || arr.constructor === Float32Array;
|
||
}
|
||
|
||
function isNumerable(tOfV, v) {
|
||
return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number;
|
||
}
|
||
|
||
function $bm_neg(a) {
|
||
var tOfA = typeof a;
|
||
if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) {
|
||
return -a;
|
||
}
|
||
if ($bm_isInstanceOfArray(a)) {
|
||
var i;
|
||
var lenA = a.length;
|
||
var retArr = [];
|
||
for (i = 0; i < lenA; i += 1) {
|
||
retArr[i] = -a[i];
|
||
}
|
||
return retArr;
|
||
}
|
||
if (a.propType) {
|
||
return a.v;
|
||
}
|
||
return -a;
|
||
}
|
||
|
||
var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get;
|
||
var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get;
|
||
var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get;
|
||
|
||
function sum(a, b) {
|
||
var tOfA = typeof a;
|
||
var tOfB = typeof b;
|
||
if (tOfA === 'string' || tOfB === 'string') {
|
||
return a + b;
|
||
}
|
||
if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
|
||
return a + b;
|
||
}
|
||
if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
|
||
a = a.slice(0);
|
||
a[0] += b;
|
||
return a;
|
||
}
|
||
if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
|
||
b = b.slice(0);
|
||
b[0] = a + b[0];
|
||
return b;
|
||
}
|
||
if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {
|
||
var i = 0;
|
||
var lenA = a.length;
|
||
var lenB = b.length;
|
||
var retArr = [];
|
||
while (i < lenA || i < lenB) {
|
||
if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {
|
||
retArr[i] = a[i] + b[i];
|
||
} else {
|
||
retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return retArr;
|
||
}
|
||
return 0;
|
||
}
|
||
var add = sum;
|
||
|
||
function sub(a, b) {
|
||
var tOfA = typeof a;
|
||
var tOfB = typeof b;
|
||
if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
|
||
if (tOfA === 'string') {
|
||
a = parseInt(a, 10);
|
||
}
|
||
if (tOfB === 'string') {
|
||
b = parseInt(b, 10);
|
||
}
|
||
return a - b;
|
||
}
|
||
if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
|
||
a = a.slice(0);
|
||
a[0] -= b;
|
||
return a;
|
||
}
|
||
if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
|
||
b = b.slice(0);
|
||
b[0] = a - b[0];
|
||
return b;
|
||
}
|
||
if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {
|
||
var i = 0;
|
||
var lenA = a.length;
|
||
var lenB = b.length;
|
||
var retArr = [];
|
||
while (i < lenA || i < lenB) {
|
||
if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {
|
||
retArr[i] = a[i] - b[i];
|
||
} else {
|
||
retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return retArr;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
function mul(a, b) {
|
||
var tOfA = typeof a;
|
||
var tOfB = typeof b;
|
||
var arr;
|
||
if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
|
||
return a * b;
|
||
}
|
||
|
||
var i;
|
||
var len;
|
||
if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
|
||
len = a.length;
|
||
arr = createTypedArray('float32', len);
|
||
for (i = 0; i < len; i += 1) {
|
||
arr[i] = a[i] * b;
|
||
}
|
||
return arr;
|
||
}
|
||
if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
|
||
len = b.length;
|
||
arr = createTypedArray('float32', len);
|
||
for (i = 0; i < len; i += 1) {
|
||
arr[i] = a * b[i];
|
||
}
|
||
return arr;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
function div(a, b) {
|
||
var tOfA = typeof a;
|
||
var tOfB = typeof b;
|
||
var arr;
|
||
if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
|
||
return a / b;
|
||
}
|
||
var i;
|
||
var len;
|
||
if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
|
||
len = a.length;
|
||
arr = createTypedArray('float32', len);
|
||
for (i = 0; i < len; i += 1) {
|
||
arr[i] = a[i] / b;
|
||
}
|
||
return arr;
|
||
}
|
||
if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
|
||
len = b.length;
|
||
arr = createTypedArray('float32', len);
|
||
for (i = 0; i < len; i += 1) {
|
||
arr[i] = a / b[i];
|
||
}
|
||
return arr;
|
||
}
|
||
return 0;
|
||
}
|
||
function mod(a, b) {
|
||
if (typeof a === 'string') {
|
||
a = parseInt(a, 10);
|
||
}
|
||
if (typeof b === 'string') {
|
||
b = parseInt(b, 10);
|
||
}
|
||
return a % b;
|
||
}
|
||
var $bm_sum = sum;
|
||
var $bm_sub = sub;
|
||
var $bm_mul = mul;
|
||
var $bm_div = div;
|
||
var $bm_mod = mod;
|
||
|
||
function clamp(num, min, max) {
|
||
if (min > max) {
|
||
var mm = max;
|
||
max = min;
|
||
min = mm;
|
||
}
|
||
return Math.min(Math.max(num, min), max);
|
||
}
|
||
|
||
function radiansToDegrees(val) {
|
||
return val / degToRads;
|
||
}
|
||
var radians_to_degrees = radiansToDegrees;
|
||
|
||
function degreesToRadians(val) {
|
||
return val * degToRads;
|
||
}
|
||
var degrees_to_radians = radiansToDegrees;
|
||
|
||
var helperLengthArray = [0, 0, 0, 0, 0, 0];
|
||
|
||
function length(arr1, arr2) {
|
||
if (typeof arr1 === 'number' || arr1 instanceof Number) {
|
||
arr2 = arr2 || 0;
|
||
return Math.abs(arr1 - arr2);
|
||
}
|
||
if (!arr2) {
|
||
arr2 = helperLengthArray;
|
||
}
|
||
var i;
|
||
var len = Math.min(arr1.length, arr2.length);
|
||
var addedLength = 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
addedLength += Math.pow(arr2[i] - arr1[i], 2);
|
||
}
|
||
return Math.sqrt(addedLength);
|
||
}
|
||
|
||
function normalize(vec) {
|
||
return div(vec, length(vec));
|
||
}
|
||
|
||
function rgbToHsl(val) {
|
||
var r = val[0]; var g = val[1]; var b = val[2];
|
||
var max = Math.max(r, g, b);
|
||
var min = Math.min(r, g, b);
|
||
var h;
|
||
var s;
|
||
var l = (max + min) / 2;
|
||
|
||
if (max === min) {
|
||
h = 0; // achromatic
|
||
s = 0; // achromatic
|
||
} else {
|
||
var d = max - min;
|
||
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
||
switch (max) {
|
||
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
||
case g: h = (b - r) / d + 2; break;
|
||
case b: h = (r - g) / d + 4; break;
|
||
default: break;
|
||
}
|
||
h /= 6;
|
||
}
|
||
|
||
return [h, s, l, val[3]];
|
||
}
|
||
|
||
function hue2rgb(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;
|
||
}
|
||
|
||
function hslToRgb(val) {
|
||
var h = val[0];
|
||
var s = val[1];
|
||
var l = val[2];
|
||
|
||
var r;
|
||
var g;
|
||
var b;
|
||
|
||
if (s === 0) {
|
||
r = l; // achromatic
|
||
b = l; // achromatic
|
||
g = l; // achromatic
|
||
} else {
|
||
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
||
var p = 2 * l - q;
|
||
r = hue2rgb(p, q, h + 1 / 3);
|
||
g = hue2rgb(p, q, h);
|
||
b = hue2rgb(p, q, h - 1 / 3);
|
||
}
|
||
|
||
return [r, g, b, val[3]];
|
||
}
|
||
|
||
function linear(t, tMin, tMax, value1, value2) {
|
||
if (value1 === undefined || value2 === undefined) {
|
||
value1 = tMin;
|
||
value2 = tMax;
|
||
tMin = 0;
|
||
tMax = 1;
|
||
}
|
||
if (tMax < tMin) {
|
||
var _tMin = tMax;
|
||
tMax = tMin;
|
||
tMin = _tMin;
|
||
}
|
||
if (t <= tMin) {
|
||
return value1;
|
||
} if (t >= tMax) {
|
||
return value2;
|
||
}
|
||
var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin);
|
||
if (!value1.length) {
|
||
return value1 + (value2 - value1) * perc;
|
||
}
|
||
var i;
|
||
var len = value1.length;
|
||
var arr = createTypedArray('float32', len);
|
||
for (i = 0; i < len; i += 1) {
|
||
arr[i] = value1[i] + (value2[i] - value1[i]) * perc;
|
||
}
|
||
return arr;
|
||
}
|
||
function random(min, max) {
|
||
if (max === undefined) {
|
||
if (min === undefined) {
|
||
min = 0;
|
||
max = 1;
|
||
} else {
|
||
max = min;
|
||
min = undefined;
|
||
}
|
||
}
|
||
if (max.length) {
|
||
var i;
|
||
var len = max.length;
|
||
if (!min) {
|
||
min = createTypedArray('float32', len);
|
||
}
|
||
var arr = createTypedArray('float32', len);
|
||
var rnd = BMMath.random();
|
||
for (i = 0; i < len; i += 1) {
|
||
arr[i] = min[i] + rnd * (max[i] - min[i]);
|
||
}
|
||
return arr;
|
||
}
|
||
if (min === undefined) {
|
||
min = 0;
|
||
}
|
||
var rndm = BMMath.random();
|
||
return min + rndm * (max - min);
|
||
}
|
||
|
||
function createPath(points, inTangents, outTangents, closed) {
|
||
var i;
|
||
var len = points.length;
|
||
var path = shapePool.newElement();
|
||
path.setPathData(!!closed, len);
|
||
var arrPlaceholder = [0, 0];
|
||
var inVertexPoint;
|
||
var outVertexPoint;
|
||
for (i = 0; i < len; i += 1) {
|
||
inVertexPoint = (inTangents && inTangents[i]) ? inTangents[i] : arrPlaceholder;
|
||
outVertexPoint = (outTangents && outTangents[i]) ? outTangents[i] : arrPlaceholder;
|
||
path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true);
|
||
}
|
||
return path;
|
||
}
|
||
|
||
function initiateExpression(elem, data, property) {
|
||
var val = data.x;
|
||
var needsVelocity = /velocity(?![\w\d])/.test(val);
|
||
var _needsRandom = val.indexOf('random') !== -1;
|
||
var elemType = elem.data.ty;
|
||
var transform;
|
||
var $bm_transform;
|
||
var content;
|
||
var effect;
|
||
var thisProperty = property;
|
||
thisProperty.valueAtTime = thisProperty.getValueAtTime;
|
||
Object.defineProperty(thisProperty, 'value', {
|
||
get: function () {
|
||
return thisProperty.v;
|
||
},
|
||
});
|
||
elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate;
|
||
elem.comp.displayStartTime = 0;
|
||
var inPoint = elem.data.ip / elem.comp.globalData.frameRate;
|
||
var outPoint = elem.data.op / elem.comp.globalData.frameRate;
|
||
var width = elem.data.sw ? elem.data.sw : 0;
|
||
var height = elem.data.sh ? elem.data.sh : 0;
|
||
var name = elem.data.nm;
|
||
var loopIn;
|
||
var loop_in;
|
||
var loopOut;
|
||
var loop_out;
|
||
var smooth;
|
||
var toWorld;
|
||
var fromWorld;
|
||
var fromComp;
|
||
var toComp;
|
||
var fromCompToSurface;
|
||
var position;
|
||
var rotation;
|
||
var anchorPoint;
|
||
var scale;
|
||
var thisLayer;
|
||
var thisComp;
|
||
var mask;
|
||
var valueAtTime;
|
||
var velocityAtTime;
|
||
|
||
var scoped_bm_rt;
|
||
// val = val.replace(/(\\?"|')((http)(s)?(:\/))?\/.*?(\\?"|')/g, "\"\""); // deter potential network calls
|
||
var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0]; // eslint-disable-line no-eval
|
||
var numKeys = property.kf ? data.k.length : 0;
|
||
|
||
var active = !this.data || this.data.hd !== true;
|
||
|
||
var wiggle = function wiggle(freq, amp) {
|
||
var iWiggle;
|
||
var j;
|
||
var lenWiggle = this.pv.length ? this.pv.length : 1;
|
||
var addedAmps = createTypedArray('float32', lenWiggle);
|
||
freq = 5;
|
||
var iterations = Math.floor(time * freq);
|
||
iWiggle = 0;
|
||
j = 0;
|
||
while (iWiggle < iterations) {
|
||
// var rnd = BMMath.random();
|
||
for (j = 0; j < lenWiggle; j += 1) {
|
||
addedAmps[j] += -amp + amp * 2 * BMMath.random();
|
||
// addedAmps[j] += -amp + amp*2*rnd;
|
||
}
|
||
iWiggle += 1;
|
||
}
|
||
// var rnd2 = BMMath.random();
|
||
var periods = time * freq;
|
||
var perc = periods - Math.floor(periods);
|
||
var arr = createTypedArray('float32', lenWiggle);
|
||
if (lenWiggle > 1) {
|
||
for (j = 0; j < lenWiggle; j += 1) {
|
||
arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc;
|
||
// arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;
|
||
// arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);
|
||
}
|
||
return arr;
|
||
}
|
||
return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc;
|
||
}.bind(this);
|
||
|
||
if (thisProperty.loopIn) {
|
||
loopIn = thisProperty.loopIn.bind(thisProperty);
|
||
loop_in = loopIn;
|
||
}
|
||
|
||
if (thisProperty.loopOut) {
|
||
loopOut = thisProperty.loopOut.bind(thisProperty);
|
||
loop_out = loopOut;
|
||
}
|
||
|
||
if (thisProperty.smooth) {
|
||
smooth = thisProperty.smooth.bind(thisProperty);
|
||
}
|
||
|
||
function loopInDuration(type, duration) {
|
||
return loopIn(type, duration, true);
|
||
}
|
||
|
||
function loopOutDuration(type, duration) {
|
||
return loopOut(type, duration, true);
|
||
}
|
||
|
||
if (this.getValueAtTime) {
|
||
valueAtTime = this.getValueAtTime.bind(this);
|
||
}
|
||
|
||
if (this.getVelocityAtTime) {
|
||
velocityAtTime = this.getVelocityAtTime.bind(this);
|
||
}
|
||
|
||
var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);
|
||
|
||
function lookAt(elem1, elem2) {
|
||
var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]];
|
||
var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads;
|
||
var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads;
|
||
return [yaw, pitch, 0];
|
||
}
|
||
|
||
function easeOut(t, tMin, tMax, val1, val2) {
|
||
return applyEase(easeOutBez, t, tMin, tMax, val1, val2);
|
||
}
|
||
|
||
function easeIn(t, tMin, tMax, val1, val2) {
|
||
return applyEase(easeInBez, t, tMin, tMax, val1, val2);
|
||
}
|
||
|
||
function ease(t, tMin, tMax, val1, val2) {
|
||
return applyEase(easeInOutBez, t, tMin, tMax, val1, val2);
|
||
}
|
||
|
||
function applyEase(fn, t, tMin, tMax, val1, val2) {
|
||
if (val1 === undefined) {
|
||
val1 = tMin;
|
||
val2 = tMax;
|
||
} else {
|
||
t = (t - tMin) / (tMax - tMin);
|
||
}
|
||
if (t > 1) {
|
||
t = 1;
|
||
} else if (t < 0) {
|
||
t = 0;
|
||
}
|
||
var mult = fn(t);
|
||
if ($bm_isInstanceOfArray(val1)) {
|
||
var iKey;
|
||
var lenKey = val1.length;
|
||
var arr = createTypedArray('float32', lenKey);
|
||
for (iKey = 0; iKey < lenKey; iKey += 1) {
|
||
arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey];
|
||
}
|
||
return arr;
|
||
}
|
||
return (val2 - val1) * mult + val1;
|
||
}
|
||
|
||
function nearestKey(time) {
|
||
var iKey;
|
||
var lenKey = data.k.length;
|
||
var index;
|
||
var keyTime;
|
||
if (!data.k.length || typeof (data.k[0]) === 'number') {
|
||
index = 0;
|
||
keyTime = 0;
|
||
} else {
|
||
index = -1;
|
||
time *= elem.comp.globalData.frameRate;
|
||
if (time < data.k[0].t) {
|
||
index = 1;
|
||
keyTime = data.k[0].t;
|
||
} else {
|
||
for (iKey = 0; iKey < lenKey - 1; iKey += 1) {
|
||
if (time === data.k[iKey].t) {
|
||
index = iKey + 1;
|
||
keyTime = data.k[iKey].t;
|
||
break;
|
||
} else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) {
|
||
if (time - data.k[iKey].t > data.k[iKey + 1].t - time) {
|
||
index = iKey + 2;
|
||
keyTime = data.k[iKey + 1].t;
|
||
} else {
|
||
index = iKey + 1;
|
||
keyTime = data.k[iKey].t;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if (index === -1) {
|
||
index = iKey + 1;
|
||
keyTime = data.k[iKey].t;
|
||
}
|
||
}
|
||
}
|
||
var obKey = {};
|
||
obKey.index = index;
|
||
obKey.time = keyTime / elem.comp.globalData.frameRate;
|
||
return obKey;
|
||
}
|
||
|
||
function key(ind) {
|
||
var obKey;
|
||
var iKey;
|
||
var lenKey;
|
||
if (!data.k.length || typeof (data.k[0]) === 'number') {
|
||
throw new Error('The property has no keyframe at index ' + ind);
|
||
}
|
||
ind -= 1;
|
||
obKey = {
|
||
time: data.k[ind].t / elem.comp.globalData.frameRate,
|
||
value: [],
|
||
};
|
||
var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e;
|
||
|
||
lenKey = arr.length;
|
||
for (iKey = 0; iKey < lenKey; iKey += 1) {
|
||
obKey[iKey] = arr[iKey];
|
||
obKey.value[iKey] = arr[iKey];
|
||
}
|
||
return obKey;
|
||
}
|
||
|
||
function framesToTime(frames, fps) {
|
||
if (!fps) {
|
||
fps = elem.comp.globalData.frameRate;
|
||
}
|
||
return frames / fps;
|
||
}
|
||
|
||
function timeToFrames(t, fps) {
|
||
if (!t && t !== 0) {
|
||
t = time;
|
||
}
|
||
if (!fps) {
|
||
fps = elem.comp.globalData.frameRate;
|
||
}
|
||
return t * fps;
|
||
}
|
||
|
||
function seedRandom(seed) {
|
||
BMMath.seedrandom(randSeed + seed);
|
||
}
|
||
|
||
function sourceRectAtTime() {
|
||
return elem.sourceRectAtTime();
|
||
}
|
||
|
||
function substring(init, end) {
|
||
if (typeof value === 'string') {
|
||
if (end === undefined) {
|
||
return value.substring(init);
|
||
}
|
||
return value.substring(init, end);
|
||
}
|
||
return '';
|
||
}
|
||
|
||
function substr(init, end) {
|
||
if (typeof value === 'string') {
|
||
if (end === undefined) {
|
||
return value.substr(init);
|
||
}
|
||
return value.substr(init, end);
|
||
}
|
||
return '';
|
||
}
|
||
|
||
function posterizeTime(framesPerSecond) {
|
||
time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond;
|
||
value = valueAtTime(time);
|
||
}
|
||
|
||
var time;
|
||
var velocity;
|
||
var value;
|
||
var text;
|
||
var textIndex;
|
||
var textTotal;
|
||
var selectorValue;
|
||
var index = elem.data.ind;
|
||
var hasParent = !!(elem.hierarchy && elem.hierarchy.length);
|
||
var parent;
|
||
var randSeed = Math.floor(Math.random() * 1000000);
|
||
var globalData = elem.globalData;
|
||
function executeExpression(_value) {
|
||
// globalData.pushExpression();
|
||
value = _value;
|
||
if (_needsRandom) {
|
||
seedRandom(randSeed);
|
||
}
|
||
if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {
|
||
return value;
|
||
}
|
||
if (this.propType === 'textSelector') {
|
||
textIndex = this.textIndex;
|
||
textTotal = this.textTotal;
|
||
selectorValue = this.selectorValue;
|
||
}
|
||
if (!thisLayer) {
|
||
text = elem.layerInterface.text;
|
||
thisLayer = elem.layerInterface;
|
||
thisComp = elem.comp.compInterface;
|
||
toWorld = thisLayer.toWorld.bind(thisLayer);
|
||
fromWorld = thisLayer.fromWorld.bind(thisLayer);
|
||
fromComp = thisLayer.fromComp.bind(thisLayer);
|
||
toComp = thisLayer.toComp.bind(thisLayer);
|
||
mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;
|
||
fromCompToSurface = fromComp;
|
||
}
|
||
if (!transform) {
|
||
transform = elem.layerInterface('ADBE Transform Group');
|
||
$bm_transform = transform;
|
||
if (transform) {
|
||
anchorPoint = transform.anchorPoint;
|
||
/* position = transform.position;
|
||
rotation = transform.rotation;
|
||
scale = transform.scale; */
|
||
}
|
||
}
|
||
|
||
if (elemType === 4 && !content) {
|
||
content = thisLayer('ADBE Root Vectors Group');
|
||
}
|
||
if (!effect) {
|
||
effect = thisLayer(4);
|
||
}
|
||
hasParent = !!(elem.hierarchy && elem.hierarchy.length);
|
||
if (hasParent && !parent) {
|
||
parent = elem.hierarchy[0].layerInterface;
|
||
}
|
||
time = this.comp.renderedFrame / this.comp.globalData.frameRate;
|
||
if (needsVelocity) {
|
||
velocity = velocityAtTime(time);
|
||
}
|
||
expression_function();
|
||
this.frameExpressionId = elem.globalData.frameId;
|
||
|
||
// TODO: Check if it's possible to return on ShapeInterface the .v value
|
||
if (scoped_bm_rt.propType === 'shape') {
|
||
scoped_bm_rt = scoped_bm_rt.v;
|
||
}
|
||
// globalData.popExpression();
|
||
return scoped_bm_rt;
|
||
}
|
||
return executeExpression;
|
||
}
|
||
|
||
ob.initiateExpression = initiateExpression;
|
||
return ob;
|
||
}());
|
||
|
||
/* global ExpressionManager, createTypedArray */
|
||
/* exported expressionHelpers */
|
||
|
||
var expressionHelpers = (function () {
|
||
function searchExpressions(elem, data, prop) {
|
||
if (data.x) {
|
||
prop.k = true;
|
||
prop.x = true;
|
||
prop.initiateExpression = ExpressionManager.initiateExpression;
|
||
prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop));
|
||
}
|
||
}
|
||
|
||
function getValueAtTime(frameNum) {
|
||
frameNum *= this.elem.globalData.frameRate;
|
||
frameNum -= this.offsetTime;
|
||
if (frameNum !== this._cachingAtTime.lastFrame) {
|
||
this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;
|
||
this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);
|
||
this._cachingAtTime.lastFrame = frameNum;
|
||
}
|
||
return this._cachingAtTime.value;
|
||
}
|
||
|
||
function getSpeedAtTime(frameNum) {
|
||
var delta = -0.01;
|
||
var v1 = this.getValueAtTime(frameNum);
|
||
var v2 = this.getValueAtTime(frameNum + delta);
|
||
var speed = 0;
|
||
if (v1.length) {
|
||
var i;
|
||
for (i = 0; i < v1.length; i += 1) {
|
||
speed += Math.pow(v2[i] - v1[i], 2);
|
||
}
|
||
speed = Math.sqrt(speed) * 100;
|
||
} else {
|
||
speed = 0;
|
||
}
|
||
return speed;
|
||
}
|
||
|
||
function getVelocityAtTime(frameNum) {
|
||
if (this.vel !== undefined) {
|
||
return this.vel;
|
||
}
|
||
var delta = -0.001;
|
||
// frameNum += this.elem.data.st;
|
||
var v1 = this.getValueAtTime(frameNum);
|
||
var v2 = this.getValueAtTime(frameNum + delta);
|
||
var velocity;
|
||
if (v1.length) {
|
||
velocity = createTypedArray('float32', v1.length);
|
||
var i;
|
||
for (i = 0; i < v1.length; i += 1) {
|
||
// removing frameRate
|
||
// if needed, don't add it here
|
||
// velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);
|
||
velocity[i] = (v2[i] - v1[i]) / delta;
|
||
}
|
||
} else {
|
||
velocity = (v2 - v1) / delta;
|
||
}
|
||
return velocity;
|
||
}
|
||
|
||
function getStaticValueAtTime() {
|
||
return this.pv;
|
||
}
|
||
|
||
function setGroupProperty(propertyGroup) {
|
||
this.propertyGroup = propertyGroup;
|
||
}
|
||
|
||
return {
|
||
searchExpressions: searchExpressions,
|
||
getSpeedAtTime: getSpeedAtTime,
|
||
getVelocityAtTime: getVelocityAtTime,
|
||
getValueAtTime: getValueAtTime,
|
||
getStaticValueAtTime: getStaticValueAtTime,
|
||
setGroupProperty: setGroupProperty,
|
||
};
|
||
}());
|
||
|
||
/* global createTypedArray, Matrix, TransformPropertyFactory, expressionHelpers, PropertyFactory, expressionHelpers,
|
||
initialDefaultFrame, shapePool, ShapePropertyFactory, bez, extendPrototype, ExpressionManager, createSizedArray */
|
||
|
||
(function addPropertyDecorator() {
|
||
function loopOut(type, duration, durationFlag) {
|
||
if (!this.k || !this.keyframes) {
|
||
return this.pv;
|
||
}
|
||
type = type ? type.toLowerCase() : '';
|
||
var currentFrame = this.comp.renderedFrame;
|
||
var keyframes = this.keyframes;
|
||
var lastKeyFrame = keyframes[keyframes.length - 1].t;
|
||
if (currentFrame <= lastKeyFrame) {
|
||
return this.pv;
|
||
}
|
||
var cycleDuration;
|
||
var firstKeyFrame;
|
||
if (!durationFlag) {
|
||
if (!duration || duration > keyframes.length - 1) {
|
||
duration = keyframes.length - 1;
|
||
}
|
||
firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;
|
||
cycleDuration = lastKeyFrame - firstKeyFrame;
|
||
} else {
|
||
if (!duration) {
|
||
cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip);
|
||
} else {
|
||
cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration);
|
||
}
|
||
firstKeyFrame = lastKeyFrame - cycleDuration;
|
||
}
|
||
var i;
|
||
var len;
|
||
var ret;
|
||
if (type === 'pingpong') {
|
||
var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);
|
||
if (iterations % 2 !== 0) {
|
||
return this.getValueAtTime(((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line
|
||
}
|
||
} else if (type === 'offset') {
|
||
var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
|
||
var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
|
||
var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line
|
||
var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);
|
||
if (this.pv.length) {
|
||
ret = new Array(initV.length);
|
||
len = ret.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
ret[i] = (endV[i] - initV[i]) * repeats + current[i];
|
||
}
|
||
return ret;
|
||
}
|
||
return (endV - initV) * repeats + current;
|
||
} else if (type === 'continue') {
|
||
var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
|
||
var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);
|
||
if (this.pv.length) {
|
||
ret = new Array(lastValue.length);
|
||
len = ret.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005; // eslint-disable-line
|
||
}
|
||
return ret;
|
||
}
|
||
return lastValue + (lastValue - nextLastValue) * (((currentFrame - lastKeyFrame)) / 0.001);
|
||
}
|
||
return this.getValueAtTime((((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line
|
||
|
||
}
|
||
|
||
function loopIn(type, duration, durationFlag) {
|
||
if (!this.k) {
|
||
return this.pv;
|
||
}
|
||
type = type ? type.toLowerCase() : '';
|
||
var currentFrame = this.comp.renderedFrame;
|
||
var keyframes = this.keyframes;
|
||
var firstKeyFrame = keyframes[0].t;
|
||
if (currentFrame >= firstKeyFrame) {
|
||
return this.pv;
|
||
}
|
||
var cycleDuration;
|
||
var lastKeyFrame;
|
||
if (!durationFlag) {
|
||
if (!duration || duration > keyframes.length - 1) {
|
||
duration = keyframes.length - 1;
|
||
}
|
||
lastKeyFrame = keyframes[duration].t;
|
||
cycleDuration = lastKeyFrame - firstKeyFrame;
|
||
} else {
|
||
if (!duration) {
|
||
cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame);
|
||
} else {
|
||
cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration);
|
||
}
|
||
lastKeyFrame = firstKeyFrame + cycleDuration;
|
||
}
|
||
var i;
|
||
var len;
|
||
var ret;
|
||
if (type === 'pingpong') {
|
||
var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration);
|
||
if (iterations % 2 === 0) {
|
||
return this.getValueAtTime((((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line
|
||
}
|
||
} else if (type === 'offset') {
|
||
var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
|
||
var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
|
||
var current = this.getValueAtTime((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate, 0);
|
||
var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1;
|
||
if (this.pv.length) {
|
||
ret = new Array(initV.length);
|
||
len = ret.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
ret[i] = current[i] - (endV[i] - initV[i]) * repeats;
|
||
}
|
||
return ret;
|
||
}
|
||
return current - (endV - initV) * repeats;
|
||
} else if (type === 'continue') {
|
||
var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
|
||
var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);
|
||
if (this.pv.length) {
|
||
ret = new Array(firstValue.length);
|
||
len = ret.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
ret[i] = firstValue[i] + ((firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame)) / 0.001;
|
||
}
|
||
return ret;
|
||
}
|
||
return firstValue + ((firstValue - nextFirstValue) * (firstKeyFrame - currentFrame)) / 0.001;
|
||
}
|
||
return this.getValueAtTime(((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame))) / this.comp.globalData.frameRate, 0); // eslint-disable-line
|
||
|
||
}
|
||
|
||
function smooth(width, samples) {
|
||
if (!this.k) {
|
||
return this.pv;
|
||
}
|
||
width = (width || 0.4) * 0.5;
|
||
samples = Math.floor(samples || 5);
|
||
if (samples <= 1) {
|
||
return this.pv;
|
||
}
|
||
var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;
|
||
var initFrame = currentTime - width;
|
||
var endFrame = currentTime + width;
|
||
var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;
|
||
var i = 0;
|
||
var j = 0;
|
||
var value;
|
||
if (this.pv.length) {
|
||
value = createTypedArray('float32', this.pv.length);
|
||
} else {
|
||
value = 0;
|
||
}
|
||
var sampleValue;
|
||
while (i < samples) {
|
||
sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);
|
||
if (this.pv.length) {
|
||
for (j = 0; j < this.pv.length; j += 1) {
|
||
value[j] += sampleValue[j];
|
||
}
|
||
} else {
|
||
value += sampleValue;
|
||
}
|
||
i += 1;
|
||
}
|
||
if (this.pv.length) {
|
||
for (j = 0; j < this.pv.length; j += 1) {
|
||
value[j] /= samples;
|
||
}
|
||
} else {
|
||
value /= samples;
|
||
}
|
||
return value;
|
||
}
|
||
|
||
function getTransformValueAtTime(time) {
|
||
if (!this._transformCachingAtTime) {
|
||
this._transformCachingAtTime = {
|
||
v: new Matrix(),
|
||
};
|
||
}
|
||
/// /
|
||
var matrix = this._transformCachingAtTime.v;
|
||
matrix.cloneFromProps(this.pre.props);
|
||
if (this.appliedTransformations < 1) {
|
||
var anchor = this.a.getValueAtTime(time);
|
||
matrix.translate(
|
||
-anchor[0] * this.a.mult,
|
||
-anchor[1] * this.a.mult,
|
||
anchor[2] * this.a.mult
|
||
);
|
||
}
|
||
if (this.appliedTransformations < 2) {
|
||
var scale = this.s.getValueAtTime(time);
|
||
matrix.scale(
|
||
scale[0] * this.s.mult,
|
||
scale[1] * this.s.mult,
|
||
scale[2] * this.s.mult
|
||
);
|
||
}
|
||
if (this.sk && this.appliedTransformations < 3) {
|
||
var skew = this.sk.getValueAtTime(time);
|
||
var skewAxis = this.sa.getValueAtTime(time);
|
||
matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult);
|
||
}
|
||
if (this.r && this.appliedTransformations < 4) {
|
||
var rotation = this.r.getValueAtTime(time);
|
||
matrix.rotate(-rotation * this.r.mult);
|
||
} else if (!this.r && this.appliedTransformations < 4) {
|
||
var rotationZ = this.rz.getValueAtTime(time);
|
||
var rotationY = this.ry.getValueAtTime(time);
|
||
var rotationX = this.rx.getValueAtTime(time);
|
||
var orientation = this.or.getValueAtTime(time);
|
||
matrix.rotateZ(-rotationZ * this.rz.mult)
|
||
.rotateY(rotationY * this.ry.mult)
|
||
.rotateX(rotationX * this.rx.mult)
|
||
.rotateZ(-orientation[2] * this.or.mult)
|
||
.rotateY(orientation[1] * this.or.mult)
|
||
.rotateX(orientation[0] * this.or.mult);
|
||
}
|
||
if (this.data.p && this.data.p.s) {
|
||
var positionX = this.px.getValueAtTime(time);
|
||
var positionY = this.py.getValueAtTime(time);
|
||
if (this.data.p.z) {
|
||
var positionZ = this.pz.getValueAtTime(time);
|
||
matrix.translate(
|
||
positionX * this.px.mult,
|
||
positionY * this.py.mult,
|
||
-positionZ * this.pz.mult
|
||
);
|
||
} else {
|
||
matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0);
|
||
}
|
||
} else {
|
||
var position = this.p.getValueAtTime(time);
|
||
matrix.translate(
|
||
position[0] * this.p.mult,
|
||
position[1] * this.p.mult,
|
||
-position[2] * this.p.mult
|
||
);
|
||
}
|
||
return matrix;
|
||
/// /
|
||
}
|
||
|
||
function getTransformStaticValueAtTime() {
|
||
return this.v.clone(new Matrix());
|
||
}
|
||
|
||
var getTransformProperty = TransformPropertyFactory.getTransformProperty;
|
||
TransformPropertyFactory.getTransformProperty = function (elem, data, container) {
|
||
var prop = getTransformProperty(elem, data, container);
|
||
if (prop.dynamicProperties.length) {
|
||
prop.getValueAtTime = getTransformValueAtTime.bind(prop);
|
||
} else {
|
||
prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);
|
||
}
|
||
prop.setGroupProperty = expressionHelpers.setGroupProperty;
|
||
return prop;
|
||
};
|
||
|
||
var propertyGetProp = PropertyFactory.getProp;
|
||
PropertyFactory.getProp = function (elem, data, type, mult, container) {
|
||
var prop = propertyGetProp(elem, data, type, mult, container);
|
||
// prop.getVelocityAtTime = getVelocityAtTime;
|
||
// prop.loopOut = loopOut;
|
||
// prop.loopIn = loopIn;
|
||
if (prop.kf) {
|
||
prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);
|
||
} else {
|
||
prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);
|
||
}
|
||
prop.setGroupProperty = expressionHelpers.setGroupProperty;
|
||
prop.loopOut = loopOut;
|
||
prop.loopIn = loopIn;
|
||
prop.smooth = smooth;
|
||
prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);
|
||
prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);
|
||
prop.numKeys = data.a === 1 ? data.k.length : 0;
|
||
prop.propertyIndex = data.ix;
|
||
var value = 0;
|
||
if (type !== 0) {
|
||
value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);
|
||
}
|
||
prop._cachingAtTime = {
|
||
lastFrame: initialDefaultFrame,
|
||
lastIndex: 0,
|
||
value: value,
|
||
};
|
||
expressionHelpers.searchExpressions(elem, data, prop);
|
||
if (prop.k) {
|
||
container.addDynamicProperty(prop);
|
||
}
|
||
|
||
return prop;
|
||
};
|
||
|
||
function getShapeValueAtTime(frameNum) {
|
||
// For now this caching object is created only when needed instead of creating it when the shape is initialized.
|
||
if (!this._cachingAtTime) {
|
||
this._cachingAtTime = {
|
||
shapeValue: shapePool.clone(this.pv),
|
||
lastIndex: 0,
|
||
lastTime: initialDefaultFrame,
|
||
};
|
||
}
|
||
|
||
frameNum *= this.elem.globalData.frameRate;
|
||
frameNum -= this.offsetTime;
|
||
if (frameNum !== this._cachingAtTime.lastTime) {
|
||
this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;
|
||
this._cachingAtTime.lastTime = frameNum;
|
||
this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);
|
||
}
|
||
return this._cachingAtTime.shapeValue;
|
||
}
|
||
|
||
var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();
|
||
var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();
|
||
|
||
function ShapeExpressions() {}
|
||
ShapeExpressions.prototype = {
|
||
vertices: function (prop, time) {
|
||
if (this.k) {
|
||
this.getValue();
|
||
}
|
||
var shapePath = this.v;
|
||
if (time !== undefined) {
|
||
shapePath = this.getValueAtTime(time, 0);
|
||
}
|
||
var i;
|
||
var len = shapePath._length;
|
||
var vertices = shapePath[prop];
|
||
var points = shapePath.v;
|
||
var arr = createSizedArray(len);
|
||
for (i = 0; i < len; i += 1) {
|
||
if (prop === 'i' || prop === 'o') {
|
||
arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];
|
||
} else {
|
||
arr[i] = [vertices[i][0], vertices[i][1]];
|
||
}
|
||
}
|
||
return arr;
|
||
},
|
||
points: function (time) {
|
||
return this.vertices('v', time);
|
||
},
|
||
inTangents: function (time) {
|
||
return this.vertices('i', time);
|
||
},
|
||
outTangents: function (time) {
|
||
return this.vertices('o', time);
|
||
},
|
||
isClosed: function () {
|
||
return this.v.c;
|
||
},
|
||
pointOnPath: function (perc, time) {
|
||
var shapePath = this.v;
|
||
if (time !== undefined) {
|
||
shapePath = this.getValueAtTime(time, 0);
|
||
}
|
||
if (!this._segmentsLength) {
|
||
this._segmentsLength = bez.getSegmentsLength(shapePath);
|
||
}
|
||
|
||
var segmentsLength = this._segmentsLength;
|
||
var lengths = segmentsLength.lengths;
|
||
var lengthPos = segmentsLength.totalLength * perc;
|
||
var i = 0;
|
||
var len = lengths.length;
|
||
var accumulatedLength = 0;
|
||
var pt;
|
||
while (i < len) {
|
||
if (accumulatedLength + lengths[i].addedLength > lengthPos) {
|
||
var initIndex = i;
|
||
var endIndex = (shapePath.c && i === len - 1) ? 0 : i + 1;
|
||
var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength;
|
||
pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);
|
||
break;
|
||
} else {
|
||
accumulatedLength += lengths[i].addedLength;
|
||
}
|
||
i += 1;
|
||
}
|
||
if (!pt) {
|
||
pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]];
|
||
}
|
||
return pt;
|
||
},
|
||
vectorOnPath: function (perc, time, vectorType) {
|
||
// perc doesn't use triple equality because it can be a Number object as well as a primitive.
|
||
if (perc == 1) { // eslint-disable-line eqeqeq
|
||
perc = this.v.c;
|
||
} else if (perc == 0) { // eslint-disable-line eqeqeq
|
||
perc = 0.999;
|
||
}
|
||
var pt1 = this.pointOnPath(perc, time);
|
||
var pt2 = this.pointOnPath(perc + 0.001, time);
|
||
var xLength = pt2[0] - pt1[0];
|
||
var yLength = pt2[1] - pt1[1];
|
||
var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2));
|
||
if (magnitude === 0) {
|
||
return [0, 0];
|
||
}
|
||
var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude];
|
||
return unitVector;
|
||
},
|
||
tangentOnPath: function (perc, time) {
|
||
return this.vectorOnPath(perc, time, 'tangent');
|
||
},
|
||
normalOnPath: function (perc, time) {
|
||
return this.vectorOnPath(perc, time, 'normal');
|
||
},
|
||
setGroupProperty: expressionHelpers.setGroupProperty,
|
||
getValueAtTime: expressionHelpers.getStaticValueAtTime,
|
||
};
|
||
extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);
|
||
extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);
|
||
KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;
|
||
KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;
|
||
|
||
var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;
|
||
ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {
|
||
var prop = propertyGetShapeProp(elem, data, type, arr, trims);
|
||
prop.propertyIndex = data.ix;
|
||
prop.lock = false;
|
||
if (type === 3) {
|
||
expressionHelpers.searchExpressions(elem, data.pt, prop);
|
||
} else if (type === 4) {
|
||
expressionHelpers.searchExpressions(elem, data.ks, prop);
|
||
}
|
||
if (prop.k) {
|
||
elem.addDynamicProperty(prop);
|
||
}
|
||
return prop;
|
||
};
|
||
}());
|
||
|
||
/* global ExpressionManager, TextProperty */
|
||
|
||
(function addDecorator() {
|
||
function searchExpressions() {
|
||
if (this.data.d.x) {
|
||
this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this);
|
||
this.addEffect(this.getExpressionValue.bind(this));
|
||
return true;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
TextProperty.prototype.getExpressionValue = function (currentValue, text) {
|
||
var newValue = this.calculateExpression(text);
|
||
if (currentValue.t !== newValue) {
|
||
var newData = {};
|
||
this.copyData(newData, currentValue);
|
||
newData.t = newValue.toString();
|
||
newData.__complete = false;
|
||
return newData;
|
||
}
|
||
return currentValue;
|
||
};
|
||
|
||
TextProperty.prototype.searchProperty = function () {
|
||
var isKeyframed = this.searchKeyframes();
|
||
var hasExpressions = this.searchExpressions();
|
||
this.kf = isKeyframed || hasExpressions;
|
||
return this.kf;
|
||
};
|
||
|
||
TextProperty.prototype.searchExpressions = searchExpressions;
|
||
}());
|
||
|
||
/* global propertyGroupFactory, PropertyInterface */
|
||
/* exported ShapePathInterface */
|
||
|
||
var ShapePathInterface = (
|
||
|
||
function () {
|
||
return function pathInterfaceFactory(shape, view, propertyGroup) {
|
||
var prop = view.sh;
|
||
|
||
function interfaceFunction(val) {
|
||
if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) {
|
||
return interfaceFunction.path;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
prop.setGroupProperty(PropertyInterface('Path', _propertyGroup));
|
||
Object.defineProperties(interfaceFunction, {
|
||
path: {
|
||
get: function () {
|
||
if (prop.k) {
|
||
prop.getValue();
|
||
}
|
||
return prop;
|
||
},
|
||
},
|
||
shape: {
|
||
get: function () {
|
||
if (prop.k) {
|
||
prop.getValue();
|
||
}
|
||
return prop;
|
||
},
|
||
},
|
||
_name: { value: shape.nm },
|
||
ix: { value: shape.ix },
|
||
propertyIndex: { value: shape.ix },
|
||
mn: { value: shape.mn },
|
||
propertyGroup: { value: propertyGroup },
|
||
});
|
||
return interfaceFunction;
|
||
};
|
||
}()
|
||
);
|
||
|
||
/* exported propertyGroupFactory */
|
||
|
||
var propertyGroupFactory = (function () {
|
||
return function (interfaceFunction, parentPropertyGroup) {
|
||
return function (val) {
|
||
val = val === undefined ? 1 : val;
|
||
if (val <= 0) {
|
||
return interfaceFunction;
|
||
}
|
||
return parentPropertyGroup(val - 1);
|
||
};
|
||
};
|
||
}());
|
||
|
||
/* exported PropertyInterface */
|
||
|
||
var PropertyInterface = (function () {
|
||
return function (propertyName, propertyGroup) {
|
||
var interfaceFunction = {
|
||
_name: propertyName,
|
||
};
|
||
|
||
function _propertyGroup(val) {
|
||
val = val === undefined ? 1 : val;
|
||
if (val <= 0) {
|
||
return interfaceFunction;
|
||
}
|
||
return propertyGroup(val - 1);
|
||
}
|
||
|
||
return _propertyGroup;
|
||
};
|
||
}());
|
||
|
||
/* global ExpressionPropertyInterface, PropertyInterface, propertyGroupFactory, ShapePathInterface */
|
||
/* exported ShapeExpressionInterface */
|
||
|
||
var ShapeExpressionInterface = (function () {
|
||
function iterateElements(shapes, view, propertyGroup) {
|
||
var arr = [];
|
||
var i;
|
||
var len = shapes ? shapes.length : 0;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (shapes[i].ty === 'gr') {
|
||
arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'fl') {
|
||
arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'st') {
|
||
arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'tm') {
|
||
arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'tr') {
|
||
// arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));
|
||
} else if (shapes[i].ty === 'el') {
|
||
arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'sr') {
|
||
arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'sh') {
|
||
arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'rc') {
|
||
arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'rd') {
|
||
arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'rp') {
|
||
arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else if (shapes[i].ty === 'gf') {
|
||
arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
} else {
|
||
arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup));
|
||
}
|
||
}
|
||
return arr;
|
||
}
|
||
|
||
function contentsInterfaceFactory(shape, view, propertyGroup) {
|
||
var interfaces;
|
||
var interfaceFunction = function _interfaceFunction(value) {
|
||
var i = 0;
|
||
var len = interfaces.length;
|
||
while (i < len) {
|
||
if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) {
|
||
return interfaces[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
if (typeof value === 'number') {
|
||
return interfaces[value - 1];
|
||
}
|
||
return null;
|
||
};
|
||
|
||
interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);
|
||
interfaceFunction.numProperties = interfaces.length;
|
||
var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);
|
||
interfaceFunction.transform = transformInterface;
|
||
interfaceFunction.propertyIndex = shape.cix;
|
||
interfaceFunction._name = shape.nm;
|
||
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function groupInterfaceFactory(shape, view, propertyGroup) {
|
||
var interfaceFunction = function _interfaceFunction(value) {
|
||
switch (value) {
|
||
case 'ADBE Vectors Group':
|
||
case 'Contents':
|
||
case 2:
|
||
return interfaceFunction.content;
|
||
// Not necessary for now. Keeping them here in case a new case appears
|
||
// case 'ADBE Vector Transform Group':
|
||
// case 3:
|
||
default:
|
||
return interfaceFunction.transform;
|
||
}
|
||
};
|
||
interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup);
|
||
var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);
|
||
interfaceFunction.content = content;
|
||
interfaceFunction.transform = transformInterface;
|
||
Object.defineProperty(interfaceFunction, '_name', {
|
||
get: function () {
|
||
return shape.nm;
|
||
},
|
||
});
|
||
// interfaceFunction.content = interfaceFunction;
|
||
interfaceFunction.numProperties = shape.np;
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
interfaceFunction.nm = shape.nm;
|
||
interfaceFunction.mn = shape.mn;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function fillInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(val) {
|
||
if (val === 'Color' || val === 'color') {
|
||
return interfaceFunction.color;
|
||
} if (val === 'Opacity' || val === 'opacity') {
|
||
return interfaceFunction.opacity;
|
||
}
|
||
return null;
|
||
}
|
||
Object.defineProperties(interfaceFunction, {
|
||
color: {
|
||
get: ExpressionPropertyInterface(view.c),
|
||
},
|
||
opacity: {
|
||
get: ExpressionPropertyInterface(view.o),
|
||
},
|
||
_name: { value: shape.nm },
|
||
mn: { value: shape.mn },
|
||
});
|
||
|
||
view.c.setGroupProperty(PropertyInterface('Color', propertyGroup));
|
||
view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function gradientFillInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(val) {
|
||
if (val === 'Start Point' || val === 'start point') {
|
||
return interfaceFunction.startPoint;
|
||
}
|
||
if (val === 'End Point' || val === 'end point') {
|
||
return interfaceFunction.endPoint;
|
||
}
|
||
if (val === 'Opacity' || val === 'opacity') {
|
||
return interfaceFunction.opacity;
|
||
}
|
||
return null;
|
||
}
|
||
Object.defineProperties(interfaceFunction, {
|
||
startPoint: {
|
||
get: ExpressionPropertyInterface(view.s),
|
||
},
|
||
endPoint: {
|
||
get: ExpressionPropertyInterface(view.e),
|
||
},
|
||
opacity: {
|
||
get: ExpressionPropertyInterface(view.o),
|
||
},
|
||
type: {
|
||
get: function () {
|
||
return 'a';
|
||
},
|
||
},
|
||
_name: { value: shape.nm },
|
||
mn: { value: shape.mn },
|
||
});
|
||
|
||
view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup));
|
||
view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup));
|
||
view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));
|
||
return interfaceFunction;
|
||
}
|
||
function defaultInterfaceFactory() {
|
||
function interfaceFunction() {
|
||
return null;
|
||
}
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function strokeInterfaceFactory(shape, view, propertyGroup) {
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup);
|
||
function addPropertyToDashOb(i) {
|
||
Object.defineProperty(dashOb, shape.d[i].nm, {
|
||
get: ExpressionPropertyInterface(view.d.dataProps[i].p),
|
||
});
|
||
}
|
||
var i;
|
||
var len = shape.d ? shape.d.length : 0;
|
||
var dashOb = {};
|
||
for (i = 0; i < len; i += 1) {
|
||
addPropertyToDashOb(i);
|
||
view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);
|
||
}
|
||
|
||
function interfaceFunction(val) {
|
||
if (val === 'Color' || val === 'color') {
|
||
return interfaceFunction.color;
|
||
} if (val === 'Opacity' || val === 'opacity') {
|
||
return interfaceFunction.opacity;
|
||
} if (val === 'Stroke Width' || val === 'stroke width') {
|
||
return interfaceFunction.strokeWidth;
|
||
}
|
||
return null;
|
||
}
|
||
Object.defineProperties(interfaceFunction, {
|
||
color: {
|
||
get: ExpressionPropertyInterface(view.c),
|
||
},
|
||
opacity: {
|
||
get: ExpressionPropertyInterface(view.o),
|
||
},
|
||
strokeWidth: {
|
||
get: ExpressionPropertyInterface(view.w),
|
||
},
|
||
dash: {
|
||
get: function () {
|
||
return dashOb;
|
||
},
|
||
},
|
||
_name: { value: shape.nm },
|
||
mn: { value: shape.mn },
|
||
});
|
||
|
||
view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup));
|
||
view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
|
||
view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup));
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function trimInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(val) {
|
||
if (val === shape.e.ix || val === 'End' || val === 'end') {
|
||
return interfaceFunction.end;
|
||
}
|
||
if (val === shape.s.ix) {
|
||
return interfaceFunction.start;
|
||
}
|
||
if (val === shape.o.ix) {
|
||
return interfaceFunction.offset;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
|
||
view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup));
|
||
view.e.setGroupProperty(PropertyInterface('End', _propertyGroup));
|
||
view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
interfaceFunction.propertyGroup = propertyGroup;
|
||
|
||
Object.defineProperties(interfaceFunction, {
|
||
start: {
|
||
get: ExpressionPropertyInterface(view.s),
|
||
},
|
||
end: {
|
||
get: ExpressionPropertyInterface(view.e),
|
||
},
|
||
offset: {
|
||
get: ExpressionPropertyInterface(view.o),
|
||
},
|
||
_name: { value: shape.nm },
|
||
});
|
||
interfaceFunction.mn = shape.mn;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function transformInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(value) {
|
||
if (shape.a.ix === value || value === 'Anchor Point') {
|
||
return interfaceFunction.anchorPoint;
|
||
}
|
||
if (shape.o.ix === value || value === 'Opacity') {
|
||
return interfaceFunction.opacity;
|
||
}
|
||
if (shape.p.ix === value || value === 'Position') {
|
||
return interfaceFunction.position;
|
||
}
|
||
if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {
|
||
return interfaceFunction.rotation;
|
||
}
|
||
if (shape.s.ix === value || value === 'Scale') {
|
||
return interfaceFunction.scale;
|
||
}
|
||
if ((shape.sk && shape.sk.ix === value) || value === 'Skew') {
|
||
return interfaceFunction.skew;
|
||
}
|
||
if ((shape.sa && shape.sa.ix === value) || value === 'Skew Axis') {
|
||
return interfaceFunction.skewAxis;
|
||
}
|
||
return null;
|
||
}
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
|
||
view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
|
||
view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup));
|
||
view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup));
|
||
view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
|
||
if (view.transform.mProps.sk) {
|
||
view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup));
|
||
view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup));
|
||
}
|
||
view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
|
||
Object.defineProperties(interfaceFunction, {
|
||
opacity: {
|
||
get: ExpressionPropertyInterface(view.transform.mProps.o),
|
||
},
|
||
position: {
|
||
get: ExpressionPropertyInterface(view.transform.mProps.p),
|
||
},
|
||
anchorPoint: {
|
||
get: ExpressionPropertyInterface(view.transform.mProps.a),
|
||
},
|
||
scale: {
|
||
get: ExpressionPropertyInterface(view.transform.mProps.s),
|
||
},
|
||
rotation: {
|
||
get: ExpressionPropertyInterface(view.transform.mProps.r),
|
||
},
|
||
skew: {
|
||
get: ExpressionPropertyInterface(view.transform.mProps.sk),
|
||
},
|
||
skewAxis: {
|
||
get: ExpressionPropertyInterface(view.transform.mProps.sa),
|
||
},
|
||
_name: { value: shape.nm },
|
||
});
|
||
interfaceFunction.ty = 'tr';
|
||
interfaceFunction.mn = shape.mn;
|
||
interfaceFunction.propertyGroup = propertyGroup;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function ellipseInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(value) {
|
||
if (shape.p.ix === value) {
|
||
return interfaceFunction.position;
|
||
}
|
||
if (shape.s.ix === value) {
|
||
return interfaceFunction.size;
|
||
}
|
||
return null;
|
||
}
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
|
||
prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));
|
||
prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
|
||
|
||
Object.defineProperties(interfaceFunction, {
|
||
size: {
|
||
get: ExpressionPropertyInterface(prop.s),
|
||
},
|
||
position: {
|
||
get: ExpressionPropertyInterface(prop.p),
|
||
},
|
||
_name: { value: shape.nm },
|
||
});
|
||
interfaceFunction.mn = shape.mn;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function starInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(value) {
|
||
if (shape.p.ix === value) {
|
||
return interfaceFunction.position;
|
||
}
|
||
if (shape.r.ix === value) {
|
||
return interfaceFunction.rotation;
|
||
}
|
||
if (shape.pt.ix === value) {
|
||
return interfaceFunction.points;
|
||
}
|
||
if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') {
|
||
return interfaceFunction.outerRadius;
|
||
}
|
||
if (shape.os.ix === value) {
|
||
return interfaceFunction.outerRoundness;
|
||
}
|
||
if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) {
|
||
return interfaceFunction.innerRadius;
|
||
}
|
||
if (shape.is && shape.is.ix === value) {
|
||
return interfaceFunction.innerRoundness;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup));
|
||
prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup));
|
||
prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup));
|
||
prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
|
||
prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
|
||
if (shape.ir) {
|
||
prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup));
|
||
prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup));
|
||
}
|
||
|
||
Object.defineProperties(interfaceFunction, {
|
||
position: {
|
||
get: ExpressionPropertyInterface(prop.p),
|
||
},
|
||
rotation: {
|
||
get: ExpressionPropertyInterface(prop.r),
|
||
},
|
||
points: {
|
||
get: ExpressionPropertyInterface(prop.pt),
|
||
},
|
||
outerRadius: {
|
||
get: ExpressionPropertyInterface(prop.or),
|
||
},
|
||
outerRoundness: {
|
||
get: ExpressionPropertyInterface(prop.os),
|
||
},
|
||
innerRadius: {
|
||
get: ExpressionPropertyInterface(prop.ir),
|
||
},
|
||
innerRoundness: {
|
||
get: ExpressionPropertyInterface(prop.is),
|
||
},
|
||
_name: { value: shape.nm },
|
||
});
|
||
interfaceFunction.mn = shape.mn;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function rectInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(value) {
|
||
if (shape.p.ix === value) {
|
||
return interfaceFunction.position;
|
||
}
|
||
if (shape.r.ix === value) {
|
||
return interfaceFunction.roundness;
|
||
}
|
||
if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {
|
||
return interfaceFunction.size;
|
||
}
|
||
return null;
|
||
}
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
|
||
var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
|
||
prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));
|
||
prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
|
||
|
||
Object.defineProperties(interfaceFunction, {
|
||
position: {
|
||
get: ExpressionPropertyInterface(prop.p),
|
||
},
|
||
roundness: {
|
||
get: ExpressionPropertyInterface(prop.r),
|
||
},
|
||
size: {
|
||
get: ExpressionPropertyInterface(prop.s),
|
||
},
|
||
_name: { value: shape.nm },
|
||
});
|
||
interfaceFunction.mn = shape.mn;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function roundedInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(value) {
|
||
if (shape.r.ix === value || value === 'Round Corners 1') {
|
||
return interfaceFunction.radius;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
var prop = view;
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup));
|
||
|
||
Object.defineProperties(interfaceFunction, {
|
||
radius: {
|
||
get: ExpressionPropertyInterface(prop.rd),
|
||
},
|
||
_name: { value: shape.nm },
|
||
});
|
||
interfaceFunction.mn = shape.mn;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
function repeaterInterfaceFactory(shape, view, propertyGroup) {
|
||
function interfaceFunction(value) {
|
||
if (shape.c.ix === value || value === 'Copies') {
|
||
return interfaceFunction.copies;
|
||
} if (shape.o.ix === value || value === 'Offset') {
|
||
return interfaceFunction.offset;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
|
||
var prop = view;
|
||
interfaceFunction.propertyIndex = shape.ix;
|
||
prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup));
|
||
prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));
|
||
Object.defineProperties(interfaceFunction, {
|
||
copies: {
|
||
get: ExpressionPropertyInterface(prop.c),
|
||
},
|
||
offset: {
|
||
get: ExpressionPropertyInterface(prop.o),
|
||
},
|
||
_name: { value: shape.nm },
|
||
});
|
||
interfaceFunction.mn = shape.mn;
|
||
return interfaceFunction;
|
||
}
|
||
|
||
return function (shapes, view, propertyGroup) {
|
||
var interfaces;
|
||
function _interfaceFunction(value) {
|
||
if (typeof value === 'number') {
|
||
value = value === undefined ? 1 : value;
|
||
if (value === 0) {
|
||
return propertyGroup;
|
||
}
|
||
return interfaces[value - 1];
|
||
}
|
||
var i = 0;
|
||
var len = interfaces.length;
|
||
while (i < len) {
|
||
if (interfaces[i]._name === value) {
|
||
return interfaces[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
}
|
||
function parentGroupWrapper() {
|
||
return propertyGroup;
|
||
}
|
||
_interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper);
|
||
interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup);
|
||
_interfaceFunction.numProperties = interfaces.length;
|
||
_interfaceFunction._name = 'Contents';
|
||
return _interfaceFunction;
|
||
};
|
||
}());
|
||
|
||
/* exported TextExpressionInterface */
|
||
|
||
var TextExpressionInterface = (function () {
|
||
return function (elem) {
|
||
var _prevValue;
|
||
var _sourceText;
|
||
function _thisLayerFunction(name) {
|
||
switch (name) {
|
||
case 'ADBE Text Document':
|
||
return _thisLayerFunction.sourceText;
|
||
default:
|
||
return null;
|
||
}
|
||
}
|
||
Object.defineProperty(_thisLayerFunction, 'sourceText', {
|
||
get: function () {
|
||
elem.textProperty.getValue();
|
||
var stringValue = elem.textProperty.currentData.t;
|
||
if (stringValue !== _prevValue) {
|
||
elem.textProperty.currentData.t = _prevValue;
|
||
_sourceText = new String(stringValue); // eslint-disable-line no-new-wrappers
|
||
// If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive
|
||
_sourceText.value = stringValue || new String(stringValue); // eslint-disable-line no-new-wrappers
|
||
}
|
||
return _sourceText;
|
||
},
|
||
});
|
||
return _thisLayerFunction;
|
||
};
|
||
}());
|
||
|
||
/* global Matrix, MaskManagerInterface, TransformExpressionInterface, getDescriptor */
|
||
/* exported LayerExpressionInterface */
|
||
|
||
var LayerExpressionInterface = (function () {
|
||
function getMatrix(time) {
|
||
var toWorldMat = new Matrix();
|
||
if (time !== undefined) {
|
||
var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time);
|
||
propMatrix.clone(toWorldMat);
|
||
} else {
|
||
var transformMat = this._elem.finalTransform.mProp;
|
||
transformMat.applyToMatrix(toWorldMat);
|
||
}
|
||
return toWorldMat;
|
||
}
|
||
|
||
function toWorldVec(arr, time) {
|
||
var toWorldMat = this.getMatrix(time);
|
||
toWorldMat.props[12] = 0;
|
||
toWorldMat.props[13] = 0;
|
||
toWorldMat.props[14] = 0;
|
||
return this.applyPoint(toWorldMat, arr);
|
||
}
|
||
|
||
function toWorld(arr, time) {
|
||
var toWorldMat = this.getMatrix(time);
|
||
return this.applyPoint(toWorldMat, arr);
|
||
}
|
||
|
||
function fromWorldVec(arr, time) {
|
||
var toWorldMat = this.getMatrix(time);
|
||
toWorldMat.props[12] = 0;
|
||
toWorldMat.props[13] = 0;
|
||
toWorldMat.props[14] = 0;
|
||
return this.invertPoint(toWorldMat, arr);
|
||
}
|
||
|
||
function fromWorld(arr, time) {
|
||
var toWorldMat = this.getMatrix(time);
|
||
return this.invertPoint(toWorldMat, arr);
|
||
}
|
||
|
||
function applyPoint(matrix, arr) {
|
||
if (this._elem.hierarchy && this._elem.hierarchy.length) {
|
||
var i;
|
||
var len = this._elem.hierarchy.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);
|
||
}
|
||
}
|
||
return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0);
|
||
}
|
||
|
||
function invertPoint(matrix, arr) {
|
||
if (this._elem.hierarchy && this._elem.hierarchy.length) {
|
||
var i;
|
||
var len = this._elem.hierarchy.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);
|
||
}
|
||
}
|
||
return matrix.inversePoint(arr);
|
||
}
|
||
|
||
function fromComp(arr) {
|
||
var toWorldMat = new Matrix();
|
||
toWorldMat.reset();
|
||
this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);
|
||
if (this._elem.hierarchy && this._elem.hierarchy.length) {
|
||
var i;
|
||
var len = this._elem.hierarchy.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
|
||
}
|
||
return toWorldMat.inversePoint(arr);
|
||
}
|
||
return toWorldMat.inversePoint(arr);
|
||
}
|
||
|
||
function sampleImage() {
|
||
return [1, 1, 1, 1];
|
||
}
|
||
|
||
return function (elem) {
|
||
var transformInterface;
|
||
|
||
function _registerMaskInterface(maskManager) {
|
||
_thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);
|
||
}
|
||
function _registerEffectsInterface(effects) {
|
||
_thisLayerFunction.effect = effects;
|
||
}
|
||
|
||
function _thisLayerFunction(name) {
|
||
switch (name) {
|
||
case 'ADBE Root Vectors Group':
|
||
case 'Contents':
|
||
case 2:
|
||
return _thisLayerFunction.shapeInterface;
|
||
case 1:
|
||
case 6:
|
||
case 'Transform':
|
||
case 'transform':
|
||
case 'ADBE Transform Group':
|
||
return transformInterface;
|
||
case 4:
|
||
case 'ADBE Effect Parade':
|
||
case 'effects':
|
||
case 'Effects':
|
||
return _thisLayerFunction.effect;
|
||
case 'ADBE Text Properties':
|
||
return _thisLayerFunction.textInterface;
|
||
default:
|
||
return null;
|
||
}
|
||
}
|
||
_thisLayerFunction.getMatrix = getMatrix;
|
||
_thisLayerFunction.invertPoint = invertPoint;
|
||
_thisLayerFunction.applyPoint = applyPoint;
|
||
_thisLayerFunction.toWorld = toWorld;
|
||
_thisLayerFunction.toWorldVec = toWorldVec;
|
||
_thisLayerFunction.fromWorld = fromWorld;
|
||
_thisLayerFunction.fromWorldVec = fromWorldVec;
|
||
_thisLayerFunction.toComp = toWorld;
|
||
_thisLayerFunction.fromComp = fromComp;
|
||
_thisLayerFunction.sampleImage = sampleImage;
|
||
_thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);
|
||
_thisLayerFunction._elem = elem;
|
||
transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);
|
||
var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');
|
||
Object.defineProperties(_thisLayerFunction, {
|
||
hasParent: {
|
||
get: function () {
|
||
return elem.hierarchy.length;
|
||
},
|
||
},
|
||
parent: {
|
||
get: function () {
|
||
return elem.hierarchy[0].layerInterface;
|
||
},
|
||
},
|
||
rotation: getDescriptor(transformInterface, 'rotation'),
|
||
scale: getDescriptor(transformInterface, 'scale'),
|
||
position: getDescriptor(transformInterface, 'position'),
|
||
opacity: getDescriptor(transformInterface, 'opacity'),
|
||
anchorPoint: anchorPointDescriptor,
|
||
anchor_point: anchorPointDescriptor,
|
||
transform: {
|
||
get: function () {
|
||
return transformInterface;
|
||
},
|
||
},
|
||
active: {
|
||
get: function () {
|
||
return elem.isInRange;
|
||
},
|
||
},
|
||
});
|
||
|
||
_thisLayerFunction.startTime = elem.data.st;
|
||
_thisLayerFunction.index = elem.data.ind;
|
||
_thisLayerFunction.source = elem.data.refId;
|
||
_thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;
|
||
_thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;
|
||
_thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate;
|
||
_thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate;
|
||
_thisLayerFunction._name = elem.data.nm;
|
||
|
||
_thisLayerFunction.registerMaskInterface = _registerMaskInterface;
|
||
_thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;
|
||
return _thisLayerFunction;
|
||
};
|
||
}());
|
||
|
||
/* global */
|
||
/* exported FootageInterface */
|
||
|
||
var FootageInterface = (function () {
|
||
var outlineInterfaceFactory = (function (elem) {
|
||
var currentPropertyName = '';
|
||
var currentProperty = elem.getFootageData();
|
||
function init() {
|
||
currentPropertyName = '';
|
||
currentProperty = elem.getFootageData();
|
||
return searchProperty;
|
||
}
|
||
function searchProperty(value) {
|
||
if (currentProperty[value]) {
|
||
currentPropertyName = value;
|
||
currentProperty = currentProperty[value];
|
||
if (typeof currentProperty === 'object') {
|
||
return searchProperty;
|
||
}
|
||
return currentProperty;
|
||
}
|
||
var propertyNameIndex = value.indexOf(currentPropertyName);
|
||
if (propertyNameIndex !== -1) {
|
||
var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10);
|
||
currentProperty = currentProperty[index];
|
||
if (typeof currentProperty === 'object') {
|
||
return searchProperty;
|
||
}
|
||
return currentProperty;
|
||
}
|
||
return '';
|
||
}
|
||
return init;
|
||
});
|
||
|
||
var dataInterfaceFactory = function (elem) {
|
||
function interfaceFunction(value) {
|
||
if (value === 'Outline') {
|
||
return interfaceFunction.outlineInterface();
|
||
}
|
||
return null;
|
||
}
|
||
|
||
interfaceFunction._name = 'Outline';
|
||
interfaceFunction.outlineInterface = outlineInterfaceFactory(elem);
|
||
return interfaceFunction;
|
||
};
|
||
|
||
return function (elem) {
|
||
function _interfaceFunction(value) {
|
||
if (value === 'Data') {
|
||
return _interfaceFunction.dataInterface;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
_interfaceFunction._name = 'Data';
|
||
_interfaceFunction.dataInterface = dataInterfaceFactory(elem);
|
||
return _interfaceFunction;
|
||
};
|
||
}());
|
||
|
||
/* exported CompExpressionInterface */
|
||
|
||
var CompExpressionInterface = (function () {
|
||
return function (comp) {
|
||
function _thisLayerFunction(name) {
|
||
var i = 0;
|
||
var len = comp.layers.length;
|
||
while (i < len) {
|
||
if (comp.layers[i].nm === name || comp.layers[i].ind === name) {
|
||
return comp.elements[i].layerInterface;
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
// return {active:false};
|
||
}
|
||
Object.defineProperty(_thisLayerFunction, '_name', { value: comp.data.nm });
|
||
_thisLayerFunction.layer = _thisLayerFunction;
|
||
_thisLayerFunction.pixelAspect = 1;
|
||
_thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;
|
||
_thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;
|
||
_thisLayerFunction.pixelAspect = 1;
|
||
_thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;
|
||
_thisLayerFunction.displayStartTime = 0;
|
||
_thisLayerFunction.numLayers = comp.layers.length;
|
||
return _thisLayerFunction;
|
||
};
|
||
}());
|
||
|
||
/* global ExpressionPropertyInterface */
|
||
/* exported TransformExpressionInterface */
|
||
|
||
var TransformExpressionInterface = (function () {
|
||
return function (transform) {
|
||
function _thisFunction(name) {
|
||
switch (name) {
|
||
case 'scale':
|
||
case 'Scale':
|
||
case 'ADBE Scale':
|
||
case 6:
|
||
return _thisFunction.scale;
|
||
case 'rotation':
|
||
case 'Rotation':
|
||
case 'ADBE Rotation':
|
||
case 'ADBE Rotate Z':
|
||
case 10:
|
||
return _thisFunction.rotation;
|
||
case 'ADBE Rotate X':
|
||
return _thisFunction.xRotation;
|
||
case 'ADBE Rotate Y':
|
||
return _thisFunction.yRotation;
|
||
case 'position':
|
||
case 'Position':
|
||
case 'ADBE Position':
|
||
case 2:
|
||
return _thisFunction.position;
|
||
case 'ADBE Position_0':
|
||
return _thisFunction.xPosition;
|
||
case 'ADBE Position_1':
|
||
return _thisFunction.yPosition;
|
||
case 'ADBE Position_2':
|
||
return _thisFunction.zPosition;
|
||
case 'anchorPoint':
|
||
case 'AnchorPoint':
|
||
case 'Anchor Point':
|
||
case 'ADBE AnchorPoint':
|
||
case 1:
|
||
return _thisFunction.anchorPoint;
|
||
case 'opacity':
|
||
case 'Opacity':
|
||
case 11:
|
||
return _thisFunction.opacity;
|
||
default:
|
||
return null;
|
||
}
|
||
}
|
||
Object.defineProperty(_thisFunction, 'rotation', {
|
||
get: ExpressionPropertyInterface(transform.r || transform.rz),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'zRotation', {
|
||
get: ExpressionPropertyInterface(transform.rz || transform.r),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'xRotation', {
|
||
get: ExpressionPropertyInterface(transform.rx),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'yRotation', {
|
||
get: ExpressionPropertyInterface(transform.ry),
|
||
});
|
||
Object.defineProperty(_thisFunction, 'scale', {
|
||
get: ExpressionPropertyInterface(transform.s),
|
||
});
|
||
var _px;
|
||
var _py;
|
||
var _pz;
|
||
var _transformFactory;
|
||
if (transform.p) {
|
||
_transformFactory = ExpressionPropertyInterface(transform.p);
|
||
} else {
|
||
_px = ExpressionPropertyInterface(transform.px);
|
||
_py = ExpressionPropertyInterface(transform.py);
|
||
if (transform.pz) {
|
||
_pz = ExpressionPropertyInterface(transform.pz);
|
||
}
|
||
}
|
||
Object.defineProperty(_thisFunction, 'position', {
|
||
get: function () {
|
||
if (transform.p) {
|
||
return _transformFactory();
|
||
}
|
||
return [
|
||
_px(),
|
||
_py(),
|
||
_pz ? _pz() : 0];
|
||
},
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'xPosition', {
|
||
get: ExpressionPropertyInterface(transform.px),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'yPosition', {
|
||
get: ExpressionPropertyInterface(transform.py),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'zPosition', {
|
||
get: ExpressionPropertyInterface(transform.pz),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'anchorPoint', {
|
||
get: ExpressionPropertyInterface(transform.a),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'opacity', {
|
||
get: ExpressionPropertyInterface(transform.o),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'skew', {
|
||
get: ExpressionPropertyInterface(transform.sk),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'skewAxis', {
|
||
get: ExpressionPropertyInterface(transform.sa),
|
||
});
|
||
|
||
Object.defineProperty(_thisFunction, 'orientation', {
|
||
get: ExpressionPropertyInterface(transform.or),
|
||
});
|
||
|
||
return _thisFunction;
|
||
};
|
||
}());
|
||
|
||
/* exported ProjectInterface */
|
||
|
||
var ProjectInterface = (function () {
|
||
function registerComposition(comp) {
|
||
this.compositions.push(comp);
|
||
}
|
||
|
||
return function () {
|
||
function _thisProjectFunction(name) {
|
||
var i = 0;
|
||
var len = this.compositions.length;
|
||
while (i < len) {
|
||
if (this.compositions[i].data && this.compositions[i].data.nm === name) {
|
||
if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {
|
||
this.compositions[i].prepareFrame(this.currentFrame);
|
||
}
|
||
return this.compositions[i].compInterface;
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
_thisProjectFunction.compositions = [];
|
||
_thisProjectFunction.currentFrame = 0;
|
||
|
||
_thisProjectFunction.registerComposition = registerComposition;
|
||
|
||
return _thisProjectFunction;
|
||
};
|
||
}());
|
||
|
||
/* global propertyGroupFactory, ExpressionPropertyInterface, PropertyInterface */
|
||
/* exported EffectsExpressionInterface */
|
||
|
||
var EffectsExpressionInterface = (function () {
|
||
var ob = {
|
||
createEffectsInterface: createEffectsInterface,
|
||
};
|
||
|
||
function createEffectsInterface(elem, propertyGroup) {
|
||
if (elem.effectsManager) {
|
||
var effectElements = [];
|
||
var effectsData = elem.data.ef;
|
||
var i;
|
||
var len = elem.effectsManager.effectElements.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem));
|
||
}
|
||
|
||
var effects = elem.data.ef || [];
|
||
var groupInterface = function (name) {
|
||
i = 0;
|
||
len = effects.length;
|
||
while (i < len) {
|
||
if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {
|
||
return effectElements[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
};
|
||
Object.defineProperty(groupInterface, 'numProperties', {
|
||
get: function () {
|
||
return effects.length;
|
||
},
|
||
});
|
||
return groupInterface;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
function createGroupInterface(data, elements, propertyGroup, elem) {
|
||
function groupInterface(name) {
|
||
var effects = data.ef;
|
||
var i = 0;
|
||
var len = effects.length;
|
||
while (i < len) {
|
||
if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {
|
||
if (effects[i].ty === 5) {
|
||
return effectElements[i];
|
||
}
|
||
return effectElements[i]();
|
||
}
|
||
i += 1;
|
||
}
|
||
throw new Error();
|
||
}
|
||
var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup);
|
||
|
||
var effectElements = [];
|
||
var i;
|
||
var len = data.ef.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
if (data.ef[i].ty === 5) {
|
||
effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem));
|
||
} else {
|
||
effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup));
|
||
}
|
||
}
|
||
|
||
if (data.mn === 'ADBE Color Control') {
|
||
Object.defineProperty(groupInterface, 'color', {
|
||
get: function () {
|
||
return effectElements[0]();
|
||
},
|
||
});
|
||
}
|
||
Object.defineProperties(groupInterface, {
|
||
numProperties: {
|
||
get: function () {
|
||
return data.np;
|
||
},
|
||
},
|
||
_name: { value: data.nm },
|
||
propertyGroup: { value: _propertyGroup },
|
||
});
|
||
groupInterface.enabled = data.en !== 0;
|
||
groupInterface.active = groupInterface.enabled;
|
||
return groupInterface;
|
||
}
|
||
|
||
function createValueInterface(element, type, elem, propertyGroup) {
|
||
var expressionProperty = ExpressionPropertyInterface(element.p);
|
||
function interfaceFunction() {
|
||
if (type === 10) {
|
||
return elem.comp.compInterface(element.p.v);
|
||
}
|
||
return expressionProperty();
|
||
}
|
||
|
||
if (element.p.setGroupProperty) {
|
||
element.p.setGroupProperty(PropertyInterface('', propertyGroup));
|
||
}
|
||
|
||
return interfaceFunction;
|
||
}
|
||
|
||
return ob;
|
||
}());
|
||
|
||
/* global createSizedArray */
|
||
/* exported MaskManagerInterface */
|
||
|
||
var MaskManagerInterface = (function () {
|
||
function MaskInterface(mask, data) {
|
||
this._mask = mask;
|
||
this._data = data;
|
||
}
|
||
Object.defineProperty(MaskInterface.prototype, 'maskPath', {
|
||
get: function () {
|
||
if (this._mask.prop.k) {
|
||
this._mask.prop.getValue();
|
||
}
|
||
return this._mask.prop;
|
||
},
|
||
});
|
||
Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {
|
||
get: function () {
|
||
if (this._mask.op.k) {
|
||
this._mask.op.getValue();
|
||
}
|
||
return this._mask.op.v * 100;
|
||
},
|
||
});
|
||
|
||
var MaskManager = function (maskManager) {
|
||
var _masksInterfaces = createSizedArray(maskManager.viewData.length);
|
||
var i;
|
||
var len = maskManager.viewData.length;
|
||
for (i = 0; i < len; i += 1) {
|
||
_masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);
|
||
}
|
||
|
||
var maskFunction = function (name) {
|
||
i = 0;
|
||
while (i < len) {
|
||
if (maskManager.masksProperties[i].nm === name) {
|
||
return _masksInterfaces[i];
|
||
}
|
||
i += 1;
|
||
}
|
||
return null;
|
||
};
|
||
return maskFunction;
|
||
};
|
||
return MaskManager;
|
||
}());
|
||
|
||
/* global createTypedArray */
|
||
/* exported ExpressionPropertyInterface */
|
||
|
||
var ExpressionPropertyInterface = (function () {
|
||
var defaultUnidimensionalValue = { pv: 0, v: 0, mult: 1 };
|
||
var defaultMultidimensionalValue = { pv: [0, 0, 0], v: [0, 0, 0], mult: 1 };
|
||
|
||
function completeProperty(expressionValue, property, type) {
|
||
Object.defineProperty(expressionValue, 'velocity', {
|
||
get: function () {
|
||
return property.getVelocityAtTime(property.comp.currentFrame);
|
||
},
|
||
});
|
||
expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;
|
||
expressionValue.key = function (pos) {
|
||
if (!expressionValue.numKeys) {
|
||
return 0;
|
||
}
|
||
var value = '';
|
||
if ('s' in property.keyframes[pos - 1]) {
|
||
value = property.keyframes[pos - 1].s;
|
||
} else if ('e' in property.keyframes[pos - 2]) {
|
||
value = property.keyframes[pos - 2].e;
|
||
} else {
|
||
value = property.keyframes[pos - 2].s;
|
||
}
|
||
var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value); // eslint-disable-line no-new-wrappers
|
||
valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate;
|
||
valueProp.value = type === 'unidimensional' ? value[0] : value;
|
||
return valueProp;
|
||
};
|
||
expressionValue.valueAtTime = property.getValueAtTime;
|
||
expressionValue.speedAtTime = property.getSpeedAtTime;
|
||
expressionValue.velocityAtTime = property.getVelocityAtTime;
|
||
expressionValue.propertyGroup = property.propertyGroup;
|
||
}
|
||
|
||
function UnidimensionalPropertyInterface(property) {
|
||
if (!property || !('pv' in property)) {
|
||
property = defaultUnidimensionalValue;
|
||
}
|
||
var mult = 1 / property.mult;
|
||
var val = property.pv * mult;
|
||
var expressionValue = new Number(val); // eslint-disable-line no-new-wrappers
|
||
expressionValue.value = val;
|
||
completeProperty(expressionValue, property, 'unidimensional');
|
||
|
||
return function () {
|
||
if (property.k) {
|
||
property.getValue();
|
||
}
|
||
val = property.v * mult;
|
||
if (expressionValue.value !== val) {
|
||
expressionValue = new Number(val); // eslint-disable-line no-new-wrappers
|
||
expressionValue.value = val;
|
||
completeProperty(expressionValue, property, 'unidimensional');
|
||
}
|
||
return expressionValue;
|
||
};
|
||
}
|
||
|
||
function MultidimensionalPropertyInterface(property) {
|
||
if (!property || !('pv' in property)) {
|
||
property = defaultMultidimensionalValue;
|
||
}
|
||
var mult = 1 / property.mult;
|
||
var len = (property.data && property.data.l) || property.pv.length;
|
||
var expressionValue = createTypedArray('float32', len);
|
||
var arrValue = createTypedArray('float32', len);
|
||
expressionValue.value = arrValue;
|
||
completeProperty(expressionValue, property, 'multidimensional');
|
||
|
||
return function () {
|
||
if (property.k) {
|
||
property.getValue();
|
||
}
|
||
for (var i = 0; i < len; i += 1) {
|
||
arrValue[i] = property.v[i] * mult;
|
||
expressionValue[i] = arrValue[i];
|
||
}
|
||
return expressionValue;
|
||
};
|
||
}
|
||
|
||
// TODO: try to avoid using this getter
|
||
function defaultGetter() {
|
||
return defaultUnidimensionalValue;
|
||
}
|
||
|
||
return function (property) {
|
||
if (!property) {
|
||
return defaultGetter;
|
||
} if (property.propType === 'unidimensional') {
|
||
return UnidimensionalPropertyInterface(property);
|
||
}
|
||
return MultidimensionalPropertyInterface(property);
|
||
};
|
||
}());
|
||
|
||
/* global expressionHelpers, TextSelectorProp, ExpressionManager */
|
||
/* exported TextExpressionSelectorPropFactory */
|
||
|
||
var TextExpressionSelectorPropFactory = (function () { // eslint-disable-line no-unused-vars
|
||
function getValueProxy(index, total) {
|
||
this.textIndex = index + 1;
|
||
this.textTotal = total;
|
||
this.v = this.getValue() * this.mult;
|
||
return this.v;
|
||
}
|
||
|
||
return function (elem, data) {
|
||
this.pv = 1;
|
||
this.comp = elem.comp;
|
||
this.elem = elem;
|
||
this.mult = 0.01;
|
||
this.propType = 'textSelector';
|
||
this.textTotal = data.totalChars;
|
||
this.selectorValue = 100;
|
||
this.lastValue = [1, 1, 1];
|
||
this.k = true;
|
||
this.x = true;
|
||
this.getValue = ExpressionManager.initiateExpression.bind(this)(elem, data, this);
|
||
this.getMult = getValueProxy;
|
||
this.getVelocityAtTime = expressionHelpers.getVelocityAtTime;
|
||
if (this.kf) {
|
||
this.getValueAtTime = expressionHelpers.getValueAtTime.bind(this);
|
||
} else {
|
||
this.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(this);
|
||
}
|
||
this.setGroupProperty = expressionHelpers.setGroupProperty;
|
||
};
|
||
}());
|
||
|
||
var propertyGetTextProp = TextSelectorProp.getTextSelectorProp;
|
||
TextSelectorProp.getTextSelectorProp = function (elem, data, arr) {
|
||
if (data.t === 1) {
|
||
return new TextExpressionSelectorPropFactory(elem, data, arr); // eslint-disable-line no-undef
|
||
}
|
||
return propertyGetTextProp(elem, data, arr);
|
||
};
|
||
|
||
/* global PropertyFactory */
|
||
/* exported SliderEffect, AngleEffect, ColorEffect, PointEffect, LayerIndexEffect, MaskIndexEffect, CheckboxEffect, NoValueEffect */
|
||
|
||
function SliderEffect(data, elem, container) {
|
||
this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
|
||
}
|
||
function AngleEffect(data, elem, container) {
|
||
this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
|
||
}
|
||
function ColorEffect(data, elem, container) {
|
||
this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);
|
||
}
|
||
function PointEffect(data, elem, container) {
|
||
this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);
|
||
}
|
||
function LayerIndexEffect(data, elem, container) {
|
||
this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
|
||
}
|
||
function MaskIndexEffect(data, elem, container) {
|
||
this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
|
||
}
|
||
function CheckboxEffect(data, elem, container) {
|
||
this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
|
||
}
|
||
function NoValueEffect() {
|
||
this.p = {};
|
||
}
|
||
|
||
/* global extendPrototype, SliderEffect, AngleEffect, ColorEffect, PointEffect, CheckboxEffect, LayerIndexEffect,
|
||
MaskIndexEffect, NoValueEffect, DynamicPropertyContainer */
|
||
|
||
function EffectsManager(data, element) {
|
||
var effects = data.ef || [];
|
||
this.effectElements = [];
|
||
var i;
|
||
var len = effects.length;
|
||
var effectItem;
|
||
for (i = 0; i < len; i += 1) {
|
||
effectItem = new GroupEffect(effects[i], element);
|
||
this.effectElements.push(effectItem);
|
||
}
|
||
}
|
||
|
||
function GroupEffect(data, element) {
|
||
this.init(data, element);
|
||
}
|
||
|
||
extendPrototype([DynamicPropertyContainer], GroupEffect);
|
||
|
||
GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;
|
||
|
||
GroupEffect.prototype.init = function (data, element) {
|
||
this.data = data;
|
||
this.effectElements = [];
|
||
this.initDynamicPropertyContainer(element);
|
||
var i;
|
||
var len = this.data.ef.length;
|
||
var eff;
|
||
var effects = this.data.ef;
|
||
for (i = 0; i < len; i += 1) {
|
||
eff = null;
|
||
switch (effects[i].ty) {
|
||
case 0:
|
||
eff = new SliderEffect(effects[i], element, this);
|
||
break;
|
||
case 1:
|
||
eff = new AngleEffect(effects[i], element, this);
|
||
break;
|
||
case 2:
|
||
eff = new ColorEffect(effects[i], element, this);
|
||
break;
|
||
case 3:
|
||
eff = new PointEffect(effects[i], element, this);
|
||
break;
|
||
case 4:
|
||
case 7:
|
||
eff = new CheckboxEffect(effects[i], element, this);
|
||
break;
|
||
case 10:
|
||
eff = new LayerIndexEffect(effects[i], element, this);
|
||
break;
|
||
case 11:
|
||
eff = new MaskIndexEffect(effects[i], element, this);
|
||
break;
|
||
case 5:
|
||
eff = new EffectsManager(effects[i], element, this);
|
||
break;
|
||
// case 6:
|
||
default:
|
||
eff = new NoValueEffect(effects[i], element, this);
|
||
break;
|
||
}
|
||
if (eff) {
|
||
this.effectElements.push(eff);
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
var lottie = {};
|
||
|
||
function setLocationHref(href) {
|
||
locationHref = href;
|
||
}
|
||
|
||
function searchAnimations() {
|
||
if (standalone === true) {
|
||
animationManager.searchAnimations(animationData, standalone, renderer);
|
||
} else {
|
||
animationManager.searchAnimations();
|
||
}
|
||
}
|
||
|
||
function setSubframeRendering(flag) {
|
||
subframeEnabled = flag;
|
||
}
|
||
|
||
function setIDPrefix(prefix) {
|
||
idPrefix = prefix;
|
||
}
|
||
|
||
function loadAnimation(params) {
|
||
if (standalone === true) {
|
||
params.animationData = JSON.parse(animationData);
|
||
}
|
||
return animationManager.loadAnimation(params);
|
||
}
|
||
|
||
function setQuality(value) {
|
||
if (typeof value === 'string') {
|
||
switch (value) {
|
||
case 'high':
|
||
defaultCurveSegments = 200;
|
||
break;
|
||
default:
|
||
case 'medium':
|
||
defaultCurveSegments = 50;
|
||
break;
|
||
case 'low':
|
||
defaultCurveSegments = 10;
|
||
break;
|
||
}
|
||
} else if (!isNaN(value) && value > 1) {
|
||
defaultCurveSegments = value;
|
||
}
|
||
if (defaultCurveSegments >= 50) {
|
||
roundValues(false);
|
||
} else {
|
||
roundValues(true);
|
||
}
|
||
}
|
||
|
||
function inBrowser() {
|
||
return typeof navigator !== 'undefined';
|
||
}
|
||
|
||
function installPlugin(type, plugin) {
|
||
if (type === 'expressions') {
|
||
expressionsPlugin = plugin;
|
||
}
|
||
}
|
||
|
||
function getFactory(name) {
|
||
switch (name) {
|
||
case 'propertyFactory':
|
||
return PropertyFactory;
|
||
case 'shapePropertyFactory':
|
||
return ShapePropertyFactory;
|
||
case 'matrix':
|
||
return Matrix;
|
||
default:
|
||
return null;
|
||
}
|
||
}
|
||
|
||
lottie.play = animationManager.play;
|
||
lottie.pause = animationManager.pause;
|
||
lottie.setLocationHref = setLocationHref;
|
||
lottie.togglePause = animationManager.togglePause;
|
||
lottie.setSpeed = animationManager.setSpeed;
|
||
lottie.setDirection = animationManager.setDirection;
|
||
lottie.stop = animationManager.stop;
|
||
lottie.searchAnimations = searchAnimations;
|
||
lottie.registerAnimation = animationManager.registerAnimation;
|
||
lottie.loadAnimation = loadAnimation;
|
||
lottie.setSubframeRendering = setSubframeRendering;
|
||
lottie.resize = animationManager.resize;
|
||
// lottie.start = start;
|
||
lottie.goToAndStop = animationManager.goToAndStop;
|
||
lottie.destroy = animationManager.destroy;
|
||
lottie.setQuality = setQuality;
|
||
lottie.inBrowser = inBrowser;
|
||
lottie.installPlugin = installPlugin;
|
||
lottie.freeze = animationManager.freeze;
|
||
lottie.unfreeze = animationManager.unfreeze;
|
||
lottie.setVolume = animationManager.setVolume;
|
||
lottie.mute = animationManager.mute;
|
||
lottie.unmute = animationManager.unmute;
|
||
lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations;
|
||
lottie.setIDPrefix = setIDPrefix;
|
||
lottie.__getFactory = getFactory;
|
||
lottie.version = '5.7.13';
|
||
|
||
function checkReady() {
|
||
if (document.readyState === 'complete') {
|
||
clearInterval(readyStateCheckInterval);
|
||
searchAnimations();
|
||
}
|
||
}
|
||
|
||
function getQueryVariable(variable) {
|
||
var vars = queryString.split('&');
|
||
for (var i = 0; i < vars.length; i += 1) {
|
||
var pair = vars[i].split('=');
|
||
if (decodeURIComponent(pair[0]) == variable) { // eslint-disable-line eqeqeq
|
||
return decodeURIComponent(pair[1]);
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
var standalone = '__[STANDALONE]__';
|
||
var animationData = '__[ANIMATIONDATA]__';
|
||
var renderer = '';
|
||
var queryString;
|
||
if (standalone) {
|
||
var scripts = document.getElementsByTagName('script');
|
||
var index = scripts.length - 1;
|
||
var myScript = scripts[index] || {
|
||
src: '',
|
||
};
|
||
queryString = myScript.src.replace(/^[^\?]+\??/, ''); // eslint-disable-line no-useless-escape
|
||
renderer = getQueryVariable('renderer');
|
||
}
|
||
var readyStateCheckInterval = setInterval(checkReady, 100);
|
||
|
||
return lottie;
|
||
}));
|
||
|
||
/***/ }),
|
||
/* 287 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals document, window, navigator */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Brand pages on the subdomain
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
Webflow.define('brand', module.exports = function ($) {
|
||
var api = {};
|
||
var doc = document;
|
||
var $html = $('html');
|
||
var $body = $('body');
|
||
var namespace = '.w-webflow-badge';
|
||
var location = window.location;
|
||
var isPhantom = /PhantomJS/i.test(navigator.userAgent);
|
||
var fullScreenEvents = 'fullscreenchange webkitfullscreenchange mozfullscreenchange msfullscreenchange';
|
||
var brandElement; // -----------------------------------
|
||
// Module methods
|
||
|
||
api.ready = function () {
|
||
var shouldBrand = $html.attr('data-wf-status');
|
||
var publishedDomain = $html.attr('data-wf-domain') || '';
|
||
|
||
if (/\.webflow\.io$/i.test(publishedDomain) && location.hostname !== publishedDomain) {
|
||
shouldBrand = true;
|
||
}
|
||
|
||
if (shouldBrand && !isPhantom) {
|
||
brandElement = brandElement || createBadge();
|
||
ensureBrand();
|
||
setTimeout(ensureBrand, 500);
|
||
$(doc).off(fullScreenEvents, onFullScreenChange).on(fullScreenEvents, onFullScreenChange);
|
||
}
|
||
};
|
||
|
||
function onFullScreenChange() {
|
||
var fullScreen = doc.fullScreen || doc.mozFullScreen || doc.webkitIsFullScreen || doc.msFullscreenElement || Boolean(doc.webkitFullscreenElement);
|
||
$(brandElement).attr('style', fullScreen ? 'display: none !important;' : '');
|
||
}
|
||
|
||
function createBadge() {
|
||
var $brand = $('<a class="w-webflow-badge"></a>').attr('href', 'https://webflow.com?utm_campaign=brandjs');
|
||
var $logoArt = $('<img>').attr('src', 'https://d3e54v103j8qbb.cloudfront.net/img/webflow-badge-icon.f67cd735e3.svg').attr('alt', '').css({
|
||
marginRight: '8px',
|
||
width: '16px'
|
||
});
|
||
var $logoText = $('<img>').attr('src', 'https://d1otoma47x30pg.cloudfront.net/img/webflow-badge-text.6faa6a38cd.svg').attr('alt', 'Made in Webflow');
|
||
$brand.append($logoArt, $logoText);
|
||
return $brand[0];
|
||
}
|
||
|
||
function ensureBrand() {
|
||
var found = $body.children(namespace);
|
||
var match = found.length && found.get(0) === brandElement;
|
||
var inEditor = Webflow.env('editor');
|
||
|
||
if (match) {
|
||
// Remove brand when Editor is active
|
||
if (inEditor) {
|
||
found.remove();
|
||
} // Exit early, brand is in place
|
||
|
||
|
||
return;
|
||
} // Remove any invalid brand elements
|
||
|
||
|
||
if (found.length) {
|
||
found.remove();
|
||
} // Append the brand (unless Editor is active)
|
||
|
||
|
||
if (!inEditor) {
|
||
$body.append(brandElement);
|
||
}
|
||
} // Export module
|
||
|
||
|
||
return api;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 288 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals window */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: IX Event triggers for other modules
|
||
*/
|
||
// eslint-disable-next-line strict
|
||
|
||
|
||
var $ = window.jQuery;
|
||
var api = {};
|
||
var eventQueue = [];
|
||
var namespace = '.w-ix';
|
||
var eventTriggers = {
|
||
reset: function reset(i, el) {
|
||
el.__wf_intro = null;
|
||
},
|
||
intro: function intro(i, el) {
|
||
if (el.__wf_intro) {
|
||
return;
|
||
}
|
||
|
||
el.__wf_intro = true;
|
||
$(el).triggerHandler(api.types.INTRO);
|
||
},
|
||
outro: function outro(i, el) {
|
||
if (!el.__wf_intro) {
|
||
return;
|
||
}
|
||
|
||
el.__wf_intro = null;
|
||
$(el).triggerHandler(api.types.OUTRO);
|
||
}
|
||
};
|
||
api.triggers = {};
|
||
api.types = {
|
||
INTRO: 'w-ix-intro' + namespace,
|
||
OUTRO: 'w-ix-outro' + namespace
|
||
}; // Trigger any events in queue + restore trigger methods
|
||
|
||
api.init = function () {
|
||
var count = eventQueue.length;
|
||
|
||
for (var i = 0; i < count; i++) {
|
||
var memo = eventQueue[i];
|
||
memo[0](0, memo[1]);
|
||
}
|
||
|
||
eventQueue = [];
|
||
$.extend(api.triggers, eventTriggers);
|
||
}; // Replace all triggers with async wrapper to queue events until init
|
||
|
||
|
||
api.async = function () {
|
||
for (var key in eventTriggers) {
|
||
var func = eventTriggers[key];
|
||
|
||
if (!eventTriggers.hasOwnProperty(key)) {
|
||
continue;
|
||
} // Replace trigger method with async wrapper
|
||
|
||
|
||
api.triggers[key] = function (i, el) {
|
||
eventQueue.push([func, el]);
|
||
};
|
||
}
|
||
}; // Default triggers to async queue
|
||
|
||
|
||
api.async();
|
||
module.exports = api;
|
||
|
||
/***/ }),
|
||
/* 289 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Interactions 2
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
var ix2 = __webpack_require__(290);
|
||
|
||
ix2.setEnv(Webflow.env);
|
||
Webflow.define('ix2', module.exports = function () {
|
||
return ix2;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 290 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireWildcard = __webpack_require__(39);
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.setEnv = setEnv;
|
||
exports.init = init;
|
||
exports.destroy = destroy;
|
||
exports.actions = exports.store = void 0;
|
||
|
||
__webpack_require__(291);
|
||
|
||
var _redux = __webpack_require__(128);
|
||
|
||
var _IX2Reducer = _interopRequireDefault(__webpack_require__(305));
|
||
|
||
var _IX2VanillaEngine = __webpack_require__(146);
|
||
|
||
var actions = _interopRequireWildcard(__webpack_require__(87));
|
||
|
||
exports.actions = actions; // Array.includes needed for IE11 @packages/systems/ix2/shared/utils/quick-effects
|
||
|
||
var store = (0, _redux.createStore)(_IX2Reducer["default"]);
|
||
exports.store = store;
|
||
|
||
function setEnv(env) {
|
||
if (env()) {
|
||
(0, _IX2VanillaEngine.observeRequests)(store);
|
||
}
|
||
}
|
||
|
||
function init(rawData) {
|
||
destroy();
|
||
(0, _IX2VanillaEngine.startEngine)({
|
||
store: store,
|
||
rawData: rawData,
|
||
allowEvents: true
|
||
});
|
||
}
|
||
|
||
function destroy() {
|
||
(0, _IX2VanillaEngine.stopEngine)(store);
|
||
}
|
||
|
||
/***/ }),
|
||
/* 291 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__(292);
|
||
|
||
|
||
/***/ }),
|
||
/* 292 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
__webpack_require__(126);
|
||
var entryUnbind = __webpack_require__(293);
|
||
|
||
module.exports = entryUnbind('Array', 'includes');
|
||
|
||
|
||
/***/ }),
|
||
/* 293 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var global = __webpack_require__(7);
|
||
var bind = __webpack_require__(54);
|
||
|
||
var call = Function.call;
|
||
|
||
module.exports = function (CONSTRUCTOR, METHOD, length) {
|
||
return bind(call, global[CONSTRUCTOR].prototype[METHOD], length);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 294 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony import */ var _Symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(130);
|
||
/* harmony import */ var _getRawTag_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(297);
|
||
/* harmony import */ var _objectToString_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(298);
|
||
|
||
|
||
|
||
|
||
/** `Object#toString` result references. */
|
||
var nullTag = '[object Null]',
|
||
undefinedTag = '[object Undefined]';
|
||
|
||
/** Built-in value references. */
|
||
var symToStringTag = _Symbol_js__WEBPACK_IMPORTED_MODULE_0__["default"] ? _Symbol_js__WEBPACK_IMPORTED_MODULE_0__["default"].toStringTag : undefined;
|
||
|
||
/**
|
||
* The base implementation of `getTag` without fallbacks for buggy environments.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to query.
|
||
* @returns {string} Returns the `toStringTag`.
|
||
*/
|
||
function baseGetTag(value) {
|
||
if (value == null) {
|
||
return value === undefined ? undefinedTag : nullTag;
|
||
}
|
||
return (symToStringTag && symToStringTag in Object(value))
|
||
? Object(_getRawTag_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value)
|
||
: Object(_objectToString_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value);
|
||
}
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (baseGetTag);
|
||
|
||
|
||
/***/ }),
|
||
/* 295 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony import */ var _freeGlobal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(296);
|
||
|
||
|
||
/** Detect free variable `self`. */
|
||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||
|
||
/** Used as a reference to the global object. */
|
||
var root = _freeGlobal_js__WEBPACK_IMPORTED_MODULE_0__["default"] || freeSelf || Function('return this')();
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (root);
|
||
|
||
|
||
/***/ }),
|
||
/* 296 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
|
||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (freeGlobal);
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(44)))
|
||
|
||
/***/ }),
|
||
/* 297 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony import */ var _Symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(130);
|
||
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Used to resolve the
|
||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||
* of values.
|
||
*/
|
||
var nativeObjectToString = objectProto.toString;
|
||
|
||
/** Built-in value references. */
|
||
var symToStringTag = _Symbol_js__WEBPACK_IMPORTED_MODULE_0__["default"] ? _Symbol_js__WEBPACK_IMPORTED_MODULE_0__["default"].toStringTag : undefined;
|
||
|
||
/**
|
||
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to query.
|
||
* @returns {string} Returns the raw `toStringTag`.
|
||
*/
|
||
function getRawTag(value) {
|
||
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
||
tag = value[symToStringTag];
|
||
|
||
try {
|
||
value[symToStringTag] = undefined;
|
||
var unmasked = true;
|
||
} catch (e) {}
|
||
|
||
var result = nativeObjectToString.call(value);
|
||
if (unmasked) {
|
||
if (isOwn) {
|
||
value[symToStringTag] = tag;
|
||
} else {
|
||
delete value[symToStringTag];
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (getRawTag);
|
||
|
||
|
||
/***/ }),
|
||
/* 298 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/**
|
||
* Used to resolve the
|
||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||
* of values.
|
||
*/
|
||
var nativeObjectToString = objectProto.toString;
|
||
|
||
/**
|
||
* Converts `value` to a string using `Object.prototype.toString`.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to convert.
|
||
* @returns {string} Returns the converted string.
|
||
*/
|
||
function objectToString(value) {
|
||
return nativeObjectToString.call(value);
|
||
}
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (objectToString);
|
||
|
||
|
||
/***/ }),
|
||
/* 299 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony import */ var _overArg_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(300);
|
||
|
||
|
||
/** Built-in value references. */
|
||
var getPrototype = Object(_overArg_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Object.getPrototypeOf, Object);
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (getPrototype);
|
||
|
||
|
||
/***/ }),
|
||
/* 300 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/**
|
||
* Creates a unary function that invokes `func` with its argument transformed.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to wrap.
|
||
* @param {Function} transform The argument transform.
|
||
* @returns {Function} Returns the new function.
|
||
*/
|
||
function overArg(func, transform) {
|
||
return function(arg) {
|
||
return func(transform(arg));
|
||
};
|
||
}
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (overArg);
|
||
|
||
|
||
/***/ }),
|
||
/* 301 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/**
|
||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||
* and has a `typeof` result of "object".
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||
* @example
|
||
*
|
||
* _.isObjectLike({});
|
||
* // => true
|
||
*
|
||
* _.isObjectLike([1, 2, 3]);
|
||
* // => true
|
||
*
|
||
* _.isObjectLike(_.noop);
|
||
* // => false
|
||
*
|
||
* _.isObjectLike(null);
|
||
* // => false
|
||
*/
|
||
function isObjectLike(value) {
|
||
return value != null && typeof value == 'object';
|
||
}
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (isObjectLike);
|
||
|
||
|
||
/***/ }),
|
||
/* 302 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(304);
|
||
/* global window */
|
||
|
||
|
||
var root;
|
||
|
||
if (typeof self !== 'undefined') {
|
||
root = self;
|
||
} else if (typeof window !== 'undefined') {
|
||
root = window;
|
||
} else if (typeof global !== 'undefined') {
|
||
root = global;
|
||
} else if (true) {
|
||
root = module;
|
||
} else {}
|
||
|
||
var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__["default"])(root);
|
||
/* harmony default export */ __webpack_exports__["default"] = (result);
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(44), __webpack_require__(303)(module)))
|
||
|
||
/***/ }),
|
||
/* 303 */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = function(originalModule) {
|
||
if (!originalModule.webpackPolyfill) {
|
||
var module = Object.create(originalModule);
|
||
// module.parent = undefined by default
|
||
if (!module.children) module.children = [];
|
||
Object.defineProperty(module, "loaded", {
|
||
enumerable: true,
|
||
get: function() {
|
||
return module.l;
|
||
}
|
||
});
|
||
Object.defineProperty(module, "id", {
|
||
enumerable: true,
|
||
get: function() {
|
||
return module.i;
|
||
}
|
||
});
|
||
Object.defineProperty(module, "exports", {
|
||
enumerable: true
|
||
});
|
||
module.webpackPolyfill = 1;
|
||
}
|
||
return module;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 304 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
__webpack_require__.r(__webpack_exports__);
|
||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return symbolObservablePonyfill; });
|
||
function symbolObservablePonyfill(root) {
|
||
var result;
|
||
var Symbol = root.Symbol;
|
||
|
||
if (typeof Symbol === 'function') {
|
||
if (Symbol.observable) {
|
||
result = Symbol.observable;
|
||
} else {
|
||
result = Symbol('observable');
|
||
Symbol.observable = result;
|
||
}
|
||
} else {
|
||
result = '@@observable';
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 305 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports["default"] = void 0;
|
||
|
||
var _redux = __webpack_require__(128);
|
||
|
||
var _IX2DataReducer = __webpack_require__(306);
|
||
|
||
var _IX2RequestReducer = __webpack_require__(312);
|
||
|
||
var _IX2SessionReducer = __webpack_require__(313);
|
||
|
||
var _shared = __webpack_require__(30);
|
||
|
||
var _IX2InstancesReducer = __webpack_require__(331);
|
||
|
||
var _IX2ParametersReducer = __webpack_require__(332);
|
||
|
||
var ixElements = _shared.IX2ElementsReducer.ixElements;
|
||
|
||
var _default = (0, _redux.combineReducers)({
|
||
ixData: _IX2DataReducer.ixData,
|
||
ixRequest: _IX2RequestReducer.ixRequest,
|
||
ixSession: _IX2SessionReducer.ixSession,
|
||
ixElements: ixElements,
|
||
ixInstances: _IX2InstancesReducer.ixInstances,
|
||
ixParameters: _IX2ParametersReducer.ixParameters
|
||
});
|
||
|
||
exports["default"] = _default;
|
||
|
||
/***/ }),
|
||
/* 306 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ixData = void 0;
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var IX2_RAW_DATA_IMPORTED = _constants.IX2EngineActionTypes.IX2_RAW_DATA_IMPORTED;
|
||
|
||
var ixData = function ixData() {
|
||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Object.freeze({});
|
||
var action = arguments.length > 1 ? arguments[1] : undefined;
|
||
|
||
switch (action.type) {
|
||
case IX2_RAW_DATA_IMPORTED:
|
||
{
|
||
return action.payload.ixData || Object.freeze({});
|
||
}
|
||
|
||
default:
|
||
{
|
||
return state;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.ixData = ixData;
|
||
|
||
/***/ }),
|
||
/* 307 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.QuickEffectDirectionConsts = exports.QuickEffectIds = exports.EventLimitAffectedElements = exports.EventContinuousMouseAxes = exports.EventBasedOn = exports.EventAppliesTo = exports.EventTypeConsts = void 0;
|
||
/**
|
||
* Event Type IDs
|
||
*/
|
||
|
||
var EventTypeConsts = {
|
||
NAVBAR_OPEN: 'NAVBAR_OPEN',
|
||
NAVBAR_CLOSE: 'NAVBAR_CLOSE',
|
||
TAB_ACTIVE: 'TAB_ACTIVE',
|
||
TAB_INACTIVE: 'TAB_INACTIVE',
|
||
SLIDER_ACTIVE: 'SLIDER_ACTIVE',
|
||
SLIDER_INACTIVE: 'SLIDER_INACTIVE',
|
||
DROPDOWN_OPEN: 'DROPDOWN_OPEN',
|
||
DROPDOWN_CLOSE: 'DROPDOWN_CLOSE',
|
||
MOUSE_CLICK: 'MOUSE_CLICK',
|
||
MOUSE_SECOND_CLICK: 'MOUSE_SECOND_CLICK',
|
||
MOUSE_DOWN: 'MOUSE_DOWN',
|
||
MOUSE_UP: 'MOUSE_UP',
|
||
MOUSE_OVER: 'MOUSE_OVER',
|
||
MOUSE_OUT: 'MOUSE_OUT',
|
||
MOUSE_MOVE: 'MOUSE_MOVE',
|
||
MOUSE_MOVE_IN_VIEWPORT: 'MOUSE_MOVE_IN_VIEWPORT',
|
||
SCROLL_INTO_VIEW: 'SCROLL_INTO_VIEW',
|
||
SCROLL_OUT_OF_VIEW: 'SCROLL_OUT_OF_VIEW',
|
||
SCROLLING_IN_VIEW: 'SCROLLING_IN_VIEW',
|
||
ECOMMERCE_CART_OPEN: 'ECOMMERCE_CART_OPEN',
|
||
ECOMMERCE_CART_CLOSE: 'ECOMMERCE_CART_CLOSE',
|
||
PAGE_START: 'PAGE_START',
|
||
PAGE_FINISH: 'PAGE_FINISH',
|
||
PAGE_SCROLL_UP: 'PAGE_SCROLL_UP',
|
||
PAGE_SCROLL_DOWN: 'PAGE_SCROLL_DOWN',
|
||
PAGE_SCROLL: 'PAGE_SCROLL'
|
||
};
|
||
/**
|
||
* Event Config Enums
|
||
*/
|
||
|
||
exports.EventTypeConsts = EventTypeConsts;
|
||
var EventAppliesTo = {
|
||
ELEMENT: 'ELEMENT',
|
||
CLASS: 'CLASS',
|
||
PAGE: 'PAGE'
|
||
};
|
||
exports.EventAppliesTo = EventAppliesTo;
|
||
var EventBasedOn = {
|
||
ELEMENT: 'ELEMENT',
|
||
VIEWPORT: 'VIEWPORT'
|
||
};
|
||
exports.EventBasedOn = EventBasedOn;
|
||
var EventContinuousMouseAxes = {
|
||
X_AXIS: 'X_AXIS',
|
||
Y_AXIS: 'Y_AXIS'
|
||
};
|
||
exports.EventContinuousMouseAxes = EventContinuousMouseAxes;
|
||
var EventLimitAffectedElements = {
|
||
CHILDREN: 'CHILDREN',
|
||
SIBLINGS: 'SIBLINGS',
|
||
IMMEDIATE_CHILDREN: 'IMMEDIATE_CHILDREN'
|
||
};
|
||
/**
|
||
* Quick Effect Enums
|
||
*/
|
||
|
||
exports.EventLimitAffectedElements = EventLimitAffectedElements;
|
||
var QuickEffectIds = {
|
||
FADE_EFFECT: 'FADE_EFFECT',
|
||
SLIDE_EFFECT: 'SLIDE_EFFECT',
|
||
GROW_EFFECT: 'GROW_EFFECT',
|
||
SHRINK_EFFECT: 'SHRINK_EFFECT',
|
||
SPIN_EFFECT: 'SPIN_EFFECT',
|
||
FLY_EFFECT: 'FLY_EFFECT',
|
||
POP_EFFECT: 'POP_EFFECT',
|
||
FLIP_EFFECT: 'FLIP_EFFECT',
|
||
JIGGLE_EFFECT: 'JIGGLE_EFFECT',
|
||
PULSE_EFFECT: 'PULSE_EFFECT',
|
||
DROP_EFFECT: 'DROP_EFFECT',
|
||
BLINK_EFFECT: 'BLINK_EFFECT',
|
||
BOUNCE_EFFECT: 'BOUNCE_EFFECT',
|
||
FLIP_LEFT_TO_RIGHT_EFFECT: 'FLIP_LEFT_TO_RIGHT_EFFECT',
|
||
FLIP_RIGHT_TO_LEFT_EFFECT: 'FLIP_RIGHT_TO_LEFT_EFFECT',
|
||
RUBBER_BAND_EFFECT: 'RUBBER_BAND_EFFECT',
|
||
JELLO_EFFECT: 'JELLO_EFFECT',
|
||
GROW_BIG_EFFECT: 'GROW_BIG_EFFECT',
|
||
SHRINK_BIG_EFFECT: 'SHRINK_BIG_EFFECT',
|
||
PLUGIN_LOTTIE_EFFECT: 'PLUGIN_LOTTIE_EFFECT'
|
||
};
|
||
/**
|
||
* Quick Effect Direction Enums
|
||
*/
|
||
|
||
exports.QuickEffectIds = QuickEffectIds;
|
||
var QuickEffectDirectionConsts = {
|
||
LEFT: 'LEFT',
|
||
RIGHT: 'RIGHT',
|
||
BOTTOM: 'BOTTOM',
|
||
TOP: 'TOP',
|
||
BOTTOM_LEFT: 'BOTTOM_LEFT',
|
||
BOTTOM_RIGHT: 'BOTTOM_RIGHT',
|
||
TOP_RIGHT: 'TOP_RIGHT',
|
||
TOP_LEFT: 'TOP_LEFT',
|
||
CLOCKWISE: 'CLOCKWISE',
|
||
COUNTER_CLOCKWISE: 'COUNTER_CLOCKWISE'
|
||
};
|
||
exports.QuickEffectDirectionConsts = QuickEffectDirectionConsts;
|
||
|
||
/***/ }),
|
||
/* 308 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.InteractionTypeConsts = void 0;
|
||
var InteractionTypeConsts = {
|
||
MOUSE_CLICK_INTERACTION: 'MOUSE_CLICK_INTERACTION',
|
||
MOUSE_HOVER_INTERACTION: 'MOUSE_HOVER_INTERACTION',
|
||
MOUSE_MOVE_INTERACTION: 'MOUSE_MOVE_INTERACTION',
|
||
SCROLL_INTO_VIEW_INTERACTION: 'SCROLL_INTO_VIEW_INTERACTION',
|
||
SCROLLING_IN_VIEW_INTERACTION: 'SCROLLING_IN_VIEW_INTERACTION',
|
||
MOUSE_MOVE_IN_VIEWPORT_INTERACTION: 'MOUSE_MOVE_IN_VIEWPORT_INTERACTION',
|
||
PAGE_IS_SCROLLING_INTERACTION: 'PAGE_IS_SCROLLING_INTERACTION',
|
||
PAGE_LOAD_INTERACTION: 'PAGE_LOAD_INTERACTION',
|
||
PAGE_SCROLLED_INTERACTION: 'PAGE_SCROLLED_INTERACTION',
|
||
NAVBAR_INTERACTION: 'NAVBAR_INTERACTION',
|
||
DROPDOWN_INTERACTION: 'DROPDOWN_INTERACTION',
|
||
ECOMMERCE_CART_INTERACTION: 'ECOMMERCE_CART_INTERACTION',
|
||
TAB_INTERACTION: 'TAB_INTERACTION',
|
||
SLIDER_INTERACTION: 'SLIDER_INTERACTION'
|
||
};
|
||
exports.InteractionTypeConsts = InteractionTypeConsts;
|
||
|
||
/***/ }),
|
||
/* 309 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
var _defineProperty2 = _interopRequireDefault(__webpack_require__(24));
|
||
|
||
var _ReducedMotionTypes;
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ReducedMotionTypes = void 0;
|
||
|
||
var _animationActions = __webpack_require__(135);
|
||
|
||
var _animationActions$Act = _animationActions.ActionTypeConsts,
|
||
TRANSFORM_MOVE = _animationActions$Act.TRANSFORM_MOVE,
|
||
TRANSFORM_SCALE = _animationActions$Act.TRANSFORM_SCALE,
|
||
TRANSFORM_ROTATE = _animationActions$Act.TRANSFORM_ROTATE,
|
||
TRANSFORM_SKEW = _animationActions$Act.TRANSFORM_SKEW,
|
||
STYLE_SIZE = _animationActions$Act.STYLE_SIZE,
|
||
STYLE_FILTER = _animationActions$Act.STYLE_FILTER;
|
||
/**
|
||
* Reduced Motion: Action types to bypass during `prefers-reduced-motion`
|
||
*/
|
||
|
||
var ReducedMotionTypes = (_ReducedMotionTypes = {}, (0, _defineProperty2["default"])(_ReducedMotionTypes, TRANSFORM_MOVE, true), (0, _defineProperty2["default"])(_ReducedMotionTypes, TRANSFORM_SCALE, true), (0, _defineProperty2["default"])(_ReducedMotionTypes, TRANSFORM_ROTATE, true), (0, _defineProperty2["default"])(_ReducedMotionTypes, TRANSFORM_SKEW, true), (0, _defineProperty2["default"])(_ReducedMotionTypes, STYLE_SIZE, true), (0, _defineProperty2["default"])(_ReducedMotionTypes, STYLE_FILTER, true), _ReducedMotionTypes);
|
||
exports.ReducedMotionTypes = ReducedMotionTypes;
|
||
|
||
/***/ }),
|
||
/* 310 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.IX2_TEST_FRAME_RENDERED = exports.IX2_MEDIA_QUERIES_DEFINED = exports.IX2_VIEWPORT_WIDTH_CHANGED = exports.IX2_ACTION_LIST_PLAYBACK_CHANGED = exports.IX2_ELEMENT_STATE_CHANGED = exports.IX2_INSTANCE_REMOVED = exports.IX2_INSTANCE_STARTED = exports.IX2_INSTANCE_ADDED = exports.IX2_PARAMETER_CHANGED = exports.IX2_ANIMATION_FRAME_CHANGED = exports.IX2_EVENT_STATE_CHANGED = exports.IX2_EVENT_LISTENER_ADDED = exports.IX2_CLEAR_REQUESTED = exports.IX2_STOP_REQUESTED = exports.IX2_PLAYBACK_REQUESTED = exports.IX2_PREVIEW_REQUESTED = exports.IX2_SESSION_STOPPED = exports.IX2_SESSION_STARTED = exports.IX2_SESSION_INITIALIZED = exports.IX2_RAW_DATA_IMPORTED = void 0;
|
||
var IX2_RAW_DATA_IMPORTED = 'IX2_RAW_DATA_IMPORTED';
|
||
exports.IX2_RAW_DATA_IMPORTED = IX2_RAW_DATA_IMPORTED;
|
||
var IX2_SESSION_INITIALIZED = 'IX2_SESSION_INITIALIZED';
|
||
exports.IX2_SESSION_INITIALIZED = IX2_SESSION_INITIALIZED;
|
||
var IX2_SESSION_STARTED = 'IX2_SESSION_STARTED';
|
||
exports.IX2_SESSION_STARTED = IX2_SESSION_STARTED;
|
||
var IX2_SESSION_STOPPED = 'IX2_SESSION_STOPPED';
|
||
exports.IX2_SESSION_STOPPED = IX2_SESSION_STOPPED;
|
||
var IX2_PREVIEW_REQUESTED = 'IX2_PREVIEW_REQUESTED';
|
||
exports.IX2_PREVIEW_REQUESTED = IX2_PREVIEW_REQUESTED;
|
||
var IX2_PLAYBACK_REQUESTED = 'IX2_PLAYBACK_REQUESTED';
|
||
exports.IX2_PLAYBACK_REQUESTED = IX2_PLAYBACK_REQUESTED;
|
||
var IX2_STOP_REQUESTED = 'IX2_STOP_REQUESTED';
|
||
exports.IX2_STOP_REQUESTED = IX2_STOP_REQUESTED;
|
||
var IX2_CLEAR_REQUESTED = 'IX2_CLEAR_REQUESTED';
|
||
exports.IX2_CLEAR_REQUESTED = IX2_CLEAR_REQUESTED;
|
||
var IX2_EVENT_LISTENER_ADDED = 'IX2_EVENT_LISTENER_ADDED';
|
||
exports.IX2_EVENT_LISTENER_ADDED = IX2_EVENT_LISTENER_ADDED;
|
||
var IX2_EVENT_STATE_CHANGED = 'IX2_EVENT_STATE_CHANGED';
|
||
exports.IX2_EVENT_STATE_CHANGED = IX2_EVENT_STATE_CHANGED;
|
||
var IX2_ANIMATION_FRAME_CHANGED = 'IX2_ANIMATION_FRAME_CHANGED';
|
||
exports.IX2_ANIMATION_FRAME_CHANGED = IX2_ANIMATION_FRAME_CHANGED;
|
||
var IX2_PARAMETER_CHANGED = 'IX2_PARAMETER_CHANGED';
|
||
exports.IX2_PARAMETER_CHANGED = IX2_PARAMETER_CHANGED;
|
||
var IX2_INSTANCE_ADDED = 'IX2_INSTANCE_ADDED';
|
||
exports.IX2_INSTANCE_ADDED = IX2_INSTANCE_ADDED;
|
||
var IX2_INSTANCE_STARTED = 'IX2_INSTANCE_STARTED';
|
||
exports.IX2_INSTANCE_STARTED = IX2_INSTANCE_STARTED;
|
||
var IX2_INSTANCE_REMOVED = 'IX2_INSTANCE_REMOVED';
|
||
exports.IX2_INSTANCE_REMOVED = IX2_INSTANCE_REMOVED;
|
||
var IX2_ELEMENT_STATE_CHANGED = 'IX2_ELEMENT_STATE_CHANGED';
|
||
exports.IX2_ELEMENT_STATE_CHANGED = IX2_ELEMENT_STATE_CHANGED;
|
||
var IX2_ACTION_LIST_PLAYBACK_CHANGED = 'IX2_ACTION_LIST_PLAYBACK_CHANGED';
|
||
exports.IX2_ACTION_LIST_PLAYBACK_CHANGED = IX2_ACTION_LIST_PLAYBACK_CHANGED;
|
||
var IX2_VIEWPORT_WIDTH_CHANGED = 'IX2_VIEWPORT_WIDTH_CHANGED';
|
||
exports.IX2_VIEWPORT_WIDTH_CHANGED = IX2_VIEWPORT_WIDTH_CHANGED;
|
||
var IX2_MEDIA_QUERIES_DEFINED = 'IX2_MEDIA_QUERIES_DEFINED';
|
||
exports.IX2_MEDIA_QUERIES_DEFINED = IX2_MEDIA_QUERIES_DEFINED;
|
||
var IX2_TEST_FRAME_RENDERED = 'IX2_TEST_FRAME_RENDERED';
|
||
exports.IX2_TEST_FRAME_RENDERED = IX2_TEST_FRAME_RENDERED;
|
||
|
||
/***/ }),
|
||
/* 311 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.RENDER_PLUGIN = exports.RENDER_STYLE = exports.RENDER_GENERAL = exports.RENDER_TRANSFORM = exports.ABSTRACT_NODE = exports.PLAIN_OBJECT = exports.HTML_ELEMENT = exports.PRESERVE_3D = exports.PARENT = exports.SIBLINGS = exports.IMMEDIATE_CHILDREN = exports.CHILDREN = exports.BAR_DELIMITER = exports.COLON_DELIMITER = exports.COMMA_DELIMITER = exports.AUTO = exports.WILL_CHANGE = exports.FLEX = exports.DISPLAY = exports.COLOR = exports.BORDER_COLOR = exports.BACKGROUND = exports.BACKGROUND_COLOR = exports.HEIGHT = exports.WIDTH = exports.FILTER = exports.OPACITY = exports.SKEW_Y = exports.SKEW_X = exports.SKEW = exports.ROTATE_Z = exports.ROTATE_Y = exports.ROTATE_X = exports.SCALE_3D = exports.SCALE_Z = exports.SCALE_Y = exports.SCALE_X = exports.TRANSLATE_3D = exports.TRANSLATE_Z = exports.TRANSLATE_Y = exports.TRANSLATE_X = exports.TRANSFORM = exports.CONFIG_UNIT = exports.CONFIG_Z_UNIT = exports.CONFIG_Y_UNIT = exports.CONFIG_X_UNIT = exports.CONFIG_VALUE = exports.CONFIG_Z_VALUE = exports.CONFIG_Y_VALUE = exports.CONFIG_X_VALUE = exports.BOUNDARY_SELECTOR = exports.W_MOD_IX = exports.W_MOD_JS = exports.WF_PAGE = exports.IX2_ID_DELIMITER = void 0;
|
||
var IX2_ID_DELIMITER = '|';
|
||
exports.IX2_ID_DELIMITER = IX2_ID_DELIMITER;
|
||
var WF_PAGE = 'data-wf-page';
|
||
exports.WF_PAGE = WF_PAGE;
|
||
var W_MOD_JS = 'w-mod-js';
|
||
exports.W_MOD_JS = W_MOD_JS;
|
||
var W_MOD_IX = 'w-mod-ix';
|
||
exports.W_MOD_IX = W_MOD_IX;
|
||
var BOUNDARY_SELECTOR = '.w-dyn-item';
|
||
exports.BOUNDARY_SELECTOR = BOUNDARY_SELECTOR;
|
||
var CONFIG_X_VALUE = 'xValue';
|
||
exports.CONFIG_X_VALUE = CONFIG_X_VALUE;
|
||
var CONFIG_Y_VALUE = 'yValue';
|
||
exports.CONFIG_Y_VALUE = CONFIG_Y_VALUE;
|
||
var CONFIG_Z_VALUE = 'zValue';
|
||
exports.CONFIG_Z_VALUE = CONFIG_Z_VALUE;
|
||
var CONFIG_VALUE = 'value';
|
||
exports.CONFIG_VALUE = CONFIG_VALUE;
|
||
var CONFIG_X_UNIT = 'xUnit';
|
||
exports.CONFIG_X_UNIT = CONFIG_X_UNIT;
|
||
var CONFIG_Y_UNIT = 'yUnit';
|
||
exports.CONFIG_Y_UNIT = CONFIG_Y_UNIT;
|
||
var CONFIG_Z_UNIT = 'zUnit';
|
||
exports.CONFIG_Z_UNIT = CONFIG_Z_UNIT;
|
||
var CONFIG_UNIT = 'unit';
|
||
exports.CONFIG_UNIT = CONFIG_UNIT;
|
||
var TRANSFORM = 'transform';
|
||
exports.TRANSFORM = TRANSFORM;
|
||
var TRANSLATE_X = 'translateX';
|
||
exports.TRANSLATE_X = TRANSLATE_X;
|
||
var TRANSLATE_Y = 'translateY';
|
||
exports.TRANSLATE_Y = TRANSLATE_Y;
|
||
var TRANSLATE_Z = 'translateZ';
|
||
exports.TRANSLATE_Z = TRANSLATE_Z;
|
||
var TRANSLATE_3D = 'translate3d';
|
||
exports.TRANSLATE_3D = TRANSLATE_3D;
|
||
var SCALE_X = 'scaleX';
|
||
exports.SCALE_X = SCALE_X;
|
||
var SCALE_Y = 'scaleY';
|
||
exports.SCALE_Y = SCALE_Y;
|
||
var SCALE_Z = 'scaleZ';
|
||
exports.SCALE_Z = SCALE_Z;
|
||
var SCALE_3D = 'scale3d';
|
||
exports.SCALE_3D = SCALE_3D;
|
||
var ROTATE_X = 'rotateX';
|
||
exports.ROTATE_X = ROTATE_X;
|
||
var ROTATE_Y = 'rotateY';
|
||
exports.ROTATE_Y = ROTATE_Y;
|
||
var ROTATE_Z = 'rotateZ';
|
||
exports.ROTATE_Z = ROTATE_Z;
|
||
var SKEW = 'skew';
|
||
exports.SKEW = SKEW;
|
||
var SKEW_X = 'skewX';
|
||
exports.SKEW_X = SKEW_X;
|
||
var SKEW_Y = 'skewY';
|
||
exports.SKEW_Y = SKEW_Y;
|
||
var OPACITY = 'opacity';
|
||
exports.OPACITY = OPACITY;
|
||
var FILTER = 'filter';
|
||
exports.FILTER = FILTER;
|
||
var WIDTH = 'width';
|
||
exports.WIDTH = WIDTH;
|
||
var HEIGHT = 'height';
|
||
exports.HEIGHT = HEIGHT;
|
||
var BACKGROUND_COLOR = 'backgroundColor';
|
||
exports.BACKGROUND_COLOR = BACKGROUND_COLOR;
|
||
var BACKGROUND = 'background';
|
||
exports.BACKGROUND = BACKGROUND;
|
||
var BORDER_COLOR = 'borderColor';
|
||
exports.BORDER_COLOR = BORDER_COLOR;
|
||
var COLOR = 'color';
|
||
exports.COLOR = COLOR;
|
||
var DISPLAY = 'display';
|
||
exports.DISPLAY = DISPLAY;
|
||
var FLEX = 'flex';
|
||
exports.FLEX = FLEX;
|
||
var WILL_CHANGE = 'willChange';
|
||
exports.WILL_CHANGE = WILL_CHANGE;
|
||
var AUTO = 'AUTO';
|
||
exports.AUTO = AUTO;
|
||
var COMMA_DELIMITER = ',';
|
||
exports.COMMA_DELIMITER = COMMA_DELIMITER;
|
||
var COLON_DELIMITER = ':';
|
||
exports.COLON_DELIMITER = COLON_DELIMITER;
|
||
var BAR_DELIMITER = '|';
|
||
exports.BAR_DELIMITER = BAR_DELIMITER;
|
||
var CHILDREN = 'CHILDREN';
|
||
exports.CHILDREN = CHILDREN;
|
||
var IMMEDIATE_CHILDREN = 'IMMEDIATE_CHILDREN';
|
||
exports.IMMEDIATE_CHILDREN = IMMEDIATE_CHILDREN;
|
||
var SIBLINGS = 'SIBLINGS';
|
||
exports.SIBLINGS = SIBLINGS;
|
||
var PARENT = 'PARENT';
|
||
exports.PARENT = PARENT;
|
||
var PRESERVE_3D = 'preserve-3d';
|
||
exports.PRESERVE_3D = PRESERVE_3D;
|
||
var HTML_ELEMENT = 'HTML_ELEMENT';
|
||
exports.HTML_ELEMENT = HTML_ELEMENT;
|
||
var PLAIN_OBJECT = 'PLAIN_OBJECT';
|
||
exports.PLAIN_OBJECT = PLAIN_OBJECT;
|
||
var ABSTRACT_NODE = 'ABSTRACT_NODE';
|
||
exports.ABSTRACT_NODE = ABSTRACT_NODE;
|
||
var RENDER_TRANSFORM = 'RENDER_TRANSFORM';
|
||
exports.RENDER_TRANSFORM = RENDER_TRANSFORM;
|
||
var RENDER_GENERAL = 'RENDER_GENERAL';
|
||
exports.RENDER_GENERAL = RENDER_GENERAL;
|
||
var RENDER_STYLE = 'RENDER_STYLE';
|
||
exports.RENDER_STYLE = RENDER_STYLE;
|
||
var RENDER_PLUGIN = 'RENDER_PLUGIN';
|
||
exports.RENDER_PLUGIN = RENDER_PLUGIN;
|
||
|
||
/***/ }),
|
||
/* 312 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault2 = __webpack_require__(1);
|
||
|
||
var _defineProperty2 = _interopRequireDefault2(__webpack_require__(24));
|
||
|
||
var _Object$create;
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ixRequest = void 0;
|
||
|
||
var _extends2 = _interopRequireDefault(__webpack_require__(31));
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _timm = __webpack_require__(40);
|
||
|
||
var _constants$IX2EngineA = _constants.IX2EngineActionTypes,
|
||
IX2_PREVIEW_REQUESTED = _constants$IX2EngineA.IX2_PREVIEW_REQUESTED,
|
||
IX2_PLAYBACK_REQUESTED = _constants$IX2EngineA.IX2_PLAYBACK_REQUESTED,
|
||
IX2_STOP_REQUESTED = _constants$IX2EngineA.IX2_STOP_REQUESTED,
|
||
IX2_CLEAR_REQUESTED = _constants$IX2EngineA.IX2_CLEAR_REQUESTED;
|
||
var initialState = {
|
||
preview: {},
|
||
playback: {},
|
||
stop: {},
|
||
clear: {}
|
||
};
|
||
var stateKeys = Object.create(null, (_Object$create = {}, (0, _defineProperty2["default"])(_Object$create, IX2_PREVIEW_REQUESTED, {
|
||
value: 'preview'
|
||
}), (0, _defineProperty2["default"])(_Object$create, IX2_PLAYBACK_REQUESTED, {
|
||
value: 'playback'
|
||
}), (0, _defineProperty2["default"])(_Object$create, IX2_STOP_REQUESTED, {
|
||
value: 'stop'
|
||
}), (0, _defineProperty2["default"])(_Object$create, IX2_CLEAR_REQUESTED, {
|
||
value: 'clear'
|
||
}), _Object$create));
|
||
|
||
var ixRequest = function ixRequest() {
|
||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
||
var action = arguments.length > 1 ? arguments[1] : undefined;
|
||
|
||
if (action.type in stateKeys) {
|
||
var key = [stateKeys[action.type]];
|
||
return (0, _timm.setIn)(state, [key], (0, _extends2["default"])({}, action.payload));
|
||
}
|
||
|
||
return state;
|
||
};
|
||
|
||
exports.ixRequest = ixRequest;
|
||
|
||
/***/ }),
|
||
/* 313 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ixSession = void 0;
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _timm = __webpack_require__(40);
|
||
|
||
var _constants$IX2EngineA = _constants.IX2EngineActionTypes,
|
||
IX2_SESSION_INITIALIZED = _constants$IX2EngineA.IX2_SESSION_INITIALIZED,
|
||
IX2_SESSION_STARTED = _constants$IX2EngineA.IX2_SESSION_STARTED,
|
||
IX2_TEST_FRAME_RENDERED = _constants$IX2EngineA.IX2_TEST_FRAME_RENDERED,
|
||
IX2_SESSION_STOPPED = _constants$IX2EngineA.IX2_SESSION_STOPPED,
|
||
IX2_EVENT_LISTENER_ADDED = _constants$IX2EngineA.IX2_EVENT_LISTENER_ADDED,
|
||
IX2_EVENT_STATE_CHANGED = _constants$IX2EngineA.IX2_EVENT_STATE_CHANGED,
|
||
IX2_ANIMATION_FRAME_CHANGED = _constants$IX2EngineA.IX2_ANIMATION_FRAME_CHANGED,
|
||
IX2_ACTION_LIST_PLAYBACK_CHANGED = _constants$IX2EngineA.IX2_ACTION_LIST_PLAYBACK_CHANGED,
|
||
IX2_VIEWPORT_WIDTH_CHANGED = _constants$IX2EngineA.IX2_VIEWPORT_WIDTH_CHANGED,
|
||
IX2_MEDIA_QUERIES_DEFINED = _constants$IX2EngineA.IX2_MEDIA_QUERIES_DEFINED;
|
||
var initialState = {
|
||
active: false,
|
||
tick: 0,
|
||
eventListeners: [],
|
||
eventState: {},
|
||
playbackState: {},
|
||
viewportWidth: 0,
|
||
mediaQueryKey: null,
|
||
hasBoundaryNodes: false,
|
||
hasDefinedMediaQueries: false,
|
||
reducedMotion: false
|
||
};
|
||
var TEST_FRAME_STEPS_SIZE = 20; // $FlowFixMe
|
||
|
||
var ixSession = function ixSession() {
|
||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
||
var action = arguments.length > 1 ? arguments[1] : undefined;
|
||
|
||
switch (action.type) {
|
||
case IX2_SESSION_INITIALIZED:
|
||
{
|
||
var _action$payload = action.payload,
|
||
hasBoundaryNodes = _action$payload.hasBoundaryNodes,
|
||
reducedMotion = _action$payload.reducedMotion;
|
||
return (0, _timm.merge)(state, {
|
||
hasBoundaryNodes: hasBoundaryNodes,
|
||
reducedMotion: reducedMotion
|
||
});
|
||
}
|
||
|
||
case IX2_SESSION_STARTED:
|
||
{
|
||
return (0, _timm.set)(state, 'active', true);
|
||
}
|
||
|
||
case IX2_TEST_FRAME_RENDERED:
|
||
{
|
||
var _action$payload$step = action.payload.step,
|
||
step = _action$payload$step === void 0 ? TEST_FRAME_STEPS_SIZE : _action$payload$step;
|
||
return (0, _timm.set)(state, 'tick', state.tick + step);
|
||
}
|
||
|
||
case IX2_SESSION_STOPPED:
|
||
{
|
||
return initialState;
|
||
}
|
||
|
||
case IX2_ANIMATION_FRAME_CHANGED:
|
||
{
|
||
var now = action.payload.now;
|
||
return (0, _timm.set)(state, 'tick', now);
|
||
}
|
||
|
||
case IX2_EVENT_LISTENER_ADDED:
|
||
{
|
||
var eventListeners = (0, _timm.addLast)(state.eventListeners, action.payload);
|
||
return (0, _timm.set)(state, 'eventListeners', eventListeners);
|
||
}
|
||
|
||
case IX2_EVENT_STATE_CHANGED:
|
||
{
|
||
var _action$payload2 = action.payload,
|
||
stateKey = _action$payload2.stateKey,
|
||
newState = _action$payload2.newState;
|
||
return (0, _timm.setIn)(state, ['eventState', stateKey], newState);
|
||
}
|
||
|
||
case IX2_ACTION_LIST_PLAYBACK_CHANGED:
|
||
{
|
||
var _action$payload3 = action.payload,
|
||
actionListId = _action$payload3.actionListId,
|
||
isPlaying = _action$payload3.isPlaying;
|
||
return (0, _timm.setIn)(state, ['playbackState', actionListId], isPlaying);
|
||
}
|
||
|
||
case IX2_VIEWPORT_WIDTH_CHANGED:
|
||
{
|
||
var _action$payload4 = action.payload,
|
||
width = _action$payload4.width,
|
||
mediaQueries = _action$payload4.mediaQueries;
|
||
var mediaQueryCount = mediaQueries.length;
|
||
var mediaQueryKey = null;
|
||
|
||
for (var i = 0; i < mediaQueryCount; i++) {
|
||
var _mediaQueries$i = mediaQueries[i],
|
||
key = _mediaQueries$i.key,
|
||
min = _mediaQueries$i.min,
|
||
max = _mediaQueries$i.max;
|
||
|
||
if (width >= min && width <= max) {
|
||
mediaQueryKey = key;
|
||
break;
|
||
}
|
||
}
|
||
|
||
return (0, _timm.merge)(state, {
|
||
viewportWidth: width,
|
||
mediaQueryKey: mediaQueryKey
|
||
});
|
||
}
|
||
|
||
case IX2_MEDIA_QUERIES_DEFINED:
|
||
{
|
||
return (0, _timm.set)(state, 'hasDefinedMediaQueries', true);
|
||
}
|
||
|
||
default:
|
||
{
|
||
return state;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.ixSession = ixSession;
|
||
|
||
/***/ }),
|
||
/* 314 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _arrayWithoutHoles(arr) {
|
||
if (Array.isArray(arr)) {
|
||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
||
arr2[i] = arr[i];
|
||
}
|
||
|
||
return arr2;
|
||
}
|
||
}
|
||
|
||
module.exports = _arrayWithoutHoles;
|
||
|
||
/***/ }),
|
||
/* 315 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _iterableToArray(iter) {
|
||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
||
}
|
||
|
||
module.exports = _iterableToArray;
|
||
|
||
/***/ }),
|
||
/* 316 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _nonIterableSpread() {
|
||
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
||
}
|
||
|
||
module.exports = _nonIterableSpread;
|
||
|
||
/***/ }),
|
||
/* 317 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.createElementState = createElementState;
|
||
exports.mergeActionState = mergeActionState;
|
||
exports.ixElements = void 0;
|
||
|
||
var _timm = __webpack_require__(40);
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _constants$IX2EngineC = _constants.IX2EngineConstants,
|
||
HTML_ELEMENT = _constants$IX2EngineC.HTML_ELEMENT,
|
||
PLAIN_OBJECT = _constants$IX2EngineC.PLAIN_OBJECT,
|
||
ABSTRACT_NODE = _constants$IX2EngineC.ABSTRACT_NODE,
|
||
CONFIG_X_VALUE = _constants$IX2EngineC.CONFIG_X_VALUE,
|
||
CONFIG_Y_VALUE = _constants$IX2EngineC.CONFIG_Y_VALUE,
|
||
CONFIG_Z_VALUE = _constants$IX2EngineC.CONFIG_Z_VALUE,
|
||
CONFIG_VALUE = _constants$IX2EngineC.CONFIG_VALUE,
|
||
CONFIG_X_UNIT = _constants$IX2EngineC.CONFIG_X_UNIT,
|
||
CONFIG_Y_UNIT = _constants$IX2EngineC.CONFIG_Y_UNIT,
|
||
CONFIG_Z_UNIT = _constants$IX2EngineC.CONFIG_Z_UNIT,
|
||
CONFIG_UNIT = _constants$IX2EngineC.CONFIG_UNIT;
|
||
var _constants$IX2EngineA = _constants.IX2EngineActionTypes,
|
||
IX2_SESSION_STOPPED = _constants$IX2EngineA.IX2_SESSION_STOPPED,
|
||
IX2_INSTANCE_ADDED = _constants$IX2EngineA.IX2_INSTANCE_ADDED,
|
||
IX2_ELEMENT_STATE_CHANGED = _constants$IX2EngineA.IX2_ELEMENT_STATE_CHANGED;
|
||
var initialState = {};
|
||
var refState = 'refState';
|
||
|
||
var ixElements = function ixElements() {
|
||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
||
var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
|
||
switch (action.type) {
|
||
case IX2_SESSION_STOPPED:
|
||
{
|
||
return initialState;
|
||
}
|
||
|
||
case IX2_INSTANCE_ADDED:
|
||
{
|
||
var _action$payload = action.payload,
|
||
elementId = _action$payload.elementId,
|
||
ref = _action$payload.element,
|
||
origin = _action$payload.origin,
|
||
actionItem = _action$payload.actionItem,
|
||
refType = _action$payload.refType;
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
var newState = state; // Create new ref entry if it doesn't exist
|
||
|
||
if ((0, _timm.getIn)(newState, [elementId, ref]) !== ref) {
|
||
newState = createElementState(newState, ref, refType, elementId, actionItem);
|
||
} // Merge origin values into ref state
|
||
|
||
|
||
return mergeActionState(newState, elementId, actionTypeId, origin, actionItem);
|
||
}
|
||
|
||
case IX2_ELEMENT_STATE_CHANGED:
|
||
{
|
||
var _action$payload2 = action.payload,
|
||
_elementId = _action$payload2.elementId,
|
||
_actionTypeId = _action$payload2.actionTypeId,
|
||
current = _action$payload2.current,
|
||
_actionItem = _action$payload2.actionItem;
|
||
return mergeActionState(state, _elementId, _actionTypeId, current, _actionItem);
|
||
}
|
||
|
||
default:
|
||
{
|
||
return state;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.ixElements = ixElements;
|
||
|
||
function createElementState(state, ref, refType, elementId, actionItem) {
|
||
var refId = refType === PLAIN_OBJECT ? (0, _timm.getIn)(actionItem, ['config', 'target', 'objectId']) : null;
|
||
return (0, _timm.mergeIn)(state, [elementId], {
|
||
id: elementId,
|
||
ref: ref,
|
||
refId: refId,
|
||
refType: refType
|
||
});
|
||
}
|
||
|
||
function mergeActionState(state, elementId, actionTypeId, actionState, // FIXME: weak type is used
|
||
actionItem) {
|
||
var units = pickUnits(actionItem);
|
||
var mergePath = [elementId, refState, actionTypeId];
|
||
return (0, _timm.mergeIn)(state, mergePath, actionState, units);
|
||
}
|
||
|
||
var valueUnitPairs = [[CONFIG_X_VALUE, CONFIG_X_UNIT], [CONFIG_Y_VALUE, CONFIG_Y_UNIT], [CONFIG_Z_VALUE, CONFIG_Z_UNIT], [CONFIG_VALUE, CONFIG_UNIT]]; // FIXME: weak type is used
|
||
// eslint-disable-next-line flowtype/no-weak-types
|
||
|
||
function pickUnits(actionItem) {
|
||
var config = actionItem.config;
|
||
return valueUnitPairs.reduce(function (result, pair) {
|
||
var valueKey = pair[0];
|
||
var unitKey = pair[1];
|
||
var configValue = config[valueKey];
|
||
var configUnit = config[unitKey];
|
||
|
||
if (configValue != null && configUnit != null) {
|
||
result[unitKey] = configUnit;
|
||
}
|
||
|
||
return result;
|
||
}, {});
|
||
}
|
||
|
||
/***/ }),
|
||
/* 318 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.clearPlugin = exports.renderPlugin = exports.createPluginInstance = exports.getPluginDestination = exports.getPluginOrigin = exports.getPluginDuration = exports.getPluginConfig = void 0;
|
||
/* eslint-env browser */
|
||
// $FlowFixMe
|
||
|
||
var getPluginConfig = function getPluginConfig(actionItemConfig) {
|
||
return actionItemConfig.value;
|
||
}; // $FlowFixMe
|
||
|
||
|
||
exports.getPluginConfig = getPluginConfig;
|
||
|
||
var getPluginDuration = function getPluginDuration(element, actionItem) {
|
||
if (actionItem.config.duration !== 'auto') {
|
||
return null;
|
||
}
|
||
|
||
var duration = parseFloat(element.getAttribute('data-duration'));
|
||
|
||
if (duration > 0) {
|
||
return duration * 1000;
|
||
}
|
||
|
||
return parseFloat(element.getAttribute('data-default-duration')) * 1000;
|
||
}; // $FlowFixMe
|
||
|
||
|
||
exports.getPluginDuration = getPluginDuration;
|
||
|
||
var getPluginOrigin = function getPluginOrigin(refState) {
|
||
return refState || {
|
||
value: 0
|
||
};
|
||
}; // $FlowFixMe
|
||
|
||
|
||
exports.getPluginOrigin = getPluginOrigin;
|
||
|
||
var getPluginDestination = function getPluginDestination(actionItemConfig) {
|
||
return {
|
||
value: actionItemConfig.value
|
||
};
|
||
}; // $FlowFixMe
|
||
|
||
|
||
exports.getPluginDestination = getPluginDestination;
|
||
|
||
var createPluginInstance = function createPluginInstance(element) {
|
||
var instance = window.Webflow.require('lottie').createInstance(element);
|
||
|
||
instance.stop();
|
||
instance.setSubframe(true);
|
||
return instance;
|
||
}; // $FlowFixMe
|
||
|
||
|
||
exports.createPluginInstance = createPluginInstance;
|
||
|
||
var renderPlugin = function renderPlugin(pluginInstance, refState, actionItem) {
|
||
if (!pluginInstance) {
|
||
return;
|
||
}
|
||
|
||
var percent = refState[actionItem.actionTypeId].value / 100;
|
||
pluginInstance.goToFrame(pluginInstance.frames * percent);
|
||
}; // $FlowFixMe
|
||
|
||
|
||
exports.renderPlugin = renderPlugin;
|
||
|
||
var clearPlugin = function clearPlugin(element) {
|
||
var instance = window.Webflow.require('lottie').createInstance(element);
|
||
|
||
instance.stop();
|
||
};
|
||
|
||
exports.clearPlugin = clearPlugin;
|
||
|
||
/***/ }),
|
||
/* 319 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault2 = __webpack_require__(1);
|
||
|
||
var _typeof2 = _interopRequireDefault2(__webpack_require__(41));
|
||
|
||
var _defineProperty2 = _interopRequireDefault2(__webpack_require__(24));
|
||
|
||
var _Object$freeze, _Object$freeze2, _transformDefaults;
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.getInstanceId = getInstanceId;
|
||
exports.getElementId = getElementId;
|
||
exports.reifyState = reifyState;
|
||
exports.observeStore = observeStore;
|
||
exports.getAffectedElements = getAffectedElements;
|
||
exports.getComputedStyle = getComputedStyle;
|
||
exports.getInstanceOrigin = getInstanceOrigin;
|
||
exports.getDestinationValues = getDestinationValues;
|
||
exports.getRenderType = getRenderType;
|
||
exports.getStyleProp = getStyleProp;
|
||
exports.renderHTMLElement = renderHTMLElement;
|
||
exports.clearAllStyles = clearAllStyles;
|
||
exports.cleanupHTMLElement = cleanupHTMLElement;
|
||
exports.getMaxDurationItemIndex = getMaxDurationItemIndex;
|
||
exports.getActionListProgress = getActionListProgress;
|
||
exports.reduceListToGroup = reduceListToGroup;
|
||
exports.shouldNamespaceEventParameter = shouldNamespaceEventParameter;
|
||
exports.getNamespacedParameterId = getNamespacedParameterId;
|
||
exports.shouldAllowMediaQuery = shouldAllowMediaQuery;
|
||
exports.mediaQueriesEqual = mediaQueriesEqual;
|
||
exports.stringifyTarget = stringifyTarget;
|
||
exports.getItemConfigByKey = void 0;
|
||
|
||
var _defaultTo = _interopRequireDefault(__webpack_require__(320));
|
||
|
||
var _reduce = _interopRequireDefault(__webpack_require__(321));
|
||
|
||
var _findLast = _interopRequireDefault(__webpack_require__(327));
|
||
|
||
var _timm = __webpack_require__(40);
|
||
|
||
var _shallowEqual = _interopRequireDefault(__webpack_require__(145));
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _IX2EasingUtils = __webpack_require__(140);
|
||
|
||
var _IX2VanillaPlugins = __webpack_require__(142);
|
||
|
||
var _IX2BrowserSupport = __webpack_require__(86);
|
||
/* eslint-env browser */
|
||
|
||
|
||
var _constants$IX2EngineC = _constants.IX2EngineConstants,
|
||
BACKGROUND = _constants$IX2EngineC.BACKGROUND,
|
||
TRANSFORM = _constants$IX2EngineC.TRANSFORM,
|
||
TRANSLATE_3D = _constants$IX2EngineC.TRANSLATE_3D,
|
||
SCALE_3D = _constants$IX2EngineC.SCALE_3D,
|
||
ROTATE_X = _constants$IX2EngineC.ROTATE_X,
|
||
ROTATE_Y = _constants$IX2EngineC.ROTATE_Y,
|
||
ROTATE_Z = _constants$IX2EngineC.ROTATE_Z,
|
||
SKEW = _constants$IX2EngineC.SKEW,
|
||
PRESERVE_3D = _constants$IX2EngineC.PRESERVE_3D,
|
||
FLEX = _constants$IX2EngineC.FLEX,
|
||
OPACITY = _constants$IX2EngineC.OPACITY,
|
||
FILTER = _constants$IX2EngineC.FILTER,
|
||
WIDTH = _constants$IX2EngineC.WIDTH,
|
||
HEIGHT = _constants$IX2EngineC.HEIGHT,
|
||
BACKGROUND_COLOR = _constants$IX2EngineC.BACKGROUND_COLOR,
|
||
BORDER_COLOR = _constants$IX2EngineC.BORDER_COLOR,
|
||
COLOR = _constants$IX2EngineC.COLOR,
|
||
CHILDREN = _constants$IX2EngineC.CHILDREN,
|
||
IMMEDIATE_CHILDREN = _constants$IX2EngineC.IMMEDIATE_CHILDREN,
|
||
SIBLINGS = _constants$IX2EngineC.SIBLINGS,
|
||
PARENT = _constants$IX2EngineC.PARENT,
|
||
DISPLAY = _constants$IX2EngineC.DISPLAY,
|
||
WILL_CHANGE = _constants$IX2EngineC.WILL_CHANGE,
|
||
AUTO = _constants$IX2EngineC.AUTO,
|
||
COMMA_DELIMITER = _constants$IX2EngineC.COMMA_DELIMITER,
|
||
COLON_DELIMITER = _constants$IX2EngineC.COLON_DELIMITER,
|
||
BAR_DELIMITER = _constants$IX2EngineC.BAR_DELIMITER,
|
||
RENDER_TRANSFORM = _constants$IX2EngineC.RENDER_TRANSFORM,
|
||
RENDER_GENERAL = _constants$IX2EngineC.RENDER_GENERAL,
|
||
RENDER_STYLE = _constants$IX2EngineC.RENDER_STYLE,
|
||
RENDER_PLUGIN = _constants$IX2EngineC.RENDER_PLUGIN;
|
||
var _constants$ActionType = _constants.ActionTypeConsts,
|
||
TRANSFORM_MOVE = _constants$ActionType.TRANSFORM_MOVE,
|
||
TRANSFORM_SCALE = _constants$ActionType.TRANSFORM_SCALE,
|
||
TRANSFORM_ROTATE = _constants$ActionType.TRANSFORM_ROTATE,
|
||
TRANSFORM_SKEW = _constants$ActionType.TRANSFORM_SKEW,
|
||
STYLE_OPACITY = _constants$ActionType.STYLE_OPACITY,
|
||
STYLE_FILTER = _constants$ActionType.STYLE_FILTER,
|
||
STYLE_SIZE = _constants$ActionType.STYLE_SIZE,
|
||
STYLE_BACKGROUND_COLOR = _constants$ActionType.STYLE_BACKGROUND_COLOR,
|
||
STYLE_BORDER = _constants$ActionType.STYLE_BORDER,
|
||
STYLE_TEXT_COLOR = _constants$ActionType.STYLE_TEXT_COLOR,
|
||
GENERAL_DISPLAY = _constants$ActionType.GENERAL_DISPLAY;
|
||
var OBJECT_VALUE = 'OBJECT_VALUE';
|
||
|
||
var trim = function trim(v) {
|
||
return v.trim();
|
||
};
|
||
|
||
var colorStyleProps = Object.freeze((_Object$freeze = {}, (0, _defineProperty2["default"])(_Object$freeze, STYLE_BACKGROUND_COLOR, BACKGROUND_COLOR), (0, _defineProperty2["default"])(_Object$freeze, STYLE_BORDER, BORDER_COLOR), (0, _defineProperty2["default"])(_Object$freeze, STYLE_TEXT_COLOR, COLOR), _Object$freeze));
|
||
var willChangeProps = Object.freeze((_Object$freeze2 = {}, (0, _defineProperty2["default"])(_Object$freeze2, _IX2BrowserSupport.TRANSFORM_PREFIXED, TRANSFORM), (0, _defineProperty2["default"])(_Object$freeze2, BACKGROUND_COLOR, BACKGROUND), (0, _defineProperty2["default"])(_Object$freeze2, OPACITY, OPACITY), (0, _defineProperty2["default"])(_Object$freeze2, FILTER, FILTER), (0, _defineProperty2["default"])(_Object$freeze2, WIDTH, WIDTH), (0, _defineProperty2["default"])(_Object$freeze2, HEIGHT, HEIGHT), _Object$freeze2));
|
||
var objectCache = {};
|
||
var instanceCount = 1;
|
||
|
||
function getInstanceId() {
|
||
return 'i' + instanceCount++;
|
||
}
|
||
|
||
var elementCount = 1; // $FlowFixMe
|
||
|
||
function getElementId(ixElements, ref) {
|
||
// TODO: optimize element lookup
|
||
for (var key in ixElements) {
|
||
var ixEl = ixElements[key];
|
||
|
||
if (ixEl && ixEl.ref === ref) {
|
||
return ixEl.id;
|
||
}
|
||
}
|
||
|
||
return 'e' + elementCount++;
|
||
} // $FlowFixMe
|
||
|
||
|
||
function reifyState() {
|
||
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||
events = _ref2.events,
|
||
actionLists = _ref2.actionLists,
|
||
site = _ref2.site;
|
||
|
||
var eventTypeMap = (0, _reduce["default"])(events, function (result, event) {
|
||
var eventTypeId = event.eventTypeId;
|
||
|
||
if (!result[eventTypeId]) {
|
||
result[eventTypeId] = {};
|
||
}
|
||
|
||
result[eventTypeId][event.id] = event;
|
||
return result;
|
||
}, {});
|
||
var mediaQueries = site && site.mediaQueries;
|
||
var mediaQueryKeys = [];
|
||
|
||
if (mediaQueries) {
|
||
mediaQueryKeys = mediaQueries.map(function (mq) {
|
||
return mq.key;
|
||
});
|
||
} else {
|
||
mediaQueries = [];
|
||
console.warn("IX2 missing mediaQueries in site data");
|
||
}
|
||
|
||
return {
|
||
ixData: {
|
||
events: events,
|
||
actionLists: actionLists,
|
||
eventTypeMap: eventTypeMap,
|
||
mediaQueries: mediaQueries,
|
||
mediaQueryKeys: mediaQueryKeys
|
||
}
|
||
};
|
||
}
|
||
|
||
var strictEqual = function strictEqual(a, b) {
|
||
return a === b;
|
||
}; // $FlowFixMe
|
||
|
||
|
||
function observeStore(_ref3) {
|
||
var store = _ref3.store,
|
||
select = _ref3.select,
|
||
onChange = _ref3.onChange,
|
||
_ref3$comparator = _ref3.comparator,
|
||
comparator = _ref3$comparator === void 0 ? strictEqual : _ref3$comparator;
|
||
var getState = store.getState,
|
||
subscribe = store.subscribe;
|
||
var unsubscribe = subscribe(handleChange);
|
||
var currentState = select(getState());
|
||
|
||
function handleChange() {
|
||
var nextState = select(getState());
|
||
|
||
if (nextState == null) {
|
||
unsubscribe();
|
||
return;
|
||
}
|
||
|
||
if (!comparator(nextState, currentState)) {
|
||
currentState = nextState;
|
||
onChange(currentState, store);
|
||
}
|
||
}
|
||
|
||
return unsubscribe;
|
||
}
|
||
|
||
function normalizeTarget(target) {
|
||
var type = (0, _typeof2["default"])(target);
|
||
|
||
if (type === 'string') {
|
||
return {
|
||
id: target
|
||
};
|
||
} else if (target != null && type === 'object') {
|
||
var id = target.id,
|
||
objectId = target.objectId,
|
||
selector = target.selector,
|
||
selectorGuids = target.selectorGuids,
|
||
appliesTo = target.appliesTo,
|
||
useEventTarget = target.useEventTarget;
|
||
return {
|
||
id: id,
|
||
objectId: objectId,
|
||
selector: selector,
|
||
selectorGuids: selectorGuids,
|
||
appliesTo: appliesTo,
|
||
useEventTarget: useEventTarget
|
||
};
|
||
}
|
||
|
||
return {};
|
||
}
|
||
|
||
function getAffectedElements(_ref4) {
|
||
var config = _ref4.config,
|
||
event = _ref4.event,
|
||
eventTarget = _ref4.eventTarget,
|
||
elementRoot = _ref4.elementRoot,
|
||
elementApi = _ref4.elementApi;
|
||
|
||
var _ref, _event$action, _event$action$config;
|
||
|
||
if (!elementApi) {
|
||
throw new Error('IX2 missing elementApi');
|
||
}
|
||
|
||
var targets = config.targets;
|
||
|
||
if (Array.isArray(targets) && targets.length > 0) {
|
||
return targets.reduce(function (accumulator, target) {
|
||
return accumulator.concat(getAffectedElements({
|
||
config: {
|
||
target: target
|
||
},
|
||
event: event,
|
||
eventTarget: eventTarget,
|
||
elementRoot: elementRoot,
|
||
elementApi: elementApi
|
||
}));
|
||
}, []);
|
||
}
|
||
|
||
var getValidDocument = elementApi.getValidDocument,
|
||
getQuerySelector = elementApi.getQuerySelector,
|
||
queryDocument = elementApi.queryDocument,
|
||
getChildElements = elementApi.getChildElements,
|
||
getSiblingElements = elementApi.getSiblingElements,
|
||
matchSelector = elementApi.matchSelector,
|
||
elementContains = elementApi.elementContains,
|
||
isSiblingNode = elementApi.isSiblingNode;
|
||
var target = config.target;
|
||
|
||
if (!target) {
|
||
return [];
|
||
}
|
||
|
||
var _normalizeTarget = normalizeTarget(target),
|
||
id = _normalizeTarget.id,
|
||
objectId = _normalizeTarget.objectId,
|
||
selector = _normalizeTarget.selector,
|
||
selectorGuids = _normalizeTarget.selectorGuids,
|
||
appliesTo = _normalizeTarget.appliesTo,
|
||
useEventTarget = _normalizeTarget.useEventTarget;
|
||
|
||
if (objectId) {
|
||
var ref = objectCache[objectId] || (objectCache[objectId] = {});
|
||
return [ref];
|
||
}
|
||
|
||
if (appliesTo === _constants.EventAppliesTo.PAGE) {
|
||
var doc = getValidDocument(id);
|
||
return doc ? [doc] : [];
|
||
}
|
||
|
||
var overrides = (_ref = event === null || event === void 0 ? void 0 : (_event$action = event.action) === null || _event$action === void 0 ? void 0 : (_event$action$config = _event$action.config) === null || _event$action$config === void 0 ? void 0 : _event$action$config.affectedElements) !== null && _ref !== void 0 ? _ref : {};
|
||
var override = overrides[id || selector] || {};
|
||
var validOverride = Boolean(override.id || override.selector);
|
||
var limitAffectedElements;
|
||
var baseSelector;
|
||
var finalSelector;
|
||
var eventTargetSelector = event && getQuerySelector(normalizeTarget(event.target));
|
||
|
||
if (validOverride) {
|
||
limitAffectedElements = override.limitAffectedElements;
|
||
baseSelector = eventTargetSelector;
|
||
finalSelector = getQuerySelector(override);
|
||
} else {
|
||
// pass in selectorGuids as well for server-side rendering.
|
||
baseSelector = finalSelector = getQuerySelector({
|
||
id: id,
|
||
selector: selector,
|
||
selectorGuids: selectorGuids
|
||
});
|
||
}
|
||
|
||
if (event && useEventTarget) {
|
||
// eventTarget is not defined when this function is called in a clear request, so find
|
||
// all target elements associated with the event data, and return affected elements.
|
||
var eventTargets = eventTarget && (finalSelector || useEventTarget === true) ? [eventTarget] : queryDocument(eventTargetSelector);
|
||
|
||
if (finalSelector) {
|
||
if (useEventTarget === PARENT) {
|
||
return queryDocument(finalSelector).filter(function (parentElement) {
|
||
return eventTargets.some(function (targetElement) {
|
||
return elementContains(parentElement, targetElement);
|
||
});
|
||
});
|
||
}
|
||
|
||
if (useEventTarget === CHILDREN) {
|
||
return queryDocument(finalSelector).filter(function (childElement) {
|
||
return eventTargets.some(function (targetElement) {
|
||
return elementContains(targetElement, childElement);
|
||
});
|
||
});
|
||
}
|
||
|
||
if (useEventTarget === SIBLINGS) {
|
||
return queryDocument(finalSelector).filter(function (siblingElement) {
|
||
return eventTargets.some(function (targetElement) {
|
||
return isSiblingNode(targetElement, siblingElement);
|
||
});
|
||
});
|
||
}
|
||
}
|
||
|
||
return eventTargets;
|
||
}
|
||
|
||
if (baseSelector == null || finalSelector == null) {
|
||
return [];
|
||
}
|
||
|
||
if (_IX2BrowserSupport.IS_BROWSER_ENV && elementRoot) {
|
||
return queryDocument(finalSelector).filter(function (element) {
|
||
return elementRoot.contains(element);
|
||
});
|
||
}
|
||
|
||
if (limitAffectedElements === CHILDREN) {
|
||
return queryDocument(baseSelector, finalSelector);
|
||
} else if (limitAffectedElements === IMMEDIATE_CHILDREN) {
|
||
return getChildElements(queryDocument(baseSelector)).filter(matchSelector(finalSelector));
|
||
} else if (limitAffectedElements === SIBLINGS) {
|
||
return getSiblingElements(queryDocument(baseSelector)).filter(matchSelector(finalSelector));
|
||
} else {
|
||
return queryDocument(finalSelector);
|
||
}
|
||
} // $FlowFixMe
|
||
|
||
|
||
function getComputedStyle(_ref5) {
|
||
var element = _ref5.element,
|
||
actionItem = _ref5.actionItem;
|
||
|
||
if (!_IX2BrowserSupport.IS_BROWSER_ENV) {
|
||
return {};
|
||
}
|
||
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
|
||
switch (actionTypeId) {
|
||
case STYLE_SIZE:
|
||
case STYLE_BACKGROUND_COLOR:
|
||
case STYLE_BORDER:
|
||
case STYLE_TEXT_COLOR:
|
||
case GENERAL_DISPLAY:
|
||
return window.getComputedStyle(element);
|
||
|
||
default:
|
||
return {};
|
||
}
|
||
}
|
||
|
||
var pxValueRegex = /px/;
|
||
|
||
var getFilterDefaults = function getFilterDefaults(actionState, filters) {
|
||
return filters.reduce(function (result, filter) {
|
||
if (result[filter.type] == null) {
|
||
result[filter.type] = filterDefaults[filter.type];
|
||
}
|
||
|
||
return result;
|
||
}, actionState || {});
|
||
};
|
||
|
||
function getInstanceOrigin( // $FlowFixMe
|
||
element) {
|
||
var refState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
var computedStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||
var // $FlowFixMe
|
||
actionItem = arguments.length > 3 ? arguments[3] : undefined;
|
||
var // $FlowFixMe
|
||
elementApi = arguments.length > 4 ? arguments[4] : undefined;
|
||
var getStyle = elementApi.getStyle;
|
||
var actionTypeId = actionItem.actionTypeId,
|
||
config = actionItem.config;
|
||
|
||
if ((0, _IX2VanillaPlugins.isPluginType)(actionTypeId)) {
|
||
// $FlowFixMe
|
||
return (0, _IX2VanillaPlugins.getPluginOrigin)(actionTypeId)(refState[actionTypeId]);
|
||
}
|
||
|
||
switch (actionTypeId) {
|
||
case TRANSFORM_MOVE:
|
||
case TRANSFORM_SCALE:
|
||
case TRANSFORM_ROTATE:
|
||
case TRANSFORM_SKEW:
|
||
return refState[actionTypeId] || transformDefaults[actionTypeId];
|
||
|
||
case STYLE_FILTER:
|
||
return getFilterDefaults(refState[actionTypeId], actionItem.config.filters);
|
||
|
||
case STYLE_OPACITY:
|
||
return {
|
||
value: (0, _defaultTo["default"])(parseFloat(getStyle(element, OPACITY)), 1.0)
|
||
};
|
||
|
||
case STYLE_SIZE:
|
||
{
|
||
var inlineWidth = getStyle(element, WIDTH);
|
||
var inlineHeight = getStyle(element, HEIGHT);
|
||
var widthValue;
|
||
var heightValue; // When destination unit is 'AUTO', ensure origin values are in px
|
||
|
||
if (config.widthUnit === AUTO) {
|
||
widthValue = pxValueRegex.test(inlineWidth) ? parseFloat(inlineWidth) : parseFloat(computedStyle.width);
|
||
} else {
|
||
widthValue = (0, _defaultTo["default"])(parseFloat(inlineWidth), parseFloat(computedStyle.width));
|
||
}
|
||
|
||
if (config.heightUnit === AUTO) {
|
||
heightValue = pxValueRegex.test(inlineHeight) ? parseFloat(inlineHeight) : parseFloat(computedStyle.height);
|
||
} else {
|
||
heightValue = (0, _defaultTo["default"])(parseFloat(inlineHeight), parseFloat(computedStyle.height));
|
||
}
|
||
|
||
return {
|
||
widthValue: widthValue,
|
||
heightValue: heightValue
|
||
};
|
||
}
|
||
|
||
case STYLE_BACKGROUND_COLOR:
|
||
case STYLE_BORDER:
|
||
case STYLE_TEXT_COLOR:
|
||
return parseColor({
|
||
element: element,
|
||
actionTypeId: actionTypeId,
|
||
computedStyle: computedStyle,
|
||
getStyle: getStyle
|
||
});
|
||
|
||
case GENERAL_DISPLAY:
|
||
return {
|
||
value: (0, _defaultTo["default"])(getStyle(element, DISPLAY), computedStyle.display)
|
||
};
|
||
|
||
case OBJECT_VALUE:
|
||
return refState[actionTypeId] || {
|
||
value: 0
|
||
};
|
||
|
||
default:
|
||
return;
|
||
}
|
||
}
|
||
|
||
var reduceFilters = function reduceFilters(result, filter) {
|
||
if (filter) {
|
||
result[filter.type] = filter.value || 0;
|
||
}
|
||
|
||
return result;
|
||
}; // $FlowFixMe
|
||
|
||
|
||
var getItemConfigByKey = function getItemConfigByKey(actionTypeId, key, config) {
|
||
if ((0, _IX2VanillaPlugins.isPluginType)(actionTypeId)) {
|
||
// $FlowFixMe
|
||
return (0, _IX2VanillaPlugins.getPluginConfig)(actionTypeId)(config, key);
|
||
}
|
||
|
||
switch (actionTypeId) {
|
||
case STYLE_FILTER:
|
||
{
|
||
var filter = (0, _findLast["default"])(config.filters, function (_ref6) {
|
||
var type = _ref6.type;
|
||
return type === key;
|
||
});
|
||
return filter ? filter.value : 0;
|
||
}
|
||
|
||
default:
|
||
return config[key];
|
||
}
|
||
}; // $FlowFixMe
|
||
|
||
|
||
exports.getItemConfigByKey = getItemConfigByKey;
|
||
|
||
function getDestinationValues(_ref7) {
|
||
var element = _ref7.element,
|
||
actionItem = _ref7.actionItem,
|
||
elementApi = _ref7.elementApi;
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
|
||
if ((0, _IX2VanillaPlugins.isPluginType)(actionTypeId)) {
|
||
// $FlowFixMe
|
||
return (0, _IX2VanillaPlugins.getPluginDestination)(actionTypeId)(actionItem.config);
|
||
}
|
||
|
||
switch (actionTypeId) {
|
||
case TRANSFORM_MOVE:
|
||
case TRANSFORM_SCALE:
|
||
case TRANSFORM_ROTATE:
|
||
case TRANSFORM_SKEW:
|
||
{
|
||
var _actionItem$config = actionItem.config,
|
||
xValue = _actionItem$config.xValue,
|
||
yValue = _actionItem$config.yValue,
|
||
zValue = _actionItem$config.zValue;
|
||
return {
|
||
xValue: xValue,
|
||
yValue: yValue,
|
||
zValue: zValue
|
||
};
|
||
}
|
||
|
||
case STYLE_SIZE:
|
||
{
|
||
var getStyle = elementApi.getStyle,
|
||
setStyle = elementApi.setStyle,
|
||
getProperty = elementApi.getProperty;
|
||
var _actionItem$config2 = actionItem.config,
|
||
widthUnit = _actionItem$config2.widthUnit,
|
||
heightUnit = _actionItem$config2.heightUnit;
|
||
var _actionItem$config3 = actionItem.config,
|
||
widthValue = _actionItem$config3.widthValue,
|
||
heightValue = _actionItem$config3.heightValue;
|
||
|
||
if (!_IX2BrowserSupport.IS_BROWSER_ENV) {
|
||
return {
|
||
widthValue: widthValue,
|
||
heightValue: heightValue
|
||
};
|
||
}
|
||
|
||
if (widthUnit === AUTO) {
|
||
var temp = getStyle(element, WIDTH);
|
||
setStyle(element, WIDTH, '');
|
||
widthValue = getProperty(element, 'offsetWidth');
|
||
setStyle(element, WIDTH, temp);
|
||
}
|
||
|
||
if (heightUnit === AUTO) {
|
||
var _temp = getStyle(element, HEIGHT);
|
||
|
||
setStyle(element, HEIGHT, '');
|
||
heightValue = getProperty(element, 'offsetHeight');
|
||
setStyle(element, HEIGHT, _temp);
|
||
}
|
||
|
||
return {
|
||
widthValue: widthValue,
|
||
heightValue: heightValue
|
||
};
|
||
}
|
||
|
||
case STYLE_BACKGROUND_COLOR:
|
||
case STYLE_BORDER:
|
||
case STYLE_TEXT_COLOR:
|
||
{
|
||
var _actionItem$config4 = actionItem.config,
|
||
rValue = _actionItem$config4.rValue,
|
||
gValue = _actionItem$config4.gValue,
|
||
bValue = _actionItem$config4.bValue,
|
||
aValue = _actionItem$config4.aValue;
|
||
return {
|
||
rValue: rValue,
|
||
gValue: gValue,
|
||
bValue: bValue,
|
||
aValue: aValue
|
||
};
|
||
}
|
||
|
||
case STYLE_FILTER:
|
||
{
|
||
return actionItem.config.filters.reduce(reduceFilters, {});
|
||
}
|
||
|
||
default:
|
||
{
|
||
var value = actionItem.config.value;
|
||
return {
|
||
value: value
|
||
};
|
||
}
|
||
}
|
||
} // $FlowFixMe
|
||
|
||
|
||
function getRenderType(actionTypeId) {
|
||
if (/^TRANSFORM_/.test(actionTypeId)) {
|
||
return RENDER_TRANSFORM;
|
||
}
|
||
|
||
if (/^STYLE_/.test(actionTypeId)) {
|
||
return RENDER_STYLE;
|
||
}
|
||
|
||
if (/^GENERAL_/.test(actionTypeId)) {
|
||
return RENDER_GENERAL;
|
||
}
|
||
|
||
if (/^PLUGIN_/.test(actionTypeId)) {
|
||
return RENDER_PLUGIN;
|
||
}
|
||
} // $FlowFixMe
|
||
|
||
|
||
function getStyleProp(renderType, actionTypeId) {
|
||
return renderType === RENDER_STYLE ? actionTypeId.replace('STYLE_', '').toLowerCase() : null;
|
||
}
|
||
|
||
function renderHTMLElement( // $FlowFixMe
|
||
element, // $FlowFixMe
|
||
refState, // $FlowFixMe
|
||
actionState, // $FlowFixMe
|
||
eventId, // $FlowFixMe
|
||
actionItem, // $FlowFixMe
|
||
styleProp, // $FlowFixMe
|
||
elementApi, // $FlowFixMe
|
||
renderType, // $FlowFixMe
|
||
pluginInstance) {
|
||
switch (renderType) {
|
||
case RENDER_TRANSFORM:
|
||
{
|
||
return renderTransform(element, refState, actionState, actionItem, elementApi);
|
||
}
|
||
|
||
case RENDER_STYLE:
|
||
{
|
||
return renderStyle(element, refState, actionState, actionItem, styleProp, elementApi);
|
||
}
|
||
|
||
case RENDER_GENERAL:
|
||
{
|
||
return renderGeneral(element, actionItem, elementApi);
|
||
}
|
||
|
||
case RENDER_PLUGIN:
|
||
{
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
|
||
if ((0, _IX2VanillaPlugins.isPluginType)(actionTypeId)) {
|
||
// $FlowFixMe
|
||
return (0, _IX2VanillaPlugins.renderPlugin)(actionTypeId)(pluginInstance, refState, actionItem);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
var transformDefaults = (_transformDefaults = {}, (0, _defineProperty2["default"])(_transformDefaults, TRANSFORM_MOVE, Object.freeze({
|
||
xValue: 0,
|
||
yValue: 0,
|
||
zValue: 0
|
||
})), (0, _defineProperty2["default"])(_transformDefaults, TRANSFORM_SCALE, Object.freeze({
|
||
xValue: 1,
|
||
yValue: 1,
|
||
zValue: 1
|
||
})), (0, _defineProperty2["default"])(_transformDefaults, TRANSFORM_ROTATE, Object.freeze({
|
||
xValue: 0,
|
||
yValue: 0,
|
||
zValue: 0
|
||
})), (0, _defineProperty2["default"])(_transformDefaults, TRANSFORM_SKEW, Object.freeze({
|
||
xValue: 0,
|
||
yValue: 0
|
||
})), _transformDefaults);
|
||
var filterDefaults = Object.freeze({
|
||
blur: 0,
|
||
'hue-rotate': 0,
|
||
invert: 0,
|
||
grayscale: 0,
|
||
saturate: 100,
|
||
sepia: 0,
|
||
contrast: 100,
|
||
brightness: 100
|
||
});
|
||
|
||
var getFilterUnit = function getFilterUnit(filterType, actionItemConfig) {
|
||
var filter = (0, _findLast["default"])(actionItemConfig.filters, function (_ref8) {
|
||
var type = _ref8.type;
|
||
return type === filterType;
|
||
});
|
||
|
||
if (filter && filter.unit) {
|
||
return filter.unit;
|
||
}
|
||
|
||
switch (filterType) {
|
||
case 'blur':
|
||
return 'px';
|
||
|
||
case 'hue-rotate':
|
||
return 'deg';
|
||
|
||
default:
|
||
return '%';
|
||
}
|
||
};
|
||
|
||
var transformKeys = Object.keys(transformDefaults);
|
||
|
||
function renderTransform(element, refState, actionState, actionItem, elementApi) {
|
||
var newTransform = transformKeys.map(function (actionTypeId) {
|
||
var defaults = transformDefaults[actionTypeId];
|
||
|
||
var _ref9 = refState[actionTypeId] || {},
|
||
_ref9$xValue = _ref9.xValue,
|
||
xValue = _ref9$xValue === void 0 ? defaults.xValue : _ref9$xValue,
|
||
_ref9$yValue = _ref9.yValue,
|
||
yValue = _ref9$yValue === void 0 ? defaults.yValue : _ref9$yValue,
|
||
_ref9$zValue = _ref9.zValue,
|
||
zValue = _ref9$zValue === void 0 ? defaults.zValue : _ref9$zValue,
|
||
_ref9$xUnit = _ref9.xUnit,
|
||
xUnit = _ref9$xUnit === void 0 ? '' : _ref9$xUnit,
|
||
_ref9$yUnit = _ref9.yUnit,
|
||
yUnit = _ref9$yUnit === void 0 ? '' : _ref9$yUnit,
|
||
_ref9$zUnit = _ref9.zUnit,
|
||
zUnit = _ref9$zUnit === void 0 ? '' : _ref9$zUnit;
|
||
|
||
switch (actionTypeId) {
|
||
case TRANSFORM_MOVE:
|
||
return "".concat(TRANSLATE_3D, "(").concat(xValue).concat(xUnit, ", ").concat(yValue).concat(yUnit, ", ").concat(zValue).concat(zUnit, ")");
|
||
|
||
case TRANSFORM_SCALE:
|
||
return "".concat(SCALE_3D, "(").concat(xValue).concat(xUnit, ", ").concat(yValue).concat(yUnit, ", ").concat(zValue).concat(zUnit, ")");
|
||
|
||
case TRANSFORM_ROTATE:
|
||
return "".concat(ROTATE_X, "(").concat(xValue).concat(xUnit, ") ").concat(ROTATE_Y, "(").concat(yValue).concat(yUnit, ") ").concat(ROTATE_Z, "(").concat(zValue).concat(zUnit, ")");
|
||
|
||
case TRANSFORM_SKEW:
|
||
return "".concat(SKEW, "(").concat(xValue).concat(xUnit, ", ").concat(yValue).concat(yUnit, ")");
|
||
|
||
default:
|
||
return '';
|
||
}
|
||
}).join(' ');
|
||
var setStyle = elementApi.setStyle;
|
||
addWillChange(element, _IX2BrowserSupport.TRANSFORM_PREFIXED, elementApi);
|
||
setStyle(element, _IX2BrowserSupport.TRANSFORM_PREFIXED, newTransform); // Set transform-style: preserve-3d
|
||
|
||
if (hasDefined3dTransform(actionItem, actionState)) {
|
||
setStyle(element, _IX2BrowserSupport.TRANSFORM_STYLE_PREFIXED, PRESERVE_3D);
|
||
}
|
||
}
|
||
|
||
function renderFilter(element, actionState, actionItemConfig, elementApi) {
|
||
var filterValue = (0, _reduce["default"])(actionState, function (result, value, type) {
|
||
return "".concat(result, " ").concat(type, "(").concat(value).concat(getFilterUnit(type, actionItemConfig), ")");
|
||
}, '');
|
||
var setStyle = elementApi.setStyle;
|
||
addWillChange(element, FILTER, elementApi);
|
||
setStyle(element, FILTER, filterValue);
|
||
}
|
||
|
||
function hasDefined3dTransform(_ref10, _ref11) {
|
||
var actionTypeId = _ref10.actionTypeId;
|
||
var xValue = _ref11.xValue,
|
||
yValue = _ref11.yValue,
|
||
zValue = _ref11.zValue;
|
||
// TRANSLATE_Z
|
||
return actionTypeId === TRANSFORM_MOVE && zValue !== undefined || // SCALE_Z
|
||
actionTypeId === TRANSFORM_SCALE && zValue !== undefined || // ROTATE_X or ROTATE_Y
|
||
actionTypeId === TRANSFORM_ROTATE && (xValue !== undefined || yValue !== undefined);
|
||
}
|
||
|
||
var paramCapture = '\\(([^)]+)\\)';
|
||
var rgbValidRegex = /^rgb/;
|
||
var rgbMatchRegex = RegExp("rgba?".concat(paramCapture));
|
||
|
||
function getFirstMatch(regex, value) {
|
||
var match = regex.exec(value);
|
||
return match ? match[1] : '';
|
||
}
|
||
|
||
function parseColor(_ref12) {
|
||
var element = _ref12.element,
|
||
actionTypeId = _ref12.actionTypeId,
|
||
computedStyle = _ref12.computedStyle,
|
||
getStyle = _ref12.getStyle;
|
||
var prop = colorStyleProps[actionTypeId];
|
||
var inlineValue = getStyle(element, prop);
|
||
var value = rgbValidRegex.test(inlineValue) ? inlineValue : computedStyle[prop];
|
||
var matches = getFirstMatch(rgbMatchRegex, value).split(COMMA_DELIMITER);
|
||
return {
|
||
rValue: (0, _defaultTo["default"])(parseInt(matches[0], 10), 255),
|
||
gValue: (0, _defaultTo["default"])(parseInt(matches[1], 10), 255),
|
||
bValue: (0, _defaultTo["default"])(parseInt(matches[2], 10), 255),
|
||
aValue: (0, _defaultTo["default"])(parseFloat(matches[3]), 1)
|
||
};
|
||
}
|
||
|
||
function renderStyle(element, refState, actionState, actionItem, styleProp, elementApi) {
|
||
var setStyle = elementApi.setStyle;
|
||
var actionTypeId = actionItem.actionTypeId,
|
||
config = actionItem.config;
|
||
|
||
switch (actionTypeId) {
|
||
case STYLE_SIZE:
|
||
{
|
||
var _actionItem$config5 = actionItem.config,
|
||
_actionItem$config5$w = _actionItem$config5.widthUnit,
|
||
widthUnit = _actionItem$config5$w === void 0 ? '' : _actionItem$config5$w,
|
||
_actionItem$config5$h = _actionItem$config5.heightUnit,
|
||
heightUnit = _actionItem$config5$h === void 0 ? '' : _actionItem$config5$h;
|
||
var widthValue = actionState.widthValue,
|
||
heightValue = actionState.heightValue;
|
||
|
||
if (widthValue !== undefined) {
|
||
if (widthUnit === AUTO) {
|
||
widthUnit = 'px';
|
||
}
|
||
|
||
addWillChange(element, WIDTH, elementApi);
|
||
setStyle(element, WIDTH, widthValue + widthUnit);
|
||
}
|
||
|
||
if (heightValue !== undefined) {
|
||
if (heightUnit === AUTO) {
|
||
heightUnit = 'px';
|
||
}
|
||
|
||
addWillChange(element, HEIGHT, elementApi);
|
||
setStyle(element, HEIGHT, heightValue + heightUnit);
|
||
}
|
||
|
||
break;
|
||
}
|
||
|
||
case STYLE_FILTER:
|
||
{
|
||
renderFilter(element, actionState, config, elementApi);
|
||
break;
|
||
}
|
||
|
||
case STYLE_BACKGROUND_COLOR:
|
||
case STYLE_BORDER:
|
||
case STYLE_TEXT_COLOR:
|
||
{
|
||
var prop = colorStyleProps[actionTypeId];
|
||
var rValue = Math.round(actionState.rValue);
|
||
var gValue = Math.round(actionState.gValue);
|
||
var bValue = Math.round(actionState.bValue);
|
||
var aValue = actionState.aValue;
|
||
addWillChange(element, prop, elementApi);
|
||
setStyle(element, prop, aValue >= 1 ? "rgb(".concat(rValue, ",").concat(gValue, ",").concat(bValue, ")") : "rgba(".concat(rValue, ",").concat(gValue, ",").concat(bValue, ",").concat(aValue, ")"));
|
||
break;
|
||
}
|
||
|
||
default:
|
||
{
|
||
var _config$unit = config.unit,
|
||
unit = _config$unit === void 0 ? '' : _config$unit;
|
||
addWillChange(element, styleProp, elementApi);
|
||
setStyle(element, styleProp, actionState.value + unit);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
function renderGeneral(element, actionItem, elementApi) {
|
||
var setStyle = elementApi.setStyle;
|
||
|
||
switch (actionItem.actionTypeId) {
|
||
case GENERAL_DISPLAY:
|
||
{
|
||
var value = actionItem.config.value;
|
||
|
||
if (value === FLEX && _IX2BrowserSupport.IS_BROWSER_ENV) {
|
||
setStyle(element, DISPLAY, _IX2BrowserSupport.FLEX_PREFIXED);
|
||
} else {
|
||
setStyle(element, DISPLAY, value);
|
||
}
|
||
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
function addWillChange(element, prop, elementApi) {
|
||
if (!_IX2BrowserSupport.IS_BROWSER_ENV) {
|
||
return;
|
||
} // $FlowFixMe
|
||
|
||
|
||
var validProp = willChangeProps[prop];
|
||
|
||
if (!validProp) {
|
||
return;
|
||
}
|
||
|
||
var getStyle = elementApi.getStyle,
|
||
setStyle = elementApi.setStyle;
|
||
var value = getStyle(element, WILL_CHANGE);
|
||
|
||
if (!value) {
|
||
setStyle(element, WILL_CHANGE, validProp);
|
||
return;
|
||
}
|
||
|
||
var values = value.split(COMMA_DELIMITER).map(trim);
|
||
|
||
if (values.indexOf(validProp) === -1) {
|
||
setStyle(element, WILL_CHANGE, values.concat(validProp).join(COMMA_DELIMITER));
|
||
}
|
||
}
|
||
|
||
function removeWillChange(element, prop, elementApi) {
|
||
if (!_IX2BrowserSupport.IS_BROWSER_ENV) {
|
||
return;
|
||
} // $FlowFixMe
|
||
|
||
|
||
var validProp = willChangeProps[prop];
|
||
|
||
if (!validProp) {
|
||
return;
|
||
}
|
||
|
||
var getStyle = elementApi.getStyle,
|
||
setStyle = elementApi.setStyle;
|
||
var value = getStyle(element, WILL_CHANGE);
|
||
|
||
if (!value || value.indexOf(validProp) === -1) {
|
||
return;
|
||
}
|
||
|
||
setStyle(element, WILL_CHANGE, value.split(COMMA_DELIMITER).map(trim).filter(function (v) {
|
||
return v !== validProp;
|
||
}).join(COMMA_DELIMITER));
|
||
} // $FlowFixMe
|
||
|
||
|
||
function clearAllStyles(_ref13) {
|
||
var store = _ref13.store,
|
||
elementApi = _ref13.elementApi;
|
||
|
||
var _store$getState = store.getState(),
|
||
ixData = _store$getState.ixData;
|
||
|
||
var _ixData$events = ixData.events,
|
||
events = _ixData$events === void 0 ? {} : _ixData$events,
|
||
_ixData$actionLists = ixData.actionLists,
|
||
actionLists = _ixData$actionLists === void 0 ? {} : _ixData$actionLists;
|
||
Object.keys(events).forEach(function (eventId) {
|
||
var event = events[eventId];
|
||
var config = event.action.config;
|
||
var actionListId = config.actionListId;
|
||
var actionList = actionLists[actionListId];
|
||
|
||
if (actionList) {
|
||
clearActionListStyles({
|
||
actionList: actionList,
|
||
event: event,
|
||
elementApi: elementApi
|
||
});
|
||
}
|
||
});
|
||
Object.keys(actionLists).forEach(function (actionListId) {
|
||
clearActionListStyles({
|
||
actionList: actionLists[actionListId],
|
||
elementApi: elementApi
|
||
});
|
||
});
|
||
} // $FlowFixMe
|
||
|
||
|
||
function clearActionListStyles(_ref14) {
|
||
var _ref14$actionList = _ref14.actionList,
|
||
actionList = _ref14$actionList === void 0 ? {} : _ref14$actionList,
|
||
event = _ref14.event,
|
||
elementApi = _ref14.elementApi;
|
||
var actionItemGroups = actionList.actionItemGroups,
|
||
continuousParameterGroups = actionList.continuousParameterGroups;
|
||
actionItemGroups && actionItemGroups.forEach(function (actionGroup) {
|
||
clearActionGroupStyles({
|
||
actionGroup: actionGroup,
|
||
event: event,
|
||
elementApi: elementApi
|
||
});
|
||
});
|
||
continuousParameterGroups && continuousParameterGroups.forEach(function (paramGroup) {
|
||
var continuousActionGroups = paramGroup.continuousActionGroups;
|
||
continuousActionGroups.forEach(function (actionGroup) {
|
||
clearActionGroupStyles({
|
||
actionGroup: actionGroup,
|
||
event: event,
|
||
elementApi: elementApi
|
||
});
|
||
});
|
||
});
|
||
}
|
||
|
||
function clearActionGroupStyles(_ref15) {
|
||
var actionGroup = _ref15.actionGroup,
|
||
event = _ref15.event,
|
||
elementApi = _ref15.elementApi;
|
||
var actionItems = actionGroup.actionItems;
|
||
actionItems.forEach(function (_ref16) {
|
||
var actionTypeId = _ref16.actionTypeId,
|
||
config = _ref16.config;
|
||
var clearElement;
|
||
|
||
if ((0, _IX2VanillaPlugins.isPluginType)(actionTypeId)) {
|
||
clearElement = (0, _IX2VanillaPlugins.clearPlugin)(actionTypeId);
|
||
} else {
|
||
clearElement = processElementByType({
|
||
effect: clearStyleProp,
|
||
actionTypeId: actionTypeId,
|
||
elementApi: elementApi
|
||
});
|
||
}
|
||
|
||
getAffectedElements({
|
||
config: config,
|
||
event: event,
|
||
elementApi: elementApi
|
||
}).forEach(clearElement);
|
||
});
|
||
} // $FlowFixMe
|
||
|
||
|
||
function cleanupHTMLElement(element, actionItem, elementApi) {
|
||
var setStyle = elementApi.setStyle,
|
||
getStyle = elementApi.getStyle;
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
|
||
if (actionTypeId === STYLE_SIZE) {
|
||
var config = actionItem.config;
|
||
|
||
if (config.widthUnit === AUTO) {
|
||
setStyle(element, WIDTH, '');
|
||
}
|
||
|
||
if (config.heightUnit === AUTO) {
|
||
setStyle(element, HEIGHT, '');
|
||
}
|
||
}
|
||
|
||
if (getStyle(element, WILL_CHANGE)) {
|
||
processElementByType({
|
||
effect: removeWillChange,
|
||
actionTypeId: actionTypeId,
|
||
elementApi: elementApi
|
||
})(element);
|
||
}
|
||
}
|
||
|
||
var processElementByType = function processElementByType(_ref17) {
|
||
var effect = _ref17.effect,
|
||
actionTypeId = _ref17.actionTypeId,
|
||
elementApi = _ref17.elementApi;
|
||
return function (element) {
|
||
switch (actionTypeId) {
|
||
case TRANSFORM_MOVE:
|
||
case TRANSFORM_SCALE:
|
||
case TRANSFORM_ROTATE:
|
||
case TRANSFORM_SKEW:
|
||
effect(element, _IX2BrowserSupport.TRANSFORM_PREFIXED, elementApi);
|
||
break;
|
||
|
||
case STYLE_FILTER:
|
||
effect(element, FILTER, elementApi);
|
||
break;
|
||
|
||
case STYLE_OPACITY:
|
||
effect(element, OPACITY, elementApi);
|
||
break;
|
||
|
||
case STYLE_SIZE:
|
||
effect(element, WIDTH, elementApi);
|
||
effect(element, HEIGHT, elementApi);
|
||
break;
|
||
|
||
case STYLE_BACKGROUND_COLOR:
|
||
case STYLE_BORDER:
|
||
case STYLE_TEXT_COLOR:
|
||
effect(element, colorStyleProps[actionTypeId], elementApi);
|
||
break;
|
||
|
||
case GENERAL_DISPLAY:
|
||
effect(element, DISPLAY, elementApi);
|
||
break;
|
||
}
|
||
};
|
||
};
|
||
|
||
function clearStyleProp(element, prop, elementApi) {
|
||
var setStyle = elementApi.setStyle;
|
||
removeWillChange(element, prop, elementApi);
|
||
setStyle(element, prop, ''); // Clear transform-style: preserve-3d
|
||
|
||
if (prop === _IX2BrowserSupport.TRANSFORM_PREFIXED) {
|
||
setStyle(element, _IX2BrowserSupport.TRANSFORM_STYLE_PREFIXED, '');
|
||
}
|
||
} // $FlowFixMe
|
||
|
||
|
||
function getMaxDurationItemIndex(actionItems) {
|
||
var maxDuration = 0;
|
||
var resultIndex = 0;
|
||
actionItems.forEach(function (actionItem, index) {
|
||
var config = actionItem.config;
|
||
var total = config.delay + config.duration;
|
||
|
||
if (total >= maxDuration) {
|
||
maxDuration = total;
|
||
resultIndex = index;
|
||
}
|
||
});
|
||
return resultIndex;
|
||
} // $FlowFixMe
|
||
|
||
|
||
function getActionListProgress(actionList, instance) {
|
||
var actionItemGroups = actionList.actionItemGroups,
|
||
useFirstGroupAsInitialState = actionList.useFirstGroupAsInitialState;
|
||
var instanceItem = instance.actionItem,
|
||
_instance$verboseTime = instance.verboseTimeElapsed,
|
||
verboseTimeElapsed = _instance$verboseTime === void 0 ? 0 : _instance$verboseTime;
|
||
var totalDuration = 0;
|
||
var elapsedDuration = 0;
|
||
actionItemGroups.forEach(function (group, index) {
|
||
if (useFirstGroupAsInitialState && index === 0) {
|
||
return;
|
||
}
|
||
|
||
var actionItems = group.actionItems;
|
||
var carrierItem = actionItems[getMaxDurationItemIndex(actionItems)];
|
||
var config = carrierItem.config,
|
||
actionTypeId = carrierItem.actionTypeId;
|
||
|
||
if (instanceItem.id === carrierItem.id) {
|
||
elapsedDuration = totalDuration + verboseTimeElapsed;
|
||
}
|
||
|
||
var duration = getRenderType(actionTypeId) === RENDER_GENERAL ? 0 : config.duration;
|
||
totalDuration += config.delay + duration;
|
||
});
|
||
return totalDuration > 0 ? (0, _IX2EasingUtils.optimizeFloat)(elapsedDuration / totalDuration) : 0;
|
||
} // $FlowFixMe
|
||
|
||
|
||
function reduceListToGroup(_ref18) {
|
||
var actionList = _ref18.actionList,
|
||
actionItemId = _ref18.actionItemId,
|
||
rawData = _ref18.rawData;
|
||
var actionItemGroups = actionList.actionItemGroups,
|
||
continuousParameterGroups = actionList.continuousParameterGroups;
|
||
var newActionItems = [];
|
||
|
||
var takeItemUntilMatch = function takeItemUntilMatch(actionItem) {
|
||
newActionItems.push((0, _timm.mergeIn)(actionItem, ['config'], {
|
||
delay: 0,
|
||
duration: 0
|
||
}));
|
||
return actionItem.id === actionItemId;
|
||
};
|
||
|
||
actionItemGroups && actionItemGroups.some(function (_ref19) {
|
||
var actionItems = _ref19.actionItems;
|
||
return actionItems.some(takeItemUntilMatch);
|
||
});
|
||
continuousParameterGroups && continuousParameterGroups.some(function (paramGroup) {
|
||
var continuousActionGroups = paramGroup.continuousActionGroups;
|
||
return continuousActionGroups.some(function (_ref20) {
|
||
var actionItems = _ref20.actionItems;
|
||
return actionItems.some(takeItemUntilMatch);
|
||
});
|
||
});
|
||
return (0, _timm.setIn)(rawData, ['actionLists'], (0, _defineProperty2["default"])({}, actionList.id, {
|
||
id: actionList.id,
|
||
actionItemGroups: [{
|
||
actionItems: newActionItems
|
||
}]
|
||
}));
|
||
} // $FlowFixMe
|
||
|
||
|
||
function shouldNamespaceEventParameter(eventTypeId, _ref22) {
|
||
var basedOn = _ref22.basedOn;
|
||
return eventTypeId === _constants.EventTypeConsts.SCROLLING_IN_VIEW && (basedOn === _constants.EventBasedOn.ELEMENT || basedOn == null) || eventTypeId === _constants.EventTypeConsts.MOUSE_MOVE && basedOn === _constants.EventBasedOn.ELEMENT;
|
||
}
|
||
|
||
function getNamespacedParameterId(eventStateKey, continuousParameterGroupId) {
|
||
var namespacedParameterId = eventStateKey + COLON_DELIMITER + continuousParameterGroupId;
|
||
return namespacedParameterId;
|
||
} // $FlowFixMe
|
||
|
||
|
||
function shouldAllowMediaQuery(mediaQueries, mediaQueryKey) {
|
||
// During design mode, current media query key does not exist
|
||
if (mediaQueryKey == null) {
|
||
return true;
|
||
}
|
||
|
||
return mediaQueries.indexOf(mediaQueryKey) !== -1;
|
||
} // $FlowFixMe
|
||
|
||
|
||
function mediaQueriesEqual(listA, listB) {
|
||
return (0, _shallowEqual["default"])(listA && listA.sort(), listB && listB.sort());
|
||
} // $FlowFixMe
|
||
|
||
|
||
function stringifyTarget(target) {
|
||
if (typeof target === 'string') {
|
||
return target;
|
||
}
|
||
|
||
var _target$id = target.id,
|
||
id = _target$id === void 0 ? '' : _target$id,
|
||
_target$selector = target.selector,
|
||
selector = _target$selector === void 0 ? '' : _target$selector,
|
||
_target$useEventTarge = target.useEventTarget,
|
||
useEventTarget = _target$useEventTarge === void 0 ? '' : _target$useEventTarge;
|
||
return id + BAR_DELIMITER + selector + BAR_DELIMITER + useEventTarget;
|
||
}
|
||
|
||
/***/ }),
|
||
/* 320 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Checks `value` to determine whether a default value should be returned in
|
||
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
|
||
* or `undefined`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.14.0
|
||
* @category Util
|
||
* @param {*} value The value to check.
|
||
* @param {*} defaultValue The default value.
|
||
* @returns {*} Returns the resolved value.
|
||
* @example
|
||
*
|
||
* _.defaultTo(1, 10);
|
||
* // => 1
|
||
*
|
||
* _.defaultTo(undefined, 10);
|
||
* // => 10
|
||
*/
|
||
function defaultTo(value, defaultValue) {
|
||
return (value == null || value !== value) ? defaultValue : value;
|
||
}
|
||
|
||
module.exports = defaultTo;
|
||
|
||
|
||
/***/ }),
|
||
/* 321 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayReduce = __webpack_require__(322),
|
||
baseEach = __webpack_require__(143),
|
||
baseIteratee = __webpack_require__(18),
|
||
baseReduce = __webpack_require__(326),
|
||
isArray = __webpack_require__(2);
|
||
|
||
/**
|
||
* Reduces `collection` to a value which is the accumulated result of running
|
||
* each element in `collection` thru `iteratee`, where each successive
|
||
* invocation is supplied the return value of the previous. If `accumulator`
|
||
* is not given, the first element of `collection` is used as the initial
|
||
* value. The iteratee is invoked with four arguments:
|
||
* (accumulator, value, index|key, collection).
|
||
*
|
||
* Many lodash methods are guarded to work as iteratees for methods like
|
||
* `_.reduce`, `_.reduceRight`, and `_.transform`.
|
||
*
|
||
* The guarded methods are:
|
||
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
|
||
* and `sortBy`
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Collection
|
||
* @param {Array|Object} collection The collection to iterate over.
|
||
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||
* @param {*} [accumulator] The initial value.
|
||
* @returns {*} Returns the accumulated value.
|
||
* @see _.reduceRight
|
||
* @example
|
||
*
|
||
* _.reduce([1, 2], function(sum, n) {
|
||
* return sum + n;
|
||
* }, 0);
|
||
* // => 3
|
||
*
|
||
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
||
* (result[value] || (result[value] = [])).push(key);
|
||
* return result;
|
||
* }, {});
|
||
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
|
||
*/
|
||
function reduce(collection, iteratee, accumulator) {
|
||
var func = isArray(collection) ? arrayReduce : baseReduce,
|
||
initAccum = arguments.length < 3;
|
||
|
||
return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach);
|
||
}
|
||
|
||
module.exports = reduce;
|
||
|
||
|
||
/***/ }),
|
||
/* 322 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* A specialized version of `_.reduce` for arrays without support for
|
||
* iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Array} [array] The array to iterate over.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @param {*} [accumulator] The initial value.
|
||
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
||
* the initial value.
|
||
* @returns {*} Returns the accumulated value.
|
||
*/
|
||
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
||
var index = -1,
|
||
length = array == null ? 0 : array.length;
|
||
|
||
if (initAccum && length) {
|
||
accumulator = array[++index];
|
||
}
|
||
while (++index < length) {
|
||
accumulator = iteratee(accumulator, array[index], index, array);
|
||
}
|
||
return accumulator;
|
||
}
|
||
|
||
module.exports = arrayReduce;
|
||
|
||
|
||
/***/ }),
|
||
/* 323 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var createBaseFor = __webpack_require__(324);
|
||
|
||
/**
|
||
* The base implementation of `baseForOwn` which iterates over `object`
|
||
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to iterate over.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @param {Function} keysFunc The function to get the keys of `object`.
|
||
* @returns {Object} Returns `object`.
|
||
*/
|
||
var baseFor = createBaseFor();
|
||
|
||
module.exports = baseFor;
|
||
|
||
|
||
/***/ }),
|
||
/* 324 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
||
*
|
||
* @private
|
||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||
* @returns {Function} Returns the new base function.
|
||
*/
|
||
function createBaseFor(fromRight) {
|
||
return function(object, iteratee, keysFunc) {
|
||
var index = -1,
|
||
iterable = Object(object),
|
||
props = keysFunc(object),
|
||
length = props.length;
|
||
|
||
while (length--) {
|
||
var key = props[fromRight ? length : ++index];
|
||
if (iteratee(iterable[key], key, iterable) === false) {
|
||
break;
|
||
}
|
||
}
|
||
return object;
|
||
};
|
||
}
|
||
|
||
module.exports = createBaseFor;
|
||
|
||
|
||
/***/ }),
|
||
/* 325 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isArrayLike = __webpack_require__(26);
|
||
|
||
/**
|
||
* Creates a `baseEach` or `baseEachRight` function.
|
||
*
|
||
* @private
|
||
* @param {Function} eachFunc The function to iterate over a collection.
|
||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||
* @returns {Function} Returns the new base function.
|
||
*/
|
||
function createBaseEach(eachFunc, fromRight) {
|
||
return function(collection, iteratee) {
|
||
if (collection == null) {
|
||
return collection;
|
||
}
|
||
if (!isArrayLike(collection)) {
|
||
return eachFunc(collection, iteratee);
|
||
}
|
||
var length = collection.length,
|
||
index = fromRight ? length : -1,
|
||
iterable = Object(collection);
|
||
|
||
while ((fromRight ? index-- : ++index < length)) {
|
||
if (iteratee(iterable[index], index, iterable) === false) {
|
||
break;
|
||
}
|
||
}
|
||
return collection;
|
||
};
|
||
}
|
||
|
||
module.exports = createBaseEach;
|
||
|
||
|
||
/***/ }),
|
||
/* 326 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
||
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
||
*
|
||
* @private
|
||
* @param {Array|Object} collection The collection to iterate over.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @param {*} accumulator The initial value.
|
||
* @param {boolean} initAccum Specify using the first or last element of
|
||
* `collection` as the initial value.
|
||
* @param {Function} eachFunc The function to iterate over `collection`.
|
||
* @returns {*} Returns the accumulated value.
|
||
*/
|
||
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
||
eachFunc(collection, function(value, index, collection) {
|
||
accumulator = initAccum
|
||
? (initAccum = false, value)
|
||
: iteratee(accumulator, value, index, collection);
|
||
});
|
||
return accumulator;
|
||
}
|
||
|
||
module.exports = baseReduce;
|
||
|
||
|
||
/***/ }),
|
||
/* 327 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var createFind = __webpack_require__(137),
|
||
findLastIndex = __webpack_require__(328);
|
||
|
||
/**
|
||
* This method is like `_.find` except that it iterates over elements of
|
||
* `collection` from right to left.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 2.0.0
|
||
* @category Collection
|
||
* @param {Array|Object} collection The collection to inspect.
|
||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
||
* @returns {*} Returns the matched element, else `undefined`.
|
||
* @example
|
||
*
|
||
* _.findLast([1, 2, 3, 4], function(n) {
|
||
* return n % 2 == 1;
|
||
* });
|
||
* // => 3
|
||
*/
|
||
var findLast = createFind(findLastIndex);
|
||
|
||
module.exports = findLast;
|
||
|
||
|
||
/***/ }),
|
||
/* 328 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseFindIndex = __webpack_require__(93),
|
||
baseIteratee = __webpack_require__(18),
|
||
toInteger = __webpack_require__(111);
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeMax = Math.max,
|
||
nativeMin = Math.min;
|
||
|
||
/**
|
||
* This method is like `_.findIndex` except that it iterates over elements
|
||
* of `collection` from right to left.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 2.0.0
|
||
* @category Array
|
||
* @param {Array} array The array to inspect.
|
||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||
* @returns {number} Returns the index of the found element, else `-1`.
|
||
* @example
|
||
*
|
||
* var users = [
|
||
* { 'user': 'barney', 'active': true },
|
||
* { 'user': 'fred', 'active': false },
|
||
* { 'user': 'pebbles', 'active': false }
|
||
* ];
|
||
*
|
||
* _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
|
||
* // => 2
|
||
*
|
||
* // The `_.matches` iteratee shorthand.
|
||
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
||
* // => 0
|
||
*
|
||
* // The `_.matchesProperty` iteratee shorthand.
|
||
* _.findLastIndex(users, ['active', false]);
|
||
* // => 2
|
||
*
|
||
* // The `_.property` iteratee shorthand.
|
||
* _.findLastIndex(users, 'active');
|
||
* // => 0
|
||
*/
|
||
function findLastIndex(array, predicate, fromIndex) {
|
||
var length = array == null ? 0 : array.length;
|
||
if (!length) {
|
||
return -1;
|
||
}
|
||
var index = length - 1;
|
||
if (fromIndex !== undefined) {
|
||
index = toInteger(fromIndex);
|
||
index = fromIndex < 0
|
||
? nativeMax(length + index, 0)
|
||
: nativeMin(index, length - 1);
|
||
}
|
||
return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
|
||
}
|
||
|
||
module.exports = findLastIndex;
|
||
|
||
|
||
/***/ }),
|
||
/* 329 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _interopRequireDefault(obj) {
|
||
return obj && obj.__esModule ? obj : {
|
||
default: obj
|
||
};
|
||
}
|
||
|
||
module.exports = _interopRequireDefault;
|
||
|
||
/***/ }),
|
||
/* 330 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/**
|
||
* Copyright (c) 2013-present, Facebook, Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*
|
||
* @typechecks
|
||
*
|
||
*/
|
||
|
||
/*eslint-disable no-self-compare */
|
||
|
||
|
||
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
||
/**
|
||
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
||
*/
|
||
function is(x, y) {
|
||
// SameValue algorithm
|
||
if (x === y) {
|
||
// Steps 1-5, 7-10
|
||
// Steps 6.b-6.e: +0 != -0
|
||
// Added the nonzero y check to make Flow happy, but it is redundant
|
||
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
||
} else {
|
||
// Step 6.a: NaN == NaN
|
||
return x !== x && y !== y;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Performs equality by iterating through keys on an object and returning false
|
||
* when any key has values which are not strictly equal between the arguments.
|
||
* Returns true when the values of all keys are strictly equal.
|
||
*/
|
||
function shallowEqual(objA, objB) {
|
||
if (is(objA, objB)) {
|
||
return true;
|
||
}
|
||
|
||
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
||
return false;
|
||
}
|
||
|
||
var keysA = Object.keys(objA);
|
||
var keysB = Object.keys(objB);
|
||
|
||
if (keysA.length !== keysB.length) {
|
||
return false;
|
||
}
|
||
|
||
// Test for A's keys different from B.
|
||
for (var i = 0; i < keysA.length; i++) {
|
||
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
module.exports = shallowEqual;
|
||
|
||
/***/ }),
|
||
/* 331 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ixInstances = void 0;
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _shared = __webpack_require__(30);
|
||
|
||
var _timm = __webpack_require__(40);
|
||
/* eslint-env browser */
|
||
|
||
|
||
var _constants$IX2EngineA = _constants.IX2EngineActionTypes,
|
||
IX2_RAW_DATA_IMPORTED = _constants$IX2EngineA.IX2_RAW_DATA_IMPORTED,
|
||
IX2_SESSION_STOPPED = _constants$IX2EngineA.IX2_SESSION_STOPPED,
|
||
IX2_INSTANCE_ADDED = _constants$IX2EngineA.IX2_INSTANCE_ADDED,
|
||
IX2_INSTANCE_STARTED = _constants$IX2EngineA.IX2_INSTANCE_STARTED,
|
||
IX2_INSTANCE_REMOVED = _constants$IX2EngineA.IX2_INSTANCE_REMOVED,
|
||
IX2_ANIMATION_FRAME_CHANGED = _constants$IX2EngineA.IX2_ANIMATION_FRAME_CHANGED;
|
||
var _shared$IX2EasingUtil = _shared.IX2EasingUtils,
|
||
optimizeFloat = _shared$IX2EasingUtil.optimizeFloat,
|
||
applyEasing = _shared$IX2EasingUtil.applyEasing,
|
||
createBezierEasing = _shared$IX2EasingUtil.createBezierEasing;
|
||
var RENDER_GENERAL = _constants.IX2EngineConstants.RENDER_GENERAL;
|
||
var _shared$IX2VanillaUti = _shared.IX2VanillaUtils,
|
||
getItemConfigByKey = _shared$IX2VanillaUti.getItemConfigByKey,
|
||
getRenderType = _shared$IX2VanillaUti.getRenderType,
|
||
getStyleProp = _shared$IX2VanillaUti.getStyleProp;
|
||
|
||
var continuousInstance = function continuousInstance(state, action) {
|
||
var lastPosition = state.position,
|
||
parameterId = state.parameterId,
|
||
actionGroups = state.actionGroups,
|
||
destinationKeys = state.destinationKeys,
|
||
smoothing = state.smoothing,
|
||
restingValue = state.restingValue,
|
||
actionTypeId = state.actionTypeId,
|
||
customEasingFn = state.customEasingFn,
|
||
skipMotion = state.skipMotion,
|
||
skipToValue = state.skipToValue;
|
||
var parameters = action.payload.parameters;
|
||
var velocity = Math.max(1 - smoothing, 0.01);
|
||
var paramValue = parameters[parameterId];
|
||
|
||
if (paramValue == null) {
|
||
velocity = 1;
|
||
paramValue = restingValue;
|
||
}
|
||
|
||
var nextPosition = Math.max(paramValue, 0) || 0;
|
||
var positionDiff = optimizeFloat(nextPosition - lastPosition);
|
||
var position = skipMotion ? skipToValue : optimizeFloat(lastPosition + positionDiff * velocity);
|
||
var keyframePosition = position * 100;
|
||
|
||
if (position === lastPosition && state.current) {
|
||
return state;
|
||
}
|
||
|
||
var fromActionItem;
|
||
var toActionItem;
|
||
var positionOffset;
|
||
var positionRange;
|
||
|
||
for (var i = 0, length = actionGroups.length; i < length; i++) {
|
||
var _actionGroups$i = actionGroups[i],
|
||
keyframe = _actionGroups$i.keyframe,
|
||
actionItems = _actionGroups$i.actionItems;
|
||
|
||
if (i === 0) {
|
||
fromActionItem = actionItems[0];
|
||
}
|
||
|
||
if (keyframePosition >= keyframe) {
|
||
fromActionItem = actionItems[0];
|
||
var nextGroup = actionGroups[i + 1];
|
||
var hasNextItem = nextGroup && keyframePosition !== keyframe;
|
||
toActionItem = hasNextItem ? nextGroup.actionItems[0] : null;
|
||
|
||
if (hasNextItem) {
|
||
positionOffset = keyframe / 100;
|
||
positionRange = (nextGroup.keyframe - keyframe) / 100;
|
||
}
|
||
}
|
||
}
|
||
|
||
var current = {};
|
||
|
||
if (fromActionItem && !toActionItem) {
|
||
for (var _i = 0, _length = destinationKeys.length; _i < _length; _i++) {
|
||
var key = destinationKeys[_i];
|
||
current[key] = getItemConfigByKey(actionTypeId, key, fromActionItem.config);
|
||
}
|
||
} else if (fromActionItem && toActionItem && positionOffset !== undefined && positionRange !== undefined) {
|
||
var localPosition = (position - positionOffset) / positionRange;
|
||
var easing = fromActionItem.config.easing;
|
||
var eased = applyEasing(easing, localPosition, customEasingFn);
|
||
|
||
for (var _i2 = 0, _length2 = destinationKeys.length; _i2 < _length2; _i2++) {
|
||
var _key = destinationKeys[_i2];
|
||
var fromVal = getItemConfigByKey(actionTypeId, _key, fromActionItem.config);
|
||
var toVal = getItemConfigByKey(actionTypeId, _key, toActionItem.config); // $FlowFixMe — toVal and fromVal could potentially be null, need to update type higher to determine number
|
||
|
||
var diff = toVal - fromVal; // $FlowFixMe
|
||
|
||
var value = diff * eased + fromVal;
|
||
current[_key] = value;
|
||
}
|
||
}
|
||
|
||
return (0, _timm.merge)(state, {
|
||
position: position,
|
||
current: current
|
||
});
|
||
};
|
||
|
||
var timedInstance = function timedInstance(state, action) {
|
||
var _state = state,
|
||
active = _state.active,
|
||
origin = _state.origin,
|
||
start = _state.start,
|
||
immediate = _state.immediate,
|
||
renderType = _state.renderType,
|
||
verbose = _state.verbose,
|
||
actionItem = _state.actionItem,
|
||
destination = _state.destination,
|
||
destinationKeys = _state.destinationKeys,
|
||
pluginDuration = _state.pluginDuration,
|
||
instanceDelay = _state.instanceDelay,
|
||
customEasingFn = _state.customEasingFn,
|
||
skipMotion = _state.skipMotion;
|
||
var easing = actionItem.config.easing;
|
||
var _actionItem$config = actionItem.config,
|
||
duration = _actionItem$config.duration,
|
||
delay = _actionItem$config.delay;
|
||
|
||
if (pluginDuration != null) {
|
||
duration = pluginDuration;
|
||
}
|
||
|
||
delay = instanceDelay != null ? instanceDelay : delay;
|
||
|
||
if (renderType === RENDER_GENERAL) {
|
||
duration = 0;
|
||
} else if (immediate || skipMotion) {
|
||
duration = delay = 0;
|
||
}
|
||
|
||
var now = action.payload.now;
|
||
|
||
if (active && origin) {
|
||
var delta = now - (start + delay);
|
||
|
||
if (verbose) {
|
||
var verboseDelta = now - start;
|
||
var verboseDuration = duration + delay;
|
||
var verbosePosition = optimizeFloat(Math.min(Math.max(0, verboseDelta / verboseDuration), 1));
|
||
state = (0, _timm.set)(state, 'verboseTimeElapsed', verboseDuration * verbosePosition);
|
||
}
|
||
|
||
if (delta < 0) {
|
||
return state;
|
||
}
|
||
|
||
var position = optimizeFloat(Math.min(Math.max(0, delta / duration), 1));
|
||
var eased = applyEasing(easing, position, customEasingFn);
|
||
var newProps = {};
|
||
var current = null;
|
||
|
||
if (destinationKeys.length) {
|
||
current = destinationKeys.reduce(function (result, key) {
|
||
var destValue = destination[key];
|
||
var originVal = parseFloat(origin[key]) || 0;
|
||
var diff = parseFloat(destValue) - originVal;
|
||
var value = diff * eased + originVal;
|
||
result[key] = value;
|
||
return result;
|
||
}, {});
|
||
}
|
||
|
||
newProps.current = current;
|
||
newProps.position = position;
|
||
|
||
if (position === 1) {
|
||
newProps.active = false;
|
||
newProps.complete = true;
|
||
}
|
||
|
||
return (0, _timm.merge)(state, newProps);
|
||
}
|
||
|
||
return state;
|
||
};
|
||
|
||
var ixInstances = function ixInstances() {
|
||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Object.freeze({});
|
||
var action = arguments.length > 1 ? arguments[1] : undefined;
|
||
|
||
switch (action.type) {
|
||
case IX2_RAW_DATA_IMPORTED:
|
||
{
|
||
return action.payload.ixInstances || Object.freeze({});
|
||
}
|
||
|
||
case IX2_SESSION_STOPPED:
|
||
{
|
||
return Object.freeze({});
|
||
}
|
||
|
||
case IX2_INSTANCE_ADDED:
|
||
{
|
||
var _action$payload = action.payload,
|
||
instanceId = _action$payload.instanceId,
|
||
elementId = _action$payload.elementId,
|
||
actionItem = _action$payload.actionItem,
|
||
eventId = _action$payload.eventId,
|
||
eventTarget = _action$payload.eventTarget,
|
||
eventStateKey = _action$payload.eventStateKey,
|
||
actionListId = _action$payload.actionListId,
|
||
groupIndex = _action$payload.groupIndex,
|
||
isCarrier = _action$payload.isCarrier,
|
||
origin = _action$payload.origin,
|
||
destination = _action$payload.destination,
|
||
immediate = _action$payload.immediate,
|
||
verbose = _action$payload.verbose,
|
||
continuous = _action$payload.continuous,
|
||
parameterId = _action$payload.parameterId,
|
||
actionGroups = _action$payload.actionGroups,
|
||
smoothing = _action$payload.smoothing,
|
||
restingValue = _action$payload.restingValue,
|
||
pluginInstance = _action$payload.pluginInstance,
|
||
pluginDuration = _action$payload.pluginDuration,
|
||
instanceDelay = _action$payload.instanceDelay,
|
||
skipMotion = _action$payload.skipMotion,
|
||
skipToValue = _action$payload.skipToValue;
|
||
var actionTypeId = actionItem.actionTypeId;
|
||
var renderType = getRenderType(actionTypeId);
|
||
var styleProp = getStyleProp(renderType, actionTypeId);
|
||
var destinationKeys = Object.keys(destination).filter(function (key) {
|
||
return destination[key] != null;
|
||
});
|
||
var easing = actionItem.config.easing;
|
||
return (0, _timm.set)(state, instanceId, {
|
||
id: instanceId,
|
||
elementId: elementId,
|
||
active: false,
|
||
position: 0,
|
||
start: 0,
|
||
origin: origin,
|
||
destination: destination,
|
||
destinationKeys: destinationKeys,
|
||
immediate: immediate,
|
||
verbose: verbose,
|
||
current: null,
|
||
actionItem: actionItem,
|
||
actionTypeId: actionTypeId,
|
||
eventId: eventId,
|
||
eventTarget: eventTarget,
|
||
eventStateKey: eventStateKey,
|
||
actionListId: actionListId,
|
||
groupIndex: groupIndex,
|
||
renderType: renderType,
|
||
isCarrier: isCarrier,
|
||
styleProp: styleProp,
|
||
continuous: continuous,
|
||
parameterId: parameterId,
|
||
actionGroups: actionGroups,
|
||
smoothing: smoothing,
|
||
restingValue: restingValue,
|
||
pluginInstance: pluginInstance,
|
||
pluginDuration: pluginDuration,
|
||
instanceDelay: instanceDelay,
|
||
skipMotion: skipMotion,
|
||
skipToValue: skipToValue,
|
||
customEasingFn: Array.isArray(easing) && easing.length === 4 ? createBezierEasing(easing) : undefined
|
||
});
|
||
}
|
||
|
||
case IX2_INSTANCE_STARTED:
|
||
{
|
||
var _action$payload2 = action.payload,
|
||
_instanceId = _action$payload2.instanceId,
|
||
time = _action$payload2.time;
|
||
return (0, _timm.mergeIn)(state, [_instanceId], {
|
||
active: true,
|
||
complete: false,
|
||
start: time
|
||
});
|
||
}
|
||
|
||
case IX2_INSTANCE_REMOVED:
|
||
{
|
||
var _instanceId2 = action.payload.instanceId;
|
||
|
||
if (!state[_instanceId2]) {
|
||
return state;
|
||
}
|
||
|
||
var newState = {};
|
||
var keys = Object.keys(state);
|
||
var length = keys.length;
|
||
|
||
for (var i = 0; i < length; i++) {
|
||
var key = keys[i];
|
||
|
||
if (key !== _instanceId2) {
|
||
newState[key] = state[key];
|
||
}
|
||
}
|
||
|
||
return newState;
|
||
}
|
||
|
||
case IX2_ANIMATION_FRAME_CHANGED:
|
||
{
|
||
var _newState = state;
|
||
|
||
var _keys = Object.keys(state);
|
||
|
||
var _length3 = _keys.length;
|
||
|
||
for (var _i3 = 0; _i3 < _length3; _i3++) {
|
||
var _key2 = _keys[_i3];
|
||
var instance = state[_key2];
|
||
var reducer = instance.continuous ? continuousInstance : timedInstance;
|
||
_newState = (0, _timm.set)(_newState, _key2, reducer(instance, action));
|
||
}
|
||
|
||
return _newState;
|
||
}
|
||
|
||
default:
|
||
{
|
||
return state;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.ixInstances = ixInstances;
|
||
|
||
/***/ }),
|
||
/* 332 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.ixParameters = void 0;
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _constants$IX2EngineA = _constants.IX2EngineActionTypes,
|
||
IX2_RAW_DATA_IMPORTED = _constants$IX2EngineA.IX2_RAW_DATA_IMPORTED,
|
||
IX2_SESSION_STOPPED = _constants$IX2EngineA.IX2_SESSION_STOPPED,
|
||
IX2_PARAMETER_CHANGED = _constants$IX2EngineA.IX2_PARAMETER_CHANGED; // prettier-ignore
|
||
|
||
var ixParameters = function ixParameters() {
|
||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
||
/*mutable flat state*/
|
||
};
|
||
var action = arguments.length > 1 ? arguments[1] : undefined;
|
||
|
||
switch (action.type) {
|
||
case IX2_RAW_DATA_IMPORTED:
|
||
{
|
||
return action.payload.ixParameters || {
|
||
/*mutable flat state*/
|
||
};
|
||
}
|
||
|
||
case IX2_SESSION_STOPPED:
|
||
{
|
||
return {
|
||
/*mutable flat state*/
|
||
};
|
||
}
|
||
|
||
case IX2_PARAMETER_CHANGED:
|
||
{
|
||
var _action$payload = action.payload,
|
||
key = _action$payload.key,
|
||
value = _action$payload.value;
|
||
state[key] = value;
|
||
return state;
|
||
}
|
||
|
||
default:
|
||
{
|
||
return state;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.ixParameters = ixParameters;
|
||
|
||
/***/ }),
|
||
/* 333 */
|
||
/***/ (function(module, exports) {
|
||
|
||
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;
|
||
}
|
||
|
||
module.exports = _objectWithoutPropertiesLoose;
|
||
|
||
/***/ }),
|
||
/* 334 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseKeys = __webpack_require__(65),
|
||
getTag = __webpack_require__(67),
|
||
isArrayLike = __webpack_require__(26),
|
||
isString = __webpack_require__(335),
|
||
stringSize = __webpack_require__(336);
|
||
|
||
/** `Object#toString` result references. */
|
||
var mapTag = '[object Map]',
|
||
setTag = '[object Set]';
|
||
|
||
/**
|
||
* Gets the size of `collection` by returning its length for array-like
|
||
* values or the number of own enumerable string keyed properties for objects.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Collection
|
||
* @param {Array|Object|string} collection The collection to inspect.
|
||
* @returns {number} Returns the collection size.
|
||
* @example
|
||
*
|
||
* _.size([1, 2, 3]);
|
||
* // => 3
|
||
*
|
||
* _.size({ 'a': 1, 'b': 2 });
|
||
* // => 2
|
||
*
|
||
* _.size('pebbles');
|
||
* // => 7
|
||
*/
|
||
function size(collection) {
|
||
if (collection == null) {
|
||
return 0;
|
||
}
|
||
if (isArrayLike(collection)) {
|
||
return isString(collection) ? stringSize(collection) : collection.length;
|
||
}
|
||
var tag = getTag(collection);
|
||
if (tag == mapTag || tag == setTag) {
|
||
return collection.size;
|
||
}
|
||
return baseKeys(collection).length;
|
||
}
|
||
|
||
module.exports = size;
|
||
|
||
|
||
/***/ }),
|
||
/* 335 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGetTag = __webpack_require__(25),
|
||
isArray = __webpack_require__(2),
|
||
isObjectLike = __webpack_require__(20);
|
||
|
||
/** `Object#toString` result references. */
|
||
var stringTag = '[object String]';
|
||
|
||
/**
|
||
* Checks if `value` is classified as a `String` primitive or object.
|
||
*
|
||
* @static
|
||
* @since 0.1.0
|
||
* @memberOf _
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
||
* @example
|
||
*
|
||
* _.isString('abc');
|
||
* // => true
|
||
*
|
||
* _.isString(1);
|
||
* // => false
|
||
*/
|
||
function isString(value) {
|
||
return typeof value == 'string' ||
|
||
(!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
|
||
}
|
||
|
||
module.exports = isString;
|
||
|
||
|
||
/***/ }),
|
||
/* 336 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var asciiSize = __webpack_require__(337),
|
||
hasUnicode = __webpack_require__(338),
|
||
unicodeSize = __webpack_require__(339);
|
||
|
||
/**
|
||
* Gets the number of symbols in `string`.
|
||
*
|
||
* @private
|
||
* @param {string} string The string to inspect.
|
||
* @returns {number} Returns the string size.
|
||
*/
|
||
function stringSize(string) {
|
||
return hasUnicode(string)
|
||
? unicodeSize(string)
|
||
: asciiSize(string);
|
||
}
|
||
|
||
module.exports = stringSize;
|
||
|
||
|
||
/***/ }),
|
||
/* 337 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseProperty = __webpack_require__(110);
|
||
|
||
/**
|
||
* Gets the size of an ASCII `string`.
|
||
*
|
||
* @private
|
||
* @param {string} string The string inspect.
|
||
* @returns {number} Returns the string size.
|
||
*/
|
||
var asciiSize = baseProperty('length');
|
||
|
||
module.exports = asciiSize;
|
||
|
||
|
||
/***/ }),
|
||
/* 338 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used to compose unicode character classes. */
|
||
var rsAstralRange = '\\ud800-\\udfff',
|
||
rsComboMarksRange = '\\u0300-\\u036f',
|
||
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
||
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
||
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
||
rsVarRange = '\\ufe0e\\ufe0f';
|
||
|
||
/** Used to compose unicode capture groups. */
|
||
var rsZWJ = '\\u200d';
|
||
|
||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
||
|
||
/**
|
||
* Checks if `string` contains Unicode symbols.
|
||
*
|
||
* @private
|
||
* @param {string} string The string to inspect.
|
||
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
||
*/
|
||
function hasUnicode(string) {
|
||
return reHasUnicode.test(string);
|
||
}
|
||
|
||
module.exports = hasUnicode;
|
||
|
||
|
||
/***/ }),
|
||
/* 339 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used to compose unicode character classes. */
|
||
var rsAstralRange = '\\ud800-\\udfff',
|
||
rsComboMarksRange = '\\u0300-\\u036f',
|
||
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
||
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
||
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
||
rsVarRange = '\\ufe0e\\ufe0f';
|
||
|
||
/** Used to compose unicode capture groups. */
|
||
var rsAstral = '[' + rsAstralRange + ']',
|
||
rsCombo = '[' + rsComboRange + ']',
|
||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||
rsNonAstral = '[^' + rsAstralRange + ']',
|
||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||
rsZWJ = '\\u200d';
|
||
|
||
/** Used to compose unicode regexes. */
|
||
var reOptMod = rsModifier + '?',
|
||
rsOptVar = '[' + rsVarRange + ']?',
|
||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||
|
||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||
|
||
/**
|
||
* Gets the size of a Unicode `string`.
|
||
*
|
||
* @private
|
||
* @param {string} string The string inspect.
|
||
* @returns {number} Returns the string size.
|
||
*/
|
||
function unicodeSize(string) {
|
||
var result = reUnicode.lastIndex = 0;
|
||
while (reUnicode.test(string)) {
|
||
++result;
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = unicodeSize;
|
||
|
||
|
||
/***/ }),
|
||
/* 340 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseIteratee = __webpack_require__(18),
|
||
negate = __webpack_require__(341),
|
||
pickBy = __webpack_require__(342);
|
||
|
||
/**
|
||
* The opposite of `_.pickBy`; this method creates an object composed of
|
||
* the own and inherited enumerable string keyed properties of `object` that
|
||
* `predicate` doesn't return truthy for. The predicate is invoked with two
|
||
* arguments: (value, key).
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Object
|
||
* @param {Object} object The source object.
|
||
* @param {Function} [predicate=_.identity] The function invoked per property.
|
||
* @returns {Object} Returns the new object.
|
||
* @example
|
||
*
|
||
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
||
*
|
||
* _.omitBy(object, _.isNumber);
|
||
* // => { 'b': '2' }
|
||
*/
|
||
function omitBy(object, predicate) {
|
||
return pickBy(object, negate(baseIteratee(predicate)));
|
||
}
|
||
|
||
module.exports = omitBy;
|
||
|
||
|
||
/***/ }),
|
||
/* 341 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Error message constants. */
|
||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||
|
||
/**
|
||
* Creates a function that negates the result of the predicate `func`. The
|
||
* `func` predicate is invoked with the `this` binding and arguments of the
|
||
* created function.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 3.0.0
|
||
* @category Function
|
||
* @param {Function} predicate The predicate to negate.
|
||
* @returns {Function} Returns the new negated function.
|
||
* @example
|
||
*
|
||
* function isEven(n) {
|
||
* return n % 2 == 0;
|
||
* }
|
||
*
|
||
* _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
|
||
* // => [1, 3, 5]
|
||
*/
|
||
function negate(predicate) {
|
||
if (typeof predicate != 'function') {
|
||
throw new TypeError(FUNC_ERROR_TEXT);
|
||
}
|
||
return function() {
|
||
var args = arguments;
|
||
switch (args.length) {
|
||
case 0: return !predicate.call(this);
|
||
case 1: return !predicate.call(this, args[0]);
|
||
case 2: return !predicate.call(this, args[0], args[1]);
|
||
case 3: return !predicate.call(this, args[0], args[1], args[2]);
|
||
}
|
||
return !predicate.apply(this, args);
|
||
};
|
||
}
|
||
|
||
module.exports = negate;
|
||
|
||
|
||
/***/ }),
|
||
/* 342 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayMap = __webpack_require__(109),
|
||
baseIteratee = __webpack_require__(18),
|
||
basePickBy = __webpack_require__(343),
|
||
getAllKeysIn = __webpack_require__(346);
|
||
|
||
/**
|
||
* Creates an object composed of the `object` properties `predicate` returns
|
||
* truthy for. The predicate is invoked with two arguments: (value, key).
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Object
|
||
* @param {Object} object The source object.
|
||
* @param {Function} [predicate=_.identity] The function invoked per property.
|
||
* @returns {Object} Returns the new object.
|
||
* @example
|
||
*
|
||
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
||
*
|
||
* _.pickBy(object, _.isNumber);
|
||
* // => { 'a': 1, 'c': 3 }
|
||
*/
|
||
function pickBy(object, predicate) {
|
||
if (object == null) {
|
||
return {};
|
||
}
|
||
var props = arrayMap(getAllKeysIn(object), function(prop) {
|
||
return [prop];
|
||
});
|
||
predicate = baseIteratee(predicate);
|
||
return basePickBy(object, props, function(value, path) {
|
||
return predicate(value, path[0]);
|
||
});
|
||
}
|
||
|
||
module.exports = pickBy;
|
||
|
||
|
||
/***/ }),
|
||
/* 343 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGet = __webpack_require__(69),
|
||
baseSet = __webpack_require__(344),
|
||
castPath = __webpack_require__(49);
|
||
|
||
/**
|
||
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Object} object The source object.
|
||
* @param {string[]} paths The property paths to pick.
|
||
* @param {Function} predicate The function invoked per property.
|
||
* @returns {Object} Returns the new object.
|
||
*/
|
||
function basePickBy(object, paths, predicate) {
|
||
var index = -1,
|
||
length = paths.length,
|
||
result = {};
|
||
|
||
while (++index < length) {
|
||
var path = paths[index],
|
||
value = baseGet(object, path);
|
||
|
||
if (predicate(value, path)) {
|
||
baseSet(result, castPath(path, object), value);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = basePickBy;
|
||
|
||
|
||
/***/ }),
|
||
/* 344 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var assignValue = __webpack_require__(345),
|
||
castPath = __webpack_require__(49),
|
||
isIndex = __webpack_require__(62),
|
||
isObject = __webpack_require__(12),
|
||
toKey = __webpack_require__(33);
|
||
|
||
/**
|
||
* The base implementation of `_.set`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to modify.
|
||
* @param {Array|string} path The path of the property to set.
|
||
* @param {*} value The value to set.
|
||
* @param {Function} [customizer] The function to customize path creation.
|
||
* @returns {Object} Returns `object`.
|
||
*/
|
||
function baseSet(object, path, value, customizer) {
|
||
if (!isObject(object)) {
|
||
return object;
|
||
}
|
||
path = castPath(path, object);
|
||
|
||
var index = -1,
|
||
length = path.length,
|
||
lastIndex = length - 1,
|
||
nested = object;
|
||
|
||
while (nested != null && ++index < length) {
|
||
var key = toKey(path[index]),
|
||
newValue = value;
|
||
|
||
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
||
return object;
|
||
}
|
||
|
||
if (index != lastIndex) {
|
||
var objValue = nested[key];
|
||
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
||
if (newValue === undefined) {
|
||
newValue = isObject(objValue)
|
||
? objValue
|
||
: (isIndex(path[index + 1]) ? [] : {});
|
||
}
|
||
}
|
||
assignValue(nested, key, newValue);
|
||
nested = nested[key];
|
||
}
|
||
return object;
|
||
}
|
||
|
||
module.exports = baseSet;
|
||
|
||
|
||
/***/ }),
|
||
/* 345 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseAssignValue = __webpack_require__(147),
|
||
eq = __webpack_require__(57);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||
* for equality comparisons.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to modify.
|
||
* @param {string} key The key of the property to assign.
|
||
* @param {*} value The value to assign.
|
||
*/
|
||
function assignValue(object, key, value) {
|
||
var objValue = object[key];
|
||
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
||
(value === undefined && !(key in object))) {
|
||
baseAssignValue(object, key, value);
|
||
}
|
||
}
|
||
|
||
module.exports = assignValue;
|
||
|
||
|
||
/***/ }),
|
||
/* 346 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseGetAllKeys = __webpack_require__(100),
|
||
getSymbolsIn = __webpack_require__(347),
|
||
keysIn = __webpack_require__(349);
|
||
|
||
/**
|
||
* Creates an array of own and inherited enumerable property names and
|
||
* symbols of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of property names and symbols.
|
||
*/
|
||
function getAllKeysIn(object) {
|
||
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
||
}
|
||
|
||
module.exports = getAllKeysIn;
|
||
|
||
|
||
/***/ }),
|
||
/* 347 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayPush = __webpack_require__(60),
|
||
getPrototype = __webpack_require__(348),
|
||
getSymbols = __webpack_require__(101),
|
||
stubArray = __webpack_require__(102);
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
||
|
||
/**
|
||
* Creates an array of the own and inherited enumerable symbols of `object`.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of symbols.
|
||
*/
|
||
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
||
var result = [];
|
||
while (object) {
|
||
arrayPush(result, getSymbols(object));
|
||
object = getPrototype(object);
|
||
}
|
||
return result;
|
||
};
|
||
|
||
module.exports = getSymbolsIn;
|
||
|
||
|
||
/***/ }),
|
||
/* 348 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var overArg = __webpack_require__(105);
|
||
|
||
/** Built-in value references. */
|
||
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
||
|
||
module.exports = getPrototype;
|
||
|
||
|
||
/***/ }),
|
||
/* 349 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayLikeKeys = __webpack_require__(103),
|
||
baseKeysIn = __webpack_require__(350),
|
||
isArrayLike = __webpack_require__(26);
|
||
|
||
/**
|
||
* Creates an array of the own and inherited enumerable property names of `object`.
|
||
*
|
||
* **Note:** Non-object values are coerced to objects.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 3.0.0
|
||
* @category Object
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of property names.
|
||
* @example
|
||
*
|
||
* function Foo() {
|
||
* this.a = 1;
|
||
* this.b = 2;
|
||
* }
|
||
*
|
||
* Foo.prototype.c = 3;
|
||
*
|
||
* _.keysIn(new Foo);
|
||
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
||
*/
|
||
function keysIn(object) {
|
||
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
||
}
|
||
|
||
module.exports = keysIn;
|
||
|
||
|
||
/***/ }),
|
||
/* 350 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(12),
|
||
isPrototype = __webpack_require__(66),
|
||
nativeKeysIn = __webpack_require__(351);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of property names.
|
||
*/
|
||
function baseKeysIn(object) {
|
||
if (!isObject(object)) {
|
||
return nativeKeysIn(object);
|
||
}
|
||
var isProto = isPrototype(object),
|
||
result = [];
|
||
|
||
for (var key in object) {
|
||
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
||
result.push(key);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = baseKeysIn;
|
||
|
||
|
||
/***/ }),
|
||
/* 351 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* This function is like
|
||
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||
* except that it includes inherited enumerable properties.
|
||
*
|
||
* @private
|
||
* @param {Object} object The object to query.
|
||
* @returns {Array} Returns the array of property names.
|
||
*/
|
||
function nativeKeysIn(object) {
|
||
var result = [];
|
||
if (object != null) {
|
||
for (var key in Object(object)) {
|
||
result.push(key);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = nativeKeysIn;
|
||
|
||
|
||
/***/ }),
|
||
/* 352 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseKeys = __webpack_require__(65),
|
||
getTag = __webpack_require__(67),
|
||
isArguments = __webpack_require__(48),
|
||
isArray = __webpack_require__(2),
|
||
isArrayLike = __webpack_require__(26),
|
||
isBuffer = __webpack_require__(61),
|
||
isPrototype = __webpack_require__(66),
|
||
isTypedArray = __webpack_require__(63);
|
||
|
||
/** `Object#toString` result references. */
|
||
var mapTag = '[object Map]',
|
||
setTag = '[object Set]';
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Checks if `value` is an empty object, collection, map, or set.
|
||
*
|
||
* Objects are considered empty if they have no own enumerable string keyed
|
||
* properties.
|
||
*
|
||
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
|
||
* jQuery-like collections are considered empty if they have a `length` of `0`.
|
||
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Lang
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
||
* @example
|
||
*
|
||
* _.isEmpty(null);
|
||
* // => true
|
||
*
|
||
* _.isEmpty(true);
|
||
* // => true
|
||
*
|
||
* _.isEmpty(1);
|
||
* // => true
|
||
*
|
||
* _.isEmpty([1, 2, 3]);
|
||
* // => false
|
||
*
|
||
* _.isEmpty({ 'a': 1 });
|
||
* // => false
|
||
*/
|
||
function isEmpty(value) {
|
||
if (value == null) {
|
||
return true;
|
||
}
|
||
if (isArrayLike(value) &&
|
||
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
||
return !value.length;
|
||
}
|
||
var tag = getTag(value);
|
||
if (tag == mapTag || tag == setTag) {
|
||
return !value.size;
|
||
}
|
||
if (isPrototype(value)) {
|
||
return !baseKeys(value).length;
|
||
}
|
||
for (var key in value) {
|
||
if (hasOwnProperty.call(value, key)) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
module.exports = isEmpty;
|
||
|
||
|
||
/***/ }),
|
||
/* 353 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseAssignValue = __webpack_require__(147),
|
||
baseForOwn = __webpack_require__(144),
|
||
baseIteratee = __webpack_require__(18);
|
||
|
||
/**
|
||
* Creates an object with the same keys as `object` and values generated
|
||
* by running each own enumerable string keyed property of `object` thru
|
||
* `iteratee`. The iteratee is invoked with three arguments:
|
||
* (value, key, object).
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 2.4.0
|
||
* @category Object
|
||
* @param {Object} object The object to iterate over.
|
||
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||
* @returns {Object} Returns the new mapped object.
|
||
* @see _.mapKeys
|
||
* @example
|
||
*
|
||
* var users = {
|
||
* 'fred': { 'user': 'fred', 'age': 40 },
|
||
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
||
* };
|
||
*
|
||
* _.mapValues(users, function(o) { return o.age; });
|
||
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
||
*
|
||
* // The `_.property` iteratee shorthand.
|
||
* _.mapValues(users, 'age');
|
||
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
||
*/
|
||
function mapValues(object, iteratee) {
|
||
var result = {};
|
||
iteratee = baseIteratee(iteratee, 3);
|
||
|
||
baseForOwn(object, function(value, key, object) {
|
||
baseAssignValue(result, key, iteratee(value, key, object));
|
||
});
|
||
return result;
|
||
}
|
||
|
||
module.exports = mapValues;
|
||
|
||
|
||
/***/ }),
|
||
/* 354 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayEach = __webpack_require__(355),
|
||
baseEach = __webpack_require__(143),
|
||
castFunction = __webpack_require__(356),
|
||
isArray = __webpack_require__(2);
|
||
|
||
/**
|
||
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
||
* The iteratee is invoked with three arguments: (value, index|key, collection).
|
||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||
*
|
||
* **Note:** As with other "Collections" methods, objects with a "length"
|
||
* property are iterated like arrays. To avoid this behavior use `_.forIn`
|
||
* or `_.forOwn` for object iteration.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @alias each
|
||
* @category Collection
|
||
* @param {Array|Object} collection The collection to iterate over.
|
||
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||
* @returns {Array|Object} Returns `collection`.
|
||
* @see _.forEachRight
|
||
* @example
|
||
*
|
||
* _.forEach([1, 2], function(value) {
|
||
* console.log(value);
|
||
* });
|
||
* // => Logs `1` then `2`.
|
||
*
|
||
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
|
||
* console.log(key);
|
||
* });
|
||
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
||
*/
|
||
function forEach(collection, iteratee) {
|
||
var func = isArray(collection) ? arrayEach : baseEach;
|
||
return func(collection, castFunction(iteratee));
|
||
}
|
||
|
||
module.exports = forEach;
|
||
|
||
|
||
/***/ }),
|
||
/* 355 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* A specialized version of `_.forEach` for arrays without support for
|
||
* iteratee shorthands.
|
||
*
|
||
* @private
|
||
* @param {Array} [array] The array to iterate over.
|
||
* @param {Function} iteratee The function invoked per iteration.
|
||
* @returns {Array} Returns `array`.
|
||
*/
|
||
function arrayEach(array, iteratee) {
|
||
var index = -1,
|
||
length = array == null ? 0 : array.length;
|
||
|
||
while (++index < length) {
|
||
if (iteratee(array[index], index, array) === false) {
|
||
break;
|
||
}
|
||
}
|
||
return array;
|
||
}
|
||
|
||
module.exports = arrayEach;
|
||
|
||
|
||
/***/ }),
|
||
/* 356 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var identity = __webpack_require__(71);
|
||
|
||
/**
|
||
* Casts `value` to `identity` if it's not a function.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to inspect.
|
||
* @returns {Function} Returns cast function.
|
||
*/
|
||
function castFunction(value) {
|
||
return typeof value == 'function' ? value : identity;
|
||
}
|
||
|
||
module.exports = castFunction;
|
||
|
||
|
||
/***/ }),
|
||
/* 357 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var debounce = __webpack_require__(358),
|
||
isObject = __webpack_require__(12);
|
||
|
||
/** Error message constants. */
|
||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||
|
||
/**
|
||
* Creates a throttled function that only invokes `func` at most once per
|
||
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
||
* method to cancel delayed `func` invocations and a `flush` method to
|
||
* immediately invoke them. Provide `options` to indicate whether `func`
|
||
* should be invoked on the leading and/or trailing edge of the `wait`
|
||
* timeout. The `func` is invoked with the last arguments provided to the
|
||
* throttled function. Subsequent calls to the throttled function return the
|
||
* result of the last `func` invocation.
|
||
*
|
||
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
||
* invoked on the trailing edge of the timeout only if the throttled function
|
||
* is invoked more than once during the `wait` timeout.
|
||
*
|
||
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
||
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
||
*
|
||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||
* for details over the differences between `_.throttle` and `_.debounce`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Function
|
||
* @param {Function} func The function to throttle.
|
||
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
||
* @param {Object} [options={}] The options object.
|
||
* @param {boolean} [options.leading=true]
|
||
* Specify invoking on the leading edge of the timeout.
|
||
* @param {boolean} [options.trailing=true]
|
||
* Specify invoking on the trailing edge of the timeout.
|
||
* @returns {Function} Returns the new throttled function.
|
||
* @example
|
||
*
|
||
* // Avoid excessively updating the position while scrolling.
|
||
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
||
*
|
||
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
||
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
||
* jQuery(element).on('click', throttled);
|
||
*
|
||
* // Cancel the trailing throttled invocation.
|
||
* jQuery(window).on('popstate', throttled.cancel);
|
||
*/
|
||
function throttle(func, wait, options) {
|
||
var leading = true,
|
||
trailing = true;
|
||
|
||
if (typeof func != 'function') {
|
||
throw new TypeError(FUNC_ERROR_TEXT);
|
||
}
|
||
if (isObject(options)) {
|
||
leading = 'leading' in options ? !!options.leading : leading;
|
||
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
||
}
|
||
return debounce(func, wait, {
|
||
'leading': leading,
|
||
'maxWait': wait,
|
||
'trailing': trailing
|
||
});
|
||
}
|
||
|
||
module.exports = throttle;
|
||
|
||
|
||
/***/ }),
|
||
/* 358 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var isObject = __webpack_require__(12),
|
||
now = __webpack_require__(359),
|
||
toNumber = __webpack_require__(72);
|
||
|
||
/** Error message constants. */
|
||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeMax = Math.max,
|
||
nativeMin = Math.min;
|
||
|
||
/**
|
||
* Creates a debounced function that delays invoking `func` until after `wait`
|
||
* milliseconds have elapsed since the last time the debounced function was
|
||
* invoked. The debounced function comes with a `cancel` method to cancel
|
||
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
||
* Provide `options` to indicate whether `func` should be invoked on the
|
||
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
||
* with the last arguments provided to the debounced function. Subsequent
|
||
* calls to the debounced function return the result of the last `func`
|
||
* invocation.
|
||
*
|
||
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
||
* invoked on the trailing edge of the timeout only if the debounced function
|
||
* is invoked more than once during the `wait` timeout.
|
||
*
|
||
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
||
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
||
*
|
||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||
* for details over the differences between `_.debounce` and `_.throttle`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Function
|
||
* @param {Function} func The function to debounce.
|
||
* @param {number} [wait=0] The number of milliseconds to delay.
|
||
* @param {Object} [options={}] The options object.
|
||
* @param {boolean} [options.leading=false]
|
||
* Specify invoking on the leading edge of the timeout.
|
||
* @param {number} [options.maxWait]
|
||
* The maximum time `func` is allowed to be delayed before it's invoked.
|
||
* @param {boolean} [options.trailing=true]
|
||
* Specify invoking on the trailing edge of the timeout.
|
||
* @returns {Function} Returns the new debounced function.
|
||
* @example
|
||
*
|
||
* // Avoid costly calculations while the window size is in flux.
|
||
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
||
*
|
||
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
||
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
||
* 'leading': true,
|
||
* 'trailing': false
|
||
* }));
|
||
*
|
||
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
||
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
||
* var source = new EventSource('/stream');
|
||
* jQuery(source).on('message', debounced);
|
||
*
|
||
* // Cancel the trailing debounced invocation.
|
||
* jQuery(window).on('popstate', debounced.cancel);
|
||
*/
|
||
function debounce(func, wait, options) {
|
||
var lastArgs,
|
||
lastThis,
|
||
maxWait,
|
||
result,
|
||
timerId,
|
||
lastCallTime,
|
||
lastInvokeTime = 0,
|
||
leading = false,
|
||
maxing = false,
|
||
trailing = true;
|
||
|
||
if (typeof func != 'function') {
|
||
throw new TypeError(FUNC_ERROR_TEXT);
|
||
}
|
||
wait = toNumber(wait) || 0;
|
||
if (isObject(options)) {
|
||
leading = !!options.leading;
|
||
maxing = 'maxWait' in options;
|
||
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
||
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
||
}
|
||
|
||
function invokeFunc(time) {
|
||
var args = lastArgs,
|
||
thisArg = lastThis;
|
||
|
||
lastArgs = lastThis = undefined;
|
||
lastInvokeTime = time;
|
||
result = func.apply(thisArg, args);
|
||
return result;
|
||
}
|
||
|
||
function leadingEdge(time) {
|
||
// Reset any `maxWait` timer.
|
||
lastInvokeTime = time;
|
||
// Start the timer for the trailing edge.
|
||
timerId = setTimeout(timerExpired, wait);
|
||
// Invoke the leading edge.
|
||
return leading ? invokeFunc(time) : result;
|
||
}
|
||
|
||
function remainingWait(time) {
|
||
var timeSinceLastCall = time - lastCallTime,
|
||
timeSinceLastInvoke = time - lastInvokeTime,
|
||
timeWaiting = wait - timeSinceLastCall;
|
||
|
||
return maxing
|
||
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
||
: timeWaiting;
|
||
}
|
||
|
||
function shouldInvoke(time) {
|
||
var timeSinceLastCall = time - lastCallTime,
|
||
timeSinceLastInvoke = time - lastInvokeTime;
|
||
|
||
// Either this is the first call, activity has stopped and we're at the
|
||
// trailing edge, the system time has gone backwards and we're treating
|
||
// it as the trailing edge, or we've hit the `maxWait` limit.
|
||
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
||
}
|
||
|
||
function timerExpired() {
|
||
var time = now();
|
||
if (shouldInvoke(time)) {
|
||
return trailingEdge(time);
|
||
}
|
||
// Restart the timer.
|
||
timerId = setTimeout(timerExpired, remainingWait(time));
|
||
}
|
||
|
||
function trailingEdge(time) {
|
||
timerId = undefined;
|
||
|
||
// Only invoke if we have `lastArgs` which means `func` has been
|
||
// debounced at least once.
|
||
if (trailing && lastArgs) {
|
||
return invokeFunc(time);
|
||
}
|
||
lastArgs = lastThis = undefined;
|
||
return result;
|
||
}
|
||
|
||
function cancel() {
|
||
if (timerId !== undefined) {
|
||
clearTimeout(timerId);
|
||
}
|
||
lastInvokeTime = 0;
|
||
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
||
}
|
||
|
||
function flush() {
|
||
return timerId === undefined ? result : trailingEdge(now());
|
||
}
|
||
|
||
function debounced() {
|
||
var time = now(),
|
||
isInvoking = shouldInvoke(time);
|
||
|
||
lastArgs = arguments;
|
||
lastThis = this;
|
||
lastCallTime = time;
|
||
|
||
if (isInvoking) {
|
||
if (timerId === undefined) {
|
||
return leadingEdge(lastCallTime);
|
||
}
|
||
if (maxing) {
|
||
// Handle invocations in a tight loop.
|
||
clearTimeout(timerId);
|
||
timerId = setTimeout(timerExpired, wait);
|
||
return invokeFunc(lastCallTime);
|
||
}
|
||
}
|
||
if (timerId === undefined) {
|
||
timerId = setTimeout(timerExpired, wait);
|
||
}
|
||
return result;
|
||
}
|
||
debounced.cancel = cancel;
|
||
debounced.flush = flush;
|
||
return debounced;
|
||
}
|
||
|
||
module.exports = debounce;
|
||
|
||
|
||
/***/ }),
|
||
/* 359 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var root = __webpack_require__(10);
|
||
|
||
/**
|
||
* Gets the timestamp of the number of milliseconds that have elapsed since
|
||
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 2.4.0
|
||
* @category Date
|
||
* @returns {number} Returns the timestamp.
|
||
* @example
|
||
*
|
||
* _.defer(function(stamp) {
|
||
* console.log(_.now() - stamp);
|
||
* }, _.now());
|
||
* // => Logs the number of milliseconds it took for the deferred invocation.
|
||
*/
|
||
var now = function() {
|
||
return root.Date.now();
|
||
};
|
||
|
||
module.exports = now;
|
||
|
||
|
||
/***/ }),
|
||
/* 360 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
var _typeof2 = _interopRequireDefault(__webpack_require__(41));
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.setStyle = setStyle;
|
||
exports.getStyle = getStyle;
|
||
exports.getProperty = getProperty;
|
||
exports.matchSelector = matchSelector;
|
||
exports.getQuerySelector = getQuerySelector;
|
||
exports.getValidDocument = getValidDocument;
|
||
exports.queryDocument = queryDocument;
|
||
exports.elementContains = elementContains;
|
||
exports.isSiblingNode = isSiblingNode;
|
||
exports.getChildElements = getChildElements;
|
||
exports.getSiblingElements = getSiblingElements;
|
||
exports.getRefType = getRefType;
|
||
exports.getClosestElement = void 0;
|
||
|
||
var _shared = __webpack_require__(30);
|
||
|
||
var _constants = __webpack_require__(6);
|
||
/* eslint-env browser */
|
||
|
||
|
||
var ELEMENT_MATCHES = _shared.IX2BrowserSupport.ELEMENT_MATCHES;
|
||
var _constants$IX2EngineC = _constants.IX2EngineConstants,
|
||
IX2_ID_DELIMITER = _constants$IX2EngineC.IX2_ID_DELIMITER,
|
||
HTML_ELEMENT = _constants$IX2EngineC.HTML_ELEMENT,
|
||
PLAIN_OBJECT = _constants$IX2EngineC.PLAIN_OBJECT,
|
||
WF_PAGE = _constants$IX2EngineC.WF_PAGE;
|
||
|
||
function setStyle(element, prop, value) {
|
||
// $FlowIgnore — flow complains that prop should be a number. Will need to update upstream
|
||
element.style[prop] = value;
|
||
}
|
||
|
||
function getStyle(element, prop) {
|
||
// $FlowIgnore — flow complains that prop should be a number. Will need to update upstream
|
||
return element.style[prop];
|
||
}
|
||
|
||
function getProperty(element, prop) {
|
||
// $FlowIgnore — flow complains that prop should be a number. Will need to update upstream
|
||
return element[prop];
|
||
}
|
||
|
||
function matchSelector(selector) {
|
||
// $FlowIgnore — ELEMENT_MATCHES is the name of the method on the element's prototype depending on browser
|
||
return function (element) {
|
||
return element[ELEMENT_MATCHES](selector);
|
||
};
|
||
}
|
||
|
||
function getQuerySelector(_ref) {
|
||
var id = _ref.id,
|
||
selector = _ref.selector;
|
||
|
||
if (id) {
|
||
var nodeId = id;
|
||
|
||
if (id.indexOf(IX2_ID_DELIMITER) !== -1) {
|
||
var pair = id.split(IX2_ID_DELIMITER);
|
||
var pageId = pair[0];
|
||
nodeId = pair[1]; // Short circuit query if we're on the wrong page
|
||
// $FlowIgnore — if documentElement is null crash
|
||
|
||
if (pageId !== document.documentElement.getAttribute(WF_PAGE)) {
|
||
return null;
|
||
}
|
||
}
|
||
|
||
return "[data-w-id=\"".concat(nodeId, "\"], [data-w-id^=\"").concat(nodeId, "_instance\"]");
|
||
}
|
||
|
||
return selector;
|
||
}
|
||
|
||
function getValidDocument(pageId) {
|
||
if (pageId == null || // $FlowIgnore — if documentElement is null crash
|
||
pageId === document.documentElement.getAttribute(WF_PAGE)) {
|
||
return document;
|
||
}
|
||
|
||
return null;
|
||
}
|
||
|
||
function queryDocument(baseSelector, descendantSelector) {
|
||
return Array.prototype.slice.call(document.querySelectorAll(descendantSelector ? baseSelector + ' ' + descendantSelector : baseSelector));
|
||
}
|
||
|
||
function elementContains(parent, child) {
|
||
return parent.contains(child);
|
||
}
|
||
|
||
function isSiblingNode(a, b) {
|
||
return a !== b && a.parentNode === b.parentNode;
|
||
}
|
||
|
||
function getChildElements(sourceElements) {
|
||
var childElements = [];
|
||
|
||
for (var i = 0, _ref2 = sourceElements || [], length = _ref2.length; i < length; i++) {
|
||
var children = sourceElements[i].children;
|
||
var childCount = children.length;
|
||
|
||
if (!childCount) {
|
||
continue;
|
||
}
|
||
|
||
for (var j = 0; j < childCount; j++) {
|
||
childElements.push(children[j]);
|
||
}
|
||
}
|
||
|
||
return childElements;
|
||
} // $FlowFixMe
|
||
|
||
|
||
function getSiblingElements() {
|
||
var sourceElements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||
var elements = [];
|
||
var parentCache = [];
|
||
|
||
for (var i = 0, length = sourceElements.length; i < length; i++) {
|
||
var parentNode = sourceElements[i].parentNode;
|
||
|
||
if (!parentNode || !parentNode.children || !parentNode.children.length) {
|
||
continue;
|
||
}
|
||
|
||
if (parentCache.indexOf(parentNode) !== -1) {
|
||
continue;
|
||
}
|
||
|
||
parentCache.push(parentNode);
|
||
var el = parentNode.firstElementChild;
|
||
|
||
while (el != null) {
|
||
if (sourceElements.indexOf(el) === -1) {
|
||
elements.push(el);
|
||
}
|
||
|
||
el = el.nextElementSibling;
|
||
}
|
||
}
|
||
|
||
return elements;
|
||
}
|
||
|
||
var getClosestElement = Element.prototype.closest ? function (element, selector) {
|
||
// $FlowIgnore — ELEMENT_MATCHES is the name of the method on the element's prototype depending on browser
|
||
if (!document.documentElement.contains(element)) {
|
||
return null;
|
||
}
|
||
|
||
return element.closest(selector);
|
||
} : function (element, selector) {
|
||
// $FlowIgnore — if documentElement is null crash
|
||
if (!document.documentElement.contains(element)) {
|
||
return null;
|
||
}
|
||
|
||
var el = element;
|
||
|
||
do {
|
||
// $FlowIgnore — if documentElement is null crash
|
||
if (el[ELEMENT_MATCHES] && el[ELEMENT_MATCHES](selector)) {
|
||
return el;
|
||
}
|
||
|
||
el = el.parentNode;
|
||
} while (el != null);
|
||
|
||
return null;
|
||
};
|
||
exports.getClosestElement = getClosestElement;
|
||
|
||
function getRefType(ref) {
|
||
if (ref != null && (0, _typeof2["default"])(ref) == 'object') {
|
||
return ref instanceof Element ? HTML_ELEMENT : PLAIN_OBJECT;
|
||
}
|
||
|
||
return null;
|
||
}
|
||
|
||
/***/ }),
|
||
/* 361 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _interopRequireDefault2 = __webpack_require__(1);
|
||
|
||
var _defineProperty2 = _interopRequireDefault2(__webpack_require__(24));
|
||
|
||
var _typeof2 = _interopRequireDefault2(__webpack_require__(41));
|
||
|
||
var _default2;
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports["default"] = void 0;
|
||
|
||
var _extends2 = _interopRequireDefault(__webpack_require__(31));
|
||
|
||
var _flow = _interopRequireDefault(__webpack_require__(362));
|
||
|
||
var _get = _interopRequireDefault(__webpack_require__(68));
|
||
|
||
var _clamp = _interopRequireDefault(__webpack_require__(381));
|
||
|
||
var _constants = __webpack_require__(6);
|
||
|
||
var _IX2VanillaEngine = __webpack_require__(146);
|
||
|
||
var _IX2EngineActions = __webpack_require__(87);
|
||
|
||
var _shared = __webpack_require__(30);
|
||
/* eslint-env browser */
|
||
|
||
|
||
var _constants$EventTypeC = _constants.EventTypeConsts,
|
||
MOUSE_CLICK = _constants$EventTypeC.MOUSE_CLICK,
|
||
MOUSE_SECOND_CLICK = _constants$EventTypeC.MOUSE_SECOND_CLICK,
|
||
MOUSE_DOWN = _constants$EventTypeC.MOUSE_DOWN,
|
||
MOUSE_UP = _constants$EventTypeC.MOUSE_UP,
|
||
MOUSE_OVER = _constants$EventTypeC.MOUSE_OVER,
|
||
MOUSE_OUT = _constants$EventTypeC.MOUSE_OUT,
|
||
DROPDOWN_CLOSE = _constants$EventTypeC.DROPDOWN_CLOSE,
|
||
DROPDOWN_OPEN = _constants$EventTypeC.DROPDOWN_OPEN,
|
||
SLIDER_ACTIVE = _constants$EventTypeC.SLIDER_ACTIVE,
|
||
SLIDER_INACTIVE = _constants$EventTypeC.SLIDER_INACTIVE,
|
||
TAB_ACTIVE = _constants$EventTypeC.TAB_ACTIVE,
|
||
TAB_INACTIVE = _constants$EventTypeC.TAB_INACTIVE,
|
||
NAVBAR_CLOSE = _constants$EventTypeC.NAVBAR_CLOSE,
|
||
NAVBAR_OPEN = _constants$EventTypeC.NAVBAR_OPEN,
|
||
MOUSE_MOVE = _constants$EventTypeC.MOUSE_MOVE,
|
||
PAGE_SCROLL_DOWN = _constants$EventTypeC.PAGE_SCROLL_DOWN,
|
||
SCROLL_INTO_VIEW = _constants$EventTypeC.SCROLL_INTO_VIEW,
|
||
SCROLL_OUT_OF_VIEW = _constants$EventTypeC.SCROLL_OUT_OF_VIEW,
|
||
PAGE_SCROLL_UP = _constants$EventTypeC.PAGE_SCROLL_UP,
|
||
SCROLLING_IN_VIEW = _constants$EventTypeC.SCROLLING_IN_VIEW,
|
||
PAGE_FINISH = _constants$EventTypeC.PAGE_FINISH,
|
||
ECOMMERCE_CART_CLOSE = _constants$EventTypeC.ECOMMERCE_CART_CLOSE,
|
||
ECOMMERCE_CART_OPEN = _constants$EventTypeC.ECOMMERCE_CART_OPEN,
|
||
PAGE_START = _constants$EventTypeC.PAGE_START,
|
||
PAGE_SCROLL = _constants$EventTypeC.PAGE_SCROLL;
|
||
var COMPONENT_ACTIVE = 'COMPONENT_ACTIVE';
|
||
var COMPONENT_INACTIVE = 'COMPONENT_INACTIVE';
|
||
var COLON_DELIMITER = _constants.IX2EngineConstants.COLON_DELIMITER;
|
||
var getNamespacedParameterId = _shared.IX2VanillaUtils.getNamespacedParameterId;
|
||
|
||
var composableFilter = function composableFilter(predicate) {
|
||
return function (options) {
|
||
if ((0, _typeof2["default"])(options) === 'object' && predicate(options)) {
|
||
return true;
|
||
}
|
||
|
||
return options;
|
||
};
|
||
};
|
||
|
||
var isElement = composableFilter(function (_ref) {
|
||
var element = _ref.element,
|
||
nativeEvent = _ref.nativeEvent;
|
||
return element === nativeEvent.target;
|
||
});
|
||
var containsElement = composableFilter(function (_ref2) {
|
||
var element = _ref2.element,
|
||
nativeEvent = _ref2.nativeEvent;
|
||
return element.contains(nativeEvent.target);
|
||
});
|
||
var isOrContainsElement = (0, _flow["default"])([isElement, containsElement]);
|
||
|
||
var getAutoStopEvent = function getAutoStopEvent(store, autoStopEventId) {
|
||
if (autoStopEventId) {
|
||
var _store$getState = store.getState(),
|
||
ixData = _store$getState.ixData;
|
||
|
||
var events = ixData.events;
|
||
var eventToStop = events[autoStopEventId];
|
||
|
||
if (eventToStop && !AUTO_STOP_DISABLED_EVENTS[eventToStop.eventTypeId]) {
|
||
return eventToStop;
|
||
}
|
||
}
|
||
|
||
return null;
|
||
};
|
||
|
||
var hasAutoStopEvent = function hasAutoStopEvent(_ref3) {
|
||
var store = _ref3.store,
|
||
event = _ref3.event;
|
||
var eventAction = event.action;
|
||
var autoStopEventId = eventAction.config.autoStopEventId;
|
||
return Boolean(getAutoStopEvent(store, autoStopEventId));
|
||
};
|
||
|
||
var actionGroupCreator = function actionGroupCreator(_ref4, state) {
|
||
var store = _ref4.store,
|
||
event = _ref4.event,
|
||
element = _ref4.element,
|
||
eventStateKey = _ref4.eventStateKey;
|
||
var eventAction = event.action,
|
||
eventId = event.id;
|
||
var _eventAction$config = eventAction.config,
|
||
actionListId = _eventAction$config.actionListId,
|
||
autoStopEventId = _eventAction$config.autoStopEventId;
|
||
var eventToStop = getAutoStopEvent(store, autoStopEventId);
|
||
|
||
if (eventToStop) {
|
||
(0, _IX2VanillaEngine.stopActionGroup)({
|
||
store: store,
|
||
eventId: autoStopEventId,
|
||
eventTarget: element,
|
||
eventStateKey: autoStopEventId + COLON_DELIMITER + eventStateKey.split(COLON_DELIMITER)[1],
|
||
actionListId: (0, _get["default"])(eventToStop, 'action.config.actionListId')
|
||
});
|
||
}
|
||
|
||
(0, _IX2VanillaEngine.stopActionGroup)({
|
||
store: store,
|
||
eventId: eventId,
|
||
eventTarget: element,
|
||
eventStateKey: eventStateKey,
|
||
actionListId: actionListId
|
||
});
|
||
(0, _IX2VanillaEngine.startActionGroup)({
|
||
store: store,
|
||
eventId: eventId,
|
||
eventTarget: element,
|
||
eventStateKey: eventStateKey,
|
||
actionListId: actionListId
|
||
});
|
||
return state;
|
||
}; // $FlowFixMe
|
||
|
||
|
||
var withFilter = function withFilter(filter, handler) {
|
||
return function (options, state) {
|
||
return (// $FlowFixMe
|
||
filter(options, state) === true ? handler(options, state) : state
|
||
);
|
||
};
|
||
};
|
||
|
||
var baseActionGroupOptions = {
|
||
handler: withFilter(isOrContainsElement, actionGroupCreator)
|
||
};
|
||
var baseActivityActionGroupOptions = (0, _extends2["default"])({}, baseActionGroupOptions, {
|
||
types: [COMPONENT_ACTIVE, COMPONENT_INACTIVE].join(' ')
|
||
});
|
||
var SCROLL_EVENT_TYPES = [{
|
||
target: window,
|
||
types: 'resize orientationchange',
|
||
throttle: true
|
||
}, {
|
||
target: document,
|
||
types: 'scroll wheel readystatechange IX2_PAGE_UPDATE',
|
||
throttle: true
|
||
}];
|
||
var MOUSE_OVER_OUT_TYPES = 'mouseover mouseout';
|
||
var baseScrollActionGroupOptions = {
|
||
types: SCROLL_EVENT_TYPES
|
||
};
|
||
var AUTO_STOP_DISABLED_EVENTS = {
|
||
PAGE_START: PAGE_START,
|
||
PAGE_FINISH: PAGE_FINISH
|
||
};
|
||
|
||
var getDocumentState = function () {
|
||
var supportOffset = window.pageXOffset !== undefined;
|
||
var isCSS1Compat = document.compatMode === 'CSS1Compat';
|
||
var rootElement = isCSS1Compat ? document.documentElement : document.body;
|
||
return function () {
|
||
return {
|
||
// $FlowFixMe
|
||
scrollLeft: supportOffset ? window.pageXOffset : rootElement.scrollLeft,
|
||
// $FlowFixMe
|
||
scrollTop: supportOffset ? window.pageYOffset : rootElement.scrollTop,
|
||
// required to remove elasticity in Safari scrolling.
|
||
stiffScrollTop: (0, _clamp["default"])( // $FlowFixMe
|
||
supportOffset ? window.pageYOffset : rootElement.scrollTop, 0, // $FlowFixMe
|
||
rootElement.scrollHeight - window.innerHeight),
|
||
// $FlowFixMe
|
||
scrollWidth: rootElement.scrollWidth,
|
||
// $FlowFixMe
|
||
scrollHeight: rootElement.scrollHeight,
|
||
// $FlowFixMe
|
||
clientWidth: rootElement.clientWidth,
|
||
// $FlowFixMe
|
||
clientHeight: rootElement.clientHeight,
|
||
innerWidth: window.innerWidth,
|
||
innerHeight: window.innerHeight
|
||
};
|
||
};
|
||
}();
|
||
|
||
var areBoxesIntersecting = function areBoxesIntersecting(a, b) {
|
||
return !(a.left > b.right || a.right < b.left || a.top > b.bottom || a.bottom < b.top);
|
||
};
|
||
|
||
var isElementHovered = function isElementHovered(_ref5) {
|
||
var element = _ref5.element,
|
||
nativeEvent = _ref5.nativeEvent;
|
||
var type = nativeEvent.type,
|
||
target = nativeEvent.target,
|
||
relatedTarget = nativeEvent.relatedTarget;
|
||
var containsTarget = element.contains(target);
|
||
|
||
if (type === 'mouseover' && containsTarget) {
|
||
return true;
|
||
}
|
||
|
||
var containsRelated = element.contains(relatedTarget);
|
||
|
||
if (type === 'mouseout' && containsTarget && containsRelated) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
var isElementVisible = function isElementVisible(options) {
|
||
var element = options.element,
|
||
config = options.event.config;
|
||
|
||
var _getDocumentState = getDocumentState(),
|
||
clientWidth = _getDocumentState.clientWidth,
|
||
clientHeight = _getDocumentState.clientHeight;
|
||
|
||
var scrollOffsetValue = config.scrollOffsetValue;
|
||
var scrollOffsetUnit = config.scrollOffsetUnit;
|
||
var isPX = scrollOffsetUnit === 'PX';
|
||
var offsetPadding = isPX ? scrollOffsetValue : clientHeight * (scrollOffsetValue || 0) / 100;
|
||
return areBoxesIntersecting(element.getBoundingClientRect(), {
|
||
left: 0,
|
||
top: offsetPadding,
|
||
right: clientWidth,
|
||
bottom: clientHeight - offsetPadding
|
||
});
|
||
};
|
||
|
||
var whenComponentActiveChange = function whenComponentActiveChange(handler) {
|
||
return function (options, oldState) {
|
||
var type = options.nativeEvent.type; // prettier-ignore
|
||
|
||
var isActive = [COMPONENT_ACTIVE, COMPONENT_INACTIVE].indexOf(type) !== -1 ? type === COMPONENT_ACTIVE : oldState.isActive;
|
||
var newState = (0, _extends2["default"])({}, oldState, {
|
||
isActive: isActive
|
||
});
|
||
|
||
if (!oldState || newState.isActive !== oldState.isActive) {
|
||
return handler(options, newState) || newState;
|
||
}
|
||
|
||
return newState;
|
||
};
|
||
};
|
||
|
||
var whenElementHoverChange = function whenElementHoverChange(handler) {
|
||
return function (options, oldState) {
|
||
var newState = {
|
||
elementHovered: isElementHovered(options)
|
||
};
|
||
|
||
if (oldState ? newState.elementHovered !== oldState.elementHovered : newState.elementHovered) {
|
||
return handler(options, newState) || newState;
|
||
}
|
||
|
||
return newState;
|
||
};
|
||
}; // $FlowFixMe
|
||
|
||
|
||
var whenElementVisibiltyChange = function whenElementVisibiltyChange(handler) {
|
||
return function (options, oldState) {
|
||
var newState = (0, _extends2["default"])({}, oldState, {
|
||
elementVisible: isElementVisible(options)
|
||
});
|
||
|
||
if (oldState ? newState.elementVisible !== oldState.elementVisible : newState.elementVisible) {
|
||
return handler(options, newState) || newState;
|
||
}
|
||
|
||
return newState;
|
||
};
|
||
}; // $FlowFixMe
|
||
|
||
|
||
var whenScrollDirectionChange = function whenScrollDirectionChange(handler) {
|
||
return function (options) {
|
||
var oldState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
|
||
var _getDocumentState2 = getDocumentState(),
|
||
scrollTop = _getDocumentState2.stiffScrollTop,
|
||
scrollHeight = _getDocumentState2.scrollHeight,
|
||
innerHeight = _getDocumentState2.innerHeight;
|
||
|
||
var _options$event = options.event,
|
||
config = _options$event.config,
|
||
eventTypeId = _options$event.eventTypeId;
|
||
var scrollOffsetValue = config.scrollOffsetValue,
|
||
scrollOffsetUnit = config.scrollOffsetUnit;
|
||
var isPX = scrollOffsetUnit === 'PX';
|
||
var scrollHeightBounds = scrollHeight - innerHeight; // percent top since innerHeight may change for mobile devices which also changes the scrollTop value.
|
||
|
||
var percentTop = Number((scrollTop / scrollHeightBounds).toFixed(2)); // no state change
|
||
|
||
if (oldState && oldState.percentTop === percentTop) {
|
||
return oldState;
|
||
}
|
||
|
||
var scrollTopPadding = (isPX ? scrollOffsetValue : innerHeight * (scrollOffsetValue || 0) / 100) / scrollHeightBounds;
|
||
var scrollingDown;
|
||
var scrollDirectionChanged;
|
||
var anchorTop = 0;
|
||
|
||
if (oldState) {
|
||
scrollingDown = percentTop > oldState.percentTop;
|
||
scrollDirectionChanged = oldState.scrollingDown !== scrollingDown;
|
||
anchorTop = scrollDirectionChanged ? percentTop : oldState.anchorTop;
|
||
}
|
||
|
||
var inBounds = eventTypeId === PAGE_SCROLL_DOWN ? percentTop >= anchorTop + scrollTopPadding : percentTop <= anchorTop - scrollTopPadding;
|
||
var newState = (0, _extends2["default"])({}, oldState, {
|
||
percentTop: percentTop,
|
||
inBounds: inBounds,
|
||
anchorTop: anchorTop,
|
||
scrollingDown: scrollingDown
|
||
});
|
||
|
||
if (oldState && inBounds && (scrollDirectionChanged || newState.inBounds !== oldState.inBounds)) {
|
||
return handler(options, newState) || newState;
|
||
}
|
||
|
||
return newState;
|
||
};
|
||
};
|
||
|
||
var pointIntersects = function pointIntersects(point, rect) {
|
||
return point.left > rect.left && point.left < rect.right && point.top > rect.top && point.top < rect.bottom;
|
||
};
|
||
|
||
var whenPageLoadFinish = function whenPageLoadFinish(handler) {
|
||
return function (options, oldState) {
|
||
var newState = {
|
||
finished: document.readyState === 'complete'
|
||
};
|
||
|
||
if (newState.finished && !(oldState && oldState.finshed)) {
|
||
handler(options);
|
||
}
|
||
|
||
return newState;
|
||
};
|
||
};
|
||
|
||
var whenPageLoadStart = function whenPageLoadStart(handler) {
|
||
return function (options, oldState) {
|
||
var newState = {
|
||
started: true
|
||
};
|
||
|
||
if (!oldState) {
|
||
handler(options);
|
||
}
|
||
|
||
return newState;
|
||
};
|
||
};
|
||
|
||
var whenClickCountChange = function whenClickCountChange(handler) {
|
||
return function (options) {
|
||
var oldState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
||
clickCount: 0
|
||
};
|
||
var newState = {
|
||
clickCount: oldState.clickCount % 2 + 1
|
||
};
|
||
|
||
if (newState.clickCount !== oldState.clickCount) {
|
||
return handler(options, newState) || newState;
|
||
}
|
||
|
||
return newState;
|
||
};
|
||
};
|
||
|
||
var getComponentActiveOptions = function getComponentActiveOptions() {
|
||
var allowNestedChildrenEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
||
return (0, _extends2["default"])({}, baseActivityActionGroupOptions, {
|
||
handler: withFilter(allowNestedChildrenEvents ? isOrContainsElement : isElement, whenComponentActiveChange(function (options, state) {
|
||
return state.isActive ? baseActionGroupOptions.handler(options, state) : state;
|
||
}))
|
||
});
|
||
};
|
||
|
||
var getComponentInactiveOptions = function getComponentInactiveOptions() {
|
||
var allowNestedChildrenEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
||
return (0, _extends2["default"])({}, baseActivityActionGroupOptions, {
|
||
handler: withFilter(allowNestedChildrenEvents ? isOrContainsElement : isElement, whenComponentActiveChange(function (options, state) {
|
||
return !state.isActive ? baseActionGroupOptions.handler(options, state) : state;
|
||
}))
|
||
});
|
||
};
|
||
|
||
var scrollIntoOutOfViewOptions = (0, _extends2["default"])({}, baseScrollActionGroupOptions, {
|
||
handler: whenElementVisibiltyChange(function (options, state) {
|
||
var elementVisible = state.elementVisible;
|
||
var event = options.event,
|
||
store = options.store;
|
||
|
||
var _store$getState2 = store.getState(),
|
||
ixData = _store$getState2.ixData;
|
||
|
||
var events = ixData.events; // trigger the handler only once if only one of SCROLL_INTO or SCROLL_OUT_OF event types
|
||
// are registered.
|
||
|
||
if (!events[event.action.config.autoStopEventId] && state.triggered) {
|
||
return state;
|
||
}
|
||
|
||
if (event.eventTypeId === SCROLL_INTO_VIEW === elementVisible) {
|
||
actionGroupCreator(options);
|
||
return (0, _extends2["default"])({}, state, {
|
||
triggered: true
|
||
});
|
||
} else {
|
||
return state;
|
||
}
|
||
})
|
||
});
|
||
var MOUSE_OUT_ROUND_THRESHOLD = 0.05;
|
||
|
||
var _default = (_default2 = {}, (0, _defineProperty2["default"])(_default2, SLIDER_ACTIVE, getComponentActiveOptions()), (0, _defineProperty2["default"])(_default2, SLIDER_INACTIVE, getComponentInactiveOptions()), (0, _defineProperty2["default"])(_default2, DROPDOWN_OPEN, getComponentActiveOptions()), (0, _defineProperty2["default"])(_default2, DROPDOWN_CLOSE, getComponentInactiveOptions()), (0, _defineProperty2["default"])(_default2, NAVBAR_OPEN, getComponentActiveOptions(false)), (0, _defineProperty2["default"])(_default2, NAVBAR_CLOSE, getComponentInactiveOptions(false)), (0, _defineProperty2["default"])(_default2, TAB_ACTIVE, getComponentActiveOptions()), (0, _defineProperty2["default"])(_default2, TAB_INACTIVE, getComponentInactiveOptions()), (0, _defineProperty2["default"])(_default2, ECOMMERCE_CART_OPEN, {
|
||
types: 'ecommerce-cart-open',
|
||
handler: withFilter(isOrContainsElement, actionGroupCreator)
|
||
}), (0, _defineProperty2["default"])(_default2, ECOMMERCE_CART_CLOSE, {
|
||
types: 'ecommerce-cart-close',
|
||
handler: withFilter(isOrContainsElement, actionGroupCreator)
|
||
}), (0, _defineProperty2["default"])(_default2, MOUSE_CLICK, {
|
||
types: 'click',
|
||
handler: withFilter(isOrContainsElement, whenClickCountChange(function (options, _ref6) {
|
||
var clickCount = _ref6.clickCount;
|
||
|
||
if (hasAutoStopEvent(options)) {
|
||
clickCount === 1 && actionGroupCreator(options);
|
||
} else {
|
||
actionGroupCreator(options);
|
||
}
|
||
}))
|
||
}), (0, _defineProperty2["default"])(_default2, MOUSE_SECOND_CLICK, {
|
||
types: 'click',
|
||
handler: withFilter(isOrContainsElement, whenClickCountChange(function (options, _ref7) {
|
||
var clickCount = _ref7.clickCount;
|
||
|
||
if (clickCount === 2) {
|
||
actionGroupCreator(options);
|
||
}
|
||
}))
|
||
}), (0, _defineProperty2["default"])(_default2, MOUSE_DOWN, (0, _extends2["default"])({}, baseActionGroupOptions, {
|
||
types: 'mousedown'
|
||
})), (0, _defineProperty2["default"])(_default2, MOUSE_UP, (0, _extends2["default"])({}, baseActionGroupOptions, {
|
||
types: 'mouseup'
|
||
})), (0, _defineProperty2["default"])(_default2, MOUSE_OVER, {
|
||
types: MOUSE_OVER_OUT_TYPES,
|
||
handler: withFilter(isOrContainsElement, whenElementHoverChange(function (options, state) {
|
||
if (state.elementHovered) {
|
||
actionGroupCreator(options);
|
||
}
|
||
}))
|
||
}), (0, _defineProperty2["default"])(_default2, MOUSE_OUT, {
|
||
types: MOUSE_OVER_OUT_TYPES,
|
||
handler: withFilter(isOrContainsElement, whenElementHoverChange(function (options, state) {
|
||
if (!state.elementHovered) {
|
||
actionGroupCreator(options);
|
||
}
|
||
}))
|
||
}), (0, _defineProperty2["default"])(_default2, MOUSE_MOVE, {
|
||
types: 'mousemove mouseout scroll',
|
||
handler: function handler( // $FlowFixMe
|
||
_ref8) {
|
||
var store = _ref8.store,
|
||
element = _ref8.element,
|
||
eventConfig = _ref8.eventConfig,
|
||
nativeEvent = _ref8.nativeEvent,
|
||
eventStateKey = _ref8.eventStateKey;
|
||
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
||
clientX: 0,
|
||
clientY: 0,
|
||
pageX: 0,
|
||
pageY: 0
|
||
};
|
||
var basedOn = eventConfig.basedOn,
|
||
selectedAxis = eventConfig.selectedAxis,
|
||
continuousParameterGroupId = eventConfig.continuousParameterGroupId,
|
||
reverse = eventConfig.reverse,
|
||
_eventConfig$restingS = eventConfig.restingState,
|
||
restingState = _eventConfig$restingS === void 0 ? 0 : _eventConfig$restingS;
|
||
var _nativeEvent$clientX = nativeEvent.clientX,
|
||
clientX = _nativeEvent$clientX === void 0 ? state.clientX : _nativeEvent$clientX,
|
||
_nativeEvent$clientY = nativeEvent.clientY,
|
||
clientY = _nativeEvent$clientY === void 0 ? state.clientY : _nativeEvent$clientY,
|
||
_nativeEvent$pageX = nativeEvent.pageX,
|
||
pageX = _nativeEvent$pageX === void 0 ? state.pageX : _nativeEvent$pageX,
|
||
_nativeEvent$pageY = nativeEvent.pageY,
|
||
pageY = _nativeEvent$pageY === void 0 ? state.pageY : _nativeEvent$pageY;
|
||
var isXAxis = selectedAxis === 'X_AXIS';
|
||
var isMouseOut = nativeEvent.type === 'mouseout';
|
||
var value = restingState / 100;
|
||
var namespacedParameterId = continuousParameterGroupId;
|
||
var elementHovered = false;
|
||
|
||
switch (basedOn) {
|
||
case _constants.EventBasedOn.VIEWPORT:
|
||
{
|
||
value = isXAxis ? Math.min(clientX, window.innerWidth) / window.innerWidth : Math.min(clientY, window.innerHeight) / window.innerHeight;
|
||
break;
|
||
}
|
||
|
||
case _constants.EventBasedOn.PAGE:
|
||
{
|
||
var _getDocumentState3 = getDocumentState(),
|
||
scrollLeft = _getDocumentState3.scrollLeft,
|
||
scrollTop = _getDocumentState3.scrollTop,
|
||
scrollWidth = _getDocumentState3.scrollWidth,
|
||
scrollHeight = _getDocumentState3.scrollHeight;
|
||
|
||
value = isXAxis ? Math.min(scrollLeft + pageX, scrollWidth) / scrollWidth : Math.min(scrollTop + pageY, scrollHeight) / scrollHeight;
|
||
break;
|
||
}
|
||
|
||
case _constants.EventBasedOn.ELEMENT:
|
||
default:
|
||
{
|
||
namespacedParameterId = getNamespacedParameterId(eventStateKey, continuousParameterGroupId);
|
||
var isMouseEvent = nativeEvent.type.indexOf('mouse') === 0; // Use isOrContainsElement for mouse events since they are fired from the target
|
||
|
||
if (isMouseEvent && isOrContainsElement({
|
||
element: element,
|
||
nativeEvent: nativeEvent
|
||
}) !== true) {
|
||
break;
|
||
}
|
||
|
||
var rect = element.getBoundingClientRect();
|
||
var left = rect.left,
|
||
top = rect.top,
|
||
width = rect.width,
|
||
height = rect.height; // Otherwise we'll need to calculate the mouse position from the previous handler state
|
||
// against the target element's rect
|
||
|
||
if (!isMouseEvent && !pointIntersects({
|
||
left: clientX,
|
||
top: clientY
|
||
}, rect)) {
|
||
break;
|
||
}
|
||
|
||
elementHovered = true;
|
||
value = isXAxis ? (clientX - left) / width : (clientY - top) / height;
|
||
break;
|
||
}
|
||
} // cover case where the event is a mouse out, but the value is not quite at 100%
|
||
|
||
|
||
if (isMouseOut && (value > 1 - MOUSE_OUT_ROUND_THRESHOLD || value < MOUSE_OUT_ROUND_THRESHOLD)) {
|
||
value = Math.round(value);
|
||
} // Only update based on element if the mouse is moving over or has just left the element
|
||
|
||
|
||
if (basedOn !== _constants.EventBasedOn.ELEMENT || elementHovered || // $FlowFixMe
|
||
elementHovered !== state.elementHovered) {
|
||
value = reverse ? 1 - value : value;
|
||
store.dispatch((0, _IX2EngineActions.parameterChanged)(namespacedParameterId, value));
|
||
}
|
||
|
||
return {
|
||
elementHovered: elementHovered,
|
||
clientX: clientX,
|
||
clientY: clientY,
|
||
pageX: pageX,
|
||
pageY: pageY
|
||
};
|
||
}
|
||
}), (0, _defineProperty2["default"])(_default2, PAGE_SCROLL, {
|
||
types: SCROLL_EVENT_TYPES,
|
||
// $FlowFixMe
|
||
handler: function handler(_ref9) {
|
||
var store = _ref9.store,
|
||
eventConfig = _ref9.eventConfig;
|
||
var continuousParameterGroupId = eventConfig.continuousParameterGroupId,
|
||
reverse = eventConfig.reverse;
|
||
|
||
var _getDocumentState4 = getDocumentState(),
|
||
scrollTop = _getDocumentState4.scrollTop,
|
||
scrollHeight = _getDocumentState4.scrollHeight,
|
||
clientHeight = _getDocumentState4.clientHeight;
|
||
|
||
var value = scrollTop / (scrollHeight - clientHeight);
|
||
value = reverse ? 1 - value : value;
|
||
store.dispatch((0, _IX2EngineActions.parameterChanged)(continuousParameterGroupId, value));
|
||
}
|
||
}), (0, _defineProperty2["default"])(_default2, SCROLLING_IN_VIEW, {
|
||
types: SCROLL_EVENT_TYPES,
|
||
handler: function handler( // $FlowFixMe
|
||
_ref10) {
|
||
var element = _ref10.element,
|
||
store = _ref10.store,
|
||
eventConfig = _ref10.eventConfig,
|
||
eventStateKey = _ref10.eventStateKey;
|
||
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
||
scrollPercent: 0
|
||
};
|
||
|
||
var _getDocumentState5 = getDocumentState(),
|
||
scrollLeft = _getDocumentState5.scrollLeft,
|
||
scrollTop = _getDocumentState5.scrollTop,
|
||
scrollWidth = _getDocumentState5.scrollWidth,
|
||
scrollHeight = _getDocumentState5.scrollHeight,
|
||
visibleHeight = _getDocumentState5.clientHeight;
|
||
|
||
var basedOn = eventConfig.basedOn,
|
||
selectedAxis = eventConfig.selectedAxis,
|
||
continuousParameterGroupId = eventConfig.continuousParameterGroupId,
|
||
startsEntering = eventConfig.startsEntering,
|
||
startsExiting = eventConfig.startsExiting,
|
||
addEndOffset = eventConfig.addEndOffset,
|
||
addStartOffset = eventConfig.addStartOffset,
|
||
_eventConfig$addOffse = eventConfig.addOffsetValue,
|
||
addOffsetValue = _eventConfig$addOffse === void 0 ? 0 : _eventConfig$addOffse,
|
||
_eventConfig$endOffse = eventConfig.endOffsetValue,
|
||
endOffsetValue = _eventConfig$endOffse === void 0 ? 0 : _eventConfig$endOffse;
|
||
var isXAxis = selectedAxis === 'X_AXIS';
|
||
|
||
if (basedOn === _constants.EventBasedOn.VIEWPORT) {
|
||
var value = isXAxis ? scrollLeft / scrollWidth : scrollTop / scrollHeight;
|
||
|
||
if (value !== state.scrollPercent) {
|
||
store.dispatch((0, _IX2EngineActions.parameterChanged)(continuousParameterGroupId, value));
|
||
}
|
||
|
||
return {
|
||
scrollPercent: value
|
||
};
|
||
} else {
|
||
var namespacedParameterId = getNamespacedParameterId(eventStateKey, continuousParameterGroupId);
|
||
var elementRect = element.getBoundingClientRect();
|
||
var offsetStartPerc = (addStartOffset ? addOffsetValue : 0) / 100;
|
||
var offsetEndPerc = (addEndOffset ? endOffsetValue : 0) / 100; // flip the offset percentages depending on start / exit type
|
||
|
||
offsetStartPerc = startsEntering ? offsetStartPerc : 1 - offsetStartPerc;
|
||
offsetEndPerc = startsExiting ? offsetEndPerc : 1 - offsetEndPerc;
|
||
var offsetElementTop = elementRect.top + Math.min(elementRect.height * offsetStartPerc, visibleHeight);
|
||
var offsetElementBottom = elementRect.top + elementRect.height * offsetEndPerc;
|
||
var offsetHeight = offsetElementBottom - offsetElementTop;
|
||
var fixedScrollHeight = Math.min(visibleHeight + offsetHeight, scrollHeight);
|
||
var fixedScrollTop = Math.min(Math.max(0, visibleHeight - offsetElementTop), fixedScrollHeight);
|
||
var fixedScrollPerc = fixedScrollTop / fixedScrollHeight;
|
||
|
||
if (fixedScrollPerc !== state.scrollPercent) {
|
||
store.dispatch((0, _IX2EngineActions.parameterChanged)(namespacedParameterId, fixedScrollPerc));
|
||
}
|
||
|
||
return {
|
||
scrollPercent: fixedScrollPerc
|
||
};
|
||
}
|
||
}
|
||
}), (0, _defineProperty2["default"])(_default2, SCROLL_INTO_VIEW, scrollIntoOutOfViewOptions), (0, _defineProperty2["default"])(_default2, SCROLL_OUT_OF_VIEW, scrollIntoOutOfViewOptions), (0, _defineProperty2["default"])(_default2, PAGE_SCROLL_DOWN, (0, _extends2["default"])({}, baseScrollActionGroupOptions, {
|
||
handler: whenScrollDirectionChange(function (options, state) {
|
||
if (state.scrollingDown) {
|
||
actionGroupCreator(options);
|
||
}
|
||
})
|
||
})), (0, _defineProperty2["default"])(_default2, PAGE_SCROLL_UP, (0, _extends2["default"])({}, baseScrollActionGroupOptions, {
|
||
handler: whenScrollDirectionChange(function (options, state) {
|
||
if (!state.scrollingDown) {
|
||
actionGroupCreator(options);
|
||
}
|
||
})
|
||
})), (0, _defineProperty2["default"])(_default2, PAGE_FINISH, {
|
||
types: 'readystatechange IX2_PAGE_UPDATE',
|
||
handler: withFilter(isElement, whenPageLoadFinish(actionGroupCreator))
|
||
}), (0, _defineProperty2["default"])(_default2, PAGE_START, {
|
||
types: 'readystatechange IX2_PAGE_UPDATE',
|
||
handler: withFilter(isElement, whenPageLoadStart(actionGroupCreator))
|
||
}), _default2);
|
||
|
||
exports["default"] = _default;
|
||
|
||
/***/ }),
|
||
/* 362 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var createFlow = __webpack_require__(363);
|
||
|
||
/**
|
||
* Creates a function that returns the result of invoking the given functions
|
||
* with the `this` binding of the created function, where each successive
|
||
* invocation is supplied the return value of the previous.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 3.0.0
|
||
* @category Util
|
||
* @param {...(Function|Function[])} [funcs] The functions to invoke.
|
||
* @returns {Function} Returns the new composite function.
|
||
* @see _.flowRight
|
||
* @example
|
||
*
|
||
* function square(n) {
|
||
* return n * n;
|
||
* }
|
||
*
|
||
* var addSquare = _.flow([_.add, square]);
|
||
* addSquare(1, 2);
|
||
* // => 9
|
||
*/
|
||
var flow = createFlow();
|
||
|
||
module.exports = flow;
|
||
|
||
|
||
/***/ }),
|
||
/* 363 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var LodashWrapper = __webpack_require__(88),
|
||
flatRest = __webpack_require__(364),
|
||
getData = __webpack_require__(150),
|
||
getFuncName = __webpack_require__(151),
|
||
isArray = __webpack_require__(2),
|
||
isLaziable = __webpack_require__(377);
|
||
|
||
/** Error message constants. */
|
||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||
|
||
/** Used to compose bitmasks for function metadata. */
|
||
var WRAP_CURRY_FLAG = 8,
|
||
WRAP_PARTIAL_FLAG = 32,
|
||
WRAP_ARY_FLAG = 128,
|
||
WRAP_REARG_FLAG = 256;
|
||
|
||
/**
|
||
* Creates a `_.flow` or `_.flowRight` function.
|
||
*
|
||
* @private
|
||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||
* @returns {Function} Returns the new flow function.
|
||
*/
|
||
function createFlow(fromRight) {
|
||
return flatRest(function(funcs) {
|
||
var length = funcs.length,
|
||
index = length,
|
||
prereq = LodashWrapper.prototype.thru;
|
||
|
||
if (fromRight) {
|
||
funcs.reverse();
|
||
}
|
||
while (index--) {
|
||
var func = funcs[index];
|
||
if (typeof func != 'function') {
|
||
throw new TypeError(FUNC_ERROR_TEXT);
|
||
}
|
||
if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
|
||
var wrapper = new LodashWrapper([], true);
|
||
}
|
||
}
|
||
index = wrapper ? index : length;
|
||
while (++index < length) {
|
||
func = funcs[index];
|
||
|
||
var funcName = getFuncName(func),
|
||
data = funcName == 'wrapper' ? getData(func) : undefined;
|
||
|
||
if (data && isLaziable(data[0]) &&
|
||
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
|
||
!data[4].length && data[9] == 1
|
||
) {
|
||
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
||
} else {
|
||
wrapper = (func.length == 1 && isLaziable(func))
|
||
? wrapper[funcName]()
|
||
: wrapper.thru(func);
|
||
}
|
||
}
|
||
return function() {
|
||
var args = arguments,
|
||
value = args[0];
|
||
|
||
if (wrapper && args.length == 1 && isArray(value)) {
|
||
return wrapper.plant(value).value();
|
||
}
|
||
var index = 0,
|
||
result = length ? funcs[index].apply(this, args) : value;
|
||
|
||
while (++index < length) {
|
||
result = funcs[index].call(this, result);
|
||
}
|
||
return result;
|
||
};
|
||
});
|
||
}
|
||
|
||
module.exports = createFlow;
|
||
|
||
|
||
/***/ }),
|
||
/* 364 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var flatten = __webpack_require__(365),
|
||
overRest = __webpack_require__(368),
|
||
setToString = __webpack_require__(370);
|
||
|
||
/**
|
||
* A specialized version of `baseRest` which flattens the rest array.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to apply a rest parameter to.
|
||
* @returns {Function} Returns the new function.
|
||
*/
|
||
function flatRest(func) {
|
||
return setToString(overRest(func, undefined, flatten), func + '');
|
||
}
|
||
|
||
module.exports = flatRest;
|
||
|
||
|
||
/***/ }),
|
||
/* 365 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseFlatten = __webpack_require__(366);
|
||
|
||
/**
|
||
* Flattens `array` a single level deep.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 0.1.0
|
||
* @category Array
|
||
* @param {Array} array The array to flatten.
|
||
* @returns {Array} Returns the new flattened array.
|
||
* @example
|
||
*
|
||
* _.flatten([1, [2, [3, [4]], 5]]);
|
||
* // => [1, 2, [3, [4]], 5]
|
||
*/
|
||
function flatten(array) {
|
||
var length = array == null ? 0 : array.length;
|
||
return length ? baseFlatten(array, 1) : [];
|
||
}
|
||
|
||
module.exports = flatten;
|
||
|
||
|
||
/***/ }),
|
||
/* 366 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayPush = __webpack_require__(60),
|
||
isFlattenable = __webpack_require__(367);
|
||
|
||
/**
|
||
* The base implementation of `_.flatten` with support for restricting flattening.
|
||
*
|
||
* @private
|
||
* @param {Array} array The array to flatten.
|
||
* @param {number} depth The maximum recursion depth.
|
||
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
||
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
||
* @param {Array} [result=[]] The initial result value.
|
||
* @returns {Array} Returns the new flattened array.
|
||
*/
|
||
function baseFlatten(array, depth, predicate, isStrict, result) {
|
||
var index = -1,
|
||
length = array.length;
|
||
|
||
predicate || (predicate = isFlattenable);
|
||
result || (result = []);
|
||
|
||
while (++index < length) {
|
||
var value = array[index];
|
||
if (depth > 0 && predicate(value)) {
|
||
if (depth > 1) {
|
||
// Recursively flatten arrays (susceptible to call stack limits).
|
||
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
||
} else {
|
||
arrayPush(result, value);
|
||
}
|
||
} else if (!isStrict) {
|
||
result[result.length] = value;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
module.exports = baseFlatten;
|
||
|
||
|
||
/***/ }),
|
||
/* 367 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var Symbol = __webpack_require__(32),
|
||
isArguments = __webpack_require__(48),
|
||
isArray = __webpack_require__(2);
|
||
|
||
/** Built-in value references. */
|
||
var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
||
|
||
/**
|
||
* Checks if `value` is a flattenable `arguments` object or array.
|
||
*
|
||
* @private
|
||
* @param {*} value The value to check.
|
||
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
||
*/
|
||
function isFlattenable(value) {
|
||
return isArray(value) || isArguments(value) ||
|
||
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
||
}
|
||
|
||
module.exports = isFlattenable;
|
||
|
||
|
||
/***/ }),
|
||
/* 368 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var apply = __webpack_require__(369);
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeMax = Math.max;
|
||
|
||
/**
|
||
* A specialized version of `baseRest` which transforms the rest array.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to apply a rest parameter to.
|
||
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
||
* @param {Function} transform The rest array transform.
|
||
* @returns {Function} Returns the new function.
|
||
*/
|
||
function overRest(func, start, transform) {
|
||
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
||
return function() {
|
||
var args = arguments,
|
||
index = -1,
|
||
length = nativeMax(args.length - start, 0),
|
||
array = Array(length);
|
||
|
||
while (++index < length) {
|
||
array[index] = args[start + index];
|
||
}
|
||
index = -1;
|
||
var otherArgs = Array(start + 1);
|
||
while (++index < start) {
|
||
otherArgs[index] = args[index];
|
||
}
|
||
otherArgs[start] = transform(array);
|
||
return apply(func, this, otherArgs);
|
||
};
|
||
}
|
||
|
||
module.exports = overRest;
|
||
|
||
|
||
/***/ }),
|
||
/* 369 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* A faster alternative to `Function#apply`, this function invokes `func`
|
||
* with the `this` binding of `thisArg` and the arguments of `args`.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to invoke.
|
||
* @param {*} thisArg The `this` binding of `func`.
|
||
* @param {Array} args The arguments to invoke `func` with.
|
||
* @returns {*} Returns the result of `func`.
|
||
*/
|
||
function apply(func, thisArg, args) {
|
||
switch (args.length) {
|
||
case 0: return func.call(thisArg);
|
||
case 1: return func.call(thisArg, args[0]);
|
||
case 2: return func.call(thisArg, args[0], args[1]);
|
||
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
||
}
|
||
return func.apply(thisArg, args);
|
||
}
|
||
|
||
module.exports = apply;
|
||
|
||
|
||
/***/ }),
|
||
/* 370 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseSetToString = __webpack_require__(371),
|
||
shortOut = __webpack_require__(373);
|
||
|
||
/**
|
||
* Sets the `toString` method of `func` to return `string`.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to modify.
|
||
* @param {Function} string The `toString` result.
|
||
* @returns {Function} Returns `func`.
|
||
*/
|
||
var setToString = shortOut(baseSetToString);
|
||
|
||
module.exports = setToString;
|
||
|
||
|
||
/***/ }),
|
||
/* 371 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var constant = __webpack_require__(372),
|
||
defineProperty = __webpack_require__(148),
|
||
identity = __webpack_require__(71);
|
||
|
||
/**
|
||
* The base implementation of `setToString` without support for hot loop shorting.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to modify.
|
||
* @param {Function} string The `toString` result.
|
||
* @returns {Function} Returns `func`.
|
||
*/
|
||
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
||
return defineProperty(func, 'toString', {
|
||
'configurable': true,
|
||
'enumerable': false,
|
||
'value': constant(string),
|
||
'writable': true
|
||
});
|
||
};
|
||
|
||
module.exports = baseSetToString;
|
||
|
||
|
||
/***/ }),
|
||
/* 372 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Creates a function that returns `value`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 2.4.0
|
||
* @category Util
|
||
* @param {*} value The value to return from the new function.
|
||
* @returns {Function} Returns the new constant function.
|
||
* @example
|
||
*
|
||
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
||
*
|
||
* console.log(objects);
|
||
* // => [{ 'a': 1 }, { 'a': 1 }]
|
||
*
|
||
* console.log(objects[0] === objects[1]);
|
||
* // => true
|
||
*/
|
||
function constant(value) {
|
||
return function() {
|
||
return value;
|
||
};
|
||
}
|
||
|
||
module.exports = constant;
|
||
|
||
|
||
/***/ }),
|
||
/* 373 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
||
var HOT_COUNT = 800,
|
||
HOT_SPAN = 16;
|
||
|
||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||
var nativeNow = Date.now;
|
||
|
||
/**
|
||
* Creates a function that'll short out and invoke `identity` instead
|
||
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
||
* milliseconds.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to restrict.
|
||
* @returns {Function} Returns the new shortable function.
|
||
*/
|
||
function shortOut(func) {
|
||
var count = 0,
|
||
lastCalled = 0;
|
||
|
||
return function() {
|
||
var stamp = nativeNow(),
|
||
remaining = HOT_SPAN - (stamp - lastCalled);
|
||
|
||
lastCalled = stamp;
|
||
if (remaining > 0) {
|
||
if (++count >= HOT_COUNT) {
|
||
return arguments[0];
|
||
}
|
||
} else {
|
||
count = 0;
|
||
}
|
||
return func.apply(undefined, arguments);
|
||
};
|
||
}
|
||
|
||
module.exports = shortOut;
|
||
|
||
|
||
/***/ }),
|
||
/* 374 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var WeakMap = __webpack_require__(106);
|
||
|
||
/** Used to store function metadata. */
|
||
var metaMap = WeakMap && new WeakMap;
|
||
|
||
module.exports = metaMap;
|
||
|
||
|
||
/***/ }),
|
||
/* 375 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* This method returns `undefined`.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 2.3.0
|
||
* @category Util
|
||
* @example
|
||
*
|
||
* _.times(2, _.noop);
|
||
* // => [undefined, undefined]
|
||
*/
|
||
function noop() {
|
||
// No operation performed.
|
||
}
|
||
|
||
module.exports = noop;
|
||
|
||
|
||
/***/ }),
|
||
/* 376 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/** Used to lookup unminified function names. */
|
||
var realNames = {};
|
||
|
||
module.exports = realNames;
|
||
|
||
|
||
/***/ }),
|
||
/* 377 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var LazyWrapper = __webpack_require__(90),
|
||
getData = __webpack_require__(150),
|
||
getFuncName = __webpack_require__(151),
|
||
lodash = __webpack_require__(378);
|
||
|
||
/**
|
||
* Checks if `func` has a lazy counterpart.
|
||
*
|
||
* @private
|
||
* @param {Function} func The function to check.
|
||
* @returns {boolean} Returns `true` if `func` has a lazy counterpart,
|
||
* else `false`.
|
||
*/
|
||
function isLaziable(func) {
|
||
var funcName = getFuncName(func),
|
||
other = lodash[funcName];
|
||
|
||
if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
|
||
return false;
|
||
}
|
||
if (func === other) {
|
||
return true;
|
||
}
|
||
var data = getData(other);
|
||
return !!data && func === data[0];
|
||
}
|
||
|
||
module.exports = isLaziable;
|
||
|
||
|
||
/***/ }),
|
||
/* 378 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var LazyWrapper = __webpack_require__(90),
|
||
LodashWrapper = __webpack_require__(88),
|
||
baseLodash = __webpack_require__(89),
|
||
isArray = __webpack_require__(2),
|
||
isObjectLike = __webpack_require__(20),
|
||
wrapperClone = __webpack_require__(379);
|
||
|
||
/** Used for built-in method references. */
|
||
var objectProto = Object.prototype;
|
||
|
||
/** Used to check objects for own properties. */
|
||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||
|
||
/**
|
||
* Creates a `lodash` object which wraps `value` to enable implicit method
|
||
* chain sequences. Methods that operate on and return arrays, collections,
|
||
* and functions can be chained together. Methods that retrieve a single value
|
||
* or may return a primitive value will automatically end the chain sequence
|
||
* and return the unwrapped value. Otherwise, the value must be unwrapped
|
||
* with `_#value`.
|
||
*
|
||
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
|
||
* enabled using `_.chain`.
|
||
*
|
||
* The execution of chained methods is lazy, that is, it's deferred until
|
||
* `_#value` is implicitly or explicitly called.
|
||
*
|
||
* Lazy evaluation allows several methods to support shortcut fusion.
|
||
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
|
||
* the creation of intermediate arrays and can greatly reduce the number of
|
||
* iteratee executions. Sections of a chain sequence qualify for shortcut
|
||
* fusion if the section is applied to an array and iteratees accept only
|
||
* one argument. The heuristic for whether a section qualifies for shortcut
|
||
* fusion is subject to change.
|
||
*
|
||
* Chaining is supported in custom builds as long as the `_#value` method is
|
||
* directly or indirectly included in the build.
|
||
*
|
||
* In addition to lodash methods, wrappers have `Array` and `String` methods.
|
||
*
|
||
* The wrapper `Array` methods are:
|
||
* `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
|
||
*
|
||
* The wrapper `String` methods are:
|
||
* `replace` and `split`
|
||
*
|
||
* The wrapper methods that support shortcut fusion are:
|
||
* `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
|
||
* `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
|
||
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
|
||
*
|
||
* The chainable wrapper methods are:
|
||
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
|
||
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
|
||
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
|
||
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
|
||
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
|
||
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
|
||
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
|
||
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
|
||
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
|
||
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
|
||
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
|
||
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
|
||
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
|
||
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
|
||
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
|
||
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
|
||
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
|
||
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
|
||
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
|
||
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
|
||
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
|
||
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
|
||
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
|
||
* `zipObject`, `zipObjectDeep`, and `zipWith`
|
||
*
|
||
* The wrapper methods that are **not** chainable by default are:
|
||
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
|
||
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
|
||
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
|
||
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
|
||
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
|
||
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
|
||
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
|
||
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
|
||
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
|
||
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
|
||
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
||
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
||
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
||
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
|
||
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
|
||
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
|
||
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
|
||
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
|
||
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
|
||
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
|
||
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
|
||
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
|
||
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
|
||
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
|
||
* `upperFirst`, `value`, and `words`
|
||
*
|
||
* @name _
|
||
* @constructor
|
||
* @category Seq
|
||
* @param {*} value The value to wrap in a `lodash` instance.
|
||
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||
* @example
|
||
*
|
||
* function square(n) {
|
||
* return n * n;
|
||
* }
|
||
*
|
||
* var wrapped = _([1, 2, 3]);
|
||
*
|
||
* // Returns an unwrapped value.
|
||
* wrapped.reduce(_.add);
|
||
* // => 6
|
||
*
|
||
* // Returns a wrapped value.
|
||
* var squares = wrapped.map(square);
|
||
*
|
||
* _.isArray(squares);
|
||
* // => false
|
||
*
|
||
* _.isArray(squares.value());
|
||
* // => true
|
||
*/
|
||
function lodash(value) {
|
||
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
||
if (value instanceof LodashWrapper) {
|
||
return value;
|
||
}
|
||
if (hasOwnProperty.call(value, '__wrapped__')) {
|
||
return wrapperClone(value);
|
||
}
|
||
}
|
||
return new LodashWrapper(value);
|
||
}
|
||
|
||
// Ensure wrappers are instances of `baseLodash`.
|
||
lodash.prototype = baseLodash.prototype;
|
||
lodash.prototype.constructor = lodash;
|
||
|
||
module.exports = lodash;
|
||
|
||
|
||
/***/ }),
|
||
/* 379 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var LazyWrapper = __webpack_require__(90),
|
||
LodashWrapper = __webpack_require__(88),
|
||
copyArray = __webpack_require__(380);
|
||
|
||
/**
|
||
* Creates a clone of `wrapper`.
|
||
*
|
||
* @private
|
||
* @param {Object} wrapper The wrapper to clone.
|
||
* @returns {Object} Returns the cloned wrapper.
|
||
*/
|
||
function wrapperClone(wrapper) {
|
||
if (wrapper instanceof LazyWrapper) {
|
||
return wrapper.clone();
|
||
}
|
||
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
|
||
result.__actions__ = copyArray(wrapper.__actions__);
|
||
result.__index__ = wrapper.__index__;
|
||
result.__values__ = wrapper.__values__;
|
||
return result;
|
||
}
|
||
|
||
module.exports = wrapperClone;
|
||
|
||
|
||
/***/ }),
|
||
/* 380 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Copies the values of `source` to `array`.
|
||
*
|
||
* @private
|
||
* @param {Array} source The array to copy values from.
|
||
* @param {Array} [array=[]] The array to copy values to.
|
||
* @returns {Array} Returns `array`.
|
||
*/
|
||
function copyArray(source, array) {
|
||
var index = -1,
|
||
length = source.length;
|
||
|
||
array || (array = Array(length));
|
||
while (++index < length) {
|
||
array[index] = source[index];
|
||
}
|
||
return array;
|
||
}
|
||
|
||
module.exports = copyArray;
|
||
|
||
|
||
/***/ }),
|
||
/* 381 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var baseClamp = __webpack_require__(382),
|
||
toNumber = __webpack_require__(72);
|
||
|
||
/**
|
||
* Clamps `number` within the inclusive `lower` and `upper` bounds.
|
||
*
|
||
* @static
|
||
* @memberOf _
|
||
* @since 4.0.0
|
||
* @category Number
|
||
* @param {number} number The number to clamp.
|
||
* @param {number} [lower] The lower bound.
|
||
* @param {number} upper The upper bound.
|
||
* @returns {number} Returns the clamped number.
|
||
* @example
|
||
*
|
||
* _.clamp(-10, -5, 5);
|
||
* // => -5
|
||
*
|
||
* _.clamp(10, -5, 5);
|
||
* // => 5
|
||
*/
|
||
function clamp(number, lower, upper) {
|
||
if (upper === undefined) {
|
||
upper = lower;
|
||
lower = undefined;
|
||
}
|
||
if (upper !== undefined) {
|
||
upper = toNumber(upper);
|
||
upper = upper === upper ? upper : 0;
|
||
}
|
||
if (lower !== undefined) {
|
||
lower = toNumber(lower);
|
||
lower = lower === lower ? lower : 0;
|
||
}
|
||
return baseClamp(toNumber(number), lower, upper);
|
||
}
|
||
|
||
module.exports = clamp;
|
||
|
||
|
||
/***/ }),
|
||
/* 382 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* The base implementation of `_.clamp` which doesn't coerce arguments.
|
||
*
|
||
* @private
|
||
* @param {number} number The number to clamp.
|
||
* @param {number} [lower] The lower bound.
|
||
* @param {number} upper The upper bound.
|
||
* @returns {number} Returns the clamped number.
|
||
*/
|
||
function baseClamp(number, lower, upper) {
|
||
if (number === number) {
|
||
if (upper !== undefined) {
|
||
number = number <= upper ? number : upper;
|
||
}
|
||
if (lower !== undefined) {
|
||
number = number >= lower ? number : lower;
|
||
}
|
||
}
|
||
return number;
|
||
}
|
||
|
||
module.exports = baseClamp;
|
||
|
||
|
||
/***/ }),
|
||
/* 383 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals window, document */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Auto-select links to current page or section
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
Webflow.define('links', module.exports = function ($, _) {
|
||
var api = {};
|
||
var $win = $(window);
|
||
var designer;
|
||
var inApp = Webflow.env();
|
||
var location = window.location;
|
||
var tempLink = document.createElement('a');
|
||
var linkCurrent = 'w--current';
|
||
var indexPage = /index\.(html|php)$/;
|
||
var dirList = /\/$/;
|
||
var anchors;
|
||
var slug; // -----------------------------------
|
||
// Module methods
|
||
|
||
api.ready = api.design = api.preview = init; // -----------------------------------
|
||
// Private methods
|
||
|
||
function init() {
|
||
designer = inApp && Webflow.env('design');
|
||
slug = Webflow.env('slug') || location.pathname || ''; // Reset scroll listener, init anchors
|
||
|
||
Webflow.scroll.off(scroll);
|
||
anchors = []; // Test all links for a selectable href
|
||
|
||
var links = document.links;
|
||
|
||
for (var i = 0; i < links.length; ++i) {
|
||
select(links[i]);
|
||
} // Listen for scroll if any anchors exist
|
||
|
||
|
||
if (anchors.length) {
|
||
Webflow.scroll.on(scroll);
|
||
scroll();
|
||
}
|
||
}
|
||
|
||
function select(link) {
|
||
var href = designer && link.getAttribute('href-disabled') || link.getAttribute('href');
|
||
tempLink.href = href; // Ignore any hrefs with a colon to safely avoid all uri schemes
|
||
|
||
if (href.indexOf(':') >= 0) {
|
||
return;
|
||
}
|
||
|
||
var $link = $(link); // Check for all links with hash (eg (this-host)(/this-path)#section) to this page
|
||
|
||
if (tempLink.hash.length > 1 && tempLink.host + tempLink.pathname === location.host + location.pathname) {
|
||
// Ignore any hrefs with Google Translate type hash
|
||
// Example: jQuery can't parse $('#googtrans(en|es)')
|
||
// https://forum.webflow.com/t/dropdown-menus-not-working-on-site/87140
|
||
if (!/^#[a-zA-Z0-9\-\_]+$/.test(tempLink.hash)) {
|
||
return;
|
||
}
|
||
|
||
var $section = $(tempLink.hash);
|
||
$section.length && anchors.push({
|
||
link: $link,
|
||
sec: $section,
|
||
active: false
|
||
});
|
||
return;
|
||
} // Ignore empty # links
|
||
|
||
|
||
if (href === '#' || href === '') {
|
||
return;
|
||
} // Determine whether the link should be selected
|
||
|
||
|
||
var match = tempLink.href === location.href || href === slug || indexPage.test(href) && dirList.test(slug);
|
||
setClass($link, linkCurrent, match);
|
||
}
|
||
|
||
function scroll() {
|
||
var viewTop = $win.scrollTop();
|
||
var viewHeight = $win.height(); // Check each anchor for a section in view
|
||
|
||
_.each(anchors, function (anchor) {
|
||
var $link = anchor.link;
|
||
var $section = anchor.sec;
|
||
var top = $section.offset().top;
|
||
var height = $section.outerHeight();
|
||
var offset = viewHeight * 0.5;
|
||
var active = $section.is(':visible') && top + height - offset >= viewTop && top + offset <= viewTop + viewHeight;
|
||
|
||
if (anchor.active === active) {
|
||
return;
|
||
}
|
||
|
||
anchor.active = active;
|
||
setClass($link, linkCurrent, active);
|
||
});
|
||
}
|
||
|
||
function setClass($elem, className, add) {
|
||
var exists = $elem.hasClass(className);
|
||
|
||
if (add && exists) {
|
||
return;
|
||
}
|
||
|
||
if (!add && !exists) {
|
||
return;
|
||
}
|
||
|
||
add ? $elem.addClass(className) : $elem.removeClass(className);
|
||
} // Export module
|
||
|
||
|
||
return api;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 384 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals window, document */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Smooth scroll
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
Webflow.define('scroll', module.exports = function ($) {
|
||
/**
|
||
* A collection of namespaced events found in this module.
|
||
* Namespaced events encapsulate our code, and make it safer and easier
|
||
* for designers to apply custom code overrides.
|
||
* @see https://api.jquery.com/on/#event-names
|
||
* @typedef {Object.<string>} NamespacedEventsCollection
|
||
*/
|
||
var NS_EVENTS = {
|
||
WF_CLICK_EMPTY: 'click.wf-empty-link',
|
||
WF_CLICK_SCROLL: 'click.wf-scroll'
|
||
};
|
||
var loc = window.location;
|
||
var history = inIframe() ? null : window.history;
|
||
var $win = $(window);
|
||
var $doc = $(document);
|
||
var $body = $(document.body);
|
||
|
||
var animate = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
|
||
window.setTimeout(fn, 15);
|
||
};
|
||
|
||
var rootTag = Webflow.env('editor') ? '.w-editor-body' : 'body';
|
||
var headerSelector = 'header, ' + rootTag + ' > .header, ' + rootTag + ' > .w-nav:not([data-no-scroll])';
|
||
var emptyHrefSelector = 'a[href="#"]';
|
||
/**
|
||
* Select only links whose href:
|
||
* - contains a #
|
||
* - is not one of our namespaced TabLink elements
|
||
* - is not _only_ a #
|
||
*/
|
||
|
||
var localHrefSelector = 'a[href*="#"]:not(.w-tab-link):not(' + emptyHrefSelector + ')';
|
||
var scrollTargetOutlineCSS = '.wf-force-outline-none[tabindex="-1"]:focus{outline:none;}';
|
||
var focusStylesEl = document.createElement('style');
|
||
focusStylesEl.appendChild(document.createTextNode(scrollTargetOutlineCSS));
|
||
|
||
function inIframe() {
|
||
try {
|
||
return Boolean(window.frameElement);
|
||
} catch (e) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
var validHash = /^#[a-zA-Z0-9][\w:.-]*$/;
|
||
/**
|
||
* Determine if link navigates to current page
|
||
* @param {HTMLAnchorElement} link
|
||
*/
|
||
|
||
function linksToCurrentPage(link) {
|
||
return validHash.test(link.hash) && link.host + link.pathname === loc.host + loc.pathname;
|
||
}
|
||
/**
|
||
* Check if the designer has indicated that this page should
|
||
* have no scroll animation, or if the end user has set
|
||
* prefers-reduced-motion in their OS
|
||
*/
|
||
|
||
|
||
var reducedMotionMediaQuery = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)');
|
||
|
||
function reducedMotionEnabled() {
|
||
return document.body.getAttribute('data-wf-scroll-motion') === 'none' || reducedMotionMediaQuery.matches;
|
||
}
|
||
|
||
function setFocusable($el, action) {
|
||
var initialTabindex;
|
||
|
||
switch (action) {
|
||
case 'add':
|
||
initialTabindex = $el.attr('tabindex');
|
||
|
||
if (initialTabindex) {
|
||
$el.attr('data-wf-tabindex-swap', initialTabindex);
|
||
} else {
|
||
$el.attr('tabindex', '-1');
|
||
}
|
||
|
||
break;
|
||
|
||
case 'remove':
|
||
initialTabindex = $el.attr('data-wf-tabindex-swap');
|
||
|
||
if (initialTabindex) {
|
||
$el.attr('tabindex', initialTabindex);
|
||
$el.removeAttr('data-wf-tabindex-swap');
|
||
} else {
|
||
$el.removeAttr('tabindex');
|
||
}
|
||
|
||
break;
|
||
}
|
||
|
||
$el.toggleClass('wf-force-outline-none', action === 'add');
|
||
}
|
||
/**
|
||
* Determine if we should execute custom scroll
|
||
*/
|
||
|
||
|
||
function validateScroll(evt) {
|
||
var target = evt.currentTarget;
|
||
|
||
if ( // Bail if in Designer
|
||
Webflow.env('design') || // Ignore links being used by jQuery mobile
|
||
window.$.mobile && /(?:^|\s)ui-link(?:$|\s)/.test(target.className)) {
|
||
return;
|
||
}
|
||
|
||
var hash = linksToCurrentPage(target) ? target.hash : '';
|
||
if (hash === '') return;
|
||
var $el = $(hash);
|
||
|
||
if (!$el.length) {
|
||
return;
|
||
}
|
||
|
||
if (evt) {
|
||
evt.preventDefault();
|
||
evt.stopPropagation();
|
||
}
|
||
|
||
updateHistory(hash, evt);
|
||
window.setTimeout(function () {
|
||
scroll($el, function setFocus() {
|
||
setFocusable($el, 'add');
|
||
$el.focus();
|
||
setFocusable($el, 'remove');
|
||
});
|
||
}, evt ? 0 : 300);
|
||
}
|
||
|
||
function updateHistory(hash) {
|
||
// Push new history state
|
||
if (loc.hash !== hash && history && history.pushState && // Navigation breaks Chrome when the protocol is `file:`.
|
||
!(Webflow.env.chrome && loc.protocol === 'file:')) {
|
||
var oldHash = history.state && history.state.hash;
|
||
|
||
if (oldHash !== hash) {
|
||
history.pushState({
|
||
hash: hash
|
||
}, '', hash);
|
||
}
|
||
}
|
||
}
|
||
|
||
function scroll($targetEl, cb) {
|
||
var start = $win.scrollTop();
|
||
var end = calculateScrollEndPosition($targetEl);
|
||
if (start === end) return;
|
||
var duration = calculateScrollDuration($targetEl, start, end);
|
||
var clock = Date.now();
|
||
|
||
var step = function step() {
|
||
var elapsed = Date.now() - clock;
|
||
window.scroll(0, getY(start, end, elapsed, duration));
|
||
|
||
if (elapsed <= duration) {
|
||
animate(step);
|
||
} else if (typeof cb === 'function') {
|
||
cb();
|
||
}
|
||
};
|
||
|
||
animate(step);
|
||
}
|
||
|
||
function calculateScrollEndPosition($targetEl) {
|
||
// If a fixed header exists, offset for the height
|
||
var $header = $(headerSelector);
|
||
var offsetY = $header.css('position') === 'fixed' ? $header.outerHeight() : 0;
|
||
var end = $targetEl.offset().top - offsetY; // If specified, scroll so that the element ends up in the middle of the viewport
|
||
|
||
if ($targetEl.data('scroll') === 'mid') {
|
||
var available = $win.height() - offsetY;
|
||
var elHeight = $targetEl.outerHeight();
|
||
|
||
if (elHeight < available) {
|
||
end -= Math.round((available - elHeight) / 2);
|
||
}
|
||
}
|
||
|
||
return end;
|
||
}
|
||
|
||
function calculateScrollDuration($targetEl, start, end) {
|
||
if (reducedMotionEnabled()) return 0;
|
||
var mult = 1; // Check for custom time multiplier on the body and the scroll target
|
||
|
||
$body.add($targetEl).each(function (_, el) {
|
||
var time = parseFloat(el.getAttribute('data-scroll-time'));
|
||
|
||
if (!isNaN(time) && time >= 0) {
|
||
mult = time;
|
||
}
|
||
});
|
||
return (472.143 * Math.log(Math.abs(start - end) + 125) - 2000) * mult;
|
||
}
|
||
|
||
function getY(start, end, elapsed, duration) {
|
||
if (elapsed > duration) {
|
||
return end;
|
||
}
|
||
|
||
return start + (end - start) * ease(elapsed / duration);
|
||
}
|
||
|
||
function ease(t) {
|
||
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
||
}
|
||
|
||
function ready() {
|
||
var WF_CLICK_EMPTY = NS_EVENTS.WF_CLICK_EMPTY,
|
||
WF_CLICK_SCROLL = NS_EVENTS.WF_CLICK_SCROLL;
|
||
$doc.on(WF_CLICK_SCROLL, localHrefSelector, validateScroll);
|
||
/**
|
||
* Prevent empty hash links from triggering scroll.
|
||
* Legacy feature to preserve: use the default "#" link
|
||
* to trigger an interaction, and do not want the page
|
||
* to scroll to the top.
|
||
*/
|
||
|
||
$doc.on(WF_CLICK_EMPTY, emptyHrefSelector, function (e) {
|
||
e.preventDefault();
|
||
});
|
||
document.head.insertBefore(focusStylesEl, document.head.firstChild);
|
||
} // Export module
|
||
|
||
|
||
return {
|
||
ready: ready
|
||
};
|
||
});
|
||
|
||
/***/ }),
|
||
/* 385 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals document, window */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Touch events
|
||
* Supports legacy 'tap' event
|
||
* Adds a 'swipe' event to desktop and mobile
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
Webflow.define('touch', module.exports = function ($) {
|
||
var api = {};
|
||
var getSelection = window.getSelection; // Delegate all legacy 'tap' events to 'click'
|
||
|
||
$.event.special.tap = {
|
||
bindType: 'click',
|
||
delegateType: 'click'
|
||
};
|
||
|
||
api.init = function (el) {
|
||
el = typeof el === 'string' ? $(el).get(0) : el;
|
||
return el ? new Touch(el) : null;
|
||
};
|
||
|
||
function Touch(el) {
|
||
var active = false;
|
||
var useTouch = false;
|
||
var thresholdX = Math.min(Math.round(window.innerWidth * 0.04), 40);
|
||
var startX;
|
||
var lastX;
|
||
el.addEventListener('touchstart', start, false);
|
||
el.addEventListener('touchmove', move, false);
|
||
el.addEventListener('touchend', end, false);
|
||
el.addEventListener('touchcancel', cancel, false);
|
||
el.addEventListener('mousedown', start, false);
|
||
el.addEventListener('mousemove', move, false);
|
||
el.addEventListener('mouseup', end, false);
|
||
el.addEventListener('mouseout', cancel, false);
|
||
|
||
function start(evt) {
|
||
// We don’t handle multi-touch events yet.
|
||
var touches = evt.touches;
|
||
|
||
if (touches && touches.length > 1) {
|
||
return;
|
||
}
|
||
|
||
active = true;
|
||
|
||
if (touches) {
|
||
useTouch = true;
|
||
startX = touches[0].clientX;
|
||
} else {
|
||
startX = evt.clientX;
|
||
}
|
||
|
||
lastX = startX;
|
||
}
|
||
|
||
function move(evt) {
|
||
if (!active) {
|
||
return;
|
||
}
|
||
|
||
if (useTouch && evt.type === 'mousemove') {
|
||
evt.preventDefault();
|
||
evt.stopPropagation();
|
||
return;
|
||
}
|
||
|
||
var touches = evt.touches;
|
||
var x = touches ? touches[0].clientX : evt.clientX;
|
||
var velocityX = x - lastX;
|
||
lastX = x; // Allow swipes while pointer is down, but prevent them during text selection
|
||
|
||
if (Math.abs(velocityX) > thresholdX && getSelection && String(getSelection()) === '') {
|
||
triggerEvent('swipe', evt, {
|
||
direction: velocityX > 0 ? 'right' : 'left'
|
||
});
|
||
cancel();
|
||
}
|
||
}
|
||
|
||
function end(evt) {
|
||
if (!active) {
|
||
return;
|
||
}
|
||
|
||
active = false;
|
||
|
||
if (useTouch && evt.type === 'mouseup') {
|
||
evt.preventDefault();
|
||
evt.stopPropagation();
|
||
useTouch = false;
|
||
return;
|
||
}
|
||
}
|
||
|
||
function cancel() {
|
||
active = false;
|
||
}
|
||
|
||
function destroy() {
|
||
el.removeEventListener('touchstart', start, false);
|
||
el.removeEventListener('touchmove', move, false);
|
||
el.removeEventListener('touchend', end, false);
|
||
el.removeEventListener('touchcancel', cancel, false);
|
||
el.removeEventListener('mousedown', start, false);
|
||
el.removeEventListener('mousemove', move, false);
|
||
el.removeEventListener('mouseup', end, false);
|
||
el.removeEventListener('mouseout', cancel, false);
|
||
el = null;
|
||
} // Public instance methods
|
||
|
||
|
||
this.destroy = destroy;
|
||
} // Wrap native event to supoprt preventdefault + stopPropagation
|
||
|
||
|
||
function triggerEvent(type, evt, data) {
|
||
var newEvent = $.Event(type, {
|
||
originalEvent: evt
|
||
});
|
||
$(evt.target).trigger(newEvent, data);
|
||
} // Listen for touch events on all nodes by default.
|
||
|
||
|
||
api.instance = api.init(document); // Export module
|
||
|
||
return api;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 386 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals window, document */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Dropdown component
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
var IXEvents = __webpack_require__(56);
|
||
|
||
var KEY_CODES = {
|
||
ARROW_LEFT: 37,
|
||
ARROW_UP: 38,
|
||
ARROW_RIGHT: 39,
|
||
ARROW_DOWN: 40,
|
||
ESCAPE: 27,
|
||
SPACE: 32,
|
||
ENTER: 13,
|
||
HOME: 36,
|
||
END: 35
|
||
};
|
||
var FORCE_CLOSE = true;
|
||
/**
|
||
* This pattern matches links that begin with a `#` AND have some alphanumeric
|
||
* characters after it, including also hyphens and underscores
|
||
*
|
||
* Matches:
|
||
* #foo
|
||
* #999
|
||
* #foo-bar_baz
|
||
*
|
||
* Does not match:
|
||
* #
|
||
*/
|
||
|
||
var INTERNAL_PAGE_LINK_HASHES_PATTERN = /^#[a-zA-Z0-9\-_]+$/;
|
||
Webflow.define('dropdown', module.exports = function ($, _) {
|
||
var debounce = _.debounce;
|
||
var api = {};
|
||
var inApp = Webflow.env();
|
||
var inPreview = false;
|
||
var inDesigner;
|
||
var touch = Webflow.env.touch;
|
||
var namespace = '.w-dropdown';
|
||
var openStateClassName = 'w--open';
|
||
var ix = IXEvents.triggers;
|
||
var defaultZIndex = 900; // @dropdown-depth
|
||
|
||
var focusOutEvent = 'focusout' + namespace;
|
||
var keydownEvent = 'keydown' + namespace;
|
||
var mouseEnterEvent = 'mouseenter' + namespace;
|
||
var mouseMoveEvent = 'mousemove' + namespace;
|
||
var mouseLeaveEvent = 'mouseleave' + namespace;
|
||
var mouseUpEvent = (touch ? 'click' : 'mouseup') + namespace;
|
||
var closeEvent = 'w-close' + namespace;
|
||
var settingEvent = 'setting' + namespace;
|
||
var $doc = $(document);
|
||
var $dropdowns; // -----------------------------------
|
||
// Module methods
|
||
|
||
api.ready = init;
|
||
|
||
api.design = function () {
|
||
// Close all when returning from preview
|
||
if (inPreview) {
|
||
closeAll();
|
||
}
|
||
|
||
inPreview = false;
|
||
init();
|
||
};
|
||
|
||
api.preview = function () {
|
||
inPreview = true;
|
||
init();
|
||
}; // -----------------------------------
|
||
// Private methods
|
||
|
||
|
||
function init() {
|
||
inDesigner = inApp && Webflow.env('design'); // Find all instances on the page
|
||
|
||
$dropdowns = $doc.find(namespace);
|
||
$dropdowns.each(build);
|
||
}
|
||
|
||
function build(i, el) {
|
||
var $el = $(el); // Store state in data
|
||
|
||
var data = $.data(el, namespace);
|
||
|
||
if (!data) {
|
||
data = $.data(el, namespace, {
|
||
open: false,
|
||
el: $el,
|
||
config: {},
|
||
selectedIdx: -1
|
||
});
|
||
}
|
||
|
||
data.toggle = data.el.children('.w-dropdown-toggle');
|
||
data.list = data.el.children('.w-dropdown-list');
|
||
data.links = data.list.find('a:not(.w-dropdown .w-dropdown a)');
|
||
data.complete = complete(data);
|
||
data.mouseLeave = makeMouseLeaveHandler(data);
|
||
data.mouseUpOutside = outside(data);
|
||
data.mouseMoveOutside = moveOutside(data); // Set config from data attributes
|
||
|
||
configure(data); // Store the IDs of the toggle button & list
|
||
|
||
var toggleId = data.toggle.attr('id');
|
||
var listId = data.list.attr('id'); // If user did not provide toggle ID, set it
|
||
|
||
if (!toggleId) {
|
||
toggleId = 'w-dropdown-toggle-' + i;
|
||
} // If user did not provide list ID, set it
|
||
|
||
|
||
if (!listId) {
|
||
listId = 'w-dropdown-list-' + i;
|
||
} // Add attributes to toggle element
|
||
|
||
|
||
data.toggle.attr('id', toggleId);
|
||
data.toggle.attr('aria-controls', listId);
|
||
data.toggle.attr('aria-haspopup', 'menu');
|
||
data.toggle.attr('aria-expanded', 'false'); // Hide toggle icon from ATs
|
||
|
||
data.toggle.find('.w-icon-dropdown-toggle').attr('aria-hidden', 'true'); // If toggle element is not a button
|
||
|
||
if (data.toggle.prop('tagName') !== 'BUTTON') {
|
||
// Give it an appropriate role
|
||
data.toggle.attr('role', 'button'); // And give it a tabindex if user has not provided one
|
||
|
||
if (!data.toggle.attr('tabindex')) {
|
||
data.toggle.attr('tabindex', '0');
|
||
}
|
||
} // Add attributes to list element
|
||
|
||
|
||
data.list.attr('id', listId);
|
||
data.list.attr('aria-labelledby', toggleId);
|
||
data.links.each(function (idx, link) {
|
||
/**
|
||
* In macOS Safari, links don't take focus on click unless they have
|
||
* a tabindex. Without this, the dropdown will break.
|
||
* @see https://gist.github.com/cvrebert/68659d0333a578d75372
|
||
*/
|
||
if (!link.hasAttribute('tabindex')) link.setAttribute('tabindex', '0'); // We want to close the drop down if the href links somewhere internally
|
||
// to the page
|
||
|
||
if (INTERNAL_PAGE_LINK_HASHES_PATTERN.test(link.hash)) {
|
||
link.addEventListener('click', close.bind(null, data));
|
||
}
|
||
}); // Remove old events
|
||
|
||
data.el.off(namespace);
|
||
data.toggle.off(namespace);
|
||
|
||
if (data.nav) {
|
||
data.nav.off(namespace);
|
||
}
|
||
|
||
var initialToggler = makeToggler(data, FORCE_CLOSE);
|
||
|
||
if (inDesigner) {
|
||
data.el.on(settingEvent, makeSettingEventHandler(data));
|
||
}
|
||
|
||
if (!inDesigner) {
|
||
// Close in preview mode and clean the data.hovering state
|
||
if (inApp) {
|
||
data.hovering = false;
|
||
close(data);
|
||
}
|
||
|
||
if (data.config.hover) {
|
||
data.toggle.on(mouseEnterEvent, makeMouseEnterHandler(data));
|
||
}
|
||
|
||
data.el.on(closeEvent, initialToggler);
|
||
data.el.on(keydownEvent, makeDropdownKeydownHandler(data));
|
||
data.el.on(focusOutEvent, makeDropdownFocusOutHandler(data));
|
||
data.toggle.on(mouseUpEvent, initialToggler);
|
||
data.toggle.on(keydownEvent, makeToggleKeydownHandler(data));
|
||
data.nav = data.el.closest('.w-nav');
|
||
data.nav.on(closeEvent, initialToggler);
|
||
}
|
||
}
|
||
/**
|
||
* Mutate the data object with a new config property
|
||
*/
|
||
|
||
|
||
function configure(data) {
|
||
// Determine if z-index should be managed
|
||
var zIndex = Number(data.el.css('z-index'));
|
||
data.manageZ = zIndex === defaultZIndex || zIndex === defaultZIndex + 1;
|
||
data.config = {
|
||
hover: data.el.attr('data-hover') === 'true' && !touch,
|
||
delay: data.el.attr('data-delay')
|
||
};
|
||
}
|
||
|
||
function makeSettingEventHandler(data) {
|
||
return function (evt, options) {
|
||
options = options || {};
|
||
configure(data);
|
||
options.open === true && open(data, true);
|
||
options.open === false && close(data, {
|
||
immediate: true
|
||
});
|
||
};
|
||
}
|
||
|
||
function makeToggler(data, forceClose) {
|
||
return debounce(function (evt) {
|
||
if (data.open || evt && evt.type === 'w-close') {
|
||
return close(data, {
|
||
forceClose: forceClose
|
||
});
|
||
}
|
||
|
||
open(data);
|
||
});
|
||
}
|
||
|
||
function open(data) {
|
||
if (data.open) {
|
||
return;
|
||
}
|
||
|
||
closeOthers(data);
|
||
data.open = true;
|
||
data.list.addClass(openStateClassName);
|
||
data.toggle.addClass(openStateClassName);
|
||
data.toggle.attr('aria-expanded', 'true'); // ARIA
|
||
|
||
ix.intro(0, data.el[0]);
|
||
Webflow.redraw.up(); // Increase z-index to keep above other managed dropdowns
|
||
|
||
data.manageZ && data.el.css('z-index', defaultZIndex + 1); // Listen for click outside events
|
||
|
||
var isEditor = Webflow.env('editor');
|
||
|
||
if (!inDesigner) {
|
||
$doc.on(mouseUpEvent, data.mouseUpOutside);
|
||
}
|
||
|
||
if (data.hovering && !isEditor) {
|
||
data.el.on(mouseLeaveEvent, data.mouseLeave);
|
||
}
|
||
|
||
if (data.hovering && isEditor) {
|
||
$doc.on(mouseMoveEvent, data.mouseMoveOutside);
|
||
} // Clear previous delay
|
||
|
||
|
||
window.clearTimeout(data.delayId);
|
||
}
|
||
|
||
function close(data) {
|
||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||
immediate = _ref.immediate,
|
||
forceClose = _ref.forceClose;
|
||
|
||
if (!data.open) {
|
||
return;
|
||
} // Do not close hover-based menus if currently hovering
|
||
|
||
|
||
if (data.config.hover && data.hovering && !forceClose) {
|
||
return;
|
||
}
|
||
|
||
data.toggle.attr('aria-expanded', 'false');
|
||
data.open = false;
|
||
var config = data.config;
|
||
ix.outro(0, data.el[0]); // Stop listening for click outside events
|
||
|
||
$doc.off(mouseUpEvent, data.mouseUpOutside);
|
||
$doc.off(mouseMoveEvent, data.mouseMoveOutside);
|
||
data.el.off(mouseLeaveEvent, data.mouseLeave); // Clear previous delay
|
||
|
||
window.clearTimeout(data.delayId); // Skip delay during immediate
|
||
|
||
if (!config.delay || immediate) {
|
||
return data.complete();
|
||
} // Optionally wait for delay before close
|
||
|
||
|
||
data.delayId = window.setTimeout(data.complete, config.delay);
|
||
}
|
||
|
||
function closeAll() {
|
||
$doc.find(namespace).each(function (i, el) {
|
||
$(el).triggerHandler(closeEvent);
|
||
});
|
||
}
|
||
|
||
function closeOthers(data) {
|
||
var self = data.el[0];
|
||
$dropdowns.each(function (i, other) {
|
||
var $other = $(other);
|
||
|
||
if ($other.is(self) || $other.has(self).length) {
|
||
return;
|
||
}
|
||
|
||
$other.triggerHandler(closeEvent);
|
||
});
|
||
}
|
||
|
||
function outside(data) {
|
||
// Unbind previous click handler if it exists
|
||
if (data.mouseUpOutside) {
|
||
$doc.off(mouseUpEvent, data.mouseUpOutside);
|
||
} // Close menu when clicked outside
|
||
|
||
|
||
return debounce(function (evt) {
|
||
if (!data.open) {
|
||
return;
|
||
}
|
||
|
||
var $target = $(evt.target);
|
||
|
||
if ($target.closest('.w-dropdown-toggle').length) {
|
||
return;
|
||
}
|
||
|
||
var isEventOutsideDropdowns = $.inArray(data.el[0], $target.parents(namespace)) === -1;
|
||
var isEditor = Webflow.env('editor');
|
||
|
||
if (isEventOutsideDropdowns) {
|
||
if (isEditor) {
|
||
var isEventOnDetachedSvg = $target.parents().length === 1 && $target.parents('svg').length === 1;
|
||
var isEventOnHoverControls = $target.parents('.w-editor-bem-EditorHoverControls').length;
|
||
|
||
if (isEventOnDetachedSvg || isEventOnHoverControls) {
|
||
return;
|
||
}
|
||
}
|
||
|
||
close(data);
|
||
}
|
||
});
|
||
}
|
||
|
||
function complete(data) {
|
||
return function () {
|
||
data.list.removeClass(openStateClassName);
|
||
data.toggle.removeClass(openStateClassName); // Reset z-index for managed dropdowns
|
||
|
||
data.manageZ && data.el.css('z-index', '');
|
||
};
|
||
}
|
||
|
||
function makeMouseEnterHandler(data) {
|
||
return function () {
|
||
data.hovering = true;
|
||
open(data);
|
||
};
|
||
}
|
||
|
||
function makeMouseLeaveHandler(data) {
|
||
return function () {
|
||
data.hovering = false; // We do not want the list to close upon mouseleave
|
||
// if one of the links has focus
|
||
|
||
if (!data.links.is(':focus')) {
|
||
close(data);
|
||
}
|
||
};
|
||
}
|
||
|
||
function moveOutside(data) {
|
||
return debounce(function (evt) {
|
||
if (!data.open) {
|
||
return;
|
||
}
|
||
|
||
var $target = $(evt.target);
|
||
var isEventOutsideDropdowns = $.inArray(data.el[0], $target.parents(namespace)) === -1;
|
||
|
||
if (isEventOutsideDropdowns) {
|
||
var isEventOnHoverControls = $target.parents('.w-editor-bem-EditorHoverControls').length;
|
||
var isEventOnHoverToolbar = $target.parents('.w-editor-bem-RTToolbar').length;
|
||
var $editorOverlay = $('.w-editor-bem-EditorOverlay');
|
||
var isDropdownInEdition = $editorOverlay.find('.w-editor-edit-outline').length || $editorOverlay.find('.w-editor-bem-RTToolbar').length;
|
||
|
||
if (isEventOnHoverControls || isEventOnHoverToolbar || isDropdownInEdition) {
|
||
return;
|
||
}
|
||
|
||
data.hovering = false;
|
||
close(data);
|
||
}
|
||
});
|
||
}
|
||
|
||
function makeDropdownKeydownHandler(data) {
|
||
return function (evt) {
|
||
// Do not respond to keyboard events in designer or preview mode,
|
||
// or if the list is not open
|
||
if (inDesigner || inPreview || !data.open) {
|
||
return;
|
||
} // Realign selectedIdx with the menu item that is currently in focus.
|
||
// We need this because we do not track the `Tab` key activity!
|
||
|
||
|
||
data.selectedIdx = data.links.index(document.activeElement); // Evaluate item-selection logic
|
||
|
||
switch (evt.keyCode) {
|
||
case KEY_CODES.HOME:
|
||
{
|
||
if (!data.open) return;
|
||
data.selectedIdx = 0;
|
||
focusSelectedLink(data);
|
||
return evt.preventDefault();
|
||
}
|
||
|
||
case KEY_CODES.END:
|
||
{
|
||
if (!data.open) return;
|
||
data.selectedIdx = data.links.length - 1;
|
||
focusSelectedLink(data);
|
||
return evt.preventDefault();
|
||
}
|
||
|
||
case KEY_CODES.ESCAPE:
|
||
{
|
||
close(data);
|
||
data.toggle.focus();
|
||
return evt.stopPropagation();
|
||
}
|
||
|
||
case KEY_CODES.ARROW_RIGHT:
|
||
case KEY_CODES.ARROW_DOWN:
|
||
{
|
||
data.selectedIdx = Math.min(data.links.length - 1, data.selectedIdx + 1);
|
||
focusSelectedLink(data);
|
||
return evt.preventDefault();
|
||
}
|
||
|
||
case KEY_CODES.ARROW_LEFT:
|
||
case KEY_CODES.ARROW_UP:
|
||
{
|
||
data.selectedIdx = Math.max(-1, data.selectedIdx - 1);
|
||
focusSelectedLink(data);
|
||
return evt.preventDefault();
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
function focusSelectedLink(data) {
|
||
if (data.links[data.selectedIdx]) {
|
||
data.links[data.selectedIdx].focus();
|
||
}
|
||
}
|
||
|
||
function makeToggleKeydownHandler(data) {
|
||
// We want to close immediately
|
||
// if interacting via keyboard
|
||
var toggler = makeToggler(data, FORCE_CLOSE);
|
||
return function (evt) {
|
||
// Do not respond to keyboard events in designer or preview
|
||
if (inDesigner || inPreview) return; // If the menu is not open, we don't want
|
||
// the up or Down arrows to do anything
|
||
|
||
if (!data.open) {
|
||
switch (evt.keyCode) {
|
||
case KEY_CODES.ARROW_UP:
|
||
case KEY_CODES.ARROW_DOWN:
|
||
{
|
||
return evt.stopPropagation();
|
||
}
|
||
}
|
||
}
|
||
|
||
switch (evt.keyCode) {
|
||
case KEY_CODES.SPACE:
|
||
case KEY_CODES.ENTER:
|
||
{
|
||
toggler();
|
||
evt.stopPropagation();
|
||
return evt.preventDefault();
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
function makeDropdownFocusOutHandler(data) {
|
||
return debounce(function (evt) {
|
||
var relatedTarget = evt.relatedTarget,
|
||
target = evt.target;
|
||
var menuEl = data.el[0];
|
||
/**
|
||
* Close menu
|
||
* With focusout events, the `relatedTarget` is the element that will next receive focus.
|
||
* @see: https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/relatedTarget
|
||
*/
|
||
|
||
var menuContainsFocus = menuEl.contains(relatedTarget) || menuEl.contains(target);
|
||
|
||
if (!menuContainsFocus) {
|
||
close(data);
|
||
}
|
||
|
||
return evt.stopPropagation();
|
||
});
|
||
} // Export module
|
||
|
||
|
||
return api;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 387 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* globals
|
||
window,
|
||
document,
|
||
FormData,
|
||
WEBFLOW_FORM_API_HOST,
|
||
WEBFLOW_FORM_OLDIE_HOST
|
||
*/
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Forms
|
||
*/
|
||
|
||
var _interopRequireDefault = __webpack_require__(1);
|
||
|
||
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(388));
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
Webflow.define('forms', module.exports = function ($, _) {
|
||
var api = {};
|
||
var $doc = $(document);
|
||
var $forms;
|
||
var loc = window.location;
|
||
var retro = window.XDomainRequest && !window.atob;
|
||
var namespace = '.w-form';
|
||
var siteId;
|
||
var emailField = /e(-)?mail/i;
|
||
var emailValue = /^\S+@\S+$/;
|
||
var alert = window.alert;
|
||
var inApp = Webflow.env();
|
||
var listening;
|
||
var formUrl;
|
||
var signFileUrl; // MailChimp domains: list-manage.com + mirrors
|
||
|
||
var chimpRegex = /list-manage[1-9]?.com/i;
|
||
|
||
var disconnected = _.debounce(function () {
|
||
alert('Oops! This page has improperly configured forms. Please contact your website administrator to fix this issue.');
|
||
}, 100);
|
||
|
||
api.ready = api.design = api.preview = function () {
|
||
// Init forms
|
||
init(); // Wire document events on published site only once
|
||
|
||
if (!inApp && !listening) {
|
||
addListeners();
|
||
}
|
||
};
|
||
|
||
function init() {
|
||
siteId = $('html').attr('data-wf-site');
|
||
formUrl = "https://webflow.com" + '/api/v1/form/' + siteId; // Work around same-protocol IE XDR limitation - without this IE9 and below forms won't submit
|
||
|
||
if (retro && formUrl.indexOf("https://webflow.com") >= 0) {
|
||
formUrl = formUrl.replace("https://webflow.com", "http://formdata.webflow.com");
|
||
}
|
||
|
||
signFileUrl = "".concat(formUrl, "/signFile");
|
||
$forms = $(namespace + ' form');
|
||
|
||
if (!$forms.length) {
|
||
return;
|
||
}
|
||
|
||
$forms.each(build);
|
||
}
|
||
|
||
function build(i, el) {
|
||
// Store form state using namespace
|
||
var $el = $(el);
|
||
var data = $.data(el, namespace);
|
||
|
||
if (!data) {
|
||
data = $.data(el, namespace, {
|
||
form: $el
|
||
});
|
||
} // data.form
|
||
|
||
|
||
reset(data);
|
||
var wrap = $el.closest('div.w-form');
|
||
data.done = wrap.find('> .w-form-done');
|
||
data.fail = wrap.find('> .w-form-fail');
|
||
data.fileUploads = wrap.find('.w-file-upload');
|
||
data.fileUploads.each(function (j) {
|
||
initFileUpload(j, data);
|
||
});
|
||
var action = data.action = $el.attr('action');
|
||
data.handler = null;
|
||
data.redirect = $el.attr('data-redirect'); // MailChimp form
|
||
|
||
if (chimpRegex.test(action)) {
|
||
data.handler = submitMailChimp;
|
||
return;
|
||
} // Custom form action
|
||
|
||
|
||
if (action) {
|
||
return;
|
||
} // Webflow forms for hosting accounts
|
||
|
||
|
||
if (siteId) {
|
||
data.handler = typeof hostedSubmitWebflow === 'function' ? hostedSubmitWebflow : exportedSubmitWebflow;
|
||
return;
|
||
} // Alert for disconnected Webflow forms
|
||
|
||
|
||
disconnected();
|
||
}
|
||
|
||
function addListeners() {
|
||
listening = true; // Handle form submission for Webflow forms
|
||
|
||
$doc.on('submit', namespace + ' form', function (evt) {
|
||
var data = $.data(this, namespace);
|
||
|
||
if (data.handler) {
|
||
data.evt = evt;
|
||
data.handler(data);
|
||
}
|
||
}); // handle checked ui for custom checkbox and radio button
|
||
|
||
var CHECKBOX_CLASS_NAME = '.w-checkbox-input';
|
||
var RADIO_INPUT_CLASS_NAME = '.w-radio-input';
|
||
var CHECKED_CLASS = 'w--redirected-checked';
|
||
var FOCUSED_CLASS = 'w--redirected-focus';
|
||
var CUSTOM_CONTROLS = [['checkbox', CHECKBOX_CLASS_NAME], ['radio', RADIO_INPUT_CLASS_NAME]];
|
||
$doc.on('change', namespace + " form input[type=\"checkbox\"]:not(" + CHECKBOX_CLASS_NAME + ')', function (evt) {
|
||
$(evt.target).siblings(CHECKBOX_CLASS_NAME).toggleClass(CHECKED_CLASS);
|
||
});
|
||
$doc.on('change', namespace + " form input[type=\"radio\"]", function (evt) {
|
||
$("input[name=\"".concat(evt.target.name, "\"]:not(").concat(CHECKBOX_CLASS_NAME, ")")).map(function (i, el) {
|
||
return $(el).siblings(RADIO_INPUT_CLASS_NAME).removeClass(CHECKED_CLASS);
|
||
});
|
||
var $target = $(evt.target);
|
||
|
||
if (!$target.hasClass('w-radio-input')) {
|
||
$target.siblings(RADIO_INPUT_CLASS_NAME).addClass(CHECKED_CLASS);
|
||
}
|
||
});
|
||
CUSTOM_CONTROLS.forEach(function (_ref) {
|
||
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
||
controlType = _ref2[0],
|
||
customControlClassName = _ref2[1];
|
||
|
||
$doc.on('focus', namespace + " form input[type=\"".concat(controlType, "\"]:not(") + customControlClassName + ')', function (evt) {
|
||
$(evt.target).siblings(customControlClassName).addClass(FOCUSED_CLASS);
|
||
});
|
||
$doc.on('blur', namespace + " form input[type=\"".concat(controlType, "\"]:not(") + customControlClassName + ')', function (evt) {
|
||
$(evt.target).siblings(customControlClassName).removeClass(FOCUSED_CLASS);
|
||
});
|
||
});
|
||
} // Reset data common to all submit handlers
|
||
|
||
|
||
function reset(data) {
|
||
var btn = data.btn = data.form.find(':input[type="submit"]');
|
||
data.wait = data.btn.attr('data-wait') || null;
|
||
data.success = false;
|
||
btn.prop('disabled', false);
|
||
data.label && btn.val(data.label);
|
||
} // Disable submit button
|
||
|
||
|
||
function disableBtn(data) {
|
||
var btn = data.btn;
|
||
var wait = data.wait;
|
||
btn.prop('disabled', true); // Show wait text and store previous label
|
||
|
||
if (wait) {
|
||
data.label = btn.val();
|
||
btn.val(wait);
|
||
}
|
||
} // Find form fields, validate, and set value pairs
|
||
|
||
|
||
function findFields(form, result) {
|
||
var status = null;
|
||
result = result || {}; // The ":input" selector is a jQuery shortcut to select all inputs, selects, textareas
|
||
|
||
form.find(':input:not([type="submit"]):not([type="file"])').each(function (i, el) {
|
||
var field = $(el);
|
||
var type = field.attr('type');
|
||
var name = field.attr('data-name') || field.attr('name') || 'Field ' + (i + 1);
|
||
var value = field.val();
|
||
|
||
if (type === 'checkbox') {
|
||
value = field.is(':checked');
|
||
} else if (type === 'radio') {
|
||
// Radio group value already processed
|
||
if (result[name] === null || typeof result[name] === 'string') {
|
||
return;
|
||
}
|
||
|
||
value = form.find('input[name="' + field.attr('name') + '"]:checked').val() || null;
|
||
}
|
||
|
||
if (typeof value === 'string') {
|
||
value = $.trim(value);
|
||
}
|
||
|
||
result[name] = value;
|
||
status = status || getStatus(field, type, name, value);
|
||
});
|
||
return status;
|
||
}
|
||
|
||
function findFileUploads(form) {
|
||
var result = {};
|
||
form.find(':input[type="file"]').each(function (i, el) {
|
||
var field = $(el);
|
||
var name = field.attr('data-name') || field.attr('name') || 'File ' + (i + 1);
|
||
var value = field.attr('data-value');
|
||
|
||
if (typeof value === 'string') {
|
||
value = $.trim(value);
|
||
}
|
||
|
||
result[name] = value;
|
||
});
|
||
return result;
|
||
}
|
||
|
||
var trackingCookieNameMap = {
|
||
_mkto_trk: 'marketo' // __hstc: 'hubspot',
|
||
|
||
};
|
||
|
||
function collectEnterpriseTrackingCookies() {
|
||
var cookies = document.cookie.split('; ').reduce(function (acc, cookie) {
|
||
var splitCookie = cookie.split('=');
|
||
var name = splitCookie[0];
|
||
|
||
if (name in trackingCookieNameMap) {
|
||
var mappedName = trackingCookieNameMap[name];
|
||
var value = splitCookie.slice(1).join('=');
|
||
acc[mappedName] = value;
|
||
}
|
||
|
||
return acc;
|
||
}, {});
|
||
return cookies;
|
||
}
|
||
|
||
function getStatus(field, type, name, value) {
|
||
var status = null;
|
||
|
||
if (type === 'password') {
|
||
status = 'Passwords cannot be submitted.';
|
||
} else if (field.attr('required')) {
|
||
if (!value) {
|
||
status = 'Please fill out the required field: ' + name;
|
||
} else if (emailField.test(field.attr('type'))) {
|
||
if (!emailValue.test(value)) {
|
||
status = 'Please enter a valid email address for: ' + name;
|
||
}
|
||
}
|
||
} else if (name === 'g-recaptcha-response' && !value) {
|
||
status = 'Please confirm you’re not a robot.';
|
||
}
|
||
|
||
return status;
|
||
}
|
||
|
||
function exportedSubmitWebflow(data) {
|
||
preventDefault(data);
|
||
afterSubmit(data);
|
||
} // Submit form to MailChimp
|
||
|
||
|
||
function submitMailChimp(data) {
|
||
reset(data);
|
||
var form = data.form;
|
||
var payload = {}; // Skip Ajax submission if http/s mismatch, fallback to POST instead
|
||
|
||
if (/^https/.test(loc.href) && !/^https/.test(data.action)) {
|
||
form.attr('method', 'post');
|
||
return;
|
||
}
|
||
|
||
preventDefault(data); // Find & populate all fields
|
||
|
||
var status = findFields(form, payload);
|
||
|
||
if (status) {
|
||
return alert(status);
|
||
} // Disable submit button
|
||
|
||
|
||
disableBtn(data); // Use special format for MailChimp params
|
||
|
||
var fullName;
|
||
|
||
_.each(payload, function (value, key) {
|
||
if (emailField.test(key)) {
|
||
payload.EMAIL = value;
|
||
}
|
||
|
||
if (/^((full[ _-]?)?name)$/i.test(key)) {
|
||
fullName = value;
|
||
}
|
||
|
||
if (/^(first[ _-]?name)$/i.test(key)) {
|
||
payload.FNAME = value;
|
||
}
|
||
|
||
if (/^(last[ _-]?name)$/i.test(key)) {
|
||
payload.LNAME = value;
|
||
}
|
||
});
|
||
|
||
if (fullName && !payload.FNAME) {
|
||
fullName = fullName.split(' ');
|
||
payload.FNAME = fullName[0];
|
||
payload.LNAME = payload.LNAME || fullName[1];
|
||
} // Use the (undocumented) MailChimp jsonp api
|
||
|
||
|
||
var url = data.action.replace('/post?', '/post-json?') + '&c=?'; // Add special param to prevent bot signups
|
||
|
||
var userId = url.indexOf('u=') + 2;
|
||
userId = url.substring(userId, url.indexOf('&', userId));
|
||
var listId = url.indexOf('id=') + 3;
|
||
listId = url.substring(listId, url.indexOf('&', listId));
|
||
payload['b_' + userId + '_' + listId] = '';
|
||
$.ajax({
|
||
url: url,
|
||
data: payload,
|
||
dataType: 'jsonp'
|
||
}).done(function (resp) {
|
||
data.success = resp.result === 'success' || /already/.test(resp.msg);
|
||
|
||
if (!data.success) {
|
||
console.info('MailChimp error: ' + resp.msg);
|
||
}
|
||
|
||
afterSubmit(data);
|
||
}).fail(function () {
|
||
afterSubmit(data);
|
||
});
|
||
} // Common callback which runs after all Ajax submissions
|
||
|
||
|
||
function afterSubmit(data) {
|
||
var form = data.form;
|
||
var redirect = data.redirect;
|
||
var success = data.success; // Redirect to a success url if defined
|
||
|
||
if (success && redirect) {
|
||
Webflow.location(redirect);
|
||
return;
|
||
} // Show or hide status divs
|
||
|
||
|
||
data.done.toggle(success);
|
||
data.fail.toggle(!success); // Hide form on success
|
||
|
||
form.toggle(!success); // Reset data and enable submit button
|
||
|
||
reset(data);
|
||
}
|
||
|
||
function preventDefault(data) {
|
||
data.evt && data.evt.preventDefault();
|
||
data.evt = null;
|
||
}
|
||
|
||
function initFileUpload(i, form) {
|
||
if (!form.fileUploads || !form.fileUploads[i]) {
|
||
return;
|
||
}
|
||
|
||
var file;
|
||
var $el = $(form.fileUploads[i]);
|
||
var $defaultWrap = $el.find('> .w-file-upload-default');
|
||
var $uploadingWrap = $el.find('> .w-file-upload-uploading');
|
||
var $successWrap = $el.find('> .w-file-upload-success');
|
||
var $errorWrap = $el.find('> .w-file-upload-error');
|
||
var $input = $defaultWrap.find('.w-file-upload-input');
|
||
var $label = $defaultWrap.find('.w-file-upload-label');
|
||
var $labelChildren = $label.children();
|
||
var $errorMsgEl = $errorWrap.find('.w-file-upload-error-msg');
|
||
var $fileEl = $successWrap.find('.w-file-upload-file');
|
||
var $removeEl = $successWrap.find('.w-file-remove-link');
|
||
var $fileNameEl = $fileEl.find('.w-file-upload-file-name');
|
||
var sizeErrMsg = $errorMsgEl.attr('data-w-size-error');
|
||
var typeErrMsg = $errorMsgEl.attr('data-w-type-error');
|
||
var genericErrMsg = $errorMsgEl.attr('data-w-generic-error');
|
||
|
||
if (!inApp) {
|
||
$removeEl.on('click', function () {
|
||
$input.removeAttr('data-value');
|
||
$input.val('');
|
||
$fileNameEl.html('');
|
||
$defaultWrap.toggle(true);
|
||
$successWrap.toggle(false);
|
||
});
|
||
$input.on('change', function (e) {
|
||
file = e.target && e.target.files && e.target.files[0];
|
||
|
||
if (!file) {
|
||
return;
|
||
} // Show uploading
|
||
|
||
|
||
$defaultWrap.toggle(false);
|
||
$errorWrap.toggle(false);
|
||
$uploadingWrap.toggle(true); // Set filename
|
||
|
||
$fileNameEl.text(file.name); // Disable submit button
|
||
|
||
if (!isUploading()) {
|
||
disableBtn(form);
|
||
}
|
||
|
||
form.fileUploads[i].uploading = true;
|
||
signFile(file, afterSign);
|
||
}); // Setting input width 1px and height equal label
|
||
// This is so the browser required error will show up
|
||
|
||
var height = $label.outerHeight();
|
||
$input.height(height);
|
||
$input.width(1);
|
||
} else {
|
||
$input.on('click', function (e) {
|
||
e.preventDefault();
|
||
});
|
||
$label.on('click', function (e) {
|
||
e.preventDefault();
|
||
});
|
||
$labelChildren.on('click', function (e) {
|
||
e.preventDefault();
|
||
});
|
||
}
|
||
|
||
function parseError(err) {
|
||
var errorMsg = err.responseJSON && err.responseJSON.msg;
|
||
var userError = genericErrMsg;
|
||
|
||
if (typeof errorMsg === 'string' && errorMsg.indexOf('InvalidFileTypeError') === 0) {
|
||
userError = typeErrMsg;
|
||
} else if (typeof errorMsg === 'string' && errorMsg.indexOf('MaxFileSizeError') === 0) {
|
||
userError = sizeErrMsg;
|
||
}
|
||
|
||
$errorMsgEl.text(userError);
|
||
$input.removeAttr('data-value');
|
||
$input.val('');
|
||
$uploadingWrap.toggle(false);
|
||
$defaultWrap.toggle(true);
|
||
$errorWrap.toggle(true);
|
||
form.fileUploads[i].uploading = false;
|
||
|
||
if (!isUploading()) {
|
||
reset(form);
|
||
}
|
||
}
|
||
|
||
function afterSign(err, data) {
|
||
if (err) {
|
||
return parseError(err);
|
||
}
|
||
|
||
var fileName = data.fileName;
|
||
var postData = data.postData;
|
||
var fileId = data.fileId;
|
||
var s3Url = data.s3Url;
|
||
$input.attr('data-value', fileId);
|
||
uploadS3(s3Url, postData, file, fileName, afterUpload);
|
||
}
|
||
|
||
function afterUpload(err) {
|
||
if (err) {
|
||
return parseError(err);
|
||
} // Show success
|
||
|
||
|
||
$uploadingWrap.toggle(false);
|
||
$successWrap.css('display', 'inline-block');
|
||
form.fileUploads[i].uploading = false;
|
||
|
||
if (!isUploading()) {
|
||
reset(form);
|
||
}
|
||
}
|
||
|
||
function isUploading() {
|
||
var uploads = form.fileUploads && form.fileUploads.toArray() || [];
|
||
return uploads.some(function (value) {
|
||
return value.uploading;
|
||
});
|
||
}
|
||
}
|
||
|
||
function signFile(file, cb) {
|
||
var payload = {
|
||
name: file.name,
|
||
size: file.size
|
||
};
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: signFileUrl,
|
||
data: payload,
|
||
dataType: 'json',
|
||
crossDomain: true
|
||
}).done(function (data) {
|
||
cb(null, data);
|
||
}).fail(function (err) {
|
||
cb(err);
|
||
});
|
||
}
|
||
|
||
function uploadS3(url, data, file, fileName, cb) {
|
||
var formData = new FormData();
|
||
|
||
for (var k in data) {
|
||
formData.append(k, data[k]);
|
||
}
|
||
|
||
formData.append('file', file, fileName);
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: url,
|
||
data: formData,
|
||
processData: false,
|
||
contentType: false
|
||
}).done(function () {
|
||
cb(null);
|
||
}).fail(function (err) {
|
||
cb(err);
|
||
});
|
||
} // Export module
|
||
|
||
|
||
return api;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 388 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var arrayWithHoles = __webpack_require__(389);
|
||
|
||
var iterableToArrayLimit = __webpack_require__(390);
|
||
|
||
var nonIterableRest = __webpack_require__(391);
|
||
|
||
function _slicedToArray(arr, i) {
|
||
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
|
||
}
|
||
|
||
module.exports = _slicedToArray;
|
||
|
||
/***/ }),
|
||
/* 389 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _arrayWithHoles(arr) {
|
||
if (Array.isArray(arr)) return arr;
|
||
}
|
||
|
||
module.exports = _arrayWithHoles;
|
||
|
||
/***/ }),
|
||
/* 390 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _iterableToArrayLimit(arr, i) {
|
||
var _arr = [];
|
||
var _n = true;
|
||
var _d = false;
|
||
var _e = undefined;
|
||
|
||
try {
|
||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
||
_arr.push(_s.value);
|
||
|
||
if (i && _arr.length === i) break;
|
||
}
|
||
} catch (err) {
|
||
_d = true;
|
||
_e = err;
|
||
} finally {
|
||
try {
|
||
if (!_n && _i["return"] != null) _i["return"]();
|
||
} finally {
|
||
if (_d) throw _e;
|
||
}
|
||
}
|
||
|
||
return _arr;
|
||
}
|
||
|
||
module.exports = _iterableToArrayLimit;
|
||
|
||
/***/ }),
|
||
/* 391 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function _nonIterableRest() {
|
||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||
}
|
||
|
||
module.exports = _nonIterableRest;
|
||
|
||
/***/ }),
|
||
/* 392 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* global window, document */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Slider component
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
var IXEvents = __webpack_require__(56);
|
||
|
||
var KEY_CODES = {
|
||
ARROW_LEFT: 37,
|
||
ARROW_UP: 38,
|
||
ARROW_RIGHT: 39,
|
||
ARROW_DOWN: 40,
|
||
SPACE: 32,
|
||
ENTER: 13,
|
||
HOME: 36,
|
||
END: 35
|
||
};
|
||
var FOCUSABLE_SELECTOR = 'a[href], area[href], [role="button"], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]';
|
||
Webflow.define('slider', module.exports = function ($, _) {
|
||
var api = {};
|
||
var tram = $.tram;
|
||
var $doc = $(document);
|
||
var $sliders;
|
||
var designer;
|
||
var inApp = Webflow.env();
|
||
var namespace = '.w-slider';
|
||
var dot = '<div class="w-slider-dot" data-wf-ignore />';
|
||
var ariaLiveLabelHtml = '<div aria-live="off" aria-atomic="true" class="w-slider-aria-label" data-wf-ignore />';
|
||
var forceShow = 'w-slider-force-show';
|
||
var ix = IXEvents.triggers;
|
||
var fallback;
|
||
var inRedraw; // -----------------------------------
|
||
// Module methods
|
||
|
||
api.ready = function () {
|
||
designer = Webflow.env('design');
|
||
init();
|
||
};
|
||
|
||
api.design = function () {
|
||
designer = true;
|
||
init();
|
||
};
|
||
|
||
api.preview = function () {
|
||
designer = false;
|
||
init();
|
||
};
|
||
|
||
api.redraw = function () {
|
||
inRedraw = true;
|
||
init();
|
||
};
|
||
|
||
api.destroy = removeListeners; // -----------------------------------
|
||
// Private methods
|
||
|
||
function init() {
|
||
// Find all sliders on the page
|
||
$sliders = $doc.find(namespace);
|
||
|
||
if (!$sliders.length) {
|
||
return;
|
||
}
|
||
|
||
$sliders.each(build);
|
||
inRedraw = null;
|
||
|
||
if (fallback) {
|
||
return;
|
||
}
|
||
|
||
removeListeners();
|
||
addListeners();
|
||
}
|
||
|
||
function removeListeners() {
|
||
Webflow.resize.off(renderAll);
|
||
Webflow.redraw.off(api.redraw);
|
||
}
|
||
|
||
function addListeners() {
|
||
Webflow.resize.on(renderAll);
|
||
Webflow.redraw.on(api.redraw);
|
||
}
|
||
|
||
function renderAll() {
|
||
$sliders.filter(':visible').each(render);
|
||
}
|
||
|
||
function build(i, el) {
|
||
var $el = $(el); // Store slider state in data
|
||
|
||
var data = $.data(el, namespace);
|
||
|
||
if (!data) {
|
||
data = $.data(el, namespace, {
|
||
index: 0,
|
||
depth: 1,
|
||
hasFocus: {
|
||
keyboard: false,
|
||
mouse: false
|
||
},
|
||
el: $el,
|
||
config: {}
|
||
});
|
||
}
|
||
|
||
data.mask = $el.children('.w-slider-mask');
|
||
data.left = $el.children('.w-slider-arrow-left');
|
||
data.right = $el.children('.w-slider-arrow-right');
|
||
data.nav = $el.children('.w-slider-nav');
|
||
data.slides = data.mask.children('.w-slide');
|
||
data.slides.each(ix.reset);
|
||
|
||
if (inRedraw) {
|
||
data.maskWidth = 0;
|
||
}
|
||
|
||
if ($el.attr('role') === undefined) {
|
||
$el.attr('role', 'region');
|
||
}
|
||
|
||
if ($el.attr('aria-label') === undefined) {
|
||
$el.attr('aria-label', 'carousel');
|
||
} // Store the ID of the slider slide view mask
|
||
|
||
|
||
var slideViewId = data.mask.attr('id'); // If user did not provide an ID, set it
|
||
|
||
if (!slideViewId) {
|
||
slideViewId = 'w-slider-mask-' + i;
|
||
data.mask.attr('id', slideViewId);
|
||
} // Create aria live label
|
||
|
||
|
||
if (!designer) {
|
||
data.ariaLiveLabel = $(ariaLiveLabelHtml).appendTo(data.mask);
|
||
} // Add attributes to left/right buttons
|
||
|
||
|
||
data.left.attr('role', 'button');
|
||
data.left.attr('tabindex', '0');
|
||
data.left.attr('aria-controls', slideViewId);
|
||
|
||
if (data.left.attr('aria-label') === undefined) {
|
||
data.left.attr('aria-label', 'previous slide');
|
||
}
|
||
|
||
data.right.attr('role', 'button');
|
||
data.right.attr('tabindex', '0');
|
||
data.right.attr('aria-controls', slideViewId);
|
||
|
||
if (data.right.attr('aria-label') === undefined) {
|
||
data.right.attr('aria-label', 'next slide');
|
||
} // Disable in old browsers
|
||
|
||
|
||
if (!tram.support.transform) {
|
||
data.left.hide();
|
||
data.right.hide();
|
||
data.nav.hide();
|
||
fallback = true;
|
||
return;
|
||
} // Remove old events
|
||
|
||
|
||
data.el.off(namespace);
|
||
data.left.off(namespace);
|
||
data.right.off(namespace);
|
||
data.nav.off(namespace); // Set config from data attributes
|
||
|
||
configure(data); // Add events based on mode
|
||
|
||
if (designer) {
|
||
data.el.on('setting' + namespace, handler(data));
|
||
stopTimer(data);
|
||
data.hasTimer = false;
|
||
} else {
|
||
data.el.on('swipe' + namespace, handler(data));
|
||
data.left.on('click' + namespace, previousFunction(data));
|
||
data.right.on('click' + namespace, next(data));
|
||
data.left.on('keydown' + namespace, keyboardSlideButtonsFunction(data, previousFunction));
|
||
data.right.on('keydown' + namespace, keyboardSlideButtonsFunction(data, next)); // Listen to nav keyboard events
|
||
|
||
data.nav.on('keydown' + namespace, '> div', handler(data)); // Start timer if autoplay is true, only once
|
||
|
||
if (data.config.autoplay && !data.hasTimer) {
|
||
data.hasTimer = true;
|
||
data.timerCount = 1;
|
||
startTimer(data);
|
||
}
|
||
|
||
data.el.on('mouseenter' + namespace, hasFocus(data, true, 'mouse'));
|
||
data.el.on('focusin' + namespace, hasFocus(data, true, 'keyboard'));
|
||
data.el.on('mouseleave' + namespace, hasFocus(data, false, 'mouse'));
|
||
data.el.on('focusout' + namespace, hasFocus(data, false, 'keyboard'));
|
||
} // Listen to nav click events
|
||
|
||
|
||
data.nav.on('click' + namespace, '> div', handler(data)); // Remove gaps from formatted html (for inline-blocks)
|
||
|
||
if (!inApp) {
|
||
data.mask.contents().filter(function () {
|
||
return this.nodeType === 3;
|
||
}).remove();
|
||
} // If slider or any parent is hidden, temporarily show for measurements (https://github.com/webflow/webflow/issues/24921)
|
||
|
||
|
||
var $elHidden = $el.filter(':hidden');
|
||
$elHidden.addClass(forceShow);
|
||
var $elHiddenParents = $el.parents(':hidden');
|
||
$elHiddenParents.addClass(forceShow); // Run first render
|
||
|
||
render(i, el); // If slider or any parent is hidden, reset after temporarily showing for measurements
|
||
|
||
$elHidden.removeClass(forceShow);
|
||
$elHiddenParents.removeClass(forceShow);
|
||
}
|
||
|
||
function configure(data) {
|
||
var config = {};
|
||
config.crossOver = 0; // Set config options from data attributes
|
||
|
||
config.animation = data.el.attr('data-animation') || 'slide';
|
||
|
||
if (config.animation === 'outin') {
|
||
config.animation = 'cross';
|
||
config.crossOver = 0.5;
|
||
}
|
||
|
||
config.easing = data.el.attr('data-easing') || 'ease';
|
||
var duration = data.el.attr('data-duration');
|
||
config.duration = duration != null ? parseInt(duration, 10) : 500;
|
||
|
||
if (isAttrTrue(data.el.attr('data-infinite'))) {
|
||
config.infinite = true;
|
||
}
|
||
|
||
if (isAttrTrue(data.el.attr('data-disable-swipe'))) {
|
||
config.disableSwipe = true;
|
||
}
|
||
|
||
if (isAttrTrue(data.el.attr('data-hide-arrows'))) {
|
||
config.hideArrows = true;
|
||
} else if (data.config.hideArrows) {
|
||
data.left.show();
|
||
data.right.show();
|
||
}
|
||
|
||
if (isAttrTrue(data.el.attr('data-autoplay'))) {
|
||
config.autoplay = true;
|
||
config.delay = parseInt(data.el.attr('data-delay'), 10) || 2000;
|
||
config.timerMax = parseInt(data.el.attr('data-autoplay-limit'), 10); // Disable timer on first touch or mouse down
|
||
|
||
var touchEvents = 'mousedown' + namespace + ' touchstart' + namespace;
|
||
|
||
if (!designer) {
|
||
data.el.off(touchEvents).one(touchEvents, function () {
|
||
stopTimer(data);
|
||
});
|
||
}
|
||
} // Use edge buffer to help calculate page count
|
||
|
||
|
||
var arrowWidth = data.right.width();
|
||
config.edge = arrowWidth ? arrowWidth + 40 : 100; // Store config in data
|
||
|
||
data.config = config;
|
||
}
|
||
|
||
function isAttrTrue(value) {
|
||
return value === '1' || value === 'true';
|
||
}
|
||
|
||
function hasFocus(data, focusIn, eventType) {
|
||
return function (evt) {
|
||
if (!focusIn) {
|
||
// Prevent Focus Out if moving to another element in the slider
|
||
if ($.contains(data.el.get(0), evt.relatedTarget)) {
|
||
return;
|
||
}
|
||
|
||
data.hasFocus[eventType] = focusIn; // Prevent Aria live change if focused by other input
|
||
|
||
if (data.hasFocus.mouse && eventType === 'keyboard' || data.hasFocus.keyboard && eventType === 'mouse') {
|
||
return;
|
||
}
|
||
} else {
|
||
data.hasFocus[eventType] = focusIn;
|
||
}
|
||
|
||
if (focusIn) {
|
||
data.ariaLiveLabel.attr('aria-live', 'polite');
|
||
|
||
if (data.hasTimer) {
|
||
stopTimer(data);
|
||
}
|
||
} else {
|
||
data.ariaLiveLabel.attr('aria-live', 'off');
|
||
|
||
if (data.hasTimer) {
|
||
startTimer(data);
|
||
}
|
||
}
|
||
|
||
return;
|
||
};
|
||
}
|
||
|
||
function keyboardSlideButtonsFunction(data, directionFunction) {
|
||
return function (evt) {
|
||
switch (evt.keyCode) {
|
||
case KEY_CODES.SPACE:
|
||
case KEY_CODES.ENTER:
|
||
{
|
||
// DirectionFunction returns a function
|
||
directionFunction(data)();
|
||
evt.preventDefault();
|
||
return evt.stopPropagation();
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
function previousFunction(data) {
|
||
return function () {
|
||
change(data, {
|
||
index: data.index - 1,
|
||
vector: -1
|
||
});
|
||
};
|
||
}
|
||
|
||
function next(data) {
|
||
return function () {
|
||
change(data, {
|
||
index: data.index + 1,
|
||
vector: 1
|
||
});
|
||
};
|
||
}
|
||
|
||
function select(data, value) {
|
||
// Select page based on slide element index
|
||
var found = null;
|
||
|
||
if (value === data.slides.length) {
|
||
init();
|
||
layout(data); // Rebuild and find new slides
|
||
}
|
||
|
||
_.each(data.anchors, function (anchor, index) {
|
||
$(anchor.els).each(function (i, el) {
|
||
if ($(el).index() === value) {
|
||
found = index;
|
||
}
|
||
});
|
||
});
|
||
|
||
if (found != null) {
|
||
change(data, {
|
||
index: found,
|
||
immediate: true
|
||
});
|
||
}
|
||
}
|
||
|
||
function startTimer(data) {
|
||
stopTimer(data);
|
||
var config = data.config;
|
||
var timerMax = config.timerMax;
|
||
|
||
if (timerMax && data.timerCount++ > timerMax) {
|
||
return;
|
||
}
|
||
|
||
data.timerId = window.setTimeout(function () {
|
||
if (data.timerId == null || designer) {
|
||
return;
|
||
}
|
||
|
||
next(data)();
|
||
startTimer(data);
|
||
}, config.delay);
|
||
}
|
||
|
||
function stopTimer(data) {
|
||
window.clearTimeout(data.timerId);
|
||
data.timerId = null;
|
||
}
|
||
|
||
function handler(data) {
|
||
return function (evt, options) {
|
||
options = options || {};
|
||
var config = data.config; // Designer settings
|
||
|
||
if (designer && evt.type === 'setting') {
|
||
if (options.select === 'prev') {
|
||
return previousFunction(data)();
|
||
}
|
||
|
||
if (options.select === 'next') {
|
||
return next(data)();
|
||
}
|
||
|
||
configure(data);
|
||
layout(data);
|
||
|
||
if (options.select == null) {
|
||
return;
|
||
}
|
||
|
||
select(data, options.select);
|
||
return;
|
||
} // Swipe event
|
||
|
||
|
||
if (evt.type === 'swipe') {
|
||
if (config.disableSwipe) {
|
||
return;
|
||
}
|
||
|
||
if (Webflow.env('editor')) {
|
||
return;
|
||
}
|
||
|
||
if (options.direction === 'left') {
|
||
return next(data)();
|
||
}
|
||
|
||
if (options.direction === 'right') {
|
||
return previousFunction(data)();
|
||
}
|
||
|
||
return;
|
||
} // Page buttons
|
||
|
||
|
||
if (data.nav.has(evt.target).length) {
|
||
var index = $(evt.target).index();
|
||
|
||
if (evt.type === 'click') {
|
||
change(data, {
|
||
index: index
|
||
});
|
||
}
|
||
|
||
if (evt.type === 'keydown') {
|
||
switch (evt.keyCode) {
|
||
case KEY_CODES.ENTER:
|
||
case KEY_CODES.SPACE:
|
||
{
|
||
change(data, {
|
||
index: index
|
||
});
|
||
evt.preventDefault();
|
||
break;
|
||
}
|
||
|
||
case KEY_CODES.ARROW_LEFT:
|
||
case KEY_CODES.ARROW_UP:
|
||
{
|
||
focusDot(data.nav, Math.max(index - 1, 0));
|
||
evt.preventDefault();
|
||
break;
|
||
}
|
||
|
||
case KEY_CODES.ARROW_RIGHT:
|
||
case KEY_CODES.ARROW_DOWN:
|
||
{
|
||
focusDot(data.nav, Math.min(index + 1, data.pages));
|
||
evt.preventDefault();
|
||
break;
|
||
}
|
||
|
||
case KEY_CODES.HOME:
|
||
{
|
||
focusDot(data.nav, 0);
|
||
evt.preventDefault();
|
||
break;
|
||
}
|
||
|
||
case KEY_CODES.END:
|
||
{
|
||
focusDot(data.nav, data.pages);
|
||
evt.preventDefault();
|
||
break;
|
||
}
|
||
|
||
default:
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
function focusDot($nav, index) {
|
||
// Focus nav dot; don't change class to active
|
||
var $active = $nav.children().eq(index).focus();
|
||
$nav.children().not($active);
|
||
}
|
||
|
||
function change(data, options) {
|
||
options = options || {};
|
||
var config = data.config;
|
||
var anchors = data.anchors; // Set new index
|
||
|
||
data.previous = data.index;
|
||
var index = options.index;
|
||
var shift = {};
|
||
|
||
if (index < 0) {
|
||
index = anchors.length - 1;
|
||
|
||
if (config.infinite) {
|
||
// Shift first slide to the end
|
||
shift.x = -data.endX;
|
||
shift.from = 0;
|
||
shift.to = anchors[0].width;
|
||
}
|
||
} else if (index >= anchors.length) {
|
||
index = 0;
|
||
|
||
if (config.infinite) {
|
||
// Shift last slide to the start
|
||
shift.x = anchors[anchors.length - 1].width;
|
||
shift.from = -anchors[anchors.length - 1].x;
|
||
shift.to = shift.from - shift.x;
|
||
}
|
||
}
|
||
|
||
data.index = index; // Select nav dot; set class active
|
||
|
||
var $active = data.nav.children().eq(index).addClass('w-active').attr('aria-pressed', 'true').attr('tabindex', '0');
|
||
data.nav.children().not($active).removeClass('w-active').attr('aria-pressed', 'false').attr('tabindex', '-1'); // Hide arrows
|
||
|
||
if (config.hideArrows) {
|
||
data.index === anchors.length - 1 ? data.right.hide() : data.right.show();
|
||
data.index === 0 ? data.left.hide() : data.left.show();
|
||
} // Get page offset from anchors
|
||
|
||
|
||
var lastOffsetX = data.offsetX || 0;
|
||
var offsetX = data.offsetX = -anchors[data.index].x;
|
||
var resetConfig = {
|
||
x: offsetX,
|
||
opacity: 1,
|
||
visibility: ''
|
||
}; // Transition slides
|
||
|
||
var targets = $(anchors[data.index].els);
|
||
var prevTargs = $(anchors[data.previous] && anchors[data.previous].els);
|
||
var others = data.slides.not(targets);
|
||
var animation = config.animation;
|
||
var easing = config.easing;
|
||
var duration = Math.round(config.duration);
|
||
var vector = options.vector || (data.index > data.previous ? 1 : -1);
|
||
var fadeRule = 'opacity ' + duration + 'ms ' + easing;
|
||
var slideRule = 'transform ' + duration + 'ms ' + easing; // Make active slides' content focusable
|
||
|
||
targets.find(FOCUSABLE_SELECTOR).removeAttr('tabindex');
|
||
targets.removeAttr('aria-hidden'); // Voiceover bug: Sometimes descendants are still visible, so hide everything...
|
||
|
||
targets.find('*').removeAttr('aria-hidden'); // Prevent focus on inactive slides' content
|
||
|
||
others.find(FOCUSABLE_SELECTOR).attr('tabindex', '-1');
|
||
others.attr('aria-hidden', 'true'); // Voiceover bug: Sometimes descendants are still visible, so hide everything...
|
||
|
||
others.find('*').attr('aria-hidden', 'true'); // Trigger IX events
|
||
|
||
if (!designer) {
|
||
targets.each(ix.intro);
|
||
others.each(ix.outro);
|
||
} // Set immediately after layout changes (but not during redraw)
|
||
|
||
|
||
if (options.immediate && !inRedraw) {
|
||
tram(targets).set(resetConfig);
|
||
resetOthers();
|
||
return;
|
||
} // Exit early if index is unchanged
|
||
|
||
|
||
if (data.index === data.previous) {
|
||
return;
|
||
} // Announce slide change to screen reader
|
||
|
||
|
||
if (!designer) {
|
||
data.ariaLiveLabel.text("Slide ".concat(index + 1, " of ").concat(anchors.length, "."));
|
||
} // Cross Fade / Out-In
|
||
|
||
|
||
if (animation === 'cross') {
|
||
var reduced = Math.round(duration - duration * config.crossOver);
|
||
var wait = Math.round(duration - reduced);
|
||
fadeRule = 'opacity ' + reduced + 'ms ' + easing;
|
||
tram(prevTargs).set({
|
||
visibility: ''
|
||
}).add(fadeRule).start({
|
||
opacity: 0
|
||
});
|
||
tram(targets).set({
|
||
visibility: '',
|
||
x: offsetX,
|
||
opacity: 0,
|
||
zIndex: data.depth++
|
||
}).add(fadeRule).wait(wait).then({
|
||
opacity: 1
|
||
}).then(resetOthers);
|
||
return;
|
||
} // Fade Over
|
||
|
||
|
||
if (animation === 'fade') {
|
||
tram(prevTargs).set({
|
||
visibility: ''
|
||
}).stop();
|
||
tram(targets).set({
|
||
visibility: '',
|
||
x: offsetX,
|
||
opacity: 0,
|
||
zIndex: data.depth++
|
||
}).add(fadeRule).start({
|
||
opacity: 1
|
||
}).then(resetOthers);
|
||
return;
|
||
} // Slide Over
|
||
|
||
|
||
if (animation === 'over') {
|
||
resetConfig = {
|
||
x: data.endX
|
||
};
|
||
tram(prevTargs).set({
|
||
visibility: ''
|
||
}).stop();
|
||
tram(targets).set({
|
||
visibility: '',
|
||
zIndex: data.depth++,
|
||
x: offsetX + anchors[data.index].width * vector
|
||
}).add(slideRule).start({
|
||
x: offsetX
|
||
}).then(resetOthers);
|
||
return;
|
||
} // Slide - infinite scroll
|
||
|
||
|
||
if (config.infinite && shift.x) {
|
||
tram(data.slides.not(prevTargs)).set({
|
||
visibility: '',
|
||
x: shift.x
|
||
}).add(slideRule).start({
|
||
x: offsetX
|
||
});
|
||
tram(prevTargs).set({
|
||
visibility: '',
|
||
x: shift.from
|
||
}).add(slideRule).start({
|
||
x: shift.to
|
||
});
|
||
data.shifted = prevTargs;
|
||
} else {
|
||
if (config.infinite && data.shifted) {
|
||
tram(data.shifted).set({
|
||
visibility: '',
|
||
x: lastOffsetX
|
||
});
|
||
data.shifted = null;
|
||
} // Slide - basic scroll
|
||
|
||
|
||
tram(data.slides).set({
|
||
visibility: ''
|
||
}).add(slideRule).start({
|
||
x: offsetX
|
||
});
|
||
} // Helper to move others out of view
|
||
|
||
|
||
function resetOthers() {
|
||
targets = $(anchors[data.index].els);
|
||
others = data.slides.not(targets);
|
||
|
||
if (animation !== 'slide') {
|
||
resetConfig.visibility = 'hidden';
|
||
}
|
||
|
||
tram(others).set(resetConfig);
|
||
}
|
||
}
|
||
|
||
function render(i, el) {
|
||
var data = $.data(el, namespace);
|
||
|
||
if (!data) {
|
||
return;
|
||
}
|
||
|
||
if (maskChanged(data)) {
|
||
return layout(data);
|
||
}
|
||
|
||
if (designer && slidesChanged(data)) {
|
||
layout(data);
|
||
}
|
||
}
|
||
|
||
function layout(data) {
|
||
// Determine page count from width of slides
|
||
var pages = 1;
|
||
var offset = 0;
|
||
var anchor = 0;
|
||
var width = 0;
|
||
var maskWidth = data.maskWidth;
|
||
var threshold = maskWidth - data.config.edge;
|
||
|
||
if (threshold < 0) {
|
||
threshold = 0;
|
||
}
|
||
|
||
data.anchors = [{
|
||
els: [],
|
||
x: 0,
|
||
width: 0
|
||
}];
|
||
data.slides.each(function (i, el) {
|
||
if (anchor - offset > threshold) {
|
||
pages++;
|
||
offset += maskWidth; // Store page anchor for transition
|
||
|
||
data.anchors[pages - 1] = {
|
||
els: [],
|
||
x: anchor,
|
||
width: 0
|
||
};
|
||
} // Set next anchor using current width + margin
|
||
|
||
|
||
width = $(el).outerWidth(true);
|
||
anchor += width;
|
||
data.anchors[pages - 1].width += width;
|
||
data.anchors[pages - 1].els.push(el);
|
||
var ariaLabel = i + 1 + ' of ' + data.slides.length;
|
||
$(el).attr('aria-label', ariaLabel);
|
||
$(el).attr('role', 'group');
|
||
});
|
||
data.endX = anchor; // Build dots if nav exists and needs updating
|
||
|
||
if (designer) {
|
||
data.pages = null;
|
||
}
|
||
|
||
if (data.nav.length && data.pages !== pages) {
|
||
data.pages = pages;
|
||
buildNav(data);
|
||
} // Make sure index is still within range and call change handler
|
||
|
||
|
||
var index = data.index;
|
||
|
||
if (index >= pages) {
|
||
index = pages - 1;
|
||
}
|
||
|
||
change(data, {
|
||
immediate: true,
|
||
index: index
|
||
});
|
||
}
|
||
|
||
function buildNav(data) {
|
||
var dots = [];
|
||
var $dot;
|
||
var spacing = data.el.attr('data-nav-spacing');
|
||
|
||
if (spacing) {
|
||
spacing = parseFloat(spacing) + 'px';
|
||
}
|
||
|
||
for (var i = 0, len = data.pages; i < len; i++) {
|
||
$dot = $(dot);
|
||
$dot.attr('aria-label', 'Show slide ' + (i + 1) + ' of ' + len).attr('aria-pressed', 'false').attr('role', 'button').attr('tabindex', '-1');
|
||
|
||
if (data.nav.hasClass('w-num')) {
|
||
$dot.text(i + 1);
|
||
}
|
||
|
||
if (spacing != null) {
|
||
$dot.css({
|
||
'margin-left': spacing,
|
||
'margin-right': spacing
|
||
});
|
||
}
|
||
|
||
dots.push($dot);
|
||
}
|
||
|
||
data.nav.empty().append(dots);
|
||
}
|
||
|
||
function maskChanged(data) {
|
||
var maskWidth = data.mask.width();
|
||
|
||
if (data.maskWidth !== maskWidth) {
|
||
data.maskWidth = maskWidth;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
function slidesChanged(data) {
|
||
var slidesWidth = 0;
|
||
data.slides.each(function (i, el) {
|
||
slidesWidth += $(el).outerWidth(true);
|
||
});
|
||
|
||
if (data.slidesWidth !== slidesWidth) {
|
||
data.slidesWidth = slidesWidth;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
} // Export module
|
||
|
||
|
||
return api;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 393 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// @wf-will-never-add-flow-to-this-file
|
||
|
||
/* global document window */
|
||
|
||
/* eslint-disable no-var */
|
||
|
||
/**
|
||
* Webflow: Tabs component
|
||
*/
|
||
|
||
var Webflow = __webpack_require__(9);
|
||
|
||
var IXEvents = __webpack_require__(56);
|
||
|
||
Webflow.define('tabs', module.exports = function ($) {
|
||
var api = {};
|
||
var tram = $.tram;
|
||
var $doc = $(document);
|
||
var $tabs;
|
||
var design;
|
||
var env = Webflow.env;
|
||
var safari = env.safari;
|
||
var inApp = env();
|
||
var tabAttr = 'data-w-tab';
|
||
var paneAttr = 'data-w-pane';
|
||
var namespace = '.w-tabs';
|
||
var linkCurrent = 'w--current';
|
||
var tabActive = 'w--tab-active';
|
||
var ix = IXEvents.triggers;
|
||
var inRedraw = false; // -----------------------------------
|
||
// Module methods
|
||
|
||
api.ready = api.design = api.preview = init;
|
||
|
||
api.redraw = function () {
|
||
inRedraw = true;
|
||
init();
|
||
inRedraw = false;
|
||
};
|
||
|
||
api.destroy = function () {
|
||
$tabs = $doc.find(namespace);
|
||
|
||
if (!$tabs.length) {
|
||
return;
|
||
}
|
||
|
||
$tabs.each(resetIX);
|
||
removeListeners();
|
||
}; // -----------------------------------
|
||
// Private methods
|
||
|
||
|
||
function init() {
|
||
design = inApp && Webflow.env('design'); // Find all instances on the page
|
||
|
||
$tabs = $doc.find(namespace);
|
||
|
||
if (!$tabs.length) {
|
||
return;
|
||
}
|
||
|
||
$tabs.each(build);
|
||
|
||
if (Webflow.env('preview') && !inRedraw) {
|
||
$tabs.each(resetIX);
|
||
}
|
||
|
||
removeListeners();
|
||
addListeners();
|
||
}
|
||
|
||
function removeListeners() {
|
||
Webflow.redraw.off(api.redraw);
|
||
}
|
||
|
||
function addListeners() {
|
||
Webflow.redraw.on(api.redraw);
|
||
}
|
||
|
||
function resetIX(i, el) {
|
||
var data = $.data(el, namespace);
|
||
|
||
if (!data) {
|
||
return;
|
||
}
|
||
|
||
data.links && data.links.each(ix.reset);
|
||
data.panes && data.panes.each(ix.reset);
|
||
}
|
||
|
||
function build(i, el) {
|
||
var widgetHash = namespace.substr(1) + '-' + i;
|
||
var $el = $(el); // Store state in data
|
||
|
||
var data = $.data(el, namespace);
|
||
|
||
if (!data) {
|
||
data = $.data(el, namespace, {
|
||
el: $el,
|
||
config: {}
|
||
});
|
||
}
|
||
|
||
data.current = null;
|
||
data.tabIdentifier = widgetHash + '-' + tabAttr;
|
||
data.paneIdentifier = widgetHash + '-' + paneAttr;
|
||
data.menu = $el.children('.w-tab-menu');
|
||
data.links = data.menu.children('.w-tab-link');
|
||
data.content = $el.children('.w-tab-content');
|
||
data.panes = data.content.children('.w-tab-pane'); // Remove old events
|
||
|
||
data.el.off(namespace);
|
||
data.links.off(namespace); // This role is necessary in the ARIA spec
|
||
|
||
data.menu.attr('role', 'tablist'); // Set all tabs unfocusable
|
||
|
||
data.links.attr('tabindex', '-1'); // Set config from data attributes
|
||
|
||
configure(data); // Wire up events when not in design mode
|
||
|
||
if (!design) {
|
||
data.links.on('click' + namespace, linkSelect(data));
|
||
data.links.on('keydown' + namespace, handleLinkKeydown(data)); // Trigger first intro event from current tab
|
||
|
||
var $link = data.links.filter('.' + linkCurrent);
|
||
var tab = $link.attr(tabAttr);
|
||
tab && changeTab(data, {
|
||
tab: tab,
|
||
immediate: true
|
||
});
|
||
}
|
||
}
|
||
|
||
function configure(data) {
|
||
var config = {}; // Set config options from data attributes
|
||
|
||
config.easing = data.el.attr('data-easing') || 'ease';
|
||
var intro = parseInt(data.el.attr('data-duration-in'), 10); // eslint-disable-next-line no-self-compare
|
||
|
||
intro = config.intro = intro === intro ? intro : 0;
|
||
var outro = parseInt(data.el.attr('data-duration-out'), 10); // eslint-disable-next-line no-self-compare
|
||
|
||
outro = config.outro = outro === outro ? outro : 0;
|
||
config.immediate = !intro && !outro; // Store config in data
|
||
|
||
data.config = config;
|
||
}
|
||
|
||
function getActiveTabIdx(data) {
|
||
var tab = data.current;
|
||
return Array.prototype.findIndex.call(data.links, function (t) {
|
||
return t.getAttribute(tabAttr) === tab;
|
||
}, null);
|
||
}
|
||
|
||
function linkSelect(data) {
|
||
return function (evt) {
|
||
evt.preventDefault();
|
||
var tab = evt.currentTarget.getAttribute(tabAttr);
|
||
tab && changeTab(data, {
|
||
tab: tab
|
||
});
|
||
};
|
||
}
|
||
|
||
function handleLinkKeydown(data) {
|
||
return function (evt) {
|
||
var currentIdx = getActiveTabIdx(data);
|
||
var keyName = evt.key;
|
||
var keyMap = {
|
||
ArrowLeft: currentIdx - 1,
|
||
ArrowUp: currentIdx - 1,
|
||
ArrowRight: currentIdx + 1,
|
||
ArrowDown: currentIdx + 1,
|
||
End: data.links.length - 1,
|
||
Home: 0
|
||
}; // Bail out of function if this key is not
|
||
// involved in tab management
|
||
|
||
if (!(keyName in keyMap)) return;
|
||
evt.preventDefault();
|
||
var nextIdx = keyMap[keyName]; // go back to end of tabs if we wrap past the start
|
||
|
||
if (nextIdx === -1) {
|
||
nextIdx = data.links.length - 1;
|
||
} // go back to start if we wrap past the last tab
|
||
|
||
|
||
if (nextIdx === data.links.length) {
|
||
nextIdx = 0;
|
||
}
|
||
|
||
var tabEl = data.links[nextIdx];
|
||
var tab = tabEl.getAttribute(tabAttr);
|
||
tab && changeTab(data, {
|
||
tab: tab
|
||
});
|
||
};
|
||
}
|
||
|
||
function changeTab(data, options) {
|
||
options = options || {};
|
||
var config = data.config;
|
||
var easing = config.easing;
|
||
var tab = options.tab; // Don't select the same tab twice
|
||
|
||
if (tab === data.current) {
|
||
return;
|
||
}
|
||
|
||
data.current = tab;
|
||
/**
|
||
* The currently active tab.
|
||
* Will be referenced to manage focus after
|
||
* TabLink attributes are changed
|
||
* @type {HTMLAnchorElement}
|
||
*/
|
||
|
||
var currentTab; // Select the current link
|
||
|
||
data.links.each(function (i, el) {
|
||
var $el = $(el); // Add important attributes at build time.
|
||
|
||
if (options.immediate || config.immediate) {
|
||
// Store corresponding pane for reference.
|
||
var pane = data.panes[i]; // IDs are necessary for ARIA relationships,
|
||
// so if the user did not create one, we create one
|
||
// using our generated identifier
|
||
|
||
if (!el.id) {
|
||
el.id = data.tabIdentifier + '-' + i;
|
||
}
|
||
|
||
if (!pane.id) {
|
||
pane.id = data.paneIdentifier + '-' + i;
|
||
}
|
||
|
||
el.href = '#' + pane.id; // Tab elements must take this role
|
||
|
||
el.setAttribute('role', 'tab'); // Tab elements must reference the unique ID of the panel
|
||
// that they control
|
||
|
||
el.setAttribute('aria-controls', pane.id); // Tab elements must report that they are not selected
|
||
// by default
|
||
|
||
el.setAttribute('aria-selected', 'false'); // Panes must take on the `Tabpanel` role
|
||
|
||
pane.setAttribute('role', 'tabpanel'); // Elements with tabpanel role must be labelled by
|
||
// their controlling tab
|
||
|
||
pane.setAttribute('aria-labelledby', el.id);
|
||
}
|
||
|
||
if (el.getAttribute(tabAttr) === tab) {
|
||
// This is the current tab. Store it.
|
||
currentTab = el;
|
||
$el.addClass(linkCurrent).removeAttr('tabindex').attr({
|
||
'aria-selected': 'true'
|
||
}).each(ix.intro);
|
||
} else if ($el.hasClass(linkCurrent)) {
|
||
$el.removeClass(linkCurrent).attr({
|
||
tabindex: '-1',
|
||
'aria-selected': 'false'
|
||
}).each(ix.outro);
|
||
}
|
||
}); // Find the new tab panes and keep track of previous
|
||
|
||
var targets = [];
|
||
var previous = [];
|
||
data.panes.each(function (i, el) {
|
||
var $el = $(el);
|
||
|
||
if (el.getAttribute(tabAttr) === tab) {
|
||
targets.push(el);
|
||
} else if ($el.hasClass(tabActive)) {
|
||
previous.push(el);
|
||
}
|
||
});
|
||
var $targets = $(targets);
|
||
var $previous = $(previous); // Switch tabs immediately and bypass transitions
|
||
|
||
if (options.immediate || config.immediate) {
|
||
$targets.addClass(tabActive).each(ix.intro);
|
||
$previous.removeClass(tabActive); // Redraw to benefit components in the hidden tab pane
|
||
// But only if not currently in the middle of a redraw
|
||
|
||
if (!inRedraw) {
|
||
Webflow.redraw.up();
|
||
}
|
||
|
||
return;
|
||
} // Focus if this is not the on-page-load call to `changeTab`
|
||
else {
|
||
// Backwards compatible hack to prevent focus from scrolling
|
||
var x = window.scrollX;
|
||
var y = window.scrollY;
|
||
currentTab.focus();
|
||
window.scrollTo(x, y);
|
||
} // Fade out the currently active tab before intro
|
||
|
||
|
||
if ($previous.length && config.outro) {
|
||
$previous.each(ix.outro);
|
||
tram($previous).add('opacity ' + config.outro + 'ms ' + easing, {
|
||
fallback: safari
|
||
}).start({
|
||
opacity: 0
|
||
}).then(function () {
|
||
return fadeIn(config, $previous, $targets);
|
||
});
|
||
} else {
|
||
// Skip the outro and play intro
|
||
fadeIn(config, $previous, $targets);
|
||
}
|
||
} // Fade in the new target
|
||
|
||
|
||
function fadeIn(config, $previous, $targets) {
|
||
// Clear previous active class + styles touched by tram
|
||
// We cannot remove the whole inline style because it could be dynamically bound
|
||
$previous.removeClass(tabActive).css({
|
||
opacity: '',
|
||
transition: '',
|
||
transform: '',
|
||
width: '',
|
||
height: ''
|
||
}); // Add active class to new target
|
||
|
||
$targets.addClass(tabActive).each(ix.intro);
|
||
Webflow.redraw.up(); // Set opacity immediately if intro is zero
|
||
|
||
if (!config.intro) {
|
||
return tram($targets).set({
|
||
opacity: 1
|
||
});
|
||
} // Otherwise fade in opacity
|
||
|
||
|
||
tram($targets).set({
|
||
opacity: 0
|
||
}).redraw().add('opacity ' + config.intro + 'ms ' + config.easing, {
|
||
fallback: safari
|
||
}).start({
|
||
opacity: 1
|
||
});
|
||
} // Export module
|
||
|
||
|
||
return api;
|
||
});
|
||
|
||
/***/ })
|
||
/******/ ]);/**
|
||
* ----------------------------------------------------------------------
|
||
* Webflow: Interactions 2.0: Init
|
||
*/
|
||
Webflow.require('ix2').init(
|
||
{"events":{"e":{"id":"e","name":"","animationType":"custom","eventTypeId":"MOUSE_OVER","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-2"}},"mediaQueries":["main"],"target":{"selector":".nav-li1","originalId":"60f9932f0024f1b59709a368|dedd4b07-e905-c6e8-25a6-dbbb29628a17","appliesTo":"CLASS"},"targets":[{"selector":".nav-li1","originalId":"60f9932f0024f1b59709a368|dedd4b07-e905-c6e8-25a6-dbbb29628a17","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1625674469111},"e-2":{"id":"e-2","name":"","animationType":"custom","eventTypeId":"MOUSE_OUT","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-2","affectedElements":{},"playInReverse":false,"autoStopEventId":"e"}},"mediaQueries":["main"],"target":{"selector":".nav-li1","originalId":"60f9932f0024f1b59709a368|dedd4b07-e905-c6e8-25a6-dbbb29628a17","appliesTo":"CLASS"},"targets":[{"selector":".nav-li1","originalId":"60f9932f0024f1b59709a368|dedd4b07-e905-c6e8-25a6-dbbb29628a17","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1625674469112},"e-3":{"id":"e-3","name":"","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-6","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-4"}},"mediaQueries":["medium","small","tiny"],"target":{"selector":".nav-ul1","originalId":"60f9932f0024f1b59709a368|13fb6938-d180-f635-b238-0d3f280b5869","appliesTo":"CLASS"},"targets":[{"selector":".nav-ul1","originalId":"60f9932f0024f1b59709a368|13fb6938-d180-f635-b238-0d3f280b5869","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1625749144425},"e-5":{"id":"e-5","name":"","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-7","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-6"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".nav-ul2","originalId":"60f9932f0024f1b59709a368|9482d4b6-873c-7b2e-d07b-9450674a951d","appliesTo":"CLASS"},"targets":[{"selector":".nav-ul2","originalId":"60f9932f0024f1b59709a368|9482d4b6-873c-7b2e-d07b-9450674a951d","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1625749362424},"e-7":{"id":"e-7","name":"","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-8","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-8"}},"mediaQueries":["medium","small","tiny"],"target":{"selector":".nav-li1","originalId":"60f9932f0024f1b59709a368|dedd4b07-e905-c6e8-25a6-dbbb29628a17","appliesTo":"CLASS"},"targets":[{"selector":".nav-li1","originalId":"60f9932f0024f1b59709a368|dedd4b07-e905-c6e8-25a6-dbbb29628a17","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1625749408800},"e-9":{"id":"e-9","name":"","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-9","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-10"}},"mediaQueries":["medium","small","tiny"],"target":{"selector":".burger","originalId":"60f9932f0024f1b59709a368|1072c267-fda6-8075-14b9-d044b88e58b9","appliesTo":"CLASS"},"targets":[{"selector":".burger","originalId":"60f9932f0024f1b59709a368|1072c267-fda6-8075-14b9-d044b88e58b9","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1625750223936},"e-10":{"id":"e-10","name":"","animationType":"custom","eventTypeId":"MOUSE_SECOND_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-10","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-9"}},"mediaQueries":["medium","small","tiny"],"target":{"selector":".burger","originalId":"60f9932f0024f1b59709a368|1072c267-fda6-8075-14b9-d044b88e58b9","appliesTo":"CLASS"},"targets":[{"selector":".burger","originalId":"60f9932f0024f1b59709a368|1072c267-fda6-8075-14b9-d044b88e58b9","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1625750223936},"e-11":{"id":"e-11","name":"","animationType":"custom","eventTypeId":"MOUSE_MOVE","action":{"id":"","actionTypeId":"GENERAL_CONTINUOUS_ACTION","config":{"actionListId":"a-11","affectedElements":{},"duration":0}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".body-2","originalId":"60f9932f0024f1b59709a368|60e5d2142271e683c082a45d","appliesTo":"CLASS"},"targets":[{"selector":".body-2","originalId":"60f9932f0024f1b59709a368|60e5d2142271e683c082a45d","appliesTo":"CLASS"}],"config":[{"continuousParameterGroupId":"a-11-p","selectedAxis":"X_AXIS","basedOn":"ELEMENT","reverse":false,"smoothing":100,"restingState":50},{"continuousParameterGroupId":"a-11-p-2","selectedAxis":"Y_AXIS","basedOn":"ELEMENT","reverse":false,"smoothing":100,"restingState":50}],"createdOn":1627027146494},"e-12":{"id":"e-12","name":"","animationType":"custom","eventTypeId":"MOUSE_OVER","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-12","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-13"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".button","originalId":"60f9932f0024f1b59709a368|8fe93542-3c5f-deb3-47e3-3dbf6b1cf25e","appliesTo":"CLASS"},"targets":[{"selector":".button","originalId":"60f9932f0024f1b59709a368|8fe93542-3c5f-deb3-47e3-3dbf6b1cf25e","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1627028532983},"e-13":{"id":"e-13","name":"","animationType":"custom","eventTypeId":"MOUSE_OUT","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-13","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-12"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".button","originalId":"60f9932f0024f1b59709a368|8fe93542-3c5f-deb3-47e3-3dbf6b1cf25e","appliesTo":"CLASS"},"targets":[{"selector":".button","originalId":"60f9932f0024f1b59709a368|8fe93542-3c5f-deb3-47e3-3dbf6b1cf25e","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1627028532983},"e-14":{"id":"e-14","name":"","animationType":"custom","eventTypeId":"MOUSE_OVER","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-14","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-15"}},"mediaQueries":["main"],"target":{"selector":".nav-li.menue-2-drop","originalId":"60f9932f0024f1b59709a368|ae4c89f8-00ae-0cee-fa6a-40fc0d271ab7","appliesTo":"CLASS"},"targets":[{"selector":".nav-li.menue-2-drop","originalId":"60f9932f0024f1b59709a368|ae4c89f8-00ae-0cee-fa6a-40fc0d271ab7","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1628154810498},"e-15":{"id":"e-15","name":"","animationType":"custom","eventTypeId":"MOUSE_OUT","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-15","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-14"}},"mediaQueries":["main"],"target":{"selector":".nav-li.menue-2-drop","originalId":"60f9932f0024f1b59709a368|ae4c89f8-00ae-0cee-fa6a-40fc0d271ab7","appliesTo":"CLASS"},"targets":[{"selector":".nav-li.menue-2-drop","originalId":"60f9932f0024f1b59709a368|ae4c89f8-00ae-0cee-fa6a-40fc0d271ab7","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1628154810498},"e-16":{"id":"e-16","name":"","animationType":"custom","eventTypeId":"PAGE_SCROLL_UP","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-16","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-17"}},"mediaQueries":["main"],"target":{"id":"60f9932f0024f1b59709a368","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"60f9932f0024f1b59709a368","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628155769345},"e-17":{"id":"e-17","name":"","animationType":"custom","eventTypeId":"PAGE_SCROLL_DOWN","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-17","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-16"}},"mediaQueries":["main"],"target":{"id":"60f9932f0024f1b59709a368","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"60f9932f0024f1b59709a368","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628155769345},"e-18":{"id":"e-18","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_UP","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-16","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-19"}},"mediaQueries":["main"],"target":{"id":"610bb7e4dd5ffc1c7358398f","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"610bb7e4dd5ffc1c7358398f","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628157924364},"e-19":{"id":"e-19","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_DOWN","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-17","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-18"}},"mediaQueries":["main"],"target":{"id":"610bb7e4dd5ffc1c7358398f","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"610bb7e4dd5ffc1c7358398f","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628157924364},"e-20":{"id":"e-20","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_UP","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-16","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-21"}},"mediaQueries":["main"],"target":{"id":"610be2ee658bb42c8aefbaad","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"610be2ee658bb42c8aefbaad","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628168941981},"e-21":{"id":"e-21","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_DOWN","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-17","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-20"}},"mediaQueries":["main"],"target":{"id":"610be2ee658bb42c8aefbaad","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"610be2ee658bb42c8aefbaad","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628168941981},"e-22":{"id":"e-22","name":"","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-18","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-23"}},"mediaQueries":["medium","small","tiny"],"target":{"selector":".manual-toggle","originalId":"610be2ee658bb42c8aefbaad|4ba45605-6151-4bd0-0d13-27a53cbf39c7","appliesTo":"CLASS"},"targets":[{"selector":".manual-toggle","originalId":"610be2ee658bb42c8aefbaad|4ba45605-6151-4bd0-0d13-27a53cbf39c7","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1628171356083},"e-23":{"id":"e-23","name":"","animationType":"custom","eventTypeId":"MOUSE_SECOND_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-19","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-22"}},"mediaQueries":["medium","small","tiny"],"target":{"selector":".manual-toggle","originalId":"610be2ee658bb42c8aefbaad|4ba45605-6151-4bd0-0d13-27a53cbf39c7","appliesTo":"CLASS"},"targets":[{"selector":".manual-toggle","originalId":"610be2ee658bb42c8aefbaad|4ba45605-6151-4bd0-0d13-27a53cbf39c7","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1628171356084},"e-24":{"id":"e-24","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-20","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-25"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".collapse-row","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5943","appliesTo":"CLASS"},"targets":[{"selector":".collapse-row","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5943","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1583164301429},"e-25":{"id":"e-25","animationType":"custom","eventTypeId":"MOUSE_SECOND_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-21","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-24"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".collapse-row","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5943","appliesTo":"CLASS"},"targets":[{"selector":".collapse-row","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5943","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1583164301432},"e-26":{"id":"e-26","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-22","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-27"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".accordion-head.first","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b596b","appliesTo":"CLASS"},"targets":[{"selector":".accordion-head.first","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b596b","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1583165532346},"e-27":{"id":"e-27","animationType":"custom","eventTypeId":"MOUSE_SECOND_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-23","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-26"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".accordion-head.first","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b596b","appliesTo":"CLASS"},"targets":[{"selector":".accordion-head.first","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b596b","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1583165532350},"e-28":{"id":"e-28","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-24","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-29"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".accordion-head.other","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5b38","appliesTo":"CLASS"},"targets":[{"selector":".accordion-head.other","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5b38","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1583165595610},"e-29":{"id":"e-29","animationType":"custom","eventTypeId":"MOUSE_SECOND_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-25","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-28"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".accordion-head.other","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5b38","appliesTo":"CLASS"},"targets":[{"selector":".accordion-head.other","originalId":"610bb7e4dd5ffc1c7358398f|d44843fa-e64c-1756-6044-d52c398b5b38","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1583165595613},"e-30":{"id":"e-30","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_UP","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-16","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-31"}},"mediaQueries":["main"],"target":{"id":"6113a59e58e60ac295162b58","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"6113a59e58e60ac295162b58","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628677535369},"e-31":{"id":"e-31","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_DOWN","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-17","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-30"}},"mediaQueries":["main"],"target":{"id":"6113a59e58e60ac295162b58","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"6113a59e58e60ac295162b58","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1628677535369},"e-32":{"id":"e-32","name":"","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-26","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-33"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".searchbutton","originalId":"ade9759d-10a7-26c1-62cf-1b7c0b17667b","appliesTo":"CLASS"},"targets":[{"selector":".searchbutton","originalId":"ade9759d-10a7-26c1-62cf-1b7c0b17667b","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1629279051066},"e-36":{"id":"e-36","name":"","animationType":"custom","eventTypeId":"MOUSE_CLICK","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-27","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-37"}},"mediaQueries":["main","medium","small","tiny"],"target":{"selector":".hide-search","originalId":"7c51c1a7-f075-262f-00ee-5197922cc5a6","appliesTo":"CLASS"},"targets":[{"selector":".hide-search","originalId":"7c51c1a7-f075-262f-00ee-5197922cc5a6","appliesTo":"CLASS"}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":null,"scrollOffsetUnit":null,"delay":null,"direction":null,"effectIn":null},"createdOn":1629279241184},"e-38":{"id":"e-38","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_UP","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-16","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-39"}},"mediaQueries":["main"],"target":{"id":"61237042b500ae3f14a0d2f7","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"61237042b500ae3f14a0d2f7","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1629712451064},"e-39":{"id":"e-39","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_DOWN","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-17","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-38"}},"mediaQueries":["main"],"target":{"id":"61237042b500ae3f14a0d2f7","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"61237042b500ae3f14a0d2f7","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1629712451064},"e-40":{"id":"e-40","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_UP","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-16","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-41"}},"mediaQueries":["main"],"target":{"id":"61237089294c915b0e8d4b7e","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"61237089294c915b0e8d4b7e","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1629712521928},"e-41":{"id":"e-41","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_DOWN","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-17","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-40"}},"mediaQueries":["main"],"target":{"id":"61237089294c915b0e8d4b7e","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"61237089294c915b0e8d4b7e","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1629712521928},"e-42":{"id":"e-42","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_UP","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-16","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-43"}},"mediaQueries":["main"],"target":{"id":"612373c035c7979f35e5809f","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"612373c035c7979f35e5809f","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1629713345045},"e-43":{"id":"e-43","name":"","animationType":"preset","eventTypeId":"PAGE_SCROLL_DOWN","action":{"id":"","actionTypeId":"GENERAL_START_ACTION","config":{"delay":0,"easing":"","duration":0,"actionListId":"a-17","affectedElements":{},"playInReverse":false,"autoStopEventId":"e-42"}},"mediaQueries":["main"],"target":{"id":"612373c035c7979f35e5809f","appliesTo":"PAGE","styleBlockIds":[]},"targets":[{"id":"612373c035c7979f35e5809f","appliesTo":"PAGE","styleBlockIds":[]}],"config":{"loop":false,"playInReverse":false,"scrollOffsetValue":0,"scrollOffsetUnit":"%","delay":null,"direction":null,"effectIn":null},"createdOn":1629713345045}},"actionLists":{"a":{"id":"a","title":"NAV","actionItemGroups":[{"actionItems":[{"id":"a-n","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul2","selectorGuids":["f3ccc6f0-3451-8105-76d8-959f04676870"]},"value":"none"}}]},{"actionItems":[{"id":"a-n-2","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul2","selectorGuids":["f3ccc6f0-3451-8105-76d8-959f04676870"]},"value":"block"}}]}],"useFirstGroupAsInitialState":true,"createdOn":1625674472351},"a-2":{"id":"a-2","title":"NAV 2","actionItemGroups":[{"actionItems":[{"id":"a-2-n-2","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul2","selectorGuids":["f3ccc6f0-3451-8105-76d8-959f04676870"]},"value":"none"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1625674472351},"a-6":{"id":"a-6","title":"navmobile-2","actionItemGroups":[{"actionItems":[{"id":"a-6-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".nav-ul1","selectorGuids":["1cf506fd-aedc-a1a1-15a3-674e47a2b322"]},"xValue":-100,"xUnit":"%","yUnit":"PX","zUnit":"PX"}}]},{"actionItems":[{"id":"a-6-n-2","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{},"value":"block"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1625749148279},"a-7":{"id":"a-7","title":"navmobile-2 2","actionItemGroups":[{"actionItems":[{"id":"a-7-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".nav-ul1","selectorGuids":["1cf506fd-aedc-a1a1-15a3-674e47a2b322"]},"xValue":0,"xUnit":"%","yUnit":"PX","zUnit":"PX"}}]},{"actionItems":[{"id":"a-7-n-2","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"selector":".nav-ul2","selectorGuids":["f3ccc6f0-3451-8105-76d8-959f04676870"]},"value":"none"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1625749148279},"a-8":{"id":"a-8","title":"show-mobile-l2","actionItemGroups":[{"actionItems":[{"id":"a-8-n","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul2","selectorGuids":["f3ccc6f0-3451-8105-76d8-959f04676870"]},"value":"block"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1625749412647},"a-9":{"id":"a-9","title":"sidenav-flyin","actionItemGroups":[{"actionItems":[{"id":"a-9-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"selector":".div-block-6","selectorGuids":["92db9b7b-210b-310d-e27f-276e1b313123"]},"xValue":-100,"xUnit":"%","yUnit":"PX","zUnit":"PX"}},{"id":"a-9-n-4","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"selector":".div-block-6","selectorGuids":["92db9b7b-210b-310d-e27f-276e1b313123"]},"value":"block"}}]},{"actionItems":[{"id":"a-9-n-2","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".div-block-6","selectorGuids":["92db9b7b-210b-310d-e27f-276e1b313123"]},"xValue":0,"xUnit":"%","yUnit":"PX","zUnit":"PX"}},{"id":"a-9-n-3","actionTypeId":"PLUGIN_LOTTIE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".burger","selectorGuids":["817d614e-966c-3aa3-367a-412704ad370f"]},"value":45}}]}],"useFirstGroupAsInitialState":true,"createdOn":1625750226967},"a-10":{"id":"a-10","title":"sidenav-flyin 2","actionItemGroups":[{"actionItems":[{"id":"a-10-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".div-block-6","selectorGuids":["92db9b7b-210b-310d-e27f-276e1b313123"]},"xValue":-100,"xUnit":"%","yUnit":"PX","zUnit":"PX"}},{"id":"a-10-n-2","actionTypeId":"PLUGIN_LOTTIE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".burger","selectorGuids":["817d614e-966c-3aa3-367a-412704ad370f"]},"value":96}}]}],"useFirstGroupAsInitialState":false,"createdOn":1625750226967},"a-11":{"id":"a-11","title":"kv-mouse","continuousParameterGroups":[{"id":"a-11-p","type":"MOUSE_X","parameterLabel":"Mouse X","continuousActionGroups":[{"keyframe":0,"actionItems":[{"id":"a-11-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".kv-image-3.l1","selectorGuids":["a64ad2cd-b317-a2b2-a938-2954fd2608fb","ff78b566-b269-a439-b7b0-e8c461961f9d"]},"xValue":10,"xUnit":"px","yUnit":"PX","zUnit":"PX"}},{"id":"a-11-n-8","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".kv-image-3.l3","selectorGuids":["a64ad2cd-b317-a2b2-a938-2954fd2608fb","fcef4bca-7125-7cdf-bf17-0dac435799e2"]},"xValue":30,"xUnit":"px","yUnit":"PX","zUnit":"PX"}},{"id":"a-11-n-9","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".kv-image-3.i2","selectorGuids":["a64ad2cd-b317-a2b2-a938-2954fd2608fb","b969a844-640d-73bb-21e0-1f19bbe43722"]},"xValue":20,"xUnit":"px","yUnit":"PX","zUnit":"PX"}}]},{"keyframe":100,"actionItems":[{"id":"a-11-n-2","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".kv-image-3.l1","selectorGuids":["a64ad2cd-b317-a2b2-a938-2954fd2608fb","ff78b566-b269-a439-b7b0-e8c461961f9d"]},"xValue":-10,"xUnit":"px","yUnit":"PX","zUnit":"PX"}},{"id":"a-11-n-7","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".kv-image-3.l3","selectorGuids":["a64ad2cd-b317-a2b2-a938-2954fd2608fb","fcef4bca-7125-7cdf-bf17-0dac435799e2"]},"xValue":-30,"xUnit":"px","yUnit":"PX","zUnit":"PX"}},{"id":"a-11-n-10","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".kv-image-3.i2","selectorGuids":["a64ad2cd-b317-a2b2-a938-2954fd2608fb","b969a844-640d-73bb-21e0-1f19bbe43722"]},"xValue":-20,"xUnit":"px","yUnit":"PX","zUnit":"PX"}}]}]},{"id":"a-11-p-2","type":"MOUSE_Y","parameterLabel":"Mouse Y","continuousActionGroups":[]}],"createdOn":1626969948966},"a-12":{"id":"a-12","title":"button-anime","actionItemGroups":[{"actionItems":[{"id":"a-12-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".button-flyin","selectorGuids":["4bca6185-ae91-dc6a-d039-21690e253ab3"]},"xValue":-100,"xUnit":"%","yUnit":"PX","zUnit":"PX"}},{"id":"a-12-n-3","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"useEventTarget":"CHILDREN","selector":".button-flyin","selectorGuids":["4bca6185-ae91-dc6a-d039-21690e253ab3"]},"value":"block"}}]},{"actionItems":[{"id":"a-12-n-2","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".button-flyin","selectorGuids":["4bca6185-ae91-dc6a-d039-21690e253ab3"]},"xValue":0,"xUnit":"px","yUnit":"PX","zUnit":"PX"}},{"id":"a-12-n-4","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":300,"target":{"useEventTarget":"CHILDREN","selector":".button-right-arrow","selectorGuids":["8c44f078-dd95-45cb-cf6f-094dba1c1bdf"]},"xValue":63,"xUnit":"px","yUnit":"PX","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":true,"createdOn":1627028210124},"a-13":{"id":"a-13","title":"button-anime 2","actionItemGroups":[{"actionItems":[{"id":"a-13-n-2","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".button-flyin","selectorGuids":["4bca6185-ae91-dc6a-d039-21690e253ab3"]},"xValue":-100,"xUnit":"%","yUnit":"PX","zUnit":"PX"}},{"id":"a-13-n-3","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".button-right-arrow","selectorGuids":["8c44f078-dd95-45cb-cf6f-094dba1c1bdf"]},"xValue":0,"xUnit":"px","yUnit":"PX","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1627028210124},"a-14":{"id":"a-14","title":"nav2","actionItemGroups":[{"actionItems":[{"id":"a-14-n","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul-2","selectorGuids":["c7cfbdea-767b-aaa1-5dae-936876dd3387"]},"heightValue":0,"widthUnit":"PX","heightUnit":"px","locked":false}},{"id":"a-14-n-3","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul-2","selectorGuids":["c7cfbdea-767b-aaa1-5dae-936876dd3387"]},"value":"flex"}}]},{"actionItems":[{"id":"a-14-n-2","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul-2","selectorGuids":["c7cfbdea-767b-aaa1-5dae-936876dd3387"]},"widthUnit":"PX","heightUnit":"AUTO","locked":false}}]}],"useFirstGroupAsInitialState":true,"createdOn":1628154815729},"a-15":{"id":"a-15","title":"nav2 2","actionItemGroups":[{"actionItems":[{"id":"a-15-n-2","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"useEventTarget":"CHILDREN","selector":".nav-ul-2","selectorGuids":["c7cfbdea-767b-aaa1-5dae-936876dd3387"]},"heightValue":0,"widthUnit":"PX","heightUnit":"px","locked":false}}]}],"useFirstGroupAsInitialState":false,"createdOn":1628154815729},"a-16":{"id":"a-16","title":"pagescroll nav","actionItemGroups":[{"actionItems":[{"id":"a-16-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".navmenu","selectorGuids":["e3c30e2a-7400-b54b-8bda-ce72f11c36cf"]},"yValue":0,"xUnit":"PX","yUnit":"px","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1628155773632},"a-17":{"id":"a-17","title":"pagescroll nav 2","actionItemGroups":[{"actionItems":[{"id":"a-17-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".navmenu","selectorGuids":["e3c30e2a-7400-b54b-8bda-ce72f11c36cf"]},"yValue":-100,"xUnit":"PX","yUnit":"%","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1628155773632},"a-18":{"id":"a-18","title":"manual","actionItemGroups":[{"actionItems":[{"id":"a-18-n-2","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"selector":".sidenav","selectorGuids":["a44a47a5-720d-2dfe-d966-2f8e0988228c"]},"value":"block"}},{"id":"a-18-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"selector":".sidenav","selectorGuids":["a44a47a5-720d-2dfe-d966-2f8e0988228c"]},"xValue":100,"xUnit":"%","yUnit":"PX","zUnit":"PX"}}]},{"actionItems":[{"id":"a-18-n-3","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".sidenav","selectorGuids":["a44a47a5-720d-2dfe-d966-2f8e0988228c"]},"xValue":0,"xUnit":"%","yUnit":"PX","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":true,"createdOn":1628171359911},"a-19":{"id":"a-19","title":"manual 2","actionItemGroups":[{"actionItems":[{"id":"a-19-n-3","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".sidenav","selectorGuids":["a44a47a5-720d-2dfe-d966-2f8e0988228c"]},"xValue":100,"xUnit":"%","yUnit":"PX","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1628171359911},"a-20":{"id":"a-20","title":"razpri vse","actionItemGroups":[{"actionItems":[{"id":"a-20-n","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"","duration":500,"target":{"selector":".accordion-toggle","selectorGuids":["27fecf28-b00c-055c-4075-62fcf84220a3"]},"widthUnit":"PX","heightUnit":"AUTO","locked":false}},{"id":"a-20-n-2","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"inOutQuint","duration":500,"target":{"selector":".accordion-toggle-2","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422099"]},"widthUnit":"PX","heightUnit":"AUTO","locked":false}},{"id":"a-20-n-3","actionTypeId":"TRANSFORM_ROTATE","config":{"delay":0,"easing":"","duration":200,"target":{},"zValue":180,"xUnit":"DEG","yUnit":"DEG","zUnit":"DEG"}},{"id":"a-20-n-4","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{},"value":"inline-block"}},{"id":"a-20-n-5","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{},"value":"none"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1583164305473},"a-21":{"id":"a-21","title":"razpri vse 2","actionItemGroups":[{"actionItems":[{"id":"a-21-n","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"inOutQuint","duration":500,"target":{"selector":".accordion-toggle","selectorGuids":["27fecf28-b00c-055c-4075-62fcf84220a3"]},"heightValue":0,"widthUnit":"PX","heightUnit":"PX","locked":false}},{"id":"a-21-n-2","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"inOutQuint","duration":500,"target":{"selector":".accordion-toggle-2","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422099"]},"heightValue":0,"widthUnit":"PX","heightUnit":"PX","locked":false}},{"id":"a-21-n-3","actionTypeId":"TRANSFORM_ROTATE","config":{"delay":0,"easing":"","duration":200,"target":{},"zValue":0,"xUnit":"DEG","yUnit":"DEG","zUnit":"DEG"}},{"id":"a-21-n-4","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{},"value":"none"}},{"id":"a-21-n-5","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{},"value":"inline-block"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1583164305473},"a-22":{"id":"a-22","title":"accordion-FIRST","actionItemGroups":[{"actionItems":[{"id":"a-22-n","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"inOutQuint","duration":500,"target":{"useEventTarget":"SIBLINGS","selector":".accordion-toggle-2","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422099"]},"heightValue":0,"widthUnit":"PX","heightUnit":"PX","locked":false}},{"id":"a-22-n-2","actionTypeId":"TRANSFORM_ROTATE","config":{"delay":0,"easing":"","duration":200,"target":{"useEventTarget":"CHILDREN","selector":".accordion-arrow","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422098"]},"zValue":180,"xUnit":"DEG","yUnit":"DEG","zUnit":"DEG"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1582028217351},"a-23":{"id":"a-23","title":"accordion-FIRTST-2","actionItemGroups":[{"actionItems":[{"id":"a-23-n","actionTypeId":"TRANSFORM_ROTATE","config":{"delay":0,"easing":"","duration":200,"target":{"useEventTarget":"CHILDREN","selector":".accordion-arrow","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422098"]},"zValue":0,"xUnit":"DEG","yUnit":"DEG","zUnit":"DEG"}},{"id":"a-23-n-2","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"inOutQuint","duration":500,"target":{"useEventTarget":"SIBLINGS","selector":".accordion-toggle-2","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422099"]},"widthUnit":"PX","heightUnit":"AUTO","locked":false}}]}],"useFirstGroupAsInitialState":false,"createdOn":1582028217351},"a-24":{"id":"a-24","title":"accordion-toggle","actionItemGroups":[{"actionItems":[{"id":"a-24-n","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"","duration":500,"target":{"useEventTarget":"SIBLINGS","selector":".accordion-toggle","selectorGuids":["27fecf28-b00c-055c-4075-62fcf84220a3"]},"heightValue":0,"widthUnit":"PX","heightUnit":"PX","locked":false}}]},{"actionItems":[{"id":"a-24-n-2","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"inOutQuint","duration":500,"target":{"useEventTarget":"SIBLINGS","selector":".accordion-toggle","selectorGuids":["27fecf28-b00c-055c-4075-62fcf84220a3"]},"widthUnit":"PX","heightUnit":"AUTO","locked":false}},{"id":"a-24-n-3","actionTypeId":"TRANSFORM_ROTATE","config":{"delay":0,"easing":"","duration":200,"target":{"useEventTarget":"CHILDREN","selector":".accordion-arrow","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422098"]},"zValue":180,"xUnit":"DEG","yUnit":"DEG","zUnit":"DEG"}}]}],"useFirstGroupAsInitialState":true,"createdOn":1582028217351},"a-25":{"id":"a-25","title":"accordion-toggle 2","actionItemGroups":[{"actionItems":[{"id":"a-25-n","actionTypeId":"STYLE_SIZE","config":{"delay":0,"easing":"inOutQuint","duration":500,"target":{"useEventTarget":"SIBLINGS","selector":".accordion-toggle","selectorGuids":["27fecf28-b00c-055c-4075-62fcf84220a3"]},"heightValue":0,"widthUnit":"PX","heightUnit":"PX","locked":false}},{"id":"a-25-n-2","actionTypeId":"TRANSFORM_ROTATE","config":{"delay":0,"easing":"","duration":200,"target":{"useEventTarget":"CHILDREN","selector":".accordion-arrow","selectorGuids":["27fecf28-b00c-055c-4075-62fcf8422098"]},"zValue":0,"xUnit":"DEG","yUnit":"DEG","zUnit":"DEG"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1582028217351},"a-26":{"id":"a-26","title":"search","actionItemGroups":[{"actionItems":[{"id":"a-26-n","actionTypeId":"GENERAL_DISPLAY","config":{"delay":0,"easing":"","duration":0,"target":{"selector":".searchform","selectorGuids":["94c6bb59-c95b-460b-fc47-f2bd6ac7116a"]},"value":"block"}},{"id":"a-26-n-2","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"","duration":500,"target":{"selector":".searchform","selectorGuids":["94c6bb59-c95b-460b-fc47-f2bd6ac7116a"]},"yValue":-100,"xUnit":"PX","yUnit":"%","zUnit":"PX"}}]},{"actionItems":[{"id":"a-26-n-3","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"selector":".searchform","selectorGuids":["94c6bb59-c95b-460b-fc47-f2bd6ac7116a"]},"yValue":0,"xUnit":"PX","yUnit":"%","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":true,"createdOn":1629279054583},"a-27":{"id":"a-27","title":"search 2","actionItemGroups":[{"actionItems":[{"id":"a-27-n","actionTypeId":"TRANSFORM_MOVE","config":{"delay":0,"easing":"outQuint","duration":500,"target":{"useEventTarget":"PARENT","selector":".searchform","selectorGuids":["94c6bb59-c95b-460b-fc47-f2bd6ac7116a"]},"yValue":-100,"xUnit":"PX","yUnit":"%","zUnit":"PX"}}]}],"useFirstGroupAsInitialState":false,"createdOn":1629279054583}},"site":{"mediaQueries":[{"key":"main","min":992,"max":10000},{"key":"medium","min":768,"max":991},{"key":"small","min":480,"max":767},{"key":"tiny","min":0,"max":479}]}}
|
||
);
|