Skip to content

Instantly share code, notes, and snippets.

@arturi
Last active September 25, 2016 03:39
Show Gist options
  • Select an option

  • Save arturi/54e076cccc929cc567cb0aba38815105 to your computer and use it in GitHub Desktop.

Select an option

Save arturi/54e076cccc929cc567cb0aba38815105 to your computer and use it in GitHub Desktop.
requirebin sketch
var Uppy = require('uppy')
var uppy = new Uppy.Core({wait: false, debug: true})
uppy
.use(Uppy.DragDrop, {target: 'body'})
.use(Uppy.Tus10, {endpoint: 'http://master.tus.io:8080/files/'})
.run()
uppy.on('core:upload-success', (fileId, url) => {
console.log(url)
var img = new Image()
img.width = 300
img.alt = fileId
img.src = url
document.body.appendChild(img)
})
This file has been truncated, but you can view the full file.
setTimeout(function(){
;require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
},{}],2:[function(require,module,exports){
(function (process){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// Split a filename into [root, dir, basename, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
var splitPath = function(filename) {
return splitPathRe.exec(filename).slice(1);
};
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string') {
throw new TypeError('Arguments to path.resolve must be strings');
} else if (!path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = exports.isAbsolute(path),
trailingSlash = substr(path, -1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.isAbsolute = function(path) {
return path.charAt(0) === '/';
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
if (typeof p !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
return p;
}).join('/'));
};
// path.relative(from, to)
// posix version
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
exports.sep = '/';
exports.delimiter = ':';
exports.dirname = function(path) {
var result = splitPath(path),
root = result[0],
dir = result[1];
if (!root && !dir) {
// No dirname whatsoever
return '.';
}
if (dir) {
// It has a dirname, strip trailing slash
dir = dir.substr(0, dir.length - 1);
}
return root + dir;
};
exports.basename = function(path, ext) {
var f = splitPath(path)[2];
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function(path) {
return splitPath(path)[3];
};
function filter (xs, f) {
if (xs.filter) return xs.filter(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
if (f(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b'
? function (str, start, len) { return str.substr(start, len) }
: function (str, start, len) {
if (start < 0) start = str.length + start;
return str.substr(start, len);
}
;
}).call(this,require('_process'))
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2hvbWUvYWRtaW4vYnJvd3NlcmlmeS1jZG4vbm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL3BhdGgtYnJvd3NlcmlmeS9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7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XNlLWluc2Vuc2l0aXZlIG9uIHdpbmRvd3M/XG4gIGlmIChleHQgJiYgZi5zdWJzdHIoLTEgKiBleHQubGVuZ3RoKSA9PT0gZXh0KSB7XG4gICAgZiA9IGYuc3Vic3RyKDAsIGYubGVuZ3RoIC0gZXh0Lmxlbmd0aCk7XG4gIH1cbiAgcmV0dXJuIGY7XG59O1xuXG5cbmV4cG9ydHMuZXh0bmFtZSA9IGZ1bmN0aW9uKHBhdGgpIHtcbiAgcmV0dXJuIHNwbGl0UGF0aChwYXRoKVszXTtcbn07XG5cbmZ1bmN0aW9uIGZpbHRlciAoeHMsIGYpIHtcbiAgICBpZiAoeHMuZmlsdGVyKSByZXR1cm4geHMuZmlsdGVyKGYpO1xuICAgIHZhciByZXMgPSBbXTtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHhzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgIGlmIChmKHhzW2ldLCBpLCB4cykpIHJlcy5wdXNoKHhzW2ldKTtcbiAgICB9XG4gICAgcmV0dXJuIHJlcztcbn1cblxuLy8gU3RyaW5nLnByb3RvdHlwZS5zdWJzdHIgLSBuZWdhdGl2ZSBpbmRleCBkb24ndCB3b3JrIGluIElFOFxudmFyIHN1YnN0ciA9ICdhYicuc3Vic3RyKC0xKSA9PT0gJ2InXG4gICAgPyBmdW5jdGlvbiAoc3RyLCBzdGFydCwgbGVuKSB7IHJldHVybiBzdHIuc3Vic3RyKHN0YXJ0LCBsZW4pIH1cbiAgICA6IGZ1bmN0aW9uIChzdHIsIHN0YXJ0LCBsZW4pIHtcbiAgICAgICAgaWYgKHN0YXJ0IDwgMCkgc3RhcnQgPSBzdHIubGVuZ3RoICsgc3RhcnQ7XG4gICAgICAgIHJldHVybiBzdHIuc3Vic3RyKHN0YXJ0LCBsZW4pO1xuICAgIH1cbjtcbiJdfQ==
},{"_process":3}],3:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canMutationObserver = typeof window !== 'undefined'
&& window.MutationObserver;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return function (f) { return window.setImmediate(f) };
}
var queue = [];
if (canMutationObserver) {
var hiddenDiv = document.createElement("div");
var observer = new MutationObserver(function () {
var queueList = queue.slice();
queue.length = 0;
queueList.forEach(function (fn) {
fn();
});
});
observer.observe(hiddenDiv, { attributes: true });
return function nextTick(fn) {
if (!queue.length) {
hiddenDiv.setAttribute('yes', 'no');
}
queue.push(fn);
};
}
if (canPost) {
window.addEventListener('message', function (ev) {
var source = ev.source;
if ((source === window || source === null) && ev.data === 'process-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('process-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
},{}],4:[function(require,module,exports){
(function (global){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Utils = require('../core/Utils');
var _Utils2 = _interopRequireDefault(_Utils);
var _Translator = require('../core/Translator');
var _Translator2 = _interopRequireDefault(_Translator);
var _namespaceEmitter = require('namespace-emitter');
var _namespaceEmitter2 = _interopRequireDefault(_namespaceEmitter);
var _UppySocket = require('./UppySocket');
var _UppySocket2 = _interopRequireDefault(_UppySocket);
var _en_US = require('../locales/en_US');
var _en_US2 = _interopRequireDefault(_en_US);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// import deepFreeze from 'deep-freeze-strict'
/**
* Main Uppy core
*
* @param {object} opts general options, like locales, to show modal or not to show
*/
var Core = function () {
function Core(opts) {
_classCallCheck(this, Core);
// set default options
var defaultOptions = {
// load English as the default locales
locales: _en_US2.default,
autoProceed: true,
debug: false
};
// Merge default options with the ones set by user
this.opts = _extends({}, defaultOptions, opts);
// Dictates in what order different plugin types are ran:
this.types = ['presetter', 'orchestrator', 'progressindicator', 'acquirer', 'modifier', 'uploader', 'presenter', 'debugger'];
this.type = 'core';
// Container for different types of plugins
this.plugins = {};
this.translator = new _Translator2.default({ locales: this.opts.locales });
this.i18n = this.translator.translate.bind(this.translator);
this.getState = this.getState.bind(this);
this.updateMeta = this.updateMeta.bind(this);
this.initSocket = this.initSocket.bind(this);
this.log = this.log.bind(this);
this.addFile = this.addFile.bind(this);
this.bus = this.emitter = (0, _namespaceEmitter2.default)();
this.on = this.bus.on.bind(this.bus);
this.emit = this.bus.emit.bind(this.bus);
this.state = {
files: {},
capabilities: {},
totalProgress: 0
};
if (this.opts.debug) {
// for debugging and testing
global.UppyState = this.state;
global.uppyLog = '';
global.UppyAddFile = this.addFile.bind(this);
global._Uppy = this;
}
}
/**
* Iterate on all plugins and run `update` on them. Called each time when state changes
*
*/
Core.prototype.updateAll = function updateAll(state) {
var _this = this;
Object.keys(this.plugins).forEach(function (pluginType) {
_this.plugins[pluginType].forEach(function (plugin) {
plugin.update(state);
});
});
};
/**
* Updates state
*
* @param {newState} object
*/
Core.prototype.setState = function setState(stateUpdate) {
var newState = _extends({}, this.state, stateUpdate);
this.bus.emit('core:state-update', this.state, newState, stateUpdate);
this.state = newState;
this.updateAll(this.state);
// this.log('Updating state with: ')
// this.log(newState)
};
/**
* Gets current state, making sure to make a copy of the state object and pass that,
* instead of an actual reference to `this.state`
*
*/
Core.prototype.getState = function getState() {
// return deepFreeze(this.state)
return this.state;
};
Core.prototype.updateMeta = function updateMeta(data, fileID) {
var updatedFiles = _extends({}, this.getState().files);
var newMeta = _extends({}, updatedFiles[fileID].meta, data);
updatedFiles[fileID] = _extends({}, updatedFiles[fileID], {
meta: newMeta
});
this.setState({ files: updatedFiles });
};
Core.prototype.addFile = function addFile(file) {
var updatedFiles = _extends({}, this.state.files);
var fileName = file.name || 'noname';
var fileType = _Utils2.default.getFileType(file) ? _Utils2.default.getFileType(file).split('/') : ['', ''];
var fileTypeGeneral = fileType[0];
var fileTypeSpecific = fileType[1];
var fileExtension = _Utils2.default.getFileNameAndExtension(fileName)[1];
var isRemote = file.isRemote || false;
var fileID = _Utils2.default.generateFileID(fileName);
var newFile = {
source: file.source || '',
id: fileID,
name: fileName,
extension: fileExtension || '',
meta: {
name: fileName
},
type: {
general: fileTypeGeneral,
specific: fileTypeSpecific
},
data: file.data,
progress: {
percentage: 0,
uploadComplete: false,
uploadStarted: false
},
size: file.data.size || 0,
isRemote: isRemote,
remote: file.remote || ''
};
updatedFiles[fileID] = newFile;
this.setState({ files: updatedFiles });
this.bus.emit('file-added', fileID);
this.log('Added file: ' + fileName + ', ' + fileID);
if (fileTypeGeneral === 'image' && !isRemote) {
this.addThumbnail(newFile.id);
}
if (this.opts.autoProceed) {
this.bus.emit('core:upload');
}
};
Core.prototype.removeFile = function removeFile(fileID) {
var updatedFiles = _extends({}, this.getState().files);
delete updatedFiles[fileID];
this.setState({ files: updatedFiles });
};
Core.prototype.addThumbnail = function addThumbnail(fileID) {
var _this2 = this;
var file = this.getState().files[fileID];
_Utils2.default.readFile(file.data).then(function (imgDataURI) {
return _Utils2.default.createImageThumbnail(imgDataURI, 200);
}).then(function (thumbnail) {
var updatedFiles = _extends({}, _this2.getState().files);
var updatedFile = _extends({}, updatedFiles[fileID], {
preview: thumbnail
});
updatedFiles[fileID] = updatedFile;
_this2.setState({ files: updatedFiles });
});
};
/**
* Registers listeners for all global actions, like:
* `file-add`, `file-remove`, `upload-progress`, `reset`
*
*/
Core.prototype.actions = function actions() {
var _this3 = this;
// this.bus.on('*', (payload) => {
// console.log('emitted: ', this.event)
// console.log('with payload: ', payload)
// })
// const bus = this.bus
this.on('core:file-add', function (data) {
_this3.addFile(data);
});
// `remove-file` removes a file from `state.files`, for example when
// a user decides not to upload particular file and clicks a button to remove it
this.on('core:file-remove', function (fileID) {
_this3.removeFile(fileID);
});
this.on('core:upload-started', function (fileID, upload) {
var updatedFiles = _extends({}, _this3.getState().files);
var updatedFile = _extends({}, updatedFiles[fileID], _extends({}, {
progress: _extends({}, updatedFiles[fileID].progress, {
uploadStarted: Date.now()
})
}));
updatedFiles[fileID] = updatedFile;
_this3.setState({ files: updatedFiles });
});
this.on('core:upload-progress', function (data) {
var fileID = data.id;
var updatedFiles = _extends({}, _this3.getState().files);
if (!updatedFiles[fileID]) {
console.error('Trying to set progress for a file that’s not with us anymore: ', fileID);
return;
}
var updatedFile = _extends({}, updatedFiles[fileID], _extends({}, {
progress: _extends({}, updatedFiles[fileID].progress, {
bytesUploaded: data.bytesUploaded,
bytesTotal: data.bytesTotal,
percentage: Math.round((data.bytesUploaded / data.bytesTotal * 100).toFixed(2))
})
}));
updatedFiles[data.id] = updatedFile;
// calculate total progress, using the number of files currently uploading,
// multiplied by 100 and the summ of individual progress of each file
var inProgress = Object.keys(updatedFiles).filter(function (file) {
return updatedFiles[file].progress.uploadStarted;
});
var progressMax = inProgress.length * 100;
var progressAll = 0;
inProgress.forEach(function (file) {
progressAll = progressAll + updatedFiles[file].progress.percentage;
});
var totalProgress = Math.round((progressAll * 100 / progressMax).toFixed(2));
if (totalProgress === 100) {
var completeFiles = Object.keys(updatedFiles).filter(function (file) {
// this should be `uploadComplete`
return updatedFiles[file].progress.percentage === 100;
});
_this3.emit('core:success', completeFiles.length);
}
_this3.setState({
totalProgress: totalProgress,
files: updatedFiles
});
});
this.on('core:upload-success', function (fileID, uploadURL) {
var updatedFiles = _extends({}, _this3.getState().files);
var updatedFile = _extends({}, updatedFiles[fileID], {
progress: _extends({}, updatedFiles[fileID].progress, {
uploadComplete: true
}),
uploadURL: uploadURL
});
updatedFiles[fileID] = updatedFile;
_this3.setState({
files: updatedFiles
});
});
this.on('core:update-meta', function (data, fileID) {
_this3.updateMeta(data, fileID);
});
// show informer if offline
if (typeof window !== 'undefined') {
window.addEventListener('online', function () {
return _this3.isOnline(true);
});
window.addEventListener('offline', function () {
return _this3.isOnline(false);
});
setTimeout(function () {
return _this3.isOnline();
}, 3000);
}
};
Core.prototype.isOnline = function isOnline(status) {
var online = status || window.navigator.onLine;
if (!online) {
this.emit('is-offline');
this.emit('informer', 'No internet connection', 'error', 0);
this.wasOffline = true;
} else {
this.emit('is-online');
if (this.wasOffline) {
this.emit('informer', 'Connected!', 'success', 3000);
this.wasOffline = false;
}
}
};
/**
* Registers a plugin with Core
*
* @param {Class} Plugin object
* @param {Object} options object that will be passed to Plugin later
* @return {Object} self for chaining
*/
Core.prototype.use = function use(Plugin, opts) {
// Prepare props to pass to plugins
var props = {
getState: this.getState.bind(this),
setState: this.setState.bind(this),
updateMeta: this.updateMeta.bind(this),
addFile: this.addFile.bind(this),
i18n: this.i18n.bind(this),
bus: this.ee,
log: this.log.bind(this)
};
// Instantiate
var plugin = new Plugin(this, opts, props);
var pluginName = plugin.id;
this.plugins[plugin.type] = this.plugins[plugin.type] || [];
if (!pluginName) {
throw new Error('Your plugin must have a name');
}
if (!plugin.type) {
throw new Error('Your plugin must have a type');
}
var existsPluginAlready = this.getPlugin(pluginName);
if (existsPluginAlready) {
var msg = 'Already found a plugin named \'' + existsPluginAlready.name + '\'.\n Tried to use: \'' + pluginName + '\'.\n Uppy is currently limited to running one of every plugin.\n Share your use case with us over at\n https://github.com/transloadit/uppy/issues/\n if you want us to reconsider.';
throw new Error(msg);
}
this.plugins[plugin.type].push(plugin);
return this;
};
/**
* Find one Plugin by name
*
* @param string name description
*/
Core.prototype.getPlugin = function getPlugin(name) {
var foundPlugin = false;
this.iteratePlugins(function (plugin) {
var pluginName = plugin.id;
if (pluginName === name) {
foundPlugin = plugin;
return false;
}
});
return foundPlugin;
};
/**
* Iterate through all `use`d plugins
*
* @param function method description
*/
Core.prototype.iteratePlugins = function iteratePlugins(method) {
var _this4 = this;
Object.keys(this.plugins).forEach(function (pluginType) {
_this4.plugins[pluginType].forEach(method);
});
};
/**
* Logs stuff to console, only if `debug` is set to true. Silent in production.
*
* @return {String|Object} to log
*/
Core.prototype.log = function log(msg) {
if (!this.opts.debug) {
return;
}
if (msg === '' + msg) {
console.log('LOG: ' + msg);
} else {
console.dir(msg);
}
global.uppyLog = global.uppyLog + '\n' + 'DEBUG LOG: ' + msg;
};
Core.prototype.initSocket = function initSocket(opts) {
if (!this.socket) {
this.socket = new _UppySocket2.default(opts);
}
return this.socket;
};
Core.prototype.installAll = function installAll() {
var _this5 = this;
Object.keys(this.plugins).forEach(function (pluginType) {
_this5.plugins[pluginType].forEach(function (plugin) {
plugin.install();
});
});
};
/**
* Initializes actions, installs all plugins (by iterating on them and calling `install`), sets options
*
* (In the past was used to run a waterfall of runType plugin packs, like so:
* All preseters(data) --> All acquirers(data) --> All uploaders(data) --> done)
*/
Core.prototype.run = function run() {
this.log('Core is run, initializing actions, installing plugins...');
// setInterval(() => {
// this.updateAll(this.state)
// }, 1000)
this.actions();
// Forse set `autoProceed` option to false if there are multiple selector Plugins active
if (this.plugins.acquirer && this.plugins.acquirer.length > 1) {
this.opts.autoProceed = false;
}
// Install all plugins
this.installAll();
return;
};
return Core;
}();
exports.default = Core;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9jb3JlL0NvcmUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQ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bmcgYWN0aW9ucywgaW5zdGFsbGluZyBwbHVnaW5zLi4uJyk7XG5cbiAgICAvLyBzZXRJbnRlcnZhbCgoKSA9PiB7XG4gICAgLy8gICB0aGlzLnVwZGF0ZUFsbCh0aGlzLnN0YXRlKVxuICAgIC8vIH0sIDEwMDApXG5cbiAgICB0aGlzLmFjdGlvbnMoKTtcblxuICAgIC8vIEZvcnNlIHNldCBgYXV0b1Byb2NlZWRgIG9wdGlvbiB0byBmYWxzZSBpZiB0aGVyZSBhcmUgbXVsdGlwbGUgc2VsZWN0b3IgUGx1Z2lucyBhY3RpdmVcbiAgICBpZiAodGhpcy5wbHVnaW5zLmFjcXVpcmVyICYmIHRoaXMucGx1Z2lucy5hY3F1aXJlci5sZW5ndGggPiAxKSB7XG4gICAgICB0aGlzLm9wdHMuYXV0b1Byb2NlZWQgPSBmYWxzZTtcbiAgICB9XG5cbiAgICAvLyBJbnN0YWxsIGFsbCBwbHVnaW5zXG4gICAgdGhpcy5pbnN0YWxsQWxsKCk7XG5cbiAgICByZXR1cm47XG4gIH07XG5cbiAgcmV0dXJuIENvcmU7XG59KCk7XG5cbmV4cG9ydHMuZGVmYXVsdCA9IENvcmU7XG4vLyMgc291cmNlTWFwcGluZ1VSTD1Db3JlLmpzLm1hcCJdfQ==
},{"../core/Translator":5,"../core/Utils":7,"../locales/en_US":10,"./UppySocket":6,"namespace-emitter":55}],5:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _en_US = require('../locales/en_US');
var _en_US2 = _interopRequireDefault(_en_US);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Translates strings with interpolation & pluralization support.Extensible with custom dictionaries
* and pluralization functions.
*
* Borrows heavily from and inspired by Polyglot https://github.com/airbnb/polyglot.js,
* basically a stripped-down version of it. Differences: pluralization functions are not hardcoded
* and can be easily added among with dictionaries, nested objects are used for pluralization
* as opposed to `||||` delimeter
*
* Usage example: `translator.translate('files_chosen', {smart_count: 3})`
*
* @param {object} opts
*/
var Translator = function () {
function Translator(opts) {
_classCallCheck(this, Translator);
var defaultOptions = {
locales: _en_US2.default
};
this.opts = _extends({}, defaultOptions, opts);
this.locales = this.opts.locales;
this.locales.strings = _extends({}, _en_US2.default.strings, this.opts.locales.strings);
}
/**
* Takes a string with placeholder variables like `%{smart_count} file selected`
* and replaces it with values from options `{smart_count: 5}`
*
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
*
* @param {string} phrase that needs interpolation, with placeholders
* @param {object} options with values that will be used to replace placeholders
* @return {string} interpolated
*/
Translator.prototype.interpolate = function interpolate(phrase, options) {
var replace = String.prototype.replace;
var dollarRegex = /\$/g;
var dollarBillsYall = '$$$$';
for (var arg in options) {
if (arg !== '_' && options.hasOwnProperty(arg)) {
// Ensure replacement value is escaped to prevent special $-prefixed
// regex replace tokens. the "$$$$" is needed because each "$" needs to
// be escaped with "$" itself, and we need two in the resulting output.
var replacement = options[arg];
if (typeof replacement === 'string') {
replacement = replace.call(options[arg], dollarRegex, dollarBillsYall);
}
// We create a new `RegExp` each time instead of using a more-efficient
// string replace so that the same argument can be replaced multiple times
// in the same phrase.
phrase = replace.call(phrase, new RegExp('%\\{' + arg + '\\}', 'g'), replacement);
}
}
return phrase;
};
/**
* Public translate method
*
* @param {string} key
* @param {object} options with values that will be used later to replace placeholders in string
* @return {string} translated (and interpolated)
*/
Translator.prototype.translate = function translate(key, options) {
if (options && options.smart_count) {
var plural = this.locales.pluralize(options.smart_count);
return this.interpolate(this.opts.locales.strings[key][plural], options);
}
return this.interpolate(this.opts.locales.strings[key], options);
};
return Translator;
}();
exports.default = Translator;
//# sourceMappingURL=Translator.js.map
},{"../locales/en_US":10}],6:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _namespaceEmitter = require('namespace-emitter');
var _namespaceEmitter2 = _interopRequireDefault(_namespaceEmitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var UppySocket = function () {
function UppySocket(opts) {
var _this = this;
_classCallCheck(this, UppySocket);
this.queued = [];
this.isOpen = false;
this.socket = new WebSocket(opts.target);
this.emitter = (0, _namespaceEmitter2.default)();
this.socket.onopen = function (e) {
_this.isOpen = true;
while (_this.queued.length > 0 && _this.isOpen) {
var first = _this.queued[0];
_this.send(first.action, first.payload);
_this.queued = _this.queued.slice(1);
}
};
this.socket.onclose = function (e) {
_this.isOpen = false;
};
this._handleMessage = this._handleMessage.bind(this);
this.socket.onmessage = this._handleMessage;
this.close = this.close.bind(this);
this.emit = this.emit.bind(this);
this.on = this.on.bind(this);
this.once = this.once.bind(this);
this.send = this.send.bind(this);
}
UppySocket.prototype.close = function close() {
return this.socket.close();
};
UppySocket.prototype.send = function send(action, payload) {
// attach uuid
if (!this.isOpen) {
this.queued.push({ action: action, payload: payload });
return;
}
this.socket.send(JSON.stringify({
action: action,
payload: payload
}));
};
UppySocket.prototype.on = function on(action, handler) {
this.emitter.on(action, handler);
};
UppySocket.prototype.emit = function emit(action, payload) {
this.emitter.emit(action, payload);
};
UppySocket.prototype.once = function once(action, handler) {
this.emitter.once(action, handler);
};
UppySocket.prototype._handleMessage = function _handleMessage(e) {
try {
var message = JSON.parse(e.data);
this.emit(message.action, message.payload);
} catch (err) {
console.log(err);
}
};
return UppySocket;
}();
exports.default = UppySocket;
//# sourceMappingURL=UppySocket.js.map
},{"namespace-emitter":55}],7:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports.flatten = flatten;
exports.isTouchDevice = isTouchDevice;
exports.$ = $;
exports.$$ = $$;
exports.truncateString = truncateString;
exports.secondsToTime = secondsToTime;
exports.groupBy = groupBy;
exports.every = every;
exports.toArray = toArray;
exports.generateFileID = generateFileID;
exports.extend = extend;
exports.getProportionalImageHeight = getProportionalImageHeight;
exports.getFileType = getFileType;
exports.getFileNameAndExtension = getFileNameAndExtension;
exports.readFile = readFile;
exports.createImageThumbnail = createImageThumbnail;
exports.dataURItoBlob = dataURItoBlob;
exports.dataURItoFile = dataURItoFile;
exports.copyToClipboard = copyToClipboard;
exports.makeWorker = makeWorker;
exports.getSpeed = getSpeed;
exports.getETA = getETA;
exports.prettyETA = prettyETA;
var _mimeTypes = require('mime-types');
var _mimeTypes2 = _interopRequireDefault(_mimeTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise;
// import pica from 'pica'
/**
* A collection of small utility functions that help with dom manipulation, adding listeners,
* promises and other good things.
*
* @module Utils
*/
/**
* Shallow flatten nested arrays.
*/
function flatten(arr) {
return [].concat.apply([], arr);
}
function isTouchDevice() {
return 'ontouchstart' in window || // works on most browsers
navigator.maxTouchPoints; // works on IE10/11 and Surface
}
/**
* Shorter and fast way to select a single node in the DOM
* @param { String } selector - unique dom selector
* @param { Object } ctx - DOM node where the target of our search will is located
* @returns { Object } dom node found
*/
function $(selector, ctx) {
return (ctx || document).querySelector(selector);
}
/**
* Shorter and fast way to select multiple nodes in the DOM
* @param { String|Array } selector - DOM selector or nodes list
* @param { Object } ctx - DOM node where the targets of our search will is located
* @returns { Object } dom nodes found
*/
function $$(selector, ctx) {
var els;
if (typeof selector === 'string') {
els = (ctx || document).querySelectorAll(selector);
} else {
els = selector;
return Array.prototype.slice.call(els);
}
}
function truncateString(str, length) {
if (str.length > length) {
return str.substr(0, length / 2) + '...' + str.substr(str.length - length / 4, str.length);
}
return str;
// more precise version if needed
// http://stackoverflow.com/a/831583
}
function secondsToTime(rawSeconds) {
var hours = Math.floor(rawSeconds / 3600) % 24;
var minutes = Math.floor(rawSeconds / 60) % 60;
var seconds = Math.floor(rawSeconds % 60);
return { hours: hours, minutes: minutes, seconds: seconds };
}
/**
* Partition array by a grouping function.
* @param {[type]} array Input array
* @param {[type]} groupingFn Grouping function
* @return {[type]} Array of arrays
*/
function groupBy(array, groupingFn) {
return array.reduce(function (result, item) {
var key = groupingFn(item);
var xs = result.get(key) || [];
xs.push(item);
result.set(key, xs);
return result;
}, new Map());
}
/**
* Tests if every array element passes predicate
* @param {Array} array Input array
* @param {Object} predicateFn Predicate
* @return {bool} Every element pass
*/
function every(array, predicateFn) {
return array.reduce(function (result, item) {
if (!result) {
return false;
}
return predicateFn(item);
}, true);
}
/**
* Converts list into array
*/
function toArray(list) {
return Array.prototype.slice.call(list || [], 0);
}
/**
* Takes a fileName and turns it into fileID, by converting to lowercase,
* removing extra characters and adding unix timestamp
*
* @param {String} fileName
*
*/
function generateFileID(fileName) {
var fileID = fileName.toLowerCase();
fileID = fileID.replace(/[^A-Z0-9]/ig, '');
fileID = fileID + Date.now();
return fileID;
}
function extend() {
for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
objs[_key] = arguments[_key];
}
return Object.assign.apply(this, [{}].concat(objs));
}
/**
* Takes function or class, returns its name.
* Because IE doesn’t support `constructor.name`.
* https://gist.github.com/dfkaye/6384439, http://stackoverflow.com/a/15714445
*
* @param {Object} fn — function
*
*/
// function getFnName (fn) {
// var f = typeof fn === 'function'
// var s = f && ((fn.name && ['', fn.name]) || fn.toString().match(/function ([^\(]+)/))
// return (!f && 'not a function') || (s && s[1] || 'anonymous')
// }
function getProportionalImageHeight(img, newWidth) {
var aspect = img.width / img.height;
var newHeight = Math.round(newWidth / aspect);
return newHeight;
}
function getFileType(file) {
if (file.type) {
return file.type;
}
return _mimeTypes2.default.lookup(file.name);
}
// returns [fileName, fileExt]
function getFileNameAndExtension(fullFileName) {
var re = /(?:\.([^.]+))?$/;
var fileExt = re.exec(fullFileName)[1];
var fileName = fullFileName.replace('.' + fileExt, '');
return [fileName, fileExt];
}
/**
* Reads file as data URI from file object,
* the one you get from input[type=file] or drag & drop.
*
* @param {Object} file object
* @return {Promise} dataURL of the file
*
*/
function readFile(fileObj) {
return new _Promise(function (resolve, reject) {
var reader = new FileReader();
reader.addEventListener('load', function (ev) {
return resolve(ev.target.result);
});
reader.readAsDataURL(fileObj);
// function workerScript () {
// self.addEventListener('message', (e) => {
// const file = e.data.file
// try {
// const reader = new FileReaderSync()
// postMessage({
// file: reader.readAsDataURL(file)
// })
// } catch (err) {
// console.log(err)
// }
// })
// }
//
// const worker = makeWorker(workerScript)
// worker.postMessage({file: fileObj})
// worker.addEventListener('message', (e) => {
// const fileDataURL = e.data.file
// console.log('FILE _ DATA _ URL')
// return resolve(fileDataURL)
// })
});
}
/**
* Resizes an image to specified width and proportional height, using canvas
* See https://davidwalsh.name/resize-image-canvas,
* http://babalan.com/resizing-images-with-javascript/
* @TODO see if we need https://github.com/stomita/ios-imagefile-megapixel for iOS
*
* @param {String} Data URI of the original image
* @param {String} width of the resulting image
* @return {String} Data URI of the resized image
*/
function createImageThumbnail(imgDataURI, newWidth) {
return new _Promise(function (resolve, reject) {
var img = new Image();
img.addEventListener('load', function () {
var newImageWidth = newWidth;
var newImageHeight = getProportionalImageHeight(img, newImageWidth);
// create an off-screen canvas
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
// set its dimension to target size
canvas.width = newImageWidth;
canvas.height = newImageHeight;
// draw source image into the off-screen canvas:
// ctx.clearRect(0, 0, width, height)
ctx.drawImage(img, 0, 0, newImageWidth, newImageHeight);
// pica.resizeCanvas(img, canvas, (err) => {
// if (err) console.log(err)
// const thumbnail = canvas.toDataURL('image/png')
// return resolve(thumbnail)
// })
// encode image to data-uri with base64 version of compressed image
// canvas.toDataURL('image/jpeg', quality); // quality = [0.0, 1.0]
var thumbnail = canvas.toDataURL('image/png');
return resolve(thumbnail);
});
img.src = imgDataURI;
});
}
function dataURItoBlob(dataURI, opts, toFile) {
// get the base64 data
var data = dataURI.split(',')[1];
// user may provide mime type, if not get it from data URI
var mimeType = opts.mimeType || dataURI.split(',')[0].split(':')[1].split(';')[0];
// default to plain/text if data URI has no mimeType
if (mimeType == null) {
mimeType = 'plain/text';
}
var binary = atob(data);
var array = [];
for (var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
// Convert to a File?
if (toFile) {
return new File([new Uint8Array(array)], opts.name || '', { type: mimeType });
}
return new Blob([new Uint8Array(array)], { type: mimeType });
}
function dataURItoFile(dataURI, opts) {
return dataURItoBlob(dataURI, opts, true);
}
/**
* Copies text to clipboard by creating an almost invisible textarea,
* adding text there, then running execCommand('copy').
* Falls back to prompt() when the easy way fails (hello, Safari!)
* From http://stackoverflow.com/a/30810322
*
* @param {String} textToCopy
* @param {String} fallbackString
* @return {Promise}
*/
function copyToClipboard(textToCopy, fallbackString) {
fallbackString = fallbackString || 'Copy the URL below';
return new _Promise(function (resolve, reject) {
var textArea = document.createElement('textarea');
textArea.setAttribute('style', {
position: 'fixed',
top: 0,
left: 0,
width: '2em',
height: '2em',
padding: 0,
border: 'none',
outline: 'none',
boxShadow: 'none',
background: 'transparent'
});
textArea.value = textToCopy;
document.body.appendChild(textArea);
textArea.select();
var magicCopyFailed = function magicCopyFailed(err) {
document.body.removeChild(textArea);
window.prompt(fallbackString, textToCopy);
return reject('Oops, unable to copy displayed fallback prompt: ' + err);
};
try {
var successful = document.execCommand('copy');
if (!successful) {
return magicCopyFailed('copy command unavailable');
}
document.body.removeChild(textArea);
return resolve();
} catch (err) {
document.body.removeChild(textArea);
return magicCopyFailed(err);
}
});
}
// export function createInlineWorker (workerFunction) {
// let code = workerFunction.toString()
// code = code.substring(code.indexOf('{') + 1, code.lastIndexOf('}'))
//
// const blob = new Blob([code], {type: 'application/javascript'})
// const worker = new Worker(URL.createObjectURL(blob))
//
// return worker
// }
function makeWorker(script) {
var URL = window.URL || window.webkitURL;
var Blob = window.Blob;
var Worker = window.Worker;
if (!URL || !Blob || !Worker || !script) {
return null;
}
var code = script.toString();
code = code.substring(code.indexOf('{') + 1, code.lastIndexOf('}'));
var blob = new Blob([code]);
var worker = new Worker(URL.createObjectURL(blob));
return worker;
}
function getSpeed(fileProgress) {
if (!fileProgress.bytesUploaded) return 0;
var timeElapsed = new Date() - fileProgress.uploadStarted;
var uploadSpeed = fileProgress.bytesUploaded / (timeElapsed / 1000);
return uploadSpeed;
}
function getETA(fileProgress) {
if (!fileProgress.bytesUploaded) return 0;
var uploadSpeed = getSpeed(fileProgress);
var bytesRemaining = fileProgress.bytesTotal - fileProgress.bytesUploaded;
var secondsRemaining = Math.round(bytesRemaining / uploadSpeed * 10) / 10;
return secondsRemaining;
}
function prettyETA(seconds) {
var time = secondsToTime(seconds);
// Only display hours and minutes if they are greater than 0 but always
// display minutes if hours is being displayed
var hoursStr = time.hours ? time.hours + 'h' : '';
var minutesStr = time.hours || time.minutes ? time.minutes + 'm' : '';
var secondsStr = time.seconds + 's';
return hoursStr + ' ' + minutesStr + ' ' + secondsStr;
}
exports.default = {
generateFileID: generateFileID,
toArray: toArray,
every: every,
flatten: flatten,
groupBy: groupBy,
$: $,
$$: $$,
extend: extend,
readFile: readFile,
createImageThumbnail: createImageThumbnail,
getProportionalImageHeight: getProportionalImageHeight,
isTouchDevice: isTouchDevice,
getFileNameAndExtension: getFileNameAndExtension,
truncateString: truncateString,
getFileType: getFileType,
secondsToTime: secondsToTime,
dataURItoBlob: dataURItoBlob,
dataURItoFile: dataURItoFile,
getSpeed: getSpeed,
getETA: getETA,
makeWorker: makeWorker
};
//# sourceMappingURL=Utils.js.map
},{"es6-promise":51,"mime-types":52}],8:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _yoYo = require('yo-yo');
var _yoYo2 = _interopRequireDefault(_yoYo);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _yoYo2.default;
//# sourceMappingURL=html.js.map
},{"yo-yo":67}],9:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _Core = require('./Core');
var _Core2 = _interopRequireDefault(_Core);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Core2.default;
//# sourceMappingURL=index.js.map
},{"./Core":4}],10:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var en_US = {};
en_US.strings = {
chooseFile: 'Choose a file',
youHaveChosen: 'You have chosen: %{fileName}',
orDragDrop: 'or drag it here',
filesChosen: {
0: '%{smart_count} file selected',
1: '%{smart_count} files selected'
},
filesUploaded: {
0: '%{smart_count} file uploaded',
1: '%{smart_count} files uploaded'
},
files: {
0: '%{smart_count} file',
1: '%{smart_count} files'
},
uploadFiles: {
0: 'Upload %{smart_count} file',
1: 'Upload %{smart_count} files'
},
selectToUpload: 'Select files to upload',
closeModal: 'Close Modal',
upload: 'Upload',
importFrom: 'Import files from',
dashboardWindowTitle: 'Uppy Dashboard Window (Press escape to close)',
dashboardTitle: 'Uppy Dashboard',
copyLinkToClipboardSuccess: 'Link copied to clipboard.',
copyLinkToClipboardFallback: 'Copy the URL below',
done: 'Done',
localDisk: 'Local Disk',
dropPasteImport: 'Drop files here, paste or import from:',
fileProgress: 'File progress: upload speed and ETA',
numberOfSelectedFiles: 'Number of selected files',
uploadAllNewFiles: 'Upload all new files'
};
en_US.pluralize = function (n) {
if (n === 1) {
return 0;
}
return 1;
};
if (typeof window !== 'undefined' && typeof window.Uppy !== 'undefined') {
window.Uppy.locales.en_US = en_US;
}
exports.default = en_US;
//# sourceMappingURL=en_US.js.map
},{}],11:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<div class="Uppy UppyTheme--default UppyDashboard\n ', '\n ', '\n ', '"\n aria-hidden="', '"\n aria-label="', '"\n role="dialog"\n onpaste=', '>\n\n <div class="UppyDashboard-overlay"\n onclick=', '></div>\n\n <button class="UppyDashboard-close"\n aria-label="', '"\n title="', '"\n onclick=', '>', '</button>\n\n <div class="UppyDashboard-inner" tabindex="0">\n <div class="UppyDashboard-innerWrap">\n\n ', '\n\n ', '\n\n ', '\n\n <div class="UppyDashboard-actions">\n ', '\n\n ', '\n </div>\n\n ', '\n\n ', '\n\n <div class="UppyDashboard-progressindicators">\n ', '\n </div>\n\n </div>\n </div>\n </div>'], ['<div class="Uppy UppyTheme--default UppyDashboard\n ', '\n ', '\n ', '"\n aria-hidden="', '"\n aria-label="', '"\n role="dialog"\n onpaste=', '>\n\n <div class="UppyDashboard-overlay"\n onclick=', '></div>\n\n <button class="UppyDashboard-close"\n aria-label="', '"\n title="', '"\n onclick=', '>', '</button>\n\n <div class="UppyDashboard-inner" tabindex="0">\n <div class="UppyDashboard-innerWrap">\n\n ', '\n\n ', '\n\n ', '\n\n <div class="UppyDashboard-actions">\n ', '\n\n ', '\n </div>\n\n ', '\n\n ', '\n\n <div class="UppyDashboard-progressindicators">\n ', '\n </div>\n\n </div>\n </div>\n </div>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<div class="UppyDashboardContent-panel"\n id="', '--', '"\n role="tabpanel"\n aria-hidden="', '">\n <div class="UppyDashboardContent-bar">\n <h2 class="UppyDashboardContent-title">', ' ', '</h2>\n <button class="UppyDashboardContent-back"\n onclick=', '>', '</button>\n </div>\n ', '\n </div>'], ['<div class="UppyDashboardContent-panel"\n id="', '--', '"\n role="tabpanel"\n aria-hidden="', '">\n <div class="UppyDashboardContent-bar">\n <h2 class="UppyDashboardContent-title">', ' ', '</h2>\n <button class="UppyDashboardContent-back"\n onclick=', '>', '</button>\n </div>\n ', '\n </div>']);
exports.default = Dashboard;
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _FileList = require('./FileList');
var _FileList2 = _interopRequireDefault(_FileList);
var _Tabs = require('./Tabs');
var _Tabs2 = _interopRequireDefault(_Tabs);
var _FileCard = require('./FileCard');
var _FileCard2 = _interopRequireDefault(_FileCard);
var _UploadBtn = require('./UploadBtn');
var _UploadBtn2 = _interopRequireDefault(_UploadBtn);
var _ProgressCircle = require('./ProgressCircle');
var _ProgressCircle2 = _interopRequireDefault(_ProgressCircle);
var _StatusBar = require('./StatusBar');
var _StatusBar2 = _interopRequireDefault(_StatusBar);
var _Utils = require('../../core/Utils');
var _icons = require('./icons');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function Dashboard(props) {
// http://dev.edenspiekermann.com/2016/02/11/introducing-accessible-modal-dialog
// const uploadStartedFilesCount = uploadStartedFiles.length
// const completeFilesCount = completeFiles.length
// const inProgressFilesCount = inProgressFiles.length
// const totalFileCount = Object.keys(files).length
// const newFileCount = newFiles.length
var handleInputChange = function handleInputChange(ev) {
ev.preventDefault();
var files = (0, _Utils.toArray)(ev.target.files);
files.forEach(function (file) {
props.addFile({
source: props.id,
name: file.name,
type: file.type,
data: file
});
});
};
// @TODO Exprimental, work in progress
// no names, weird API, Chrome-only http://stackoverflow.com/a/22940020
var handlePaste = function handlePaste(ev) {
ev.preventDefault();
var files = (0, _Utils.toArray)(ev.clipboardData.items);
files.forEach(function (file) {
if (file.kind !== 'file') return;
var blob = file.getAsFile();
// console.log(blob)
// console.log(blob.size)
props.log('File pasted');
props.addFile({
source: props.id,
name: file.name,
type: file.type,
data: blob
});
});
};
return (0, _html2.default)(_templateObject, (0, _Utils.isTouchDevice)() ? 'Uppy--isTouchDevice' : '', props.semiTransparent ? 'UppyDashboard--semiTransparent' : '', !props.inline ? 'UppyDashboard--modal' : '', props.inline ? 'false' : props.modal.isHidden, !props.inline ? props.i18n('dashboardWindowTitle') : props.i18n('dashboardTitle'), handlePaste, props.hideModal, props.i18n('closeModal'), props.i18n('closeModal'), props.hideModal, (0, _icons.closeIcon)(), (0, _Tabs2.default)({
handleInputChange: handleInputChange,
acquirers: props.acquirers,
container: props.container,
panelSelectorPrefix: props.panelSelectorPrefix,
showPanel: props.showPanel,
i18n: props.i18n
}), (0, _FileCard2.default)({
files: props.files,
fileCardFor: props.fileCardFor,
done: props.fileCardDone,
metaFields: props.metaFields,
log: props.log,
i18n: props.i18n
}), (0, _FileList2.default)({
files: props.files,
showFileCard: props.showFileCard,
showProgressDetails: props.showProgressDetails,
totalProgress: props.totalProgress,
totalFileCount: props.totalFileCount,
info: props.info,
i18n: props.i18n,
log: props.log,
removeFile: props.removeFile,
pauseAll: props.pauseAll,
resumeAll: props.resumeAll,
pauseUpload: props.pauseUpload,
startUpload: props.startUpload
}), !props.autoProceed && props.newFiles.length > 0 ? (0, _UploadBtn2.default)({
i18n: props.i18n,
startUpload: props.startUpload,
newFileCount: props.newFiles.length
}) : null, props.uploadStartedFiles.length > 0 ? (0, _ProgressCircle2.default)({
totalProgress: props.totalProgress,
isAllPaused: props.isAllPaused,
isAllComplete: props.isAllComplete,
pauseAll: props.pauseAll,
resumeAll: props.resumeAll
}) : null, props.uploadStartedFiles.length > 0 ? (0, _StatusBar2.default)({
totalProgress: props.totalProgress,
isAllComplete: props.isAllComplete,
isAllPaused: props.isAllPaused,
complete: props.completeFiles.length,
inProgress: props.uploadStartedFiles.length,
totalSpeed: props.totalSpeed,
totalETA: props.totalETA
}) : null, props.acquirers.map(function (target) {
return (0, _html2.default)(_templateObject2, props.panelSelectorPrefix, target.id, target.isHidden, props.i18n('importFrom'), target.name, props.hideAllPanels, props.i18n('done'), target.render(props.state));
}), props.progressindicators.map(function (target) {
return target.render(props.state);
}));
}
//# sourceMappingURL=Dashboard.js.map
},{"../../core/Utils":7,"../../core/html":8,"./FileCard":12,"./FileList":15,"./ProgressCircle":16,"./StatusBar":17,"./Tabs":18,"./UploadBtn":19,"./icons":20}],12:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<fieldset class="UppyDashboardFileCard-fieldset">\n <label class="UppyDashboardFileCard-label">', '</label>\n <input class="UppyDashboardFileCard-input"\n name="', '"\n type="text"\n value="', '"\n placeholder="', '"\n onkeyup=', ' /></fieldset>'], ['<fieldset class="UppyDashboardFileCard-fieldset">\n <label class="UppyDashboardFileCard-label">', '</label>\n <input class="UppyDashboardFileCard-input"\n name="', '"\n type="text"\n value="', '"\n placeholder="', '"\n onkeyup=', ' /></fieldset>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<div class="UppyDashboardFileCard" aria-hidden="', '">\n <div class="UppyDashboardContent-bar">\n <h2 class="UppyDashboardContent-title">Editing <span class="UppyDashboardContent-titleFile">', '</span></h2>\n <button class="UppyDashboardContent-back" title="Finish editing file"\n onclick=', '>Done</button>\n </div>\n ', '\n <button class="UppyButton--circular UppyButton--blue UppyButton--sizeM UppyDashboardFileCard-done" type="button"\n title="Finish editing file" onclick=', '>', '</button>\n </div>'], ['<div class="UppyDashboardFileCard" aria-hidden="', '">\n <div class="UppyDashboardContent-bar">\n <h2 class="UppyDashboardContent-title">Editing <span class="UppyDashboardContent-titleFile">', '</span></h2>\n <button class="UppyDashboardContent-back" title="Finish editing file"\n onclick=', '>Done</button>\n </div>\n ', '\n <button class="UppyButton--circular UppyButton--blue UppyButton--sizeM UppyDashboardFileCard-done" type="button"\n title="Finish editing file" onclick=', '>', '</button>\n </div>']),
_templateObject3 = _taggedTemplateLiteralLoose(['<div class="UppyDashboardFileCard-inner">\n <div class="UppyDashboardFileCard-preview">\n ', '\n </div>\n <div class="UppyDashboardFileCard-info">\n <fieldset class="UppyDashboardFileCard-fieldset">\n <label class="UppyDashboardFileCard-label">Name</label>\n <input class="UppyDashboardFileCard-input" name="name" type="text" value="', '"\n onkeyup=', ' />\n </fieldset>\n ', '\n </div>\n </div>'], ['<div class="UppyDashboardFileCard-inner">\n <div class="UppyDashboardFileCard-preview">\n ', '\n </div>\n <div class="UppyDashboardFileCard-info">\n <fieldset class="UppyDashboardFileCard-fieldset">\n <label class="UppyDashboardFileCard-label">Name</label>\n <input class="UppyDashboardFileCard-input" name="name" type="text" value="', '"\n onkeyup=', ' />\n </fieldset>\n ', '\n </div>\n </div>']),
_templateObject4 = _taggedTemplateLiteralLoose(['<img alt="', '" src="', '">'], ['<img alt="', '" src="', '">']),
_templateObject5 = _taggedTemplateLiteralLoose(['<div class="UppyDashboardItem-previewIcon">', '</div>'], ['<div class="UppyDashboardItem-previewIcon">', '</div>']);
exports.default = fileCard;
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _icons = require('./icons');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function getIconByMime(fileTypeGeneral) {
switch (fileTypeGeneral) {
case 'text':
return (0, _icons.iconText)();
case 'audio':
return (0, _icons.iconAudio)();
default:
return (0, _icons.iconFile)();
}
}
function fileCard(props) {
var file = props.fileCardFor ? props.files[props.fileCardFor] : false;
var meta = {};
function tempStoreMeta(ev) {
var value = ev.target.value;
var name = ev.target.attributes.name.value;
meta[name] = value;
}
function renderMetaFields(file) {
var metaFields = props.metaFields || [];
return metaFields.map(function (field) {
return (0, _html2.default)(_templateObject, field.name, field.id, file.meta[field.id], field.placeholder || '', tempStoreMeta);
});
}
return (0, _html2.default)(_templateObject2, !props.fileCardFor, file.meta ? file.meta.name : file.name, function () {
return props.done(meta, file.id);
}, props.fileCardFor ? (0, _html2.default)(_templateObject3, file.preview ? (0, _html2.default)(_templateObject4, file.name, file.preview) : (0, _html2.default)(_templateObject5, getIconByMime(file.type.general)), file.meta.name, tempStoreMeta, renderMetaFields(file)) : null, function () {
return props.done(meta, file.id);
}, (0, _icons.checkIcon)());
}
//# sourceMappingURL=FileCard.js.map
},{"../../core/html":8,"./icons":20}],13:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<li class="UppyDashboardItem\n ', '\n ', '\n ', '"\n id="uppy_', '"\n title="', '">\n <div class="UppyDashboardItem-preview">\n ', '\n <div class="UppyDashboardItem-progress">\n <button class="UppyDashboardItem-progressBtn"\n title="', '"\n onclick=', '>\n ', '\n </button>\n ', '\n </div>\n </div>\n <div class="UppyDashboardItem-info">\n <h4 class="UppyDashboardItem-name" title="', '">\n ', '\n </h4>\n <div class="UppyDashboardItem-status">\n <span class="UppyDashboardItem-statusSize">', '</span>\n </div>\n ', '\n ', '\n </div>\n <div class="UppyDashboardItem-action">\n ', '\n </div>\n </li>'], ['<li class="UppyDashboardItem\n ', '\n ', '\n ', '"\n id="uppy_', '"\n title="', '">\n <div class="UppyDashboardItem-preview">\n ', '\n <div class="UppyDashboardItem-progress">\n <button class="UppyDashboardItem-progressBtn"\n title="', '"\n onclick=', '>\n ', '\n </button>\n ', '\n </div>\n </div>\n <div class="UppyDashboardItem-info">\n <h4 class="UppyDashboardItem-name" title="', '">\n ', '\n </h4>\n <div class="UppyDashboardItem-status">\n <span class="UppyDashboardItem-statusSize">', '</span>\n </div>\n ', '\n ', '\n </div>\n <div class="UppyDashboardItem-action">\n ', '\n </div>\n </li>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<img alt="', '" src="', '">'], ['<img alt="', '" src="', '">']),
_templateObject3 = _taggedTemplateLiteralLoose(['<div class="UppyDashboardItem-progressInfo"\n title="', '"\n aria-label="', '">\n ', '\n </div>'], ['<div class="UppyDashboardItem-progressInfo"\n title="', '"\n aria-label="', '">\n ', '\n </div>']),
_templateObject4 = _taggedTemplateLiteralLoose(['<span>', ' ・ ↑ ', '/s</span>'], ['<span>', ' ・ ↑ ', '/s</span>']),
_templateObject5 = _taggedTemplateLiteralLoose(['<a href="', '" target="_blank">\n ', '\n </a>'], ['<a href="', '" target="_blank">\n ', '\n </a>']),
_templateObject6 = _taggedTemplateLiteralLoose(['<button class="UppyDashboardItem-edit"\n aria-label="Edit file"\n title="Edit file"\n onclick=', '>\n ', '</button>'], ['<button class="UppyDashboardItem-edit"\n aria-label="Edit file"\n title="Edit file"\n onclick=', '>\n ', '</button>']),
_templateObject7 = _taggedTemplateLiteralLoose(['<button class="UppyDashboardItem-copyLink"\n aria-label="Copy link"\n title="Copy link"\n onclick=', '>', '</button>'], ['<button class="UppyDashboardItem-copyLink"\n aria-label="Copy link"\n title="Copy link"\n onclick=', '>', '</button>']),
_templateObject8 = _taggedTemplateLiteralLoose(['<button class="UppyDashboardItem-remove"\n aria-label="Remove file"\n title="Remove file"\n onclick=', '>\n <svg width="22" height="21" viewBox="0 0 18 17">\n <ellipse fill="#000" cx="8.62" cy="8.383" rx="8.62" ry="8.383"/>\n <path stroke="#FFF" fill="#FFF" d="M11 6.147L10.85 6 8.5 8.284 6.15 6 6 6.147 8.35 8.43 6 10.717l.15.146L8.5 8.578l2.35 2.284.15-.146L8.65 8.43z"/>\n </svg>\n </button>'], ['<button class="UppyDashboardItem-remove"\n aria-label="Remove file"\n title="Remove file"\n onclick=', '>\n <svg width="22" height="21" viewBox="0 0 18 17">\n <ellipse fill="#000" cx="8.62" cy="8.383" rx="8.62" ry="8.383"/>\n <path stroke="#FFF" fill="#FFF" d="M11 6.147L10.85 6 8.5 8.284 6.15 6 6 6.147 8.35 8.43 6 10.717l.15.146L8.5 8.578l2.35 2.284.15-.146L8.65 8.43z"/>\n </svg>\n </button>']);
exports.default = fileItem;
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _Utils = require('../../core/Utils');
var _prettyBytes = require('pretty-bytes');
var _prettyBytes2 = _interopRequireDefault(_prettyBytes);
var _FileItemProgress = require('./FileItemProgress');
var _FileItemProgress2 = _interopRequireDefault(_FileItemProgress);
var _icons = require('./icons');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function getIconByMime(fileTypeGeneral) {
switch (fileTypeGeneral) {
case 'text':
return (0, _icons.iconText)();
case 'audio':
return (0, _icons.iconAudio)();
default:
return (0, _icons.iconFile)();
}
}
function fileItem(props) {
var file = props.file;
var isUploaded = file.progress.uploadComplete;
var uploadInProgressOrComplete = file.progress.uploadStarted;
var uploadInProgress = file.progress.uploadStarted && !file.progress.uploadComplete;
var isPaused = file.isPaused || false;
var fileName = (0, _Utils.getFileNameAndExtension)(file.meta.name)[0];
var truncatedFileName = (0, _Utils.truncateString)(fileName, 15);
return (0, _html2.default)(_templateObject, uploadInProgress ? 'is-inprogress' : '', isUploaded ? 'is-complete' : '', isPaused ? 'is-paused' : '', file.id, file.meta.name, file.preview ? (0, _html2.default)(_templateObject2, file.name, file.preview) : getIconByMime(file.type.general), isUploaded ? 'upload complete' : file.isPaused ? 'resume upload' : 'pause upload', function (ev) {
if (isUploaded) return;
props.pauseUpload(file.id);
}, (0, _FileItemProgress2.default)({
progress: file.progress.percentage,
fileID: file.id
}), props.showProgressDetails ? (0, _html2.default)(_templateObject3, props.i18n('localDisk'), props.i18n('localDisk'), !file.isPaused && !isUploaded ? (0, _html2.default)(_templateObject4, (0, _Utils.prettyETA)((0, _Utils.getETA)(file.progress)), (0, _prettyBytes2.default)((0, _Utils.getSpeed)(file.progress))) : null) : null, fileName, file.uploadURL ? (0, _html2.default)(_templateObject5, file.uploadURL, file.extension ? truncatedFileName + '.' + file.extension : truncatedFileName) : file.extension ? truncatedFileName + '.' + file.extension : truncatedFileName, file.data.size ? (0, _prettyBytes2.default)(file.data.size) : '?', !uploadInProgressOrComplete ? (0, _html2.default)(_templateObject6, function (e) {
return props.showFileCard(file.id);
}, (0, _icons.iconEdit)()) : null, file.uploadURL ? (0, _html2.default)(_templateObject7, function () {
(0, _Utils.copyToClipboard)(file.uploadURL, props.i18n('copyLinkToClipboardFallback')).then(function () {
props.log('Link copied to clipboard.');
props.info(props.i18n('copyLinkToClipboardSuccess'), 'info', 3000);
}).catch(props.log);
}, (0, _icons.iconCopy)()) : null, !isUploaded ? (0, _html2.default)(_templateObject8, function () {
return props.removeFile(file.id);
}) : null);
}
//# sourceMappingURL=FileItem.js.map
},{"../../core/Utils":7,"../../core/html":8,"./FileItemProgress":14,"./icons":20,"pretty-bytes":56}],14:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <svg width="70" height="70" viewBox="0 0 36 36" class="UppyIcon UppyIcon-progressCircle">\n <g class="progress-group">\n <circle r="15" cx="18" cy="18" stroke-width="2" fill="none" class="bg"/>\n <circle r="15" cx="18" cy="18" transform="rotate(-90, 18, 18)" stroke-width="2" fill="none" stroke-dasharray="100" stroke-dashoffset="', '" class="progress"/>\n </g>\n <polygon transform="translate(3, 3)" points="12 20 12 10 20 15" class="play"/>\n <g transform="translate(14.5, 13)" class="pause">\n <rect x="0" y="0" width="2" height="10" rx="0" />\n <rect x="5" y="0" width="2" height="10" rx="0" />\n </g>\n <polygon transform="translate(2, 3)" points="14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634" class="check"/>\n </svg>'], ['\n <svg width="70" height="70" viewBox="0 0 36 36" class="UppyIcon UppyIcon-progressCircle">\n <g class="progress-group">\n <circle r="15" cx="18" cy="18" stroke-width="2" fill="none" class="bg"/>\n <circle r="15" cx="18" cy="18" transform="rotate(-90, 18, 18)" stroke-width="2" fill="none" stroke-dasharray="100" stroke-dashoffset="', '" class="progress"/>\n </g>\n <polygon transform="translate(3, 3)" points="12 20 12 10 20 15" class="play"/>\n <g transform="translate(14.5, 13)" class="pause">\n <rect x="0" y="0" width="2" height="10" rx="0" />\n <rect x="5" y="0" width="2" height="10" rx="0" />\n </g>\n <polygon transform="translate(2, 3)" points="14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634" class="check"/>\n </svg>']);
exports.default = function (props) {
return (0, _html2.default)(_templateObject, 100 - props.progress || 100);
};
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
// http://codepen.io/Harkko/pen/rVxvNM
// https://gist.github.com/eswak/ad4ea57bcd5ff7aa5d42
//# sourceMappingURL=FileItemProgress.js.map
},{"../../core/html":8}],15:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<ul class="UppyDashboard-files\n ', '">\n ', '\n ', '\n </ul>'], ['<ul class="UppyDashboard-files\n ', '">\n ', '\n ', '\n </ul>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<div class="UppyDashboard-bgIcon">\n ', '\n <h4 class="UppyDashboard-dropFilesTitle">Drop or paste files here</h4>\n </div>'], ['<div class="UppyDashboard-bgIcon">\n ', '\n <h4 class="UppyDashboard-dropFilesTitle">Drop or paste files here</h4>\n </div>']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _FileItem = require('./FileItem');
var _FileItem2 = _interopRequireDefault(_FileItem);
var _icons = require('./icons');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject, props.totalFileCount === 0 ? 'UppyDashboard-files--noFiles' : '', props.totalFileCount === 0 ? (0, _html2.default)(_templateObject2, (0, _icons.dashboardBgIcon)()) : null, Object.keys(props.files).map(function (fileID) {
return (0, _FileItem2.default)({
file: props.files[fileID],
showFileCard: props.showFileCard,
showProgressDetails: props.showProgressDetails,
info: props.info,
log: props.log,
i18n: props.i18n,
removeFile: props.removeFile,
pauseUpload: props.pauseUpload
});
}));
};
//# sourceMappingURL=FileList.js.map
},{"../../core/html":8,"./FileItem":13,"./icons":20}],16:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <div class="UppyDashboard-actionsItem">\n <button class="UppyTotalProgress\n ', '\n ', '"\n onclick=', '>\n <svg width="70" height="70" viewBox="0 0 36 36" class="UppyIcon">\n <g class="progress-group">\n <circle r="15" cx="18" cy="18" stroke-width="2" fill="none" class="bg"/>\n <circle r="15" cx="18" cy="18" transform="rotate(-90, 18, 18)" stroke-width="2" fill="none" stroke-dasharray="100" stroke-dashoffset="', '" class="progress"/>\n </g>\n <polygon transform="translate(3, 3)" points="12 20 12 10 20 15" class="play"/>\n <g transform="translate(14.5, 13)" class="pause">\n <rect x="0" y="0" width="2" height="10" rx="0" />\n <rect x="5" y="0" width="2" height="10" rx="0" />\n </g>\n <polygon transform="translate(2, 3)" points="14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634" class="check"/>\n </svg>\n </button>\n </div>'], ['\n <div class="UppyDashboard-actionsItem">\n <button class="UppyTotalProgress\n ', '\n ', '"\n onclick=', '>\n <svg width="70" height="70" viewBox="0 0 36 36" class="UppyIcon">\n <g class="progress-group">\n <circle r="15" cx="18" cy="18" stroke-width="2" fill="none" class="bg"/>\n <circle r="15" cx="18" cy="18" transform="rotate(-90, 18, 18)" stroke-width="2" fill="none" stroke-dasharray="100" stroke-dashoffset="', '" class="progress"/>\n </g>\n <polygon transform="translate(3, 3)" points="12 20 12 10 20 15" class="play"/>\n <g transform="translate(14.5, 13)" class="pause">\n <rect x="0" y="0" width="2" height="10" rx="0" />\n <rect x="5" y="0" width="2" height="10" rx="0" />\n </g>\n <polygon transform="translate(2, 3)" points="14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634" class="check"/>\n </svg>\n </button>\n </div>']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
props = props || {};
var togglePauseResume = function togglePauseResume() {
if (props.isAllComplete) return;
if (props.isAllPaused) {
return props.resumeAll();
}
return props.pauseAll();
};
return (0, _html2.default)(_templateObject, props.isAllPaused ? 'UppyTotalProgress--is-paused' : '', props.isAllComplete ? 'UppyTotalProgress--is-complete' : '', togglePauseResume, 100 - props.totalProgress || 100);
};
//# sourceMappingURL=ProgressCircle.js.map
},{"../../core/html":8}],17:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <div class="UppyDashboard-statusBar">\n ', '\n </div>'], ['\n <div class="UppyDashboard-statusBar">\n ', '\n </div>']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
props = props || {};
return (0, _html2.default)(_templateObject, !props.isAllComplete ? !props.isAllPaused ? 'Uploading... ' + props.complete + ' / ' + props.inProgress + '・' + (props.totalProgress || 0) + '%・' + props.totalETA + '・↑ ' + props.totalSpeed + '/s' : 'Paused ・' + props.totalProgress + '%' : null);
};
//# sourceMappingURL=StatusBar.js.map
},{"../../core/html":8}],18:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<div class="UppyDashboardTabs">\n <h3 class="UppyDashboardTabs-title">', ':</h3>\n <nav>\n <ul class="UppyDashboardTabs-list" role="tablist">\n <li class="UppyDashboardTab">\n <button class="UppyDashboardTab-btn UppyDashboard-focus"\n role="tab"\n tabindex="0"\n onclick=', '>\n ', '\n <h5 class="UppyDashboardTab-name">', '</h5>\n </button>\n <input class="UppyDashboard-input" type="file" name="files[]" multiple="true"\n onchange=', ' />\n </li>\n ', '\n </ul>\n </nav>\n </div>'], ['<div class="UppyDashboardTabs">\n <h3 class="UppyDashboardTabs-title">', ':</h3>\n <nav>\n <ul class="UppyDashboardTabs-list" role="tablist">\n <li class="UppyDashboardTab">\n <button class="UppyDashboardTab-btn UppyDashboard-focus"\n role="tab"\n tabindex="0"\n onclick=', '>\n ', '\n <h5 class="UppyDashboardTab-name">', '</h5>\n </button>\n <input class="UppyDashboard-input" type="file" name="files[]" multiple="true"\n onchange=', ' />\n </li>\n ', '\n </ul>\n </nav>\n </div>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<li class="UppyDashboardTab">\n <button class="UppyDashboardTab-btn"\n role="tab"\n tabindex="0"\n aria-controls="', '--', '"\n aria-selected="', '"\n onclick=', '>\n ', '\n <h5 class="UppyDashboardTab-name">', '</h5>\n </button>\n </li>'], ['<li class="UppyDashboardTab">\n <button class="UppyDashboardTab-btn"\n role="tab"\n tabindex="0"\n aria-controls="', '--', '"\n aria-selected="', '"\n onclick=', '>\n ', '\n <h5 class="UppyDashboardTab-name">', '</h5>\n </button>\n </li>']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _icons = require('./icons');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject, props.i18n('importFrom'), function (ev) {
var input = document.querySelector(props.container + ' .UppyDashboard-input');
input.click();
}, (0, _icons.localIcon)(), props.i18n('localDisk'), props.handleInputChange, props.acquirers.map(function (target) {
return (0, _html2.default)(_templateObject2, props.panelSelectorPrefix, target.id, target.isHidden ? 'false' : 'true', function () {
return props.showPanel(target.id);
}, target.icon, target.name);
}));
};
//# sourceMappingURL=Tabs.js.map
},{"../../core/html":8,"./icons":20}],19:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<button class="UppyButton--circular\n UppyButton--blue\n UppyButton--sizeM\n UppyDashboard-upload"\n type="button"\n title="', '"\n aria-label="', '"\n onclick=', '>\n ', '\n <sup class="UppyDashboard-uploadCount"\n title="', '"\n aria-label="', '">\n ', '</sup>\n </button>\n '], ['<button class="UppyButton--circular\n UppyButton--blue\n UppyButton--sizeM\n UppyDashboard-upload"\n type="button"\n title="', '"\n aria-label="', '"\n onclick=', '>\n ', '\n <sup class="UppyDashboard-uploadCount"\n title="', '"\n aria-label="', '">\n ', '</sup>\n </button>\n ']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _icons = require('./icons');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
props = props || {};
return (0, _html2.default)(_templateObject, props.i18n('uploadAllNewFiles'), props.i18n('uploadAllNewFiles'), props.startUpload, (0, _icons.uploadIcon)(), props.i18n('numberOfSelectedFiles'), props.i18n('numberOfSelectedFiles'), props.newFileCount);
};
//# sourceMappingURL=UploadBtn.js.map
},{"../../core/html":8,"./icons":20}],20:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="30" height="30" viewBox="0 0 30 30">\n <path d="M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z" />\n </svg>'], ['<svg class="UppyIcon" width="30" height="30" viewBox="0 0 30 30">\n <path d="M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z" />\n </svg>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="51" height="51" viewBox="0 0 51 51">\n <path d="M17.21 45.765a5.394 5.394 0 0 1-7.62 0l-4.12-4.122a5.393 5.393 0 0 1 0-7.618l6.774-6.775-2.404-2.404-6.775 6.776c-3.424 3.427-3.424 9 0 12.426l4.12 4.123a8.766 8.766 0 0 0 6.216 2.57c2.25 0 4.5-.858 6.214-2.57l13.55-13.552a8.72 8.72 0 0 0 2.575-6.213 8.73 8.73 0 0 0-2.575-6.213l-4.123-4.12-2.404 2.404 4.123 4.12a5.352 5.352 0 0 1 1.58 3.81c0 1.438-.562 2.79-1.58 3.808l-13.55 13.55z"/>\n <path d="M44.256 2.858A8.728 8.728 0 0 0 38.043.283h-.002a8.73 8.73 0 0 0-6.212 2.574l-13.55 13.55a8.725 8.725 0 0 0-2.575 6.214 8.73 8.73 0 0 0 2.574 6.216l4.12 4.12 2.405-2.403-4.12-4.12a5.357 5.357 0 0 1-1.58-3.812c0-1.437.562-2.79 1.58-3.808l13.55-13.55a5.348 5.348 0 0 1 3.81-1.58c1.44 0 2.792.562 3.81 1.58l4.12 4.12c2.1 2.1 2.1 5.518 0 7.617L39.2 23.775l2.404 2.404 6.775-6.777c3.426-3.427 3.426-9 0-12.426l-4.12-4.12z"/>\n </svg>'], ['<svg class="UppyIcon" width="51" height="51" viewBox="0 0 51 51">\n <path d="M17.21 45.765a5.394 5.394 0 0 1-7.62 0l-4.12-4.122a5.393 5.393 0 0 1 0-7.618l6.774-6.775-2.404-2.404-6.775 6.776c-3.424 3.427-3.424 9 0 12.426l4.12 4.123a8.766 8.766 0 0 0 6.216 2.57c2.25 0 4.5-.858 6.214-2.57l13.55-13.552a8.72 8.72 0 0 0 2.575-6.213 8.73 8.73 0 0 0-2.575-6.213l-4.123-4.12-2.404 2.404 4.123 4.12a5.352 5.352 0 0 1 1.58 3.81c0 1.438-.562 2.79-1.58 3.808l-13.55 13.55z"/>\n <path d="M44.256 2.858A8.728 8.728 0 0 0 38.043.283h-.002a8.73 8.73 0 0 0-6.212 2.574l-13.55 13.55a8.725 8.725 0 0 0-2.575 6.214 8.73 8.73 0 0 0 2.574 6.216l4.12 4.12 2.405-2.403-4.12-4.12a5.357 5.357 0 0 1-1.58-3.812c0-1.437.562-2.79 1.58-3.808l13.55-13.55a5.348 5.348 0 0 1 3.81-1.58c1.44 0 2.792.562 3.81 1.58l4.12 4.12c2.1 2.1 2.1 5.518 0 7.617L39.2 23.775l2.404 2.404 6.775-6.777c3.426-3.427 3.426-9 0-12.426l-4.12-4.12z"/>\n </svg>']),
_templateObject3 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="25" height="25" viewBox="0 0 44 44">\n <polygon class="play" transform="translate(6, 5.5)" points="13 21.6666667 13 11 21 16.3333333" />\n </svg>'], ['<svg class="UppyIcon" width="25" height="25" viewBox="0 0 44 44">\n <polygon class="play" transform="translate(6, 5.5)" points="13 21.6666667 13 11 21 16.3333333" />\n </svg>']),
_templateObject4 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="25px" height="25px" viewBox="0 0 44 44">\n <g transform="translate(18, 17)" class="pause">\n <rect x="0" y="0" width="2" height="10" rx="0" />\n <rect x="6" y="0" width="2" height="10" rx="0" />\n </g>\n </svg>'], ['<svg class="UppyIcon" width="25px" height="25px" viewBox="0 0 44 44">\n <g transform="translate(18, 17)" class="pause">\n <rect x="0" y="0" width="2" height="10" rx="0" />\n <rect x="6" y="0" width="2" height="10" rx="0" />\n </g>\n </svg>']),
_templateObject5 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="28" height="28" viewBox="0 0 28 28">\n <path d="M25.436 2.566a7.98 7.98 0 0 0-2.078-1.51C22.638.703 21.906.5 21.198.5a3 3 0 0 0-1.023.17 2.436 2.436 0 0 0-.893.562L2.292 18.217.5 27.5l9.28-1.796 16.99-16.99c.255-.254.444-.56.562-.888a3 3 0 0 0 .17-1.023c0-.708-.205-1.44-.555-2.16a8 8 0 0 0-1.51-2.077zM9.01 24.252l-4.313.834c0-.03.008-.06.012-.09.007-.944-.74-1.715-1.67-1.723-.04 0-.078.007-.118.01l.83-4.29L17.72 5.024l5.264 5.264L9.01 24.252zm16.84-16.96a.818.818 0 0 1-.194.31l-1.57 1.57-5.26-5.26 1.57-1.57a.82.82 0 0 1 .31-.194 1.45 1.45 0 0 1 .492-.074c.397 0 .917.126 1.468.397.55.27 1.13.678 1.656 1.21.53.53.94 1.11 1.208 1.655.272.55.397 1.07.393 1.468.004.193-.027.358-.074.488z" />\n </svg>'], ['<svg class="UppyIcon" width="28" height="28" viewBox="0 0 28 28">\n <path d="M25.436 2.566a7.98 7.98 0 0 0-2.078-1.51C22.638.703 21.906.5 21.198.5a3 3 0 0 0-1.023.17 2.436 2.436 0 0 0-.893.562L2.292 18.217.5 27.5l9.28-1.796 16.99-16.99c.255-.254.444-.56.562-.888a3 3 0 0 0 .17-1.023c0-.708-.205-1.44-.555-2.16a8 8 0 0 0-1.51-2.077zM9.01 24.252l-4.313.834c0-.03.008-.06.012-.09.007-.944-.74-1.715-1.67-1.723-.04 0-.078.007-.118.01l.83-4.29L17.72 5.024l5.264 5.264L9.01 24.252zm16.84-16.96a.818.818 0 0 1-.194.31l-1.57 1.57-5.26-5.26 1.57-1.57a.82.82 0 0 1 .31-.194 1.45 1.45 0 0 1 .492-.074c.397 0 .917.126 1.468.397.55.27 1.13.678 1.656 1.21.53.53.94 1.11 1.208 1.655.272.55.397 1.07.393 1.468.004.193-.027.358-.074.488z" />\n </svg>']),
_templateObject6 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="27" height="25" viewBox="0 0 27 25">\n <path d="M5.586 9.288a.313.313 0 0 0 .282.176h4.84v3.922c0 1.514 1.25 2.24 2.792 2.24 1.54 0 2.79-.726 2.79-2.24V9.464h4.84c.122 0 .23-.068.284-.176a.304.304 0 0 0-.046-.324L13.735.106a.316.316 0 0 0-.472 0l-7.63 8.857a.302.302 0 0 0-.047.325z"/>\n <path d="M24.3 5.093c-.218-.76-.54-1.187-1.208-1.187h-4.856l1.018 1.18h3.948l2.043 11.038h-7.193v2.728H9.114v-2.725h-7.36l2.66-11.04h3.33l1.018-1.18H3.907c-.668 0-1.06.46-1.21 1.186L0 16.456v7.062C0 24.338.676 25 1.51 25h23.98c.833 0 1.51-.663 1.51-1.482v-7.062L24.3 5.093z"/>\n </svg>'], ['<svg class="UppyIcon" width="27" height="25" viewBox="0 0 27 25">\n <path d="M5.586 9.288a.313.313 0 0 0 .282.176h4.84v3.922c0 1.514 1.25 2.24 2.792 2.24 1.54 0 2.79-.726 2.79-2.24V9.464h4.84c.122 0 .23-.068.284-.176a.304.304 0 0 0-.046-.324L13.735.106a.316.316 0 0 0-.472 0l-7.63 8.857a.302.302 0 0 0-.047.325z"/>\n <path d="M24.3 5.093c-.218-.76-.54-1.187-1.208-1.187h-4.856l1.018 1.18h3.948l2.043 11.038h-7.193v2.728H9.114v-2.725h-7.36l2.66-11.04h3.33l1.018-1.18H3.907c-.668 0-1.06.46-1.21 1.186L0 16.456v7.062C0 24.338.676 25 1.51 25h23.98c.833 0 1.51-.663 1.51-1.482v-7.062L24.3 5.093z"/>\n </svg>']),
_templateObject7 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="14px" height="14px" viewBox="0 0 19 19">\n <polygon points="17.3182539 17.2324466 9.93955339 9.85374611 9.586 9.50019272 9.23244661 9.85374611 1.85374611 17.2324466 2.56085289 17.2324466 1.93955339 16.6111471 1.93955865 17.3182486 9.31803946 9.93954813 9.67158232 9.58599474 9.31803419 9.23244661 1.93955339 1.85396581 1.93961588 2.56101008 2.56091538 1.93949089 1.85375137 1.93955865 9.23245187 9.31803946 9.586 9.67157706 9.93954813 9.31803946 17.3182486 1.93955865 16.6111471 1.93955339 17.2324466 2.56085289 17.2324466 1.85374611 9.85374611 9.23244661 9.50019272 9.586 9.85374611 9.93955339 17.2324466 17.3182539 17.9395534 16.6111471 10.5608529 9.23244661 10.5608529 9.93955339 17.9395534 2.56085289 18.2931068 2.2072995 17.9395534 1.85374611 17.3182539 1.23244661 16.9647058 0.878898482 16.6111524 1.23244135 9.23245187 8.61092215 9.93954813 8.61092215 2.56084763 1.23244135 2.20723173 0.87883598 1.85368362 1.23250911 1.23238412 1.85402831 0.878955712 2.20758169 1.23244661 2.56107259 8.61092741 9.93955339 8.61092215 9.23245187 1.23244135 16.6111524 0.878898482 16.9647058 1.23244661 17.3182539 1.85374611 17.9395534 2.2072995 18.2931068 2.56085289 17.9395534 9.93955339 10.5608529 9.23244661 10.5608529 16.6111471 17.9395534"></polygon>\n </svg>'], ['<svg class="UppyIcon" width="14px" height="14px" viewBox="0 0 19 19">\n <polygon points="17.3182539 17.2324466 9.93955339 9.85374611 9.586 9.50019272 9.23244661 9.85374611 1.85374611 17.2324466 2.56085289 17.2324466 1.93955339 16.6111471 1.93955865 17.3182486 9.31803946 9.93954813 9.67158232 9.58599474 9.31803419 9.23244661 1.93955339 1.85396581 1.93961588 2.56101008 2.56091538 1.93949089 1.85375137 1.93955865 9.23245187 9.31803946 9.586 9.67157706 9.93954813 9.31803946 17.3182486 1.93955865 16.6111471 1.93955339 17.2324466 2.56085289 17.2324466 1.85374611 9.85374611 9.23244661 9.50019272 9.586 9.85374611 9.93955339 17.2324466 17.3182539 17.9395534 16.6111471 10.5608529 9.23244661 10.5608529 9.93955339 17.9395534 2.56085289 18.2931068 2.2072995 17.9395534 1.85374611 17.3182539 1.23244661 16.9647058 0.878898482 16.6111524 1.23244135 9.23245187 8.61092215 9.93954813 8.61092215 2.56084763 1.23244135 2.20723173 0.87883598 1.85368362 1.23250911 1.23238412 1.85402831 0.878955712 2.20758169 1.23244661 2.56107259 8.61092741 9.93955339 8.61092215 9.23245187 1.23244135 16.6111524 0.878898482 16.9647058 1.23244661 17.3182539 1.85374611 17.9395534 2.2072995 18.2931068 2.56085289 17.9395534 9.93955339 10.5608529 9.23244661 10.5608529 16.6111471 17.9395534"></polygon>\n </svg>']),
_templateObject8 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="16px" height="16px" viewBox="0 0 32 30">\n <path d="M6.6209894,11.1451162 C6.6823051,11.2751669 6.81374248,11.3572188 6.95463813,11.3572188 L12.6925482,11.3572188 L12.6925482,16.0630427 C12.6925482,17.880509 14.1726048,18.75 16.0000083,18.75 C17.8261072,18.75 19.3074684,17.8801847 19.3074684,16.0630427 L19.3074684,11.3572188 L25.0437478,11.3572188 C25.1875787,11.3572188 25.3164069,11.2751669 25.3790272,11.1451162 C25.4370814,11.0173358 25.4171865,10.8642587 25.3252129,10.7562615 L16.278212,0.127131837 C16.2093949,0.0463771751 16.1069846,0 15.9996822,0 C15.8910751,0 15.7886648,0.0463771751 15.718217,0.127131837 L6.6761083,10.7559371 C6.58250402,10.8642587 6.56293518,11.0173358 6.6209894,11.1451162 L6.6209894,11.1451162 Z"/>\n <path d="M28.8008722,6.11142645 C28.5417891,5.19831555 28.1583331,4.6875 27.3684848,4.6875 L21.6124454,4.6875 L22.8190234,6.10307874 L27.4986725,6.10307874 L29.9195817,19.3486449 L21.3943891,19.3502502 L21.3943891,22.622552 L10.8023461,22.622552 L10.8023461,19.3524977 L2.07815702,19.3534609 L5.22979699,6.10307874 L9.17871529,6.10307874 L10.3840011,4.6875 L4.6308691,4.6875 C3.83940559,4.6875 3.37421888,5.2390909 3.19815864,6.11142645 L0,19.7470874 L0,28.2212959 C0,29.2043992 0.801477937,30 1.78870751,30 L30.2096773,30 C31.198199,30 32,29.2043992 32,28.2212959 L32,19.7470874 L28.8008722,6.11142645 L28.8008722,6.11142645 Z"/>\n </svg>'], ['<svg class="UppyIcon" width="16px" height="16px" viewBox="0 0 32 30">\n <path d="M6.6209894,11.1451162 C6.6823051,11.2751669 6.81374248,11.3572188 6.95463813,11.3572188 L12.6925482,11.3572188 L12.6925482,16.0630427 C12.6925482,17.880509 14.1726048,18.75 16.0000083,18.75 C17.8261072,18.75 19.3074684,17.8801847 19.3074684,16.0630427 L19.3074684,11.3572188 L25.0437478,11.3572188 C25.1875787,11.3572188 25.3164069,11.2751669 25.3790272,11.1451162 C25.4370814,11.0173358 25.4171865,10.8642587 25.3252129,10.7562615 L16.278212,0.127131837 C16.2093949,0.0463771751 16.1069846,0 15.9996822,0 C15.8910751,0 15.7886648,0.0463771751 15.718217,0.127131837 L6.6761083,10.7559371 C6.58250402,10.8642587 6.56293518,11.0173358 6.6209894,11.1451162 L6.6209894,11.1451162 Z"/>\n <path d="M28.8008722,6.11142645 C28.5417891,5.19831555 28.1583331,4.6875 27.3684848,4.6875 L21.6124454,4.6875 L22.8190234,6.10307874 L27.4986725,6.10307874 L29.9195817,19.3486449 L21.3943891,19.3502502 L21.3943891,22.622552 L10.8023461,22.622552 L10.8023461,19.3524977 L2.07815702,19.3534609 L5.22979699,6.10307874 L9.17871529,6.10307874 L10.3840011,4.6875 L4.6308691,4.6875 C3.83940559,4.6875 3.37421888,5.2390909 3.19815864,6.11142645 L0,19.7470874 L0,28.2212959 C0,29.2043992 0.801477937,30 1.78870751,30 L30.2096773,30 C31.198199,30 32,29.2043992 32,28.2212959 L32,19.7470874 L28.8008722,6.11142645 L28.8008722,6.11142645 Z"/>\n </svg>']),
_templateObject9 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon UppyIcon-check" width="13px" height="9px" viewBox="0 0 13 9">\n <polygon points="5 7.293 1.354 3.647 0.646 4.354 5 8.707 12.354 1.354 11.646 0.647"></polygon>\n </svg>'], ['<svg class="UppyIcon UppyIcon-check" width="13px" height="9px" viewBox="0 0 13 9">\n <polygon points="5 7.293 1.354 3.647 0.646 4.354 5 8.707 12.354 1.354 11.646 0.647"></polygon>\n </svg>']),
_templateObject10 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="34" height="91" viewBox="0 0 34 91">\n <path d="M22.366 43.134V29.33c5.892-6.588 10.986-14.507 10.986-22.183 0-4.114-2.986-7.1-7.1-7.1-3.914 0-7.1 3.186-7.1 7.1v20.936a92.562 92.562 0 0 1-5.728 5.677l-.384.348C4.643 41.762.428 45.604.428 54.802c0 8.866 7.214 16.08 16.08 16.08.902 0 1.784-.074 2.644-.216v11.26c0 2.702-2.198 4.9-4.9 4.9a4.855 4.855 0 0 1-2.95-1.015c2.364-.24 4.222-2.218 4.222-4.643a4.698 4.698 0 0 0-4.692-4.692 4.738 4.738 0 0 0-4.213 2.628c-.923 1.874-.56 4.386.277 6.228a7.82 7.82 0 0 0 .9 1.502 8.178 8.178 0 0 0 4.23 2.896c.723.207 1.474.31 2.226.31 4.474 0 8.113-3.64 8.113-8.113V69.78c5.98-2.345 10.225-8.176 10.225-14.977 0-5.975-4.464-10.876-10.224-11.67zm0-35.987a3.89 3.89 0 0 1 3.887-3.885c1.933 0 3.885 1.202 3.885 3.885 0 4.95-2.702 10.862-7.772 17.204V7.148zM16.51 67.67c-7.096 0-12.867-5.77-12.867-12.867 0-7.78 3.385-10.865 11.563-18.32l.384-.35c1.166-1.064 2.365-2.2 3.562-3.402v10.404c-5.758.793-10.223 5.695-10.223 11.67 0 3.935 1.948 7.603 5.212 9.81a1.605 1.605 0 1 0 1.8-2.66 8.622 8.622 0 0 1-3.8-7.15c0-4.2 3.025-7.7 7.01-8.456v21.05c-.853.178-1.736.272-2.642.272zm5.856-1.412v-19.91c3.985.756 7.01 4.253 7.01 8.455 0 4.987-2.85 9.32-7.01 11.455z" />\n </svg>'], ['<svg class="UppyIcon" width="34" height="91" viewBox="0 0 34 91">\n <path d="M22.366 43.134V29.33c5.892-6.588 10.986-14.507 10.986-22.183 0-4.114-2.986-7.1-7.1-7.1-3.914 0-7.1 3.186-7.1 7.1v20.936a92.562 92.562 0 0 1-5.728 5.677l-.384.348C4.643 41.762.428 45.604.428 54.802c0 8.866 7.214 16.08 16.08 16.08.902 0 1.784-.074 2.644-.216v11.26c0 2.702-2.198 4.9-4.9 4.9a4.855 4.855 0 0 1-2.95-1.015c2.364-.24 4.222-2.218 4.222-4.643a4.698 4.698 0 0 0-4.692-4.692 4.738 4.738 0 0 0-4.213 2.628c-.923 1.874-.56 4.386.277 6.228a7.82 7.82 0 0 0 .9 1.502 8.178 8.178 0 0 0 4.23 2.896c.723.207 1.474.31 2.226.31 4.474 0 8.113-3.64 8.113-8.113V69.78c5.98-2.345 10.225-8.176 10.225-14.977 0-5.975-4.464-10.876-10.224-11.67zm0-35.987a3.89 3.89 0 0 1 3.887-3.885c1.933 0 3.885 1.202 3.885 3.885 0 4.95-2.702 10.862-7.772 17.204V7.148zM16.51 67.67c-7.096 0-12.867-5.77-12.867-12.867 0-7.78 3.385-10.865 11.563-18.32l.384-.35c1.166-1.064 2.365-2.2 3.562-3.402v10.404c-5.758.793-10.223 5.695-10.223 11.67 0 3.935 1.948 7.603 5.212 9.81a1.605 1.605 0 1 0 1.8-2.66 8.622 8.622 0 0 1-3.8-7.15c0-4.2 3.025-7.7 7.01-8.456v21.05c-.853.178-1.736.272-2.642.272zm5.856-1.412v-19.91c3.985.756 7.01 4.253 7.01 8.455 0 4.987-2.85 9.32-7.01 11.455z" />\n </svg>']),
_templateObject11 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="44" height="58" viewBox="0 0 44 58">\n <path d="M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z" />\n </svg>'], ['<svg class="UppyIcon" width="44" height="58" viewBox="0 0 44 58">\n <path d="M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z" />\n </svg>']),
_templateObject12 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="50" height="63" viewBox="0 0 50 63">\n <path d="M0 .5v15.617h6.25l1.7-5.1a6.242 6.242 0 0 1 5.933-4.267h8V50.5c0 3.45-2.8 6.25-6.25 6.25H12.5V63h25v-6.25h-3.133c-3.45 0-6.25-2.8-6.25-6.25V6.75h8a6.257 6.257 0 0 1 5.933 4.267l1.7 5.1H50V.5H0z" />\n </svg>'], ['<svg class="UppyIcon" width="50" height="63" viewBox="0 0 50 63">\n <path d="M0 .5v15.617h6.25l1.7-5.1a6.242 6.242 0 0 1 5.933-4.267h8V50.5c0 3.45-2.8 6.25-6.25 6.25H12.5V63h25v-6.25h-3.133c-3.45 0-6.25-2.8-6.25-6.25V6.75h8a6.257 6.257 0 0 1 5.933 4.267l1.7 5.1H50V.5H0z" />\n </svg>']),
_templateObject13 = _taggedTemplateLiteralLoose(['<svg width="22" height="21" viewBox="0 0 18 17">\n <ellipse fill="#000" cx="8.62" cy="8.383" rx="8.62" ry="8.383"/>\n <path stroke="#FFF" fill="#FFF" d="M11 6.147L10.85 6 8.5 8.284 6.15 6 6 6.147 8.35 8.43 6 10.717l.15.146L8.5 8.578l2.35 2.284.15-.146L8.65 8.43z"/>\n </svg>'], ['<svg width="22" height="21" viewBox="0 0 18 17">\n <ellipse fill="#000" cx="8.62" cy="8.383" rx="8.62" ry="8.383"/>\n <path stroke="#FFF" fill="#FFF" d="M11 6.147L10.85 6 8.5 8.284 6.15 6 6 6.147 8.35 8.43 6 10.717l.15.146L8.5 8.578l2.35 2.284.15-.146L8.65 8.43z"/>\n </svg>']),
_templateObject14 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="37" height="33" viewBox="0 0 37 33">\n <path d="M29.107 24.5c4.07 0 7.393-3.355 7.393-7.442 0-3.994-3.105-7.307-7.012-7.502l.468.415C29.02 4.52 24.34.5 18.886.5c-4.348 0-8.27 2.522-10.138 6.506l.446-.288C4.394 6.782.5 10.758.5 15.608c0 4.924 3.906 8.892 8.76 8.892h4.872c.635 0 1.095-.467 1.095-1.104 0-.636-.46-1.103-1.095-1.103H9.26c-3.644 0-6.63-3.035-6.63-6.744 0-3.71 2.926-6.685 6.57-6.685h.964l.14-.28.177-.362c1.477-3.4 4.744-5.576 8.347-5.576 4.58 0 8.45 3.452 9.01 8.072l.06.536.05.446h1.101c2.87 0 5.204 2.37 5.204 5.295s-2.333 5.296-5.204 5.296h-6.062c-.634 0-1.094.467-1.094 1.103 0 .637.46 1.104 1.094 1.104h6.12z"/>\n <path d="M23.196 18.92l-4.828-5.258-.366-.4-.368.398-4.828 5.196a1.13 1.13 0 0 0 0 1.546c.428.46 1.11.46 1.537 0l3.45-3.71-.868-.34v15.03c0 .64.445 1.118 1.075 1.118.63 0 1.075-.48 1.075-1.12V16.35l-.867.34 3.45 3.712a1 1 0 0 0 .767.345 1 1 0 0 0 .77-.345c.416-.33.416-1.036 0-1.485v.003z"/>\n </svg>'], ['<svg class="UppyIcon" width="37" height="33" viewBox="0 0 37 33">\n <path d="M29.107 24.5c4.07 0 7.393-3.355 7.393-7.442 0-3.994-3.105-7.307-7.012-7.502l.468.415C29.02 4.52 24.34.5 18.886.5c-4.348 0-8.27 2.522-10.138 6.506l.446-.288C4.394 6.782.5 10.758.5 15.608c0 4.924 3.906 8.892 8.76 8.892h4.872c.635 0 1.095-.467 1.095-1.104 0-.636-.46-1.103-1.095-1.103H9.26c-3.644 0-6.63-3.035-6.63-6.744 0-3.71 2.926-6.685 6.57-6.685h.964l.14-.28.177-.362c1.477-3.4 4.744-5.576 8.347-5.576 4.58 0 8.45 3.452 9.01 8.072l.06.536.05.446h1.101c2.87 0 5.204 2.37 5.204 5.295s-2.333 5.296-5.204 5.296h-6.062c-.634 0-1.094.467-1.094 1.103 0 .637.46 1.104 1.094 1.104h6.12z"/>\n <path d="M23.196 18.92l-4.828-5.258-.366-.4-.368.398-4.828 5.196a1.13 1.13 0 0 0 0 1.546c.428.46 1.11.46 1.537 0l3.45-3.71-.868-.34v15.03c0 .64.445 1.118 1.075 1.118.63 0 1.075-.48 1.075-1.12V16.35l-.867.34 3.45 3.712a1 1 0 0 0 .767.345 1 1 0 0 0 .77-.345c.416-.33.416-1.036 0-1.485v.003z"/>\n </svg>']),
_templateObject15 = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="102" height="124" viewBox="0 0 102 124">\n <g>\n <path d="M69.125 124c7.363 0 13.353-5.975 13.353-13.322v-6.15h4c8.56 0 15.522-6.946 15.522-15.482v-59.16c0-2.033-1.087-4.65-2.53-6.088L78.14 2.52C76.7 1.085 74.075 0 72.038 0H32.873c-7.36 0-13.35 6.947-13.35 15.483v3.99h-6.168C5.99 19.472 0 25.445 0 32.792v77.885C0 118.025 5.99 124 13.355 124h55.77zM76.903 7.488l17.59 17.55h-13.13c-2.46 0-4.46-2-4.46-4.454V7.488zm-52.985 7.995c0-6.12 4.016-11.1 8.955-11.1h39.165c.14 0 .3.022.466.05v16.15c0 4.873 3.973 8.837 8.86 8.837h16.19c.028.165.048.323.048.467v59.158c0 6.118-4.99 11.097-11.125 11.097H35.043c-6.135 0-11.127-4.978-11.127-11.096V15.483h.002zm-19.52 95.195V32.792c0-4.928 4.018-8.934 8.957-8.934h6.167v65.188c0 8.536 6.963 15.482 15.52 15.482H78.08v6.15c0 4.927-4.017 8.935-8.955 8.935h-55.77c-4.94 0-8.957-4.008-8.957-8.935z"/><path d="M40.218 76h40.564C82.007 76 83 75.106 83 74c0-1.106-.993-2-2.218-2H40.218C38.995 72 38 72.894 38 74c0 1.106.995 2 2.218 2zM40.218 57h40.564C82.007 57 83 56.105 83 55c0-1.106-.993-2-2.218-2H40.218C38.995 53 38 53.894 38 55c0 1.105.995 2 2.218 2zM40.208 37h23.584c1.22 0 2.208-.896 2.208-2s-.987-2-2.208-2H40.208C38.99 33 38 33.896 38 35s.99 2 2.208 2z"/>\n </g>\n </svg>'], ['<svg class="UppyIcon" width="102" height="124" viewBox="0 0 102 124">\n <g>\n <path d="M69.125 124c7.363 0 13.353-5.975 13.353-13.322v-6.15h4c8.56 0 15.522-6.946 15.522-15.482v-59.16c0-2.033-1.087-4.65-2.53-6.088L78.14 2.52C76.7 1.085 74.075 0 72.038 0H32.873c-7.36 0-13.35 6.947-13.35 15.483v3.99h-6.168C5.99 19.472 0 25.445 0 32.792v77.885C0 118.025 5.99 124 13.355 124h55.77zM76.903 7.488l17.59 17.55h-13.13c-2.46 0-4.46-2-4.46-4.454V7.488zm-52.985 7.995c0-6.12 4.016-11.1 8.955-11.1h39.165c.14 0 .3.022.466.05v16.15c0 4.873 3.973 8.837 8.86 8.837h16.19c.028.165.048.323.048.467v59.158c0 6.118-4.99 11.097-11.125 11.097H35.043c-6.135 0-11.127-4.978-11.127-11.096V15.483h.002zm-19.52 95.195V32.792c0-4.928 4.018-8.934 8.957-8.934h6.167v65.188c0 8.536 6.963 15.482 15.52 15.482H78.08v6.15c0 4.927-4.017 8.935-8.955 8.935h-55.77c-4.94 0-8.957-4.008-8.957-8.935z"/><path d="M40.218 76h40.564C82.007 76 83 75.106 83 74c0-1.106-.993-2-2.218-2H40.218C38.995 72 38 72.894 38 74c0 1.106.995 2 2.218 2zM40.218 57h40.564C82.007 57 83 56.105 83 55c0-1.106-.993-2-2.218-2H40.218C38.995 53 38 53.894 38 55c0 1.105.995 2 2.218 2zM40.208 37h23.584c1.22 0 2.208-.896 2.208-2s-.987-2-2.208-2H40.208C38.99 33 38 33.896 38 35s.99 2 2.208 2z"/>\n </g>\n </svg>']);
exports.defaultTabIcon = defaultTabIcon;
exports.iconCopy = iconCopy;
exports.iconResume = iconResume;
exports.iconPause = iconPause;
exports.iconEdit = iconEdit;
exports.localIcon = localIcon;
exports.closeIcon = closeIcon;
exports.pluginIcon = pluginIcon;
exports.checkIcon = checkIcon;
exports.iconAudio = iconAudio;
exports.iconFile = iconFile;
exports.iconText = iconText;
exports.removeIcon = removeIcon;
exports.uploadIcon = uploadIcon;
exports.dashboardBgIcon = dashboardBgIcon;
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
// https://css-tricks.com/creating-svg-icon-system-react/
function defaultTabIcon() {
return (0, _html2.default)(_templateObject);
}
function iconCopy() {
return (0, _html2.default)(_templateObject2);
}
function iconResume() {
return (0, _html2.default)(_templateObject3);
}
function iconPause() {
return (0, _html2.default)(_templateObject4);
}
function iconEdit() {
return (0, _html2.default)(_templateObject5);
}
function localIcon() {
return (0, _html2.default)(_templateObject6);
}
function closeIcon() {
return (0, _html2.default)(_templateObject7);
}
function pluginIcon() {
return (0, _html2.default)(_templateObject8);
}
function checkIcon() {
return (0, _html2.default)(_templateObject9);
}
function iconAudio() {
return (0, _html2.default)(_templateObject10);
}
function iconFile() {
return (0, _html2.default)(_templateObject11);
}
function iconText() {
return (0, _html2.default)(_templateObject12);
}
function removeIcon() {
return (0, _html2.default)(_templateObject13);
}
function uploadIcon() {
return (0, _html2.default)(_templateObject14);
}
function dashboardBgIcon() {
return (0, _html2.default)(_templateObject15);
}
//# sourceMappingURL=icons.js.map
},{"../../core/html":8}],21:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Plugin2 = require('../Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _dragDrop = require('drag-drop');
var _dragDrop2 = _interopRequireDefault(_dragDrop);
var _Dashboard = require('./Dashboard');
var _Dashboard2 = _interopRequireDefault(_Dashboard);
var _Utils = require('../../core/Utils');
var _prettyBytes = require('pretty-bytes');
var _prettyBytes2 = _interopRequireDefault(_prettyBytes);
var _icons = require('./icons');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Modal Dialog & Dashboard
*/
var DashboardUI = function (_Plugin) {
_inherits(DashboardUI, _Plugin);
function DashboardUI(core, opts) {
_classCallCheck(this, DashboardUI);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.id = 'DashboardUI';
_this.title = 'Dashboard UI';
_this.type = 'orchestrator';
// set default options
var defaultOptions = {
target: 'body',
inline: false,
semiTransparent: false,
defaultTabIcon: (0, _icons.defaultTabIcon)(),
panelSelectorPrefix: 'UppyDashboardContent-panel',
showProgressDetails: true
};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
_this.hideModal = _this.hideModal.bind(_this);
_this.showModal = _this.showModal.bind(_this);
_this.addTarget = _this.addTarget.bind(_this);
_this.actions = _this.actions.bind(_this);
_this.hideAllPanels = _this.hideAllPanels.bind(_this);
_this.showPanel = _this.showPanel.bind(_this);
_this.initEvents = _this.initEvents.bind(_this);
_this.handleDrop = _this.handleDrop.bind(_this);
_this.pauseAll = _this.pauseAll.bind(_this);
_this.resumeAll = _this.resumeAll.bind(_this);
_this.render = _this.render.bind(_this);
_this.install = _this.install.bind(_this);
return _this;
}
DashboardUI.prototype.addTarget = function addTarget(plugin) {
var callerPluginId = plugin.constructor.name;
var callerPluginName = plugin.title || callerPluginId;
var callerPluginIcon = plugin.icon || this.opts.defaultTabIcon;
var callerPluginType = plugin.type;
if (callerPluginType !== 'acquirer' && callerPluginType !== 'progressindicator' && callerPluginType !== 'presenter') {
var msg = 'Error: Modal can only be used by plugins of types: acquirer, progressindicator, presenter';
this.core.log(msg);
return;
}
var target = {
id: callerPluginId,
name: callerPluginName,
icon: callerPluginIcon,
type: callerPluginType,
focus: plugin.focus,
render: plugin.render,
isHidden: true
};
var modal = this.core.getState().modal;
var newTargets = modal.targets.slice();
newTargets.push(target);
this.core.setState({
modal: _extends({}, modal, {
targets: newTargets
})
});
return this.opts.target;
};
DashboardUI.prototype.hideAllPanels = function hideAllPanels() {
var modal = this.core.getState().modal;
var newTargets = modal.targets.map(function (target) {
return _extends({}, target, {
isHidden: true
});
});
this.core.setState({ modal: _extends({}, modal, {
targets: newTargets
}) });
};
DashboardUI.prototype.showPanel = function showPanel(id) {
var modal = this.core.getState().modal;
// hide all panels, except the one that matches current id
var newTargets = modal.targets.map(function (target) {
if (target.type === 'acquirer') {
if (target.id === id) {
target.focus();
return _extends({}, target, {
isHidden: false
});
}
return _extends({}, target, {
isHidden: true
});
}
return target;
});
this.core.setState({ modal: _extends({}, modal, {
targets: newTargets
}) });
};
DashboardUI.prototype.hideModal = function hideModal() {
var modal = this.core.getState().modal;
this.core.setState({
modal: _extends({}, modal, {
isHidden: true
})
});
document.body.classList.remove('is-UppyDashboard-open');
};
DashboardUI.prototype.showModal = function showModal() {
var modal = this.core.getState().modal;
this.core.setState({
modal: _extends({}, modal, {
isHidden: false
})
});
// add class to body that sets position fixed
document.body.classList.add('is-UppyDashboard-open');
// focus on modal inner block
document.querySelector('.UppyDashboard-inner').focus();
};
DashboardUI.prototype.initEvents = function initEvents() {
var _this2 = this;
// const dashboardEl = document.querySelector(`${this.opts.target} .UppyDashboard`)
// Modal open button
var showModalTrigger = document.querySelector(this.opts.trigger);
showModalTrigger.addEventListener('click', this.showModal);
// Close the Modal on esc key press
document.body.addEventListener('keyup', function (event) {
if (event.keyCode === 27) {
_this2.hideModal();
}
});
// Drag Drop
(0, _dragDrop2.default)(this.el, function (files) {
_this2.handleDrop(files);
});
};
DashboardUI.prototype.actions = function actions() {
var _this3 = this;
var bus = this.core.bus;
bus.on('core:file-add', function () {
_this3.hideAllPanels();
});
bus.on('dashboard:file-card', function (fileId) {
var modal = _this3.core.getState().modal;
_this3.core.setState({
modal: _extends({}, modal, {
fileCardFor: fileId || false
})
});
});
bus.on('core:success', function (uploadedCount) {
bus.emit('informer', _this3.core.i18n('files', { 'smart_count': uploadedCount }) + ' successfully uploaded, Sir!', 'info', 6000);
});
};
DashboardUI.prototype.handleDrop = function handleDrop(files) {
var _this4 = this;
this.core.log('All right, someone dropped something...');
files.forEach(function (file) {
_this4.core.bus.emit('core:file-add', {
source: _this4.id,
name: file.name,
type: file.type,
data: file
});
});
};
DashboardUI.prototype.pauseAll = function pauseAll() {
this.core.bus.emit('core:pause-all');
};
DashboardUI.prototype.resumeAll = function resumeAll() {
this.core.bus.emit('core:resume-all');
};
DashboardUI.prototype.getTotalSpeed = function getTotalSpeed(files) {
var totalSpeed = 0;
files.forEach(function (file) {
totalSpeed = totalSpeed + (0, _Utils.getSpeed)(file.progress);
});
return totalSpeed;
};
DashboardUI.prototype.getTotalETA = function getTotalETA(files) {
var totalSeconds = 0;
files.forEach(function (file) {
totalSeconds = totalSeconds + (0, _Utils.getETA)(file.progress);
});
return totalSeconds;
};
DashboardUI.prototype.render = function render(state) {
var _this5 = this;
var files = state.files;
var newFiles = Object.keys(files).filter(function (file) {
return !files[file].progress.uploadStarted;
});
var uploadStartedFiles = Object.keys(files).filter(function (file) {
return files[file].progress.uploadStarted;
});
var completeFiles = Object.keys(files).filter(function (file) {
return files[file].progress.uploadComplete;
});
var inProgressFiles = Object.keys(files).filter(function (file) {
return !files[file].progress.uploadComplete && files[file].progress.uploadStarted && !files[file].isPaused;
});
var inProgressFilesArray = [];
inProgressFiles.forEach(function (file) {
inProgressFilesArray.push(files[file]);
});
var totalSpeed = (0, _prettyBytes2.default)(this.getTotalSpeed(inProgressFilesArray));
var totalETA = (0, _Utils.prettyETA)(this.getTotalETA(inProgressFilesArray));
var isAllComplete = state.totalProgress === 100;
var isAllPaused = inProgressFiles.length === 0 && !isAllComplete;
var acquirers = state.modal.targets.filter(function (target) {
return target.type === 'acquirer';
});
var progressindicators = state.modal.targets.filter(function (target) {
return target.type === 'progressindicator';
});
var addFile = function addFile(file) {
_this5.core.emitter.emit('core:file-add', file);
};
var removeFile = function removeFile(fileID) {
_this5.core.emitter.emit('core:file-remove', fileID);
};
var startUpload = function startUpload(ev) {
_this5.core.emitter.emit('core:upload');
};
var pauseUpload = function pauseUpload(fileID) {
_this5.core.emitter.emit('core:upload-pause', fileID);
};
var showFileCard = function showFileCard(fileID) {
_this5.core.emitter.emit('dashboard:file-card', fileID);
};
var fileCardDone = function fileCardDone(meta, fileID) {
// console.log(meta, fileID)
// console.log('ФАЙЛ КАРД СОХРАНЯЮ, НАХУЙ')
_this5.core.emitter.emit('core:update-meta', meta, fileID);
_this5.core.emitter.emit('dashboard:file-card');
};
var info = function info(text, type, duration) {
_this5.core.emitter.emit('informer', text, type, duration);
};
return (0, _Dashboard2.default)({
state: state,
modal: state.modal,
newFiles: newFiles,
files: files,
totalFileCount: Object.keys(files).length,
uploadStartedFiles: uploadStartedFiles,
completeFiles: completeFiles,
inProgressFiles: inProgressFiles,
totalSpeed: totalSpeed,
totalETA: totalETA,
totalProgress: state.totalProgress,
isAllComplete: isAllComplete,
isAllPaused: isAllPaused,
acquirers: acquirers,
progressindicators: progressindicators,
autoProceed: this.core.opts.autoProceed,
id: this.id,
container: this.opts.target,
hideModal: this.hideModal,
panelSelectorPrefix: this.opts.panelSelectorPrefix,
showProgressDetails: this.opts.showProgressDetails,
inline: this.opts.inline,
semiTransparent: this.opts.semiTransparent,
onPaste: this.handlePaste,
showPanel: this.showPanel,
hideAllPanels: this.hideAllPanels,
log: this.core.log,
bus: this.core.emitter,
i18n: this.core.i18n,
pauseAll: this.pauseAll,
resumeAll: this.resumeAll,
addFile: addFile,
removeFile: removeFile,
info: info,
metaFields: state.metaFields,
startUpload: startUpload,
pauseUpload: pauseUpload,
fileCardFor: state.modal.fileCardFor,
showFileCard: showFileCard,
fileCardDone: fileCardDone
});
};
DashboardUI.prototype.install = function install() {
// Set default state for Modal
this.core.setState({ modal: {
isHidden: true,
showFileCard: false,
targets: []
} });
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
this.initEvents();
this.actions();
};
return DashboardUI;
}(_Plugin3.default);
exports.default = DashboardUI;
//# sourceMappingURL=index.js.map
},{"../../core/Utils":7,"../Plugin":37,"./Dashboard":11,"./icons":20,"drag-drop":48,"pretty-bytes":56}],22:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _templateObject = _taggedTemplateLiteralLoose(['\n <svg class="UppyIcon" width="28" height="28" viewBox="0 0 16 16">\n <path d="M15.982 2.97c0-.02 0-.02-.018-.037 0-.017-.017-.035-.035-.053 0 0 0-.018-.02-.018-.017-.018-.034-.053-.052-.07L13.19.123c-.017-.017-.034-.035-.07-.053h-.018c-.018-.017-.035-.017-.053-.034h-.02c-.017 0-.034-.018-.052-.018h-6.31a.415.415 0 0 0-.446.426V11.11c0 .25.196.446.445.446h8.89A.44.44 0 0 0 16 11.11V3.023c-.018-.018-.018-.035-.018-.053zm-2.65-1.46l1.157 1.157h-1.157V1.51zm1.78 9.157h-8V.89h5.332v2.22c0 .25.196.446.445.446h2.22v7.11z"/>\n <path d="M9.778 12.89H4V2.666a.44.44 0 0 0-.444-.445.44.44 0 0 0-.445.445v10.666c0 .25.197.445.446.445h6.222a.44.44 0 0 0 .444-.445.44.44 0 0 0-.444-.444z"/>\n <path d="M.444 16h6.223a.44.44 0 0 0 .444-.444.44.44 0 0 0-.443-.445H.89V4.89a.44.44 0 0 0-.446-.446A.44.44 0 0 0 0 4.89v10.666c0 .248.196.444.444.444z"/>\n </svg>\n '], ['\n <svg class="UppyIcon" width="28" height="28" viewBox="0 0 16 16">\n <path d="M15.982 2.97c0-.02 0-.02-.018-.037 0-.017-.017-.035-.035-.053 0 0 0-.018-.02-.018-.017-.018-.034-.053-.052-.07L13.19.123c-.017-.017-.034-.035-.07-.053h-.018c-.018-.017-.035-.017-.053-.034h-.02c-.017 0-.034-.018-.052-.018h-6.31a.415.415 0 0 0-.446.426V11.11c0 .25.196.446.445.446h8.89A.44.44 0 0 0 16 11.11V3.023c-.018-.018-.018-.035-.018-.053zm-2.65-1.46l1.157 1.157h-1.157V1.51zm1.78 9.157h-8V.89h5.332v2.22c0 .25.196.446.445.446h2.22v7.11z"/>\n <path d="M9.778 12.89H4V2.666a.44.44 0 0 0-.444-.445.44.44 0 0 0-.445.445v10.666c0 .25.197.445.446.445h6.222a.44.44 0 0 0 .444-.445.44.44 0 0 0-.444-.444z"/>\n <path d="M.444 16h6.223a.44.44 0 0 0 .444-.444.44.44 0 0 0-.443-.445H.89V4.89a.44.44 0 0 0-.446-.446A.44.44 0 0 0 0 4.89v10.666c0 .248.196.444.444.444z"/>\n </svg>\n ']),
_templateObject2 = _taggedTemplateLiteralLoose(['\n <div class="UppyDragDrop-container ', '">\n <form class="UppyDragDrop-inner"\n onsubmit=', '>\n <input class="UppyDragDrop-input UppyDragDrop-focus"\n type="file"\n name="files[]"\n multiple="true"\n value=""\n onchange=', ' />\n <label class="UppyDragDrop-label" onclick=', '>\n <strong>', '</strong>\n <span class="UppyDragDrop-dragText">', '</span>\n </label>\n ', '\n </form>\n </div>\n '], ['\n <div class="UppyDragDrop-container ', '">\n <form class="UppyDragDrop-inner"\n onsubmit=', '>\n <input class="UppyDragDrop-input UppyDragDrop-focus"\n type="file"\n name="files[]"\n multiple="true"\n value=""\n onchange=', ' />\n <label class="UppyDragDrop-label" onclick=', '>\n <strong>', '</strong>\n <span class="UppyDragDrop-dragText">', '</span>\n </label>\n ', '\n </form>\n </div>\n ']),
_templateObject3 = _taggedTemplateLiteralLoose(['<button class="UppyDragDrop-uploadBtn UppyNextBtn"\n type="submit"\n onclick=', '>\n ', '\n </button>'], ['<button class="UppyDragDrop-uploadBtn UppyNextBtn"\n type="submit"\n onclick=', '>\n ', '\n </button>']);
var _Plugin2 = require('./../Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _Utils = require('../../core/Utils');
var _dragDrop = require('drag-drop');
var _dragDrop2 = _interopRequireDefault(_dragDrop);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Drag & Drop plugin
*
*/
var DragDrop = function (_Plugin) {
_inherits(DragDrop, _Plugin);
function DragDrop(core, opts, props) {
_classCallCheck(this, DragDrop);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.type = 'acquirer';
_this.id = 'DragDrop';
_this.title = 'Drag & Drop';
_this.props = props;
_this.icon = (0, _html2.default)(_templateObject);
// Default options
var defaultOpts = {
target: '.UppyDragDrop'
};
// Merge default options with the ones set by user
_this.opts = _extends({}, defaultOpts, opts);
// Check for browser dragDrop support
_this.isDragDropSupported = _this.checkDragDropSupport();
// Bind `this` to class methods
_this.handleDrop = _this.handleDrop.bind(_this);
_this.checkDragDropSupport = _this.checkDragDropSupport.bind(_this);
_this.handleInputChange = _this.handleInputChange.bind(_this);
_this.render = _this.render.bind(_this);
return _this;
}
/**
* Checks if the browser supports Drag & Drop (not supported on mobile devices, for example).
* @return {Boolean} true if supported, false otherwise
*/
DragDrop.prototype.checkDragDropSupport = function checkDragDropSupport() {
var div = document.createElement('div');
if (!('draggable' in div) || !('ondragstart' in div && 'ondrop' in div)) {
return false;
}
if (!('FormData' in window)) {
return false;
}
if (!('FileReader' in window)) {
return false;
}
return true;
};
DragDrop.prototype.handleDrop = function handleDrop(files) {
var _this2 = this;
this.core.log('All right, someone dropped something...');
files.forEach(function (file) {
_this2.props.addFile({
source: _this2.id,
name: file.name,
type: file.type,
data: file
});
// this.core.emitter.emit('file-add', {
// source: this.id,
// name: file.name,
// type: file.type,
// data: file
// })
});
};
DragDrop.prototype.handleInputChange = function handleInputChange(ev) {
var _this3 = this;
this.core.log('All right, something selected through input...');
var files = (0, _Utils.toArray)(ev.target.files);
files.forEach(function (file) {
_this3.core.emitter.emit('core:file-add', {
source: _this3.id,
name: file.name,
type: file.type,
data: file
});
});
};
DragDrop.prototype.focus = function focus() {
var firstInput = document.querySelector(this.target + ' .UppyDragDrop-focus');
// only works for the first time if wrapped in setTimeout for some reason
setTimeout(function () {
firstInput.focus();
}, 10);
};
DragDrop.prototype.render = function render(state) {
var _this4 = this;
// Another way not to render next/upload button — if Modal is used as a target
var target = this.opts.target.name;
var onSelect = function onSelect(ev) {
var input = document.querySelector(_this4.target + ' .UppyDragDrop-input');
input.click();
};
var next = function next(ev) {
ev.preventDefault();
ev.stopPropagation();
_this4.core.emitter.emit('core:upload');
};
var onSubmit = function onSubmit(ev) {
ev.preventDefault();
};
return (0, _html2.default)(_templateObject2, this.isDragDropSupported ? 'is-dragdrop-supported' : '', onSubmit, this.handleInputChange.bind(this), onSelect, this.core.i18n('chooseFile'), this.core.i18n('orDragDrop'), !this.core.opts.autoProceed && target !== 'Dashboard' ? (0, _html2.default)(_templateObject3, next, this.core.i18n('upload')) : '');
};
DragDrop.prototype.install = function install() {
var _this5 = this;
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
(0, _dragDrop2.default)(this.target + ' .UppyDragDrop-container', function (files) {
_this5.handleDrop(files);
_this5.core.log(files);
});
};
return DragDrop;
}(_Plugin3.default);
exports.default = DragDrop;
//# sourceMappingURL=index.js.map
},{"../../core/Utils":7,"../../core/html":8,"./../Plugin":37,"drag-drop":48}],23:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _templateObject = _taggedTemplateLiteralLoose(['<h1>this is strange 1</h1>'], ['<h1>this is strange 1</h1>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<h2>this is strange 2</h2>'], ['<h2>this is strange 2</h2>']),
_templateObject3 = _taggedTemplateLiteralLoose(['\n <div class="wow-this-works">\n <input class="UppyDummy-firstInput" type="text" value="hello">\n ', '\n ', '\n </div>\n '], ['\n <div class="wow-this-works">\n <input class="UppyDummy-firstInput" type="text" value="hello">\n ', '\n ', '\n </div>\n ']);
var _Plugin2 = require('./Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _html = require('../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
// import { createInlineWorker } from '../core/Utils'
/**
* Dummy
*
*/
var Dummy = function (_Plugin) {
_inherits(Dummy, _Plugin);
function Dummy(core, opts, props) {
_classCallCheck(this, Dummy);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.type = 'acquirer';
_this.id = 'Dummy';
_this.title = 'Mr. Plugin';
_this.props = props;
// set default options
var defaultOptions = {};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
_this.strange = (0, _html2.default)(_templateObject);
_this.render = _this.render.bind(_this);
_this.install = _this.install.bind(_this);
return _this;
}
Dummy.prototype.addFakeFileJustToTest = function addFakeFileJustToTest() {
var blob = new Blob(['data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+CiAgPGNpcmNsZSBjeD0iNjAiIGN5PSI2MCIgcj0iNTAiLz4KPC9zdmc+Cg=='], { type: 'image/svg+xml' });
var file = {
source: 'acceptance-test',
name: 'test-file',
type: 'image/svg+xml',
data: blob
};
this.props.log('Adding fake file blob');
this.props.addFile(file);
};
Dummy.prototype.render = function render() {
var bla = (0, _html2.default)(_templateObject2);
return (0, _html2.default)(_templateObject3, this.strange, bla);
};
Dummy.prototype.focus = function focus() {
var _this2 = this;
var firstInput = document.querySelector(this.target + ' .UppyDummy-firstInput');
// only works for the first time if wrapped in setTimeout for some reason
// firstInput.focus()
setTimeout(function () {
firstInput.focus();
}, 10);
setTimeout(function () {
_this2.core.emit('informer', 'Hello! I’m a test Informer message', 'info', 4500);
_this2.addFakeFileJustToTest();
}, 1000);
};
Dummy.prototype.install = function install() {
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
//
// function workerFunc () {
// self.addEventListener('message', (e) => {
// const file = e.data.file
// const reader = new FileReaderSync()
// const dataURL = reader.readAsDataURL(file)
// postMessage({file: dataURL})
// })
// }
//
// const worker = createInlineWorker(workerFunc)
// const testFileBlob = new Blob(
// ['data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+CiAgPGNpcmNsZSBjeD0iNjAiIGN5PSI2MCIgcj0iNTAiLz4KPC9zdmc+Cg=='],
// {type: 'image/svg+xml'}
// )
// worker.postMessage({file: testFileBlob})
// worker.addEventListener('message', (e) => {
// console.log(e)
// })
};
return Dummy;
}(_Plugin3.default);
exports.default = Dummy;
//# sourceMappingURL=Dummy.js.map
},{"../core/html":8,"./Plugin":37}],24:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _templateObject = _taggedTemplateLiteralLoose(['<form class="UppyFormContainer">\n <input class="UppyForm-input"\n type="file"\n name="files[]"\n onchange=', '\n multiple="', '"\n value="">\n ', '\n </form>'], ['<form class="UppyFormContainer">\n <input class="UppyForm-input"\n type="file"\n name="files[]"\n onchange=', '\n multiple="', '"\n value="">\n ', '\n </form>']),
_templateObject2 = _taggedTemplateLiteralLoose(['<button class="UppyForm-uploadBtn UppyNextBtn"\n type="submit"\n onclick=', '>\n ', '\n </button>'], ['<button class="UppyForm-uploadBtn UppyNextBtn"\n type="submit"\n onclick=', '>\n ', '\n </button>']);
var _Plugin2 = require('./Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _Utils = require('../core/Utils');
var _Utils2 = _interopRequireDefault(_Utils);
var _html = require('../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Formtag = function (_Plugin) {
_inherits(Formtag, _Plugin);
function Formtag(core, opts) {
_classCallCheck(this, Formtag);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.id = 'Formtag';
_this.title = 'Formtag';
_this.type = 'acquirer';
// Default options
var defaultOptions = {
target: '.UppyForm',
replaceTargetContent: true,
multipleFiles: true
};
// Merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
_this.render = _this.render.bind(_this);
return _this;
}
Formtag.prototype.handleInputChange = function handleInputChange(ev) {
var _this2 = this;
this.core.log('All right, something selected through input...');
// this added rubbish keys like “length” to the resulting array
// const files = Object.keys(ev.target.files).map((key) => {
// return ev.target.files[key]
// })
var files = _Utils2.default.toArray(ev.target.files);
files.forEach(function (file) {
_this2.core.emitter.emit('core:file-add', {
source: _this2.id,
name: file.name,
type: file.type,
data: file
});
});
};
Formtag.prototype.render = function render(state) {
var _this3 = this;
var upload = function upload(ev) {
ev.preventDefault();
ev.stopPropagation();
_this3.core.emitter.emit('core:upload');
};
return (0, _html2.default)(_templateObject, this.handleInputChange.bind(this), this.opts.multipleFiles ? 'true' : 'false', !this.core.opts.autoProceed && this.opts.target.name !== 'Modal' ? (0, _html2.default)(_templateObject2, upload, this.core.i18n('upload')) : '');
};
Formtag.prototype.install = function install() {
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
};
// run (results) {
// console.log({
// class: 'Formtag',
// method: 'run',
// results: results
// })
//
// const button = document.querySelector(this.opts.doneButtonSelector)
// var self = this
//
// return new Promise((resolve, reject) => {
// button.addEventListener('click', (e) => {
// var fields = document.querySelectorAll(self.opts.selector)
// var selected = [];
//
// [].forEach.call(fields, (field, i) => {
// selected.push({
// from: 'Formtag',
// files: field.files
// })
// })
// resolve(selected)
// })
// })
// }
return Formtag;
}(_Plugin3.default);
exports.default = Formtag;
//# sourceMappingURL=Formtag.js.map
},{"../core/Utils":7,"../core/html":8,"./Plugin":37}],25:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<a onclick=', '>Proceed with Demo Account</a>'], ['<a onclick=', '>Proceed with Demo Account</a>']),
_templateObject2 = _taggedTemplateLiteralLoose(['\n <div class="UppyGoogleDrive-authenticate">\n <h1>You need to authenticate with Google before selecting files.</h1>\n <a href=', '>Authenticate</a>\n ', '\n </div>\n '], ['\n <div class="UppyGoogleDrive-authenticate">\n <h1>You need to authenticate with Google before selecting files.</h1>\n <a href=', '>Authenticate</a>\n ', '\n </div>\n ']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
var demoLink = props.demo ? (0, _html2.default)(_templateObject, props.handleDemoAuth) : null;
return (0, _html2.default)(_templateObject2, props.link, demoLink);
};
//# sourceMappingURL=AuthView.js.map
},{"../../core/html":8}],26:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <div>\n <span>\n Something went wrong. Probably our fault. ', '\n </span>\n </div>\n '], ['\n <div>\n <span>\n Something went wrong. Probably our fault. ', '\n </span>\n </div>\n ']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject, props.error);
};
//# sourceMappingURL=Error.js.map
},{"../../core/html":8}],27:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _templateObject = _taggedTemplateLiteralLoose(['\n <svg class="UppyIcon UppyModalTab-icon" width="28" height="28" viewBox="0 0 16 16">\n <path d="M2.955 14.93l2.667-4.62H16l-2.667 4.62H2.955zm2.378-4.62l-2.666 4.62L0 10.31l5.19-8.99 2.666 4.62-2.523 4.37zm10.523-.25h-5.333l-5.19-8.99h5.334l5.19 8.99z"/>\n </svg>\n '], ['\n <svg class="UppyIcon UppyModalTab-icon" width="28" height="28" viewBox="0 0 16 16">\n <path d="M2.955 14.93l2.667-4.62H16l-2.667 4.62H2.955zm2.378-4.62l-2.666 4.62L0 10.31l5.19-8.99 2.666 4.62-2.523 4.37zm10.523-.25h-5.333l-5.19-8.99h5.334l5.19 8.99z"/>\n </svg>\n ']);
var _Utils = require('../../core/Utils');
var _Utils2 = _interopRequireDefault(_Utils);
var _Plugin2 = require('../Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
require('whatwg-fetch');
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _Provider = require('../../uppy-base/src/plugins/Provider');
var _Provider2 = _interopRequireDefault(_Provider);
var _AuthView = require('./AuthView');
var _AuthView2 = _interopRequireDefault(_AuthView);
var _Browser = require('./new/Browser');
var _Browser2 = _interopRequireDefault(_Browser);
var _Error = require('./Error');
var _Error2 = _interopRequireDefault(_Error);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Google = function (_Plugin) {
_inherits(Google, _Plugin);
function Google(core, opts) {
_classCallCheck(this, Google);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.type = 'acquirer';
_this.id = 'GoogleDrive';
_this.title = 'Google Drive';
_this.icon = (0, _html2.default)(_templateObject);
_this.GoogleDrive = new _Provider2.default({
host: _this.opts.host,
provider: 'google'
});
_this.files = [];
// this.core.socket.on('')
// Logic
_this.addFile = _this.addFile.bind(_this);
_this.filterItems = _this.filterItems.bind(_this);
_this.filterQuery = _this.filterQuery.bind(_this);
_this.getFolder = _this.getFolder.bind(_this);
_this.getNextFolder = _this.getNextFolder.bind(_this);
_this.handleRowClick = _this.handleRowClick.bind(_this);
_this.logout = _this.logout.bind(_this);
_this.handleDemoAuth = _this.handleDemoAuth.bind(_this);
_this.sortByTitle = _this.sortByTitle.bind(_this);
_this.sortByDate = _this.sortByDate.bind(_this);
// Visual
_this.render = _this.render.bind(_this);
// set default options
var defaultOptions = {};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
return _this;
}
Google.prototype.install = function install() {
var _this2 = this;
// Set default state for Google Drive
this.core.setState({
googleDrive: {
authenticated: false,
files: [],
folders: [],
directories: [{
title: 'My Drive',
id: 'root'
}],
activeRow: -1,
filterInput: ''
}
});
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
this.checkAuthentication().then(function (authenticated) {
_this2.updateState({ authenticated: authenticated });
console.log('are we authenticated?');
console.log(authenticated);
if (authenticated) {
return _this2.getFolder('root');
}
return authenticated;
}).then(function (newState) {
_this2.updateState(newState);
});
return;
};
Google.prototype.focus = function focus() {};
/**
* Little shorthand to update the state with my new state
*/
Google.prototype.updateState = function updateState(newState) {
var state = this.core.state;
var googleDrive = _extends({}, state.googleDrive, newState);
this.core.setState({ googleDrive: googleDrive });
};
/**
* Check to see if the user is authenticated.
* @return {Promise} authentication status
*/
Google.prototype.checkAuthentication = function checkAuthentication() {
var _this3 = this;
return fetch(this.opts.host + '/google/authorize', {
method: 'get',
credentials: 'include',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then(function (res) {
console.log(res.status);
if (res.status < 200 || res.status > 300) {
_this3.updateState({
authenticated: false,
error: true
});
var error = new Error(res.statusText);
error.response = res;
throw error;
}
return res.json();
}).then(function (data) {
return data.isAuthenticated;
}).catch(function (err) {
return err;
});
};
/**
* Based on folder ID, fetch a new folder
* @param {String} id Folder id
* @return {Promise} Folders/files in folder
*/
Google.prototype.getFolder = function getFolder() {
var id = arguments.length <= 0 || arguments[0] === undefined ? 'root' : arguments[0];
return this.GoogleDrive.list(id).then(function (res) {
// let result = Utils.groupBy(data.items, (item) => item.mimeType)
var folders = [];
var files = [];
res.items.forEach(function (item) {
if (item.mimeType === 'application/vnd.google-apps.folder') {
folders.push(item);
} else {
files.push(item);
}
});
return {
folders: folders,
files: files
};
}).catch(function (err) {
return err;
});
};
/**
* Fetches new folder and adds to breadcrumb nav
* @param {String} id Folder id
* @param {String} title Folder title
*/
Google.prototype.getNextFolder = function getNextFolder(id, title) {
var _this4 = this;
this.getFolder(id).then(function (data) {
var state = _this4.core.getState().googleDrive;
var index = state.directories.findIndex(function (dir) {
return id === dir.id;
});
var updatedDirectories = void 0;
if (index !== -1) {
updatedDirectories = state.directories.slice(0, index + 1);
} else {
updatedDirectories = state.directories.concat([{
id: id,
title: title
}]);
}
_this4.updateState(_Utils2.default.extend(data, {
directories: updatedDirectories
}));
});
};
Google.prototype.addFile = function addFile(file) {
var tagFile = {
source: this.id,
data: file,
name: file.title,
type: file.mimeType,
isRemote: true,
body: {
fileId: file.id
},
remote: {
host: this.opts.host,
url: this.opts.host + '/google/get?fileId=' + file.id,
body: {
fileId: file.id
}
}
};
console.log('adding file');
this.core.emitter.emit('core:file-add', tagFile);
};
Google.prototype.handleError = function handleError(response) {
var _this5 = this;
this.checkAuthentication().then(function (authenticated) {
_this5.updateState({ authenticated: authenticated });
});
};
/**
* Removes session token on client side.
*/
Google.prototype.logout = function logout() {
var _this6 = this;
this.GoogleDrive.logout(location.href).then(function (res) {
return res.json();
}).then(function (res) {
if (res.ok) {
console.log('ok');
var newState = {
authenticated: false,
files: [],
folders: [],
directories: [{
title: 'My Drive',
id: 'root'
}]
};
_this6.updateState(newState);
}
});
};
Google.prototype.getFileType = function getFileType(file) {
var fileTypes = {
'application/vnd.google-apps.folder': 'Folder',
'application/vnd.google-apps.document': 'Google Docs',
'application/vnd.google-apps.spreadsheet': 'Google Sheets',
'application/vnd.google-apps.presentation': 'Google Slides',
'image/jpeg': 'JPEG Image',
'image/png': 'PNG Image'
};
return fileTypes[file.mimeType] ? fileTypes[file.mimeType] : file.fileExtension.toUpperCase();
};
/**
* Used to set active file/folder.
* @param {Object} file Active file/folder
*/
Google.prototype.handleRowClick = function handleRowClick(fileId) {
var state = this.core.getState().googleDrive;
var newState = _extends({}, state, {
activeRow: fileId
});
this.updateState(newState);
};
Google.prototype.filterQuery = function filterQuery(e) {
var state = this.core.getState().googleDrive;
this.updateState(_extends({}, state, {
filterInput: e.target.value
}));
};
Google.prototype.filterItems = function filterItems(items) {
var state = this.core.getState().googleDrive;
return items.filter(function (folder) {
return folder.title.toLowerCase().indexOf(state.filterInput.toLowerCase()) !== -1;
});
};
Google.prototype.sortByTitle = function sortByTitle() {
var state = _extends({}, this.core.getState().googleDrive);
var files = state.files;
var folders = state.folders;
var sorting = state.sorting;
var sortedFiles = files.sort(function (fileA, fileB) {
if (sorting === 'titleDescending') {
return fileB.title.localeCompare(fileA.title);
}
return fileA.title.localeCompare(fileB.title);
});
var sortedFolders = folders.sort(function (folderA, folderB) {
if (sorting === 'titleDescending') {
return folderB.title.localeCompare(folderA.title);
}
return folderA.title.localeCompare(folderB.title);
});
this.updateState(_extends({}, state, {
files: sortedFiles,
folders: sortedFolders,
sorting: sorting === 'titleDescending' ? 'titleAscending' : 'titleDescending'
}));
};
Google.prototype.sortByDate = function sortByDate() {
var state = _extends({}, this.core.getState().googleDrive);
var files = state.files;
var folders = state.folders;
var sorting = state.sorting;
var sortedFiles = files.sort(function (fileA, fileB) {
var a = new Date(fileA.modifiedByMeDate);
var b = new Date(fileB.modifiedByMeDate);
if (sorting === 'dateDescending') {
return a > b ? -1 : a < b ? 1 : 0;
}
return a > b ? 1 : a < b ? -1 : 0;
});
var sortedFolders = folders.sort(function (folderA, folderB) {
var a = new Date(folderA.modifiedByMeDate);
var b = new Date(folderB.modifiedByMeDate);
if (sorting === 'dateDescending') {
return a > b ? -1 : a < b ? 1 : 0;
}
return a > b ? 1 : a < b ? -1 : 0;
});
this.updateState(_extends({}, state, {
files: sortedFiles,
folders: sortedFolders,
sorting: sorting === 'dateDescending' ? 'dateAscending' : 'dateDescending'
}));
};
Google.prototype.handleDemoAuth = function handleDemoAuth() {
var state = this.core.getState().googleDrive;
this.updateState({}, state, {
authenticated: true
});
};
Google.prototype.render = function render(state) {
var _state$googleDrive = state.googleDrive;
var authenticated = _state$googleDrive.authenticated;
var error = _state$googleDrive.error;
if (error) {
return (0, _Error2.default)({ error: error });
}
if (!authenticated) {
var authState = btoa(JSON.stringify({
redirect: location.href.split('#')[0]
}));
var link = this.opts.host + '/connect/google?state=' + authState;
return (0, _AuthView2.default)({
link: link,
demo: this.opts.demo,
handleDemoAuth: this.handleDemoAuth
});
}
var browserProps = _extends({}, state.googleDrive, {
getNextFolder: this.getNextFolder,
getFolder: this.getFolder,
addFile: this.addFile,
filterItems: this.filterItems,
filterQuery: this.filterQuery,
handleRowClick: this.handleRowClick,
sortByTitle: this.sortByTitle,
sortByDate: this.sortByDate,
logout: this.logout,
demo: this.opts.demo
});
return (0, _Browser2.default)(browserProps);
};
return Google;
}(_Plugin3.default);
exports.default = Google;
//# sourceMappingURL=index.js.map
},{"../../core/Utils":7,"../../core/html":8,"../../uppy-base/src/plugins/Provider":45,"../Plugin":37,"./AuthView":25,"./Error":26,"./new/Browser":30,"whatwg-fetch":66}],28:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <li>\n <button onclick=', '>', '</button>\n </li>\n '], ['\n <li>\n <button onclick=', '>', '</button>\n </li>\n ']);
var _html = require('../../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject, props.getNextFolder, props.title);
};
//# sourceMappingURL=Breadcrumb.js.map
},{"../../../core/html":8}],29:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <ul class="UppyGoogleDrive-breadcrumbs">\n ', '\n </ul>\n '], ['\n <ul class="UppyGoogleDrive-breadcrumbs">\n ', '\n </ul>\n ']);
var _html = require('../../../core/html');
var _html2 = _interopRequireDefault(_html);
var _Breadcrumb = require('./Breadcrumb');
var _Breadcrumb2 = _interopRequireDefault(_Breadcrumb);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject, props.directories.map(function (directory) {
return (0, _Breadcrumb2.default)({
getNextFolder: function getNextFolder() {
return props.getNextFolder(directory.id, directory.title);
},
title: directory.title
});
}));
};
//# sourceMappingURL=Breadcrumbs.js.map
},{"../../../core/html":8,"./Breadcrumb":28}],30:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <div class="Browser">\n <header>\n <input\n type="text"\n class="Browser-search"\n placeholder="Search Drive"\n onkeyup=', '\n value=', '/>\n </header>\n <div class="Browser-subHeader">\n ', '\n </div>\n <div class="Browser-body">\n <main class="Browser-content">\n ', '\n </main>\n </div>\n </div>\n '], ['\n <div class="Browser">\n <header>\n <input\n type="text"\n class="Browser-search"\n placeholder="Search Drive"\n onkeyup=', '\n value=', '/>\n </header>\n <div class="Browser-subHeader">\n ', '\n </div>\n <div class="Browser-body">\n <main class="Browser-content">\n ', '\n </main>\n </div>\n </div>\n ']);
var _html = require('../../../core/html');
var _html2 = _interopRequireDefault(_html);
var _Breadcrumbs = require('./Breadcrumbs');
var _Breadcrumbs2 = _interopRequireDefault(_Breadcrumbs);
var _Table = require('./Table');
var _Table2 = _interopRequireDefault(_Table);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
var filteredFolders = props.folders;
var filteredFiles = props.files;
if (props.filterInput !== '') {
filteredFolders = props.filterItems(props.folders);
filteredFiles = props.filterItems(props.files);
}
return (0, _html2.default)(_templateObject, props.filterQuery, props.filterInput, (0, _Breadcrumbs2.default)({
getNextFolder: props.getNextFolder,
directories: props.directories
}), (0, _Table2.default)({
columns: [{
name: 'Name',
key: 'title'
}],
folders: filteredFolders,
files: filteredFiles,
activeRow: props.activeRow,
sortByTitle: props.sortByTitle,
sortByDate: props.sortByDate,
handleRowClick: props.handleRowClick,
handleFileDoubleClick: props.addFile,
handleFolderDoubleClick: props.getNextFolder
}));
};
//# sourceMappingURL=Browser.js.map
},{"../../../core/html":8,"./Breadcrumbs":29,"./Table":31}],31:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <th class="BrowserTable-headerColumn BrowserTable-column" onclick=', '>\n ', '\n </th>\n '], ['\n <th class="BrowserTable-headerColumn BrowserTable-column" onclick=', '>\n ', '\n </th>\n ']),
_templateObject2 = _taggedTemplateLiteralLoose(['\n <table class="BrowserTable">\n <thead class="BrowserTable-header">\n <tr>\n ', '\n </tr>\n </thead>\n <tbody>\n ', '\n ', '\n </tbody>\n </table>\n '], ['\n <table class="BrowserTable">\n <thead class="BrowserTable-header">\n <tr>\n ', '\n </tr>\n </thead>\n <tbody>\n ', '\n ', '\n </tbody>\n </table>\n ']);
var _html = require('../../../core/html');
var _html2 = _interopRequireDefault(_html);
var _TableRow = require('./TableRow');
var _TableRow2 = _interopRequireDefault(_TableRow);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
var headers = props.columns.map(function (column) {
return (0, _html2.default)(_templateObject, props.sortByTitle, column.name);
});
return (0, _html2.default)(_templateObject2, headers, props.folders.map(function (folder) {
return (0, _TableRow2.default)({
title: folder.title,
active: props.activeRow === folder.id,
iconLink: folder.iconLink,
modifiedByMeDate: folder.modifiedByMeDate,
handleClick: function handleClick() {
return props.handleRowClick(folder.id);
},
handleDoubleClick: function handleDoubleClick() {
return props.handleFolderDoubleClick(folder.id, folder.title);
},
columns: props.columns
});
}), props.files.map(function (file) {
return (0, _TableRow2.default)({
title: file.title,
active: props.activeRow === file.id,
iconLink: file.iconLink,
modifiedByMeDate: file.modifiedByMeDate,
handleClick: function handleClick() {
return props.handleRowClick(file.id);
},
handleDoubleClick: function handleDoubleClick() {
return props.handleFileDoubleClick(file);
},
columns: props.columns,
owner: 'Joe Mama'
});
}));
};
//# sourceMappingURL=Table.js.map
},{"../../../core/html":8,"./TableRow":33}],32:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <td class="BrowserTable-rowColumn BrowserTable-column">\n <img src=', '/> ', '\n </td>\n '], ['\n <td class="BrowserTable-rowColumn BrowserTable-column">\n <img src=', '/> ', '\n </td>\n ']);
var _html = require('../../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject, props.iconLink, props.value);
};
//# sourceMappingURL=TableColumn.js.map
},{"../../../core/html":8}],33:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <tr onclick=', ' ondblclick=', ' class=', '>\n ', '\n </tr>\n '], ['\n <tr onclick=', ' ondblclick=', ' class=', '>\n ', '\n </tr>\n ']);
var _html = require('../../../core/html');
var _html2 = _interopRequireDefault(_html);
var _TableColumn = require('./TableColumn');
var _TableColumn2 = _interopRequireDefault(_TableColumn);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
var classes = props.active ? 'BrowserTable-row is-active' : 'BrowserTable-row';
return (0, _html2.default)(_templateObject, props.handleClick, props.handleDoubleClick, classes, (0, _TableColumn2.default)({
iconLink: props.iconLink,
value: props.title || ''
}));
};
//# sourceMappingURL=TableRow.js.map
},{"../../../core/html":8,"./TableColumn":32}],34:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _templateObject = _taggedTemplateLiteralLoose(['<div class="UppyInformer" aria-hidden="', '">\n <p>', '</p>\n </div>'], ['<div class="UppyInformer" aria-hidden="', '">\n <p>', '</p>\n </div>']);
var _Plugin2 = require('./Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _html = require('../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Informer
* Shows rad message bubbles
* used like this: `bus.emit('informer', 'hello world', 'info', 5000)`
* or for errors: `bus.emit('informer', 'Error uploading img.jpg', 'error', 5000)`
*
*/
var Informer = function (_Plugin) {
_inherits(Informer, _Plugin);
function Informer(core, opts) {
_classCallCheck(this, Informer);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.type = 'progressindicator';
_this.id = 'Informer';
_this.title = 'Informer';
// set default options
var defaultOptions = {};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
return _this;
}
Informer.prototype.showInformer = function showInformer(msg, type, duration) {
var _this2 = this;
this.core.setState({
informer: {
isHidden: false,
msg: msg
}
});
if (duration === 0) return;
// hide the informer after `duration` milliseconds
setTimeout(function () {
var newInformer = _extends({}, _this2.core.getState().informer, {
isHidden: true
});
_this2.core.setState({
informer: newInformer
});
}, duration);
};
Informer.prototype.hideInformer = function hideInformer() {
var newInformer = _extends({}, this.core.getState().informer, {
isHidden: true
});
this.core.setState({
informer: newInformer
});
};
Informer.prototype.render = function render(state) {
var msg = state.informer.msg;
var isHidden = state.informer.isHidden;
// @TODO add aria-live for screen-readers
return (0, _html2.default)(_templateObject, isHidden, msg);
};
Informer.prototype.install = function install() {
var _this3 = this;
// Set default state for Google Drive
this.core.setState({
informer: {
isHidden: true,
msg: ''
}
});
var bus = this.core.bus;
bus.on('informer', function (msg, type, duration) {
_this3.showInformer(msg, type, duration);
});
bus.on('informer-hide', function () {
_this3.hideInformer();
});
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
};
return Informer;
}(_Plugin3.default);
exports.default = Informer;
//# sourceMappingURL=Informer.js.map
},{"../core/html":8,"./Plugin":37}],35:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Plugin2 = require('./Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Meta Data
* Adds metadata fields to Uppy
*
*/
var MetaData = function (_Plugin) {
_inherits(MetaData, _Plugin);
function MetaData(core, opts) {
_classCallCheck(this, MetaData);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.type = 'modifier';
_this.id = 'MetaData';
_this.title = 'Meta Data';
// set default options
var defaultOptions = {};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
return _this;
}
MetaData.prototype.addInitialMeta = function addInitialMeta() {
var _this2 = this;
var metaFields = this.opts.fields;
this.core.setState({
metaFields: metaFields
});
this.core.emitter.on('file-added', function (fileID) {
metaFields.forEach(function (item) {
var obj = {};
obj[item.id] = item.value;
_this2.core.updateMeta(obj, fileID);
});
});
};
MetaData.prototype.install = function install() {
this.addInitialMeta();
};
return MetaData;
}(_Plugin3.default);
exports.default = MetaData;
//# sourceMappingURL=MetaData.js.map
},{"./Plugin":37}],36:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Plugin2 = require('./Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise;
var Multipart = function (_Plugin) {
_inherits(Multipart, _Plugin);
function Multipart(core, opts) {
_classCallCheck(this, Multipart);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.type = 'uploader';
_this.id = 'Multipart';
_this.title = 'Multipart';
// Default options
var defaultOptions = {
fieldName: 'files[]',
responseUrlFieldName: 'url',
bundle: true
};
// Merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
return _this;
}
Multipart.prototype.upload = function upload(file, current, total) {
var _this2 = this;
this.core.log('uploading ' + current + ' of ' + total);
return new _Promise(function (resolve, reject) {
// turn file into an array so we can use bundle
// if (!this.opts.bundle) {
// files = [files[current]]
// }
// for (let i in files) {
// formPost.append(this.opts.fieldName, files[i])
// }
var formPost = new FormData();
formPost.append(_this2.opts.fieldName, file.data);
Object.keys(file.meta).forEach(function (item) {
console.log(file.meta, file.meta[item]);
formPost.append(file.meta, file.meta[item]);
});
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress', function (ev) {
if (ev.lengthComputable) {
// Dispatch progress event
_this2.core.emitter.emit('core:upload-progress', {
uploader: _this2,
id: file.id,
bytesUploaded: ev.loaded,
bytesTotal: ev.total
});
}
});
xhr.addEventListener('load', function (ev) {
if (ev.target.status === 200) {
var resp = JSON.parse(xhr.response);
var uploadURL = resp[_this2.opts.responseUrlFieldName];
_this2.core.emitter.emit('core:upload-success', file.id, uploadURL);
_this2.core.log('Download ' + file.name + ' from ' + file.uploadURL);
return resolve(file);
}
// var upload = {}
//
// if (this.opts.bundle) {
// upload = {files: files}
// } else {
// upload = {file: files[current]}
// }
});
xhr.addEventListener('error', function (ev) {
_this2.core.emitter.emit('core:upload-error', file.id);
return reject('Upload error');
});
xhr.open('POST', _this2.opts.endpoint, true);
xhr.send(formPost);
_this2.core.emitter.emit('core:upload-started', file.id);
});
};
Multipart.prototype.selectForUpload = function selectForUpload(files) {
var _this3 = this;
if (Object.keys(files).length === 0) {
this.core.log('no files to upload!');
return;
}
var filesForUpload = [];
Object.keys(files).forEach(function (file) {
if (files[file].progress.percentage === 0) {
filesForUpload.push(files[file]);
}
});
var uploaders = [];
filesForUpload.forEach(function (file, i) {
var current = parseInt(i, 10) + 1;
var total = filesForUpload.length;
uploaders.push(_this3.upload(file, current, total));
});
return Promise.all(uploaders).then(function (result) {
_this3.core.log('Multipart has finished uploading!');
});
// if (this.opts.bundle) {
// uploaders.push(this.upload(files, 0, files.length))
// } else {
// for (let i in files) {
// uploaders.push(this.upload(files, i, files.length))
// }
// }
};
Multipart.prototype.install = function install() {
var _this4 = this;
var bus = this.core.emitter;
bus.on('core:upload', function () {
_this4.core.log('Multipart is uploading...');
var files = _this4.core.getState().files;
_this4.selectForUpload(files);
});
};
return Multipart;
}(_Plugin3.default);
exports.default = Multipart;
//# sourceMappingURL=Multipart.js.map
},{"./Plugin":37,"es6-promise":51}],37:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _yoYo = require('yo-yo');
var _yoYo2 = _interopRequireDefault(_yoYo);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Boilerplate that all Plugins share - and should not be used
* directly. It also shows which methods final plugins should implement/override,
* this deciding on structure.
*
* @param {object} main Uppy core object
* @param {object} object with plugin options
* @return {array | string} files or success/fail message
*/
var Plugin = function () {
function Plugin(core, opts) {
_classCallCheck(this, Plugin);
this.core = core;
this.opts = opts || {};
this.type = 'none';
// clear everything inside the target selector
this.opts.replaceTargetContent === this.opts.replaceTargetContent || true;
this.update = this.update.bind(this);
this.mount = this.mount.bind(this);
this.focus = this.focus.bind(this);
this.install = this.install.bind(this);
}
Plugin.prototype.update = function update(state) {
if (typeof this.el === 'undefined') {
return;
}
var newEl = this.render(state);
_yoYo2.default.update(this.el, newEl);
// optimizes performance?
// requestAnimationFrame(() => {
// const newEl = this.render(state)
// yo.update(this.el, newEl)
// })
};
/**
* Check if supplied `target` is a `string` or an `object`.
* If it’s an object — target is a plugin, and we search `plugins`
* for a plugin with same name and return its target.
*
* @param {String|Object} target
*
*/
Plugin.prototype.mount = function mount(target, plugin) {
var callerPluginName = plugin.id;
if (typeof target === 'string') {
this.core.log('Installing ' + callerPluginName + ' to ' + target);
// clear everything inside the target container
if (this.opts.replaceTargetContent) {
document.querySelector(target).innerHTML = '';
}
this.el = plugin.render(this.core.state);
document.querySelector(target).appendChild(this.el);
return target;
} else {
// TODO: is instantiating the plugin really the way to roll
// just to get the plugin name?
var Target = target;
var targetPluginName = new Target().id;
this.core.log('Installing ' + callerPluginName + ' to ' + targetPluginName);
var targetPlugin = this.core.getPlugin(targetPluginName);
var selectorTarget = targetPlugin.addTarget(plugin);
return selectorTarget;
}
};
Plugin.prototype.focus = function focus() {
return;
};
Plugin.prototype.install = function install() {
return;
};
return Plugin;
}();
exports.default = Plugin;
//# sourceMappingURL=Plugin.js.map
},{"yo-yo":67}],38:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _templateObject = _taggedTemplateLiteralLoose(['<div class="UppyProgressBar" style="', '">\n <div class="UppyProgressBar-inner" style="width: ', '%"></div>\n <div class="UppyProgressBar-percentage">', '</div>\n </div>'], ['<div class="UppyProgressBar" style="', '">\n <div class="UppyProgressBar-inner" style="width: ', '%"></div>\n <div class="UppyProgressBar-percentage">', '</div>\n </div>']);
var _Plugin2 = require('./Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _html = require('../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Progress bar
*
*/
var ProgressBar = function (_Plugin) {
_inherits(ProgressBar, _Plugin);
function ProgressBar(core, opts) {
_classCallCheck(this, ProgressBar);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.id = 'ProgressBar';
_this.title = 'Progress Bar';
_this.type = 'progressindicator';
// set default options
var defaultOptions = {
replaceTargetContent: false,
fixed: false
};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
_this.render = _this.render.bind(_this);
return _this;
}
ProgressBar.prototype.render = function render(state) {
var progress = state.totalProgress || 0;
return (0, _html2.default)(_templateObject, this.opts.fixed ? 'position: fixed' : 'null', progress, progress);
};
ProgressBar.prototype.install = function install() {
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
};
return ProgressBar;
}(_Plugin3.default);
exports.default = ProgressBar;
//# sourceMappingURL=ProgressBar.js.map
},{"../core/html":8,"./Plugin":37}],39:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Plugin2 = require('./Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _tusJsClient = require('tus-js-client');
var _tusJsClient2 = _interopRequireDefault(_tusJsClient);
var _UppySocket = require('../core/UppySocket');
var _UppySocket2 = _interopRequireDefault(_UppySocket);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise;
/**
* Tus resumable file uploader
*
*/
var Tus10 = function (_Plugin) {
_inherits(Tus10, _Plugin);
function Tus10(core, opts) {
_classCallCheck(this, Tus10);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.type = 'uploader';
_this.id = 'Tus';
_this.title = 'Tus';
// set default options
var defaultOptions = {
resume: true,
allowPause: true
};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
return _this;
}
Tus10.prototype.pauseResume = function pauseResume(action, fileID) {
var updatedFiles = _extends({}, this.core.getState().files);
var inProgressUpdatedFiles = Object.keys(updatedFiles).filter(function (file) {
return !updatedFiles[file].progress.uploadComplete && updatedFiles[file].progress.uploadStarted;
});
switch (action) {
case 'toggle':
if (updatedFiles[fileID].uploadComplete) return;
var wasPaused = updatedFiles[fileID].isPaused || false;
var isPaused = !wasPaused;
var updatedFile = void 0;
if (wasPaused) {
updatedFile = _extends({}, updatedFiles[fileID], {
isPaused: false
});
} else {
updatedFile = _extends({}, updatedFiles[fileID], {
isPaused: true
});
}
updatedFiles[fileID] = updatedFile;
this.core.setState({ files: updatedFiles });
return isPaused;
case 'pauseAll':
inProgressUpdatedFiles.forEach(function (file) {
var updatedFile = _extends({}, updatedFiles[file], {
isPaused: true
});
updatedFiles[file] = updatedFile;
});
this.core.setState({ files: updatedFiles });
return;
case 'resumeAll':
inProgressUpdatedFiles.forEach(function (file) {
var updatedFile = _extends({}, updatedFiles[file], {
isPaused: false
});
updatedFiles[file] = updatedFile;
});
this.core.setState({ files: updatedFiles });
return;
}
};
/**
* Create a new Tus upload
*
* @param {object} file for use with upload
* @param {integer} current file in a queue
* @param {integer} total number of files in a queue
* @returns {Promise}
*/
Tus10.prototype.upload = function upload(file, current, total) {
var _this2 = this;
this.core.log('uploading ' + current + ' of ' + total);
// Create a new tus upload
return new _Promise(function (resolve, reject) {
var upload = new _tusJsClient2.default.Upload(file.data, {
// TODO merge this.opts or this.opts.tus here
metadata: file.meta,
resume: _this2.opts.resume,
endpoint: _this2.opts.endpoint,
onError: function onError(err) {
_this2.core.log(err);
_this2.core.emitter.emit('core:upload-error', file.id);
reject('Failed because: ' + err);
},
onProgress: function onProgress(bytesUploaded, bytesTotal) {
// Dispatch progress event
_this2.core.emitter.emit('core:upload-progress', {
uploader: _this2,
id: file.id,
bytesUploaded: bytesUploaded,
bytesTotal: bytesTotal
});
},
onSuccess: function onSuccess() {
_this2.core.emitter.emit('core:upload-success', file.id, upload.url);
_this2.core.log('Download ' + upload.file.name + ' from ' + upload.url);
resolve(upload);
}
});
_this2.core.emitter.on('core:file-remove', function (fileID) {
if (fileID === file.id) {
console.log('removing file: ', fileID);
upload.abort();
resolve('upload ' + fileID + ' was removed');
}
});
_this2.core.emitter.on('core:upload-pause', function (fileID) {
if (fileID === file.id) {
var isPaused = _this2.pauseResume('toggle', fileID);
isPaused ? upload.abort() : upload.start();
}
});
_this2.core.emitter.on('core:pause-all', function () {
var files = _this2.core.getState().files;
if (!files[file.id]) return;
upload.abort();
});
_this2.core.emitter.on('core:resume-all', function () {
var files = _this2.core.getState().files;
if (!files[file.id]) return;
upload.start();
});
upload.start();
_this2.core.emitter.emit('core:upload-started', file.id, upload);
});
};
Tus10.prototype.uploadRemote = function uploadRemote(file, current, total) {
var _this3 = this;
return new _Promise(function (resolve, reject) {
_this3.core.log(file.remote.url);
fetch(file.remote.url, {
method: 'post',
credentials: 'include',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(_extends({}, file.remote.body, {
target: _this3.opts.endpoint,
protocol: 'tus'
}))
}).then(function (res) {
if (res.status < 200 && res.status > 300) {
return reject(res.statusText);
}
res.json().then(function (data) {
// get the host domain
var regex = /^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)/;
var host = regex.exec(file.remote.host)[1];
var token = data.token;
var socket = new _UppySocket2.default({
target: 'ws://' + host + ':3020/api/' + token
});
socket.on('progress', function (progressData) {
var progress = progressData.progress;
var bytesUploaded = progressData.bytesUploaded;
var bytesTotal = progressData.bytesTotal;
if (progress) {
_this3.core.log('Upload progress: ' + progress);
// Dispatch progress event
_this3.core.emitter.emit('core:upload-progress', {
uploader: _this3,
id: file.id,
bytesUploaded: bytesUploaded,
bytesTotal: bytesTotal
});
if (progress === '100.00') {
_this3.core.emitter.emit('core:upload-success', file.id);
socket.close();
return resolve();
}
}
});
});
});
});
};
Tus10.prototype.uploadFiles = function uploadFiles(files) {
var _this4 = this;
if (Object.keys(files).length === 0) {
this.core.log('no files to upload!');
return;
}
var uploaders = [];
files.forEach(function (file, index) {
var current = parseInt(index, 10) + 1;
var total = files.length;
if (!file.isRemote) {
uploaders.push(_this4.upload(file, current, total));
} else {
uploaders.push(_this4.uploadRemote(file, current, total));
}
});
return Promise.all(uploaders).then(function () {
_this4.core.log('All files uploaded');
return { uploadedCount: files.length };
}).catch(function (err) {
_this4.core.log('Upload error: ' + err);
});
};
Tus10.prototype.selectForUpload = function selectForUpload(files) {
// TODO: replace files[file].isRemote with some logic
//
// filter files that are now yet being uploaded / haven’t been uploaded
// and remote too
var filesForUpload = Object.keys(files).filter(function (file) {
if (files[file].progress.percentage === 0 || files[file].isRemote) {
return true;
}
return false;
}).map(function (file) {
return files[file];
});
this.uploadFiles(filesForUpload);
};
Tus10.prototype.actions = function actions() {
var _this5 = this;
this.core.emitter.on('core:pause-all', function () {
_this5.pauseResume('pauseAll');
});
this.core.emitter.on('core:resume-all', function () {
_this5.pauseResume('resumeAll');
});
this.core.emitter.on('core:upload', function () {
_this5.core.log('Tus is uploading...');
var files = _this5.core.getState().files;
_this5.selectForUpload(files);
});
};
Tus10.prototype.addResumableUploadsCapabilityFlag = function addResumableUploadsCapabilityFlag() {
var newCapabilities = _extends({}, this.core.getState().capabilities);
newCapabilities.resumableUploads = true;
this.core.setState({
capabilities: newCapabilities
});
};
Tus10.prototype.install = function install() {
this.addResumableUploadsCapabilityFlag();
this.actions();
};
return Tus10;
}(_Plugin3.default);
exports.default = Tus10;
//# sourceMappingURL=Tus10.js.map
},{"../core/UppySocket":6,"./Plugin":37,"es6-promise":51,"tus-js-client":63}],40:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<svg class="UppyIcon" width="100" height="77" viewBox="0 0 100 77">\n <g>\n <path d="M50 32c-7.168 0-13 5.832-13 13s5.832 13 13 13 13-5.832 13-13-5.832-13-13-13z"/>\n <path d="M87 13H72c0-7.18-5.82-13-13-13H41c-7.18 0-13 5.82-13 13H13C5.82 13 0 18.82 0 26v38c0 7.18 5.82 13 13 13h74c7.18 0 13-5.82 13-13V26c0-7.18-5.82-13-13-13zM50 68c-12.683 0-23-10.318-23-23s10.317-23 23-23 23 10.318 23 23-10.317 23-23 23z"/>\n <g>\n </svg>'], ['<svg class="UppyIcon" width="100" height="77" viewBox="0 0 100 77">\n <g>\n <path d="M50 32c-7.168 0-13 5.832-13 13s5.832 13 13 13 13-5.832 13-13-5.832-13-13-13z"/>\n <path d="M87 13H72c0-7.18-5.82-13-13-13H41c-7.18 0-13 5.82-13 13H13C5.82 13 0 18.82 0 26v38c0 7.18 5.82 13 13 13h74c7.18 0 13-5.82 13-13V26c0-7.18-5.82-13-13-13zM50 68c-12.683 0-23-10.318-23-23s10.317-23 23-23 23 10.318 23 23-10.317 23-23 23z"/>\n <g>\n </svg>']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject);
};
//# sourceMappingURL=CameraIcon.js.map
},{"../../core/html":8}],41:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['<video class="UppyWebcam-video" autoplay src="', '"></video>'], ['<video class="UppyWebcam-video" autoplay src="', '"></video>']),
_templateObject2 = _taggedTemplateLiteralLoose(['\n <div class="UppyWebcam-container">\n <div class=\'UppyWebcam-videoContainer\'>\n ', '\n </div>\n <div class=\'UppyWebcam-buttonContainer\'>\n <button class="UppyButton--circular UppyButton--red UppyButton--sizeM UppyWebcam-stopRecordBtn"\n type="button"\n title="Take a snapshot"\n aria-label="Take a snapshot"\n onclick=', '>\n ', '\n </button>\n </div>\n <canvas class="UppyWebcam-canvas" style="display: none;"></canvas>\n </div>\n '], ['\n <div class="UppyWebcam-container">\n <div class=\'UppyWebcam-videoContainer\'>\n ', '\n </div>\n <div class=\'UppyWebcam-buttonContainer\'>\n <button class="UppyButton--circular UppyButton--red UppyButton--sizeM UppyWebcam-stopRecordBtn"\n type="button"\n title="Take a snapshot"\n aria-label="Take a snapshot"\n onclick=', '>\n ', '\n </button>\n </div>\n <canvas class="UppyWebcam-canvas" style="display: none;"></canvas>\n </div>\n ']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
var _CameraIcon = require('./CameraIcon');
var _CameraIcon2 = _interopRequireDefault(_CameraIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
var video = void 0;
if (props.useTheFlash) {
video = props.getSWFHTML();
} else {
video = (0, _html2.default)(_templateObject, props.src);
}
return (0, _html2.default)(_templateObject2, video, props.onSnapshot, (0, _CameraIcon2.default)());
};
//# sourceMappingURL=CameraScreen.js.map
},{"../../core/html":8,"./CameraIcon":40}],42:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <div>\n <h1>Please allow access to your camera</h1>\n <span>You have been prompted to allow camera access from this site. In order to take pictures with your camera you must approve this request.</span>\n </div>\n '], ['\n <div>\n <h1>Please allow access to your camera</h1>\n <span>You have been prompted to allow camera access from this site. In order to take pictures with your camera you must approve this request.</span>\n </div>\n ']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject);
};
//# sourceMappingURL=PermissionsScreen.js.map
},{"../../core/html":8}],43:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _templateObject = _taggedTemplateLiteralLoose(['\n <svg class="UppyIcon UppyModalTab-icon" width="18" height="21" viewBox="0 0 18 21">\n <g>\n <path d="M14.8 16.9c1.9-1.7 3.2-4.1 3.2-6.9 0-5-4-9-9-9s-9 4-9 9c0 2.8 1.2 5.2 3.2 6.9C1.9 17.9.5 19.4 0 21h3c1-1.9 11-1.9 12 0h3c-.5-1.6-1.9-3.1-3.2-4.1zM9 4c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6 2.7-6 6-6z"/>\n <path d="M9 14c2.2 0 4-1.8 4-4s-1.8-4-4-4-4 1.8-4 4 1.8 4 4 4zM8 8c.6 0 1 .4 1 1s-.4 1-1 1-1-.4-1-1c0-.5.4-1 1-1z"/>\n </g>\n </svg>\n '], ['\n <svg class="UppyIcon UppyModalTab-icon" width="18" height="21" viewBox="0 0 18 21">\n <g>\n <path d="M14.8 16.9c1.9-1.7 3.2-4.1 3.2-6.9 0-5-4-9-9-9s-9 4-9 9c0 2.8 1.2 5.2 3.2 6.9C1.9 17.9.5 19.4 0 21h3c1-1.9 11-1.9 12 0h3c-.5-1.6-1.9-3.1-3.2-4.1zM9 4c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6 2.7-6 6-6z"/>\n <path d="M9 14c2.2 0 4-1.8 4-4s-1.8-4-4-4-4 1.8-4 4 1.8 4 4 4zM8 8c.6 0 1 .4 1 1s-.4 1-1 1-1-.4-1-1c0-.5.4-1 1-1z"/>\n </g>\n </svg>\n ']);
var _html = require('../../core/html');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }
exports.default = function (props) {
return (0, _html2.default)(_templateObject);
};
//# sourceMappingURL=WebcamIcon.js.map
},{"../../core/html":8}],44:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Plugin2 = require('../Plugin');
var _Plugin3 = _interopRequireDefault(_Plugin2);
var _Webcam = require('../../uppy-base/src/plugins/Webcam');
var _Webcam2 = _interopRequireDefault(_Webcam);
var _Utils = require('../../core/Utils');
var _WebcamIcon = require('./WebcamIcon');
var _WebcamIcon2 = _interopRequireDefault(_WebcamIcon);
var _CameraScreen = require('./CameraScreen');
var _CameraScreen2 = _interopRequireDefault(_CameraScreen);
var _PermissionsScreen = require('./PermissionsScreen');
var _PermissionsScreen2 = _interopRequireDefault(_PermissionsScreen);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Webcam
*/
var Webcam = function (_Plugin) {
_inherits(Webcam, _Plugin);
function Webcam(core, opts) {
_classCallCheck(this, Webcam);
var _this = _possibleConstructorReturn(this, _Plugin.call(this, core, opts));
_this.userMedia = true;
_this.protocol = location.protocol.match(/https/i) ? 'https' : 'http';
_this.type = 'acquirer';
_this.id = 'Webcam';
_this.title = 'Webcam';
_this.icon = (0, _WebcamIcon2.default)();
// set default options
var defaultOptions = {
enableFlash: true
};
_this.params = {
swfURL: 'webcam.swf',
width: 400,
height: 300,
dest_width: 800, // size of captured image
dest_height: 600, // these default to width/height
image_format: 'jpeg', // image format (may be jpeg or png)
jpeg_quality: 90, // jpeg image quality from 0 (worst) to 100 (best)
enable_flash: true, // enable flash fallback,
force_flash: false, // force flash mode,
flip_horiz: false, // flip image horiz (mirror mode)
fps: 30, // camera frames per second
upload_name: 'webcam', // name of file in upload post data
constraints: null, // custom user media constraints,
flashNotDetectedText: 'ERROR: No Adobe Flash Player detected. Webcam.js relies on Flash for browsers that do not support getUserMedia (like yours).',
noInterfaceFoundText: 'No supported webcam interface found.',
unfreeze_snap: true // Whether to unfreeze the camera after snap (defaults to true)
};
// merge default options with the ones set by user
_this.opts = _extends({}, defaultOptions, opts);
_this.install = _this.install.bind(_this);
_this.updateState = _this.updateState.bind(_this);
_this.render = _this.render.bind(_this);
// Camera controls
_this.start = _this.start.bind(_this);
_this.takeSnapshot = _this.takeSnapshot.bind(_this);
_this.webcam = new _Webcam2.default(_this.opts, _this.params);
return _this;
}
Webcam.prototype.start = function start() {
var _this2 = this;
this.webcam.start().then(function (stream) {
_this2.updateState({
videoStream: stream,
cameraReady: true
});
}).catch(function (err) {
_this2.updateState({
cameraError: err
});
});
};
Webcam.prototype.takeSnapshot = function takeSnapshot() {
var opts = {
name: 'webcam-' + Date.now() + '.jpg',
mimeType: 'image/jpeg'
};
var video = document.querySelector('.UppyWebcam-video');
var image = this.webcam.getImage(video, opts);
var tagFile = {
source: this.id,
name: opts.name,
data: image.data,
type: opts.mimeType
};
this.core.emitter.emit('core:file-add', tagFile);
};
Webcam.prototype.render = function render(state) {
if (!state.webcam.cameraReady && !state.webcam.useTheFlash) {
return (0, _PermissionsScreen2.default)(state.webcam);
}
var stream = state.webcam.videoStream ? URL.createObjectURL(state.webcam.videoStream) : null;
return (0, _CameraScreen2.default)((0, _Utils.extend)(state.webcam, {
onSnapshot: this.takeSnapshot,
getSWFHTML: this.webcam.getSWFHTML,
src: stream
}));
};
Webcam.prototype.focus = function focus() {
var _this3 = this;
var firstInput = document.querySelector('.UppyWebcam-stopRecordBtn');
// only works for the first time if wrapped in setTimeout for some reason
// firstInput.focus()
if (firstInput) {
setTimeout(function () {
firstInput.focus();
}, 10);
}
this.start();
setTimeout(function () {
_this3.core.emitter.emit('informer', 'Smile!', 'info', 3500);
}, 1000);
};
Webcam.prototype.install = function install() {
this.webcam.init();
this.core.setState({
webcam: {
cameraReady: false
}
});
var target = this.opts.target;
var plugin = this;
this.target = this.mount(target, plugin);
};
/**
* Little shorthand to update the state with my new state
*/
Webcam.prototype.updateState = function updateState(newState) {
var state = this.core.state;
var webcam = _extends({}, state.webcam, newState);
this.core.setState({ webcam: webcam });
};
return Webcam;
}(_Plugin3.default);
exports.default = Webcam;
//# sourceMappingURL=index.js.map
},{"../../core/Utils":7,"../../uppy-base/src/plugins/Webcam":46,"../Plugin":37,"./CameraScreen":41,"./PermissionsScreen":42,"./WebcamIcon":43}],45:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _getName = function _getName(id) {
return id.split('-').map(function (s) {
return s.charAt(0).toUpperCase() + s.slice(1);
}).join(' ');
};
var Provider = function () {
function Provider(opts) {
_classCallCheck(this, Provider);
this.opts = opts;
this.provider = opts.provider;
this.id = this.provider;
this.name = this.opts.name || _getName(this.id);
}
_createClass(Provider, [{
key: 'auth',
value: function auth() {
return fetch(this.opts.host + '/' + this.provider + '/authorize', {
method: 'get',
credentials: 'include',
headers: {
'Accept': 'application/json',
'Content-Type': 'application.json'
}
}).then(function (res) {
return res.json().then(function (payload) {
return payload.isAuthenticated;
});
});
}
}, {
key: 'list',
value: function list() {
var directory = arguments.length <= 0 || arguments[0] === undefined ? 'root' : arguments[0];
return fetch(this.opts.host + '/' + this.provider + '/list?dir=' + directory, {
method: 'get',
credentials: 'include',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then(function (res) {
return res.json();
});
}
}, {
key: 'logout',
value: function logout() {
var redirect = arguments.length <= 0 || arguments[0] === undefined ? location.href : arguments[0];
return fetch(this.opts.host + '/' + this.provider + '/logout?redirect=' + redirect, {
method: 'get',
credentials: 'include',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
});
}
}]);
return Provider;
}();
exports.default = Provider;
//# sourceMappingURL=Provider.js.map
},{}],46:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dataURItoFile = require('../utils/dataURItoFile');
var _dataURItoFile2 = _interopRequireDefault(_dataURItoFile);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Webcam Plugin
*/
var Webcam = function () {
function Webcam() {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, Webcam);
this._userMedia;
this.userMedia = true;
this.protocol = location.protocol.match(/https/i) ? 'https' : 'http';
// set default options
var defaultOptions = {
enableFlash: true
};
var defaultParams = {
swfURL: 'webcam.swf',
width: 400,
height: 300,
dest_width: 800, // size of captured image
dest_height: 600, // these default to width/height
image_format: 'jpeg', // image format (may be jpeg or png)
jpeg_quality: 90, // jpeg image quality from 0 (worst) to 100 (best)
enable_flash: true, // enable flash fallback,
force_flash: false, // force flash mode,
flip_horiz: false, // flip image horiz (mirror mode)
fps: 30, // camera frames per second
upload_name: 'webcam', // name of file in upload post data
constraints: null, // custom user media constraints,
flashNotDetectedText: 'ERROR: No Adobe Flash Player detected. Webcam.js relies on Flash for browsers that do not support getUserMedia (like yours).',
noInterfaceFoundText: 'No supported webcam interface found.',
unfreeze_snap: true // Whether to unfreeze the camera after snap (defaults to true)
};
this.params = Object.assign({}, defaultParams, params);
// merge default options with the ones set by user
this.opts = Object.assign({}, defaultOptions, opts);
// Camera controls
this.start = this.start.bind(this);
this.init = this.init.bind(this);
this.stop = this.stop.bind(this);
// this.startRecording = this.startRecording.bind(this)
// this.stopRecording = this.stopRecording.bind(this)
this.takeSnapshot = this.takeSnapshot.bind(this);
this.getImage = this.getImage.bind(this);
this.getSWFHTML = this.getSWFHTML.bind(this);
this.detectFlash = this.detectFlash.bind(this);
this.getUserMedia = this.getUserMedia.bind(this);
this.getMediaDevices = this.getMediaDevices.bind(this);
}
/**
* Checks for getUserMedia support
*/
_createClass(Webcam, [{
key: 'init',
value: function init() {
var _this = this;
// initialize, check for getUserMedia support
this.mediaDevices = this.getMediaDevices();
this.userMedia = this.getUserMedia(this.mediaDevices);
// Make sure media stream is closed when navigating away from page
if (this.userMedia) {
window.addEventListener('beforeunload', function (event) {
_this.reset();
});
}
return {
mediaDevices: this.mediaDevices,
userMedia: this.userMedia
};
}
// Setup getUserMedia, with polyfill for older browsers
// Adapted from: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
}, {
key: 'getMediaDevices',
value: function getMediaDevices() {
return navigator.mediaDevices && navigator.mediaDevices.getUserMedia ? navigator.mediaDevices : navigator.mozGetUserMedia || navigator.webkitGetUserMedia ? {
getUserMedia: function getUserMedia(opts) {
return new Promise(function (resolve, reject) {
(navigator.mozGetUserMedia || navigator.webkitGetUserMedia).call(navigator, opts, resolve, reject);
});
}
} : null;
}
}, {
key: 'getUserMedia',
value: function getUserMedia(mediaDevices) {
var userMedia = true;
// Older versions of firefox (< 21) apparently claim support but user media does not actually work
if (navigator.userAgent.match(/Firefox\D+(\d+)/)) {
if (parseInt(RegExp.$1, 10) < 21) {
return null;
}
}
window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
return userMedia && !!mediaDevices && !!window.URL;
}
}, {
key: 'start',
value: function start() {
var _this2 = this;
this.userMedia = this._userMedia === undefined ? this.userMedia : this._userMedia;
return new Promise(function (resolve, reject) {
if (_this2.userMedia) {
// ask user for access to their camera
_this2.mediaDevices.getUserMedia({
audio: false,
video: true
}).then(function (stream) {
return resolve(stream);
}).catch(function (err) {
return reject(err);
});
}
});
}
/**
* Detects if browser supports flash
* Code snippet borrowed from: https://github.com/swfobject/swfobject
*
* @return {bool} flash supported
*/
}, {
key: 'detectFlash',
value: function detectFlash() {
var SHOCKWAVE_FLASH = 'Shockwave Flash';
var SHOCKWAVE_FLASH_AX = 'ShockwaveFlash.ShockwaveFlash';
var FLASH_MIME_TYPE = 'application/x-shockwave-flash';
var win = window;
var nav = navigator;
var hasFlash = false;
if (typeof nav.plugins !== 'undefined' && _typeof(nav.plugins[SHOCKWAVE_FLASH]) === 'object') {
var desc = nav.plugins[SHOCKWAVE_FLASH].description;
if (desc && typeof nav.mimeTypes !== 'undefined' && nav.mimeTypes[FLASH_MIME_TYPE] && nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin) {
hasFlash = true;
}
} else if (typeof win.ActiveXObject !== 'undefined') {
try {
var ax = new win.ActiveXObject(SHOCKWAVE_FLASH_AX);
if (ax) {
var ver = ax.GetVariable('$version');
if (ver) hasFlash = true;
}
} catch (e) {}
}
return hasFlash;
}
}, {
key: 'reset',
value: function reset() {
// shutdown camera, reset to potentially attach again
if (this.preview_active) this.unfreeze();
if (this.userMedia) {
if (this.stream) {
if (this.stream.getVideoTracks) {
// get video track to call stop on it
var tracks = this.stream.getVideoTracks();
if (tracks && tracks[0] && tracks[0].stop) tracks[0].stop();
} else if (this.stream.stop) {
// deprecated, may be removed in future
this.stream.stop();
}
}
delete this.stream;
delete this.video;
}
if (this.userMedia !== true) {
// call for turn off camera in flash
this.getMovie()._releaseCamera();
}
}
}, {
key: 'getSWFHTML',
value: function getSWFHTML() {
// Return HTML for embedding flash based webcam capture movie
var swfURL = this.params.swfURL;
// make sure we aren't running locally (flash doesn't work)
if (location.protocol.match(/file/)) {
return '<h3 style="color:red">ERROR: the Webcam.js Flash fallback does not work from local disk. Please run it from a web server.</h3>';
}
// make sure we have flash
if (!this.detectFlash()) {
return '<h3 style="color:red">No flash</h3>';
}
// set default swfURL if not explicitly set
if (!swfURL) {
// find our script tag, and use that base URL
var base_url = '';
var scpts = document.getElementsByTagName('script');
for (var idx = 0, len = scpts.length; idx < len; idx++) {
var src = scpts[idx].getAttribute('src');
if (src && src.match(/\/webcam(\.min)?\.js/)) {
base_url = src.replace(/\/webcam(\.min)?\.js.*$/, '');
idx = len;
}
}
if (base_url) swfURL = base_url + '/webcam.swf';else swfURL = 'webcam.swf';
}
// // if this is the user's first visit, set flashvar so flash privacy settings panel is shown first
// if (window.localStorage && !localStorage.getItem('visited')) {
// // this.params.new_user = 1
// localStorage.setItem('visited', 1)
// }
// this.params.new_user = 1
// construct flashvars string
var flashvars = '';
for (var key in this.params) {
if (flashvars) flashvars += '&';
flashvars += key + '=' + escape(this.params[key]);
}
// construct object/embed tag
return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" type="application/x-shockwave-flash" codebase="' + this.protocol + '://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + this.params.width + '" height="' + this.params.height + '" id="webcam_movie_obj" align="middle"><param name="wmode" value="opaque" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + swfURL + '" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="' + flashvars + '"/><embed id="webcam_movie_embed" src="' + swfURL + '" wmode="opaque" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="' + this.params.width + '" height="' + this.params.height + '" name="webcam_movie_embed" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + flashvars + '"></embed></object>';
}
}, {
key: 'getMovie',
value: function getMovie() {
// get reference to movie object/embed in DOM
var movie = document.getElementById('webcam_movie_obj');
if (!movie || !movie._snap) movie = document.getElementById('webcam_movie_embed');
if (!movie) console.log('getMovie error');
return movie;
}
/**
* Stops the webcam capture and video playback.
*/
}, {
key: 'stop',
value: function stop() {
var video = this.video;
var videoStream = this.videoStream;
this.updateState({
cameraReady: false
});
if (videoStream) {
if (videoStream.stop) {
videoStream.stop();
} else if (videoStream.msStop) {
videoStream.msStop();
}
videoStream.onended = null;
videoStream = null;
}
if (video) {
video.onerror = null;
video.pause();
if (video.mozSrcObject) {
video.mozSrcObject = null;
}
video.src = '';
}
this.video = document.querySelector('.UppyWebcam-video');
this.canvas = document.querySelector('.UppyWebcam-canvas');
}
}, {
key: 'flashNotify',
value: function flashNotify(type, msg) {
// receive notification from flash about event
switch (type) {
case 'flashLoadComplete':
// movie loaded successfully
break;
case 'cameraLive':
// camera is live and ready to snap
this.live = true;
break;
case 'error':
// Flash error
console.log('There was a flash error', msg);
break;
default:
// catch-all event, just in case
console.log('webcam flash_notify: ' + type + ': ' + msg);
break;
}
}
}, {
key: 'configure',
value: function configure(panel) {
// open flash configuration panel -- specify tab name:
// 'camera', 'privacy', 'default', 'localStorage', 'microphone', 'settingsManager'
if (!panel) panel = 'camera';
this.getMovie()._configure(panel);
}
/**
* Takes a snapshot and displays it in a canvas.
*/
}, {
key: 'getImage',
value: function getImage(video, opts) {
var canvas = document.createElement('canvas');
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext('2d').drawImage(video, 0, 0);
var dataUrl = canvas.toDataURL(opts.mimeType);
var file = (0, _dataURItoFile2.default)(dataUrl, {
name: opts.name
});
return {
dataUrl: dataUrl,
data: file,
type: opts.mimeType
};
}
}, {
key: 'takeSnapshot',
value: function takeSnapshot(video, canvas) {
var opts = {
name: 'webcam-' + Date.now() + '.jpg',
mimeType: 'image/jpeg'
};
var image = this.getImage(video, canvas, opts);
var tagFile = {
source: this.id,
name: opts.name,
data: image.data,
type: opts.type
};
return tagFile;
}
}]);
return Webcam;
}();
exports.default = Webcam;
//# sourceMappingURL=Webcam.js.map
},{"../utils/dataURItoFile":47}],47:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (dataURI, opts) {
return dataURItoBlob(dataURI, opts, true);
};
function dataURItoBlob(dataURI, opts, toFile) {
// get the base64 data
var data = dataURI.split(',')[1];
// user may provide mime type, if not get it from data URI
var mimeType = opts.mimeType || dataURI.split(',')[0].split(':')[1].split(';')[0];
// default to plain/text if data URI has no mimeType
if (mimeType == null) {
mimeType = 'plain/text';
}
var binary = atob(data);
var array = [];
for (var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
// Convert to a File?
if (toFile) {
return new File([new Uint8Array(array)], opts.name || '', { type: mimeType });
}
return new Blob([new Uint8Array(array)], { type: mimeType });
}
//# sourceMappingURL=dataURItoFile.js.map
},{}],48:[function(require,module,exports){
module.exports = dragDrop
var flatten = require('flatten')
var parallel = require('run-parallel')
function dragDrop (elem, listeners) {
if (typeof elem === 'string') {
elem = window.document.querySelector(elem)
}
if (typeof listeners === 'function') {
listeners = { onDrop: listeners }
}
var timeout
elem.addEventListener('dragenter', stopEvent, false)
elem.addEventListener('dragover', onDragOver, false)
elem.addEventListener('dragleave', onDragLeave, false)
elem.addEventListener('drop', onDrop, false)
// Function to remove drag-drop listeners
return function remove () {
removeDragClass()
elem.removeEventListener('dragenter', stopEvent, false)
elem.removeEventListener('dragover', onDragOver, false)
elem.removeEventListener('dragleave', onDragLeave, false)
elem.removeEventListener('drop', onDrop, false)
}
function onDragOver (e) {
e.stopPropagation()
e.preventDefault()
if (e.dataTransfer.items) {
// Only add "drag" class when `items` contains a file
var items = toArray(e.dataTransfer.items).filter(function (item) {
return item.kind === 'file'
})
if (items.length === 0) return
}
elem.classList.add('drag')
clearTimeout(timeout)
if (listeners.onDragOver) {
listeners.onDragOver(e)
}
e.dataTransfer.dropEffect = 'copy'
return false
}
function onDragLeave (e) {
e.stopPropagation()
e.preventDefault()
if (listeners.onDragLeave) {
listeners.onDragLeave(e)
}
clearTimeout(timeout)
timeout = setTimeout(removeDragClass, 50)
return false
}
function onDrop (e) {
e.stopPropagation()
e.preventDefault()
if (listeners.onDragLeave) {
listeners.onDragLeave(e)
}
clearTimeout(timeout)
removeDragClass()
var pos = {
x: e.clientX,
y: e.clientY
}
if (e.dataTransfer.items) {
// Handle directories in Chrome using the proprietary FileSystem API
var items = toArray(e.dataTransfer.items).filter(function (item) {
return item.kind === 'file'
})
if (items.length === 0) return
parallel(items.map(function (item) {
return function (cb) {
processEntry(item.webkitGetAsEntry(), cb)
}
}), function (err, results) {
// This catches permission errors with file:// in Chrome. This should never
// throw in production code, so the user does not need to use try-catch.
if (err) throw err
if (listeners.onDrop) {
listeners.onDrop(flatten(results), pos)
}
})
} else {
var files = toArray(e.dataTransfer.files)
if (files.length === 0) return
files.forEach(function (file) {
file.fullPath = '/' + file.name
})
if (listeners.onDrop) {
listeners.onDrop(files, pos)
}
}
return false
}
function removeDragClass () {
elem.classList.remove('drag')
}
}
function stopEvent (e) {
e.stopPropagation()
e.preventDefault()
return false
}
function processEntry (entry, cb) {
var entries = []
if (entry.isFile) {
entry.file(function (file) {
file.fullPath = entry.fullPath // preserve pathing for consumer
cb(null, file)
}, function (err) {
cb(err)
})
} else if (entry.isDirectory) {
var reader = entry.createReader()
readEntries()
}
function readEntries () {
reader.readEntries(function (entries_) {
if (entries_.length > 0) {
entries = entries.concat(toArray(entries_))
readEntries() // continue reading entries until `readEntries` returns no more
} else {
doneEntries()
}
})
}
function doneEntries () {
parallel(entries.map(function (entry) {
return function (cb) {
processEntry(entry, cb)
}
}), cb)
}
}
function toArray (list) {
return Array.prototype.slice.call(list || [], 0)
}
},{"flatten":49,"run-parallel":50}],49:[function(require,module,exports){
module.exports = function flatten(list, depth) {
depth = (typeof depth == 'number') ? depth : Infinity;
if (!depth) {
if (Array.isArray(list)) {
return list.map(function(i) { return i; });
}
return list;
}
return _flatten(list, 1);
function _flatten(list, d) {
return list.reduce(function (acc, item) {
if (Array.isArray(item) && d < depth) {
return acc.concat(_flatten(item, d + 1));
}
else {
return acc.concat(item);
}
}, []);
}
};
},{}],50:[function(require,module,exports){
(function (process){
module.exports = function (tasks, cb) {
var results, pending, keys
var isSync = true
if (Array.isArray(tasks)) {
results = []
pending = tasks.length
} else {
keys = Object.keys(tasks)
results = {}
pending = keys.length
}
function done (err) {
function end () {
if (cb) cb(err, results)
cb = null
}
if (isSync) process.nextTick(end)
else end()
}
function each (i, err, result) {
results[i] = result
if (--pending === 0 || err) {
done(err)
}
}
if (!pending) {
// empty
done(null)
} else if (keys) {
// object
keys.forEach(function (key) {
tasks[key](function (err, result) { each(key, err, result) })
})
} else {
// array
tasks.forEach(function (task, i) {
task(function (err, result) { each(i, err, result) })
})
}
isSync = false
}
}).call(this,require('_process'))
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9kcmFnLWRyb3Avbm9kZV9tb2R1bGVzL3J1bi1wYXJhbGxlbC9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAodGFza3MsIGNiKSB7XG4gIHZhciByZXN1bHRzLCBwZW5kaW5nLCBrZXlzXG4gIHZhciBpc1N5bmMgPSB0cnVlXG5cbiAgaWYgKEFycmF5LmlzQXJyYXkodGFza3MpKSB7XG4gICAgcmVzdWx0cyA9IFtdXG4gICAgcGVuZGluZyA9IHRhc2tzLmxlbmd0aFxuICB9IGVsc2Uge1xuICAgIGtleXMgPSBPYmplY3Qua2V5cyh0YXNrcylcbiAgICByZXN1bHRzID0ge31cbiAgICBwZW5kaW5nID0ga2V5cy5sZW5ndGhcbiAgfVxuXG4gIGZ1bmN0aW9uIGRvbmUgKGVycikge1xuICAgIGZ1bmN0aW9uIGVuZCAoKSB7XG4gICAgICBpZiAoY2IpIGNiKGVyciwgcmVzdWx0cylcbiAgICAgIGNiID0gbnVsbFxuICAgIH1cbiAgICBpZiAoaXNTeW5jKSBwcm9jZXNzLm5leHRUaWNrKGVuZClcbiAgICBlbHNlIGVuZCgpXG4gIH1cblxuICBmdW5jdGlvbiBlYWNoIChpLCBlcnIsIHJlc3VsdCkge1xuICAgIHJlc3VsdHNbaV0gPSByZXN1bHRcbiAgICBpZiAoLS1wZW5kaW5nID09PSAwIHx8IGVycikge1xuICAgICAgZG9uZShlcnIpXG4gICAgfVxuICB9XG5cbiAgaWYgKCFwZW5kaW5nKSB7XG4gICAgLy8gZW1wdHlcbiAgICBkb25lKG51bGwpXG4gIH0gZWxzZSBpZiAoa2V5cykge1xuICAgIC8vIG9iamVjdFxuICAgIGtleXMuZm9yRWFjaChmdW5jdGlvbiAoa2V5KSB7XG4gICAgICB0YXNrc1trZXldKGZ1bmN0aW9uIChlcnIsIHJlc3VsdCkgeyBlYWNoKGtleSwgZXJyLCByZXN1bHQpIH0pXG4gICAgfSlcbiAgfSBlbHNlIHtcbiAgICAvLyBhcnJheVxuICAgIHRhc2tzLmZvckVhY2goZnVuY3Rpb24gKHRhc2ssIGkpIHtcbiAgICAgIHRhc2soZnVuY3Rpb24gKGVyciwgcmVzdWx0KSB7IGVhY2goaSwgZXJyLCByZXN1bHQpIH0pXG4gICAgfSlcbiAgfVxuXG4gIGlzU3luYyA9IGZhbHNlXG59XG4iXX0=
},{"_process":3}],51:[function(require,module,exports){
(function (process,global){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
* @version 3.2.1
*/
(function() {
"use strict";
function lib$es6$promise$utils$$objectOrFunction(x) {
return typeof x === 'function' || (typeof x === 'object' && x !== null);
}
function lib$es6$promise$utils$$isFunction(x) {
return typeof x === 'function';
}
function lib$es6$promise$utils$$isMaybeThenable(x) {
return typeof x === 'object' && x !== null;
}
var lib$es6$promise$utils$$_isArray;
if (!Array.isArray) {
lib$es6$promise$utils$$_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
lib$es6$promise$utils$$_isArray = Array.isArray;
}
var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
var lib$es6$promise$asap$$len = 0;
var lib$es6$promise$asap$$vertxNext;
var lib$es6$promise$asap$$customSchedulerFn;
var lib$es6$promise$asap$$asap = function asap(callback, arg) {
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
lib$es6$promise$asap$$len += 2;
if (lib$es6$promise$asap$$len === 2) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if (lib$es6$promise$asap$$customSchedulerFn) {
lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
} else {
lib$es6$promise$asap$$scheduleFlush();
}
}
}
function lib$es6$promise$asap$$setScheduler(scheduleFn) {
lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
}
function lib$es6$promise$asap$$setAsap(asapFn) {
lib$es6$promise$asap$$asap = asapFn;
}
var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
var lib$es6$promise$asap$$isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
// test for web worker but not in IE10
var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
typeof importScripts !== 'undefined' &&
typeof MessageChannel !== 'undefined';
// node
function lib$es6$promise$asap$$useNextTick() {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function() {
process.nextTick(lib$es6$promise$asap$$flush);
};
}
// vertx
function lib$es6$promise$asap$$useVertxTimer() {
return function() {
lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
};
}
function lib$es6$promise$asap$$useMutationObserver() {
var iterations = 0;
var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
// web worker
function lib$es6$promise$asap$$useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = lib$es6$promise$asap$$flush;
return function () {
channel.port2.postMessage(0);
};
}
function lib$es6$promise$asap$$useSetTimeout() {
return function() {
setTimeout(lib$es6$promise$asap$$flush, 1);
};
}
var lib$es6$promise$asap$$queue = new Array(1000);
function lib$es6$promise$asap$$flush() {
for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
var callback = lib$es6$promise$asap$$queue[i];
var arg = lib$es6$promise$asap$$queue[i+1];
callback(arg);
lib$es6$promise$asap$$queue[i] = undefined;
lib$es6$promise$asap$$queue[i+1] = undefined;
}
lib$es6$promise$asap$$len = 0;
}
function lib$es6$promise$asap$$attemptVertx() {
try {
var r = require;
var vertx = r('vertx');
lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
return lib$es6$promise$asap$$useVertxTimer();
} catch(e) {
return lib$es6$promise$asap$$useSetTimeout();
}
}
var lib$es6$promise$asap$$scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (lib$es6$promise$asap$$isNode) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
} else if (lib$es6$promise$asap$$BrowserMutationObserver) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
} else if (lib$es6$promise$asap$$isWorker) {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
} else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();
} else {
lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
}
function lib$es6$promise$then$$then(onFulfillment, onRejection) {
var parent = this;
var child = new this.constructor(lib$es6$promise$$internal$$noop);
if (child[lib$es6$promise$$internal$$PROMISE_ID] === undefined) {
lib$es6$promise$$internal$$makePromise(child);
}
var state = parent._state;
if (state) {
var callback = arguments[state - 1];
lib$es6$promise$asap$$asap(function(){
lib$es6$promise$$internal$$invokeCallback(state, child, callback, parent._result);
});
} else {
lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
}
return child;
}
var lib$es6$promise$then$$default = lib$es6$promise$then$$then;
function lib$es6$promise$promise$resolve$$resolve(object) {
/*jshint validthis:true */
var Constructor = this;
if (object && typeof object === 'object' && object.constructor === Constructor) {
return object;
}
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$resolve(promise, object);
return promise;
}
var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
var lib$es6$promise$$internal$$PROMISE_ID = Math.random().toString(36).substring(16);
function lib$es6$promise$$internal$$noop() {}
var lib$es6$promise$$internal$$PENDING = void 0;
var lib$es6$promise$$internal$$FULFILLED = 1;
var lib$es6$promise$$internal$$REJECTED = 2;
var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$selfFulfillment() {
return new TypeError("You cannot resolve a promise with itself");
}
function lib$es6$promise$$internal$$cannotReturnOwn() {
return new TypeError('A promises callback cannot return that same promise.');
}
function lib$es6$promise$$internal$$getThen(promise) {
try {
return promise.then;
} catch(error) {
lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
return lib$es6$promise$$internal$$GET_THEN_ERROR;
}
}
function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
try {
then.call(value, fulfillmentHandler, rejectionHandler);
} catch(e) {
return e;
}
}
function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
lib$es6$promise$asap$$asap(function(promise) {
var sealed = false;
var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
if (sealed) { return; }
sealed = true;
if (thenable !== value) {
lib$es6$promise$$internal$$resolve(promise, value);
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}, function(reason) {
if (sealed) { return; }
sealed = true;
lib$es6$promise$$internal$$reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
lib$es6$promise$$internal$$reject(promise, error);
}
}, promise);
}
function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, thenable._result);
} else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, thenable._result);
} else {
lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
lib$es6$promise$$internal$$resolve(promise, value);
}, function(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
}
}
function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {
if (maybeThenable.constructor === promise.constructor &&
then === lib$es6$promise$then$$default &&
constructor.resolve === lib$es6$promise$promise$resolve$$default) {
lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
} else {
if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
} else if (then === undefined) {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
} else if (lib$es6$promise$utils$$isFunction(then)) {
lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
} else {
lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
}
}
}
function lib$es6$promise$$internal$$resolve(promise, value) {
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());
} else if (lib$es6$promise$utils$$objectOrFunction(value)) {
lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));
} else {
lib$es6$promise$$internal$$fulfill(promise, value);
}
}
function lib$es6$promise$$internal$$publishRejection(promise) {
if (promise._onerror) {
promise._onerror(promise._result);
}
lib$es6$promise$$internal$$publish(promise);
}
function lib$es6$promise$$internal$$fulfill(promise, value) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
promise._result = value;
promise._state = lib$es6$promise$$internal$$FULFILLED;
if (promise._subscribers.length !== 0) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
}
}
function lib$es6$promise$$internal$$reject(promise, reason) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
promise._state = lib$es6$promise$$internal$$REJECTED;
promise._result = reason;
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
}
function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
parent._onerror = null;
subscribers[length] = child;
subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
if (length === 0 && parent._state) {
lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
}
}
function lib$es6$promise$$internal$$publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
if (subscribers.length === 0) { return; }
var child, callback, detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
if (child) {
lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
} else {
callback(detail);
}
}
promise._subscribers.length = 0;
}
function lib$es6$promise$$internal$$ErrorObject() {
this.error = null;
}
var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
function lib$es6$promise$$internal$$tryCatch(callback, detail) {
try {
return callback(detail);
} catch(e) {
lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
}
}
function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
var hasCallback = lib$es6$promise$utils$$isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
value = lib$es6$promise$$internal$$tryCatch(callback, detail);
if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
failed = true;
error = value.error;
value = null;
} else {
succeeded = true;
}
if (promise === value) {
lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
return;
}
} else {
value = detail;
succeeded = true;
}
if (promise._state !== lib$es6$promise$$internal$$PENDING) {
// noop
} else if (hasCallback && succeeded) {
lib$es6$promise$$internal$$resolve(promise, value);
} else if (failed) {
lib$es6$promise$$internal$$reject(promise, error);
} else if (settled === lib$es6$promise$$internal$$FULFILLED) {
lib$es6$promise$$internal$$fulfill(promise, value);
} else if (settled === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
}
}
function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value){
lib$es6$promise$$internal$$resolve(promise, value);
}, function rejectPromise(reason) {
lib$es6$promise$$internal$$reject(promise, reason);
});
} catch(e) {
lib$es6$promise$$internal$$reject(promise, e);
}
}
var lib$es6$promise$$internal$$id = 0;
function lib$es6$promise$$internal$$nextId() {
return lib$es6$promise$$internal$$id++;
}
function lib$es6$promise$$internal$$makePromise(promise) {
promise[lib$es6$promise$$internal$$PROMISE_ID] = lib$es6$promise$$internal$$id++;
promise._state = undefined;
promise._result = undefined;
promise._subscribers = [];
}
function lib$es6$promise$promise$all$$all(entries) {
return new lib$es6$promise$enumerator$$default(this, entries).promise;
}
var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
function lib$es6$promise$promise$race$$race(entries) {
/*jshint validthis:true */
var Constructor = this;
if (!lib$es6$promise$utils$$isArray(entries)) {
return new Constructor(function(resolve, reject) {
reject(new TypeError('You must pass an array to race.'));
});
} else {
return new Constructor(function(resolve, reject) {
var length = entries.length;
for (var i = 0; i < length; i++) {
Constructor.resolve(entries[i]).then(resolve, reject);
}
});
}
}
var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
function lib$es6$promise$promise$reject$$reject(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$reject(promise, reason);
return promise;
}
var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
function lib$es6$promise$promise$$needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function lib$es6$promise$promise$$needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
A promise can be in one of three states: pending, fulfilled, or rejected.
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
Basic Usage:
------------
```js
var promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
// on failure
reject(reason);
});
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Advanced Usage:
---------------
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
}
}
};
});
}
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Unlike callbacks, promises are great composable primitives.
```js
Promise.all([
getJSON('/posts'),
getJSON('/comments')
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
return values;
});
```
@class Promise
@param {function} resolver
Useful for tooling.
@constructor
*/
function lib$es6$promise$promise$$Promise(resolver) {
this[lib$es6$promise$$internal$$PROMISE_ID] = lib$es6$promise$$internal$$nextId();
this._result = this._state = undefined;
this._subscribers = [];
if (lib$es6$promise$$internal$$noop !== resolver) {
typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();
this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();
}
}
lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
lib$es6$promise$promise$$Promise.prototype = {
constructor: lib$es6$promise$promise$$Promise,
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
}, function(reason){
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
}, function (reason) {
return 'default name';
}).then(function (userName) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
throw new Error('`findUser` rejected and we're unhappy');
}).then(function (value) {
// never reached
}, function (reason) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
}).then(function (value) {
// never reached
}).then(function (value) {
// never reached
}, function (reason) {
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
}, function (reason) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
var result;
try {
result = findResult();
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
// failure
} else {
// success
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
}, function(reason){
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
var author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
// failure
} else {
try {
findBoooksByAuthor(author, function(books, err) {
if (err) {
failure(err);
} else {
try {
foundBooks(books);
} catch(reason) {
failure(reason);
}
}
});
} catch(error) {
failure(err);
}
// success
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
then(function(books){
// found books
}).catch(function(reason){
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
then: lib$es6$promise$then$$default,
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
this._instanceConstructor = Constructor;
this.promise = new Constructor(lib$es6$promise$$internal$$noop);
if (!this.promise[lib$es6$promise$$internal$$PROMISE_ID]) {
lib$es6$promise$$internal$$makePromise(this.promise);
}
if (lib$es6$promise$utils$$isArray(input)) {
this._input = input;
this.length = input.length;
this._remaining = input.length;
this._result = new Array(this.length);
if (this.length === 0) {
lib$es6$promise$$internal$$fulfill(this.promise, this._result);
} else {
this.length = this.length || 0;
this._enumerate();
if (this._remaining === 0) {
lib$es6$promise$$internal$$fulfill(this.promise, this._result);
}
}
} else {
lib$es6$promise$$internal$$reject(this.promise, lib$es6$promise$enumerator$$validationError());
}
}
function lib$es6$promise$enumerator$$validationError() {
return new Error('Array Methods must be provided an Array');
}
lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
var length = this.length;
var input = this._input;
for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
this._eachEntry(input[i], i);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
var c = this._instanceConstructor;
var resolve = c.resolve;
if (resolve === lib$es6$promise$promise$resolve$$default) {
var then = lib$es6$promise$$internal$$getThen(entry);
if (then === lib$es6$promise$then$$default &&
entry._state !== lib$es6$promise$$internal$$PENDING) {
this._settledAt(entry._state, i, entry._result);
} else if (typeof then !== 'function') {
this._remaining--;
this._result[i] = entry;
} else if (c === lib$es6$promise$promise$$default) {
var promise = new c(lib$es6$promise$$internal$$noop);
lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);
this._willSettleAt(promise, i);
} else {
this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);
}
} else {
this._willSettleAt(resolve(entry), i);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
var promise = this.promise;
if (promise._state === lib$es6$promise$$internal$$PENDING) {
this._remaining--;
if (state === lib$es6$promise$$internal$$REJECTED) {
lib$es6$promise$$internal$$reject(promise, value);
} else {
this._result[i] = value;
}
}
if (this._remaining === 0) {
lib$es6$promise$$internal$$fulfill(promise, this._result);
}
};
lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
var enumerator = this;
lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
}, function(reason) {
enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
});
};
function lib$es6$promise$polyfill$$polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof self !== 'undefined') {
local = self;
} else {
try {
local = Function('return this')();
} catch (e) {
throw new Error('polyfill failed because global object is unavailable in this environment');
}
}
var P = local.Promise;
if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
return;
}
local.Promise = lib$es6$promise$promise$$default;
}
var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
var lib$es6$promise$umd$$ES6Promise = {
'Promise': lib$es6$promise$promise$$default,
'polyfill': lib$es6$promise$polyfill$$default
};
/* global define:true module:true window: true */
if (typeof define === 'function' && define['amd']) {
define(function() { return lib$es6$promise$umd$$ES6Promise; });
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = lib$es6$promise$umd$$ES6Promise;
} else if (typeof this !== 'undefined') {
this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
}
lib$es6$promise$polyfill$$default();
}).call(this);
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9lczYtcHJvbWlzZS9kaXN0L2VzNi1wcm9taXNlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7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hZGVyKCdBY2NlcHQnLCAnYXBwbGljYXRpb24vanNvbicpO1xuICAgICAgICAgIHhoci5zZW5kKCk7XG5cbiAgICAgICAgICBmdW5jdGlvbiBoYW5kbGVyKCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucmVhZHlTdGF0ZSA9PT0gdGhpcy5ET05FKSB7XG4gICAgICAgICAgICAgIGlmICh0aGlzLnN0YXR1cyA9PT0gMjAwKSB7XG4gICAgICAgICAgICAgICAgcmVzb2x2ZSh0aGlzLnJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZWplY3QobmV3IEVycm9yKCdnZXRKU09OOiBgJyArIHVybCArICdgIGZhaWxlZCB3aXRoIHN0YXR1czogWycgKyB0aGlzLnN0YXR1cyArICddJykpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfTtcbiAgICAgICAgfSk7XG4gICAgICB9XG5cbiAgICAgIGdldEpTT04oJy9wb3N0cy5qc29uJykudGhlbihmdW5jdGlvbihqc29uKSB7XG4gICAgICAgIC8vIG9uIGZ1bGZpbGxtZW50XG4gICAgICB9LCBmdW5jdGlvbihyZWFzb24pIHtcbiAgICAgICAgLy8gb24gcmVqZWN0aW9uXG4gICAgICB9KTtcbiAgICAgIGBgYFxuXG4gICAgICBVbmxpa2UgY2FsbGJhY2tzLCBwcm9taXNlcyBhcmUgZ3JlYXQgY29tcG9zYWJsZSBwcmltaXRpdmVzLlxuXG4gICAgICBgYGBqc1xuICAgICAgUHJvbWlzZS5hbGwoW1xuICAgICAgICBnZXRKU09OKCcvcG9zdHMnKSxcbiAgICAgICAgZ2V0SlNPTignL2NvbW1lbnRzJylcbiAgICAgIF0pLnRoZW4oZnVuY3Rpb24odmFsdWVzKXtcbiAgICAgICAgdmFsdWVzWzBdIC8vID0+IHBvc3RzSlNPTlxuICAgICAgICB2YWx1ZXNbMV0gLy8gPT4gY29tbWVudHNKU09OXG5cbiAgIC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VzdWx0KXtcbiAgICAgICAgLy8gc3VjY2Vzc1xuICAgICAgfSwgZnVuY3Rpb24ocmVhc29uKXtcbiAgICAgICAgLy8gZmFpbHVyZVxuICAgICAgfSk7XG4gICAgICBgYGBcblxuICAgICAgQWR2YW5jZWQgRXhhbXBsZVxuICAgICAgLS0tLS0tLS0tLS0tLS1cblxuICAgICAgU3luY2hyb25vdXMgRXhhbXBsZVxuXG4gICAgICBgYGBqYXZhc2NyaXB0XG4gICAgICB2YXIgYXV0aG9yLCBib29rcztcblxuICAgICAgdHJ5IHtcbiAgICAgICAgYXV0aG9yID0gZmluZEF1dGhvcigpO1xuICAgICAgICBib29rcyAgPSBmaW5kQm9va3NCeUF1dGhvcihhdXRob3IpO1xuICAgICAgICAvLyBzdWNjZXNzXG4gICAgICB9IGNhdGNoKHJlYXNvbikge1xuICAgICAgICAvLyBmYWlsdXJlXG4gICAgICB9XG4gICAgICBgYGBcblxuICAgICAgRXJyYmFjayBFeGFtcGxlXG5cbiAgICAgIGBgYGpzXG5cbiAgICAgIGZ1bmN0aW9uIGZvdW5kQm9va3MoYm9va3MpIHtcblxuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBmYWlsdXJlKHJlYXNvbikge1xuXG4gICAgICB9XG5cbiAgICAgIGZpbmRBdXRob3IoZnVuY3Rpb24oYXV0aG9yLCBlcnIpe1xuICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgZmFpbHVyZShlcnIpO1xuICAgICAgICAgIC8vIGZhaWx1cmVcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgZmluZEJvb29rc0J5QXV0aG9yKGF1dGhvciwgZnVuY3Rpb24oYm9va3MsIGVycikge1xuICAgICAgICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgZmFpbHVyZShlcnIpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICBmb3VuZEJvb2tzKGJvb2tzKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoKHJlYXNvbikge1xuICAgICAgICAgICAgICAgICAgZmFpbHVyZShyZWFzb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSBjYXRjaChlcnJvcikge1xuICAgICAgICAgICAgZmFpbHVyZShlcnIpO1xuICAgICAgICAgIH1cbiAgICAgICAgICAvLyBzdWNjZXNzXG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgICAgYGBgXG5cbiAgICAgIFByb21pc2UgRXhhbXBsZTtcblxuICAgICAgYGBgamF2YXNjcmlwdFxuICAgICAgZmluZEF1dGhvcigpLlxuICAgICAgICB0aGVuKGZpbmRCb29rc0J5QXV0aG9yKS5cbiAgICAgICAgdGhlbihmdW5jdGlvbihib29rcyl7XG4gICAgICAgICAgLy8gZm91bmQgYm9va3NcbiAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uKHJlYXNvbil7XG4gICAgICAgIC8vIHNvbWV0aGluZyB3ZW50IHdyb25nXG4gICAgICB9KTtcbiAgICAgIGBgYFxuXG4gICAgICBAbWV0aG9kIHRoZW5cbiAgICAgIEBwYXJhbSB7RnVuY3Rpb259IG9uRnVsZmlsbGVkXG4gICAgICBAcGFyYW0ge0Z1bmN0aW9ufSBvblJlamVjdGVkXG4gICAgICBVc2VmdWwgZm9yIHRvb2xpbmcuXG4gICAgICBAcmV0dXJuIHtQcm9taXNlfVxuICAgICovXG4gICAgICB0aGVuOiBsaWIkZXM2JHByb21pc2UkdGhlbiQkZGVmYXVsdCxcblxuICAgIC8qKlxuICAgICAgYGNhdGNoYCBpcyBzaW1wbHkgc3VnYXIgZm9yIGB0aGVuKHVuZGVmaW5lZCwgb25SZWplY3Rpb24pYCB3aGljaCBtYWtlcyBpdCB0aGUgc2FtZVxuICAgICAgYXMgdGhlIGNhdGNoIGJsb2NrIG9mIGEgdH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5wcm9taXNlID0gbmV3IENvbnN0cnVjdG9yKGxpYiRlczYkcHJvbWlzZSQkaW50ZXJuYWwkJG5vb3ApO1xuXG4gICAgICBpZiAoIXRoaXMucHJvbWlzZVtsaWIkZXM2JHByb21pc2UkJGludGVybmFsJCRQUk9NSVNFX0lEXSkge1xuICAgICAgICBsaWIkZXM2JHByb21pc2UkJGludGVybmFsJCRtYWtlUHJvbWlzZSh0aGlzLnByb21pc2UpO1xuICAgICAgfVxuXG4gICAgICBpZiAobGliJGVzNiRwcm9taXNlJHV0aWxzJCRpc0FycmF5KGlucHV0KSkge1xuICAgICAgICB0aGlzLl9pbnB1dCAgICAgPSBpbnB1dDtcbiAgICAgICAgdGhpcy5sZW5ndGggICAgID0gaW5wdXQubGVuZ3RoO1xuICAgICAgICB0aGlzLl9yZW1haW5pbmcgPSBpbnB1dC5sZW5ndGg7XG5cbiAgICAgICAgdGhpcy5fcmVzdWx0ID0gbmV3IEFycmF5KHRoaXMubGVuZ3RoKTtcblxuICAgICAgICBpZiAodGhpcy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICBsaWIkZXM2JHByb21pc2UkJGludGVybmFsJCRmdWxmaWxsKHRoaXMucHJvbWlzZSwgdGhpcy5fcmVzdWx0KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0aGlzLmxlbmd0aCA9IHRoaXMubGVuZ3RoIHx8IDA7XG4gICAgICAgICAgdGhpcy5fZW51bWVyYXRlKCk7XG4gICAgICAgICAgaWYgKHRoaXMuX3JlbWFpbmluZyA9PT0gMCkge1xuICAgICAgICAgICAgbGliJGVzNiRwcm9taXNlJCRpbnRlcm5hbCQkZnVsZmlsbCh0aGlzLnByb21pc2UsIHRoaXMuX3Jlc3VsdCk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBsaWIkZXM2JHByb21pc2UkJGludGVybmFsJCRyZWplY3QodGhpcy5wcm9taXNlLCBsaWIkZXM2JHByb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gICdQcm9taXNlJzogbGliJGVzNiRwcm9taXNlJHByb21pc2UkJGRlZmF1bHQsXG4gICAgICAncG9seWZpbGwnOiBsaWIkZXM2JHByb21pc2UkcG9seWZpbGwkJGRlZmF1bHRcbiAgICB9O1xuXG4gICAgLyogZ2xvYmFsIGRlZmluZTp0cnVlIG1vZHVsZTp0cnVlIHdpbmRvdzogdHJ1ZSAqL1xuICAgIGlmICh0eXBlb2YgZGVmaW5lID09PSAnZnVuY3Rpb24nICYmIGRlZmluZVsnYW1kJ10pIHtcbiAgICAgIGRlZmluZShmdW5jdGlvbigpIHsgcmV0dXJuIGxpYiRlczYkcHJvbWlzZSR1bWQkJEVTNlByb21pc2U7IH0pO1xuICAgIH0gZWxzZSBpZiAodHlwZW9mIG1vZHVsZSAhPT0gJ3VuZGVmaW5lZCcgJiYgbW9kdWxlWydleHBvcnRzJ10pIHtcbiAgICAgIG1vZHVsZVsnZXhwb3J0cyddID0gbGliJGVzNiRwcm9taXNlJHVtZCQkRVM2UHJvbWlzZTtcbiAgICB9IGVsc2UgaWYgKHR5cGVvZiB0aGlzICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgdGhpc1snRVM2UHJvbWlzZSddID0gbGliJGVzNiRwcm9taXNlJHVtZCQkRVM2UHJvbWlzZTtcbiAgICB9XG5cbiAgICBsaWIkZXM2JHByb21pc2UkcG9seWZpbGwkJGRlZmF1bHQoKTtcbn0pLmNhbGwodGhpcyk7XG5cbiJdfQ==
},{"_process":3}],52:[function(require,module,exports){
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var db = require('mime-db')
var extname = require('path').extname
/**
* Module variables.
* @private
*/
var extractTypeRegExp = /^\s*([^;\s]*)(?:;|\s|$)/
var textTypeRegExp = /^text\//i
/**
* Module exports.
* @public
*/
exports.charset = charset
exports.charsets = { lookup: charset }
exports.contentType = contentType
exports.extension = extension
exports.extensions = Object.create(null)
exports.lookup = lookup
exports.types = Object.create(null)
// Populate the extensions/types maps
populateMaps(exports.extensions, exports.types)
/**
* Get the default charset for a MIME type.
*
* @param {string} type
* @return {boolean|string}
*/
function charset(type) {
if (!type || typeof type !== 'string') {
return false
}
// TODO: use media-typer
var match = extractTypeRegExp.exec(type)
var mime = match && db[match[1].toLowerCase()]
if (mime && mime.charset) {
return mime.charset
}
// default text/* to utf-8
if (match && textTypeRegExp.test(match[1])) {
return 'UTF-8'
}
return false
}
/**
* Create a full Content-Type header given a MIME type or extension.
*
* @param {string} str
* @return {boolean|string}
*/
function contentType(str) {
// TODO: should this even be in this module?
if (!str || typeof str !== 'string') {
return false
}
var mime = str.indexOf('/') === -1
? exports.lookup(str)
: str
if (!mime) {
return false
}
// TODO: use content-type or other module
if (mime.indexOf('charset') === -1) {
var charset = exports.charset(mime)
if (charset) mime += '; charset=' + charset.toLowerCase()
}
return mime
}
/**
* Get the default extension for a MIME type.
*
* @param {string} type
* @return {boolean|string}
*/
function extension(type) {
if (!type || typeof type !== 'string') {
return false
}
// TODO: use media-typer
var match = extractTypeRegExp.exec(type)
// get extensions
var exts = match && exports.extensions[match[1].toLowerCase()]
if (!exts || !exts.length) {
return false
}
return exts[0]
}
/**
* Lookup the MIME type for a file path/extension.
*
* @param {string} path
* @return {boolean|string}
*/
function lookup(path) {
if (!path || typeof path !== 'string') {
return false
}
// get the extension ("ext" or ".ext" or full path)
var extension = extname('x.' + path)
.toLowerCase()
.substr(1)
if (!extension) {
return false
}
return exports.types[extension] || false
}
/**
* Populate the extensions and types maps.
* @private
*/
function populateMaps(extensions, types) {
// source preference (least -> most)
var preference = ['nginx', 'apache', undefined, 'iana']
Object.keys(db).forEach(function forEachMimeType(type) {
var mime = db[type]
var exts = mime.extensions
if (!exts || !exts.length) {
return
}
// mime -> extensions
extensions[type] = exts
// extension -> mime
for (var i = 0; i < exts.length; i++) {
var extension = exts[i]
if (types[extension]) {
var from = preference.indexOf(db[types[extension]].source)
var to = preference.indexOf(mime.source)
if (types[extension] !== 'application/octet-stream'
&& from > to || (from === to && types[extension].substr(0, 12) === 'application/')) {
// skip the remapping
continue
}
}
// set the extension -> mime
types[extension] = type
}
})
}
},{"mime-db":54,"path":2}],53:[function(require,module,exports){
module.exports={
"application/1d-interleaved-parityfec": {
"source": "iana"
},
"application/3gpdash-qoe-report+xml": {
"source": "iana"
},
"application/3gpp-ims+xml": {
"source": "iana"
},
"application/a2l": {
"source": "iana"
},
"application/activemessage": {
"source": "iana"
},
"application/alto-costmap+json": {
"source": "iana",
"compressible": true
},
"application/alto-costmapfilter+json": {
"source": "iana",
"compressible": true
},
"application/alto-directory+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointcost+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointcostparams+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointprop+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointpropparams+json": {
"source": "iana",
"compressible": true
},
"application/alto-error+json": {
"source": "iana",
"compressible": true
},
"application/alto-networkmap+json": {
"source": "iana",
"compressible": true
},
"application/alto-networkmapfilter+json": {
"source": "iana",
"compressible": true
},
"application/aml": {
"source": "iana"
},
"application/andrew-inset": {
"source": "iana",
"extensions": ["ez"]
},
"application/applefile": {
"source": "iana"
},
"application/applixware": {
"source": "apache",
"extensions": ["aw"]
},
"application/atf": {
"source": "iana"
},
"application/atfx": {
"source": "iana"
},
"application/atom+xml": {
"source": "iana",
"compressible": true,
"extensions": ["atom"]
},
"application/atomcat+xml": {
"source": "iana",
"extensions": ["atomcat"]
},
"application/atomdeleted+xml": {
"source": "iana"
},
"application/atomicmail": {
"source": "iana"
},
"application/atomsvc+xml": {
"source": "iana",
"extensions": ["atomsvc"]
},
"application/atxml": {
"source": "iana"
},
"application/auth-policy+xml": {
"source": "iana"
},
"application/bacnet-xdd+zip": {
"source": "iana"
},
"application/batch-smtp": {
"source": "iana"
},
"application/bdoc": {
"compressible": false,
"extensions": ["bdoc"]
},
"application/beep+xml": {
"source": "iana"
},
"application/calendar+json": {
"source": "iana",
"compressible": true
},
"application/calendar+xml": {
"source": "iana"
},
"application/call-completion": {
"source": "iana"
},
"application/cals-1840": {
"source": "iana"
},
"application/cbor": {
"source": "iana"
},
"application/ccmp+xml": {
"source": "iana"
},
"application/ccxml+xml": {
"source": "iana",
"extensions": ["ccxml"]
},
"application/cdfx+xml": {
"source": "iana"
},
"application/cdmi-capability": {
"source": "iana",
"extensions": ["cdmia"]
},
"application/cdmi-container": {
"source": "iana",
"extensions": ["cdmic"]
},
"application/cdmi-domain": {
"source": "iana",
"extensions": ["cdmid"]
},
"application/cdmi-object": {
"source": "iana",
"extensions": ["cdmio"]
},
"application/cdmi-queue": {
"source": "iana",
"extensions": ["cdmiq"]
},
"application/cdni": {
"source": "iana"
},
"application/cea": {
"source": "iana"
},
"application/cea-2018+xml": {
"source": "iana"
},
"application/cellml+xml": {
"source": "iana"
},
"application/cfw": {
"source": "iana"
},
"application/cms": {
"source": "iana"
},
"application/cnrp+xml": {
"source": "iana"
},
"application/coap-group+json": {
"source": "iana",
"compressible": true
},
"application/commonground": {
"source": "iana"
},
"application/conference-info+xml": {
"source": "iana"
},
"application/cpl+xml": {
"source": "iana"
},
"application/csrattrs": {
"source": "iana"
},
"application/csta+xml": {
"source": "iana"
},
"application/cstadata+xml": {
"source": "iana"
},
"application/csvm+json": {
"source": "iana",
"compressible": true
},
"application/cu-seeme": {
"source": "apache",
"extensions": ["cu"]
},
"application/cybercash": {
"source": "iana"
},
"application/dart": {
"compressible": true
},
"application/dash+xml": {
"source": "iana",
"extensions": ["mpd"]
},
"application/dashdelta": {
"source": "iana"
},
"application/davmount+xml": {
"source": "iana",
"extensions": ["davmount"]
},
"application/dca-rft": {
"source": "iana"
},
"application/dcd": {
"source": "iana"
},
"application/dec-dx": {
"source": "iana"
},
"application/dialog-info+xml": {
"source": "iana"
},
"application/dicom": {
"source": "iana"
},
"application/dii": {
"source": "iana"
},
"application/dit": {
"source": "iana"
},
"application/dns": {
"source": "iana"
},
"application/docbook+xml": {
"source": "apache",
"extensions": ["dbk"]
},
"application/dskpp+xml": {
"source": "iana"
},
"application/dssc+der": {
"source": "iana",
"extensions": ["dssc"]
},
"application/dssc+xml": {
"source": "iana",
"extensions": ["xdssc"]
},
"application/dvcs": {
"source": "iana"
},
"application/ecmascript": {
"source": "iana",
"compressible": true,
"extensions": ["ecma"]
},
"application/edi-consent": {
"source": "iana"
},
"application/edi-x12": {
"source": "iana",
"compressible": false
},
"application/edifact": {
"source": "iana",
"compressible": false
},
"application/efi": {
"source": "iana"
},
"application/emergencycalldata.comment+xml": {
"source": "iana"
},
"application/emergencycalldata.deviceinfo+xml": {
"source": "iana"
},
"application/emergencycalldata.providerinfo+xml": {
"source": "iana"
},
"application/emergencycalldata.serviceinfo+xml": {
"source": "iana"
},
"application/emergencycalldata.subscriberinfo+xml": {
"source": "iana"
},
"application/emma+xml": {
"source": "iana",
"extensions": ["emma"]
},
"application/emotionml+xml": {
"source": "iana"
},
"application/encaprtp": {
"source": "iana"
},
"application/epp+xml": {
"source": "iana"
},
"application/epub+zip": {
"source": "iana",
"extensions": ["epub"]
},
"application/eshop": {
"source": "iana"
},
"application/exi": {
"source": "iana",
"extensions": ["exi"]
},
"application/fastinfoset": {
"source": "iana"
},
"application/fastsoap": {
"source": "iana"
},
"application/fdt+xml": {
"source": "iana"
},
"application/fits": {
"source": "iana"
},
"application/font-sfnt": {
"source": "iana"
},
"application/font-tdpfr": {
"source": "iana",
"extensions": ["pfr"]
},
"application/font-woff": {
"source": "iana",
"compressible": false,
"extensions": ["woff"]
},
"application/font-woff2": {
"compressible": false,
"extensions": ["woff2"]
},
"application/framework-attributes+xml": {
"source": "iana"
},
"application/gml+xml": {
"source": "apache",
"extensions": ["gml"]
},
"application/gpx+xml": {
"source": "apache",
"extensions": ["gpx"]
},
"application/gxf": {
"source": "apache",
"extensions": ["gxf"]
},
"application/gzip": {
"source": "iana",
"compressible": false
},
"application/h224": {
"source": "iana"
},
"application/held+xml": {
"source": "iana"
},
"application/http": {
"source": "iana"
},
"application/hyperstudio": {
"source": "iana",
"extensions": ["stk"]
},
"application/ibe-key-request+xml": {
"source": "iana"
},
"application/ibe-pkg-reply+xml": {
"source": "iana"
},
"application/ibe-pp-data": {
"source": "iana"
},
"application/iges": {
"source": "iana"
},
"application/im-iscomposing+xml": {
"source": "iana"
},
"application/index": {
"source": "iana"
},
"application/index.cmd": {
"source": "iana"
},
"application/index.obj": {
"source": "iana"
},
"application/index.response": {
"source": "iana"
},
"application/index.vnd": {
"source": "iana"
},
"application/inkml+xml": {
"source": "iana",
"extensions": ["ink","inkml"]
},
"application/iotp": {
"source": "iana"
},
"application/ipfix": {
"source": "iana",
"extensions": ["ipfix"]
},
"application/ipp": {
"source": "iana"
},
"application/isup": {
"source": "iana"
},
"application/its+xml": {
"source": "iana"
},
"application/java-archive": {
"source": "apache",
"compressible": false,
"extensions": ["jar","war","ear"]
},
"application/java-serialized-object": {
"source": "apache",
"compressible": false,
"extensions": ["ser"]
},
"application/java-vm": {
"source": "apache",
"compressible": false,
"extensions": ["class"]
},
"application/javascript": {
"source": "iana",
"charset": "UTF-8",
"compressible": true,
"extensions": ["js"]
},
"application/jose": {
"source": "iana"
},
"application/jose+json": {
"source": "iana",
"compressible": true
},
"application/jrd+json": {
"source": "iana",
"compressible": true
},
"application/json": {
"source": "iana",
"charset": "UTF-8",
"compressible": true,
"extensions": ["json","map"]
},
"application/json-patch+json": {
"source": "iana",
"compressible": true
},
"application/json-seq": {
"source": "iana"
},
"application/json5": {
"extensions": ["json5"]
},
"application/jsonml+json": {
"source": "apache",
"compressible": true,
"extensions": ["jsonml"]
},
"application/jwk+json": {
"source": "iana",
"compressible": true
},
"application/jwk-set+json": {
"source": "iana",
"compressible": true
},
"application/jwt": {
"source": "iana"
},
"application/kpml-request+xml": {
"source": "iana"
},
"application/kpml-response+xml": {
"source": "iana"
},
"application/ld+json": {
"source": "iana",
"compressible": true,
"extensions": ["jsonld"]
},
"application/link-format": {
"source": "iana"
},
"application/load-control+xml": {
"source": "iana"
},
"application/lost+xml": {
"source": "iana",
"extensions": ["lostxml"]
},
"application/lostsync+xml": {
"source": "iana"
},
"application/lxf": {
"source": "iana"
},
"application/mac-binhex40": {
"source": "iana",
"extensions": ["hqx"]
},
"application/mac-compactpro": {
"source": "apache",
"extensions": ["cpt"]
},
"application/macwriteii": {
"source": "iana"
},
"application/mads+xml": {
"source": "iana",
"extensions": ["mads"]
},
"application/manifest+json": {
"charset": "UTF-8",
"compressible": true,
"extensions": ["webmanifest"]
},
"application/marc": {
"source": "iana",
"extensions": ["mrc"]
},
"application/marcxml+xml": {
"source": "iana",
"extensions": ["mrcx"]
},
"application/mathematica": {
"source": "iana",
"extensions": ["ma","nb","mb"]
},
"application/mathml+xml": {
"source": "iana",
"extensions": ["mathml"]
},
"application/mathml-content+xml": {
"source": "iana"
},
"application/mathml-presentation+xml": {
"source": "iana"
},
"application/mbms-associated-procedure-description+xml": {
"source": "iana"
},
"application/mbms-deregister+xml": {
"source": "iana"
},
"application/mbms-envelope+xml": {
"source": "iana"
},
"application/mbms-msk+xml": {
"source": "iana"
},
"application/mbms-msk-response+xml": {
"source": "iana"
},
"application/mbms-protection-description+xml": {
"source": "iana"
},
"application/mbms-reception-report+xml": {
"source": "iana"
},
"application/mbms-register+xml": {
"source": "iana"
},
"application/mbms-register-response+xml": {
"source": "iana"
},
"application/mbms-schedule+xml": {
"source": "iana"
},
"application/mbms-user-service-description+xml": {
"source": "iana"
},
"application/mbox": {
"source": "iana",
"extensions": ["mbox"]
},
"application/media-policy-dataset+xml": {
"source": "iana"
},
"application/media_control+xml": {
"source": "iana"
},
"application/mediaservercontrol+xml": {
"source": "iana",
"extensions": ["mscml"]
},
"application/merge-patch+json": {
"source": "iana",
"compressible": true
},
"application/metalink+xml": {
"source": "apache",
"extensions": ["metalink"]
},
"application/metalink4+xml": {
"source": "iana",
"extensions": ["meta4"]
},
"application/mets+xml": {
"source": "iana",
"extensions": ["mets"]
},
"application/mf4": {
"source": "iana"
},
"application/mikey": {
"source": "iana"
},
"application/mods+xml": {
"source": "iana",
"extensions": ["mods"]
},
"application/moss-keys": {
"source": "iana"
},
"application/moss-signature": {
"source": "iana"
},
"application/mosskey-data": {
"source": "iana"
},
"application/mosskey-request": {
"source": "iana"
},
"application/mp21": {
"source": "iana",
"extensions": ["m21","mp21"]
},
"application/mp4": {
"source": "iana",
"extensions": ["mp4s","m4p"]
},
"application/mpeg4-generic": {
"source": "iana"
},
"application/mpeg4-iod": {
"source": "iana"
},
"application/mpeg4-iod-xmt": {
"source": "iana"
},
"application/mrb-consumer+xml": {
"source": "iana"
},
"application/mrb-publish+xml": {
"source": "iana"
},
"application/msc-ivr+xml": {
"source": "iana"
},
"application/msc-mixer+xml": {
"source": "iana"
},
"application/msword": {
"source": "iana",
"compressible": false,
"extensions": ["doc","dot"]
},
"application/mxf": {
"source": "iana",
"extensions": ["mxf"]
},
"application/nasdata": {
"source": "iana"
},
"application/news-checkgroups": {
"source": "iana"
},
"application/news-groupinfo": {
"source": "iana"
},
"application/news-transmission": {
"source": "iana"
},
"application/nlsml+xml": {
"source": "iana"
},
"application/nss": {
"source": "iana"
},
"application/ocsp-request": {
"source": "iana"
},
"application/ocsp-response": {
"source": "iana"
},
"application/octet-stream": {
"source": "iana",
"compressible": false,
"extensions": ["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]
},
"application/oda": {
"source": "iana",
"extensions": ["oda"]
},
"application/odx": {
"source": "iana"
},
"application/oebps-package+xml": {
"source": "iana",
"extensions": ["opf"]
},
"application/ogg": {
"source": "iana",
"compressible": false,
"extensions": ["ogx"]
},
"application/omdoc+xml": {
"source": "apache",
"extensions": ["omdoc"]
},
"application/onenote": {
"source": "apache",
"extensions": ["onetoc","onetoc2","onetmp","onepkg"]
},
"application/oxps": {
"source": "iana",
"extensions": ["oxps"]
},
"application/p2p-overlay+xml": {
"source": "iana"
},
"application/parityfec": {
"source": "iana"
},
"application/patch-ops-error+xml": {
"source": "iana",
"extensions": ["xer"]
},
"application/pdf": {
"source": "iana",
"compressible": false,
"extensions": ["pdf"]
},
"application/pdx": {
"source": "iana"
},
"application/pgp-encrypted": {
"source": "iana",
"compressible": false,
"extensions": ["pgp"]
},
"application/pgp-keys": {
"source": "iana"
},
"application/pgp-signature": {
"source": "iana",
"extensions": ["asc","sig"]
},
"application/pics-rules": {
"source": "apache",
"extensions": ["prf"]
},
"application/pidf+xml": {
"source": "iana"
},
"application/pidf-diff+xml": {
"source": "iana"
},
"application/pkcs10": {
"source": "iana",
"extensions": ["p10"]
},
"application/pkcs12": {
"source": "iana"
},
"application/pkcs7-mime": {
"source": "iana",
"extensions": ["p7m","p7c"]
},
"application/pkcs7-signature": {
"source": "iana",
"extensions": ["p7s"]
},
"application/pkcs8": {
"source": "iana",
"extensions": ["p8"]
},
"application/pkix-attr-cert": {
"source": "iana",
"extensions": ["ac"]
},
"application/pkix-cert": {
"source": "iana",
"extensions": ["cer"]
},
"application/pkix-crl": {
"source": "iana",
"extensions": ["crl"]
},
"application/pkix-pkipath": {
"source": "iana",
"extensions": ["pkipath"]
},
"application/pkixcmp": {
"source": "iana",
"extensions": ["pki"]
},
"application/pls+xml": {
"source": "iana",
"extensions": ["pls"]
},
"application/poc-settings+xml": {
"source": "iana"
},
"application/postscript": {
"source": "iana",
"compressible": true,
"extensions": ["ai","eps","ps"]
},
"application/ppsp-tracker+json": {
"source": "iana",
"compressible": true
},
"application/problem+json": {
"source": "iana",
"compressible": true
},
"application/problem+xml": {
"source": "iana"
},
"application/provenance+xml": {
"source": "iana"
},
"application/prs.alvestrand.titrax-sheet": {
"source": "iana"
},
"application/prs.cww": {
"source": "iana",
"extensions": ["cww"]
},
"application/prs.hpub+zip": {
"source": "iana"
},
"application/prs.nprend": {
"source": "iana"
},
"application/prs.plucker": {
"source": "iana"
},
"application/prs.rdf-xml-crypt": {
"source": "iana"
},
"application/prs.xsf+xml": {
"source": "iana"
},
"application/pskc+xml": {
"source": "iana",
"extensions": ["pskcxml"]
},
"application/qsig": {
"source": "iana"
},
"application/raptorfec": {
"source": "iana"
},
"application/rdap+json": {
"source": "iana",
"compressible": true
},
"application/rdf+xml": {
"source": "iana",
"compressible": true,
"extensions": ["rdf"]
},
"application/reginfo+xml": {
"source": "iana",
"extensions": ["rif"]
},
"application/relax-ng-compact-syntax": {
"source": "iana",
"extensions": ["rnc"]
},
"application/remote-printing": {
"source": "iana"
},
"application/reputon+json": {
"source": "iana",
"compressible": true
},
"application/resource-lists+xml": {
"source": "iana",
"extensions": ["rl"]
},
"application/resource-lists-diff+xml": {
"source": "iana",
"extensions": ["rld"]
},
"application/rfc+xml": {
"source": "iana"
},
"application/riscos": {
"source": "iana"
},
"application/rlmi+xml": {
"source": "iana"
},
"application/rls-services+xml": {
"source": "iana",
"extensions": ["rs"]
},
"application/rpki-ghostbusters": {
"source": "iana",
"extensions": ["gbr"]
},
"application/rpki-manifest": {
"source": "iana",
"extensions": ["mft"]
},
"application/rpki-roa": {
"source": "iana",
"extensions": ["roa"]
},
"application/rpki-updown": {
"source": "iana"
},
"application/rsd+xml": {
"source": "apache",
"extensions": ["rsd"]
},
"application/rss+xml": {
"source": "apache",
"compressible": true,
"extensions": ["rss"]
},
"application/rtf": {
"source": "iana",
"compressible": true,
"extensions": ["rtf"]
},
"application/rtploopback": {
"source": "iana"
},
"application/rtx": {
"source": "iana"
},
"application/samlassertion+xml": {
"source": "iana"
},
"application/samlmetadata+xml": {
"source": "iana"
},
"application/sbml+xml": {
"source": "iana",
"extensions": ["sbml"]
},
"application/scaip+xml": {
"source": "iana"
},
"application/scim+json": {
"source": "iana",
"compressible": true
},
"application/scvp-cv-request": {
"source": "iana",
"extensions": ["scq"]
},
"application/scvp-cv-response": {
"source": "iana",
"extensions": ["scs"]
},
"application/scvp-vp-request": {
"source": "iana",
"extensions": ["spq"]
},
"application/scvp-vp-response": {
"source": "iana",
"extensions": ["spp"]
},
"application/sdp": {
"source": "iana",
"extensions": ["sdp"]
},
"application/sep+xml": {
"source": "iana"
},
"application/sep-exi": {
"source": "iana"
},
"application/session-info": {
"source": "iana"
},
"application/set-payment": {
"source": "iana"
},
"application/set-payment-initiation": {
"source": "iana",
"extensions": ["setpay"]
},
"application/set-registration": {
"source": "iana"
},
"application/set-registration-initiation": {
"source": "iana",
"extensions": ["setreg"]
},
"application/sgml": {
"source": "iana"
},
"application/sgml-open-catalog": {
"source": "iana"
},
"application/shf+xml": {
"source": "iana",
"extensions": ["shf"]
},
"application/sieve": {
"source": "iana"
},
"application/simple-filter+xml": {
"source": "iana"
},
"application/simple-message-summary": {
"source": "iana"
},
"application/simplesymbolcontainer": {
"source": "iana"
},
"application/slate": {
"source": "iana"
},
"application/smil": {
"source": "iana"
},
"application/smil+xml": {
"source": "iana",
"extensions": ["smi","smil"]
},
"application/smpte336m": {
"source": "iana"
},
"application/soap+fastinfoset": {
"source": "iana"
},
"application/soap+xml": {
"source": "iana",
"compressible": true
},
"application/sparql-query": {
"source": "iana",
"extensions": ["rq"]
},
"application/sparql-results+xml": {
"source": "iana",
"extensions": ["srx"]
},
"application/spirits-event+xml": {
"source": "iana"
},
"application/sql": {
"source": "iana"
},
"application/srgs": {
"source": "iana",
"extensions": ["gram"]
},
"application/srgs+xml": {
"source": "iana",
"extensions": ["grxml"]
},
"application/sru+xml": {
"source": "iana",
"extensions": ["sru"]
},
"application/ssdl+xml": {
"source": "apache",
"extensions": ["ssdl"]
},
"application/ssml+xml": {
"source": "iana",
"extensions": ["ssml"]
},
"application/tamp-apex-update": {
"source": "iana"
},
"application/tamp-apex-update-confirm": {
"source": "iana"
},
"application/tamp-community-update": {
"source": "iana"
},
"application/tamp-community-update-confirm": {
"source": "iana"
},
"application/tamp-error": {
"source": "iana"
},
"application/tamp-sequence-adjust": {
"source": "iana"
},
"application/tamp-sequence-adjust-confirm": {
"source": "iana"
},
"application/tamp-status-query": {
"source": "iana"
},
"application/tamp-status-response": {
"source": "iana"
},
"application/tamp-update": {
"source": "iana"
},
"application/tamp-update-confirm": {
"source": "iana"
},
"application/tar": {
"compressible": true
},
"application/tei+xml": {
"source": "iana",
"extensions": ["tei","teicorpus"]
},
"application/thraud+xml": {
"source": "iana",
"extensions": ["tfi"]
},
"application/timestamp-query": {
"source": "iana"
},
"application/timestamp-reply": {
"source": "iana"
},
"application/timestamped-data": {
"source": "iana",
"extensions": ["tsd"]
},
"application/ttml+xml": {
"source": "iana"
},
"application/tve-trigger": {
"source": "iana"
},
"application/ulpfec": {
"source": "iana"
},
"application/urc-grpsheet+xml": {
"source": "iana"
},
"application/urc-ressheet+xml": {
"source": "iana"
},
"application/urc-targetdesc+xml": {
"source": "iana"
},
"application/urc-uisocketdesc+xml": {
"source": "iana"
},
"application/vcard+json": {
"source": "iana",
"compressible": true
},
"application/vcard+xml": {
"source": "iana"
},
"application/vemmi": {
"source": "iana"
},
"application/vividence.scriptfile": {
"source": "apache"
},
"application/vnd.3gpp-prose+xml": {
"source": "iana"
},
"application/vnd.3gpp-prose-pc3ch+xml": {
"source": "iana"
},
"application/vnd.3gpp.access-transfer-events+xml": {
"source": "iana"
},
"application/vnd.3gpp.bsf+xml": {
"source": "iana"
},
"application/vnd.3gpp.mid-call+xml": {
"source": "iana"
},
"application/vnd.3gpp.pic-bw-large": {
"source": "iana",
"extensions": ["plb"]
},
"application/vnd.3gpp.pic-bw-small": {
"source": "iana",
"extensions": ["psb"]
},
"application/vnd.3gpp.pic-bw-var": {
"source": "iana",
"extensions": ["pvb"]
},
"application/vnd.3gpp.sms": {
"source": "iana"
},
"application/vnd.3gpp.sms+xml": {
"source": "iana"
},
"application/vnd.3gpp.srvcc-ext+xml": {
"source": "iana"
},
"application/vnd.3gpp.srvcc-info+xml": {
"source": "iana"
},
"application/vnd.3gpp.state-and-event-info+xml": {
"source": "iana"
},
"application/vnd.3gpp.ussd+xml": {
"source": "iana"
},
"application/vnd.3gpp2.bcmcsinfo+xml": {
"source": "iana"
},
"application/vnd.3gpp2.sms": {
"source": "iana"
},
"application/vnd.3gpp2.tcap": {
"source": "iana",
"extensions": ["tcap"]
},
"application/vnd.3lightssoftware.imagescal": {
"source": "iana"
},
"application/vnd.3m.post-it-notes": {
"source": "iana",
"extensions": ["pwn"]
},
"application/vnd.accpac.simply.aso": {
"source": "iana",
"extensions": ["aso"]
},
"application/vnd.accpac.simply.imp": {
"source": "iana",
"extensions": ["imp"]
},
"application/vnd.acucobol": {
"source": "iana",
"extensions": ["acu"]
},
"application/vnd.acucorp": {
"source": "iana",
"extensions": ["atc","acutc"]
},
"application/vnd.adobe.air-application-installer-package+zip": {
"source": "apache",
"extensions": ["air"]
},
"application/vnd.adobe.flash.movie": {
"source": "iana"
},
"application/vnd.adobe.formscentral.fcdt": {
"source": "iana",
"extensions": ["fcdt"]
},
"application/vnd.adobe.fxp": {
"source": "iana",
"extensions": ["fxp","fxpl"]
},
"application/vnd.adobe.partial-upload": {
"source": "iana"
},
"application/vnd.adobe.xdp+xml": {
"source": "iana",
"extensions": ["xdp"]
},
"application/vnd.adobe.xfdf": {
"source": "iana",
"extensions": ["xfdf"]
},
"application/vnd.aether.imp": {
"source": "iana"
},
"application/vnd.ah-barcode": {
"source": "iana"
},
"application/vnd.ahead.space": {
"source": "iana",
"extensions": ["ahead"]
},
"application/vnd.airzip.filesecure.azf": {
"source": "iana",
"extensions": ["azf"]
},
"application/vnd.airzip.filesecure.azs": {
"source": "iana",
"extensions": ["azs"]
},
"application/vnd.amazon.ebook": {
"source": "apache",
"extensions": ["azw"]
},
"application/vnd.americandynamics.acc": {
"source": "iana",
"extensions": ["acc"]
},
"application/vnd.amiga.ami": {
"source": "iana",
"extensions": ["ami"]
},
"application/vnd.amundsen.maze+xml": {
"source": "iana"
},
"application/vnd.android.package-archive": {
"source": "apache",
"compressible": false,
"extensions": ["apk"]
},
"application/vnd.anki": {
"source": "iana"
},
"application/vnd.anser-web-certificate-issue-initiation": {
"source": "iana",
"extensions": ["cii"]
},
"application/vnd.anser-web-funds-transfer-initiation": {
"source": "apache",
"extensions": ["fti"]
},
"application/vnd.antix.game-component": {
"source": "iana",
"extensions": ["atx"]
},
"application/vnd.apache.thrift.binary": {
"source": "iana"
},
"application/vnd.apache.thrift.compact": {
"source": "iana"
},
"application/vnd.apache.thrift.json": {
"source": "iana"
},
"application/vnd.api+json": {
"source": "iana",
"compressible": true
},
"application/vnd.apple.installer+xml": {
"source": "iana",
"extensions": ["mpkg"]
},
"application/vnd.apple.mpegurl": {
"source": "iana",
"extensions": ["m3u8"]
},
"application/vnd.apple.pkpass": {
"compressible": false,
"extensions": ["pkpass"]
},
"application/vnd.arastra.swi": {
"source": "iana"
},
"application/vnd.aristanetworks.swi": {
"source": "iana",
"extensions": ["swi"]
},
"application/vnd.artsquare": {
"source": "iana"
},
"application/vnd.astraea-software.iota": {
"source": "iana",
"extensions": ["iota"]
},
"application/vnd.audiograph": {
"source": "iana",
"extensions": ["aep"]
},
"application/vnd.autopackage": {
"source": "iana"
},
"application/vnd.avistar+xml": {
"source": "iana"
},
"application/vnd.balsamiq.bmml+xml": {
"source": "iana"
},
"application/vnd.balsamiq.bmpr": {
"source": "iana"
},
"application/vnd.bekitzur-stech+json": {
"source": "iana",
"compressible": true
},
"application/vnd.biopax.rdf+xml": {
"source": "iana"
},
"application/vnd.blueice.multipass": {
"source": "iana",
"extensions": ["mpm"]
},
"application/vnd.bluetooth.ep.oob": {
"source": "iana"
},
"application/vnd.bluetooth.le.oob": {
"source": "iana"
},
"application/vnd.bmi": {
"source": "iana",
"extensions": ["bmi"]
},
"application/vnd.businessobjects": {
"source": "iana",
"extensions": ["rep"]
},
"application/vnd.cab-jscript": {
"source": "iana"
},
"application/vnd.canon-cpdl": {
"source": "iana"
},
"application/vnd.canon-lips": {
"source": "iana"
},
"application/vnd.cendio.thinlinc.clientconf": {
"source": "iana"
},
"application/vnd.century-systems.tcp_stream": {
"source": "iana"
},
"application/vnd.chemdraw+xml": {
"source": "iana",
"extensions": ["cdxml"]
},
"application/vnd.chipnuts.karaoke-mmd": {
"source": "iana",
"extensions": ["mmd"]
},
"application/vnd.cinderella": {
"source": "iana",
"extensions": ["cdy"]
},
"application/vnd.cirpack.isdn-ext": {
"source": "iana"
},
"application/vnd.citationstyles.style+xml": {
"source": "iana"
},
"application/vnd.claymore": {
"source": "iana",
"extensions": ["cla"]
},
"application/vnd.cloanto.rp9": {
"source": "iana",
"extensions": ["rp9"]
},
"application/vnd.clonk.c4group": {
"source": "iana",
"extensions": ["c4g","c4d","c4f","c4p","c4u"]
},
"application/vnd.cluetrust.cartomobile-config": {
"source": "iana",
"extensions": ["c11amc"]
},
"application/vnd.cluetrust.cartomobile-config-pkg": {
"source": "iana",
"extensions": ["c11amz"]
},
"application/vnd.coffeescript": {
"source": "iana"
},
"application/vnd.collection+json": {
"source": "iana",
"compressible": true
},
"application/vnd.collection.doc+json": {
"source": "iana",
"compressible": true
},
"application/vnd.collection.next+json": {
"source": "iana",
"compressible": true
},
"application/vnd.commerce-battelle": {
"source": "iana"
},
"application/vnd.commonspace": {
"source": "iana",
"extensions": ["csp"]
},
"application/vnd.contact.cmsg": {
"source": "iana",
"extensions": ["cdbcmsg"]
},
"application/vnd.coreos.ignition+json": {
"source": "iana",
"compressible": true
},
"application/vnd.cosmocaller": {
"source": "iana",
"extensions": ["cmc"]
},
"application/vnd.crick.clicker": {
"source": "iana",
"extensions": ["clkx"]
},
"application/vnd.crick.clicker.keyboard": {
"source": "iana",
"extensions": ["clkk"]
},
"application/vnd.crick.clicker.palette": {
"source": "iana",
"extensions": ["clkp"]
},
"application/vnd.crick.clicker.template": {
"source": "iana",
"extensions": ["clkt"]
},
"application/vnd.crick.clicker.wordbank": {
"source": "iana",
"extensions": ["clkw"]
},
"application/vnd.criticaltools.wbs+xml": {
"source": "iana",
"extensions": ["wbs"]
},
"application/vnd.ctc-posml": {
"source": "iana",
"extensions": ["pml"]
},
"application/vnd.ctct.ws+xml": {
"source": "iana"
},
"application/vnd.cups-pdf": {
"source": "iana"
},
"application/vnd.cups-postscript": {
"source": "iana"
},
"application/vnd.cups-ppd": {
"source": "iana",
"extensions": ["ppd"]
},
"application/vnd.cups-raster": {
"source": "iana"
},
"application/vnd.cups-raw": {
"source": "iana"
},
"application/vnd.curl": {
"source": "iana"
},
"application/vnd.curl.car": {
"source": "apache",
"extensions": ["car"]
},
"application/vnd.curl.pcurl": {
"source": "apache",
"extensions": ["pcurl"]
},
"application/vnd.cyan.dean.root+xml": {
"source": "iana"
},
"application/vnd.cybank": {
"source": "iana"
},
"application/vnd.dart": {
"source": "iana",
"compressible": true,
"extensions": ["dart"]
},
"application/vnd.data-vision.rdz": {
"source": "iana",
"extensions": ["rdz"]
},
"application/vnd.debian.binary-package": {
"source": "iana"
},
"application/vnd.dece.data": {
"source": "iana",
"extensions": ["uvf","uvvf","uvd","uvvd"]
},
"application/vnd.dece.ttml+xml": {
"source": "iana",
"extensions": ["uvt","uvvt"]
},
"application/vnd.dece.unspecified": {
"source": "iana",
"extensions": ["uvx","uvvx"]
},
"application/vnd.dece.zip": {
"source": "iana",
"extensions": ["uvz","uvvz"]
},
"application/vnd.denovo.fcselayout-link": {
"source": "iana",
"extensions": ["fe_launch"]
},
"application/vnd.desmume-movie": {
"source": "iana"
},
"application/vnd.desmume.movie": {
"source": "apache"
},
"application/vnd.dir-bi.plate-dl-nosuffix": {
"source": "iana"
},
"application/vnd.dm.delegation+xml": {
"source": "iana"
},
"application/vnd.dna": {
"source": "iana",
"extensions": ["dna"]
},
"application/vnd.document+json": {
"source": "iana",
"compressible": true
},
"application/vnd.dolby.mlp": {
"source": "apache",
"extensions": ["mlp"]
},
"application/vnd.dolby.mobile.1": {
"source": "iana"
},
"application/vnd.dolby.mobile.2": {
"source": "iana"
},
"application/vnd.doremir.scorecloud-binary-document": {
"source": "iana"
},
"application/vnd.dpgraph": {
"source": "iana",
"extensions": ["dpg"]
},
"application/vnd.dreamfactory": {
"source": "iana",
"extensions": ["dfac"]
},
"application/vnd.drive+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ds-keypoint": {
"source": "apache",
"extensions": ["kpxx"]
},
"application/vnd.dtg.local": {
"source": "iana"
},
"application/vnd.dtg.local.flash": {
"source": "iana"
},
"application/vnd.dtg.local.html": {
"source": "iana"
},
"application/vnd.dvb.ait": {
"source": "iana",
"extensions": ["ait"]
},
"application/vnd.dvb.dvbj": {
"source": "iana"
},
"application/vnd.dvb.esgcontainer": {
"source": "iana"
},
"application/vnd.dvb.ipdcdftnotifaccess": {
"source": "iana"
},
"application/vnd.dvb.ipdcesgaccess": {
"source": "iana"
},
"application/vnd.dvb.ipdcesgaccess2": {
"source": "iana"
},
"application/vnd.dvb.ipdcesgpdd": {
"source": "iana"
},
"application/vnd.dvb.ipdcroaming": {
"source": "iana"
},
"application/vnd.dvb.iptv.alfec-base": {
"source": "iana"
},
"application/vnd.dvb.iptv.alfec-enhancement": {
"source": "iana"
},
"application/vnd.dvb.notif-aggregate-root+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-container+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-generic+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-ia-msglist+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-ia-registration-request+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-ia-registration-response+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-init+xml": {
"source": "iana"
},
"application/vnd.dvb.pfr": {
"source": "iana"
},
"application/vnd.dvb.service": {
"source": "iana",
"extensions": ["svc"]
},
"application/vnd.dxr": {
"source": "iana"
},
"application/vnd.dynageo": {
"source": "iana",
"extensions": ["geo"]
},
"application/vnd.dzr": {
"source": "iana"
},
"application/vnd.easykaraoke.cdgdownload": {
"source": "iana"
},
"application/vnd.ecdis-update": {
"source": "iana"
},
"application/vnd.ecowin.chart": {
"source": "iana",
"extensions": ["mag"]
},
"application/vnd.ecowin.filerequest": {
"source": "iana"
},
"application/vnd.ecowin.fileupdate": {
"source": "iana"
},
"application/vnd.ecowin.series": {
"source": "iana"
},
"application/vnd.ecowin.seriesrequest": {
"source": "iana"
},
"application/vnd.ecowin.seriesupdate": {
"source": "iana"
},
"application/vnd.emclient.accessrequest+xml": {
"source": "iana"
},
"application/vnd.enliven": {
"source": "iana",
"extensions": ["nml"]
},
"application/vnd.enphase.envoy": {
"source": "iana"
},
"application/vnd.eprints.data+xml": {
"source": "iana"
},
"application/vnd.epson.esf": {
"source": "iana",
"extensions": ["esf"]
},
"application/vnd.epson.msf": {
"source": "iana",
"extensions": ["msf"]
},
"application/vnd.epson.quickanime": {
"source": "iana",
"extensions": ["qam"]
},
"application/vnd.epson.salt": {
"source": "iana",
"extensions": ["slt"]
},
"application/vnd.epson.ssf": {
"source": "iana",
"extensions": ["ssf"]
},
"application/vnd.ericsson.quickcall": {
"source": "iana"
},
"application/vnd.eszigno3+xml": {
"source": "iana",
"extensions": ["es3","et3"]
},
"application/vnd.etsi.aoc+xml": {
"source": "iana"
},
"application/vnd.etsi.asic-e+zip": {
"source": "iana"
},
"application/vnd.etsi.asic-s+zip": {
"source": "iana"
},
"application/vnd.etsi.cug+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvcommand+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvdiscovery+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvprofile+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsad-bc+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsad-cod+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsad-npvr+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvservice+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsync+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvueprofile+xml": {
"source": "iana"
},
"application/vnd.etsi.mcid+xml": {
"source": "iana"
},
"application/vnd.etsi.mheg5": {
"source": "iana"
},
"application/vnd.etsi.overload-control-policy-dataset+xml": {
"source": "iana"
},
"application/vnd.etsi.pstn+xml": {
"source": "iana"
},
"application/vnd.etsi.sci+xml": {
"source": "iana"
},
"application/vnd.etsi.simservs+xml": {
"source": "iana"
},
"application/vnd.etsi.timestamp-token": {
"source": "iana"
},
"application/vnd.etsi.tsl+xml": {
"source": "iana"
},
"application/vnd.etsi.tsl.der": {
"source": "iana"
},
"application/vnd.eudora.data": {
"source": "iana"
},
"application/vnd.ezpix-album": {
"source": "iana",
"extensions": ["ez2"]
},
"application/vnd.ezpix-package": {
"source": "iana",
"extensions": ["ez3"]
},
"application/vnd.f-secure.mobile": {
"source": "iana"
},
"application/vnd.fastcopy-disk-image": {
"source": "iana"
},
"application/vnd.fdf": {
"source": "iana",
"extensions": ["fdf"]
},
"application/vnd.fdsn.mseed": {
"source": "iana",
"extensions": ["mseed"]
},
"application/vnd.fdsn.seed": {
"source": "iana",
"extensions": ["seed","dataless"]
},
"application/vnd.ffsns": {
"source": "iana"
},
"application/vnd.filmit.zfc": {
"source": "iana"
},
"application/vnd.fints": {
"source": "iana"
},
"application/vnd.firemonkeys.cloudcell": {
"source": "iana"
},
"application/vnd.flographit": {
"source": "iana",
"extensions": ["gph"]
},
"application/vnd.fluxtime.clip": {
"source": "iana",
"extensions": ["ftc"]
},
"application/vnd.font-fontforge-sfd": {
"source": "iana"
},
"application/vnd.framemaker": {
"source": "iana",
"extensions": ["fm","frame","maker","book"]
},
"application/vnd.frogans.fnc": {
"source": "iana",
"extensions": ["fnc"]
},
"application/vnd.frogans.ltf": {
"source": "iana",
"extensions": ["ltf"]
},
"application/vnd.fsc.weblaunch": {
"source": "iana",
"extensions": ["fsc"]
},
"application/vnd.fujitsu.oasys": {
"source": "iana",
"extensions": ["oas"]
},
"application/vnd.fujitsu.oasys2": {
"source": "iana",
"extensions": ["oa2"]
},
"application/vnd.fujitsu.oasys3": {
"source": "iana",
"extensions": ["oa3"]
},
"application/vnd.fujitsu.oasysgp": {
"source": "iana",
"extensions": ["fg5"]
},
"application/vnd.fujitsu.oasysprs": {
"source": "iana",
"extensions": ["bh2"]
},
"application/vnd.fujixerox.art-ex": {
"source": "iana"
},
"application/vnd.fujixerox.art4": {
"source": "iana"
},
"application/vnd.fujixerox.ddd": {
"source": "iana",
"extensions": ["ddd"]
},
"application/vnd.fujixerox.docuworks": {
"source": "iana",
"extensions": ["xdw"]
},
"application/vnd.fujixerox.docuworks.binder": {
"source": "iana",
"extensions": ["xbd"]
},
"application/vnd.fujixerox.docuworks.container": {
"source": "iana"
},
"application/vnd.fujixerox.hbpl": {
"source": "iana"
},
"application/vnd.fut-misnet": {
"source": "iana"
},
"application/vnd.fuzzysheet": {
"source": "iana",
"extensions": ["fzs"]
},
"application/vnd.genomatix.tuxedo": {
"source": "iana",
"extensions": ["txd"]
},
"application/vnd.geo+json": {
"source": "iana",
"compressible": true
},
"application/vnd.geocube+xml": {
"source": "iana"
},
"application/vnd.geogebra.file": {
"source": "iana",
"extensions": ["ggb"]
},
"application/vnd.geogebra.tool": {
"source": "iana",
"extensions": ["ggt"]
},
"application/vnd.geometry-explorer": {
"source": "iana",
"extensions": ["gex","gre"]
},
"application/vnd.geonext": {
"source": "iana",
"extensions": ["gxt"]
},
"application/vnd.geoplan": {
"source": "iana",
"extensions": ["g2w"]
},
"application/vnd.geospace": {
"source": "iana",
"extensions": ["g3w"]
},
"application/vnd.gerber": {
"source": "iana"
},
"application/vnd.globalplatform.card-content-mgt": {
"source": "iana"
},
"application/vnd.globalplatform.card-content-mgt-response": {
"source": "iana"
},
"application/vnd.gmx": {
"source": "iana",
"extensions": ["gmx"]
},
"application/vnd.google-apps.document": {
"compressible": false,
"extensions": ["gdoc"]
},
"application/vnd.google-apps.presentation": {
"compressible": false,
"extensions": ["gslides"]
},
"application/vnd.google-apps.spreadsheet": {
"compressible": false,
"extensions": ["gsheet"]
},
"application/vnd.google-earth.kml+xml": {
"source": "iana",
"compressible": true,
"extensions": ["kml"]
},
"application/vnd.google-earth.kmz": {
"source": "iana",
"compressible": false,
"extensions": ["kmz"]
},
"application/vnd.gov.sk.e-form+xml": {
"source": "iana"
},
"application/vnd.gov.sk.e-form+zip": {
"source": "iana"
},
"application/vnd.gov.sk.xmldatacontainer+xml": {
"source": "iana"
},
"application/vnd.grafeq": {
"source": "iana",
"extensions": ["gqf","gqs"]
},
"application/vnd.gridmp": {
"source": "iana"
},
"application/vnd.groove-account": {
"source": "iana",
"extensions": ["gac"]
},
"application/vnd.groove-help": {
"source": "iana",
"extensions": ["ghf"]
},
"application/vnd.groove-identity-message": {
"source": "iana",
"extensions": ["gim"]
},
"application/vnd.groove-injector": {
"source": "iana",
"extensions": ["grv"]
},
"application/vnd.groove-tool-message": {
"source": "iana",
"extensions": ["gtm"]
},
"application/vnd.groove-tool-template": {
"source": "iana",
"extensions": ["tpl"]
},
"application/vnd.groove-vcard": {
"source": "iana",
"extensions": ["vcg"]
},
"application/vnd.hal+json": {
"source": "iana",
"compressible": true
},
"application/vnd.hal+xml": {
"source": "iana",
"extensions": ["hal"]
},
"application/vnd.handheld-entertainment+xml": {
"source": "iana",
"extensions": ["zmm"]
},
"application/vnd.hbci": {
"source": "iana",
"extensions": ["hbci"]
},
"application/vnd.hcl-bireports": {
"source": "iana"
},
"application/vnd.hdt": {
"source": "iana"
},
"application/vnd.heroku+json": {
"source": "iana",
"compressible": true
},
"application/vnd.hhe.lesson-player": {
"source": "iana",
"extensions": ["les"]
},
"application/vnd.hp-hpgl": {
"source": "iana",
"extensions": ["hpgl"]
},
"application/vnd.hp-hpid": {
"source": "iana",
"extensions": ["hpid"]
},
"application/vnd.hp-hps": {
"source": "iana",
"extensions": ["hps"]
},
"application/vnd.hp-jlyt": {
"source": "iana",
"extensions": ["jlt"]
},
"application/vnd.hp-pcl": {
"source": "iana",
"extensions": ["pcl"]
},
"application/vnd.hp-pclxl": {
"source": "iana",
"extensions": ["pclxl"]
},
"application/vnd.httphone": {
"source": "iana"
},
"application/vnd.hydrostatix.sof-data": {
"source": "iana",
"extensions": ["sfd-hdstx"]
},
"application/vnd.hyperdrive+json": {
"source": "iana",
"compressible": true
},
"application/vnd.hzn-3d-crossword": {
"source": "iana"
},
"application/vnd.ibm.afplinedata": {
"source": "iana"
},
"application/vnd.ibm.electronic-media": {
"source": "iana"
},
"application/vnd.ibm.minipay": {
"source": "iana",
"extensions": ["mpy"]
},
"application/vnd.ibm.modcap": {
"source": "iana",
"extensions": ["afp","listafp","list3820"]
},
"application/vnd.ibm.rights-management": {
"source": "iana",
"extensions": ["irm"]
},
"application/vnd.ibm.secure-container": {
"source": "iana",
"extensions": ["sc"]
},
"application/vnd.iccprofile": {
"source": "iana",
"extensions": ["icc","icm"]
},
"application/vnd.ieee.1905": {
"source": "iana"
},
"application/vnd.igloader": {
"source": "iana",
"extensions": ["igl"]
},
"application/vnd.immervision-ivp": {
"source": "iana",
"extensions": ["ivp"]
},
"application/vnd.immervision-ivu": {
"source": "iana",
"extensions": ["ivu"]
},
"application/vnd.ims.imsccv1p1": {
"source": "iana"
},
"application/vnd.ims.imsccv1p2": {
"source": "iana"
},
"application/vnd.ims.imsccv1p3": {
"source": "iana"
},
"application/vnd.ims.lis.v2.result+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolconsumerprofile+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolproxy+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolproxy.id+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolsettings+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolsettings.simple+json": {
"source": "iana",
"compressible": true
},
"application/vnd.informedcontrol.rms+xml": {
"source": "iana"
},
"application/vnd.informix-visionary": {
"source": "iana"
},
"application/vnd.infotech.project": {
"source": "iana"
},
"application/vnd.infotech.project+xml": {
"source": "iana"
},
"application/vnd.innopath.wamp.notification": {
"source": "iana"
},
"application/vnd.insors.igm": {
"source": "iana",
"extensions": ["igm"]
},
"application/vnd.intercon.formnet": {
"source": "iana",
"extensions": ["xpw","xpx"]
},
"application/vnd.intergeo": {
"source": "iana",
"extensions": ["i2g"]
},
"application/vnd.intertrust.digibox": {
"source": "iana"
},
"application/vnd.intertrust.nncp": {
"source": "iana"
},
"application/vnd.intu.qbo": {
"source": "iana",
"extensions": ["qbo"]
},
"application/vnd.intu.qfx": {
"source": "iana",
"extensions": ["qfx"]
},
"application/vnd.iptc.g2.catalogitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.conceptitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.knowledgeitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.newsitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.newsmessage+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.packageitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.planningitem+xml": {
"source": "iana"
},
"application/vnd.ipunplugged.rcprofile": {
"source": "iana",
"extensions": ["rcprofile"]
},
"application/vnd.irepository.package+xml": {
"source": "iana",
"extensions": ["irp"]
},
"application/vnd.is-xpr": {
"source": "iana",
"extensions": ["xpr"]
},
"application/vnd.isac.fcs": {
"source": "iana",
"extensions": ["fcs"]
},
"application/vnd.jam": {
"source": "iana",
"extensions": ["jam"]
},
"application/vnd.japannet-directory-service": {
"source": "iana"
},
"application/vnd.japannet-jpnstore-wakeup": {
"source": "iana"
},
"application/vnd.japannet-payment-wakeup": {
"source": "iana"
},
"application/vnd.japannet-registration": {
"source": "iana"
},
"application/vnd.japannet-registration-wakeup": {
"source": "iana"
},
"application/vnd.japannet-setstore-wakeup": {
"source": "iana"
},
"application/vnd.japannet-verification": {
"source": "iana"
},
"application/vnd.japannet-verification-wakeup": {
"source": "iana"
},
"application/vnd.jcp.javame.midlet-rms": {
"source": "iana",
"extensions": ["rms"]
},
"application/vnd.jisp": {
"source": "iana",
"extensions": ["jisp"]
},
"application/vnd.joost.joda-archive": {
"source": "iana",
"extensions": ["joda"]
},
"application/vnd.jsk.isdn-ngn": {
"source": "iana"
},
"application/vnd.kahootz": {
"source": "iana",
"extensions": ["ktz","ktr"]
},
"application/vnd.kde.karbon": {
"source": "iana",
"extensions": ["karbon"]
},
"application/vnd.kde.kchart": {
"source": "iana",
"extensions": ["chrt"]
},
"application/vnd.kde.kformula": {
"source": "iana",
"extensions": ["kfo"]
},
"application/vnd.kde.kivio": {
"source": "iana",
"extensions": ["flw"]
},
"application/vnd.kde.kontour": {
"source": "iana",
"extensions": ["kon"]
},
"application/vnd.kde.kpresenter": {
"source": "iana",
"extensions": ["kpr","kpt"]
},
"application/vnd.kde.kspread": {
"source": "iana",
"extensions": ["ksp"]
},
"application/vnd.kde.kword": {
"source": "iana",
"extensions": ["kwd","kwt"]
},
"application/vnd.kenameaapp": {
"source": "iana",
"extensions": ["htke"]
},
"application/vnd.kidspiration": {
"source": "iana",
"extensions": ["kia"]
},
"application/vnd.kinar": {
"source": "iana",
"extensions": ["kne","knp"]
},
"application/vnd.koan": {
"source": "iana",
"extensions": ["skp","skd","skt","skm"]
},
"application/vnd.kodak-descriptor": {
"source": "iana",
"extensions": ["sse"]
},
"application/vnd.las.las+xml": {
"source": "iana",
"extensions": ["lasxml"]
},
"application/vnd.liberty-request+xml": {
"source": "iana"
},
"application/vnd.llamagraphics.life-balance.desktop": {
"source": "iana",
"extensions": ["lbd"]
},
"application/vnd.llamagraphics.life-balance.exchange+xml": {
"source": "iana",
"extensions": ["lbe"]
},
"application/vnd.lotus-1-2-3": {
"source": "iana",
"extensions": ["123"]
},
"application/vnd.lotus-approach": {
"source": "iana",
"extensions": ["apr"]
},
"application/vnd.lotus-freelance": {
"source": "iana",
"extensions": ["pre"]
},
"application/vnd.lotus-notes": {
"source": "iana",
"extensions": ["nsf"]
},
"application/vnd.lotus-organizer": {
"source": "iana",
"extensions": ["org"]
},
"application/vnd.lotus-screencam": {
"source": "iana",
"extensions": ["scm"]
},
"application/vnd.lotus-wordpro": {
"source": "iana",
"extensions": ["lwp"]
},
"application/vnd.macports.portpkg": {
"source": "iana",
"extensions": ["portpkg"]
},
"application/vnd.mapbox-vector-tile": {
"source": "iana"
},
"application/vnd.marlin.drm.actiontoken+xml": {
"source": "iana"
},
"application/vnd.marlin.drm.conftoken+xml": {
"source": "iana"
},
"application/vnd.marlin.drm.license+xml": {
"source": "iana"
},
"application/vnd.marlin.drm.mdcf": {
"source": "iana"
},
"application/vnd.mason+json": {
"source": "iana",
"compressible": true
},
"application/vnd.maxmind.maxmind-db": {
"source": "iana"
},
"application/vnd.mcd": {
"source": "iana",
"extensions": ["mcd"]
},
"application/vnd.medcalcdata": {
"source": "iana",
"extensions": ["mc1"]
},
"application/vnd.mediastation.cdkey": {
"source": "iana",
"extensions": ["cdkey"]
},
"application/vnd.meridian-slingshot": {
"source": "iana"
},
"application/vnd.mfer": {
"source": "iana",
"extensions": ["mwf"]
},
"application/vnd.mfmp": {
"source": "iana",
"extensions": ["mfm"]
},
"application/vnd.micro+json": {
"source": "iana",
"compressible": true
},
"application/vnd.micrografx.flo": {
"source": "iana",
"extensions": ["flo"]
},
"application/vnd.micrografx.igx": {
"source": "iana",
"extensions": ["igx"]
},
"application/vnd.microsoft.portable-executable": {
"source": "iana"
},
"application/vnd.miele+json": {
"source": "iana",
"compressible": true
},
"application/vnd.mif": {
"source": "iana",
"extensions": ["mif"]
},
"application/vnd.minisoft-hp3000-save": {
"source": "iana"
},
"application/vnd.mitsubishi.misty-guard.trustweb": {
"source": "iana"
},
"application/vnd.mobius.daf": {
"source": "iana",
"extensions": ["daf"]
},
"application/vnd.mobius.dis": {
"source": "iana",
"extensions": ["dis"]
},
"application/vnd.mobius.mbk": {
"source": "iana",
"extensions": ["mbk"]
},
"application/vnd.mobius.mqy": {
"source": "iana",
"extensions": ["mqy"]
},
"application/vnd.mobius.msl": {
"source": "iana",
"extensions": ["msl"]
},
"application/vnd.mobius.plc": {
"source": "iana",
"extensions": ["plc"]
},
"application/vnd.mobius.txf": {
"source": "iana",
"extensions": ["txf"]
},
"application/vnd.mophun.application": {
"source": "iana",
"extensions": ["mpn"]
},
"application/vnd.mophun.certificate": {
"source": "iana",
"extensions": ["mpc"]
},
"application/vnd.motorola.flexsuite": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.adsi": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.fis": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.gotap": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.kmr": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.ttc": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.wem": {
"source": "iana"
},
"application/vnd.motorola.iprm": {
"source": "iana"
},
"application/vnd.mozilla.xul+xml": {
"source": "iana",
"compressible": true,
"extensions": ["xul"]
},
"application/vnd.ms-3mfdocument": {
"source": "iana"
},
"application/vnd.ms-artgalry": {
"source": "iana",
"extensions": ["cil"]
},
"application/vnd.ms-asf": {
"source": "iana"
},
"application/vnd.ms-cab-compressed": {
"source": "iana",
"extensions": ["cab"]
},
"application/vnd.ms-color.iccprofile": {
"source": "apache"
},
"application/vnd.ms-excel": {
"source": "iana",
"compressible": false,
"extensions": ["xls","xlm","xla","xlc","xlt","xlw"]
},
"application/vnd.ms-excel.addin.macroenabled.12": {
"source": "iana",
"extensions": ["xlam"]
},
"application/vnd.ms-excel.sheet.binary.macroenabled.12": {
"source": "iana",
"extensions": ["xlsb"]
},
"application/vnd.ms-excel.sheet.macroenabled.12": {
"source": "iana",
"extensions": ["xlsm"]
},
"application/vnd.ms-excel.template.macroenabled.12": {
"source": "iana",
"extensions": ["xltm"]
},
"application/vnd.ms-fontobject": {
"source": "iana",
"compressible": true,
"extensions": ["eot"]
},
"application/vnd.ms-htmlhelp": {
"source": "iana",
"extensions": ["chm"]
},
"application/vnd.ms-ims": {
"source": "iana",
"extensions": ["ims"]
},
"application/vnd.ms-lrm": {
"source": "iana",
"extensions": ["lrm"]
},
"application/vnd.ms-office.activex+xml": {
"source": "iana"
},
"application/vnd.ms-officetheme": {
"source": "iana",
"extensions": ["thmx"]
},
"application/vnd.ms-opentype": {
"source": "apache",
"compressible": true
},
"application/vnd.ms-package.obfuscated-opentype": {
"source": "apache"
},
"application/vnd.ms-pki.seccat": {
"source": "apache",
"extensions": ["cat"]
},
"application/vnd.ms-pki.stl": {
"source": "apache",
"extensions": ["stl"]
},
"application/vnd.ms-playready.initiator+xml": {
"source": "iana"
},
"application/vnd.ms-powerpoint": {
"source": "iana",
"compressible": false,
"extensions": ["ppt","pps","pot"]
},
"application/vnd.ms-powerpoint.addin.macroenabled.12": {
"source": "iana",
"extensions": ["ppam"]
},
"application/vnd.ms-powerpoint.presentation.macroenabled.12": {
"source": "iana",
"extensions": ["pptm"]
},
"application/vnd.ms-powerpoint.slide.macroenabled.12": {
"source": "iana",
"extensions": ["sldm"]
},
"application/vnd.ms-powerpoint.slideshow.macroenabled.12": {
"source": "iana",
"extensions": ["ppsm"]
},
"application/vnd.ms-powerpoint.template.macroenabled.12": {
"source": "iana",
"extensions": ["potm"]
},
"application/vnd.ms-printdevicecapabilities+xml": {
"source": "iana"
},
"application/vnd.ms-printing.printticket+xml": {
"source": "apache"
},
"application/vnd.ms-printschematicket+xml": {
"source": "iana"
},
"application/vnd.ms-project": {
"source": "iana",
"extensions": ["mpp","mpt"]
},
"application/vnd.ms-tnef": {
"source": "iana"
},
"application/vnd.ms-windows.devicepairing": {
"source": "iana"
},
"application/vnd.ms-windows.nwprinting.oob": {
"source": "iana"
},
"application/vnd.ms-windows.printerpairing": {
"source": "iana"
},
"application/vnd.ms-windows.wsd.oob": {
"source": "iana"
},
"application/vnd.ms-wmdrm.lic-chlg-req": {
"source": "iana"
},
"application/vnd.ms-wmdrm.lic-resp": {
"source": "iana"
},
"application/vnd.ms-wmdrm.meter-chlg-req": {
"source": "iana"
},
"application/vnd.ms-wmdrm.meter-resp": {
"source": "iana"
},
"application/vnd.ms-word.document.macroenabled.12": {
"source": "iana",
"extensions": ["docm"]
},
"application/vnd.ms-word.template.macroenabled.12": {
"source": "iana",
"extensions": ["dotm"]
},
"application/vnd.ms-works": {
"source": "iana",
"extensions": ["wps","wks","wcm","wdb"]
},
"application/vnd.ms-wpl": {
"source": "iana",
"extensions": ["wpl"]
},
"application/vnd.ms-xpsdocument": {
"source": "iana",
"compressible": false,
"extensions": ["xps"]
},
"application/vnd.msa-disk-image": {
"source": "iana"
},
"application/vnd.mseq": {
"source": "iana",
"extensions": ["mseq"]
},
"application/vnd.msign": {
"source": "iana"
},
"application/vnd.multiad.creator": {
"source": "iana"
},
"application/vnd.multiad.creator.cif": {
"source": "iana"
},
"application/vnd.music-niff": {
"source": "iana"
},
"application/vnd.musician": {
"source": "iana",
"extensions": ["mus"]
},
"application/vnd.muvee.style": {
"source": "iana",
"extensions": ["msty"]
},
"application/vnd.mynfc": {
"source": "iana",
"extensions": ["taglet"]
},
"application/vnd.ncd.control": {
"source": "iana"
},
"application/vnd.ncd.reference": {
"source": "iana"
},
"application/vnd.nervana": {
"source": "iana"
},
"application/vnd.netfpx": {
"source": "iana"
},
"application/vnd.neurolanguage.nlu": {
"source": "iana",
"extensions": ["nlu"]
},
"application/vnd.nintendo.nitro.rom": {
"source": "iana"
},
"application/vnd.nintendo.snes.rom": {
"source": "iana"
},
"application/vnd.nitf": {
"source": "iana",
"extensions": ["ntf","nitf"]
},
"application/vnd.noblenet-directory": {
"source": "iana",
"extensions": ["nnd"]
},
"application/vnd.noblenet-sealer": {
"source": "iana",
"extensions": ["nns"]
},
"application/vnd.noblenet-web": {
"source": "iana",
"extensions": ["nnw"]
},
"application/vnd.nokia.catalogs": {
"source": "iana"
},
"application/vnd.nokia.conml+wbxml": {
"source": "iana"
},
"application/vnd.nokia.conml+xml": {
"source": "iana"
},
"application/vnd.nokia.iptv.config+xml": {
"source": "iana"
},
"application/vnd.nokia.isds-radio-presets": {
"source": "iana"
},
"application/vnd.nokia.landmark+wbxml": {
"source": "iana"
},
"application/vnd.nokia.landmark+xml": {
"source": "iana"
},
"application/vnd.nokia.landmarkcollection+xml": {
"source": "iana"
},
"application/vnd.nokia.n-gage.ac+xml": {
"source": "iana"
},
"application/vnd.nokia.n-gage.data": {
"source": "iana",
"extensions": ["ngdat"]
},
"application/vnd.nokia.n-gage.symbian.install": {
"source": "iana",
"extensions": ["n-gage"]
},
"application/vnd.nokia.ncd": {
"source": "iana"
},
"application/vnd.nokia.pcd+wbxml": {
"source": "iana"
},
"application/vnd.nokia.pcd+xml": {
"source": "iana"
},
"application/vnd.nokia.radio-preset": {
"source": "iana",
"extensions": ["rpst"]
},
"application/vnd.nokia.radio-presets": {
"source": "iana",
"extensions": ["rpss"]
},
"application/vnd.novadigm.edm": {
"source": "iana",
"extensions": ["edm"]
},
"application/vnd.novadigm.edx": {
"source": "iana",
"extensions": ["edx"]
},
"application/vnd.novadigm.ext": {
"source": "iana",
"extensions": ["ext"]
},
"application/vnd.ntt-local.content-share": {
"source": "iana"
},
"application/vnd.ntt-local.file-transfer": {
"source": "iana"
},
"application/vnd.ntt-local.ogw_remote-access": {
"source": "iana"
},
"application/vnd.ntt-local.sip-ta_remote": {
"source": "iana"
},
"application/vnd.ntt-local.sip-ta_tcp_stream": {
"source": "iana"
},
"application/vnd.oasis.opendocument.chart": {
"source": "iana",
"extensions": ["odc"]
},
"application/vnd.oasis.opendocument.chart-template": {
"source": "iana",
"extensions": ["otc"]
},
"application/vnd.oasis.opendocument.database": {
"source": "iana",
"extensions": ["odb"]
},
"application/vnd.oasis.opendocument.formula": {
"source": "iana",
"extensions": ["odf"]
},
"application/vnd.oasis.opendocument.formula-template": {
"source": "iana",
"extensions": ["odft"]
},
"application/vnd.oasis.opendocument.graphics": {
"source": "iana",
"compressible": false,
"extensions": ["odg"]
},
"application/vnd.oasis.opendocument.graphics-template": {
"source": "iana",
"extensions": ["otg"]
},
"application/vnd.oasis.opendocument.image": {
"source": "iana",
"extensions": ["odi"]
},
"application/vnd.oasis.opendocument.image-template": {
"source": "iana",
"extensions": ["oti"]
},
"application/vnd.oasis.opendocument.presentation": {
"source": "iana",
"compressible": false,
"extensions": ["odp"]
},
"application/vnd.oasis.opendocument.presentation-template": {
"source": "iana",
"extensions": ["otp"]
},
"application/vnd.oasis.opendocument.spreadsheet": {
"source": "iana",
"compressible": false,
"extensions": ["ods"]
},
"application/vnd.oasis.opendocument.spreadsheet-template": {
"source": "iana",
"extensions": ["ots"]
},
"application/vnd.oasis.opendocument.text": {
"source": "iana",
"compressible": false,
"extensions": ["odt"]
},
"application/vnd.oasis.opendocument.text-master": {
"source": "iana",
"extensions": ["odm"]
},
"application/vnd.oasis.opendocument.text-template": {
"source": "iana",
"extensions": ["ott"]
},
"application/vnd.oasis.opendocument.text-web": {
"source": "iana",
"extensions": ["oth"]
},
"application/vnd.obn": {
"source": "iana"
},
"application/vnd.oftn.l10n+json": {
"source": "iana",
"compressible": true
},
"application/vnd.oipf.contentaccessdownload+xml": {
"source": "iana"
},
"application/vnd.oipf.contentaccessstreaming+xml": {
"source": "iana"
},
"application/vnd.oipf.cspg-hexbinary": {
"source": "iana"
},
"application/vnd.oipf.dae.svg+xml": {
"source": "iana"
},
"application/vnd.oipf.dae.xhtml+xml": {
"source": "iana"
},
"application/vnd.oipf.mippvcontrolmessage+xml": {
"source": "iana"
},
"application/vnd.oipf.pae.gem": {
"source": "iana"
},
"application/vnd.oipf.spdiscovery+xml": {
"source": "iana"
},
"application/vnd.oipf.spdlist+xml": {
"source": "iana"
},
"application/vnd.oipf.ueprofile+xml": {
"source": "iana"
},
"application/vnd.oipf.userprofile+xml": {
"source": "iana"
},
"application/vnd.olpc-sugar": {
"source": "iana",
"extensions": ["xo"]
},
"application/vnd.oma-scws-config": {
"source": "iana"
},
"application/vnd.oma-scws-http-request": {
"source": "iana"
},
"application/vnd.oma-scws-http-response": {
"source": "iana"
},
"application/vnd.oma.bcast.associated-procedure-parameter+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.drm-trigger+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.imd+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.ltkm": {
"source": "iana"
},
"application/vnd.oma.bcast.notification+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.provisioningtrigger": {
"source": "iana"
},
"application/vnd.oma.bcast.sgboot": {
"source": "iana"
},
"application/vnd.oma.bcast.sgdd+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.sgdu": {
"source": "iana"
},
"application/vnd.oma.bcast.simple-symbol-container": {
"source": "iana"
},
"application/vnd.oma.bcast.smartcard-trigger+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.sprov+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.stkm": {
"source": "iana"
},
"application/vnd.oma.cab-address-book+xml": {
"source": "iana"
},
"application/vnd.oma.cab-feature-handler+xml": {
"source": "iana"
},
"application/vnd.oma.cab-pcc+xml": {
"source": "iana"
},
"application/vnd.oma.cab-subs-invite+xml": {
"source": "iana"
},
"application/vnd.oma.cab-user-prefs+xml": {
"source": "iana"
},
"application/vnd.oma.dcd": {
"source": "iana"
},
"application/vnd.oma.dcdc": {
"source": "iana"
},
"application/vnd.oma.dd2+xml": {
"source": "iana",
"extensions": ["dd2"]
},
"application/vnd.oma.drm.risd+xml": {
"source": "iana"
},
"application/vnd.oma.group-usage-list+xml": {
"source": "iana"
},
"application/vnd.oma.pal+xml": {
"source": "iana"
},
"application/vnd.oma.poc.detailed-progress-report+xml": {
"source": "iana"
},
"application/vnd.oma.poc.final-report+xml": {
"source": "iana"
},
"application/vnd.oma.poc.groups+xml": {
"source": "iana"
},
"application/vnd.oma.poc.invocation-descriptor+xml": {
"source": "iana"
},
"application/vnd.oma.poc.optimized-progress-report+xml": {
"source": "iana"
},
"application/vnd.oma.push": {
"source": "iana"
},
"application/vnd.oma.scidm.messages+xml": {
"source": "iana"
},
"application/vnd.oma.xcap-directory+xml": {
"source": "iana"
},
"application/vnd.omads-email+xml": {
"source": "iana"
},
"application/vnd.omads-file+xml": {
"source": "iana"
},
"application/vnd.omads-folder+xml": {
"source": "iana"
},
"application/vnd.omaloc-supl-init": {
"source": "iana"
},
"application/vnd.onepager": {
"source": "iana"
},
"application/vnd.openblox.game+xml": {
"source": "iana"
},
"application/vnd.openblox.game-binary": {
"source": "iana"
},
"application/vnd.openeye.oeb": {
"source": "iana"
},
"application/vnd.openofficeorg.extension": {
"source": "apache",
"extensions": ["oxt"]
},
"application/vnd.openxmlformats-officedocument.custom-properties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.customxmlproperties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawing+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.extended-properties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml-template": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.comments+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation": {
"source": "iana",
"compressible": false,
"extensions": ["pptx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slide": {
"source": "iana",
"extensions": ["sldx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.slide+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slideshow": {
"source": "iana",
"extensions": ["ppsx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.tags+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.template": {
"source": "apache",
"extensions": ["potx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml-template": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
"source": "iana",
"compressible": false,
"extensions": ["xlsx"]
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.template": {
"source": "apache",
"extensions": ["xltx"]
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.theme+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.themeoverride+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.vmldrawing": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml-template": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
"source": "iana",
"compressible": false,
"extensions": ["docx"]
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": {
"source": "apache",
"extensions": ["dotx"]
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-package.core-properties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-package.relationships+xml": {
"source": "iana"
},
"application/vnd.oracle.resource+json": {
"source": "iana",
"compressible": true
},
"application/vnd.orange.indata": {
"source": "iana"
},
"application/vnd.osa.netdeploy": {
"source": "iana"
},
"application/vnd.osgeo.mapguide.package": {
"source": "iana",
"extensions": ["mgp"]
},
"application/vnd.osgi.bundle": {
"source": "iana"
},
"application/vnd.osgi.dp": {
"source": "iana",
"extensions": ["dp"]
},
"application/vnd.osgi.subsystem": {
"source": "iana",
"extensions": ["esa"]
},
"application/vnd.otps.ct-kip+xml": {
"source": "iana"
},
"application/vnd.oxli.countgraph": {
"source": "iana"
},
"application/vnd.pagerduty+json": {
"source": "iana",
"compressible": true
},
"application/vnd.palm": {
"source": "iana",
"extensions": ["pdb","pqa","oprc"]
},
"application/vnd.panoply": {
"source": "iana"
},
"application/vnd.paos+xml": {
"source": "iana"
},
"application/vnd.paos.xml": {
"source": "apache"
},
"application/vnd.pawaafile": {
"source": "iana",
"extensions": ["paw"]
},
"application/vnd.pcos": {
"source": "iana"
},
"application/vnd.pg.format": {
"source": "iana",
"extensions": ["str"]
},
"application/vnd.pg.osasli": {
"source": "iana",
"extensions": ["ei6"]
},
"application/vnd.piaccess.application-licence": {
"source": "iana"
},
"application/vnd.picsel": {
"source": "iana",
"extensions": ["efif"]
},
"application/vnd.pmi.widget": {
"source": "iana",
"extensions": ["wg"]
},
"application/vnd.poc.group-advertisement+xml": {
"source": "iana"
},
"application/vnd.pocketlearn": {
"source": "iana",
"extensions": ["plf"]
},
"application/vnd.powerbuilder6": {
"source": "iana",
"extensions": ["pbd"]
},
"application/vnd.powerbuilder6-s": {
"source": "iana"
},
"application/vnd.powerbuilder7": {
"source": "iana"
},
"application/vnd.powerbuilder7-s": {
"source": "iana"
},
"application/vnd.powerbuilder75": {
"source": "iana"
},
"application/vnd.powerbuilder75-s": {
"source": "iana"
},
"application/vnd.preminet": {
"source": "iana"
},
"application/vnd.previewsystems.box": {
"source": "iana",
"extensions": ["box"]
},
"application/vnd.proteus.magazine": {
"source": "iana",
"extensions": ["mgz"]
},
"application/vnd.publishare-delta-tree": {
"source": "iana",
"extensions": ["qps"]
},
"application/vnd.pvi.ptid1": {
"source": "iana",
"extensions": ["ptid"]
},
"application/vnd.pwg-multiplexed": {
"source": "iana"
},
"application/vnd.pwg-xhtml-print+xml": {
"source": "iana"
},
"application/vnd.qualcomm.brew-app-res": {
"source": "iana"
},
"application/vnd.quark.quarkxpress": {
"source": "iana",
"extensions": ["qxd","qxt","qwd","qwt","qxl","qxb"]
},
"application/vnd.quobject-quoxdocument": {
"source": "iana"
},
"application/vnd.radisys.moml+xml": {
"source": "iana"
},
"application/vnd.radisys.msml+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-conf+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-conn+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-dialog+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-stream+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-conf+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-base+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-fax-detect+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-fax-sendrecv+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-group+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-speech+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-transform+xml": {
"source": "iana"
},
"application/vnd.rainstor.data": {
"source": "iana"
},
"application/vnd.rapid": {
"source": "iana"
},
"application/vnd.realvnc.bed": {
"source": "iana",
"extensions": ["bed"]
},
"application/vnd.recordare.musicxml": {
"source": "iana",
"extensions": ["mxl"]
},
"application/vnd.recordare.musicxml+xml": {
"source": "iana",
"extensions": ["musicxml"]
},
"application/vnd.renlearn.rlprint": {
"source": "iana"
},
"application/vnd.rig.cryptonote": {
"source": "iana",
"extensions": ["cryptonote"]
},
"application/vnd.rim.cod": {
"source": "apache",
"extensions": ["cod"]
},
"application/vnd.rn-realmedia": {
"source": "apache",
"extensions": ["rm"]
},
"application/vnd.rn-realmedia-vbr": {
"source": "apache",
"extensions": ["rmvb"]
},
"application/vnd.route66.link66+xml": {
"source": "iana",
"extensions": ["link66"]
},
"application/vnd.rs-274x": {
"source": "iana"
},
"application/vnd.ruckus.download": {
"source": "iana"
},
"application/vnd.s3sms": {
"source": "iana"
},
"application/vnd.sailingtracker.track": {
"source": "iana",
"extensions": ["st"]
},
"application/vnd.sbm.cid": {
"source": "iana"
},
"application/vnd.sbm.mid2": {
"source": "iana"
},
"application/vnd.scribus": {
"source": "iana"
},
"application/vnd.sealed.3df": {
"source": "iana"
},
"application/vnd.sealed.csf": {
"source": "iana"
},
"application/vnd.sealed.doc": {
"source": "iana"
},
"application/vnd.sealed.eml": {
"source": "iana"
},
"application/vnd.sealed.mht": {
"source": "iana"
},
"application/vnd.sealed.net": {
"source": "iana"
},
"application/vnd.sealed.ppt": {
"source": "iana"
},
"application/vnd.sealed.tiff": {
"source": "iana"
},
"application/vnd.sealed.xls": {
"source": "iana"
},
"application/vnd.sealedmedia.softseal.html": {
"source": "iana"
},
"application/vnd.sealedmedia.softseal.pdf": {
"source": "iana"
},
"application/vnd.seemail": {
"source": "iana",
"extensions": ["see"]
},
"application/vnd.sema": {
"source": "iana",
"extensions": ["sema"]
},
"application/vnd.semd": {
"source": "iana",
"extensions": ["semd"]
},
"application/vnd.semf": {
"source": "iana",
"extensions": ["semf"]
},
"application/vnd.shana.informed.formdata": {
"source": "iana",
"extensions": ["ifm"]
},
"application/vnd.shana.informed.formtemplate": {
"source": "iana",
"extensions": ["itp"]
},
"application/vnd.shana.informed.interchange": {
"source": "iana",
"extensions": ["iif"]
},
"application/vnd.shana.informed.package": {
"source": "iana",
"extensions": ["ipk"]
},
"application/vnd.simtech-mindmapper": {
"source": "iana",
"extensions": ["twd","twds"]
},
"application/vnd.siren+json": {
"source": "iana",
"compressible": true
},
"application/vnd.smaf": {
"source": "iana",
"extensions": ["mmf"]
},
"application/vnd.smart.notebook": {
"source": "iana"
},
"application/vnd.smart.teacher": {
"source": "iana",
"extensions": ["teacher"]
},
"application/vnd.software602.filler.form+xml": {
"source": "iana"
},
"application/vnd.software602.filler.form-xml-zip": {
"source": "iana"
},
"application/vnd.solent.sdkm+xml": {
"source": "iana",
"extensions": ["sdkm","sdkd"]
},
"application/vnd.spotfire.dxp": {
"source": "iana",
"extensions": ["dxp"]
},
"application/vnd.spotfire.sfs": {
"source": "iana",
"extensions": ["sfs"]
},
"application/vnd.sss-cod": {
"source": "iana"
},
"application/vnd.sss-dtf": {
"source": "iana"
},
"application/vnd.sss-ntf": {
"source": "iana"
},
"application/vnd.stardivision.calc": {
"source": "apache",
"extensions": ["sdc"]
},
"application/vnd.stardivision.draw": {
"source": "apache",
"extensions": ["sda"]
},
"application/vnd.stardivision.impress": {
"source": "apache",
"extensions": ["sdd"]
},
"application/vnd.stardivision.math": {
"source": "apache",
"extensions": ["smf"]
},
"application/vnd.stardivision.writer": {
"source": "apache",
"extensions": ["sdw","vor"]
},
"application/vnd.stardivision.writer-global": {
"source": "apache",
"extensions": ["sgl"]
},
"application/vnd.stepmania.package": {
"source": "iana",
"extensions": ["smzip"]
},
"application/vnd.stepmania.stepchart": {
"source": "iana",
"extensions": ["sm"]
},
"application/vnd.street-stream": {
"source": "iana"
},
"application/vnd.sun.wadl+xml": {
"source": "iana"
},
"application/vnd.sun.xml.calc": {
"source": "apache",
"extensions": ["sxc"]
},
"application/vnd.sun.xml.calc.template": {
"source": "apache",
"extensions": ["stc"]
},
"application/vnd.sun.xml.draw": {
"source": "apache",
"extensions": ["sxd"]
},
"application/vnd.sun.xml.draw.template": {
"source": "apache",
"extensions": ["std"]
},
"application/vnd.sun.xml.impress": {
"source": "apache",
"extensions": ["sxi"]
},
"application/vnd.sun.xml.impress.template": {
"source": "apache",
"extensions": ["sti"]
},
"application/vnd.sun.xml.math": {
"source": "apache",
"extensions": ["sxm"]
},
"application/vnd.sun.xml.writer": {
"source": "apache",
"extensions": ["sxw"]
},
"application/vnd.sun.xml.writer.global": {
"source": "apache",
"extensions": ["sxg"]
},
"application/vnd.sun.xml.writer.template": {
"source": "apache",
"extensions": ["stw"]
},
"application/vnd.sus-calendar": {
"source": "iana",
"extensions": ["sus","susp"]
},
"application/vnd.svd": {
"source": "iana",
"extensions": ["svd"]
},
"application/vnd.swiftview-ics": {
"source": "iana"
},
"application/vnd.symbian.install": {
"source": "apache",
"extensions": ["sis","sisx"]
},
"application/vnd.syncml+xml": {
"source": "iana",
"extensions": ["xsm"]
},
"application/vnd.syncml.dm+wbxml": {
"source": "iana",
"extensions": ["bdm"]
},
"application/vnd.syncml.dm+xml": {
"source": "iana",
"extensions": ["xdm"]
},
"application/vnd.syncml.dm.notification": {
"source": "iana"
},
"application/vnd.syncml.dmddf+wbxml": {
"source": "iana"
},
"application/vnd.syncml.dmddf+xml": {
"source": "iana"
},
"application/vnd.syncml.dmtnds+wbxml": {
"source": "iana"
},
"application/vnd.syncml.dmtnds+xml": {
"source": "iana"
},
"application/vnd.syncml.ds.notification": {
"source": "iana"
},
"application/vnd.tao.intent-module-archive": {
"source": "iana",
"extensions": ["tao"]
},
"application/vnd.tcpdump.pcap": {
"source": "iana",
"extensions": ["pcap","cap","dmp"]
},
"application/vnd.tmd.mediaflex.api+xml": {
"source": "iana"
},
"application/vnd.tml": {
"source": "iana"
},
"application/vnd.tmobile-livetv": {
"source": "iana",
"extensions": ["tmo"]
},
"application/vnd.trid.tpt": {
"source": "iana",
"extensions": ["tpt"]
},
"application/vnd.triscape.mxs": {
"source": "iana",
"extensions": ["mxs"]
},
"application/vnd.trueapp": {
"source": "iana",
"extensions": ["tra"]
},
"application/vnd.truedoc": {
"source": "iana"
},
"application/vnd.ubisoft.webplayer": {
"source": "iana"
},
"application/vnd.ufdl": {
"source": "iana",
"extensions": ["ufd","ufdl"]
},
"application/vnd.uiq.theme": {
"source": "iana",
"extensions": ["utz"]
},
"application/vnd.umajin": {
"source": "iana",
"extensions": ["umj"]
},
"application/vnd.unity": {
"source": "iana",
"extensions": ["unityweb"]
},
"application/vnd.uoml+xml": {
"source": "iana",
"extensions": ["uoml"]
},
"application/vnd.uplanet.alert": {
"source": "iana"
},
"application/vnd.uplanet.alert-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.bearer-choice": {
"source": "iana"
},
"application/vnd.uplanet.bearer-choice-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.cacheop": {
"source": "iana"
},
"application/vnd.uplanet.cacheop-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.channel": {
"source": "iana"
},
"application/vnd.uplanet.channel-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.list": {
"source": "iana"
},
"application/vnd.uplanet.list-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.listcmd": {
"source": "iana"
},
"application/vnd.uplanet.listcmd-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.signal": {
"source": "iana"
},
"application/vnd.uri-map": {
"source": "iana"
},
"application/vnd.valve.source.material": {
"source": "iana"
},
"application/vnd.vcx": {
"source": "iana",
"extensions": ["vcx"]
},
"application/vnd.vd-study": {
"source": "iana"
},
"application/vnd.vectorworks": {
"source": "iana"
},
"application/vnd.vel+json": {
"source": "iana",
"compressible": true
},
"application/vnd.verimatrix.vcas": {
"source": "iana"
},
"application/vnd.vidsoft.vidconference": {
"source": "iana"
},
"application/vnd.visio": {
"source": "iana",
"extensions": ["vsd","vst","vss","vsw"]
},
"application/vnd.visionary": {
"source": "iana",
"extensions": ["vis"]
},
"application/vnd.vividence.scriptfile": {
"source": "iana"
},
"application/vnd.vsf": {
"source": "iana",
"extensions": ["vsf"]
},
"application/vnd.wap.sic": {
"source": "iana"
},
"application/vnd.wap.slc": {
"source": "iana"
},
"application/vnd.wap.wbxml": {
"source": "iana",
"extensions": ["wbxml"]
},
"application/vnd.wap.wmlc": {
"source": "iana",
"extensions": ["wmlc"]
},
"application/vnd.wap.wmlscriptc": {
"source": "iana",
"extensions": ["wmlsc"]
},
"application/vnd.webturbo": {
"source": "iana",
"extensions": ["wtb"]
},
"application/vnd.wfa.p2p": {
"source": "iana"
},
"application/vnd.wfa.wsc": {
"source": "iana"
},
"application/vnd.windows.devicepairing": {
"source": "iana"
},
"application/vnd.wmc": {
"source": "iana"
},
"application/vnd.wmf.bootstrap": {
"source": "iana"
},
"application/vnd.wolfram.mathematica": {
"source": "iana"
},
"application/vnd.wolfram.mathematica.package": {
"source": "iana"
},
"application/vnd.wolfram.player": {
"source": "iana",
"extensions": ["nbp"]
},
"application/vnd.wordperfect": {
"source": "iana",
"extensions": ["wpd"]
},
"application/vnd.wqd": {
"source": "iana",
"extensions": ["wqd"]
},
"application/vnd.wrq-hp3000-labelled": {
"source": "iana"
},
"application/vnd.wt.stf": {
"source": "iana",
"extensions": ["stf"]
},
"application/vnd.wv.csp+wbxml": {
"source": "iana"
},
"application/vnd.wv.csp+xml": {
"source": "iana"
},
"application/vnd.wv.ssp+xml": {
"source": "iana"
},
"application/vnd.xacml+json": {
"source": "iana",
"compressible": true
},
"application/vnd.xara": {
"source": "iana",
"extensions": ["xar"]
},
"application/vnd.xfdl": {
"source": "iana",
"extensions": ["xfdl"]
},
"application/vnd.xfdl.webform": {
"source": "iana"
},
"application/vnd.xmi+xml": {
"source": "iana"
},
"application/vnd.xmpie.cpkg": {
"source": "iana"
},
"application/vnd.xmpie.dpkg": {
"source": "iana"
},
"application/vnd.xmpie.plan": {
"source": "iana"
},
"application/vnd.xmpie.ppkg": {
"source": "iana"
},
"application/vnd.xmpie.xlim": {
"source": "iana"
},
"application/vnd.yamaha.hv-dic": {
"source": "iana",
"extensions": ["hvd"]
},
"application/vnd.yamaha.hv-script": {
"source": "iana",
"extensions": ["hvs"]
},
"application/vnd.yamaha.hv-voice": {
"source": "iana",
"extensions": ["hvp"]
},
"application/vnd.yamaha.openscoreformat": {
"source": "iana",
"extensions": ["osf"]
},
"application/vnd.yamaha.openscoreformat.osfpvg+xml": {
"source": "iana",
"extensions": ["osfpvg"]
},
"application/vnd.yamaha.remote-setup": {
"source": "iana"
},
"application/vnd.yamaha.smaf-audio": {
"source": "iana",
"extensions": ["saf"]
},
"application/vnd.yamaha.smaf-phrase": {
"source": "iana",
"extensions": ["spf"]
},
"application/vnd.yamaha.through-ngn": {
"source": "iana"
},
"application/vnd.yamaha.tunnel-udpencap": {
"source": "iana"
},
"application/vnd.yaoweme": {
"source": "iana"
},
"application/vnd.yellowriver-custom-menu": {
"source": "iana",
"extensions": ["cmp"]
},
"application/vnd.zul": {
"source": "iana",
"extensions": ["zir","zirz"]
},
"application/vnd.zzazz.deck+xml": {
"source": "iana",
"extensions": ["zaz"]
},
"application/voicexml+xml": {
"source": "iana",
"extensions": ["vxml"]
},
"application/vq-rtcpxr": {
"source": "iana"
},
"application/watcherinfo+xml": {
"source": "iana"
},
"application/whoispp-query": {
"source": "iana"
},
"application/whoispp-response": {
"source": "iana"
},
"application/widget": {
"source": "iana",
"extensions": ["wgt"]
},
"application/winhlp": {
"source": "apache",
"extensions": ["hlp"]
},
"application/wita": {
"source": "iana"
},
"application/wordperfect5.1": {
"source": "iana"
},
"application/wsdl+xml": {
"source": "iana",
"extensions": ["wsdl"]
},
"application/wspolicy+xml": {
"source": "iana",
"extensions": ["wspolicy"]
},
"application/x-7z-compressed": {
"source": "apache",
"compressible": false,
"extensions": ["7z"]
},
"application/x-abiword": {
"source": "apache",
"extensions": ["abw"]
},
"application/x-ace-compressed": {
"source": "apache",
"extensions": ["ace"]
},
"application/x-amf": {
"source": "apache"
},
"application/x-apple-diskimage": {
"source": "apache",
"extensions": ["dmg"]
},
"application/x-authorware-bin": {
"source": "apache",
"extensions": ["aab","x32","u32","vox"]
},
"application/x-authorware-map": {
"source": "apache",
"extensions": ["aam"]
},
"application/x-authorware-seg": {
"source": "apache",
"extensions": ["aas"]
},
"application/x-bcpio": {
"source": "apache",
"extensions": ["bcpio"]
},
"application/x-bdoc": {
"compressible": false,
"extensions": ["bdoc"]
},
"application/x-bittorrent": {
"source": "apache",
"extensions": ["torrent"]
},
"application/x-blorb": {
"source": "apache",
"extensions": ["blb","blorb"]
},
"application/x-bzip": {
"source": "apache",
"compressible": false,
"extensions": ["bz"]
},
"application/x-bzip2": {
"source": "apache",
"compressible": false,
"extensions": ["bz2","boz"]
},
"application/x-cbr": {
"source": "apache",
"extensions": ["cbr","cba","cbt","cbz","cb7"]
},
"application/x-cdlink": {
"source": "apache",
"extensions": ["vcd"]
},
"application/x-cfs-compressed": {
"source": "apache",
"extensions": ["cfs"]
},
"application/x-chat": {
"source": "apache",
"extensions": ["chat"]
},
"application/x-chess-pgn": {
"source": "apache",
"extensions": ["pgn"]
},
"application/x-chrome-extension": {
"extensions": ["crx"]
},
"application/x-cocoa": {
"source": "nginx",
"extensions": ["cco"]
},
"application/x-compress": {
"source": "apache"
},
"application/x-conference": {
"source": "apache",
"extensions": ["nsc"]
},
"application/x-cpio": {
"source": "apache",
"extensions": ["cpio"]
},
"application/x-csh": {
"source": "apache",
"extensions": ["csh"]
},
"application/x-deb": {
"compressible": false
},
"application/x-debian-package": {
"source": "apache",
"extensions": ["deb","udeb"]
},
"application/x-dgc-compressed": {
"source": "apache",
"extensions": ["dgc"]
},
"application/x-director": {
"source": "apache",
"extensions": ["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]
},
"application/x-doom": {
"source": "apache",
"extensions": ["wad"]
},
"application/x-dtbncx+xml": {
"source": "apache",
"extensions": ["ncx"]
},
"application/x-dtbook+xml": {
"source": "apache",
"extensions": ["dtb"]
},
"application/x-dtbresource+xml": {
"source": "apache",
"extensions": ["res"]
},
"application/x-dvi": {
"source": "apache",
"compressible": false,
"extensions": ["dvi"]
},
"application/x-envoy": {
"source": "apache",
"extensions": ["evy"]
},
"application/x-eva": {
"source": "apache",
"extensions": ["eva"]
},
"application/x-font-bdf": {
"source": "apache",
"extensions": ["bdf"]
},
"application/x-font-dos": {
"source": "apache"
},
"application/x-font-framemaker": {
"source": "apache"
},
"application/x-font-ghostscript": {
"source": "apache",
"extensions": ["gsf"]
},
"application/x-font-libgrx": {
"source": "apache"
},
"application/x-font-linux-psf": {
"source": "apache",
"extensions": ["psf"]
},
"application/x-font-otf": {
"source": "apache",
"compressible": true,
"extensions": ["otf"]
},
"application/x-font-pcf": {
"source": "apache",
"extensions": ["pcf"]
},
"application/x-font-snf": {
"source": "apache",
"extensions": ["snf"]
},
"application/x-font-speedo": {
"source": "apache"
},
"application/x-font-sunos-news": {
"source": "apache"
},
"application/x-font-ttf": {
"source": "apache",
"compressible": true,
"extensions": ["ttf","ttc"]
},
"application/x-font-type1": {
"source": "apache",
"extensions": ["pfa","pfb","pfm","afm"]
},
"application/x-font-vfont": {
"source": "apache"
},
"application/x-freearc": {
"source": "apache",
"extensions": ["arc"]
},
"application/x-futuresplash": {
"source": "apache",
"extensions": ["spl"]
},
"application/x-gca-compressed": {
"source": "apache",
"extensions": ["gca"]
},
"application/x-glulx": {
"source": "apache",
"extensions": ["ulx"]
},
"application/x-gnumeric": {
"source": "apache",
"extensions": ["gnumeric"]
},
"application/x-gramps-xml": {
"source": "apache",
"extensions": ["gramps"]
},
"application/x-gtar": {
"source": "apache",
"extensions": ["gtar"]
},
"application/x-gzip": {
"source": "apache"
},
"application/x-hdf": {
"source": "apache",
"extensions": ["hdf"]
},
"application/x-httpd-php": {
"compressible": true,
"extensions": ["php"]
},
"application/x-install-instructions": {
"source": "apache",
"extensions": ["install"]
},
"application/x-iso9660-image": {
"source": "apache",
"extensions": ["iso"]
},
"application/x-java-archive-diff": {
"source": "nginx",
"extensions": ["jardiff"]
},
"application/x-java-jnlp-file": {
"source": "apache",
"compressible": false,
"extensions": ["jnlp"]
},
"application/x-javascript": {
"compressible": true
},
"application/x-latex": {
"source": "apache",
"compressible": false,
"extensions": ["latex"]
},
"application/x-lua-bytecode": {
"extensions": ["luac"]
},
"application/x-lzh-compressed": {
"source": "apache",
"extensions": ["lzh","lha"]
},
"application/x-makeself": {
"source": "nginx",
"extensions": ["run"]
},
"application/x-mie": {
"source": "apache",
"extensions": ["mie"]
},
"application/x-mobipocket-ebook": {
"source": "apache",
"extensions": ["prc","mobi"]
},
"application/x-mpegurl": {
"compressible": false
},
"application/x-ms-application": {
"source": "apache",
"extensions": ["application"]
},
"application/x-ms-shortcut": {
"source": "apache",
"extensions": ["lnk"]
},
"application/x-ms-wmd": {
"source": "apache",
"extensions": ["wmd"]
},
"application/x-ms-wmz": {
"source": "apache",
"extensions": ["wmz"]
},
"application/x-ms-xbap": {
"source": "apache",
"extensions": ["xbap"]
},
"application/x-msaccess": {
"source": "apache",
"extensions": ["mdb"]
},
"application/x-msbinder": {
"source": "apache",
"extensions": ["obd"]
},
"application/x-mscardfile": {
"source": "apache",
"extensions": ["crd"]
},
"application/x-msclip": {
"source": "apache",
"extensions": ["clp"]
},
"application/x-msdos-program": {
"extensions": ["exe"]
},
"application/x-msdownload": {
"source": "apache",
"extensions": ["exe","dll","com","bat","msi"]
},
"application/x-msmediaview": {
"source": "apache",
"extensions": ["mvb","m13","m14"]
},
"application/x-msmetafile": {
"source": "apache",
"extensions": ["wmf","wmz","emf","emz"]
},
"application/x-msmoney": {
"source": "apache",
"extensions": ["mny"]
},
"application/x-mspublisher": {
"source": "apache",
"extensions": ["pub"]
},
"application/x-msschedule": {
"source": "apache",
"extensions": ["scd"]
},
"application/x-msterminal": {
"source": "apache",
"extensions": ["trm"]
},
"application/x-mswrite": {
"source": "apache",
"extensions": ["wri"]
},
"application/x-netcdf": {
"source": "apache",
"extensions": ["nc","cdf"]
},
"application/x-ns-proxy-autoconfig": {
"compressible": true,
"extensions": ["pac"]
},
"application/x-nzb": {
"source": "apache",
"extensions": ["nzb"]
},
"application/x-perl": {
"source": "nginx",
"extensions": ["pl","pm"]
},
"application/x-pilot": {
"source": "nginx",
"extensions": ["prc","pdb"]
},
"application/x-pkcs12": {
"source": "apache",
"compressible": false,
"extensions": ["p12","pfx"]
},
"application/x-pkcs7-certificates": {
"source": "apache",
"extensions": ["p7b","spc"]
},
"application/x-pkcs7-certreqresp": {
"source": "apache",
"extensions": ["p7r"]
},
"application/x-rar-compressed": {
"source": "apache",
"compressible": false,
"extensions": ["rar"]
},
"application/x-redhat-package-manager": {
"source": "nginx",
"extensions": ["rpm"]
},
"application/x-research-info-systems": {
"source": "apache",
"extensions": ["ris"]
},
"application/x-sea": {
"source": "nginx",
"extensions": ["sea"]
},
"application/x-sh": {
"source": "apache",
"compressible": true,
"extensions": ["sh"]
},
"application/x-shar": {
"source": "apache",
"extensions": ["shar"]
},
"application/x-shockwave-flash": {
"source": "apache",
"compressible": false,
"extensions": ["swf"]
},
"application/x-silverlight-app": {
"source": "apache",
"extensions": ["xap"]
},
"application/x-sql": {
"source": "apache",
"extensions": ["sql"]
},
"application/x-stuffit": {
"source": "apache",
"compressible": false,
"extensions": ["sit"]
},
"application/x-stuffitx": {
"source": "apache",
"extensions": ["sitx"]
},
"application/x-subrip": {
"source": "apache",
"extensions": ["srt"]
},
"application/x-sv4cpio": {
"source": "apache",
"extensions": ["sv4cpio"]
},
"application/x-sv4crc": {
"source": "apache",
"extensions": ["sv4crc"]
},
"application/x-t3vm-image": {
"source": "apache",
"extensions": ["t3"]
},
"application/x-tads": {
"source": "apache",
"extensions": ["gam"]
},
"application/x-tar": {
"source": "apache",
"compressible": true,
"extensions": ["tar"]
},
"application/x-tcl": {
"source": "apache",
"extensions": ["tcl","tk"]
},
"application/x-tex": {
"source": "apache",
"extensions": ["tex"]
},
"application/x-tex-tfm": {
"source": "apache",
"extensions": ["tfm"]
},
"application/x-texinfo": {
"source": "apache",
"extensions": ["texinfo","texi"]
},
"application/x-tgif": {
"source": "apache",
"extensions": ["obj"]
},
"application/x-ustar": {
"source": "apache",
"extensions": ["ustar"]
},
"application/x-wais-source": {
"source": "apache",
"extensions": ["src"]
},
"application/x-web-app-manifest+json": {
"compressible": true,
"extensions": ["webapp"]
},
"application/x-www-form-urlencoded": {
"source": "iana",
"compressible": true
},
"application/x-x509-ca-cert": {
"source": "apache",
"extensions": ["der","crt","pem"]
},
"application/x-xfig": {
"source": "apache",
"extensions": ["fig"]
},
"application/x-xliff+xml": {
"source": "apache",
"extensions": ["xlf"]
},
"application/x-xpinstall": {
"source": "apache",
"compressible": false,
"extensions": ["xpi"]
},
"application/x-xz": {
"source": "apache",
"extensions": ["xz"]
},
"application/x-zmachine": {
"source": "apache",
"extensions": ["z1","z2","z3","z4","z5","z6","z7","z8"]
},
"application/x400-bp": {
"source": "iana"
},
"application/xacml+xml": {
"source": "iana"
},
"application/xaml+xml": {
"source": "apache",
"extensions": ["xaml"]
},
"application/xcap-att+xml": {
"source": "iana"
},
"application/xcap-caps+xml": {
"source": "iana"
},
"application/xcap-diff+xml": {
"source": "iana",
"extensions": ["xdf"]
},
"application/xcap-el+xml": {
"source": "iana"
},
"application/xcap-error+xml": {
"source": "iana"
},
"application/xcap-ns+xml": {
"source": "iana"
},
"application/xcon-conference-info+xml": {
"source": "iana"
},
"application/xcon-conference-info-diff+xml": {
"source": "iana"
},
"application/xenc+xml": {
"source": "iana",
"extensions": ["xenc"]
},
"application/xhtml+xml": {
"source": "iana",
"compressible": true,
"extensions": ["xhtml","xht"]
},
"application/xhtml-voice+xml": {
"source": "apache"
},
"application/xml": {
"source": "iana",
"compressible": true,
"extensions": ["xml","xsl","xsd","rng"]
},
"application/xml-dtd": {
"source": "iana",
"compressible": true,
"extensions": ["dtd"]
},
"application/xml-external-parsed-entity": {
"source": "iana"
},
"application/xml-patch+xml": {
"source": "iana"
},
"application/xmpp+xml": {
"source": "iana"
},
"application/xop+xml": {
"source": "iana",
"compressible": true,
"extensions": ["xop"]
},
"application/xproc+xml": {
"source": "apache",
"extensions": ["xpl"]
},
"application/xslt+xml": {
"source": "iana",
"extensions": ["xslt"]
},
"application/xspf+xml": {
"source": "apache",
"extensions": ["xspf"]
},
"application/xv+xml": {
"source": "iana",
"extensions": ["mxml","xhvml","xvml","xvm"]
},
"application/yang": {
"source": "iana",
"extensions": ["yang"]
},
"application/yin+xml": {
"source": "iana",
"extensions": ["yin"]
},
"application/zip": {
"source": "iana",
"compressible": false,
"extensions": ["zip"]
},
"application/zlib": {
"source": "iana"
},
"audio/1d-interleaved-parityfec": {
"source": "iana"
},
"audio/32kadpcm": {
"source": "iana"
},
"audio/3gpp": {
"source": "iana",
"compressible": false,
"extensions": ["3gpp"]
},
"audio/3gpp2": {
"source": "iana"
},
"audio/ac3": {
"source": "iana"
},
"audio/adpcm": {
"source": "apache",
"extensions": ["adp"]
},
"audio/amr": {
"source": "iana"
},
"audio/amr-wb": {
"source": "iana"
},
"audio/amr-wb+": {
"source": "iana"
},
"audio/aptx": {
"source": "iana"
},
"audio/asc": {
"source": "iana"
},
"audio/atrac-advanced-lossless": {
"source": "iana"
},
"audio/atrac-x": {
"source": "iana"
},
"audio/atrac3": {
"source": "iana"
},
"audio/basic": {
"source": "iana",
"compressible": false,
"extensions": ["au","snd"]
},
"audio/bv16": {
"source": "iana"
},
"audio/bv32": {
"source": "iana"
},
"audio/clearmode": {
"source": "iana"
},
"audio/cn": {
"source": "iana"
},
"audio/dat12": {
"source": "iana"
},
"audio/dls": {
"source": "iana"
},
"audio/dsr-es201108": {
"source": "iana"
},
"audio/dsr-es202050": {
"source": "iana"
},
"audio/dsr-es202211": {
"source": "iana"
},
"audio/dsr-es202212": {
"source": "iana"
},
"audio/dv": {
"source": "iana"
},
"audio/dvi4": {
"source": "iana"
},
"audio/eac3": {
"source": "iana"
},
"audio/encaprtp": {
"source": "iana"
},
"audio/evrc": {
"source": "iana"
},
"audio/evrc-qcp": {
"source": "iana"
},
"audio/evrc0": {
"source": "iana"
},
"audio/evrc1": {
"source": "iana"
},
"audio/evrcb": {
"source": "iana"
},
"audio/evrcb0": {
"source": "iana"
},
"audio/evrcb1": {
"source": "iana"
},
"audio/evrcnw": {
"source": "iana"
},
"audio/evrcnw0": {
"source": "iana"
},
"audio/evrcnw1": {
"source": "iana"
},
"audio/evrcwb": {
"source": "iana"
},
"audio/evrcwb0": {
"source": "iana"
},
"audio/evrcwb1": {
"source": "iana"
},
"audio/evs": {
"source": "iana"
},
"audio/fwdred": {
"source": "iana"
},
"audio/g711-0": {
"source": "iana"
},
"audio/g719": {
"source": "iana"
},
"audio/g722": {
"source": "iana"
},
"audio/g7221": {
"source": "iana"
},
"audio/g723": {
"source": "iana"
},
"audio/g726-16": {
"source": "iana"
},
"audio/g726-24": {
"source": "iana"
},
"audio/g726-32": {
"source": "iana"
},
"audio/g726-40": {
"source": "iana"
},
"audio/g728": {
"source": "iana"
},
"audio/g729": {
"source": "iana"
},
"audio/g7291": {
"source": "iana"
},
"audio/g729d": {
"source": "iana"
},
"audio/g729e": {
"source": "iana"
},
"audio/gsm": {
"source": "iana"
},
"audio/gsm-efr": {
"source": "iana"
},
"audio/gsm-hr-08": {
"source": "iana"
},
"audio/ilbc": {
"source": "iana"
},
"audio/ip-mr_v2.5": {
"source": "iana"
},
"audio/isac": {
"source": "apache"
},
"audio/l16": {
"source": "iana"
},
"audio/l20": {
"source": "iana"
},
"audio/l24": {
"source": "iana",
"compressible": false
},
"audio/l8": {
"source": "iana"
},
"audio/lpc": {
"source": "iana"
},
"audio/midi": {
"source": "apache",
"extensions": ["mid","midi","kar","rmi"]
},
"audio/mobile-xmf": {
"source": "iana"
},
"audio/mp4": {
"source": "iana",
"compressible": false,
"extensions": ["m4a","mp4a"]
},
"audio/mp4a-latm": {
"source": "iana"
},
"audio/mpa": {
"source": "iana"
},
"audio/mpa-robust": {
"source": "iana"
},
"audio/mpeg": {
"source": "iana",
"compressible": false,
"extensions": ["mpga","mp2","mp2a","mp3","m2a","m3a"]
},
"audio/mpeg4-generic": {
"source": "iana"
},
"audio/musepack": {
"source": "apache"
},
"audio/ogg": {
"source": "iana",
"compressible": false,
"extensions": ["oga","ogg","spx"]
},
"audio/opus": {
"source": "iana"
},
"audio/parityfec": {
"source": "iana"
},
"audio/pcma": {
"source": "iana"
},
"audio/pcma-wb": {
"source": "iana"
},
"audio/pcmu": {
"source": "iana"
},
"audio/pcmu-wb": {
"source": "iana"
},
"audio/prs.sid": {
"source": "iana"
},
"audio/qcelp": {
"source": "iana"
},
"audio/raptorfec": {
"source": "iana"
},
"audio/red": {
"source": "iana"
},
"audio/rtp-enc-aescm128": {
"source": "iana"
},
"audio/rtp-midi": {
"source": "iana"
},
"audio/rtploopback": {
"source": "iana"
},
"audio/rtx": {
"source": "iana"
},
"audio/s3m": {
"source": "apache",
"extensions": ["s3m"]
},
"audio/silk": {
"source": "apache",
"extensions": ["sil"]
},
"audio/smv": {
"source": "iana"
},
"audio/smv-qcp": {
"source": "iana"
},
"audio/smv0": {
"source": "iana"
},
"audio/sp-midi": {
"source": "iana"
},
"audio/speex": {
"source": "iana"
},
"audio/t140c": {
"source": "iana"
},
"audio/t38": {
"source": "iana"
},
"audio/telephone-event": {
"source": "iana"
},
"audio/tone": {
"source": "iana"
},
"audio/uemclip": {
"source": "iana"
},
"audio/ulpfec": {
"source": "iana"
},
"audio/vdvi": {
"source": "iana"
},
"audio/vmr-wb": {
"source": "iana"
},
"audio/vnd.3gpp.iufp": {
"source": "iana"
},
"audio/vnd.4sb": {
"source": "iana"
},
"audio/vnd.audiokoz": {
"source": "iana"
},
"audio/vnd.celp": {
"source": "iana"
},
"audio/vnd.cisco.nse": {
"source": "iana"
},
"audio/vnd.cmles.radio-events": {
"source": "iana"
},
"audio/vnd.cns.anp1": {
"source": "iana"
},
"audio/vnd.cns.inf1": {
"source": "iana"
},
"audio/vnd.dece.audio": {
"source": "iana",
"extensions": ["uva","uvva"]
},
"audio/vnd.digital-winds": {
"source": "iana",
"extensions": ["eol"]
},
"audio/vnd.dlna.adts": {
"source": "iana"
},
"audio/vnd.dolby.heaac.1": {
"source": "iana"
},
"audio/vnd.dolby.heaac.2": {
"source": "iana"
},
"audio/vnd.dolby.mlp": {
"source": "iana"
},
"audio/vnd.dolby.mps": {
"source": "iana"
},
"audio/vnd.dolby.pl2": {
"source": "iana"
},
"audio/vnd.dolby.pl2x": {
"source": "iana"
},
"audio/vnd.dolby.pl2z": {
"source": "iana"
},
"audio/vnd.dolby.pulse.1": {
"source": "iana"
},
"audio/vnd.dra": {
"source": "iana",
"extensions": ["dra"]
},
"audio/vnd.dts": {
"source": "iana",
"extensions": ["dts"]
},
"audio/vnd.dts.hd": {
"source": "iana",
"extensions": ["dtshd"]
},
"audio/vnd.dvb.file": {
"source": "iana"
},
"audio/vnd.everad.plj": {
"source": "iana"
},
"audio/vnd.hns.audio": {
"source": "iana"
},
"audio/vnd.lucent.voice": {
"source": "iana",
"extensions": ["lvp"]
},
"audio/vnd.ms-playready.media.pya": {
"source": "iana",
"extensions": ["pya"]
},
"audio/vnd.nokia.mobile-xmf": {
"source": "iana"
},
"audio/vnd.nortel.vbk": {
"source": "iana"
},
"audio/vnd.nuera.ecelp4800": {
"source": "iana",
"extensions": ["ecelp4800"]
},
"audio/vnd.nuera.ecelp7470": {
"source": "iana",
"extensions": ["ecelp7470"]
},
"audio/vnd.nuera.ecelp9600": {
"source": "iana",
"extensions": ["ecelp9600"]
},
"audio/vnd.octel.sbc": {
"source": "iana"
},
"audio/vnd.qcelp": {
"source": "iana"
},
"audio/vnd.rhetorex.32kadpcm": {
"source": "iana"
},
"audio/vnd.rip": {
"source": "iana",
"extensions": ["rip"]
},
"audio/vnd.rn-realaudio": {
"compressible": false
},
"audio/vnd.sealedmedia.softseal.mpeg": {
"source": "iana"
},
"audio/vnd.vmx.cvsd": {
"source": "iana"
},
"audio/vnd.wave": {
"compressible": false
},
"audio/vorbis": {
"source": "iana",
"compressible": false
},
"audio/vorbis-config": {
"source": "iana"
},
"audio/wav": {
"compressible": false,
"extensions": ["wav"]
},
"audio/wave": {
"compressible": false,
"extensions": ["wav"]
},
"audio/webm": {
"source": "apache",
"compressible": false,
"extensions": ["weba"]
},
"audio/x-aac": {
"source": "apache",
"compressible": false,
"extensions": ["aac"]
},
"audio/x-aiff": {
"source": "apache",
"extensions": ["aif","aiff","aifc"]
},
"audio/x-caf": {
"source": "apache",
"compressible": false,
"extensions": ["caf"]
},
"audio/x-flac": {
"source": "apache",
"extensions": ["flac"]
},
"audio/x-m4a": {
"source": "nginx",
"extensions": ["m4a"]
},
"audio/x-matroska": {
"source": "apache",
"extensions": ["mka"]
},
"audio/x-mpegurl": {
"source": "apache",
"extensions": ["m3u"]
},
"audio/x-ms-wax": {
"source": "apache",
"extensions": ["wax"]
},
"audio/x-ms-wma": {
"source": "apache",
"extensions": ["wma"]
},
"audio/x-pn-realaudio": {
"source": "apache",
"extensions": ["ram","ra"]
},
"audio/x-pn-realaudio-plugin": {
"source": "apache",
"extensions": ["rmp"]
},
"audio/x-realaudio": {
"source": "nginx",
"extensions": ["ra"]
},
"audio/x-tta": {
"source": "apache"
},
"audio/x-wav": {
"source": "apache",
"extensions": ["wav"]
},
"audio/xm": {
"source": "apache",
"extensions": ["xm"]
},
"chemical/x-cdx": {
"source": "apache",
"extensions": ["cdx"]
},
"chemical/x-cif": {
"source": "apache",
"extensions": ["cif"]
},
"chemical/x-cmdf": {
"source": "apache",
"extensions": ["cmdf"]
},
"chemical/x-cml": {
"source": "apache",
"extensions": ["cml"]
},
"chemical/x-csml": {
"source": "apache",
"extensions": ["csml"]
},
"chemical/x-pdb": {
"source": "apache"
},
"chemical/x-xyz": {
"source": "apache",
"extensions": ["xyz"]
},
"font/opentype": {
"compressible": true,
"extensions": ["otf"]
},
"image/bmp": {
"source": "apache",
"compressible": true,
"extensions": ["bmp"]
},
"image/cgm": {
"source": "iana",
"extensions": ["cgm"]
},
"image/fits": {
"source": "iana"
},
"image/g3fax": {
"source": "iana",
"extensions": ["g3"]
},
"image/gif": {
"source": "iana",
"compressible": false,
"extensions": ["gif"]
},
"image/ief": {
"source": "iana",
"extensions": ["ief"]
},
"image/jp2": {
"source": "iana"
},
"image/jpeg": {
"source": "iana",
"compressible": false,
"extensions": ["jpeg","jpg","jpe"]
},
"image/jpm": {
"source": "iana"
},
"image/jpx": {
"source": "iana"
},
"image/ktx": {
"source": "iana",
"extensions": ["ktx"]
},
"image/naplps": {
"source": "iana"
},
"image/pjpeg": {
"compressible": false
},
"image/png": {
"source": "iana",
"compressible": false,
"extensions": ["png"]
},
"image/prs.btif": {
"source": "iana",
"extensions": ["btif"]
},
"image/prs.pti": {
"source": "iana"
},
"image/pwg-raster": {
"source": "iana"
},
"image/sgi": {
"source": "apache",
"extensions": ["sgi"]
},
"image/svg+xml": {
"source": "iana",
"compressible": true,
"extensions": ["svg","svgz"]
},
"image/t38": {
"source": "iana"
},
"image/tiff": {
"source": "iana",
"compressible": false,
"extensions": ["tiff","tif"]
},
"image/tiff-fx": {
"source": "iana"
},
"image/vnd.adobe.photoshop": {
"source": "iana",
"compressible": true,
"extensions": ["psd"]
},
"image/vnd.airzip.accelerator.azv": {
"source": "iana"
},
"image/vnd.cns.inf2": {
"source": "iana"
},
"image/vnd.dece.graphic": {
"source": "iana",
"extensions": ["uvi","uvvi","uvg","uvvg"]
},
"image/vnd.djvu": {
"source": "iana",
"extensions": ["djvu","djv"]
},
"image/vnd.dvb.subtitle": {
"source": "iana",
"extensions": ["sub"]
},
"image/vnd.dwg": {
"source": "iana",
"extensions": ["dwg"]
},
"image/vnd.dxf": {
"source": "iana",
"extensions": ["dxf"]
},
"image/vnd.fastbidsheet": {
"source": "iana",
"extensions": ["fbs"]
},
"image/vnd.fpx": {
"source": "iana",
"extensions": ["fpx"]
},
"image/vnd.fst": {
"source": "iana",
"extensions": ["fst"]
},
"image/vnd.fujixerox.edmics-mmr": {
"source": "iana",
"extensions": ["mmr"]
},
"image/vnd.fujixerox.edmics-rlc": {
"source": "iana",
"extensions": ["rlc"]
},
"image/vnd.globalgraphics.pgb": {
"source": "iana"
},
"image/vnd.microsoft.icon": {
"source": "iana"
},
"image/vnd.mix": {
"source": "iana"
},
"image/vnd.mozilla.apng": {
"source": "iana"
},
"image/vnd.ms-modi": {
"source": "iana",
"extensions": ["mdi"]
},
"image/vnd.ms-photo": {
"source": "apache",
"extensions": ["wdp"]
},
"image/vnd.net-fpx": {
"source": "iana",
"extensions": ["npx"]
},
"image/vnd.radiance": {
"source": "iana"
},
"image/vnd.sealed.png": {
"source": "iana"
},
"image/vnd.sealedmedia.softseal.gif": {
"source": "iana"
},
"image/vnd.sealedmedia.softseal.jpg": {
"source": "iana"
},
"image/vnd.svf": {
"source": "iana"
},
"image/vnd.tencent.tap": {
"source": "iana"
},
"image/vnd.valve.source.texture": {
"source": "iana"
},
"image/vnd.wap.wbmp": {
"source": "iana",
"extensions": ["wbmp"]
},
"image/vnd.xiff": {
"source": "iana",
"extensions": ["xif"]
},
"image/vnd.zbrush.pcx": {
"source": "iana"
},
"image/webp": {
"source": "apache",
"extensions": ["webp"]
},
"image/x-3ds": {
"source": "apache",
"extensions": ["3ds"]
},
"image/x-cmu-raster": {
"source": "apache",
"extensions": ["ras"]
},
"image/x-cmx": {
"source": "apache",
"extensions": ["cmx"]
},
"image/x-freehand": {
"source": "apache",
"extensions": ["fh","fhc","fh4","fh5","fh7"]
},
"image/x-icon": {
"source": "apache",
"compressible": true,
"extensions": ["ico"]
},
"image/x-jng": {
"source": "nginx",
"extensions": ["jng"]
},
"image/x-mrsid-image": {
"source": "apache",
"extensions": ["sid"]
},
"image/x-ms-bmp": {
"source": "nginx",
"compressible": true,
"extensions": ["bmp"]
},
"image/x-pcx": {
"source": "apache",
"extensions": ["pcx"]
},
"image/x-pict": {
"source": "apache",
"extensions": ["pic","pct"]
},
"image/x-portable-anymap": {
"source": "apache",
"extensions": ["pnm"]
},
"image/x-portable-bitmap": {
"source": "apache",
"extensions": ["pbm"]
},
"image/x-portable-graymap": {
"source": "apache",
"extensions": ["pgm"]
},
"image/x-portable-pixmap": {
"source": "apache",
"extensions": ["ppm"]
},
"image/x-rgb": {
"source": "apache",
"extensions": ["rgb"]
},
"image/x-tga": {
"source": "apache",
"extensions": ["tga"]
},
"image/x-xbitmap": {
"source": "apache",
"extensions": ["xbm"]
},
"image/x-xcf": {
"compressible": false
},
"image/x-xpixmap": {
"source": "apache",
"extensions": ["xpm"]
},
"image/x-xwindowdump": {
"source": "apache",
"extensions": ["xwd"]
},
"message/cpim": {
"source": "iana"
},
"message/delivery-status": {
"source": "iana"
},
"message/disposition-notification": {
"source": "iana"
},
"message/external-body": {
"source": "iana"
},
"message/feedback-report": {
"source": "iana"
},
"message/global": {
"source": "iana"
},
"message/global-delivery-status": {
"source": "iana"
},
"message/global-disposition-notification": {
"source": "iana"
},
"message/global-headers": {
"source": "iana"
},
"message/http": {
"source": "iana",
"compressible": false
},
"message/imdn+xml": {
"source": "iana",
"compressible": true
},
"message/news": {
"source": "iana"
},
"message/partial": {
"source": "iana",
"compressible": false
},
"message/rfc822": {
"source": "iana",
"compressible": true,
"extensions": ["eml","mime"]
},
"message/s-http": {
"source": "iana"
},
"message/sip": {
"source": "iana"
},
"message/sipfrag": {
"source": "iana"
},
"message/tracking-status": {
"source": "iana"
},
"message/vnd.si.simp": {
"source": "iana"
},
"message/vnd.wfa.wsc": {
"source": "iana"
},
"model/iges": {
"source": "iana",
"compressible": false,
"extensions": ["igs","iges"]
},
"model/mesh": {
"source": "iana",
"compressible": false,
"extensions": ["msh","mesh","silo"]
},
"model/vnd.collada+xml": {
"source": "iana",
"extensions": ["dae"]
},
"model/vnd.dwf": {
"source": "iana",
"extensions": ["dwf"]
},
"model/vnd.flatland.3dml": {
"source": "iana"
},
"model/vnd.gdl": {
"source": "iana",
"extensions": ["gdl"]
},
"model/vnd.gs-gdl": {
"source": "apache"
},
"model/vnd.gs.gdl": {
"source": "iana"
},
"model/vnd.gtw": {
"source": "iana",
"extensions": ["gtw"]
},
"model/vnd.moml+xml": {
"source": "iana"
},
"model/vnd.mts": {
"source": "iana",
"extensions": ["mts"]
},
"model/vnd.opengex": {
"source": "iana"
},
"model/vnd.parasolid.transmit.binary": {
"source": "iana"
},
"model/vnd.parasolid.transmit.text": {
"source": "iana"
},
"model/vnd.rosette.annotated-data-model": {
"source": "iana"
},
"model/vnd.valve.source.compiled-map": {
"source": "iana"
},
"model/vnd.vtu": {
"source": "iana",
"extensions": ["vtu"]
},
"model/vrml": {
"source": "iana",
"compressible": false,
"extensions": ["wrl","vrml"]
},
"model/x3d+binary": {
"source": "apache",
"compressible": false,
"extensions": ["x3db","x3dbz"]
},
"model/x3d+fastinfoset": {
"source": "iana"
},
"model/x3d+vrml": {
"source": "apache",
"compressible": false,
"extensions": ["x3dv","x3dvz"]
},
"model/x3d+xml": {
"source": "iana",
"compressible": true,
"extensions": ["x3d","x3dz"]
},
"model/x3d-vrml": {
"source": "iana"
},
"multipart/alternative": {
"source": "iana",
"compressible": false
},
"multipart/appledouble": {
"source": "iana"
},
"multipart/byteranges": {
"source": "iana"
},
"multipart/digest": {
"source": "iana"
},
"multipart/encrypted": {
"source": "iana",
"compressible": false
},
"multipart/form-data": {
"source": "iana",
"compressible": false
},
"multipart/header-set": {
"source": "iana"
},
"multipart/mixed": {
"source": "iana",
"compressible": false
},
"multipart/parallel": {
"source": "iana"
},
"multipart/related": {
"source": "iana",
"compressible": false
},
"multipart/report": {
"source": "iana"
},
"multipart/signed": {
"source": "iana",
"compressible": false
},
"multipart/voice-message": {
"source": "iana"
},
"multipart/x-mixed-replace": {
"source": "iana"
},
"text/1d-interleaved-parityfec": {
"source": "iana"
},
"text/cache-manifest": {
"source": "iana",
"compressible": true,
"extensions": ["appcache","manifest"]
},
"text/calendar": {
"source": "iana",
"extensions": ["ics","ifb"]
},
"text/calender": {
"compressible": true
},
"text/cmd": {
"compressible": true
},
"text/coffeescript": {
"extensions": ["coffee","litcoffee"]
},
"text/css": {
"source": "iana",
"compressible": true,
"extensions": ["css"]
},
"text/csv": {
"source": "iana",
"compressible": true,
"extensions": ["csv"]
},
"text/csv-schema": {
"source": "iana"
},
"text/directory": {
"source": "iana"
},
"text/dns": {
"source": "iana"
},
"text/ecmascript": {
"source": "iana"
},
"text/encaprtp": {
"source": "iana"
},
"text/enriched": {
"source": "iana"
},
"text/fwdred": {
"source": "iana"
},
"text/grammar-ref-list": {
"source": "iana"
},
"text/hjson": {
"extensions": ["hjson"]
},
"text/html": {
"source": "iana",
"compressible": true,
"extensions": ["html","htm","shtml"]
},
"text/jade": {
"extensions": ["jade"]
},
"text/javascript": {
"source": "iana",
"compressible": true
},
"text/jcr-cnd": {
"source": "iana"
},
"text/jsx": {
"compressible": true,
"extensions": ["jsx"]
},
"text/less": {
"extensions": ["less"]
},
"text/markdown": {
"source": "iana"
},
"text/mathml": {
"source": "nginx",
"extensions": ["mml"]
},
"text/mizar": {
"source": "iana"
},
"text/n3": {
"source": "iana",
"compressible": true,
"extensions": ["n3"]
},
"text/parameters": {
"source": "iana"
},
"text/parityfec": {
"source": "iana"
},
"text/plain": {
"source": "iana",
"compressible": true,
"extensions": ["txt","text","conf","def","list","log","in","ini"]
},
"text/provenance-notation": {
"source": "iana"
},
"text/prs.fallenstein.rst": {
"source": "iana"
},
"text/prs.lines.tag": {
"source": "iana",
"extensions": ["dsc"]
},
"text/prs.prop.logic": {
"source": "iana"
},
"text/raptorfec": {
"source": "iana"
},
"text/red": {
"source": "iana"
},
"text/rfc822-headers": {
"source": "iana"
},
"text/richtext": {
"source": "iana",
"compressible": true,
"extensions": ["rtx"]
},
"text/rtf": {
"source": "iana",
"compressible": true,
"extensions": ["rtf"]
},
"text/rtp-enc-aescm128": {
"source": "iana"
},
"text/rtploopback": {
"source": "iana"
},
"text/rtx": {
"source": "iana"
},
"text/sgml": {
"source": "iana",
"extensions": ["sgml","sgm"]
},
"text/slim": {
"extensions": ["slim","slm"]
},
"text/stylus": {
"extensions": ["stylus","styl"]
},
"text/t140": {
"source": "iana"
},
"text/tab-separated-values": {
"source": "iana",
"compressible": true,
"extensions": ["tsv"]
},
"text/troff": {
"source": "iana",
"extensions": ["t","tr","roff","man","me","ms"]
},
"text/turtle": {
"source": "iana",
"extensions": ["ttl"]
},
"text/ulpfec": {
"source": "iana"
},
"text/uri-list": {
"source": "iana",
"compressible": true,
"extensions": ["uri","uris","urls"]
},
"text/vcard": {
"source": "iana",
"compressible": true,
"extensions": ["vcard"]
},
"text/vnd.a": {
"source": "iana"
},
"text/vnd.abc": {
"source": "iana"
},
"text/vnd.curl": {
"source": "iana",
"extensions": ["curl"]
},
"text/vnd.curl.dcurl": {
"source": "apache",
"extensions": ["dcurl"]
},
"text/vnd.curl.mcurl": {
"source": "apache",
"extensions": ["mcurl"]
},
"text/vnd.curl.scurl": {
"source": "apache",
"extensions": ["scurl"]
},
"text/vnd.debian.copyright": {
"source": "iana"
},
"text/vnd.dmclientscript": {
"source": "iana"
},
"text/vnd.dvb.subtitle": {
"source": "iana",
"extensions": ["sub"]
},
"text/vnd.esmertec.theme-descriptor": {
"source": "iana"
},
"text/vnd.fly": {
"source": "iana",
"extensions": ["fly"]
},
"text/vnd.fmi.flexstor": {
"source": "iana",
"extensions": ["flx"]
},
"text/vnd.graphviz": {
"source": "iana",
"extensions": ["gv"]
},
"text/vnd.in3d.3dml": {
"source": "iana",
"extensions": ["3dml"]
},
"text/vnd.in3d.spot": {
"source": "iana",
"extensions": ["spot"]
},
"text/vnd.iptc.newsml": {
"source": "iana"
},
"text/vnd.iptc.nitf": {
"source": "iana"
},
"text/vnd.latex-z": {
"source": "iana"
},
"text/vnd.motorola.reflex": {
"source": "iana"
},
"text/vnd.ms-mediapackage": {
"source": "iana"
},
"text/vnd.net2phone.commcenter.command": {
"source": "iana"
},
"text/vnd.radisys.msml-basic-layout": {
"source": "iana"
},
"text/vnd.si.uricatalogue": {
"source": "iana"
},
"text/vnd.sun.j2me.app-descriptor": {
"source": "iana",
"extensions": ["jad"]
},
"text/vnd.trolltech.linguist": {
"source": "iana"
},
"text/vnd.wap.si": {
"source": "iana"
},
"text/vnd.wap.sl": {
"source": "iana"
},
"text/vnd.wap.wml": {
"source": "iana",
"extensions": ["wml"]
},
"text/vnd.wap.wmlscript": {
"source": "iana",
"extensions": ["wmls"]
},
"text/vtt": {
"charset": "UTF-8",
"compressible": true,
"extensions": ["vtt"]
},
"text/x-asm": {
"source": "apache",
"extensions": ["s","asm"]
},
"text/x-c": {
"source": "apache",
"extensions": ["c","cc","cxx","cpp","h","hh","dic"]
},
"text/x-component": {
"source": "nginx",
"extensions": ["htc"]
},
"text/x-fortran": {
"source": "apache",
"extensions": ["f","for","f77","f90"]
},
"text/x-gwt-rpc": {
"compressible": true
},
"text/x-handlebars-template": {
"extensions": ["hbs"]
},
"text/x-java-source": {
"source": "apache",
"extensions": ["java"]
},
"text/x-jquery-tmpl": {
"compressible": true
},
"text/x-lua": {
"extensions": ["lua"]
},
"text/x-markdown": {
"compressible": true,
"extensions": ["markdown","md","mkd"]
},
"text/x-nfo": {
"source": "apache",
"extensions": ["nfo"]
},
"text/x-opml": {
"source": "apache",
"extensions": ["opml"]
},
"text/x-pascal": {
"source": "apache",
"extensions": ["p","pas"]
},
"text/x-processing": {
"compressible": true,
"extensions": ["pde"]
},
"text/x-sass": {
"extensions": ["sass"]
},
"text/x-scss": {
"extensions": ["scss"]
},
"text/x-setext": {
"source": "apache",
"extensions": ["etx"]
},
"text/x-sfv": {
"source": "apache",
"extensions": ["sfv"]
},
"text/x-suse-ymp": {
"compressible": true,
"extensions": ["ymp"]
},
"text/x-uuencode": {
"source": "apache",
"extensions": ["uu"]
},
"text/x-vcalendar": {
"source": "apache",
"extensions": ["vcs"]
},
"text/x-vcard": {
"source": "apache",
"extensions": ["vcf"]
},
"text/xml": {
"source": "iana",
"compressible": true,
"extensions": ["xml"]
},
"text/xml-external-parsed-entity": {
"source": "iana"
},
"text/yaml": {
"extensions": ["yaml","yml"]
},
"video/1d-interleaved-parityfec": {
"source": "apache"
},
"video/3gpp": {
"source": "apache",
"extensions": ["3gp","3gpp"]
},
"video/3gpp-tt": {
"source": "apache"
},
"video/3gpp2": {
"source": "apache",
"extensions": ["3g2"]
},
"video/bmpeg": {
"source": "apache"
},
"video/bt656": {
"source": "apache"
},
"video/celb": {
"source": "apache"
},
"video/dv": {
"source": "apache"
},
"video/encaprtp": {
"source": "apache"
},
"video/h261": {
"source": "apache",
"extensions": ["h261"]
},
"video/h263": {
"source": "apache",
"extensions": ["h263"]
},
"video/h263-1998": {
"source": "apache"
},
"video/h263-2000": {
"source": "apache"
},
"video/h264": {
"source": "apache",
"extensions": ["h264"]
},
"video/h264-rcdo": {
"source": "apache"
},
"video/h264-svc": {
"source": "apache"
},
"video/h265": {
"source": "apache"
},
"video/iso.segment": {
"source": "apache"
},
"video/jpeg": {
"source": "apache",
"extensions": ["jpgv"]
},
"video/jpeg2000": {
"source": "apache"
},
"video/jpm": {
"source": "apache",
"extensions": ["jpm","jpgm"]
},
"video/mj2": {
"source": "apache",
"extensions": ["mj2","mjp2"]
},
"video/mp1s": {
"source": "apache"
},
"video/mp2p": {
"source": "apache"
},
"video/mp2t": {
"source": "apache",
"extensions": ["ts"]
},
"video/mp4": {
"source": "apache",
"compressible": false,
"extensions": ["mp4","mp4v","mpg4"]
},
"video/mp4v-es": {
"source": "apache"
},
"video/mpeg": {
"source": "apache",
"compressible": false,
"extensions": ["mpeg","mpg","mpe","m1v","m2v"]
},
"video/mpeg4-generic": {
"source": "apache"
},
"video/mpv": {
"source": "apache"
},
"video/nv": {
"source": "apache"
},
"video/ogg": {
"source": "apache",
"compressible": false,
"extensions": ["ogv"]
},
"video/parityfec": {
"source": "apache"
},
"video/pointer": {
"source": "apache"
},
"video/quicktime": {
"source": "apache",
"compressible": false,
"extensions": ["qt","mov"]
},
"video/raptorfec": {
"source": "apache"
},
"video/raw": {
"source": "apache"
},
"video/rtp-enc-aescm128": {
"source": "apache"
},
"video/rtploopback": {
"source": "apache"
},
"video/rtx": {
"source": "apache"
},
"video/smpte292m": {
"source": "apache"
},
"video/ulpfec": {
"source": "apache"
},
"video/vc1": {
"source": "apache"
},
"video/vnd.cctv": {
"source": "apache"
},
"video/vnd.dece.hd": {
"source": "apache",
"extensions": ["uvh","uvvh"]
},
"video/vnd.dece.mobile": {
"source": "apache",
"extensions": ["uvm","uvvm"]
},
"video/vnd.dece.mp4": {
"source": "apache"
},
"video/vnd.dece.pd": {
"source": "apache",
"extensions": ["uvp","uvvp"]
},
"video/vnd.dece.sd": {
"source": "apache",
"extensions": ["uvs","uvvs"]
},
"video/vnd.dece.video": {
"source": "apache",
"extensions": ["uvv","uvvv"]
},
"video/vnd.directv.mpeg": {
"source": "apache"
},
"video/vnd.directv.mpeg-tts": {
"source": "apache"
},
"video/vnd.dlna.mpeg-tts": {
"source": "apache"
},
"video/vnd.dvb.file": {
"source": "apache",
"extensions": ["dvb"]
},
"video/vnd.fvt": {
"source": "apache",
"extensions": ["fvt"]
},
"video/vnd.hns.video": {
"source": "apache"
},
"video/vnd.iptvforum.1dparityfec-1010": {
"source": "apache"
},
"video/vnd.iptvforum.1dparityfec-2005": {
"source": "apache"
},
"video/vnd.iptvforum.2dparityfec-1010": {
"source": "apache"
},
"video/vnd.iptvforum.2dparityfec-2005": {
"source": "apache"
},
"video/vnd.iptvforum.ttsavc": {
"source": "apache"
},
"video/vnd.iptvforum.ttsmpeg2": {
"source": "apache"
},
"video/vnd.motorola.video": {
"source": "apache"
},
"video/vnd.motorola.videop": {
"source": "apache"
},
"video/vnd.mpegurl": {
"source": "apache",
"extensions": ["mxu","m4u"]
},
"video/vnd.ms-playready.media.pyv": {
"source": "apache",
"extensions": ["pyv"]
},
"video/vnd.nokia.interleaved-multimedia": {
"source": "apache"
},
"video/vnd.nokia.videovoip": {
"source": "apache"
},
"video/vnd.objectvideo": {
"source": "apache"
},
"video/vnd.radgamettools.bink": {
"source": "apache"
},
"video/vnd.radgamettools.smacker": {
"source": "apache"
},
"video/vnd.sealed.mpeg1": {
"source": "apache"
},
"video/vnd.sealed.mpeg4": {
"source": "apache"
},
"video/vnd.sealed.swf": {
"source": "apache"
},
"video/vnd.sealedmedia.softseal.mov": {
"source": "apache"
},
"video/vnd.uvvu.mp4": {
"source": "apache",
"extensions": ["uvu","uvvu"]
},
"video/vnd.vivo": {
"source": "apache",
"extensions": ["viv"]
},
"video/vp8": {
"source": "apache"
},
"video/webm": {
"source": "apache",
"compressible": false,
"extensions": ["webm"]
},
"video/x-f4v": {
"source": "apache",
"extensions": ["f4v"]
},
"video/x-fli": {
"source": "apache",
"extensions": ["fli"]
},
"video/x-flv": {
"source": "apache",
"compressible": false,
"extensions": ["flv"]
},
"video/x-m4v": {
"source": "apache",
"extensions": ["m4v"]
},
"video/x-matroska": {
"source": "apache",
"compressible": false,
"extensions": ["mkv","mk3d","mks"]
},
"video/x-mng": {
"source": "apache",
"extensions": ["mng"]
},
"video/x-ms-asf": {
"source": "apache",
"extensions": ["asf","asx"]
},
"video/x-ms-vob": {
"source": "apache",
"extensions": ["vob"]
},
"video/x-ms-wm": {
"source": "apache",
"extensions": ["wm"]
},
"video/x-ms-wmv": {
"source": "apache",
"compressible": false,
"extensions": ["wmv"]
},
"video/x-ms-wmx": {
"source": "apache",
"extensions": ["wmx"]
},
"video/x-ms-wvx": {
"source": "apache",
"extensions": ["wvx"]
},
"video/x-msvideo": {
"source": "apache",
"extensions": ["avi"]
},
"video/x-sgi-movie": {
"source": "apache",
"extensions": ["movie"]
},
"video/x-smv": {
"source": "apache",
"extensions": ["smv"]
},
"x-conference/x-cooltalk": {
"source": "apache",
"extensions": ["ice"]
},
"x-shader/x-fragment": {
"compressible": true
},
"x-shader/x-vertex": {
"compressible": true
}
}
},{}],54:[function(require,module,exports){
/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*/
/**
* Module exports.
*/
module.exports = require('./db.json')
},{"./db.json":53}],55:[function(require,module,exports){
/**
* Create an event emitter with namespaces
* @name createNamespaceEmitter
* @example
* var emitter = require('./index')()
*
* emitter.on('*', function () {
* console.log('all events emitted', this.event)
* })
*
* emitter.on('example', function () {
* console.log('example event emitted')
* })
*/
module.exports = function createNamespaceEmitter () {
var emitter = { _fns: {} }
/**
* Emit an event. Optionally namespace the event. Separate the namespace and event with a `:`
* @name emit
* @param {String} event – the name of the event, with optional namespace
* @param {...*} data – data variables that will be passed as arguments to the event listener
* @example
* emitter.emit('example')
* emitter.emit('demo:test')
* emitter.emit('data', { example: true}, 'a string', 1)
*/
emitter.emit = function emit (event) {
var args = [].slice.call(arguments, 1)
var namespaced = namespaces(event)
if (this._fns[event]) emitAll(event, this._fns[event], args)
if (namespaced) emitAll(event, namespaced, args)
}
/**
* Create en event listener.
* @name on
* @param {String} event
* @param {Function} fn
* @example
* emitter.on('example', function () {})
* emitter.on('demo', function () {})
*/
emitter.on = function on (event, fn) {
if (typeof fn !== 'function') { throw new Error('callback required') }
(this._fns[event] = this._fns[event] || []).push(fn)
}
/**
* Create en event listener that fires once.
* @name once
* @param {String} event
* @param {Function} fn
* @example
* emitter.once('example', function () {})
* emitter.once('demo', function () {})
*/
emitter.once = function once (event, fn) {
function one () {
fn.apply(this, arguments)
emitter.off(event, one)
}
this.on(event, one)
}
/**
* Stop listening to an event. Stop all listeners on an event by only passing the event name. Stop a single listener by passing that event handler as a callback.
* You must be explicit about what will be unsubscribed: `emitter.off('demo')` will unsubscribe an `emitter.on('demo')` listener,
* `emitter.off('demo:example')` will unsubscribe an `emitter.on('demo:example')` listener
* @name off
* @param {String} event
* @param {Function} [fn] – the specific handler
* @example
* emitter.off('example')
* emitter.off('demo', function () {})
*/
emitter.off = function off (event, fn) {
var keep = []
if (event && fn) {
for (var i = 0; i < this._fns.length; i++) {
if (this._fns[i] !== fn) {
keep.push(this._fns[i])
}
}
}
keep.length ? this._fns[event] = keep : delete this._fns[event]
}
function namespaces (e) {
var out = []
var args = e.split(':')
var fns = emitter._fns
Object.keys(fns).forEach(function (key) {
if (key === '*') out = out.concat(fns[key])
if (args.length === 2 && args[0] === key) out = out.concat(fns[key])
})
return out
}
function emitAll (e, fns, args) {
for (var i = 0; i < fns.length; i++) {
if (!fns[i]) break
fns[i].event = e
fns[i].apply(fns[i], args)
}
}
return emitter
}
},{}],56:[function(require,module,exports){
'use strict';
var numberIsNan = require('number-is-nan');
module.exports = function (num) {
if (typeof num !== 'number' || numberIsNan(num)) {
throw new TypeError('Expected a number, got ' + typeof num);
}
var exponent;
var unit;
var neg = num < 0;
var units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
if (neg) {
num = -num;
}
if (num < 1) {
return (neg ? '-' : '') + num + ' B';
}
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1);
num = Number((num / Math.pow(1000, exponent)).toFixed(2));
unit = units[exponent];
return (neg ? '-' : '') + num + ' ' + unit;
};
},{"number-is-nan":57}],57:[function(require,module,exports){
'use strict';
module.exports = Number.isNaN || function (x) {
return x !== x;
};
},{}],58:[function(require,module,exports){
// Generated by Babel
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.encode = encode;
/* global: window */
var _window = window;
var btoa = _window.btoa;
function encode(data) {
return btoa(unescape(encodeURIComponent(data)));
}
var isSupported = exports.isSupported = "btoa" in window;
},{}],59:[function(require,module,exports){
// Generated by Babel
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.newRequest = newRequest;
/* global window */
function newRequest() {
return new window.XMLHttpRequest();
}
},{}],60:[function(require,module,exports){
// Generated by Babel
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getSource = getSource;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var FileSource = function () {
function FileSource(file) {
_classCallCheck(this, FileSource);
this._file = file;
this.size = file.size;
}
_createClass(FileSource, [{
key: "slice",
value: function slice(start, end) {
return this._file.slice(start, end);
}
}, {
key: "close",
value: function close() {}
}]);
return FileSource;
}();
function getSource(input) {
// Since we emulate the Blob type in our tests (not all target browsers
// support it), we cannot use `instanceof` for testing whether the input value
// can be handled. Instead, we simply check is the slice() function and the
// size property are available.
if (typeof input.slice === "function" && typeof input.size !== "undefined") {
return new FileSource(input);
}
throw new Error("source object may only be an instance of File or Blob in this environment");
}
},{}],61:[function(require,module,exports){
// Generated by Babel
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setItem = setItem;
exports.getItem = getItem;
exports.removeItem = removeItem;
/* global window, localStorage */
var hasStorage = false;
try {
hasStorage = "localStorage" in window;
// Attempt to access localStorage
localStorage.length;
} catch (e) {
// If we try to access localStorage inside a sandboxed iframe, a SecurityError
// is thrown.
if (e.code === e.SECURITY_ERR) {
hasStorage = false;
} else {
throw e;
}
}
var canStoreURLs = exports.canStoreURLs = hasStorage;
function setItem(key, value) {
if (!hasStorage) return;
return localStorage.setItem(key, value);
}
function getItem(key) {
if (!hasStorage) return;
return localStorage.getItem(key);
}
function removeItem(key) {
if (!hasStorage) return;
return localStorage.removeItem(key);
}
},{}],62:[function(require,module,exports){
// Generated by Babel
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = fingerprint;
/**
* Generate a fingerprint for a file which will be used the store the endpoint
*
* @param {File} file
* @return {String}
*/
function fingerprint(file) {
return ["tus", file.name, file.type, file.size, file.lastModified].join("-");
}
},{}],63:[function(require,module,exports){
// Generated by Babel
"use strict";
var _upload = require("./upload");
var _upload2 = _interopRequireDefault(_upload);
var _storage = require("./node/storage");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* global window */
var defaultOptions = _upload2.default.defaultOptions;
if (typeof window !== "undefined") {
// Browser environment using XMLHttpRequest
var _window = window;
var XMLHttpRequest = _window.XMLHttpRequest;
var Blob = _window.Blob;
var isSupported = XMLHttpRequest && Blob && typeof Blob.prototype.slice === "function";
} else {
// Node.js environment using http module
var isSupported = true;
}
// The usage of the commonjs exporting syntax instead of the new ECMAScript
// one is actually inteded and prevents weird behaviour if we are trying to
// import this module in another module using Babel.
module.exports = {
Upload: _upload2.default,
isSupported: isSupported,
canStoreURLs: _storage.canStoreURLs,
defaultOptions: defaultOptions
};
},{"./node/storage":61,"./upload":64}],64:[function(require,module,exports){
// Generated by Babel
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global window */
// We import the files used inside the Node environment which are rewritten
// for browsers using the rules defined in the package.json
Object.defineProperty(exports, "__esModule", {
value: true
});
var _fingerprint = require("./fingerprint");
var _fingerprint2 = _interopRequireDefault(_fingerprint);
var _extend = require("extend");
var _extend2 = _interopRequireDefault(_extend);
var _request = require("./node/request");
var _source = require("./node/source");
var _base = require("./node/base64");
var Base64 = _interopRequireWildcard(_base);
var _storage = require("./node/storage");
var Storage = _interopRequireWildcard(_storage);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var defaultOptions = {
endpoint: "",
fingerprint: _fingerprint2.default,
resume: true,
onProgress: null,
onChunkComplete: null,
onSuccess: null,
onError: null,
headers: {},
chunkSize: Infinity,
withCredentials: false,
uploadUrl: null,
uploadSize: null,
overridePatchMethod: false
};
var Upload = function () {
function Upload(file, options) {
_classCallCheck(this, Upload);
this.options = (0, _extend2.default)(true, {}, defaultOptions, options);
// The underlying File/Blob object
this.file = file;
// The URL against which the file will be uploaded
this.url = null;
// The underlying XHR object for the current PATCH request
this._xhr = null;
// The fingerpinrt for the current file (set after start())
this._fingerprint = null;
// The offset used in the current PATCH request
this._offset = null;
// True if the current PATCH request has been aborted
this._aborted = false;
// The file's size in bytes
this._size = null;
// The Source object which will wrap around the given file and provides us
// with a unified interface for getting its size and slice chunks from its
// content allowing us to easily handle Files, Blobs, Buffers and Streams.
this._source = null;
}
_createClass(Upload, [{
key: "start",
value: function start() {
var file = this.file;
if (!file) {
this._emitError(new Error("tus: no file or stream to upload provided"));
return;
}
if (!this.options.endpoint) {
this._emitError(new Error("tus: no endpoint provided"));
return;
}
var source = this._source = (0, _source.getSource)(file, this.options.chunkSize);
// Firstly, check if the caller has supplied a manual upload size or else
// we will use the calculated size by the source object.
if (this.options.uploadSize != null) {
var size = +this.options.uploadSize;
if (isNaN(size)) {
throw new Error("tus: cannot convert `uploadSize` option into a number");
}
this._size = size;
} else {
var size = source.size;
// The size property will be null if we cannot calculate the file's size,
// for example if you handle a stream.
if (size == null) {
throw new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option");
}
this._size = size;
}
// A URL has manually been specified, so we try to resume
if (this.options.uploadUrl != null) {
this.url = this.options.uploadUrl;
this._resumeUpload();
return;
}
// Try to find the endpoint for the file in the storage
if (this.options.resume) {
this._fingerprint = this.options.fingerprint(file);
var resumedUrl = Storage.getItem(this._fingerprint);
if (resumedUrl != null) {
this.url = resumedUrl;
this._resumeUpload();
return;
}
}
// An upload has not started for the file yet, so we start a new one
this._createUpload();
}
}, {
key: "abort",
value: function abort() {
if (this._xhr !== null) {
this._xhr.abort();
this._source.close();
this._aborted = true;
}
}
}, {
key: "_emitXhrError",
value: function _emitXhrError(xhr, err) {
err.originalRequest = xhr;
this._emitError(err);
}
}, {
key: "_emitError",
value: function _emitError(err) {
if (typeof this.options.onError === "function") {
this.options.onError(err);
} else {
throw err;
}
}
}, {
key: "_emitSuccess",
value: function _emitSuccess() {
if (typeof this.options.onSuccess === "function") {
this.options.onSuccess();
}
}
/**
* Publishes notification when data has been sent to the server. This
* data may not have been accepted by the server yet.
* @param {number} bytesSent Number of bytes sent to the server.
* @param {number} bytesTotal Total number of bytes to be sent to the server.
*/
}, {
key: "_emitProgress",
value: function _emitProgress(bytesSent, bytesTotal) {
if (typeof this.options.onProgress === "function") {
this.options.onProgress(bytesSent, bytesTotal);
}
}
/**
* Publishes notification when a chunk of data has been sent to the server
* and accepted by the server.
* @param {number} chunkSize Size of the chunk that was accepted by the
* server.
* @param {number} bytesAccepted Total number of bytes that have been
* accepted by the server.
* @param {number} bytesTotal Total number of bytes to be sent to the server.
*/
}, {
key: "_emitChunkComplete",
value: function _emitChunkComplete(chunkSize, bytesAccepted, bytesTotal) {
if (typeof this.options.onChunkComplete === "function") {
this.options.onChunkComplete(chunkSize, bytesAccepted, bytesTotal);
}
}
/**
* Set the headers used in the request and the withCredentials property
* as defined in the options
*
* @param {XMLHttpRequest} xhr
*/
}, {
key: "_setupXHR",
value: function _setupXHR(xhr) {
xhr.setRequestHeader("Tus-Resumable", "1.0.0");
var headers = this.options.headers;
for (var name in headers) {
xhr.setRequestHeader(name, headers[name]);
}
xhr.withCredentials = this.options.withCredentials;
}
/**
* Create a new upload using the creation extension by sending a POST
* request to the endpoint. After successful creation the file will be
* uploaded
*
* @api private
*/
}, {
key: "_createUpload",
value: function _createUpload() {
var _this = this;
var xhr = (0, _request.newRequest)();
xhr.open("POST", this.options.endpoint, true);
xhr.onload = function () {
if (!(xhr.status >= 200 && xhr.status < 300)) {
_this._emitXhrError(xhr, new Error("tus: unexpected response while creating upload"));
return;
}
_this.url = xhr.getResponseHeader("Location");
if (_this.options.resume) {
Storage.setItem(_this._fingerprint, _this.url);
}
_this._offset = 0;
_this._startUpload();
};
xhr.onerror = function () {
_this._emitXhrError(xhr, new Error("tus: failed to create upload"));
};
this._setupXHR(xhr);
xhr.setRequestHeader("Upload-Length", this._size);
// Add metadata if values have been added
var metadata = encodeMetadata(this.options.metadata);
if (metadata !== "") {
xhr.setRequestHeader("Upload-Metadata", metadata);
}
xhr.send(null);
}
/*
* Try to resume an existing upload. First a HEAD request will be sent
* to retrieve the offset. If the request fails a new upload will be
* created. In the case of a successful response the file will be uploaded.
*
* @api private
*/
}, {
key: "_resumeUpload",
value: function _resumeUpload() {
var _this2 = this;
var xhr = (0, _request.newRequest)();
xhr.open("HEAD", this.url, true);
xhr.onload = function () {
if (!(xhr.status >= 200 && xhr.status < 300)) {
if (_this2.options.resume) {
// Remove stored fingerprint and corresponding endpoint,
// since the file can not be found
Storage.removeItem(_this2._fingerprint);
}
// Try to create a new upload
_this2.url = null;
_this2._createUpload();
return;
}
var offset = parseInt(xhr.getResponseHeader("Upload-Offset"), 10);
if (isNaN(offset)) {
_this2._emitXhrError(xhr, new Error("tus: invalid or missing offset value"));
return;
}
var length = parseInt(xhr.getResponseHeader("Upload-Length"), 10);
if (isNaN(length)) {
_this2._emitXhrError(xhr, new Error("tus: invalid or missing length value"));
return;
}
// Upload has already been completed and we do not need to send additional
// data to the server
if (offset === length) {
_this2._emitProgress(length, length);
_this2._emitSuccess();
return;
}
_this2._offset = offset;
_this2._startUpload();
};
xhr.onerror = function () {
_this2._emitXhrError(xhr, new Error("tus: failed to resume upload"));
};
this._setupXHR(xhr);
xhr.send(null);
}
/**
* Start uploading the file using PATCH requests. The file will be divided
* into chunks as specified in the chunkSize option. During the upload
* the onProgress event handler may be invoked multiple times.
*
* @api private
*/
}, {
key: "_startUpload",
value: function _startUpload() {
var _this3 = this;
var xhr = this._xhr = (0, _request.newRequest)();
// Some browser and servers may not support the PATCH method. For those
// cases, you can tell tus-js-client to use a POST request with the
// X-HTTP-Method-Override header for simulating a PATCH request.
if (this.options.overridePatchMethod) {
xhr.open("POST", this.url, true);
xhr.setRequestHeader("X-HTTP-Method-Override", "PATCH");
} else {
xhr.open("PATCH", this.url, true);
}
xhr.onload = function () {
if (!(xhr.status >= 200 && xhr.status < 300)) {
_this3._emitXhrError(xhr, new Error("tus: unexpected response while uploading chunk"));
return;
}
var offset = parseInt(xhr.getResponseHeader("Upload-Offset"), 10);
if (isNaN(offset)) {
_this3._emitXhrError(xhr, new Error("tus: invalid or missing offset value"));
return;
}
_this3._emitProgress(offset, _this3._size);
_this3._emitChunkComplete(offset - _this3._offset, offset, _this3._size);
_this3._offset = offset;
if (offset == _this3._size) {
// Yay, finally done :)
_this3._emitSuccess();
_this3._source.close();
return;
}
_this3._startUpload();
};
xhr.onerror = function () {
// Don't emit an error if the upload was aborted manually
if (_this3._aborted) {
return;
}
_this3._emitXhrError(xhr, new Error("tus: failed to upload chunk at offset " + _this3._offset));
};
// Test support for progress events before attaching an event listener
if ("upload" in xhr) {
xhr.upload.onprogress = function (e) {
if (!e.lengthComputable) {
return;
}
_this3._emitProgress(start + e.loaded, _this3._size);
};
}
this._setupXHR(xhr);
xhr.setRequestHeader("Upload-Offset", this._offset);
xhr.setRequestHeader("Content-Type", "application/offset+octet-stream");
var start = this._offset;
var end = this._offset + this.options.chunkSize;
// The specified chunkSize may be Infinity or the calcluated end position
// may exceed the file's size. In both cases, we limit the end position to
// the input's total size for simpler calculations and correctness.
if (end === Infinity || end > this._size) {
end = this._size;
}
xhr.send(this._source.slice(start, end));
}
}]);
return Upload;
}();
function encodeMetadata(metadata) {
if (!Base64.isSupported) {
return "";
}
var encoded = [];
for (var key in metadata) {
encoded.push(key + " " + Base64.encode(metadata[key]));
}
return encoded.join(",");
}
Upload.defaultOptions = defaultOptions;
exports.default = Upload;
},{"./fingerprint":62,"./node/base64":58,"./node/request":59,"./node/source":60,"./node/storage":61,"extend":65}],65:[function(require,module,exports){
'use strict';
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
return Array.isArray(arr);
}
return toStr.call(arr) === '[object Array]';
};
var isPlainObject = function isPlainObject(obj) {
if (!obj || toStr.call(obj) !== '[object Object]') {
return false;
}
var hasOwnConstructor = hasOwn.call(obj, 'constructor');
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
// Not own constructor property must be Object
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for (key in obj) {/**/}
return typeof key === 'undefined' || hasOwn.call(obj, key);
};
module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0],
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if (typeof target === 'boolean') {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
} else if ((typeof target !== 'object' && typeof target !== 'function') || target == null) {
target = {};
}
for (; i < length; ++i) {
options = arguments[i];
// Only deal with non-null/undefined values
if (options != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target !== copy) {
// Recurse if we're merging plain objects or arrays
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
}
}
// Return the modified object
return target;
};
},{}],66:[function(require,module,exports){
(function(self) {
'use strict';
if (self.fetch) {
return
}
var support = {
searchParams: 'URLSearchParams' in self,
iterable: 'Symbol' in self && 'iterator' in Symbol,
blob: 'FileReader' in self && 'Blob' in self && (function() {
try {
new Blob()
return true
} catch(e) {
return false
}
})(),
formData: 'FormData' in self,
arrayBuffer: 'ArrayBuffer' in self
}
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name)
}
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
throw new TypeError('Invalid character in header field name')
}
return name.toLowerCase()
}
function normalizeValue(value) {
if (typeof value !== 'string') {
value = String(value)
}
return value
}
// Build a destructive iterator for the value list
function iteratorFor(items) {
var iterator = {
next: function() {
var value = items.shift()
return {done: value === undefined, value: value}
}
}
if (support.iterable) {
iterator[Symbol.iterator] = function() {
return iterator
}
}
return iterator
}
function Headers(headers) {
this.map = {}
if (headers instanceof Headers) {
headers.forEach(function(value, name) {
this.append(name, value)
}, this)
} else if (headers) {
Object.getOwnPropertyNames(headers).forEach(function(name) {
this.append(name, headers[name])
}, this)
}
}
Headers.prototype.append = function(name, value) {
name = normalizeName(name)
value = normalizeValue(value)
var list = this.map[name]
if (!list) {
list = []
this.map[name] = list
}
list.push(value)
}
Headers.prototype['delete'] = function(name) {
delete this.map[normalizeName(name)]
}
Headers.prototype.get = function(name) {
var values = this.map[normalizeName(name)]
return values ? values[0] : null
}
Headers.prototype.getAll = function(name) {
return this.map[normalizeName(name)] || []
}
Headers.prototype.has = function(name) {
return this.map.hasOwnProperty(normalizeName(name))
}
Headers.prototype.set = function(name, value) {
this.map[normalizeName(name)] = [normalizeValue(value)]
}
Headers.prototype.forEach = function(callback, thisArg) {
Object.getOwnPropertyNames(this.map).forEach(function(name) {
this.map[name].forEach(function(value) {
callback.call(thisArg, value, name, this)
}, this)
}, this)
}
Headers.prototype.keys = function() {
var items = []
this.forEach(function(value, name) { items.push(name) })
return iteratorFor(items)
}
Headers.prototype.values = function() {
var items = []
this.forEach(function(value) { items.push(value) })
return iteratorFor(items)
}
Headers.prototype.entries = function() {
var items = []
this.forEach(function(value, name) { items.push([name, value]) })
return iteratorFor(items)
}
if (support.iterable) {
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
}
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError('Already read'))
}
body.bodyUsed = true
}
function fileReaderReady(reader) {
return new Promise(function(resolve, reject) {
reader.onload = function() {
resolve(reader.result)
}
reader.onerror = function() {
reject(reader.error)
}
})
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader()
reader.readAsArrayBuffer(blob)
return fileReaderReady(reader)
}
function readBlobAsText(blob) {
var reader = new FileReader()
reader.readAsText(blob)
return fileReaderReady(reader)
}
function Body() {
this.bodyUsed = false
this._initBody = function(body) {
this._bodyInit = body
if (typeof body === 'string') {
this._bodyText = body
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this._bodyText = body.toString()
} else if (!body) {
this._bodyText = ''
} else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
// Only support ArrayBuffers for POST method.
// Receiving ArrayBuffers happens via Blobs, instead.
} else {
throw new Error('unsupported BodyInit type')
}
if (!this.headers.get('content-type')) {
if (typeof body === 'string') {
this.headers.set('content-type', 'text/plain;charset=UTF-8')
} else if (this._bodyBlob && this._bodyBlob.type) {
this.headers.set('content-type', this._bodyBlob.type)
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
}
}
}
if (support.blob) {
this.blob = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob)
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob')
} else {
return Promise.resolve(new Blob([this._bodyText]))
}
}
this.arrayBuffer = function() {
return this.blob().then(readBlobAsArrayBuffer)
}
this.text = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
} else {
return Promise.resolve(this._bodyText)
}
}
} else {
this.text = function() {
var rejected = consumed(this)
return rejected ? rejected : Promise.resolve(this._bodyText)
}
}
if (support.formData) {
this.formData = function() {
return this.text().then(decode)
}
}
this.json = function() {
return this.text().then(JSON.parse)
}
return this
}
// HTTP methods whose capitalization should be normalized
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
function normalizeMethod(method) {
var upcased = method.toUpperCase()
return (methods.indexOf(upcased) > -1) ? upcased : method
}
function Request(input, options) {
options = options || {}
var body = options.body
if (Request.prototype.isPrototypeOf(input)) {
if (input.bodyUsed) {
throw new TypeError('Already read')
}
this.url = input.url
this.credentials = input.credentials
if (!options.headers) {
this.headers = new Headers(input.headers)
}
this.method = input.method
this.mode = input.mode
if (!body) {
body = input._bodyInit
input.bodyUsed = true
}
} else {
this.url = input
}
this.credentials = options.credentials || this.credentials || 'omit'
if (options.headers || !this.headers) {
this.headers = new Headers(options.headers)
}
this.method = normalizeMethod(options.method || this.method || 'GET')
this.mode = options.mode || this.mode || null
this.referrer = null
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
throw new TypeError('Body not allowed for GET or HEAD requests')
}
this._initBody(body)
}
Request.prototype.clone = function() {
return new Request(this)
}
function decode(body) {
var form = new FormData()
body.trim().split('&').forEach(function(bytes) {
if (bytes) {
var split = bytes.split('=')
var name = split.shift().replace(/\+/g, ' ')
var value = split.join('=').replace(/\+/g, ' ')
form.append(decodeURIComponent(name), decodeURIComponent(value))
}
})
return form
}
function headers(xhr) {
var head = new Headers()
var pairs = (xhr.getAllResponseHeaders() || '').trim().split('\n')
pairs.forEach(function(header) {
var split = header.trim().split(':')
var key = split.shift().trim()
var value = split.join(':').trim()
head.append(key, value)
})
return head
}
Body.call(Request.prototype)
function Response(bodyInit, options) {
if (!options) {
options = {}
}
this.type = 'default'
this.status = options.status
this.ok = this.status >= 200 && this.status < 300
this.statusText = options.statusText
this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
this.url = options.url || ''
this._initBody(bodyInit)
}
Body.call(Response.prototype)
Response.prototype.clone = function() {
return new Response(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers(this.headers),
url: this.url
})
}
Response.error = function() {
var response = new Response(null, {status: 0, statusText: ''})
response.type = 'error'
return response
}
var redirectStatuses = [301, 302, 303, 307, 308]
Response.redirect = function(url, status) {
if (redirectStatuses.indexOf(status) === -1) {
throw new RangeError('Invalid status code')
}
return new Response(null, {status: status, headers: {location: url}})
}
self.Headers = Headers
self.Request = Request
self.Response = Response
self.fetch = function(input, init) {
return new Promise(function(resolve, reject) {
var request
if (Request.prototype.isPrototypeOf(input) && !init) {
request = input
} else {
request = new Request(input, init)
}
var xhr = new XMLHttpRequest()
function responseURL() {
if ('responseURL' in xhr) {
return xhr.responseURL
}
// Avoid security warnings on getResponseHeader when not allowed by CORS
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL')
}
return
}
xhr.onload = function() {
var options = {
status: xhr.status,
statusText: xhr.statusText,
headers: headers(xhr),
url: responseURL()
}
var body = 'response' in xhr ? xhr.response : xhr.responseText
resolve(new Response(body, options))
}
xhr.onerror = function() {
reject(new TypeError('Network request failed'))
}
xhr.ontimeout = function() {
reject(new TypeError('Network request failed'))
}
xhr.open(request.method, request.url, true)
if (request.credentials === 'include') {
xhr.withCredentials = true
}
if ('responseType' in xhr && support.blob) {
xhr.responseType = 'blob'
}
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
})
}
self.fetch.polyfill = true
})(typeof self !== 'undefined' ? self : this);
},{}],67:[function(require,module,exports){
var bel = require('bel') // turns template tag into DOM elements
var morphdom = require('morphdom') // efficiently diffs + morphs two DOM elements
var defaultEvents = require('./update-events.js') // default events to be copied when dom elements update
module.exports = bel
// TODO move this + defaultEvents to a new module once we receive more feedback
module.exports.update = function (fromNode, toNode, opts) {
if (!opts) opts = {}
if (opts.events !== false) {
if (!opts.onBeforeMorphEl) opts.onBeforeMorphEl = copier
}
return morphdom(fromNode, toNode, opts)
// morphdom only copies attributes. we decided we also wanted to copy events
// that can be set via attributes
function copier (f, t) {
// copy events:
var events = opts.events || defaultEvents
for (var i = 0; i < events.length; i++) {
var ev = events[i]
if (t[ev]) { // if new element has a whitelisted attribute
f[ev] = t[ev] // update existing element
} else if (f[ev]) { // if existing element has it and new one doesnt
f[ev] = undefined // remove it from existing element
}
}
// copy values for form elements
if ((f.nodeName === 'INPUT' && f.type !== 'file') || f.nodeName === 'TEXTAREA' || f.nodeName === 'SELECT') {
if (t.getAttribute('value') === null) t.value = f.value
}
}
}
},{"./update-events.js":75,"bel":68,"morphdom":74}],68:[function(require,module,exports){
var document = require('global/document')
var hyperx = require('hyperx')
var onload = require('on-load')
var SVGNS = 'http://www.w3.org/2000/svg'
var BOOL_PROPS = {
autofocus: 1,
checked: 1,
defaultchecked: 1,
disabled: 1,
formnovalidate: 1,
indeterminate: 1,
readonly: 1,
required: 1,
selected: 1,
willvalidate: 1
}
var SVG_TAGS = [
'svg',
'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor',
'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile',
'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix',
'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB',
'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode',
'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting',
'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'font', 'font-face',
'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri',
'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line',
'linearGradient', 'marker', 'mask', 'metadata', 'missing-glyph', 'mpath',
'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect',
'set', 'stop', 'switch', 'symbol', 'text', 'textPath', 'title', 'tref',
'tspan', 'use', 'view', 'vkern'
]
function belCreateElement (tag, props, children) {
var el
// If an svg tag, it needs a namespace
if (SVG_TAGS.indexOf(tag) !== -1) {
props.namespace = SVGNS
}
// If we are using a namespace
var ns = false
if (props.namespace) {
ns = props.namespace
delete props.namespace
}
// Create the element
if (ns) {
el = document.createElementNS(ns, tag)
} else {
el = document.createElement(tag)
}
// If adding onload events
if (props.onload || props.onunload) {
var load = props.onload || function () {}
var unload = props.onunload || function () {}
onload(el, function bel_onload () {
load(el)
}, function bel_onunload () {
unload(el)
},
// We have to use non-standard `caller` to find who invokes `belCreateElement`
belCreateElement.caller.caller.caller)
delete props.onload
delete props.onunload
}
// Create the properties
for (var p in props) {
if (props.hasOwnProperty(p)) {
var key = p.toLowerCase()
var val = props[p]
// Normalize className
if (key === 'classname') {
key = 'class'
p = 'class'
}
// The for attribute gets transformed to htmlFor, but we just set as for
if (p === 'htmlFor') {
p = 'for'
}
// If a property is boolean, set itself to the key
if (BOOL_PROPS[key]) {
if (val === 'true') val = key
else if (val === 'false') continue
}
// If a property prefers being set directly vs setAttribute
if (key.slice(0, 2) === 'on') {
el[p] = val
} else {
if (ns) {
el.setAttributeNS(null, p, val)
} else {
el.setAttribute(p, val)
}
}
}
}
function appendChild (childs) {
if (!Array.isArray(childs)) return
for (var i = 0; i < childs.length; i++) {
var node = childs[i]
if (Array.isArray(node)) {
appendChild(node)
continue
}
if (typeof node === 'number' ||
typeof node === 'boolean' ||
node instanceof Date ||
node instanceof RegExp) {
node = node.toString()
}
if (typeof node === 'string') {
if (el.lastChild && el.lastChild.nodeName === '#text') {
el.lastChild.nodeValue += node
continue
}
node = document.createTextNode(node)
}
if (node && node.nodeType) {
el.appendChild(node)
}
}
}
appendChild(children)
return el
}
module.exports = hyperx(belCreateElement)
module.exports.createElement = belCreateElement
},{"global/document":69,"hyperx":71,"on-load":73}],69:[function(require,module,exports){
(function (global){
var topLevel = typeof global !== 'undefined' ? global :
typeof window !== 'undefined' ? window : {}
var minDoc = require('min-document');
if (typeof document !== 'undefined') {
module.exports = document;
} else {
var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
}
module.exports = doccy;
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy95by15by9ub2RlX21vZHVsZXMvYmVsL25vZGVfbW9kdWxlcy9nbG9iYWwvZG9jdW1lbnQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgdG9wTGV2ZWwgPSB0eXBlb2YgZ2xvYmFsICE9PSAndW5kZWZpbmVkJyA/IGdsb2JhbCA6XG4gICAgdHlwZW9mIHdpbmRvdyAhPT0gJ3VuZGVmaW5lZCcgPyB3aW5kb3cgOiB7fVxudmFyIG1pbkRvYyA9IHJlcXVpcmUoJ21pbi1kb2N1bWVudCcpO1xuXG5pZiAodHlwZW9mIGRvY3VtZW50ICE9PSAndW5kZWZpbmVkJykge1xuICAgIG1vZHVsZS5leHBvcnRzID0gZG9jdW1lbnQ7XG59IGVsc2Uge1xuICAgIHZhciBkb2NjeSA9IHRvcExldmVsWydfX0dMT0JBTF9ET0NVTUVOVF9DQUNIRUA0J107XG5cbiAgICBpZiAoIWRvY2N5KSB7XG4gICAgICAgIGRvY2N5ID0gdG9wTGV2ZWxbJ19fR0xPQkFMX0RPQ1VNRU5UX0NBQ0hFQDQnXSA9IG1pbkRvYztcbiAgICB9XG5cbiAgICBtb2R1bGUuZXhwb3J0cyA9IGRvY2N5O1xufVxuIl19
},{"min-document":1}],70:[function(require,module,exports){
(function (global){
if (typeof window !== "undefined") {
module.exports = window;
} else if (typeof global !== "undefined") {
module.exports = global;
} else if (typeof self !== "undefined"){
module.exports = self;
} else {
module.exports = {};
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy95by15by9ub2RlX21vZHVsZXMvYmVsL25vZGVfbW9kdWxlcy9nbG9iYWwvd2luZG93LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiaWYgKHR5cGVvZiB3aW5kb3cgIT09IFwidW5kZWZpbmVkXCIpIHtcbiAgICBtb2R1bGUuZXhwb3J0cyA9IHdpbmRvdztcbn0gZWxzZSBpZiAodHlwZW9mIGdsb2JhbCAhPT0gXCJ1bmRlZmluZWRcIikge1xuICAgIG1vZHVsZS5leHBvcnRzID0gZ2xvYmFsO1xufSBlbHNlIGlmICh0eXBlb2Ygc2VsZiAhPT0gXCJ1bmRlZmluZWRcIil7XG4gICAgbW9kdWxlLmV4cG9ydHMgPSBzZWxmO1xufSBlbHNlIHtcbiAgICBtb2R1bGUuZXhwb3J0cyA9IHt9O1xufVxuIl19
},{}],71:[function(require,module,exports){
var attrToProp = require('hyperscript-attribute-to-property')
var VAR = 0, TEXT = 1, OPEN = 2, CLOSE = 3, ATTR = 4
var ATTR_KEY = 5, ATTR_KEY_W = 6
var ATTR_VALUE_W = 7, ATTR_VALUE = 8
var ATTR_VALUE_SQ = 9, ATTR_VALUE_DQ = 10
var ATTR_EQ = 11, ATTR_BREAK = 12
module.exports = function (h, opts) {
h = attrToProp(h)
if (!opts) opts = {}
var concat = opts.concat || function (a, b) {
return String(a) + String(b)
}
return function (strings) {
var state = TEXT, reg = ''
var arglen = arguments.length
var parts = []
for (var i = 0; i < strings.length; i++) {
if (i < arglen - 1) {
var arg = arguments[i+1]
var p = parse(strings[i])
var xstate = state
if (xstate === ATTR_VALUE_DQ) xstate = ATTR_VALUE
if (xstate === ATTR_VALUE_SQ) xstate = ATTR_VALUE
if (xstate === ATTR_VALUE_W) xstate = ATTR_VALUE
if (xstate === ATTR) xstate = ATTR_KEY
p.push([ VAR, xstate, arg ])
parts.push.apply(parts, p)
} else parts.push.apply(parts, parse(strings[i]))
}
var tree = [null,{},[]]
var stack = [[tree,-1]]
for (var i = 0; i < parts.length; i++) {
var cur = stack[stack.length-1][0]
var p = parts[i], s = p[0]
if (s === OPEN && /^\//.test(p[1])) {
var ix = stack[stack.length-1][1]
if (stack.length > 1) {
stack.pop()
stack[stack.length-1][0][2][ix] = h(
cur[0], cur[1], cur[2].length ? cur[2] : undefined
)
}
} else if (s === OPEN) {
var c = [p[1],{},[]]
cur[2].push(c)
stack.push([c,cur[2].length-1])
} else if (s === ATTR_KEY || (s === VAR && p[1] === ATTR_KEY)) {
var key = ''
var copyKey
for (; i < parts.length; i++) {
if (parts[i][0] === ATTR_KEY) {
key = concat(key, parts[i][1])
} else if (parts[i][0] === VAR && parts[i][1] === ATTR_KEY) {
if (typeof parts[i][2] === 'object' && !key) {
for (copyKey in parts[i][2]) {
if (parts[i][2].hasOwnProperty(copyKey) && !cur[1][copyKey]) {
cur[1][copyKey] = parts[i][2][copyKey]
}
}
} else {
key = concat(key, parts[i][2])
}
} else break
}
if (parts[i][0] === ATTR_EQ) i++
var j = i
for (; i < parts.length; i++) {
if (parts[i][0] === ATTR_VALUE || parts[i][0] === ATTR_KEY) {
if (!cur[1][key]) cur[1][key] = strfn(parts[i][1])
else cur[1][key] = concat(cur[1][key], parts[i][1])
} else if (parts[i][0] === VAR
&& (parts[i][1] === ATTR_VALUE || parts[i][1] === ATTR_KEY)) {
if (!cur[1][key]) cur[1][key] = strfn(parts[i][2])
else cur[1][key] = concat(cur[1][key], parts[i][2])
} else {
if (key.length && !cur[1][key] && i === j
&& (parts[i][0] === CLOSE || parts[i][0] === ATTR_BREAK)) {
// https://html.spec.whatwg.org/multipage/infrastructure.html#boolean-attributes
// empty string is falsy, not well behaved value in browser
cur[1][key] = key.toLowerCase()
}
break
}
}
} else if (s === ATTR_KEY) {
cur[1][p[1]] = true
} else if (s === VAR && p[1] === ATTR_KEY) {
cur[1][p[2]] = true
} else if (s === CLOSE) {
if (selfClosing(cur[0]) && stack.length) {
var ix = stack[stack.length-1][1]
stack.pop()
stack[stack.length-1][0][2][ix] = h(
cur[0], cur[1], cur[2].length ? cur[2] : undefined
)
}
} else if (s === VAR && p[1] === TEXT) {
if (p[2] === undefined || p[2] === null) p[2] = ''
else if (!p[2]) p[2] = concat('', p[2])
if (Array.isArray(p[2][0])) {
cur[2].push.apply(cur[2], p[2])
} else {
cur[2].push(p[2])
}
} else if (s === TEXT) {
cur[2].push(p[1])
} else if (s === ATTR_EQ || s === ATTR_BREAK) {
// no-op
} else {
throw new Error('unhandled: ' + s)
}
}
if (tree[2].length > 1 && /^\s*$/.test(tree[2][0])) {
tree[2].shift()
}
if (tree[2].length > 2
|| (tree[2].length === 2 && /\S/.test(tree[2][1]))) {
throw new Error(
'multiple root elements must be wrapped in an enclosing tag'
)
}
if (Array.isArray(tree[2][0]) && typeof tree[2][0][0] === 'string'
&& Array.isArray(tree[2][0][2])) {
tree[2][0] = h(tree[2][0][0], tree[2][0][1], tree[2][0][2])
}
return tree[2][0]
function parse (str) {
var res = []
if (state === ATTR_VALUE_W) state = ATTR
for (var i = 0; i < str.length; i++) {
var c = str.charAt(i)
if (state === TEXT && c === '<') {
if (reg.length) res.push([TEXT, reg])
reg = ''
state = OPEN
} else if (c === '>' && !quot(state)) {
if (state === OPEN) {
res.push([OPEN,reg])
} else if (state === ATTR_KEY) {
res.push([ATTR_KEY,reg])
} else if (state === ATTR_VALUE && reg.length) {
res.push([ATTR_VALUE,reg])
}
res.push([CLOSE])
reg = ''
state = TEXT
} else if (state === TEXT) {
reg += c
} else if (state === OPEN && /\s/.test(c)) {
res.push([OPEN, reg])
reg = ''
state = ATTR
} else if (state === OPEN) {
reg += c
} else if (state === ATTR && /[\w-]/.test(c)) {
state = ATTR_KEY
reg = c
} else if (state === ATTR && /\s/.test(c)) {
if (reg.length) res.push([ATTR_KEY,reg])
res.push([ATTR_BREAK])
} else if (state === ATTR_KEY && /\s/.test(c)) {
res.push([ATTR_KEY,reg])
reg = ''
state = ATTR_KEY_W
} else if (state === ATTR_KEY && c === '=') {
res.push([ATTR_KEY,reg],[ATTR_EQ])
reg = ''
state = ATTR_VALUE_W
} else if (state === ATTR_KEY) {
reg += c
} else if ((state === ATTR_KEY_W || state === ATTR) && c === '=') {
res.push([ATTR_EQ])
state = ATTR_VALUE_W
} else if ((state === ATTR_KEY_W || state === ATTR) && !/\s/.test(c)) {
res.push([ATTR_BREAK])
if (/[\w-]/.test(c)) {
reg += c
state = ATTR_KEY
} else state = ATTR
} else if (state === ATTR_VALUE_W && c === '"') {
state = ATTR_VALUE_DQ
} else if (state === ATTR_VALUE_W && c === "'") {
state = ATTR_VALUE_SQ
} else if (state === ATTR_VALUE_DQ && c === '"') {
res.push([ATTR_VALUE,reg],[ATTR_BREAK])
reg = ''
state = ATTR
} else if (state === ATTR_VALUE_SQ && c === "'") {
res.push([ATTR_VALUE,reg],[ATTR_BREAK])
reg = ''
state = ATTR
} else if (state === ATTR_VALUE_W && !/\s/.test(c)) {
state = ATTR_VALUE
i--
} else if (state === ATTR_VALUE && /\s/.test(c)) {
res.push([ATTR_VALUE,reg],[ATTR_BREAK])
reg = ''
state = ATTR
} else if (state === ATTR_VALUE || state === ATTR_VALUE_SQ
|| state === ATTR_VALUE_DQ) {
reg += c
}
}
if (state === TEXT && reg.length) {
res.push([TEXT,reg])
reg = ''
} else if (state === ATTR_VALUE && reg.length) {
res.push([ATTR_VALUE,reg])
reg = ''
} else if (state === ATTR_VALUE_DQ && reg.length) {
res.push([ATTR_VALUE,reg])
reg = ''
} else if (state === ATTR_VALUE_SQ && reg.length) {
res.push([ATTR_VALUE,reg])
reg = ''
} else if (state === ATTR_KEY) {
res.push([ATTR_KEY,reg])
reg = ''
}
return res
}
}
function strfn (x) {
if (typeof x === 'function') return x
else if (typeof x === 'string') return x
else if (x && typeof x === 'object') return x
else return concat('', x)
}
}
function quot (state) {
return state === ATTR_VALUE_SQ || state === ATTR_VALUE_DQ
}
var hasOwn = Object.prototype.hasOwnProperty
function has (obj, key) { return hasOwn.call(obj, key) }
var closeRE = RegExp('^(' + [
'area', 'base', 'basefont', 'bgsound', 'br', 'col', 'command', 'embed',
'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param',
'source', 'track', 'wbr',
// SVG TAGS
'animate', 'animateTransform', 'circle', 'cursor', 'desc', 'ellipse',
'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite',
'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',
'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR',
'feGaussianBlur', 'feImage', 'feMergeNode', 'feMorphology',
'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile',
'feTurbulence', 'font-face-format', 'font-face-name', 'font-face-uri',
'glyph', 'glyphRef', 'hkern', 'image', 'line', 'missing-glyph', 'mpath',
'path', 'polygon', 'polyline', 'rect', 'set', 'stop', 'tref', 'use', 'view',
'vkern'
].join('|') + ')(?:[\.#][a-zA-Z0-9\u007F-\uFFFF_:-]+)*$')
function selfClosing (tag) { return closeRE.test(tag) }
},{"hyperscript-attribute-to-property":72}],72:[function(require,module,exports){
module.exports = attributeToProperty
var transform = {
'class': 'className',
'for': 'htmlFor',
'http-equiv': 'httpEquiv'
}
function attributeToProperty (h) {
return function (tagName, attrs, children) {
for (var attr in attrs) {
if (attr in transform) {
attrs[transform[attr]] = attrs[attr]
delete attrs[attr]
}
}
return h(tagName, attrs, children)
}
}
},{}],73:[function(require,module,exports){
/* global MutationObserver */
var document = require('global/document')
var window = require('global/window')
var watch = Object.create(null)
var KEY_ID = 'onloadid' + (new Date() % 9e6).toString(36)
var KEY_ATTR = 'data-' + KEY_ID
var INDEX = 0
if (window && window.MutationObserver) {
var observer = new MutationObserver(function (mutations) {
if (Object.keys(watch).length < 1) return
for (var i = 0; i < mutations.length; i++) {
if (mutations[i].attributeName === KEY_ATTR) {
eachAttr(mutations[i], turnon, turnoff)
continue
}
eachMutation(mutations[i].removedNodes, turnoff)
eachMutation(mutations[i].addedNodes, turnon)
}
})
observer.observe(document.body, {
childList: true,
subtree: true,
attributes: true,
attributeOldValue: true,
attributeFilter: [KEY_ATTR]
})
}
module.exports = function onload (el, on, off, caller) {
on = on || function () {}
off = off || function () {}
el.setAttribute(KEY_ATTR, 'o' + INDEX)
watch['o' + INDEX] = [on, off, 0, caller || onload.caller]
INDEX += 1
return el
}
function turnon (index, el) {
if (watch[index][0] && watch[index][2] === 0) {
watch[index][0](el)
watch[index][2] = 1
}
}
function turnoff (index, el) {
if (watch[index][1] && watch[index][2] === 1) {
watch[index][1](el)
watch[index][2] = 0
}
}
function eachAttr (mutation, on, off) {
var newValue = mutation.target.getAttribute(KEY_ATTR)
if (sameOrigin(mutation.oldValue, newValue)) {
watch[newValue] = watch[mutation.oldValue]
return
}
if (watch[mutation.oldValue]) {
off(mutation.oldValue, mutation.target)
}
if (watch[newValue]) {
on(newValue, mutation.target)
}
}
function sameOrigin (oldValue, newValue) {
if (!oldValue || !newValue) return false
return watch[oldValue][3] === watch[newValue][3]
}
function eachMutation (nodes, fn) {
var keys = Object.keys(watch)
for (var i = 0; i < nodes.length; i++) {
if (nodes[i] && nodes[i].getAttribute && nodes[i].getAttribute(KEY_ATTR)) {
var onloadid = nodes[i].getAttribute(KEY_ATTR)
keys.forEach(function (k) {
if (onloadid === k) {
fn(k, nodes[i])
}
})
}
if (nodes[i].childNodes.length > 0) {
eachMutation(nodes[i].childNodes, fn)
}
}
}
},{"global/document":69,"global/window":70}],74:[function(require,module,exports){
// Create a range object for efficently rendering strings to elements.
var range;
var testEl = (typeof document !== 'undefined') ?
document.body || document.createElement('div') :
{};
var XHTML = 'http://www.w3.org/1999/xhtml';
var ELEMENT_NODE = 1;
var TEXT_NODE = 3;
var COMMENT_NODE = 8;
// Fixes <https://github.com/patrick-steele-idem/morphdom/issues/32>
// (IE7+ support) <=IE7 does not support el.hasAttribute(name)
var hasAttributeNS;
if (testEl.hasAttributeNS) {
hasAttributeNS = function(el, namespaceURI, name) {
return el.hasAttributeNS(namespaceURI, name);
};
} else if (testEl.hasAttribute) {
hasAttributeNS = function(el, namespaceURI, name) {
return el.hasAttribute(name);
};
} else {
hasAttributeNS = function(el, namespaceURI, name) {
return !!el.getAttributeNode(name);
};
}
function empty(o) {
for (var k in o) {
if (o.hasOwnProperty(k)) {
return false;
}
}
return true;
}
function toElement(str) {
if (!range && document.createRange) {
range = document.createRange();
range.selectNode(document.body);
}
var fragment;
if (range && range.createContextualFragment) {
fragment = range.createContextualFragment(str);
} else {
fragment = document.createElement('body');
fragment.innerHTML = str;
}
return fragment.childNodes[0];
}
var specialElHandlers = {
/**
* Needed for IE. Apparently IE doesn't think that "selected" is an
* attribute when reading over the attributes using selectEl.attributes
*/
OPTION: function(fromEl, toEl) {
fromEl.selected = toEl.selected;
if (fromEl.selected) {
fromEl.setAttribute('selected', '');
} else {
fromEl.removeAttribute('selected', '');
}
},
/**
* The "value" attribute is special for the <input> element since it sets
* the initial value. Changing the "value" attribute without changing the
* "value" property will have no effect since it is only used to the set the
* initial value. Similar for the "checked" attribute, and "disabled".
*/
INPUT: function(fromEl, toEl) {
fromEl.checked = toEl.checked;
if (fromEl.checked) {
fromEl.setAttribute('checked', '');
} else {
fromEl.removeAttribute('checked');
}
if (fromEl.value !== toEl.value) {
fromEl.value = toEl.value;
}
if (!hasAttributeNS(toEl, null, 'value')) {
fromEl.removeAttribute('value');
}
fromEl.disabled = toEl.disabled;
if (fromEl.disabled) {
fromEl.setAttribute('disabled', '');
} else {
fromEl.removeAttribute('disabled');
}
},
TEXTAREA: function(fromEl, toEl) {
var newValue = toEl.value;
if (fromEl.value !== newValue) {
fromEl.value = newValue;
}
if (fromEl.firstChild) {
fromEl.firstChild.nodeValue = newValue;
}
}
};
function noop() {}
/**
* Returns true if two node's names and namespace URIs are the same.
*
* @param {Element} a
* @param {Element} b
* @return {boolean}
*/
var compareNodeNames = function(a, b) {
return a.nodeName === b.nodeName &&
a.namespaceURI === b.namespaceURI;
};
/**
* Create an element, optionally with a known namespace URI.
*
* @param {string} name the element name, e.g. 'div' or 'svg'
* @param {string} [namespaceURI] the element's namespace URI, i.e. the value of
* its `xmlns` attribute or its inferred namespace.
*
* @return {Element}
*/
function createElementNS(name, namespaceURI) {
return !namespaceURI || namespaceURI === XHTML ?
document.createElement(name) :
document.createElementNS(namespaceURI, name);
}
/**
* Loop over all of the attributes on the target node and make sure the original
* DOM node has the same attributes. If an attribute found on the original node
* is not on the new node then remove it from the original node.
*
* @param {Element} fromNode
* @param {Element} toNode
*/
function morphAttrs(fromNode, toNode) {
var attrs = toNode.attributes;
var i;
var attr;
var attrName;
var attrNamespaceURI;
var attrValue;
var fromValue;
for (i = attrs.length - 1; i >= 0; i--) {
attr = attrs[i];
attrName = attr.name;
attrValue = attr.value;
attrNamespaceURI = attr.namespaceURI;
if (attrNamespaceURI) {
attrName = attr.localName || attrName;
fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);
} else {
fromValue = fromNode.getAttribute(attrName);
}
if (fromValue !== attrValue) {
if (attrNamespaceURI) {
fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);
} else {
fromNode.setAttribute(attrName, attrValue);
}
}
}
// Remove any extra attributes found on the original DOM element that
// weren't found on the target element.
attrs = fromNode.attributes;
for (i = attrs.length - 1; i >= 0; i--) {
attr = attrs[i];
if (attr.specified !== false) {
attrName = attr.name;
attrNamespaceURI = attr.namespaceURI;
if (!hasAttributeNS(toNode, attrNamespaceURI, attrNamespaceURI ? attrName = attr.localName || attrName : attrName)) {
if (attrNamespaceURI) {
fromNode.removeAttributeNS(attrNamespaceURI, attr.localName);
} else {
fromNode.removeAttribute(attrName);
}
}
}
}
}
/**
* Copies the children of one DOM element to another DOM element
*/
function moveChildren(fromEl, toEl) {
var curChild = fromEl.firstChild;
while (curChild) {
var nextChild = curChild.nextSibling;
toEl.appendChild(curChild);
curChild = nextChild;
}
return toEl;
}
function defaultGetNodeKey(node) {
return node.id;
}
function morphdom(fromNode, toNode, options) {
if (!options) {
options = {};
}
if (typeof toNode === 'string') {
if (fromNode.nodeName === '#document' || fromNode.nodeName === 'HTML') {
var toNodeHtml = toNode;
toNode = document.createElement('html');
toNode.innerHTML = toNodeHtml;
} else {
toNode = toElement(toNode);
}
}
// XXX optimization: if the nodes are equal, don't morph them
/*
if (fromNode.isEqualNode(toNode)) {
return fromNode;
}
*/
var savedEls = {}; // Used to save off DOM elements with IDs
var unmatchedEls = {};
var getNodeKey = options.getNodeKey || defaultGetNodeKey;
var onBeforeNodeAdded = options.onBeforeNodeAdded || noop;
var onNodeAdded = options.onNodeAdded || noop;
var onBeforeElUpdated = options.onBeforeElUpdated || options.onBeforeMorphEl || noop;
var onElUpdated = options.onElUpdated || noop;
var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop;
var onNodeDiscarded = options.onNodeDiscarded || noop;
var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || options.onBeforeMorphElChildren || noop;
var childrenOnly = options.childrenOnly === true;
var movedEls = [];
function removeNodeHelper(node, nestedInSavedEl) {
var id = getNodeKey(node);
// If the node has an ID then save it off since we will want
// to reuse it in case the target DOM tree has a DOM element
// with the same ID
if (id) {
savedEls[id] = node;
} else if (!nestedInSavedEl) {
// If we are not nested in a saved element then we know that this node has been
// completely discarded and will not exist in the final DOM.
onNodeDiscarded(node);
}
if (node.nodeType === ELEMENT_NODE) {
var curChild = node.firstChild;
while (curChild) {
removeNodeHelper(curChild, nestedInSavedEl || id);
curChild = curChild.nextSibling;
}
}
}
function walkDiscardedChildNodes(node) {
if (node.nodeType === ELEMENT_NODE) {
var curChild = node.firstChild;
while (curChild) {
if (!getNodeKey(curChild)) {
// We only want to handle nodes that don't have an ID to avoid double
// walking the same saved element.
onNodeDiscarded(curChild);
// Walk recursively
walkDiscardedChildNodes(curChild);
}
curChild = curChild.nextSibling;
}
}
}
function removeNode(node, parentNode, alreadyVisited) {
if (onBeforeNodeDiscarded(node) === false) {
return;
}
parentNode.removeChild(node);
if (alreadyVisited) {
if (!getNodeKey(node)) {
onNodeDiscarded(node);
walkDiscardedChildNodes(node);
}
} else {
removeNodeHelper(node);
}
}
function morphEl(fromEl, toEl, alreadyVisited, childrenOnly) {
var toElKey = getNodeKey(toEl);
if (toElKey) {
// If an element with an ID is being morphed then it is will be in the final
// DOM so clear it out of the saved elements collection
delete savedEls[toElKey];
}
if (!childrenOnly) {
if (onBeforeElUpdated(fromEl, toEl) === false) {
return;
}
morphAttrs(fromEl, toEl);
onElUpdated(fromEl);
if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {
return;
}
}
if (fromEl.nodeName !== 'TEXTAREA') {
var curToNodeChild = toEl.firstChild;
var curFromNodeChild = fromEl.firstChild;
var curToNodeId;
var fromNextSibling;
var toNextSibling;
var savedEl;
var unmatchedEl;
outer: while (curToNodeChild) {
toNextSibling = curToNodeChild.nextSibling;
curToNodeId = getNodeKey(curToNodeChild);
while (curFromNodeChild) {
var curFromNodeId = getNodeKey(curFromNodeChild);
fromNextSibling = curFromNodeChild.nextSibling;
if (!alreadyVisited) {
if (curFromNodeId && (unmatchedEl = unmatchedEls[curFromNodeId])) {
unmatchedEl.parentNode.replaceChild(curFromNodeChild, unmatchedEl);
morphEl(curFromNodeChild, unmatchedEl, alreadyVisited);
curFromNodeChild = fromNextSibling;
continue;
}
}
var curFromNodeType = curFromNodeChild.nodeType;
if (curFromNodeType === curToNodeChild.nodeType) {
var isCompatible = false;
// Both nodes being compared are Element nodes
if (curFromNodeType === ELEMENT_NODE) {
if (compareNodeNames(curFromNodeChild, curToNodeChild)) {
// We have compatible DOM elements
if (curFromNodeId || curToNodeId) {
// If either DOM element has an ID then we
// handle those differently since we want to
// match up by ID
if (curToNodeId === curFromNodeId) {
isCompatible = true;
}
} else {
isCompatible = true;
}
}
if (isCompatible) {
// We found compatible DOM elements so transform
// the current "from" node to match the current
// target DOM node.
morphEl(curFromNodeChild, curToNodeChild, alreadyVisited);
}
// Both nodes being compared are Text or Comment nodes
} else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) {
isCompatible = true;
// Simply update nodeValue on the original node to
// change the text value
curFromNodeChild.nodeValue = curToNodeChild.nodeValue;
}
if (isCompatible) {
curToNodeChild = toNextSibling;
curFromNodeChild = fromNextSibling;
continue outer;
}
}
// No compatible match so remove the old node from the DOM
// and continue trying to find a match in the original DOM
removeNode(curFromNodeChild, fromEl, alreadyVisited);
curFromNodeChild = fromNextSibling;
}
if (curToNodeId) {
if ((savedEl = savedEls[curToNodeId])) {
if (compareNodeNames(savedEl, curToNodeChild)) {
morphEl(savedEl, curToNodeChild, true);
// We want to append the saved element instead
curToNodeChild = savedEl;
} else {
delete savedEls[curToNodeId];
onNodeDiscarded(savedEl);
}
} else {
// The current DOM element in the target tree has an ID
// but we did not find a match in any of the
// corresponding siblings. We just put the target
// element in the old DOM tree but if we later find an
// element in the old DOM tree that has a matching ID
// then we will replace the target element with the
// corresponding old element and morph the old element
unmatchedEls[curToNodeId] = curToNodeChild;
}
}
// If we got this far then we did not find a candidate match for
// our "to node" and we exhausted all of the children "from"
// nodes. Therefore, we will just append the current "to node"
// to the end
if (onBeforeNodeAdded(curToNodeChild) !== false) {
fromEl.appendChild(curToNodeChild);
onNodeAdded(curToNodeChild);
}
if (curToNodeChild.nodeType === ELEMENT_NODE &&
(curToNodeId || curToNodeChild.firstChild)) {
// The element that was just added to the original DOM may
// have some nested elements with a key/ID that needs to be
// matched up with other elements. We'll add the element to
// a list so that we can later process the nested elements
// if there are any unmatched keyed elements that were
// discarded
movedEls.push(curToNodeChild);
}
curToNodeChild = toNextSibling;
curFromNodeChild = fromNextSibling;
}
// We have processed all of the "to nodes". If curFromNodeChild is
// non-null then we still have some from nodes left over that need
// to be removed
while (curFromNodeChild) {
fromNextSibling = curFromNodeChild.nextSibling;
removeNode(curFromNodeChild, fromEl, alreadyVisited);
curFromNodeChild = fromNextSibling;
}
}
var specialElHandler = specialElHandlers[fromEl.nodeName];
if (specialElHandler) {
specialElHandler(fromEl, toEl);
}
} // END: morphEl(...)
var morphedNode = fromNode;
var morphedNodeType = morphedNode.nodeType;
var toNodeType = toNode.nodeType;
if (!childrenOnly) {
// Handle the case where we are given two DOM nodes that are not
// compatible (e.g. <div> --> <span> or <div> --> TEXT)
if (morphedNodeType === ELEMENT_NODE) {
if (toNodeType === ELEMENT_NODE) {
if (!compareNodeNames(fromNode, toNode)) {
onNodeDiscarded(fromNode);
morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));
}
} else {
// Going from an element node to a text node
morphedNode = toNode;
}
} else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) { // Text or comment node
if (toNodeType === morphedNodeType) {
morphedNode.nodeValue = toNode.nodeValue;
return morphedNode;
} else {
// Text node to something else
morphedNode = toNode;
}
}
}
if (morphedNode === toNode) {
// The "to node" was not compatible with the "from node" so we had to
// toss out the "from node" and use the "to node"
onNodeDiscarded(fromNode);
} else {
morphEl(morphedNode, toNode, false, childrenOnly);
/**
* What we will do here is walk the tree for the DOM element that was
* moved from the target DOM tree to the original DOM tree and we will
* look for keyed elements that could be matched to keyed elements that
* were earlier discarded. If we find a match then we will move the
* saved element into the final DOM tree.
*/
var handleMovedEl = function(el) {
var curChild = el.firstChild;
while (curChild) {
var nextSibling = curChild.nextSibling;
var key = getNodeKey(curChild);
if (key) {
var savedEl = savedEls[key];
if (savedEl && compareNodeNames(curChild, savedEl)) {
curChild.parentNode.replaceChild(savedEl, curChild);
// true: already visited the saved el tree
morphEl(savedEl, curChild, true);
curChild = nextSibling;
if (empty(savedEls)) {
return false;
}
continue;
}
}
if (curChild.nodeType === ELEMENT_NODE) {
handleMovedEl(curChild);
}
curChild = nextSibling;
}
};
// The loop below is used to possibly match up any discarded
// elements in the original DOM tree with elemenets from the
// target tree that were moved over without visiting their
// children
if (!empty(savedEls)) {
handleMovedElsLoop:
while (movedEls.length) {
var movedElsTemp = movedEls;
movedEls = [];
for (var i=0; i<movedElsTemp.length; i++) {
if (handleMovedEl(movedElsTemp[i]) === false) {
// There are no more unmatched elements so completely end
// the loop
break handleMovedElsLoop;
}
}
}
}
// Fire the "onNodeDiscarded" event for any saved elements
// that never found a new home in the morphed DOM
for (var savedElId in savedEls) {
if (savedEls.hasOwnProperty(savedElId)) {
var savedEl = savedEls[savedElId];
onNodeDiscarded(savedEl);
walkDiscardedChildNodes(savedEl);
}
}
}
if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {
// If we had to swap out the from node with a new node because the old
// node was not compatible with the target node then we need to
// replace the old DOM node in the original DOM tree. This is only
// possible if the original DOM node was part of a DOM tree which
// we know is the case if it has a parent node.
fromNode.parentNode.replaceChild(morphedNode, fromNode);
}
return morphedNode;
}
module.exports = morphdom;
},{}],75:[function(require,module,exports){
module.exports = [
// attribute events (can be set with attributes)
'onclick',
'ondblclick',
'onmousedown',
'onmouseup',
'onmouseover',
'onmousemove',
'onmouseout',
'ondragstart',
'ondrag',
'ondragenter',
'ondragleave',
'ondragover',
'ondrop',
'ondragend',
'onkeydown',
'onkeypress',
'onkeyup',
'onunload',
'onabort',
'onerror',
'onresize',
'onscroll',
'onselect',
'onchange',
'onsubmit',
'onreset',
'onfocus',
'onblur',
'oninput',
// other common events
'oncontextmenu',
'onfocusin',
'onfocusout'
]
},{}],"uppy":[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports.Webcam = exports.MetaData = exports.Dashboard = exports.Multipart = exports.Tus10 = exports.Formtag = exports.GoogleDrive = exports.DragDrop = exports.Informer = exports.ProgressBar = exports.Dummy = exports.locales = exports.Plugin = exports.Core = undefined;
var _index = require('./core/index.js');
var _index2 = _interopRequireDefault(_index);
var _Plugin = require('./plugins/Plugin');
var _Plugin2 = _interopRequireDefault(_Plugin);
var _index3 = require('./plugins/Dashboard/index.js');
var _index4 = _interopRequireDefault(_index3);
var _Dummy = require('./plugins/Dummy');
var _Dummy2 = _interopRequireDefault(_Dummy);
var _index5 = require('./plugins/DragDrop/index.js');
var _index6 = _interopRequireDefault(_index5);
var _Formtag = require('./plugins/Formtag');
var _Formtag2 = _interopRequireDefault(_Formtag);
var _index7 = require('./plugins/GoogleDrive/index.js');
var _index8 = _interopRequireDefault(_index7);
var _index9 = require('./plugins/Webcam/index.js');
var _index10 = _interopRequireDefault(_index9);
var _ProgressBar = require('./plugins/ProgressBar.js');
var _ProgressBar2 = _interopRequireDefault(_ProgressBar);
var _Informer = require('./plugins/Informer.js');
var _Informer2 = _interopRequireDefault(_Informer);
var _MetaData = require('./plugins/MetaData.js');
var _MetaData2 = _interopRequireDefault(_MetaData);
var _Tus = require('./plugins/Tus10');
var _Tus2 = _interopRequireDefault(_Tus);
var _Multipart = require('./plugins/Multipart');
var _Multipart2 = _interopRequireDefault(_Multipart);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var locales = {};
// Orchestrators
// Parent
// Acquirers
// Progressindicators
// Modifiers
// Uploaders
exports.default = {
Core: _index2.default,
Plugin: _Plugin2.default,
locales: locales,
Dummy: _Dummy2.default,
ProgressBar: _ProgressBar2.default,
Informer: _Informer2.default,
DragDrop: _index6.default,
GoogleDrive: _index8.default,
Formtag: _Formtag2.default,
Tus10: _Tus2.default,
Multipart: _Multipart2.default,
Dashboard: _index4.default,
MetaData: _MetaData2.default,
Webcam: _index10.default
};
exports.Core = _index2.default;
exports.Plugin = _Plugin2.default;
exports.locales = locales;
exports.Dummy = _Dummy2.default;
exports.ProgressBar = _ProgressBar2.default;
exports.Informer = _Informer2.default;
exports.DragDrop = _index6.default;
exports.GoogleDrive = _index8.default;
exports.Formtag = _Formtag2.default;
exports.Tus10 = _Tus2.default;
exports.Multipart = _Multipart2.default;
exports.Dashboard = _index4.default;
exports.MetaData = _MetaData2.default;
exports.Webcam = _index10.default;
// import Core from './core/index.js'
// import plugins from './plugins/index.js'
//
// const locales = {}
//
// export {
// Core,
// plugins,
// locales
// }
//# sourceMappingURL=index.js.map
},{"./core/index.js":9,"./plugins/Dashboard/index.js":21,"./plugins/DragDrop/index.js":22,"./plugins/Dummy":23,"./plugins/Formtag":24,"./plugins/GoogleDrive/index.js":27,"./plugins/Informer.js":34,"./plugins/MetaData.js":35,"./plugins/Multipart":36,"./plugins/Plugin":37,"./plugins/ProgressBar.js":38,"./plugins/Tus10":39,"./plugins/Webcam/index.js":44}]},{},[])
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment