Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/******/ (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 = 46);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(12);
module.exports = function (it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var global = __webpack_require__(2);
var getOwnPropertyDescriptor = __webpack_require__(55).f;
var isForced = __webpack_require__(58);
var path = __webpack_require__(13);
var bind = __webpack_require__(36);
var createNonEnumerableProperty = __webpack_require__(3);
var has = __webpack_require__(6);
var wrapConstructor = function (NativeConstructor) {
var Wrapper = function (a, b, c) {
if (this instanceof NativeConstructor) {
switch (arguments.length) {
case 0: return new NativeConstructor();
case 1: return new NativeConstructor(a);
case 2: return new NativeConstructor(a, b);
} return new NativeConstructor(a, b, c);
} return NativeConstructor.apply(this, arguments);
};
Wrapper.prototype = NativeConstructor.prototype;
return Wrapper;
};
/*
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 PROTO = options.proto;
var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {});
var targetPrototype = target.prototype;
var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
for (key in source) {
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contains in native
USE_NATIVE = !FORCED && nativeSource && has(nativeSource, key);
targetProperty = target[key];
if (USE_NATIVE) if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor(nativeSource, key);
nativeProperty = descriptor && descriptor.value;
} else nativeProperty = nativeSource[key];
// export native or implementation
sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue;
// bind timers to global for call from export context
if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
// wrap global constructors for prevent changs in this version
else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
// make static versions for prototype methods
else if (PROTO && typeof sourceProperty == 'function') resultProperty = bind(Function.call, sourceProperty);
// default case
else resultProperty = sourceProperty;
// add a flag to not completely full polyfills
if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty(resultProperty, 'sham', true);
}
target[key] = resultProperty;
if (PROTO) {
VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
if (!has(path, VIRTUAL_PROTOTYPE)) {
createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
}
// export virtual prototype methods
path[VIRTUAL_PROTOTYPE][key] = sourceProperty;
// export real prototype methods
if (options.real && targetPrototype && !targetPrototype[key]) {
createNonEnumerableProperty(targetPrototype, key, sourceProperty);
}
}
}
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {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 == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
check(typeof self == 'object' && self) ||
check(typeof global == 'object' && global) ||
// eslint-disable-next-line no-new-func
Function('return this')();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(52)))
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(11);
var definePropertyModule = __webpack_require__(20);
var createPropertyDescriptor = __webpack_require__(21);
module.exports = DESCRIPTORS ? function (object, key, value) {
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
} return it;
};
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(2);
var shared = __webpack_require__(32);
var has = __webpack_require__(6);
var uid = __webpack_require__(33);
var NATIVE_SYMBOL = __webpack_require__(39);
var USE_SYMBOL_AS_UID = __webpack_require__(61);
var WellKnownSymbolsStore = shared('wks');
var Symbol = global.Symbol;
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
module.exports = function (name) {
if (!has(WellKnownSymbolsStore, name)) {
if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];
else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
} return WellKnownSymbolsStore[name];
};
/***/ }),
/* 6 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 7 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var path = __webpack_require__(13);
var aFunction = __webpack_require__(4);
var anObject = __webpack_require__(0);
var create = __webpack_require__(40);
var createNonEnumerableProperty = __webpack_require__(3);
var redefineAll = __webpack_require__(75);
var wellKnownSymbol = __webpack_require__(5);
var InternalStateModule = __webpack_require__(19);
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.get;
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var $return = function (value) {
var iterator = getInternalState(this).iterator;
var $$return = iterator['return'];
return $$return === undefined ? { done: true, value: value } : anObject($$return.call(iterator, value));
};
var $throw = function (value) {
var iterator = getInternalState(this).iterator;
var $$throw = iterator['throw'];
if ($$throw === undefined) throw value;
return $$throw.call(iterator, value);
};
module.exports = function (nextHandler, IS_ITERATOR) {
var IteratorProxy = function Iterator(state) {
state.next = aFunction(state.iterator.next);
state.done = false;
setInternalState(this, state);
};
IteratorProxy.prototype = redefineAll(create(path.Iterator.prototype), {
next: function next() {
var state = getInternalState(this);
var result = state.done ? undefined : nextHandler.apply(state, arguments);
return { done: state.done, value: result };
},
'return': $return,
'throw': $throw
});
if (!IS_ITERATOR) {
createNonEnumerableProperty(IteratorProxy.prototype, TO_STRING_TAG, 'Generator');
}
return IteratorProxy;
};
/***/ }),
/* 9 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(0);
var isArrayIteratorMethod = __webpack_require__(78);
var toLength = __webpack_require__(41);
var bind = __webpack_require__(36);
var getIteratorMethod = __webpack_require__(27);
var callWithSafeIterationClosing = __webpack_require__(17);
var Result = function (stopped, result) {
this.stopped = stopped;
this.result = result;
};
var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
var iterator, iterFn, index, length, result, next, step;
if (IS_ITERATOR) {
iterator = iterable;
} else {
iterFn = getIteratorMethod(iterable);
if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
// optimisation for array iterators
if (isArrayIteratorMethod(iterFn)) {
for (index = 0, length = toLength(iterable.length); length > index; index++) {
result = AS_ENTRIES
? boundFunction(anObject(step = iterable[index])[0], step[1])
: boundFunction(iterable[index]);
if (result && result instanceof Result) return result;
} return new Result(false);
}
iterator = iterFn.call(iterable);
}
next = iterator.next;
while (!(step = next.call(iterator)).done) {
result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
if (typeof result == 'object' && result && result instanceof Result) return result;
} return new Result(false);
};
iterate.stop = function (result) {
return new Result(true, result);
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(7);
// Thank's IE8 for his funny defineProperty
module.exports = !fails(function () {
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
/***/ }),
/* 12 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 13 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 14 */
/***/ (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);
};
/***/ }),
/* 15 */
/***/ (function(module, exports) {
module.exports = true;
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__(57);
var requireObjectCoercible = __webpack_require__(18);
module.exports = function (it) {
return IndexedObject(requireObjectCoercible(it));
};
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(0);
// 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;
}
};
/***/ }),
/* 18 */
/***/ (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;
};
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
var NATIVE_WEAK_MAP = __webpack_require__(51);
var global = __webpack_require__(2);
var isObject = __webpack_require__(12);
var createNonEnumerableProperty = __webpack_require__(3);
var objectHas = __webpack_require__(6);
var sharedKey = __webpack_require__(22);
var hiddenKeys = __webpack_require__(23);
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) {
createNonEnumerableProperty(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
};
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(11);
var IE8_DOM_DEFINE = __webpack_require__(29);
var anObject = __webpack_require__(0);
var toPrimitive = __webpack_require__(31);
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;
};
/***/ }),
/* 21 */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(32);
var uid = __webpack_require__(33);
var keys = shared('keys');
module.exports = function (key) {
return keys[key] || (keys[key] = uid(key));
};
/***/ }),
/* 23 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getPrototypeOf = __webpack_require__(37);
var createNonEnumerableProperty = __webpack_require__(3);
var has = __webpack_require__(6);
var wellKnownSymbol = __webpack_require__(5);
var IS_PURE = __webpack_require__(15);
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)) {
createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
}
module.exports = {
IteratorPrototype: IteratorPrototype,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(5);
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var test = {};
test[TO_STRING_TAG] = 'z';
module.exports = String(test) === '[object z]';
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
var TO_STRING_TAG_SUPPORT = __webpack_require__(25);
var classofRaw = __webpack_require__(35);
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 = TO_STRING_TAG_SUPPORT ? classofRaw : 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;
};
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(26);
var Iterators = __webpack_require__(9);
var wellKnownSymbol = __webpack_require__(5);
var ITERATOR = wellKnownSymbol('iterator');
module.exports = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(2);
var setGlobal = __webpack_require__(54);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || setGlobal(SHARED, {});
module.exports = store;
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(11);
var fails = __webpack_require__(7);
var createElement = __webpack_require__(30);
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(2);
var isObject = __webpack_require__(12);
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) : {};
};
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(12);
// `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");
};
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
var IS_PURE = __webpack_require__(15);
var store = __webpack_require__(28);
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.6.4',
mode: IS_PURE ? 'pure' : 'global',
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
});
/***/ }),
/* 33 */
/***/ (function(module, exports) {
var id = 0;
var postfix = Math.random();
module.exports = function (key) {
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
};
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $ = __webpack_require__(1);
var createIteratorConstructor = __webpack_require__(59);
var getPrototypeOf = __webpack_require__(37);
var setPrototypeOf = __webpack_require__(70);
var setToStringTag = __webpack_require__(43);
var createNonEnumerableProperty = __webpack_require__(3);
var redefine = __webpack_require__(44);
var wellKnownSymbol = __webpack_require__(5);
var IS_PURE = __webpack_require__(15);
var Iterators = __webpack_require__(9);
var IteratorsCore = __webpack_require__(24);
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') {
createNonEnumerableProperty(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) {
createNonEnumerableProperty(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;
};
/***/ }),
/* 35 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
var aFunction = __webpack_require__(4);
// 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);
};
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(6);
var toObject = __webpack_require__(38);
var sharedKey = __webpack_require__(22);
var CORRECT_PROTOTYPE_GETTER = __webpack_require__(60);
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;
};
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
var requireObjectCoercible = __webpack_require__(18);
// `ToObject` abstract operation
// https://tc39.github.io/ecma262/#sec-toobject
module.exports = function (argument) {
return Object(requireObjectCoercible(argument));
};
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(7);
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
// Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(0);
var defineProperties = __webpack_require__(62);
var enumBugKeys = __webpack_require__(42);
var hiddenKeys = __webpack_require__(23);
var html = __webpack_require__(67);
var documentCreateElement = __webpack_require__(30);
var sharedKey = __webpack_require__(22);
var GT = '>';
var LT = '<';
var PROTOTYPE = 'prototype';
var SCRIPT = 'script';
var IE_PROTO = sharedKey('IE_PROTO');
var EmptyConstructor = function () { /* empty */ };
var scriptTag = function (content) {
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
};
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
var NullProtoObjectViaActiveX = function (activeXDocument) {
activeXDocument.write(scriptTag(''));
activeXDocument.close();
var temp = activeXDocument.parentWindow.Object;
activeXDocument = null; // avoid memory leak
return temp;
};
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var NullProtoObjectViaIFrame = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = documentCreateElement('iframe');
var JS = 'java' + SCRIPT + ':';
var iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
// https://github.com/zloirock/core-js/issues/475
iframe.src = String(JS);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
return iframeDocument.F;
};
// Check for document.domain and active x support
// No need to use active x approach when document.domain is not set
// see https://github.com/es-shims/es5-shim/issues/150
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
// avoid IE GC bug
var activeXDocument;
var NullProtoObject = function () {
try {
/* global ActiveXObject */
activeXDocument = document.domain && new ActiveXObject('htmlfile');
} catch (error) { /* ignore */ }
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
var length = enumBugKeys.length;
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
return NullProtoObject();
};
hiddenKeys[IE_PROTO] = true;
// `Object.create` method
// https://tc39.github.io/ecma262/#sec-object.create
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
EmptyConstructor[PROTOTYPE] = anObject(O);
result = new EmptyConstructor();
EmptyConstructor[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = NullProtoObject();
return Properties === undefined ? result : defineProperties(result, Properties);
};
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(14);
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
};
/***/ }),
/* 42 */
/***/ (function(module, exports) {
// IE8- don't enum bug keys
module.exports = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
var TO_STRING_TAG_SUPPORT = __webpack_require__(25);
var defineProperty = __webpack_require__(20).f;
var createNonEnumerableProperty = __webpack_require__(3);
var has = __webpack_require__(6);
var toString = __webpack_require__(69);
var wellKnownSymbol = __webpack_require__(5);
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
module.exports = function (it, TAG, STATIC, SET_METHOD) {
if (it) {
var target = STATIC ? it : it.prototype;
if (!has(target, TO_STRING_TAG)) {
defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
}
if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
createNonEnumerableProperty(target, 'toString', toString);
}
}
};
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
var createNonEnumerableProperty = __webpack_require__(3);
module.exports = function (target, key, value, options) {
if (options && options.enumerable) target[key] = value;
else createNonEnumerableProperty(target, key, value);
};
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(14);
module.exports = function (it) {
var result = toInteger(it);
if (result < 0) throw RangeError("The argument can't be less than 0");
return result;
};
/***/ }),
/* 46 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Dropzone", function() { return Dropzone; });
/* harmony import */ var core_js_pure_features_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(47);
/* harmony import */ var core_js_pure_features_iterator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_pure_features_iterator__WEBPACK_IMPORTED_MODULE_0__);
/*
*
* More info at [www.dropzonejs.com](http://www.dropzonejs.com)
*
* Copyright (c) 2012, Matias Meno
*
* 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.
*
*/
// The Emitter class provides the ability to call `.on()` on Dropzone to listen
// to events.
// It is strongly based on component's emitter class, and I removed the
// functionality because of the dependency hell with different frameworks.
class Emitter {
// Add an event listener for given event
on(event, fn) {
this._callbacks = this._callbacks || {};
// Create namespace for this event
if (!this._callbacks[event]) {
this._callbacks[event] = [];
}
this._callbacks[event].push(fn);
return this;
}
emit(event, ...args) {
this._callbacks = this._callbacks || {};
let callbacks = this._callbacks[event];
if (callbacks) {
for (let callback of callbacks) {
callback.apply(this, args);
}
}
return this;
}
// Remove event listener for given event. If fn is not provided, all event
// listeners for that event will be removed. If neither is provided, all
// event listeners will be removed.
off(event, fn) {
if (!this._callbacks || arguments.length === 0) {
this._callbacks = {};
return this;
}
// specific event
let callbacks = this._callbacks[event];
if (!callbacks) {
return this;
}
// remove all handlers
if (arguments.length === 1) {
delete this._callbacks[event];
return this;
}
// remove specific handler
for (let i = 0; i < callbacks.length; i++) {
let callback = callbacks[i];
if (callback === fn) {
callbacks.splice(i, 1);
break;
}
}
return this;
}
}
class Dropzone extends Emitter {
static initClass() {
// Exposing the emitter class, mainly for tests
this.prototype.Emitter = Emitter;
/*
This is a list of all available events you can register on a dropzone object.
You can register an event handler like this:
dropzone.on("dragEnter", function() { });
*/
this.prototype.events = [
"drop",
"dragstart",
"dragend",
"dragenter",
"dragover",
"dragleave",
"addedfile",
"addedfiles",
"removedfile",
"thumbnail",
"error",
"errormultiple",
"processing",
"processingmultiple",
"uploadprogress",
"totaluploadprogress",
"sending",
"sendingmultiple",
"success",
"successmultiple",
"canceled",
"canceledmultiple",
"complete",
"completemultiple",
"reset",
"maxfilesexceeded",
"maxfilesreached",
"queuecomplete",
];
this.prototype.defaultOptions = {
/**
* Has to be specified on elements other than form (or when the form
* doesn't have an `action` attribute). You can also
* provide a function that will be called with `files` and
* must return the url (since `v3.12.0`)
*/
url: null,
/**
* Can be changed to `"put"` if necessary. You can also provide a function
* that will be called with `files` and must return the method (since `v3.12.0`).
*/
method: "post",
/**
* Will be set on the XHRequest.
*/
withCredentials: false,
/**
* The timeout for the XHR requests in milliseconds (since `v4.4.0`).
*/
timeout: 30000,
/**
* How many file uploads to process in parallel (See the
* Enqueuing file uploads documentation section for more info)
*/
parallelUploads: 2,
/**
* Whether to send multiple files in one request. If
* this it set to true, then the fallback file input element will
* have the `multiple` attribute as well. This option will
* also trigger additional events (like `processingmultiple`). See the events
* documentation section for more information.
*/
uploadMultiple: false,
/**
* Whether you want files to be uploaded in chunks to your server. This can't be
* used in combination with `uploadMultiple`.
*
* See [chunksUploaded](#config-chunksUploaded) for the callback to finalise an upload.
*/
chunking: false,
/**
* If `chunking` is enabled, this defines whether **every** file should be chunked,
* even if the file size is below chunkSize. This means, that the additional chunk
* form data will be submitted and the `chunksUploaded` callback will be invoked.
*/
forceChunking: false,
/**
* If `chunking` is `true`, then this defines the chunk size in bytes.
*/
chunkSize: 2000000,
/**
* If `true`, the individual chunks of a file are being uploaded simultaneously.
*/
parallelChunkUploads: false,
/**
* Whether a chunk should be retried if it fails.
*/
retryChunks: false,
/**
* If `retryChunks` is true, how many times should it be retried.
*/
retryChunksLimit: 3,
/**
* If not `null` defines how many files this Dropzone handles. If it exceeds,
* the event `maxfilesexceeded` will be called. The dropzone element gets the
* class `dz-max-files-reached` accordingly so you can provide visual feedback.
*/
maxFilesize: 256,
/**
* The name of the file param that gets transferred.
* **NOTE**: If you have the option `uploadMultiple` set to `true`, then
* Dropzone will append `[]` to the name.
*/
paramName: "file",
/**
* Whether thumbnails for images should be generated
*/
createImageThumbnails: true,
/**
* In MB. When the filename exceeds this limit, the thumbnail will not be generated.
*/
maxThumbnailFilesize: 10,
/**
* If `null`, the ratio of the image will be used to calculate it.
*/
thumbnailWidth: 120,
/**
* The same as `thumbnailWidth`. If both are null, images will not be resized.
*/
thumbnailHeight: 120,
/**
* How the images should be scaled down in case both, `thumbnailWidth` and `thumbnailHeight` are provided.
* Can be either `contain` or `crop`.
*/
thumbnailMethod: "crop",
/**
* If set, images will be resized to these dimensions before being **uploaded**.
* If only one, `resizeWidth` **or** `resizeHeight` is provided, the original aspect
* ratio of the file will be preserved.
*
* The `options.transformFile` function uses these options, so if the `transformFile` function
* is overridden, these options don't do anything.
*/
resizeWidth: null,
/**
* See `resizeWidth`.
*/
resizeHeight: null,
/**
* The mime type of the resized image (before it gets uploaded to the server).
* If `null` the original mime type will be used. To force jpeg, for example, use `image/jpeg`.
* See `resizeWidth` for more information.
*/
resizeMimeType: null,
/**
* The quality of the resized images. See `resizeWidth`.
*/
resizeQuality: 0.8,
/**
* How the images should be scaled down in case both, `resizeWidth` and `resizeHeight` are provided.
* Can be either `contain` or `crop`.
*/
resizeMethod: "contain",
/**
* The base that is used to calculate the filesize. You can change this to
* 1024 if you would rather display kibibytes, mebibytes, etc...
* 1024 is technically incorrect, because `1024 bytes` are `1 kibibyte` not `1 kilobyte`.
* You can change this to `1024` if you don't care about validity.
*/
filesizeBase: 1000,
/**
* Can be used to limit the maximum number of files that will be handled by this Dropzone
*/
maxFiles: null,
/**
* An optional object to send additional headers to the server. Eg:
* `{ "My-Awesome-Header": "header value" }`
*/
headers: null,
/**
* If `true`, the dropzone element itself will be clickable, if `false`
* nothing will be clickable.
*
* You can also pass an HTML element, a CSS selector (for multiple elements)
* or an array of those. In that case, all of those elements will trigger an
* upload when clicked.
*/
clickable: true,
/**
* Whether hidden files in directories should be ignored.
*/
ignoreHiddenFiles: true,
/**
* The default implementation of `accept` checks the file's mime type or
* extension against this list. This is a comma separated list of mime
* types or file extensions.
*
* Eg.: `image/*,application/pdf,.psd`
*
* If the Dropzone is `clickable` this option will also be used as
* [`accept`](https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept)
* parameter on the hidden file input as well.
*/
acceptedFiles: null,
/**
* **Deprecated!**
* Use acceptedFiles instead.
*/
acceptedMimeTypes: null,
/**
* If false, files will be added to the queue but the queue will not be
* processed automatically.
* This can be useful if you need some additional user input before sending
* files (or if you want want all files sent at once).
* If you're ready to send the file simply call `myDropzone.processQueue()`.
*
* See the [enqueuing file uploads](#enqueuing-file-uploads) documentation
* section for more information.
*/
autoProcessQueue: true,
/**
* If false, files added to the dropzone will not be queued by default.
* You'll have to call `enqueueFile(file)` manually.
*/
autoQueue: true,
/**
* If `true`, this will add a link to every file preview to remove or cancel (if
* already uploading) the file. The `dictCancelUpload`, `dictCancelUploadConfirmation`
* and `dictRemoveFile` options are used for the wording.
*/
addRemoveLinks: false,
/**
* Defines where to display the file previews – if `null` the
* Dropzone element itself is used. Can be a plain `HTMLElement` or a CSS
* selector. The element should have the `dropzone-previews` class so
* the previews are displayed properly.
*/
previewsContainer: null,
/**
* This is the element the hidden input field (which is used when clicking on the
* dropzone to trigger file selection) will be appended to. This might
* be important in case you use frameworks to switch the content of your page.
*
* Can be a selector string, or an element directly.
*/
hiddenInputContainer: "body",
/**
* If null, no capture type will be specified
* If camera, mobile devices will skip the file selection and choose camera
* If microphone, mobile devices will skip the file selection and choose the microphone
* If camcorder, mobile devices will skip the file selection and choose the camera in video mode
* On apple devices multiple must be set to false. AcceptedFiles may need to
* be set to an appropriate mime type (e.g. "image/*", "audio/*", or "video/*").
*/
capture: null,
/**
* **Deprecated**. Use `renameFile` instead.
*/
renameFilename: null,
/**
* A function that is invoked before the file is uploaded to the server and renames the file.
* This function gets the `File` as argument and can use the `file.name`. The actual name of the
* file that gets used during the upload can be accessed through `file.upload.filename`.
*/
renameFile: null,
/**
* If `true` the fallback will be forced. This is very useful to test your server
* implementations first and make sure that everything works as
* expected without dropzone if you experience problems, and to test
* how your fallbacks will look.
*/
forceFallback: false,
/**
* The text used before any files are dropped.
*/
dictDefaultMessage: "Drop files here to upload",
/**
* The text that replaces the default message text it the browser is not supported.
*/
dictFallbackMessage:
"Your browser does not support drag'n'drop file uploads.",
/**
* The text that will be added before the fallback form.
* If you provide a fallback element yourself, or if this option is `null` this will
* be ignored.
*/
dictFallbackText:
"Please use the fallback form below to upload your files like in the olden days.",
/**
* If the filesize is too big.
* `{{filesize}}` and `{{maxFilesize}}` will be replaced with the respective configuration values.
*/
dictFileTooBig:
"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
/**
* If the file doesn't match the file type.
*/
dictInvalidFileType: "You can't upload files of this type.",
/**
* If the server response was invalid.
* `{{statusCode}}` will be replaced with the servers status code.
*/
dictResponseError: "Server responded with {{statusCode}} code.",
/**
* If `addRemoveLinks` is true, the text to be used for the cancel upload link.
*/
dictCancelUpload: "Cancel upload",
/**
* The text that is displayed if an upload was manually canceled
*/
dictUploadCanceled: "Upload canceled.",
/**
* If `addRemoveLinks` is true, the text to be used for confirmation when cancelling upload.
*/
dictCancelUploadConfirmation:
"Are you sure you want to cancel this upload?",
/**
* If `addRemoveLinks` is true, the text to be used to remove a file.
*/
dictRemoveFile: "Remove file",
/**
* If this is not null, then the user will be prompted before removing a file.
*/
dictRemoveFileConfirmation: null,
/**
* Displayed if `maxFiles` is st and exceeded.
* The string `{{maxFiles}}` will be replaced by the configuration value.
*/
dictMaxFilesExceeded: "You can not upload any more files.",
/**
* Allows you to translate the different units. Starting with `tb` for terabytes and going down to
* `b` for bytes.
*/
dictFileSizeUnits: { tb: "TB", gb: "GB", mb: "MB", kb: "KB", b: "b" },
/**
* Called when dropzone initialized
* You can add event listeners here
*/
init() {},
/**
* Can be an **object** of additional parameters to transfer to the server, **or** a `Function`
* that gets invoked with the `files`, `xhr` and, if it's a chunked upload, `chunk` arguments. In case
* of a function, this needs to return a map.
*
* The default implementation does nothing for normal uploads, but adds relevant information for
* chunked uploads.
*
* This is the same as adding hidden input fields in the form element.
*/
params(files, xhr, chunk) {
if (chunk) {
return {
dzuuid: chunk.file.upload.uuid,
dzchunkindex: chunk.index,
dztotalfilesize: chunk.file.size,
dzchunksize: this.options.chunkSize,
dztotalchunkcount: chunk.file.upload.totalChunkCount,
dzchunkbyteoffset: chunk.index * this.options.chunkSize,
};
}
},
/**
* A function that gets a [file](https://developer.mozilla.org/en-US/docs/DOM/File)
* and a `done` function as parameters.
*
* If the done function is invoked without arguments, the file is "accepted" and will
* be processed. If you pass an error message, the file is rejected, and the error
* message will be displayed.
* This function will not be called if the file is too big or doesn't match the mime types.
*/
accept(file, done) {
return done();
},
/**
* The callback that will be invoked when all chunks have been uploaded for a file.
* It gets the file for which the chunks have been uploaded as the first parameter,
* and the `done` function as second. `done()` needs to be invoked when everything
* needed to finish the upload process is done.
*/
chunksUploaded: function (file, done) {
done();
},
/**
* Gets called when the browser is not supported.
* The default implementation shows the fallback input field and adds
* a text.
*/
fallback() {
// This code should pass in IE7... :(
let messageElement;
this.element.className = `${this.element.className} dz-browser-not-supported`;
for (let child of this.element.getElementsByTagName("div")) {
if (/(^| )dz-message($| )/.test(child.className)) {
messageElement = child;
child.className = "dz-message"; // Removes the 'dz-default' class
break;
}
}
if (!messageElement) {
messageElement = Dropzone.createElement(
'<div class="dz-message"><span></span></div>'
);
this.element.appendChild(messageElement);
}
let span = messageElement.getElementsByTagName("span")[0];
if (span) {
if (span.textContent != null) {
span.textContent = this.options.dictFallbackMessage;
} else if (span.innerText != null) {
span.innerText = this.options.dictFallbackMessage;
}
}
return this.element.appendChild(this.getFallbackForm());
},
/**
* Gets called to calculate the thumbnail dimensions.
*
* It gets `file`, `width` and `height` (both may be `null`) as parameters and must return an object containing:
*
* - `srcWidth` & `srcHeight` (required)
* - `trgWidth` & `trgHeight` (required)
* - `srcX` & `srcY` (optional, default `0`)
* - `trgX` & `trgY` (optional, default `0`)
*
* Those values are going to be used by `ctx.drawImage()`.
*/
resize(file, width, height, resizeMethod) {
let info = {
srcX: 0,
srcY: 0,
srcWidth: file.width,
srcHeight: file.height,
};
let srcRatio = file.width / file.height;
// Automatically calculate dimensions if not specified
if (width == null && height == null) {
width = info.srcWidth;
height = info.srcHeight;
} else if (width == null) {
width = height * srcRatio;
} else if (height == null) {
height = width / srcRatio;
}
// Make sure images aren't upscaled
width = Math.min(width, info.srcWidth);
height = Math.min(height, info.srcHeight);
let trgRatio = width / height;
if (info.srcWidth > width || info.srcHeight > height) {
// Image is bigger and needs rescaling
if (resizeMethod === "crop") {
if (srcRatio > trgRatio) {
info.srcHeight = file.height;
info.srcWidth = info.srcHeight * trgRatio;
} else {
info.srcWidth = file.width;
info.srcHeight = info.srcWidth / trgRatio;
}
} else if (resizeMethod === "contain") {
// Method 'contain'
if (srcRatio > trgRatio) {
height = width / srcRatio;
} else {
width = height * srcRatio;
}
} else {
throw new Error(`Unknown resizeMethod '${resizeMethod}'`);
}
}
info.srcX = (file.width - info.srcWidth) / 2;
info.srcY = (file.height - info.srcHeight) / 2;
info.trgWidth = width;
info.trgHeight = height;
return info;
},
/**
* Can be used to transform the file (for example, resize an image if necessary).
*
* The default implementation uses `resizeWidth` and `resizeHeight` (if provided) and resizes
* images according to those dimensions.
*
* Gets the `file` as the first parameter, and a `done()` function as the second, that needs
* to be invoked with the file when the transformation is done.
*/
transformFile(file, done) {
if (
(this.options.resizeWidth || this.options.resizeHeight) &&
file.type.match(/image.*/)
) {
return this.resizeImage(
file,
this.options.resizeWidth,
this.options.resizeHeight,
this.options.resizeMethod,
done
);
} else {
return done(file);
}
},
/**
* A string that contains the template used for each dropped
* file. Change it to fulfill your needs but make sure to properly
* provide all elements.
*
* If you want to use an actual HTML element instead of providing a String
* as a config option, you could create a div with the id `tpl`,
* put the template inside it and provide the element like this:
*
* document
* .querySelector('#tpl')
* .innerHTML
*
*/
previewTemplate: `\
<div class="dz-preview dz-file-preview">
<div class="dz-image"><img data-dz-thumbnail /></div>
<div class="dz-details">
<div class="dz-size"><span data-dz-size></span></div>
<div class="dz-filename"><span data-dz-name></span></div>
</div>
<div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>
<div class="dz-error-message"><span data-dz-errormessage></span></div>
<div class="dz-success-mark">
<svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Check</title>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF"></path>
</g>
</svg>
</div>
<div class="dz-error-mark">
<svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Error</title>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">
<path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z"></path>
</g>
</g>
</svg>
</div>
</div>\
`,
// END OPTIONS
// (Required by the dropzone documentation parser)
/*
Those functions register themselves to the events on init and handle all
the user interface specific stuff. Overwriting them won't break the upload
but can break the way it's displayed.
You can overwrite them if you don't like the default behavior. If you just
want to add an additional event handler, register it on the dropzone object
and don't overwrite those options.
*/
// Those are self explanatory and simply concern the DragnDrop.
drop(e) {
return this.element.classList.remove("dz-drag-hover");
},
dragstart(e) {},
dragend(e) {
return this.element.classList.remove("dz-drag-hover");
},
dragenter(e) {
return this.element.classList.add("dz-drag-hover");
},
dragover(e) {
return this.element.classList.add("dz-drag-hover");
},
dragleave(e) {
return this.element.classList.remove("dz-drag-hover");
},
paste(e) {},
// Called whenever there are no files left in the dropzone anymore, and the
// dropzone should be displayed as if in the initial state.
reset() {
return this.element.classList.remove("dz-started");
},
// Called when a file is added to the queue
// Receives `file`
addedfile(file) {
if (this.element === this.previewsContainer) {
this.element.classList.add("dz-started");
}
if (this.previewsContainer) {
file.previewElement = Dropzone.createElement(
this.options.previewTemplate.trim()
);
file.previewTemplate = file.previewElement; // Backwards compatibility
this.previewsContainer.appendChild(file.previewElement);
for (var node of file.previewElement.querySelectorAll(
"[data-dz-name]"
)) {
node.textContent = file.name;
}
for (node of file.previewElement.querySelectorAll("[data-dz-size]")) {
node.innerHTML = this.filesize(file.size);
}
if (this.options.addRemoveLinks) {
file._removeLink = Dropzone.createElement(
`<a class="dz-remove" href="javascript:undefined;" data-dz-remove>${this.options.dictRemoveFile}</a>`
);
file.previewElement.appendChild(file._removeLink);
}
let removeFileEvent = (e) => {
e.preventDefault();
e.stopPropagation();
if (file.status === Dropzone.UPLOADING) {
return Dropzone.confirm(
this.options.dictCancelUploadConfirmation,
() => this.removeFile(file)
);
} else {
if (this.options.dictRemoveFileConfirmation) {
return Dropzone.confirm(
this.options.dictRemoveFileConfirmation,
() => this.removeFile(file)
);
} else {
return this.removeFile(file);
}
}
};
for (let removeLink of file.previewElement.querySelectorAll(
"[data-dz-remove]"
)) {
removeLink.addEventListener("click", removeFileEvent);
}
}
},
// Called whenever a file is removed.
removedfile(file) {
if (
file.previewElement != null &&
file.previewElement.parentNode != null
) {
file.previewElement.parentNode.removeChild(file.previewElement);
}
return this._updateMaxFilesReachedClass();
},
// Called when a thumbnail has been generated
// Receives `file` and `dataUrl`
thumbnail(file, dataUrl) {
if (file.previewElement) {
file.previewElement.classList.remove("dz-file-preview");
for (let thumbnailElement of file.previewElement.querySelectorAll(
"[data-dz-thumbnail]"
)) {
thumbnailElement.alt = file.name;
thumbnailElement.src = dataUrl;
}
return setTimeout(
() => file.previewElement.classList.add("dz-image-preview"),
1
);
}
},
// Called whenever an error occurs
// Receives `file` and `message`
error(file, message) {
if (file.previewElement) {
file.previewElement.classList.add("dz-error");
if (typeof message !== "string" && message.error) {
message = message.error;
}
for (let node of file.previewElement.querySelectorAll(
"[data-dz-errormessage]"
)) {
node.textContent = message;
}
}
},
errormultiple() {},
// Called when a file gets processed. Since there is a cue, not all added
// files are processed immediately.
// Receives `file`
processing(file) {
if (file.previewElement) {
file.previewElement.classList.add("dz-processing");
if (file._removeLink) {
return (file._removeLink.innerHTML = this.options.dictCancelUpload);
}
}
},
processingmultiple() {},
// Called whenever the upload progress gets updated.
// Receives `file`, `progress` (percentage 0-100) and `bytesSent`.
// To get the total number of bytes of the file, use `file.size`
uploadprogress(file, progress, bytesSent) {
if (file.previewElement) {
for (let node of file.previewElement.querySelectorAll(
"[data-dz-uploadprogress]"
)) {
node.nodeName === "PROGRESS"
? (node.value = progress)
: (node.style.width = `${progress}%`);
}
}
},
// Called whenever the total upload progress gets updated.
// Called with totalUploadProgress (0-100), totalBytes and totalBytesSent
totaluploadprogress() {},
// Called just before the file is sent. Gets the `xhr` object as second
// parameter, so you can modify it (for example to add a CSRF token) and a
// `formData` object to add additional information.
sending() {},
sendingmultiple() {},
// When the complete upload is finished and successful
// Receives `file`
success(file) {
if (file.previewElement) {
return file.previewElement.classList.add("dz-success");
}
},
successmultiple() {},
// When the upload is canceled.
canceled(file) {
return this.emit("error", file, this.options.dictUploadCanceled);
},
canceledmultiple() {},
// When the upload is finished, either with success or an error.
// Receives `file`
complete(file) {
if (file._removeLink) {
file._removeLink.innerHTML = this.options.dictRemoveFile;
}
if (file.previewElement) {
return file.previewElement.classList.add("dz-complete");
}
},
completemultiple() {},
maxfilesexceeded() {},
maxfilesreached() {},
queuecomplete() {},
addedfiles() {},
};
this.prototype._thumbnailQueue = [];
this.prototype._processingThumbnail = false;
}
// global utility
static extend(target, ...objects) {
for (let object of objects) {
for (let key in object) {
let val = object[key];
target[key] = val;
}
}
return target;
}
constructor(el, options) {
super();
let fallback, left;
this.element = el;
// For backwards compatibility since the version was in the prototype previously
this.version = Dropzone.version;
this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(
/\n*/g,
""
);
this.clickableElements = [];
this.listeners = [];
this.files = []; // All files
if (typeof this.element === "string") {
this.element = document.querySelector(this.element);
}
// Not checking if instance of HTMLElement or Element since IE9 is extremely weird.
if (!this.element || this.element.nodeType == null) {
throw new Error("Invalid dropzone element.");
}
if (this.element.dropzone) {
throw new Error("Dropzone already attached.");
}
// Now add this dropzone to the instances.
Dropzone.instances.push(this);
// Put the dropzone inside the element itself.
this.element.dropzone = this;
let elementOptions =
(left = Dropzone.optionsForElement(this.element)) != null ? left : {};
this.options = Dropzone.extend(
{},
this.defaultOptions,
elementOptions,
options != null ? options : {}
);
// If the browser failed, just call the fallback and leave
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
return this.options.fallback.call(this);
}
// @options.url = @element.getAttribute "action" unless @options.url?
if (this.options.url == null) {
this.options.url = this.element.getAttribute("action");
}
if (!this.options.url) {
throw new Error("No URL provided.");
}
if (this.options.acceptedFiles && this.options.acceptedMimeTypes) {
throw new Error(
"You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated."
);
}
if (this.options.uploadMultiple && this.options.chunking) {
throw new Error("You cannot set both: uploadMultiple and chunking.");
}
// Backwards compatibility
if (this.options.acceptedMimeTypes) {
this.options.acceptedFiles = this.options.acceptedMimeTypes;
delete this.options.acceptedMimeTypes;
}
// Backwards compatibility
if (this.options.renameFilename != null) {
this.options.renameFile = (file) =>
this.options.renameFilename.call(this, file.name, file);
}
if (typeof this.options.method === "string") {
this.options.method = this.options.method.toUpperCase();
}
if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
// Remove the fallback
fallback.parentNode.removeChild(fallback);
}
// Display previews in the previewsContainer element or the Dropzone element unless explicitly set to false
if (this.options.previewsContainer !== false) {
if (this.options.previewsContainer) {
this.previewsContainer = Dropzone.getElement(
this.options.previewsContainer,
"previewsContainer"
);
} else {
this.previewsContainer = this.element;
}
}
if (this.options.clickable) {
if (this.options.clickable === true) {
this.clickableElements = [this.element];
} else {
this.clickableElements = Dropzone.getElements(
this.options.clickable,
"clickable"
);
}
}
this.init();
}
// Returns all files that have been accepted
getAcceptedFiles() {
return this.files.filter((file) => file.accepted).map((file) => file);
}
// Returns all files that have been rejected
// Not sure when that's going to be useful, but added for completeness.
getRejectedFiles() {
return this.files.filter((file) => !file.accepted).map((file) => file);
}
getFilesWithStatus(status) {
return this.files
.filter((file) => file.status === status)
.map((file) => file);
}
// Returns all files that are in the queue
getQueuedFiles() {
return this.getFilesWithStatus(Dropzone.QUEUED);
}
getUploadingFiles() {
return this.getFilesWithStatus(Dropzone.UPLOADING);
}
getAddedFiles() {
return this.getFilesWithStatus(Dropzone.ADDED);
}
// Files that are either queued or uploading
getActiveFiles() {
return this.files
.filter(
(file) =>
file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED
)
.map((file) => file);
}
// The function that gets called when Dropzone is initialized. You
// can (and should) setup event listeners inside this function.
init() {
// In case it isn't set already
if (this.element.tagName === "form") {
this.element.setAttribute("enctype", "multipart/form-data");
}
if (
this.element.classList.contains("dropzone") &&
!this.element.querySelector(".dz-message")
) {
this.element.appendChild(
Dropzone.createElement(
`<div class="dz-default dz-message"><button class="dz-button" type="button">${this.options.dictDefaultMessage}</button></div>`
)
);
}
if (this.clickableElements.length) {
let setupHiddenFileInput = () => {
if (this.hiddenFileInput) {
this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
}
this.hiddenFileInput = document.createElement("input");
this.hiddenFileInput.setAttribute("type", "file");
if (this.options.maxFiles === null || this.options.maxFiles > 1) {
this.hiddenFileInput.setAttribute("multiple", "multiple");
}
this.hiddenFileInput.className = "dz-hidden-input";
if (this.options.acceptedFiles !== null) {
this.hiddenFileInput.setAttribute(
"accept",
this.options.acceptedFiles
);
}
if (this.options.capture !== null) {
this.hiddenFileInput.setAttribute("capture", this.options.capture);
}
// Not setting `display="none"` because some browsers don't accept clicks
// on elements that aren't displayed.
this.hiddenFileInput.style.visibility = "hidden";
this.hiddenFileInput.style.position = "absolute";
this.hiddenFileInput.style.top = "0";
this.hiddenFileInput.style.left = "0";
this.hiddenFileInput.style.height = "0";
this.hiddenFileInput.style.width = "0";
Dropzone.getElement(
this.options.hiddenInputContainer,
"hiddenInputContainer"
).appendChild(this.hiddenFileInput);
return this.hiddenFileInput.addEventListener("change", () => {
let { files } = this.hiddenFileInput;
if (files.length) {
for (let file of files) {
this.addFile(file);
}
}
this.emit("addedfiles", files);
return setupHiddenFileInput();
});
};
setupHiddenFileInput();
}
this.URL = window.URL !== null ? window.URL : window.webkitURL;
// Setup all event listeners on the Dropzone object itself.
// They're not in @setupEventListeners() because they shouldn't be removed
// again when the dropzone gets disabled.
for (let eventName of this.events) {
this.on(eventName, this.options[eventName]);
}
this.on("uploadprogress", () => this.updateTotalUploadProgress());
this.on("removedfile", () => this.updateTotalUploadProgress());
this.on("canceled", (file) => this.emit("complete", file));
// Emit a `queuecomplete` event if all files finished uploading.
this.on("complete", (file) => {
if (
this.getAddedFiles().length === 0 &&
this.getUploadingFiles().length === 0 &&
this.getQueuedFiles().length === 0
) {
// This needs to be deferred so that `queuecomplete` really triggers after `complete`
return setTimeout(() => this.emit("queuecomplete"), 0);
}
});
const containsFiles = function (e) {
if (e.dataTransfer.types) {
// Because e.dataTransfer.types is an Object in
// IE, we need to iterate like this instead of
// using e.dataTransfer.types.some()
for (var i = 0; i < e.dataTransfer.types.length; i++) {
if (e.dataTransfer.types[i] === "Files") return true;
}
}
return false;
};
let noPropagation = function (e) {
// If there are no files, we don't want to stop
// propagation so we don't interfere with other
// drag and drop behaviour.
if (!containsFiles(e)) return;
e.stopPropagation();
if (e.preventDefault) {
return e.preventDefault();
} else {
return (e.returnValue = false);
}
};
// Create the listeners
this.listeners = [
{
element: this.element,
events: {
dragstart: (e) => {
return this.emit("dragstart", e);
},
dragenter: (e) => {
noPropagation(e);
return this.emit("dragenter", e);
},
dragover: (e) => {
// Makes it possible to drag files from chrome's download bar
// http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar
// Try is required to prevent bug in Internet Explorer 11 (SCRIPT65535 exception)
let efct;
try {
efct = e.dataTransfer.effectAllowed;
} catch (error) {}
e.dataTransfer.dropEffect =
"move" === efct || "linkMove" === efct ? "move" : "copy";
noPropagation(e);
return this.emit("dragover", e);
},
dragleave: (e) => {
return this.emit("dragleave", e);
},
drop: (e) => {
noPropagation(e);
return this.drop(e);
},
dragend: (e) => {
return this.emit("dragend", e);
},
},
// This is disabled right now, because the browsers don't implement it properly.
// "paste": (e) =>
// noPropagation e
// @paste e
},
];
this.clickableElements.forEach((clickableElement) => {
return this.listeners.push({
element: clickableElement,
events: {
click: (evt) => {
// Only the actual dropzone or the message element should trigger file selection
if (
clickableElement !== this.element ||
evt.target === this.element ||
Dropzone.elementInside(
evt.target,
this.element.querySelector(".dz-message")
)
) {
this.hiddenFileInput.click(); // Forward the click
}
return true;
},
},
});
});
this.enable();
return this.options.init.call(this);
}
// Not fully tested yet
destroy() {
this.disable();
this.removeAllFiles(true);
if (
this.hiddenFileInput != null ? this.hiddenFileInput.parentNode : undefined
) {
this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
this.hiddenFileInput = null;
}
delete this.element.dropzone;
return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);
}
updateTotalUploadProgress() {
let totalUploadProgress;
let totalBytesSent = 0;
let totalBytes = 0;
let activeFiles = this.getActiveFiles();
if (activeFiles.length) {
for (let file of this.getActiveFiles()) {
totalBytesSent += file.upload.bytesSent;
totalBytes += file.upload.total;
}
totalUploadProgress = (100 * totalBytesSent) / totalBytes;
} else {
totalUploadProgress = 100;
}
return this.emit(
"totaluploadprogress",
totalUploadProgress,
totalBytes,
totalBytesSent
);
}
// @options.paramName can be a function taking one parameter rather than a string.
// A parameter name for a file is obtained simply by calling this with an index number.
_getParamName(n) {
if (typeof this.options.paramName === "function") {
return this.options.paramName(n);
} else {
return `${this.options.paramName}${
this.options.uploadMultiple ? `[${n}]` : ""
}`;
}
}
// If @options.renameFile is a function,
// the function will be used to rename the file.name before appending it to the formData
_renameFile(file) {
if (typeof this.options.renameFile !== "function") {
return file.name;
}
return this.options.renameFile(file);
}
// Returns a form that can be used as fallback if the browser does not support DragnDrop