Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.vcom = factory());
}(this, (function () {
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var index$4 = function (obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
};
/* eslint-disable no-unused-vars */
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (e) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
var index$6 = shouldUseNative() ? Object.assign : function (target, source) {
var arguments$1 = arguments;
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments$1[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/**
* Export `freeze`
*/
var freeze_1 = freeze$2
/**
* Are we running in a production build?
*/
var production = process && process.env && process.env.NODE_ENV === 'production'
/**
* Is Freezable?
*
* @param {Object} object
* @return {Boolean}
*/
function isFreezable (object) {
if (object === null) { return false }
return Array.isArray(object) ||
typeof object === 'object'
}
/**
* Check if we need to freeze this value
*
* @param {Object} object
* @return {Boolean}
*/
function needsFreezing (object) {
return isFreezable(object) && !Object.isFrozen(object)
}
/**
* Recurse
*
* @param {Object}
* @return {Object}
*/
function recur (object) {
Object.freeze(object)
Object.keys(object).forEach(function (key) {
var value = object[key]
if (needsFreezing(value)) {
recur(value)
}
})
return object
}
/**
* Deeply freeze a plain javascript object.
*
* If `process.env.NODE_ENV === 'production'`, this returns the original object
* witout freezing.
*
* @function
* @sig a -> a
* @param {object} object Object to freeze.
* @return {object} Frozen object, unless in production, then the same object.
*/
function freeze$2 (object) {
if (production) { return object }
if (needsFreezing(object)) {
recur(object)
}
return object
}
/**
* An Array.prototype.slice.call(arguments) alternative
*
* @param {Object} args something with a length
* @param {Number} slice
* @param {Number} sliceEnd
* @api public
*/
var index$8 = function (args, slice, sliceEnd) {
var ret = [];
var len = args.length;
if (0 === len) { return ret; }
var start = slice < 0
? Math.max(0, slice + len)
: slice || 0;
if (sliceEnd !== undefined) {
len = sliceEnd < 0
? sliceEnd + len
: sliceEnd
}
while (len-- > start) {
ret[len - start] = args[len];
}
return ret;
}
/**
* Module Dependencies
*/
var isPlainObject = index$4
var assign = index$6
var freeze$1 = freeze_1
var sliced$1 = index$8
var isArray$1 = Array.isArray
var keys = Object.keys
/**
* Export `update`
*/
var update_1 = update$1
/**
* Update the object or array
*
* @param {Mixed} original
* @param {Mixed, ...} updates
* @return {Mixed}
*/
function update$1 (original, update) {
update = sliced$1(arguments, 2).reduce(function (o, n) { return resolve$1(o, n, true) }, update)
return freeze$1(resolve$1(original, update))
}
/**
* Resolve the updates
*
* @param {Mixed} original
* @param {Array} updates
*/
function resolve$1 (original, updates, keepNull) {
return isPlainObject(original) && isPlainObject(updates)
? object(original, updates, keepNull)
: isArray$1(original) && isArray$1(updates)
? array(original, updates)
: updates === undefined ? original : updates
}
/**
* Update objects
*
* @param {Object} original
* @param {Array} updates
* @return {Array}
*/
function object (original, updates, keepNull) {
return keys(updates).reduce(function (obj, key, i) {
if (!keepNull && updates[key] === null) {
delete obj[key]
} else {
obj[key] = resolve$1(original[key], updates[key])
}
return obj
}, assign({}, original))
}
/**
* Update arrays
*
* @param {Array} original
* @param {Array} updates
* @return {Array}
*/
function array (original, updates) {
return [].concat(updates)
}
/**
* Modules
*/
/**
* Expose isFunction
*/
var index$20 = isFunction$1['default'] = isFunction$1
/**
* isFunction
*/
function isFunction$1 (value) {
return typeof value === 'function'
}
/**
* Modules
*/
var isFunction = index$20
/**
* Expose isObject
*/
var index$18 = isObject$1
/**
* Constants
*/
var objString = toString(Object)
/**
* Check for plain object.
*
* @param {Mixed} val
* @return {Boolean}
* @api private
*/
function isObject$1 (val) {
return !!val && (val.constructor === Object || isObjectString(val.constructor))
}
function isObjectString (val) {
return !!val && isFunction(val) && toString(val) === objString
}
function toString (val) {
return Function.prototype.toString.call(val)
}
/**
* Expose isArray
*/
var index$22 = isArray$4['default'] = isArray$4
/**
* isArray
*/
function isArray$4 (val) {
return Array.isArray(val)
}
/**
* Expose forEach
*/
var index$24 = forEach$2
/**
* forEach
*/
function forEach$2 (fn, obj) {
var this$1 = this;
if (!obj) { return }
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; ++i) {
var key = keys[i]
fn.call(this$1, obj[key], key, i)
}
}
/**
* Expose forEach
*/
var index$26 = forEach$3['default'] = forEach$3
/**
* forEach
*/
function forEach$3 (fn, arr) {
var this$1 = this;
if (!arr) { return }
for (var i = 0, len = arr.length; i < len; ++i) {
fn.call(this$1, arr[i], i)
}
}
/**
* Modules
*/
var isObject = index$18
var isArray$3 = index$22
var forEachObj = index$24
var forEachArr = index$26
/**
* Expose foreach
*/
var index$16 = forEach$1['default'] = forEach$1
/**
* For each
* @param {Function} fn iterator
* @param {Object} obj object to iterate over
*/
function forEach$1 (fn, a) {
if (isArray$3(a)) { return forEachArr.call(this, fn, a) }
if (isObject(a)) { return forEachObj.call(this, fn, a) }
}
/**
* Modules
*/
var forEach = index$16
/**
* Expose cloneObj
*/
var index$14 = cloneObj$1['default'] = cloneObj$1
/**
* Clone an object.
* @param {Object} obj Object to Clone
* @return {Object}
*/
function cloneObj$1 (obj) {
var newObj = {}
forEach(function (val, key) {
newObj[key] = val
}, obj)
return newObj
}
/**
* Expose slice
*/
var index$28 = slice
/**
* slice
*/
function slice (array, begin, end) {
begin = begin || 0
end = end || array.length
var arr = new Array(array.length)
for (var i = begin; i < end; ++i) {
arr[i - begin] = array[i]
}
return arr
}
/**
* Modules
*/
var cloneObj = index$14
var cloneArray = index$28
var isArray$2 = index$22
/**
* Expose cloneShallow
*/
var index$12 = cloneShallow
/**
* Clone object or array shallow
* @param {Object|Array} a object to copy
* @return {Object|Array}
*/
function cloneShallow (a) {
return isArray$2()
? cloneArray(a)
: cloneObj(a)
}
/**
* Expose toArray
*/
var index$32 = toArray$1['default'] = toArray$1
/**
* Convert to an array from array like
* @param {ArrayLike} arr
* @return {Array}
*/
function toArray$1 (arr) {
var len = arr.length
var idx = -1
var array = new Array(len)
while (++idx < len) {
array[idx] = arr[idx]
}
return array
}
/**
* Modules
*/
var toArray = index$32
/**
* Expose composeReducers
*/
var index$30 = composeReducers$1['default'] = composeReducers$1
/**
* composeReducers
*/
function composeReducers$1 (/* arguments */) {
var args = toArray(arguments)
var len = args.length
return function (state, action) {
for (var i = 0; i < len; ++i) {
state = args[i](state, action)
}
return state
}
}
/**
* Modules
*/
var clone = index$12
var composeReducers = index$30
/**
* Expose combineReducers
*/
var index$10 = combineReducers['default'] = combineReducers
/**
* combineReducers
*/
function combineReducers (reducers, defaultState) {
defaultState = defaultState || {}
return composeReducers.apply(null, Object
.keys(reducers)
.map(function (key) {
return scopeReducer(reducers[key], key, defaultState)
}))
}
function scopeReducer (reducer, prop, defaultState) {
return function (state, action) {
if (state === undefined) { state = defaultState }
var childState = reducer(state[prop], action)
if (childState !== state[prop]) {
state = clone(state)
state[prop] = childState
}
return state
}
}
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function set$1(obj, path, value) {
if (path.length === 0) {
return;
}
var res = obj;
var last = path[path.length - 1];
if (path.length === 1) {
if (isObject$2(res)) {
return res[last] = value;
}
return;
}
for (var i = 0; i < path.length - 1; i++) {
var key = path[i];
if (!_hasOwnProperty.call(res, key) || !isObject$2(res[key])) {
res[key] = {};
}
res = res[key];
}
return res[last] = value;
}
var set_1 = set$1;
function isObject$2(value) {
return value != null && (typeof value === 'object' || typeof value === 'function');
}
var index$34 = {
set: set_1
};
/**
* Module Dependencies
*/
var set = index$34.set
/**
* Expose `handle`
*/
var handle_1 = handle$2
/**
* handle
*/
function handle$2 (map) {
map = map || {}
return function (state, action) {
var keys = action.type.split(/[: ]/)
var handler = keys.shift()
var rest = keys.join('.')
// normalized path
var path = rest
? [handler].concat(rest).join(':')
: handler
if (map[path]) { return map[path](state, action.payload, map) }
var obj = {}
if (handler === 'set') {
if (!keys.length) { return action.payload }
set(obj, keys.join('.').split('.'), action.payload)
return obj
}
}
}
/**
* Module dependencies
*/
var combine = index$10
var handle$1 = handle_1
var isobj$1 = index$4
/**
* Export `Tree`
*/
var tree$1 = Tree
/**
* Initialize `Tree`
*
* @param {Object} map
* @param {Function}
*/
function Tree (tree) {
var obj = walk(tree, [], {})
return handle$1(obj)
}
/**
* Walk the object tree
*
* @param {Object} tree
* @param {Array} trail
* @return {Function}
*/
function walk (tree, tail, out) {
for (var key in tree) {
if (!tree.hasOwnProperty(key)) { continue }
else if (typeof tree[key] === 'function') {
var path = tail.length ? key + ':' + tail.join('.') : key
out[path] = tail.reduceRight(function (fn, k) {
var o = {}
o[k] = fn
return combine(o)
}, tree[key])
} else if (isobj$1(tree[key])) {
walk(tree[key], tail.concat(key), out)
}
}
return out
}
/**
* Module dependencies
*/
var update = update_1
var tree = tree$1
var isobj = index$4
/**
* Export `reducer`
*/
var reducer_1 = reducer$1
/**
* Initialize `reducer`
*
* @param {Function|Object} fn
* @return {Function}
*/
function reducer$1 (fn) {
fn = isobj(fn) ? tree(fn) : fn
return function reduce (state, action) {
var updates = fn(state, action)
return update(state, updates)
}
}
/**
* lodash 3.1.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** `Object#toString` result references. */
var errorTag = '[object Error]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
* `SyntaxError`, `TypeError`, or `URIError` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
* @example
*
* _.isError(new Error);
* // => true
*
* _.isError(Error);
* // => false
*/
function isError$1(value) {
if (!isObjectLike(value)) {
return false;
}
return (objectToString.call(value) == errorTag) ||
(typeof value.message == 'string' && typeof value.name == 'string');
}
/**
* 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 _
* @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 && typeof value == 'object';
}
var index$36 = isError$1;
/**
* Module Dependencies
*/
var isError = index$36
var isobj$2 = index$4
var keys$1 = Object.keys
/**
* Whitelisted keys
*/
var whitelist = {
type: 1,
meta: 1,
error: 1,
payload: 1
}
/**
* Export `isFSA`
*/
var isFsa = isFSA$1
/**
* Check if the value is an action
*
* Spec: https://github.com/acdlite/flux-standard-action#actions
*
* @param {Mixed} value
* @return {Boolean}
*/
function isFSA$1 (value) {
// value must be an object and have a type
if (!isobj$2(value) || !value.type) { return false }
// if any properties on the object are
// not part of the whitelist fail then
// return false
var props = keys$1(value)
for (var i = 0, prop; (prop = props[i]); i++) {
if (!whitelist[prop]) { return false }
}
// lastly check that if value.error is "true"
// that our payload is an Error object
if (value.error === true && !isError(value.payload)) {
return false
}
return true
}
/**
* Module Dependencies
*/
var isFSA = isFsa
/**
* Export `middleware`
*/
var resolve_1 = resolve$2
/**
* Resolve promises, arrays, objects, etc.
*/
function resolve$2 (store) {
return function (next) {
return function (action) {
return typeof action === 'function'
? next(FSACheck(action(store.getState())))
: next(action)
}
}
}
/**
* Ensure that what's returned
* is a flux standard action
*
* @param {Mixed} mixed
* @return {Object}
*/
function FSACheck (mixed) {
if (isFSA(mixed)) { return mixed }
throw new Error('resolved action (' + stringify(mixed) + ') is not the correct format. Please refer to the spec: https://github.com/acdlite/flux-standard-action#actions')
}
/**
* Serialize our value
*
* @param {Mixed} mixed
* @return {String}
*/
function stringify (mixed) {
try {
return JSON.stringify(mixed)
} catch (e) {
return mixed
}
}
/**
* 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));
};
}
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
/**
* 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$1(value) {
return value != null && typeof value == 'object';
}
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype;
var objectProto$1 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString$1 = objectProto$1.toString;
/**
* 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$1(value) {
if (!isObjectLike$1(value) || objectToString$1.call(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor;
return (typeof Ctor == 'function' &&
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
}
var ponyfill = createCommonjsModule(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = 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;
}
});
var index$40 = createCommonjsModule(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ponyfill = ponyfill;
var _ponyfill2 = _interopRequireDefault(_ponyfill);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var root = undefined; /* global window */
if (typeof commonjsGlobal !== 'undefined') {
root = commonjsGlobal;
} else if (typeof window !== 'undefined') {
root = window;
}
var result = (0, _ponyfill2['default'])(root);
exports['default'] = result;
});
var index$39 = index$40;
/**
* 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 (!isPlainObject$1(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[index$39] = 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[index$39] = observable, _ref2;
}
/**
* 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 */
}
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 === 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 (!isPlainObject$1(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: 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 ' + 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$1(reducers) {
var reducerKeys = Object.keys(reducers);
var finalReducers = {};
for (var i = 0; i < reducerKeys.length; i++) {
var key = reducerKeys[i];
if (process.env.NODE_ENV !== 'production') {
if (typeof reducers[key] === 'undefined') {
warning('No reducer provided for key "' + key + '"');
}
}
if (typeof reducers[key] === 'function') {
finalReducers[key] = reducers[key];
}
}
var finalReducerKeys = Object.keys(finalReducers);
if (process.env.NODE_ENV !== 'production') {
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 (process.env.NODE_ENV !== 'production') {
var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
if (warningMessage) {
warning(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;
};
}
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;
}
/**
* 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() {
var arguments$1 = arguments;
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments$1[_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));
};
}
var _extends = Object.assign || function (target) {
var arguments$1 = arguments;
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[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() {
var arguments$1 = arguments;
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments$1[_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.apply(undefined, chain)(store.dispatch);
return _extends({}, store, {
dispatch: _dispatch
});
};
};
}
/*
* 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 (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
warning('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
}
var index$38 = Object.freeze({
createStore: createStore,
combineReducers: combineReducers$1,
bindActionCreators: bindActionCreators,
applyMiddleware: applyMiddleware,
compose: compose
});
var require$$0$10 = ( index$38 && index$38['default'] ) || index$38;
/**
* Module Dependencies
*/
var reducer = reducer_1
var resolve = resolve_1
var freeze = freeze_1
var handle = handle_1
var sliced = index$8
var redux = require$$0$10
var isArray = Array.isArray
/**
* Redux methods
*/
var Middleware = redux.applyMiddleware
var Store = redux.createStore
/**
* Export `Socrates`
*/
var index$2 = Socrates
/**
* Initialize `Socrates`
*
* @param {Array} middlewares
* @param {Function} root reducer
* @return {Function} socrates
*/
function Socrates (reduce) {
reduce = reduce || handle()
// create our redux client
var redux = Store(reducer(reduce), {}, Middleware(resolve))
// initialize a store
function store (action) {
var arrayContext = isArray(this)
if (!arguments.length && !arrayContext) { return freeze(redux.getState()) }
var actions = arrayContext ? sliced(this) : sliced(arguments)
actions = wrapEmitterStyle(actions)
redux.dispatch.apply(redux, actions)
return redux.getState()
}
// subscribe to changes
store.subscribe = function subscribe (fn) {
return redux.subscribe(function listener () {
return fn(freeze(redux.getState()))
})
}
return store
}
/**
* Maybe wrap the emitter style
* into a flux standard action
*
* @param {Array} actions
* @return {Array}
*/
function wrapEmitterStyle (actions) {
if (actions.length !== 2) { return actions }
if (typeof actions[0] !== 'string') { return actions }
return [{
type: actions[0],
payload: actions[1]
}]
}
var index$42 = createCommonjsModule(function (module, exports) {
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.afro = factory());
}(commonjsGlobal, function () {
function interopDefault(ex) {
return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex;
}
function createCommonjsModule$$1(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var walk = createCommonjsModule$$1(function (module) {
/**
* Export `walk`
*/
module.exports = walk
/**
* Walk the AST calling `fn`
*
* @param {AST} node
* @param {Function} fn
*/
function walk(node, fn) {
for (var i = 0, rule; rule = node.rules[i]; i++) {
rule.rules ? walk(rule, fn) : fn(rule, node)
}
}
});
var walk$1 = interopDefault(walk);
var require$$1 = Object.freeze({
default: walk$1
});
var hash = createCommonjsModule$$1(function (module) {
/**
* Export Hash
*/
module.exports = Hash
/**
* Hash
*
* @param {Object} object
* @return {String} string
*/
function Hash (object) {
return murmur(JSON.stringify(object))
}
/**
* JS Implementation of MurmurHash2
*
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
* @see http://github.com/garycourt/murmurhash-js
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
* @see http://sites.google.com/site/murmurhash/
*
* @param {string} str ASCII only
* @return {string} Base 36 encoded hash result
*/
function murmur (str) {
var l = str.length
var h = l
var i = 0
var k = undefined
while (l >= 4) {
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16)
k ^= k >>> 24
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16)
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k
l -= 4
++i
}
switch (l) {
case 3:
h ^= (str.charCodeAt(i + 2) & 0xff) << 16
case 2:
h ^= (str.charCodeAt(i + 1) & 0xff) << 8
case 1:
h ^= str.charCodeAt(i) & 0xff
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16)
}
h ^= h >>> 13
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16)
h ^= h >>> 15
return (h >>> 0).toString(36)
}
});
var hash$1 = interopDefault(hash);
var require$$0 = Object.freeze({
default: hash$1
});
var analyze = createCommonjsModule$$1(function (module) {
/**
* Module dependencies
*/
var walk = interopDefault(require$$1)
var Hash = interopDefault(require$$0)
/**
* Export `Analyze`
*/
module.exports = Analyze
/**
* Initialize `Analyze`
*/
function Analyze (ast) {
var classes = {}
// aggregate all the selectors
walk(ast, function (rule, node) {
if (rule.type !== 'rule') { return }
var selectors = split(rule.selectors)
selectors.forEach(function (selector) {
var psuedos = selector.split(':')
var tag = psuedos.shift()
// setup the attrs object
var attrs = classes[tag] = classes[tag] || {}
if (node.media) {
var media = "@media " + (node.media)
attrs = attrs[media] = attrs[media] || {}
}
if (psuedos.length) {
var psuedo = ":" + (psuedos.join(':'))
attrs = attrs[psuedo] = attrs[psuedo] || {}
}
rule.declarations.forEach(function (decl) {
attrs[decl.property] = decl.value
})
})
})
for (var selector in classes) {
classes[selector] = '_' + Hash(classes[selector])
}
return classes
}
/**
* Get all the classnames, ignore everything else
*
* @param {Array} selectors
* @return {Array} selectors
*/
function split (selectors) {
return selectors.reduce(function (selectors, selector) {
selector.replace(/\.([^\s]+)/g, function (m, cls) {
selectors.push(cls)
})
return selectors
}, [])
}
});
var analyze$1 = interopDefault(analyze);
var require$$5 = Object.freeze({
default: analyze$1
});
var prefixProps = createCommonjsModule$$1(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = { "Webkit": { "transform": true, "transformOrigin": true, "transformOriginX": true, "transformOriginY": true, "backfaceVisibility": true, "perspective": true, "perspectiveOrigin": true, "transformStyle": true, "transformOriginZ": true, "animation": true, "animationDelay": true, "animationDirection": true, "animationFillMode": true, "animationDuration": true, "animationIterationCount": true, "animationName": true, "animationPlayState": true, "animationTimingFunction": true, "appearance": true, "userSelect": true, "fontKerning": true, "textEmphasisPosition": true, "textEmphasis": true, "textEmphasisStyle": true, "textEmphasisColor": true, "boxDecorationBreak": true, "clipPath": true, "maskImage": true, "maskMode": true, "maskRepeat": true, "maskPosition": true, "maskClip": true, "maskOrigin": true, "maskSize": true, "maskComposite": true, "mask": true, "maskBorderSource": true, "maskBorderMode": true, "maskBorderSlice": true, "maskBorderWidth": true, "maskBorderOutset": true, "maskBorderRepeat": true, "maskBorder": true, "maskType": true, "textDecorationStyle": true, "textDecorationSkip": true, "textDecorationLine": true, "textDecorationColor": true, "filter": true, "fontFeatureSettings": true, "breakAfter": true, "breakBefore": true, "breakInside": true, "columnCount": true, "columnFill": true, "columnGap": true, "columnRule": true, "columnRuleColor": true, "columnRuleStyle": true, "columnRuleWidth": true, "columns": true, "columnSpan": true, "columnWidth": true, "flex": true, "flexBasis": true, "flexDirection": true, "flexGrow": true, "flexFlow": true, "flexShrink": true, "flexWrap": true, "alignContent": true, "alignItems": true, "alignSelf": true, "justifyContent": true, "order": true, "transition": true, "transitionDelay": true, "transitionDuration": true, "transitionProperty": true, "transitionTimingFunction": true, "backdropFilter": true, "scrollSnapType": true, "scrollSnapPointsX": true, "scrollSnapPointsY": true, "scrollSnapDestination": true, "scrollSnapCoordinate": true, "shapeImageThreshold": true, "shapeImageMargin": true, "shapeImageOutside": true, "hyphens": true, "flowInto": true, "flowFrom": true, "regionFragment": true, "textSizeAdjust": true, "borderImage": true, "borderImageOutset": true, "borderImageRepeat": true, "borderImageSlice": true, "borderImageSource": true, "borderImageWidth": true, "tabSize": true, "objectFit": true, "objectPosition": true }, "Moz": { "appearance": true, "userSelect": true, "boxSizing": true, "textAlignLast": true, "textDecorationStyle": true, "textDecorationSkip": true, "textDecorationLine": true, "textDecorationColor": true, "tabSize": true, "hyphens": true, "fontFeatureSettings": true, "breakAfter": true, "breakBefore": true, "breakInside": true, "columnCount": true, "columnFill": true, "columnGap": true, "columnRule": true, "columnRuleColor": true, "columnRuleStyle": true, "columnRuleWidth": true, "columns": true, "columnSpan": true, "columnWidth": true }, "ms": { "flex": true, "flexBasis": false, "flexDirection": true, "flexGrow": false, "flexFlow": true, "flexShrink": false, "flexWrap": true, "alignContent": false, "alignItems": false, "alignSelf": false, "justifyContent": false, "order": false, "transform": true, "transformOrigin": true, "transformOriginX": true, "transformOriginY": true, "userSelect": true, "wrapFlow": true, "wrapThrough": true, "wrapMargin": true, "scrollSnapType": true, "scrollSnapPointsX": true, "scrollSnapPointsY": true, "scrollSnapDestination": true, "scrollSnapCoordinate": true, "touchAction": true, "hyphens": true, "flowInto": true, "flowFrom": true, "breakBefore": true, "breakAfter": true, "breakInside": true, "regionFragment": true, "gridTemplateColumns": true, "gridTemplateRows": true, "gridTemplateAreas": true, "gridTemplate": true, "gridAutoColumns": true, "gridAutoRows": true, "gridAutoFlow": true, "grid": true, "gridRowStart": true, "gridColumnStart": true, "gridRowEnd": true, "gridRow": true, "gridColumn": true, "gridColumnEnd": true, "gridColumnGap": true, "gridRowGap": true, "gridArea": true, "gridGap": true, "textSizeAdjust": true } };
module.exports = exports["default"];
});
var prefixProps$1 = interopDefault(prefixProps);
var require$$0$3 = Object.freeze({
default: prefixProps$1
});
var capitalizeString = createCommonjsModule$$1(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
// helper to capitalize strings
exports.default = function (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
module.exports = exports["default"];
});
var capitalizeString$1 = interopDefault(capitalizeString);
var require$$2$1 = Object.freeze({
default: capitalizeString$1
});
var joinPrefixedValue = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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; }
// returns a style object with a single concated prefixed value string
exports.default = function (property, value) {
var replacer = arguments.length <= 2 || arguments[2] === undefined ? function (prefix, value) {
return prefix + value;
} : arguments[2];
return _defineProperty({}, property, ['-webkit-', '-moz-', ''].map(function (prefix) {
return replacer(prefix, value);
}));
};
module.exports = exports['default'];
});
var joinPrefixedValue$1 = interopDefault(joinPrefixedValue);
var require$$1$2 = Object.freeze({
default: joinPrefixedValue$1
});
var isPrefixedValue = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (value) {
if (Array.isArray(value)) { value = value.join(','); }
return value.match(/-webkit-|-moz-|-ms-/) !== null;
};
module.exports = exports['default'];
});
var isPrefixedValue$1 = interopDefault(isPrefixedValue);
var require$$1$3 = Object.freeze({
default: isPrefixedValue$1
});
var calc = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = calc;
var _joinPrefixedValue = interopDefault(require$$1$2);
var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue);
var _isPrefixedValue = interopDefault(require$$1$3);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function calc(property, value) {
if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.indexOf('calc(') > -1) {
return (0, _joinPrefixedValue2.default)(property, value, function (prefix, value) {
return value.replace(/calc\(/g, prefix + 'calc(');
});
}
}
module.exports = exports['default'];
});
var calc$1 = interopDefault(calc);
var require$$7 = Object.freeze({
default: calc$1
});
var cursor = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cursor;
var _joinPrefixedValue = interopDefault(require$$1$2);
var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var values = {
'zoom-in': true,
'zoom-out': true,
grab: true,
grabbing: true
};
function cursor(property, value) {
if (property === 'cursor' && values[value]) {
return (0, _joinPrefixedValue2.default)(property, value);
}
}
module.exports = exports['default'];
});
var cursor$1 = interopDefault(cursor);
var require$$6 = Object.freeze({
default: cursor$1
});
var flex = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = flex;
var values = { flex: true, 'inline-flex': true };
function flex(property, value) {
if (property === 'display' && values[value]) {
return {
display: ['-webkit-box', '-moz-box', '-ms-' + value + 'box', '-webkit-' + value, value]
};
}
}
module.exports = exports['default'];
});
var flex$1 = interopDefault(flex);
var require$$5$1 = Object.freeze({
default: flex$1
});
var sizing = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = sizing;
var _joinPrefixedValue = interopDefault(require$$1$2);
var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var properties = {
maxHeight: true,
maxWidth: true,
width: true,
height: true,
columnWidth: true,
minWidth: true,
minHeight: true
};
var values = {
'min-content': true,
'max-content': true,
'fill-available': true,
'fit-content': true,
'contain-floats': true
};
function sizing(property, value) {
if (properties[property] && values[value]) {
return (0, _joinPrefixedValue2.default)(property, value);
}
}
module.exports = exports['default'];
});
var sizing$1 = interopDefault(sizing);
var require$$4$1 = Object.freeze({
default: sizing$1
});
var gradient = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = gradient;
var _joinPrefixedValue = interopDefault(require$$1$2);
var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue);
var _isPrefixedValue = interopDefault(require$$1$3);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;
function gradient(property, value) {
if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.match(values) !== null) {
return (0, _joinPrefixedValue2.default)(property, value);
}
}
module.exports = exports['default'];
});
var gradient$1 = interopDefault(gradient);
var require$$3 = Object.freeze({
default: gradient$1
});
var index$2 = createCommonjsModule$$1(function (module) {
'use strict';
var uppercasePattern = /[A-Z]/g;
var msPattern = /^ms-/;
function hyphenateStyleName(string) {
return string
.replace(uppercasePattern, '-$&')
.toLowerCase()
.replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
});
var index$3 = interopDefault(index$2);
var require$$3$1 = Object.freeze({
default: index$3
});
var transition = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = transition;
var _hyphenateStyleName = interopDefault(require$$3$1);
var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName);
var _capitalizeString = interopDefault(require$$2$1);
var _capitalizeString2 = _interopRequireDefault(_capitalizeString);
var _isPrefixedValue = interopDefault(require$$1$3);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
var _prefixProps = interopDefault(require$$0$3);
var _prefixProps2 = _interopRequireDefault(_prefixProps);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var properties = {
transition: true,
transitionProperty: true,
WebkitTransition: true,
WebkitTransitionProperty: true
};
function transition(property, value) {
// also check for already prefixed transitions
if (typeof value === 'string' && properties[property]) {
var _ref2;
var outputValue = prefixValue(value);
var webkitOutput = outputValue.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function (value) {
return value.match(/-moz-|-ms-/) === null;
}).join(',');
// if the property is already prefixed
if (property.indexOf('Webkit') > -1) {
return _defineProperty({}, property, webkitOutput);
}
return _ref2 = {}, _defineProperty(_ref2, 'Webkit' + (0, _capitalizeString2.default)(property), webkitOutput), _defineProperty(_ref2, property, outputValue), _ref2;
}
}
function prefixValue(value) {
if ((0, _isPrefixedValue2.default)(value)) {
return value;
}
// only split multi values, not cubic beziers
var multipleValues = value.split(/,(?![^()]*(?:\([^()]*\))?\))/g);
// iterate each single value and check for transitioned properties
// that need to be prefixed as well
multipleValues.forEach(function (val, index) {
multipleValues[index] = Object.keys(_prefixProps2.default).reduce(function (out, prefix) {
var dashCasePrefix = '-' + prefix.toLowerCase() + '-';
Object.keys(_prefixProps2.default[prefix]).forEach(function (prop) {
var dashCaseProperty = (0, _hyphenateStyleName2.default)(prop);
if (val.indexOf(dashCaseProperty) > -1 && dashCaseProperty !== 'order') {
// join all prefixes and create a new value
out = val.replace(dashCaseProperty, dashCasePrefix + dashCaseProperty) + ',' + out;
}
});
return out;
}, val);
});
return multipleValues.join(',');
}
module.exports = exports['default'];
});
var transition$1 = interopDefault(transition);
var require$$2$2 = Object.freeze({
default: transition$1
});
var flexboxIE = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = flexboxIE;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var alternativeValues = {
'space-around': 'distribute',
'space-between': 'justify',
'flex-start': 'start',
'flex-end': 'end'
};
var alternativeProps = {
alignContent: 'msFlexLinePack',
alignSelf: 'msFlexItemAlign',
alignItems: 'msFlexAlign',
justifyContent: 'msFlexPack',
order: 'msFlexOrder',
flexGrow: 'msFlexPositive',
flexShrink: 'msFlexNegative',
flexBasis: 'msPreferredSize'
};
function flexboxIE(property, value) {
if (alternativeProps[property]) {
return _defineProperty({}, alternativeProps[property], alternativeValues[value] || value);
}
}
module.exports = exports['default'];
});
var flexboxIE$1 = interopDefault(flexboxIE);
var require$$1$4 = Object.freeze({
default: flexboxIE$1
});
var flexboxOld = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = flexboxOld;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var alternativeValues = {
'space-around': 'justify',
'space-between': 'justify',
'flex-start': 'start',
'flex-end': 'end',
'wrap-reverse': 'multiple',
wrap: 'multiple'
};
var alternativeProps = {
alignItems: 'WebkitBoxAlign',
justifyContent: 'WebkitBoxPack',
flexWrap: 'WebkitBoxLines'
};
function flexboxOld(property, value) {
if (property === 'flexDirection') {
return {
WebkitBoxOrient: value.indexOf('column') > -1 ? 'vertical' : 'horizontal',
WebkitBoxDirection: value.indexOf('reverse') > -1 ? 'reverse' : 'normal'
};
}
if (alternativeProps[property]) {
return _defineProperty({}, alternativeProps[property], alternativeValues[value] || value);
}
}
module.exports = exports['default'];
});
var flexboxOld$1 = interopDefault(flexboxOld);
var require$$0$4 = Object.freeze({
default: flexboxOld$1
});
var prefixAll = createCommonjsModule$$1(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = prefixAll;
var _prefixProps = interopDefault(require$$0$3);
var _prefixProps2 = _interopRequireDefault(_prefixProps);
var _capitalizeString = interopDefault(require$$2$1);
var _capitalizeString2 = _interopRequireDefault(_capitalizeString);
var _calc = interopDefault(require$$7);
var _calc2 = _interopRequireDefault(_calc);
var _cursor = interopDefault(require$$6);
var _cursor2 = _interopRequireDefault(_cursor);
var _flex = interopDefault(require$$5$1);
var _flex2 = _interopRequireDefault(_flex);
var _sizing = interopDefault(require$$4$1);
var _sizing2 = _interopRequireDefault(_sizing);
var _gradient = interopDefault(require$$3);
var _gradient2 = _interopRequireDefault(_gradient);
var _transition = interopDefault(require$$2$2);
var _transition2 = _interopRequireDefault(_transition);
var _flexboxIE = interopDefault(require$$1$4);
var _flexboxIE2 = _interopRequireDefault(_flexboxIE);
var _flexboxOld = interopDefault(require$$0$4);
var _flexboxOld2 = _interopRequireDefault(_flexboxOld);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// special flexbox specifications
var plugins = [_calc2.default, _cursor2.default, _sizing2.default, _gradient2.default, _transition2.default, _flexboxIE2.default, _flexboxOld2.default, _flex2.default];
/**
* Returns a prefixed version of the style object using all vendor prefixes
* @param {Object} styles - Style object that gets prefixed properties added
* @returns {Object} - Style object with prefixed properties and values
*/
function prefixAll(styles) {
Object.keys(styles).forEach(function (property) {
var value = styles[property];
if (value instanceof Object && !Array.isArray(value)) {
// recurse through nested style objects
styles[property] = prefixAll(value);
} else {
Object.keys(_prefixProps2.default).forEach(function (prefix) {
var properties = _prefixProps2.default[prefix];
// add prefixes if needed
if (properties[property]) {
styles[prefix + (0, _capitalizeString2.default)(property)] = value;
}
});
}
});
Object.keys(styles).forEach(function (property) {
[].concat(styles[property]).forEach(function (value, index) {
// resolve every special plugins
plugins.forEach(function (plugin) {
return assignStyles(styles, plugin(property, value));
});
});
});
return styles;
}
function assignStyles(base) {
var extend = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
Object.keys(extend).forEach(function (property) {
var baseValue = base[property];
if (Array.isArray(baseValue)) {
[].concat(extend[property]).forEach(function (value) {
var valueIndex = baseValue.indexOf(value);
if (valueIndex > -1) {
base[property].splice(valueIndex, 1);
}
base[property].push(value);
});
} else {
base[property] = extend[property];
}
});
}
module.exports = exports['default'];
});
var prefixAll$1 = interopDefault(prefixAll);
var require$$0$2 = Object.freeze({
default: prefixAll$1
});
var _static = createCommonjsModule$$1(function (module) {
module.exports = interopDefault(require$$0$2)
});
var _static$1 = interopDefault(_static);
var require$$2 = Object.freeze({
default: _static$1
});
var index$8 = createCommonjsModule$$1(function (module) {
/**
* Export.
*/
module.exports = toNoCase
/**
* Test whether a string is camel-case.
*/
var hasSpace = /\s/
var hasSeparator = /[\W_]/
var hasCamel = /([a-z][A-Z]|[A-Z][a-z])/
/**
* Remove any starting case from a `string`, like camel or snake, but keep
* spaces and punctuation that may be important otherwise.
*
* @param {String} string
* @return {String}
*/
function toNoCase(string) {
if (hasSpace.test(string)) { return string.toLowerCase() }
if (hasSeparator.test(string)) { return (unseparate(string) || string).toLowerCase() }
if (hasCamel.test(string)) { return uncamelize(string).toLowerCase() }
return string.toLowerCase()
}
/**
* Separator splitter.
*/
var separatorSplitter = /[\W_]+(.|$)/g
/**
* Un-separate a `string`.
*
* @param {String} string
* @return {String}
*/
function unseparate(string) {
return string.replace(separatorSplitter, function (m, next) {
return next ? ' ' + next : ''
})
}
/**
* Camelcase splitter.
*/
var camelSplitter = /(.)([A-Z]+)/g
/**
* Un-camelcase a `string`.
*
* @param {String} string
* @return {String}
*/
function uncamelize(string) {
return string.replace(camelSplitter, function (m, previous, uppers) {
return previous + ' ' + uppers.toLowerCase().split('').join(' ')
})
}
});
var index$9 = interopDefault(index$8);
var require$$0$6 = Object.freeze({
default: index$9
});
var index$6 = createCommonjsModule$$1(function (module) {
var clean = interopDefault(require$$0$6)
/**
* Export.
*/
module.exports = toSpaceCase
/**
* Convert a `string` to space case.
*
* @param {String} string
* @return {String}
*/
function toSpaceCase(string) {
return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) {
return match ? ' ' + match : ''
}).trim()
}
});
var index$7 = interopDefault(index$6);
var require$$0$5 = Object.freeze({
default: index$7
});
var index$4 = createCommonjsModule$$1(function (module) {
var space = interopDefault(require$$0$5)
/**
* Export.
*/
module.exports = toCamelCase
/**
* Convert a `string` to camel case.
*
* @param {String} string
* @return {String}
*/
function toCamelCase(string) {
return space(string).replace(/\s(\w)/g, function (matches, letter) {
return letter.toUpperCase()
})
}
});
var index$5 = interopDefault(index$4);
var require$$1$5 = Object.freeze({
default: index$5
});
var index$10 = createCommonjsModule$$1(function (module) {
var toSpace = interopDefault(require$$0$5)
/**
* Export.
*/
module.exports = toSlugCase
/**
* Convert a `string` to slug case.
*
* @param {String} string
* @return {String}
*/
function toSlugCase(string) {
return toSpace(string).replace(/\s/g, '-')
}
});
var index$11 = interopDefault(index$10);
var require$$0$7 = Object.freeze({
default: index$11
});
var prefix = createCommonjsModule$$1(function (module) {
/**
* Module dependencies
*/
var prefixes = interopDefault(require$$2)
var camel = interopDefault(require$$1$5)
var slug = interopDefault(require$$0$7)
/**
* Export `prefix`
*/
module.exports = prefix
/**
* Initialize `prefix`
*/
function prefix (key, value) {
key = camel(key)
var obj = {}
obj[key] = value
obj = prefixes(obj)
var out = {}
for (var k in obj) {
var str = slug(k)
// add hyphen in front of browser prefixes
str = ~str.search(/^(webkit|moz|ms)/) ? '-' + str : str
out[str] = obj[k]
}
return out
}
});
var prefix$1 = interopDefault(prefix);
var require$$0$1 = Object.freeze({
default: prefix$1
});
var stringify = createCommonjsModule$$1(function (module) {
/**
* Module Dependencies
*/
var prefix = interopDefault(require$$0$1)
var isArray = Array.isArray
/**
* Export `stringify`
*/
module.exports = stringify
/**
* Browser keyframes
*/
var prefixes = [
'-webkit-',
'-moz-',
''
]
/**
* Selector
*/
var rselector = /\.([^\s]+)/g
/**
* Stringify
*/
function stringify (rule, classes, id) {
// handle rules
if (rule.type === 'rule') {
var selectors = rule.selectors.map(function (s) {
return selector(s, classes, id)
}).join(', ')
var decs = declarations(rule.declarations)
return (selectors + " { " + decs + " }")
}
// @media
if (rule.type === 'media') {
var rules = rule.rules.map(function (rule) { return stringify(rule, classes, id); }).join('\n')
return ("@media " + (rule.media) + " {\n" + rules + "\n}")
}
// handle @keyframes
if (rule.type === 'keyframes') {
return prefixes.reduce(function (keyframe, prefix) {
var keys = keyframes(rule.keyframes)
return keyframe.concat(("@" + prefix + "keyframes " + (rule.name) + " {\n" + keys + "}"))
}, []).join('\n')
}
// handle @font-faces
if (rule.type === 'font-face') {
return ("@font-face { " + (declarations(rule.declarations)) + " }")
}
}
function selector (selector, classes, id) {
return selector.replace(rselector, function (m, cls) {
var psuedos = cls.split(':')
var tag = psuedos.shift()
tag = classes[tag] && classes[tag][id] ? classes[tag][id] : tag
psuedos.unshift(tag)
return '.' + psuedos.join(':')
})
}
function declarations (declarations) {
return declarations.reduce(function (decs, dec) {
if (dec.type === 'comment') { return decs }
var obj = prefix(dec.property, dec.value)
var loop = function ( k ) {
if (isArray(obj[k])) {
obj[k].forEach(function (v) { return decs.push((k + ": " + v + ";")); })
} else {
decs.push((k + ": " + (obj[k]) + ";"))
}
};
for (var k in obj) { loop( k ); }
return decs
}, []).join(' ')
}
function keyframes (keyframes) {
return keyframes.reduce(function (keys, keyframe) {
var values = keyframe.values.join(', ')
keys += values + " { " + (declarations(keyframe.declarations)) + " }\n"
return keys
}, '')
}
});
var stringify$1 = interopDefault(stringify);
var require$$1$1 = Object.freeze({
default: stringify$1
});
var render = createCommonjsModule$$1(function (module) {
/**
* Module dependencies
*/
var stringify = interopDefault(require$$1$1)
var Hash = interopDefault(require$$0)
/**
* Export `Render`
*/
module.exports = Render
/**
* Initialize `Render`
*/
function Render (asts, classes) {
var styles = []
var dedupe = {}
for (var i = 0, ast; ast = asts[i]; i++) {
for (var j = 0, rule; rule = ast.rules[j]; j++) {
if (rule.type === 'comment') { continue }
var compiled = stringify(rule, classes, ast.id)
var hash = Hash(compiled)
if (dedupe[hash]) { continue }
styles.push(compiled)
dedupe[hash] = true
}
}
return styles.join('\n')
}
});
var render$1 = interopDefault(render);
var require$$4 = Object.freeze({
default: render$1
});
var deepExtend = createCommonjsModule$$1(function (module) {
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2015 Viacheslav Lotsmanov
*
* 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.
*/
'use strict';
function isSpecificValue(val) {
return (
val instanceof Buffer
|| val instanceof Date
|| val instanceof RegExp
) ? true : false;
}
function cloneSpecificValue(val) {
if (val instanceof Buffer) {
var x = new Buffer(val.length);
val.copy(x);
return x;
} else if (val instanceof Date) {
return new Date(val.getTime());
} else if (val instanceof RegExp) {
return new RegExp(val);
} else {
throw new Error('Unexpected situation');
}
}
/**
* Recursive cloning array.
*/
function deepCloneArray(arr) {
var clone = [];
arr.forEach(function (item, index) {
if (typeof item === 'object' && item !== null) {
if (Array.isArray(item)) {
clone[index] = deepCloneArray(item);
} else if (isSpecificValue(item)) {
clone[index] = cloneSpecificValue(item);
} else {
clone[index] = deepExtend({}, item);
}
} else {
clone[index] = item;
}
});
return clone;
}
/**
* Extening object that entered in first argument.
*
* Returns extended object or false if have no target object or incorrect type.
*
* If you wish to clone source object (without modify it), just use empty new
* object as first argument, like this:
* deepExtend({}, yourObj_1, [yourObj_N]);
*/
var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
return false;
}
if (arguments.length < 2) {
return arguments[0];
}
var target = arguments[0];
// convert arguments to array and cut off target object
var args = Array.prototype.slice.call(arguments, 1);
var val, src, clone;
args.forEach(function (obj) {
// skip argument if it is array or isn't object
if (typeof obj !== 'object' || Array.isArray(obj)) {
return;
}
Object.keys(obj).forEach(function (key) {
src = target[key]; // source value
val = obj[key]; // new value
// recursion prevention
if (val === target) {
return;
/**
* if new value isn't object then just overwrite by new value
* instead of extending.
*/
} else if (typeof val !== 'object' || val === null) {
target[key] = val;
return;
// just clone arrays (and recursive clone objects inside)
} else if (Array.isArray(val)) {
target[key] = deepCloneArray(val);
return;
// custom cloning and overwrite for specific objects
} else if (isSpecificValue(val)) {
target[key] = cloneSpecificValue(val);
return;
// overwrite by new value if source isn't object or array
} else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
target[key] = deepExtend({}, val);
return;
// source value and new value is objects both, extending...
} else {
target[key] = deepExtend(src, val);
return;
}
});
});
return target;
}
});
var deepExtend$1 = interopDefault(deepExtend);
var require$$3$2 = Object.freeze({
default: deepExtend$1
});
var parse = createCommonjsModule$$1(function (module) {
// http://www.w3.org/TR/CSS21/grammar.html
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g
/**
* Export `parse`
*/
module.exports = parse
/**
* Parse
*/
function parse (css, options) {
options = options || {}
/**
* Positional.
*/
var lineno = 1
var column = 1
/**
* Update lineno and column based on `str`.
*/
function updatePosition (str) {
var lines = str.match(/\n/g)
if (lines) { lineno += lines.length }
var i = str.lastIndexOf('\n')
column = ~i ? str.length - i : column + str.length
}
/**
* Mark position and patch `node.position`.
*/
function position () {
return { line: lineno, column: column }
}
function markPosition (start, node) {
node.position = new Position(start)
whitespace()
return node
}
/**
* Store position information for a node
*/
function Position (start) {
this.start = start
this.end = { line: lineno, column: column }
this.source = options.source
}
/**
* Non-enumerable source string
*/
Position.prototype.content = css
/**
* Error `msg`.
*/
var errorsList = []
function error (msg) {
var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg)
err.reason = msg
err.filename = options.source
err.line = lineno
err.column = column
err.source = css
if (options.silent) {
errorsList.push(err)
} else {
throw err
}
}
/**
* Parse stylesheet.
*/
function stylesheet () {
var rulesList = rules()
return {
type: 'stylesheet',
stylesheet: {
source: options.source,
rules: rulesList,
parsingErrors: errorsList
}
}
}
/**
* Opening brace.
*/
function open () {
return match(/^{\s*/)
}
/**
* Closing brace.
*/
function close () {
return match(/^}/)
}
/**
* Parse ruleset.
*/
function rules () {
var node
var rules = []
whitespace()
comments(rules)
while (css.length && css.charAt(0) != '}' && (node = atrule() || rule())) {
if (node !== false) {
rules.push(node)
comments(rules)
}
}
return rules
}
/**
* Match `re` and return captures.
*/
function match (re) {
var m = re.exec(css)
if (!m) { return }
var str = m[0]
updatePosition(str)
css = css.slice(str.length)
return m
}
/**
* Parse whitespace.
*/
function whitespace () {
match(/^\s*/)
}
/**
* Parse comments
*/
function comments (rules) {
var c
rules = rules || []
while (c = comment()) {
if (c !== false) {
rules.push(c)
}
}
return rules
}
/**
* Parse comment.
*/
function comment () {
var pos = position()
if ('/' != css.charAt(0) || '*' != css.charAt(1)) { return }
var i = 2
while ('' != css.charAt(i) && ('*' != css.charAt(i) || '/' != css.charAt(i + 1))) { ++i }
i += 2
if ('' === css.charAt(i - 1)) {
return error('End of comment missing')
}
var str = css.slice(2, i - 2)
column += 2
updatePosition(str)
css = css.slice(i)
column += 2
return markPosition(pos, {
type: 'comment',
comment: str
})
}
/**
* Parse selector.
*/
function selector () {
var m = match(/^([^{]+)/)
if (!m) { return }
/* @fix Remove all comments from selectors
* http://ostermiller.org/findcomment.html */
return trim(m[0])
.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '')
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) {
return m.replace(/,/g, '\u200C')
})
.split(/\s*(?![^(]*\)),\s*/)
.map(function (s) {
return s.replace(/\u200C/g, ',')
})
}
/**
* Parse declaration.
*/
function declaration () {
var pos = position()
// prop
var prop = match(/^(\*?[-#\/\*\\@\w]+(\[[0-9a-z_-]+\])?)\s*/)
if (!prop) { return }
prop = trim(prop[0])
// :
if (!match(/^:\s*/)) { return error("property missing ':'") }
// val
var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/)
var ret = markPosition(pos, {
type: 'declaration',
property: prop.replace(commentre, ''),
value: val ? trim(val[0]).replace(commentre, '') : ''
})
//
match(/^[;\s]*/)
return ret
}
/**
* Parse declarations.
*/
function declarations () {
var decls = []
if (!open()) { return error("missing '{'") }
comments(decls)
// declarations
var decl
while (decl = declaration()) {
if (decl !== false) {
decls.push(decl)
comments(decls)
}
}
if (!close()) { return error("missing '}'") }
return decls
}
/**
* Parse keyframe.
*/
function keyframe () {
var m
var vals = []
var pos = position()
while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
vals.push(m[1])
match(/^,\s*/)
}
if (!vals.length) { return }
return markPosition(pos, {
type: 'keyframe',
values: vals,