ddv-restful-api
Version:
ddv-restful-api
1,756 lines (1,578 loc) • 397 kB
JavaScript
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 34);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// 导出模块
var util = __webpack_require__(3);
module.exports = util;
// 生成请求id
Object.assign(util, {
// 生成请求id
createRequestId: function createRequestId() {
var pid, rid, ridLen, ridT, ridNew, i;
// 获取16进制的 pid
pid = Number(util.createNewPid(true)).toString(16);
// 种子
rid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
ridNew = '';
for (i = rid.length - 1; i >= 0; i--) {
ridT = rid[i];
if (ridT === 'x') {
ridLen = pid.length;
ridT = pid ? pid.charAt(ridLen - 1) : 'x';
pid = pid.substr(0, ridLen - 1);
}
ridNew = ridT + ridNew;
}
rid = util.createGuid(ridNew);
i = ridNew = ridT = ridLen = pid = void 0;
return rid;
}
});
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
;(function (root, factory) {
if (true) {
// CommonJS
module.exports = exports = factory();
}
else if (typeof define === "function" && define.amd) {
// AMD
define([], factory);
}
else {
// Global (browser)
root.CryptoJS = factory();
}
}(this, function () {
/**
* CryptoJS core components.
*/
var CryptoJS = CryptoJS || (function (Math, undefined) {
/*
* Local polyfil of Object.create
*/
var create = Object.create || (function () {
function F() {};
return function (obj) {
var subtype;
F.prototype = obj;
subtype = new F();
F.prototype = null;
return subtype;
};
}())
/**
* CryptoJS namespace.
*/
var C = {};
/**
* Library namespace.
*/
var C_lib = C.lib = {};
/**
* Base object for prototypal inheritance.
*/
var Base = C_lib.Base = (function () {
return {
/**
* Creates a new object that inherits from this object.
*
* @param {Object} overrides Properties to copy into the new object.
*
* @return {Object} The new object.
*
* @static
*
* @example
*
* var MyType = CryptoJS.lib.Base.extend({
* field: 'value',
*
* method: function () {
* }
* });
*/
extend: function (overrides) {
// Spawn
var subtype = create(this);
// Augment
if (overrides) {
subtype.mixIn(overrides);
}
// Create default initializer
if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
subtype.init = function () {
subtype.$super.init.apply(this, arguments);
};
}
// Initializer's prototype is the subtype object
subtype.init.prototype = subtype;
// Reference supertype
subtype.$super = this;
return subtype;
},
/**
* Extends this object and runs the init method.
* Arguments to create() will be passed to init().
*
* @return {Object} The new object.
*
* @static
*
* @example
*
* var instance = MyType.create();
*/
create: function () {
var instance = this.extend();
instance.init.apply(instance, arguments);
return instance;
},
/**
* Initializes a newly created object.
* Override this method to add some logic when your objects are created.
*
* @example
*
* var MyType = CryptoJS.lib.Base.extend({
* init: function () {
* // ...
* }
* });
*/
init: function () {
},
/**
* Copies properties into this object.
*
* @param {Object} properties The properties to mix in.
*
* @example
*
* MyType.mixIn({
* field: 'value'
* });
*/
mixIn: function (properties) {
for (var propertyName in properties) {
if (properties.hasOwnProperty(propertyName)) {
this[propertyName] = properties[propertyName];
}
}
// IE won't copy toString using the loop above
if (properties.hasOwnProperty('toString')) {
this.toString = properties.toString;
}
},
/**
* Creates a copy of this object.
*
* @return {Object} The clone.
*
* @example
*
* var clone = instance.clone();
*/
clone: function () {
return this.init.prototype.extend(this);
}
};
}());
/**
* An array of 32-bit words.
*
* @property {Array} words The array of 32-bit words.
* @property {number} sigBytes The number of significant bytes in this word array.
*/
var WordArray = C_lib.WordArray = Base.extend({
/**
* Initializes a newly created word array.
*
* @param {Array} words (Optional) An array of 32-bit words.
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
*
* @example
*
* var wordArray = CryptoJS.lib.WordArray.create();
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
*/
init: function (words, sigBytes) {
words = this.words = words || [];
if (sigBytes != undefined) {
this.sigBytes = sigBytes;
} else {
this.sigBytes = words.length * 4;
}
},
/**
* Converts this word array to a string.
*
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
*
* @return {string} The stringified word array.
*
* @example
*
* var string = wordArray + '';
* var string = wordArray.toString();
* var string = wordArray.toString(CryptoJS.enc.Utf8);
*/
toString: function (encoder) {
return (encoder || Hex).stringify(this);
},
/**
* Concatenates a word array to this word array.
*
* @param {WordArray} wordArray The word array to append.
*
* @return {WordArray} This word array.
*
* @example
*
* wordArray1.concat(wordArray2);
*/
concat: function (wordArray) {
// Shortcuts
var thisWords = this.words;
var thatWords = wordArray.words;
var thisSigBytes = this.sigBytes;
var thatSigBytes = wordArray.sigBytes;
// Clamp excess bits
this.clamp();
// Concat
if (thisSigBytes % 4) {
// Copy one byte at a time
for (var i = 0; i < thatSigBytes; i++) {
var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
}
} else {
// Copy one word at a time
for (var i = 0; i < thatSigBytes; i += 4) {
thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
}
}
this.sigBytes += thatSigBytes;
// Chainable
return this;
},
/**
* Removes insignificant bits.
*
* @example
*
* wordArray.clamp();
*/
clamp: function () {
// Shortcuts
var words = this.words;
var sigBytes = this.sigBytes;
// Clamp
words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
words.length = Math.ceil(sigBytes / 4);
},
/**
* Creates a copy of this word array.
*
* @return {WordArray} The clone.
*
* @example
*
* var clone = wordArray.clone();
*/
clone: function () {
var clone = Base.clone.call(this);
clone.words = this.words.slice(0);
return clone;
},
/**
* Creates a word array filled with random bytes.
*
* @param {number} nBytes The number of random bytes to generate.
*
* @return {WordArray} The random word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.lib.WordArray.random(16);
*/
random: function (nBytes) {
var words = [];
var r = (function (m_w) {
var m_w = m_w;
var m_z = 0x3ade68b1;
var mask = 0xffffffff;
return function () {
m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
var result = ((m_z << 0x10) + m_w) & mask;
result /= 0x100000000;
result += 0.5;
return result * (Math.random() > .5 ? 1 : -1);
}
});
for (var i = 0, rcache; i < nBytes; i += 4) {
var _r = r((rcache || Math.random()) * 0x100000000);
rcache = _r() * 0x3ade67b7;
words.push((_r() * 0x100000000) | 0);
}
return new WordArray.init(words, nBytes);
}
});
/**
* Encoder namespace.
*/
var C_enc = C.enc = {};
/**
* Hex encoding strategy.
*/
var Hex = C_enc.Hex = {
/**
* Converts a word array to a hex string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The hex string.
*
* @static
*
* @example
*
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
*/
stringify: function (wordArray) {
// Shortcuts
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
// Convert
var hexChars = [];
for (var i = 0; i < sigBytes; i++) {
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
hexChars.push((bite >>> 4).toString(16));
hexChars.push((bite & 0x0f).toString(16));
}
return hexChars.join('');
},
/**
* Converts a hex string to a word array.
*
* @param {string} hexStr The hex string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
*/
parse: function (hexStr) {
// Shortcut
var hexStrLength = hexStr.length;
// Convert
var words = [];
for (var i = 0; i < hexStrLength; i += 2) {
words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
}
return new WordArray.init(words, hexStrLength / 2);
}
};
/**
* Latin1 encoding strategy.
*/
var Latin1 = C_enc.Latin1 = {
/**
* Converts a word array to a Latin1 string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The Latin1 string.
*
* @static
*
* @example
*
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
*/
stringify: function (wordArray) {
// Shortcuts
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
// Convert
var latin1Chars = [];
for (var i = 0; i < sigBytes; i++) {
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
latin1Chars.push(String.fromCharCode(bite));
}
return latin1Chars.join('');
},
/**
* Converts a Latin1 string to a word array.
*
* @param {string} latin1Str The Latin1 string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
*/
parse: function (latin1Str) {
// Shortcut
var latin1StrLength = latin1Str.length;
// Convert
var words = [];
for (var i = 0; i < latin1StrLength; i++) {
words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
}
return new WordArray.init(words, latin1StrLength);
}
};
/**
* UTF-8 encoding strategy.
*/
var Utf8 = C_enc.Utf8 = {
/**
* Converts a word array to a UTF-8 string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The UTF-8 string.
*
* @static
*
* @example
*
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
*/
stringify: function (wordArray) {
try {
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
} catch (e) {
throw new Error('Malformed UTF-8 data');
}
},
/**
* Converts a UTF-8 string to a word array.
*
* @param {string} utf8Str The UTF-8 string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
*/
parse: function (utf8Str) {
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
}
};
/**
* Abstract buffered block algorithm template.
*
* The property blockSize must be implemented in a concrete subtype.
*
* @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
*/
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
/**
* Resets this block algorithm's data buffer to its initial state.
*
* @example
*
* bufferedBlockAlgorithm.reset();
*/
reset: function () {
// Initial values
this._data = new WordArray.init();
this._nDataBytes = 0;
},
/**
* Adds new data to this block algorithm's buffer.
*
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
*
* @example
*
* bufferedBlockAlgorithm._append('data');
* bufferedBlockAlgorithm._append(wordArray);
*/
_append: function (data) {
// Convert string to WordArray, else assume WordArray already
if (typeof data == 'string') {
data = Utf8.parse(data);
}
// Append
this._data.concat(data);
this._nDataBytes += data.sigBytes;
},
/**
* Processes available data blocks.
*
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
*
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
*
* @return {WordArray} The processed data.
*
* @example
*
* var processedData = bufferedBlockAlgorithm._process();
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
*/
_process: function (doFlush) {
// Shortcuts
var data = this._data;
var dataWords = data.words;
var dataSigBytes = data.sigBytes;
var blockSize = this.blockSize;
var blockSizeBytes = blockSize * 4;
// Count blocks ready
var nBlocksReady = dataSigBytes / blockSizeBytes;
if (doFlush) {
// Round up to include partial blocks
nBlocksReady = Math.ceil(nBlocksReady);
} else {
// Round down to include only full blocks,
// less the number of blocks that must remain in the buffer
nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
}
// Count words ready
var nWordsReady = nBlocksReady * blockSize;
// Count bytes ready
var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
// Process blocks
if (nWordsReady) {
for (var offset = 0; offset < nWordsReady; offset += blockSize) {
// Perform concrete-algorithm logic
this._doProcessBlock(dataWords, offset);
}
// Remove processed words
var processedWords = dataWords.splice(0, nWordsReady);
data.sigBytes -= nBytesReady;
}
// Return processed words
return new WordArray.init(processedWords, nBytesReady);
},
/**
* Creates a copy of this object.
*
* @return {Object} The clone.
*
* @example
*
* var clone = bufferedBlockAlgorithm.clone();
*/
clone: function () {
var clone = Base.clone.call(this);
clone._data = this._data.clone();
return clone;
},
_minBufferSize: 0
});
/**
* Abstract hasher template.
*
* @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
*/
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
/**
* Configuration options.
*/
cfg: Base.extend(),
/**
* Initializes a newly created hasher.
*
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
*
* @example
*
* var hasher = CryptoJS.algo.SHA256.create();
*/
init: function (cfg) {
// Apply config defaults
this.cfg = this.cfg.extend(cfg);
// Set initial values
this.reset();
},
/**
* Resets this hasher to its initial state.
*
* @example
*
* hasher.reset();
*/
reset: function () {
// Reset data buffer
BufferedBlockAlgorithm.reset.call(this);
// Perform concrete-hasher logic
this._doReset();
},
/**
* Updates this hasher with a message.
*
* @param {WordArray|string} messageUpdate The message to append.
*
* @return {Hasher} This hasher.
*
* @example
*
* hasher.update('message');
* hasher.update(wordArray);
*/
update: function (messageUpdate) {
// Append
this._append(messageUpdate);
// Update the hash
this._process();
// Chainable
return this;
},
/**
* Finalizes the hash computation.
* Note that the finalize operation is effectively a destructive, read-once operation.
*
* @param {WordArray|string} messageUpdate (Optional) A final message update.
*
* @return {WordArray} The hash.
*
* @example
*
* var hash = hasher.finalize();
* var hash = hasher.finalize('message');
* var hash = hasher.finalize(wordArray);
*/
finalize: function (messageUpdate) {
// Final message update
if (messageUpdate) {
this._append(messageUpdate);
}
// Perform concrete-hasher logic
var hash = this._doFinalize();
return hash;
},
blockSize: 512/32,
/**
* Creates a shortcut function to a hasher's object interface.
*
* @param {Hasher} hasher The hasher to create a helper for.
*
* @return {Function} The shortcut function.
*
* @static
*
* @example
*
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
*/
_createHelper: function (hasher) {
return function (message, cfg) {
return new hasher.init(cfg).finalize(message);
};
},
/**
* Creates a shortcut function to the HMAC's object interface.
*
* @param {Hasher} hasher The hasher to use in this HMAC helper.
*
* @return {Function} The shortcut function.
*
* @static
*
* @example
*
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
*/
_createHmacHelper: function (hasher) {
return function (message, key) {
return new C_algo.HMAC.init(hasher, key).finalize(message);
};
}
});
/**
* Algorithm namespace.
*/
var C_algo = C.algo = {};
return C;
}(Math));
return CryptoJS;
}));
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
// 导出模块
module.exports = util
// 创建最后总和
var createNewidSumLast = 0
// 创建最后时间
var createNewidTimeLast = 0
// 创建请求id
Object.assign(util, {
/**
* 创建一个当前运行环境中唯一的id
* @param {Boolean} is10 [是否为10进制]
* @return {String} [返回唯一id]
*/
createNewPid: function createNewid (is10) {
var r
if (createNewidTimeLast !== util.time()) {
createNewidTimeLast = util.time()
createNewidSumLast = 0
}
r = createNewidTimeLast.toString() + (++createNewidSumLast).toString()
// 使用36进制
if (!is10) {
r = parseInt(r, 10).toString(36)
}
return r
},
/**
* 生成guid
* @param {String} s [模板]
* @return {String} [返回guid]
*/
createGuid: function createGuid (s) {
return (s || 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx').replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0
var v = c === 'x' ? r : (r & 0x3 | 0x8)
return v.toString(16)
})
}
})
// 时间工具
Object.assign(util, {
/**
* 获取当前时间开始
* @return {Int} [毫秒级时间戳]
*/
now: function now () {
return (new Date()).getTime()
},
/**
* 获取php的时间戳
* @return {Int} [秒级时间戳]
*/
time: function time () {
return parseInt(util.now() / 1000)
},
/**
* 去空格
* @param {String} t [需要去空格的字符串]
* @return {String} [去空格后的字符串]
*/
trim: function trim (t) {
return (t || typeof t === 'string') ? (t.toString().trim()) : t
}
})
// 基本判断
Object.assign(util, {
/**
* 判断是一个方法
* @param {Function} fn [这个对象是否一个方法]
* @return {Boolean} [是否为一个方法]
*/
isFunction: function isFunction (fn) {
return typeof fn === 'function'
},
/**
* 判断是否为一个数组
* @param {Array} fn [这个对象是否一个方法]
* @return {Boolean} [description]
*/
isArray: function isArray (a) {
return Array.isArray.apply(this, arguments)
},
/**
* 是否为一个数字
* @author: 桦 <yuchonghua@163.com>
* @DateTime 2017-07-28T09:46:39+0800
* @param {[type]} obj [description]
* @return {Boolean} [description]
*/
isNumber: function isNumber (obj) {
return (typeof obj === 'string' || typeof obj === 'number') && (!util.isArray(obj) && (obj - parseFloat(obj) >= 0))
},
// 判断是否一个标准的global
isGlobal: function isGlobal (obj) {
return obj !== void 0 && obj === obj.global
},
// 类似php里面的inArray
inArray: function inArray (a, b) {
if (!util.isArray(b)) {
return false
}
for (var i in b) {
if (b[i] === a) {
return true
}
}
return false
}
})
// 基本工具
Object.assign(util, {
// 克隆
clone: function clone (myObj) {
var i, myNewObj
if (!(myObj && typeof myObj === 'object')) {
return myObj
}
if (myObj === null || myObj === undefined) {
return myObj
}
myNewObj = ''
if (util.isArray(myObj)) {
myNewObj = []
for (i = 0; i < myObj.length; i++) {
myNewObj.push(myObj[i])
}
} else if (typeof myObj === 'object') {
myNewObj = {}
if (myObj.constructor && myObj.constructor !== Object) {
myNewObj = myObj
// 防止克隆ie下克隆 Element 出问题
} else if (myObj.innerHTML !== undefined && myObj.innerText !== undefined && myObj.tagName !== undefined && myObj.tabIndex !== undefined) {
myNewObj = myObj
} else {
for (i in myObj) {
myNewObj[i] = clone(myObj[i])
}
}
}
return myNewObj
},
/**
* 复制对象,通过制定key
* @author: 桦 <yuchonghua@163.com>
* @DateTime 2017-07-28T09:47:56+0800
* @param {[type]} oldObj [description]
* @param {[type]} newObj [description]
* @param {[type]} keys [description]
* @return {[type]} [description]
*/
copyObjByKey: function copyObjByKey (oldObj, newObj, keys) {
keys = keys || []
keys.forEach(function (key) {
oldObj[key] = newObj[key] || oldObj[key]
})
},
// 设置错误id
setErrorId: function setErrorId (errorId, error) {
error.errorId = errorId
error.error_id = errorId
return error
},
// 参数强转数组
argsToArray: function argsToArray (args) {
return Array.prototype.slice.call(args)
}
})
// nextTick
Object.assign(util, {
nextTick: __webpack_require__(50)
})
// 类型
var class2type = (function () {
var t = {}
// Populate the class2type map
'Boolean Number String Function Array Date RegExp Object Error'.split(' ').forEach(function (name) {
t[ '[object ' + name + ']' ] = name.toLowerCase()
})
return t
}())
Object.assign(util, {
type: function type (obj, isType) {
if (isType !== void 0) {
return isType === util.type(obj)
}
if (obj === void 0) {
return obj + ''
}
// Support: Android<4.0, iOS<6 (functionish RegExp)
return (typeof obj === 'object' || typeof obj === 'function') ? class2type[ class2type.toString.call(obj) ] || 'object' : typeof obj
},
isPlainObject: function isPlainObject (obj) {
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
if (util.type(obj) !== 'object' || obj.nodeType || util.isGlobal(obj)) {
return false
}
if (obj.constructor && !Object.hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')) {
return false
}
// If the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new Object
return true
},
extend: function extend () {
var options, name, src, copy, copyIsArray, clone
var target = arguments[ 0 ] || {}
var i = 1
var length = arguments.length
var deep = false
// Handle a deep copy situation
if (typeof target === 'boolean') {
deep = target
// Skip the boolean and the target
target = arguments[ i ] || {}
i++
}
// Handle case when target is a string or something (possible in deep copy)
if (typeof target !== 'object' && !util.isFunction(target)) {
target = {}
}
// Extend jQuery itself if only one argument is passed
if (i === length) {
target = this
i--
}
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) !== void 0) {
// Extend the base object
for (name in options) {
src = target[ name ]
copy = options[ name ]
// Prevent never-ending loop
if (target === copy) {
continue
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && (util.isPlainObject(copy) || (copyIsArray = util.isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false
clone = src && util.isArray(src) ? src : []
} else {
clone = src && util.isPlainObject(src) ? src : Object.create(null)
}
// Never move original objects, clone them
target[name] = util.extend(deep, clone, copy)
// Don't bring in undefined values
} else if (copy !== undefined) {
target[name] = copy
}
}
}
}
// Return the modified object
return target
}
})
function util () {
}
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
var util = __webpack_require__(3)
var url = __webpack_require__(52)
var parseStrByPhp = __webpack_require__(51)
// 工具
module.exports = url
Object.assign(url, {
parse: function parse (str, component) {
var query
var mode = 'php'
var key = [
'source',
'scheme',
'authority',
'userInfo',
'user',
'pass',
'host',
'port',
'relative',
'path',
'directory',
'file',
'query',
'fragment'
]
// For loose we added one optional slash to post-scheme to catch file:/// (should restrict this)
var parser = {
php: new RegExp([
'(?:([^:\\/?#]+):)?',
'(?:\\/\\/()(?:(?:()(?:([^:@\\/]*):?([^:@\\/]*))?@)?([^:\\/?#]*)(?::(\\d*))?))?',
'()',
'(?:(()(?:(?:[^?#\\/]*\\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)'
].join('')),
strict: new RegExp([
'(?:([^:\\/?#]+):)?',
'(?:\\/\\/((?:(([^:@\\/]*):?([^:@\\/]*))?@)?([^:\\/?#]*)(?::(\\d*))?))?',
'((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)'
].join('')),
loose: new RegExp([
'(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?',
'(?:\\/\\/\\/?)?',
'((?:(([^:@\\/]*):?([^:@\\/]*))?@)?([^:\\/?#]*)(?::(\\d*))?)',
'(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))',
'(?:\\?([^#]*))?(?:#(.*))?)'
].join(''))
}
var m = parser[mode].exec(str)
var uri = {}
var i = 14
while (i--) {
if (m[i]) {
uri[key[i]] = m[i]
}
}
if (component) {
return uri[component.replace('PHP_URL_', '').toLowerCase()]
}
if (mode !== 'php') {
var name = 'queryKey'
parser = /(?:^|&)([^&=]*)=?([^&]*)/g
uri[name] = {}
query = uri[key[12]] || ''
query.replace(parser, function ($0, $1, $2) {
if ($1) {
uri[name][$1] = $2
}
})
}
delete uri.source
return uri
},
parseQuery: function parseQuery (query) {
query = query || ''
var r = {}
parseStrByPhp(query, r)
return r
},
buildQuery: function buildQuery (params, isQuery) {
params = params || {}
var r = url._buildParamsToArray(params, '').join('&')
if (isQuery) {
r = r.replace(/%20/gi, '+')
}
return r
}
})
// urlEncode 编码
Object.assign(url, {
// 编码对照数组表
kEscapedMap: {
'!': '%21',
'\'': '%27',
'(': '%28',
')': '%29',
'*': '%2A'
},
// 编码
urlDecode: function urlDecode (string) {
return decodeURIComponent(string)
},
// 编码
urlEncode: function urlEncode (string, encodingSlash) {
var result = encodeURIComponent(string)
result = result.replace(/[!'()*]/g, function (key) {
return url.kEscapedMap[key]
})
if (encodingSlash === false) {
result = result.replace(/%2F/gi, '/')
}
return result
},
// path编码
urlEncodeExceptSlash: function urlEncodeExceptSlash (value) {
return url.urlEncode(value, false)
}
})
// 对象序列化
Object.assign(url, {
_buildParamsToArray: function _buildParamsToArray (data, prefix) {
var r = []
var i, key, keyt, value
if (typeof data === 'object') {
// 数组
if (util.isArray(data)) {
for (i = 0; i < data.length; i++) {
// 值
value = data[i]
if (value === void 0) continue
// 键
keyt = url._buildParamsAddPrefix(i, prefix, (typeof value === 'object'))
// 递归处理对象和数组
if (typeof value === 'object') {
// 插入数组
r.push.apply(r, url._buildParamsToArray(value, keyt))
} else {
// 插入数组
r.push(url.urlEncode(keyt) + '=' + url.urlEncode(value))
}
}
} else {
for (key in data) {
if (!Object.hasOwnProperty.call(data, key)) {
continue
}
// 值
value = data[key]
if (value === void 0) continue
// 键
keyt = url._buildParamsAddPrefix(key, prefix)
if (typeof value === 'object') {
// 插入数组
r.push.apply(r, url._buildParamsToArray(value, keyt))
} else {
// 插入数组
r.push(url.urlEncode(keyt) + '=' + url.urlEncode(value))
}
}
}
}
return r
},
_buildParamsAddPrefix: function _buildParamsAddPrefix (key, prefix, isNotArray) {
if (prefix) {
return prefix + '[' + (isNotArray !== false ? key : '') + ']'
} else {
return key
}
}
})
Object.assign(url, {
/**
* Build a URL.
*
* The parts of the second URL will be merged into the first according to
* the flags argument.
*
* @param mixed urli (part(s) of) an URL in form of a string or
* associative array like parse_url() returns
* @param mixed parts same as the first argument
* @param int flags a bitmask of binary or'ed HTTP_URL constants;
* HTTP_URL_REPLACE is the default
* @param array new_url if set, it will be filled with the parts of the
* composed url like parse_url() would return
* @return string
*/
build: function build (urli, parts, flags) {
urli = urli || {}
parts = parts || {}
flags = flags || url.HTTP_URL_REPLACE
typeof urli === 'object' || (urli = url.parse(urli))
typeof parts === 'object' || (parts = url.parse(parts))
var keys = ['user', 'pass', 'port', 'path', 'query', 'fragment']
// HTTP_URL_STRIP_ALL and HTTP_URL_STRIP_AUTH cover several other flags.
if (flags & url.HTTP_URL_STRIP_ALL) {
flags |= url.HTTP_URL_STRIP_USER | url.HTTP_URL_STRIP_PASS |
url.HTTP_URL_STRIP_PORT | url.HTTP_URL_STRIP_PATH |
url.HTTP_URL_STRIP_QUERY | url.HTTP_URL_STRIP_FRAGMENT
} else if (flags & url.HTTP_URL_STRIP_AUTH) {
flags |= url.HTTP_URL_STRIP_USER | url.HTTP_URL_STRIP_PASS
}
// Schema and host are alwasy replaced
var t = ['scheme', 'host']
var i
for (i = 0; i < t.length; i++) {
if (parts && t[i] && parts[t[i]]) {
urli[t[i]] = parts[t[i]]
}
}
if (flags & url.HTTP_URL_REPLACE) {
for (i = 0; i < keys.length; i++) {
if (parts && keys[i] && parts[keys[i]]) {
urli[keys[i]] = parts[keys[i]]
}
}
} else {
if (parts && parts['path'] && (flags & url.HTTP_URL_JOIN_PATH)) {
if (urli && urli['path'] && (parts['path']).substr(0, 1) !== '/') {
var leftTemp, rigthTemp
// Workaround for trailing slashes
leftTemp = rigthTemp = ''
if (parts['path']) {
parts['path'] = (parts['path'] || '').toString()
i = parts['path'].indexOf('/')
if (i > -1) {
rigthTemp = parts['path'].substr(i + 1)
}
}
if (urli['path']) {
urli['path'] = (urli['path'] || '').toString()
i = urli['path'].lastIndexOf('/')
if (i > -1) {
leftTemp = urli['path'].substr(0, i)
}
}
urli['path'] = rigthTemp ? leftTemp : (leftTemp + '/' + rigthTemp)
} else {
urli['path'] = parts['path']
}
}
if (parts && parts['query'] && (flags & url.HTTP_URL_JOIN_QUERY)) {
if (urli && urli['query']) {
var urliQuery = url.parseQuery(urli['query'])
var partsQuery = url.parseQuery(parts['query'])
urli['query'] = url.buildQuery(util.extend({}, urliQuery, partsQuery))
} else {
urli['query'] = parts['query']
}
}
}
if (urli && urli['path'] && urli['path'] !== '' && (urli['path'] || '').substr(0, 1) !== '/') {
urli['path'] = '/'.urli['path']
}
var strip
for (i = 0; i < keys.length; i++) {
strip = 'HTTP_URL_STRIP_' + (keys[i] || '').toUpperCase()
if (flags & url[strip]) {
delete urli[keys[i] || '']
}
}
var parsedString = ''
if (urli['scheme']) {
parsedString += urli['scheme'] + '://'
}
if (urli['user']) {
parsedString += urli['user']
if (urli['pass']) {
parsedString += ':' + urli['pass']
}
parsedString += '@'
}
if (urli['host']) {
parsedString += urli['host']
}
if (urli['port']) {
parsedString += ':' + urli['port']
}
if (urli['path']) {
parsedString += urli['path']
}
if (urli['query']) {
parsedString += '?' + urli['query']
}
if (urli['fragment']) {
parsedString += '#' + urli['fragment']
}
return parsedString
}
})
Object.assign(url, {
'HTTP_URL_REPLACE': 1,
'HTTP_URL_JOIN_PATH': 2,
'HTTP_URL_JOIN_QUERY': 4,
'HTTP_URL_STRIP_USER': 8,
'HTTP_URL_STRIP_PASS': 16,
'HTTP_URL_STRIP_AUTH': 32,
'HTTP_URL_STRIP_PORT': 64,
'HTTP_URL_STRIP_PATH': 128,
'HTTP_URL_STRIP_QUERY': 256,
'HTTP_URL_STRIP_FRAGMENT': 512,
'HTTP_URL_STRIP_ALL': 1024
})
/***/ }),
/* 5 */
/***/ (function(module, exports) {
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
/***/ }),
/* 6 */
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// 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 SO