parent
c1d32317ab
commit
39583f9954
Binary file not shown.
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Eslint config file
|
||||
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
||||
* Install the Eslint extension before using this feature.
|
||||
*/
|
||||
module.exports = {
|
||||
env: {
|
||||
es6: true,
|
||||
browser: true,
|
||||
node: true,
|
||||
},
|
||||
ecmaFeatures: {
|
||||
modules: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
wx: true,
|
||||
App: true,
|
||||
Page: true,
|
||||
getCurrentPages: true,
|
||||
getApp: true,
|
||||
Component: true,
|
||||
requirePlugin: true,
|
||||
requireMiniProgram: true,
|
||||
},
|
||||
// extends: 'eslint:recommended',
|
||||
rules: {},
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
bazel*
|
||||
*.pyc
|
||||
node_modules
|
@ -0,0 +1,93 @@
|
||||
// app.js
|
||||
App({
|
||||
onLaunch() {
|
||||
wx.cloud.init({
|
||||
env: "daily-consumption-1eonh2e259454a",//修改成自己的云环境名称
|
||||
traceUser: true,
|
||||
})
|
||||
var that = this;
|
||||
wx.cloud.callFunction({
|
||||
name:'getOpenid',
|
||||
success(res){
|
||||
console.log(res)
|
||||
that.globalData.openid = res.result.openid
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if(wx.getStorageSync('userInfo')){
|
||||
this.globalData.userInfo = wx.getStorageSync('userInfo')
|
||||
this.getUserinfo()
|
||||
}
|
||||
|
||||
},
|
||||
getUserinfo(){
|
||||
//获取用户的openid
|
||||
var that = this;
|
||||
wx.cloud.callFunction({
|
||||
name:'getOpenid',
|
||||
success(res){
|
||||
console.log(res)
|
||||
that.globalData.openid = res.result.openid
|
||||
|
||||
//查找数据库用户表里面是否有这个用户记录
|
||||
wx.cloud.database().collection('user').where({
|
||||
_openid: res.result.openid
|
||||
}).get({
|
||||
success(result){
|
||||
|
||||
console.log(result)
|
||||
that.globalData.userInfo = result.data[0]
|
||||
wx.setStorageSync('userInfo', result.data[0])
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null,
|
||||
openid:null,
|
||||
wordObject: null,
|
||||
daySentence1: "",
|
||||
daySentence2: "",
|
||||
daySentence3: "",
|
||||
navBarHeight: 0, // 导航栏高度
|
||||
menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
|
||||
menuTop: 0, // 胶囊距底部间距(保持底部间距一致)
|
||||
menuHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
|
||||
books: [
|
||||
{
|
||||
"_id": "CET4Full",
|
||||
"title": "四级大纲词 『CET4+』",
|
||||
"desc": "cet4WordsGrouped",
|
||||
"name": "四级大纲词",
|
||||
"wordsNumber": 4976,
|
||||
"peopleNumber": 0.0,
|
||||
"image": "/image/book-CET4Full.png"
|
||||
},
|
||||
{
|
||||
"_id": "CET6Full",
|
||||
"title": "六级大纲词 『CET6+』",
|
||||
"desc": "cet6WordsGrouped",
|
||||
"name": "六级大纲词",
|
||||
"wordsNumber": 3994,
|
||||
"peopleNumber": 0.0,
|
||||
"image": "/image/book-CET4Full.png"
|
||||
},
|
||||
{
|
||||
"_id": "kaoYanFull",
|
||||
"title": "考研大纲词汇 『考研+』",
|
||||
"desc": "pgeeWordsGrouped",
|
||||
"name": "考研大纲词汇",
|
||||
"wordsNumber": 5058,
|
||||
"peopleNumber": 0.0,
|
||||
"image": "/image/book-CET4Full.png"
|
||||
},
|
||||
|
||||
],
|
||||
value:0,
|
||||
mybook: 0,
|
||||
everydayWord: 10,
|
||||
learnedWord: 0,
|
||||
}
|
||||
})
|
@ -0,0 +1,128 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/Accounting/Accounting",
|
||||
"pages/bill/bill",
|
||||
"pages/user/user",
|
||||
"pages/show/show",
|
||||
"pages/book/book",
|
||||
"pages/English/English",
|
||||
"pages/index/index",
|
||||
"pages/user/function/function",
|
||||
"pages/index/addBook/addBook",
|
||||
"pages/book/newBook/newBook",
|
||||
"pages/book/bookDetail/bookDetail",
|
||||
"pages/book/wordDetail/wordDetail",
|
||||
"pages/book/bookSearch/bookSearch",
|
||||
"pages/book/search/search",
|
||||
"pages/wordDetail/wordDetail",
|
||||
"pages/user/userInfo/userInfo",
|
||||
"pages/user/dlWords/dlWords",
|
||||
"pages/user/showNotice/showNotice",
|
||||
"pages/index/phrases/phrases",
|
||||
"pages/user/accounting/accounting",
|
||||
"pages/user/getWords/getWords",
|
||||
"pages/index/showCET4Words/showCET4Words",
|
||||
"pages/index/showCET6Words/showCET6Words",
|
||||
"pages/index/showPGEEWords/showPGEEWords",
|
||||
"pages/index/book/book",
|
||||
"pages/English/setMyPlan/setMyPlan",
|
||||
"pages/English/review/review",
|
||||
"pages/user/function/lottery/lottery",
|
||||
"pages/user/function/calculator/calculator",
|
||||
"pages/user/function/notes/notes",
|
||||
"pages/user/function/notes/note-detail/note-detail",
|
||||
"pages/English/spell/spell"
|
||||
],
|
||||
"window": {
|
||||
"backgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "bill",
|
||||
"navigationBarBackgroundColor": "#96e3fa"
|
||||
},
|
||||
"usingComponents": {
|
||||
"van-toast": "@vant/weapp/toast/index",
|
||||
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
|
||||
"van-switch": "@vant/weapp/switch/index",
|
||||
"van-index-bar": "@vant/weapp/index-bar/index",
|
||||
"van-index-anchor": "@vant/weapp/index-anchor/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"van-cell-group": "@vant/weapp/cell-group/index",
|
||||
"van-divider": "@vant/weapp/divider/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-grid": "@vant/weapp/grid/index",
|
||||
"van-grid-item": "@vant/weapp/grid-item/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-picker": "@vant/weapp/picker/index",
|
||||
"van-tag": "@vant/weapp/tag/index",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"van-row": "@vant/weapp/row/index",
|
||||
"van-col": "@vant/weapp/col/index",
|
||||
"van-notice-bar": "@vant/weapp/notice-bar/index",
|
||||
"van-checkbox": "@vant/weapp/checkbox/index",
|
||||
"van-checkbox-group": "@vant/weapp/checkbox-group/index",
|
||||
"van-tabbar": "@vant/weapp/tabbar/index",
|
||||
"van-tabbar-item": "@vant/weapp/tabbar-item/index",
|
||||
"van-nav-bar": "@vant/weapp/nav-bar/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-loading": "@vant/weapp/loading/index",
|
||||
"van-overlay": "@vant/weapp/overlay/index",
|
||||
"van-tab": "@vant/weapp/tab/index",
|
||||
"van-tabs": "@vant/weapp/tabs/index",
|
||||
"van-card": "@vant/weapp/card/index",
|
||||
"van-uploader": "@vant/weapp/uploader/index",
|
||||
"van-panel": "@vant/weapp/panel/index",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-collapse": "@vant/weapp/collapse/index",
|
||||
"van-collapse-item": "@vant/weapp/collapse-item/index",
|
||||
"van-radio": "@vant/weapp/radio/index",
|
||||
"van-radio-group": "@vant/weapp/radio-group/index",
|
||||
"van-stepper": "@vant/weapp/stepper/index",
|
||||
"van-steps": "@vant/weapp/steps/index",
|
||||
"van-sidebar": "@vant/weapp/sidebar/index",
|
||||
"van-sidebar-item": "@vant/weapp/sidebar-item/index",
|
||||
"van-search": "@vant/weapp/search/index",
|
||||
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
|
||||
},
|
||||
"componentFramework": "glass-easel",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"lazyCodeLoading": "requiredComponents",
|
||||
"tabBar": {
|
||||
"color": "#8a8a8a",
|
||||
"selectedColor": "#1c1c1c",
|
||||
"backgroundColor": "#ffffff",
|
||||
"borderStyle": "black",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/bill/bill",
|
||||
"text": "账单",
|
||||
"iconPath": "image/bill.png",
|
||||
"selectedIconPath": "image/bill-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/English/English",
|
||||
"text": "复习",
|
||||
"iconPath": "image/book.png",
|
||||
"selectedIconPath": "image/book_yes.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/Accounting/Accounting",
|
||||
"text": "记账",
|
||||
"iconPath": "image/add.png",
|
||||
"selectedIconPath": "image/add-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "词库",
|
||||
"iconPath": "image/english.png",
|
||||
"selectedIconPath": "image/english-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/user/user",
|
||||
"text": "我的",
|
||||
"iconPath": "image/user.png",
|
||||
"selectedIconPath": "image/user-active.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"permissions": {
|
||||
"openapi": [
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
// 云函数入口文件
|
||||
const cloud = require('wx-server-sdk')
|
||||
|
||||
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
|
||||
|
||||
// 云函数入口函数
|
||||
exports.main = async (event, context) => {
|
||||
const db = cloud.database();
|
||||
const { _id, price, note, date, type } = event;
|
||||
|
||||
try {
|
||||
// 选择要更新的表
|
||||
let collection;
|
||||
if (type === '支出') {
|
||||
collection = db.collection('expenses');
|
||||
} else if (type === '收入') {
|
||||
collection = db.collection('income');
|
||||
} else {
|
||||
throw new Error('无效的记录类型');
|
||||
}
|
||||
|
||||
// 执行更新操作
|
||||
const result = await collection.doc(_id).update({
|
||||
data: {
|
||||
price,
|
||||
note,
|
||||
date
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: '记录更新成功',
|
||||
result
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
success: false,
|
||||
message: '记录更新失败',
|
||||
error: error.message
|
||||
};
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,65 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696691, function(require, module, exports) {
|
||||
|
||||
module.exports = asPromise;
|
||||
|
||||
/**
|
||||
* Callback as used by {@link util.asPromise}.
|
||||
* @typedef asPromiseCallback
|
||||
* @type {function}
|
||||
* @param {Error|null} error Error, if any
|
||||
* @param {...*} params Additional arguments
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a promise from a node-style callback function.
|
||||
* @memberof util
|
||||
* @param {asPromiseCallback} fn Function to call
|
||||
* @param {*} ctx Function context
|
||||
* @param {...*} params Function arguments
|
||||
* @returns {Promise<*>} Promisified function
|
||||
*/
|
||||
function asPromise(fn, ctx/*, varargs */) {
|
||||
var params = new Array(arguments.length - 1),
|
||||
offset = 0,
|
||||
index = 2,
|
||||
pending = true;
|
||||
while (index < arguments.length)
|
||||
params[offset++] = arguments[index++];
|
||||
return new Promise(function executor(resolve, reject) {
|
||||
params[offset] = function callback(err/*, varargs */) {
|
||||
if (pending) {
|
||||
pending = false;
|
||||
if (err)
|
||||
reject(err);
|
||||
else {
|
||||
var params = new Array(arguments.length - 1),
|
||||
offset = 0;
|
||||
while (offset < params.length)
|
||||
params[offset++] = arguments[offset];
|
||||
resolve.apply(null, params);
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
fn.apply(ctx || null, params);
|
||||
} catch (err) {
|
||||
if (pending) {
|
||||
pending = false;
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696691);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n"]}
|
@ -0,0 +1,152 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696692, function(require, module, exports) {
|
||||
|
||||
|
||||
/**
|
||||
* A minimal base64 implementation for number arrays.
|
||||
* @memberof util
|
||||
* @namespace
|
||||
*/
|
||||
var base64 = exports;
|
||||
|
||||
/**
|
||||
* Calculates the byte length of a base64 encoded string.
|
||||
* @param {string} string Base64 encoded string
|
||||
* @returns {number} Byte length
|
||||
*/
|
||||
base64.length = function length(string) {
|
||||
var p = string.length;
|
||||
if (!p)
|
||||
return 0;
|
||||
var n = 0;
|
||||
while (--p % 4 > 1 && string.charAt(p) === "=")
|
||||
++n;
|
||||
return Math.ceil(string.length * 3) / 4 - n;
|
||||
};
|
||||
|
||||
// Base64 encoding table
|
||||
var b64 = new Array(64);
|
||||
|
||||
// Base64 decoding table
|
||||
var s64 = new Array(123);
|
||||
|
||||
// 65..90, 97..122, 48..57, 43, 47
|
||||
for (var i = 0; i < 64;)
|
||||
s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
|
||||
|
||||
/**
|
||||
* Encodes a buffer to a base64 encoded string.
|
||||
* @param {Uint8Array} buffer Source buffer
|
||||
* @param {number} start Source start
|
||||
* @param {number} end Source end
|
||||
* @returns {string} Base64 encoded string
|
||||
*/
|
||||
base64.encode = function encode(buffer, start, end) {
|
||||
var parts = null,
|
||||
chunk = [];
|
||||
var i = 0, // output index
|
||||
j = 0, // goto index
|
||||
t; // temporary
|
||||
while (start < end) {
|
||||
var b = buffer[start++];
|
||||
switch (j) {
|
||||
case 0:
|
||||
chunk[i++] = b64[b >> 2];
|
||||
t = (b & 3) << 4;
|
||||
j = 1;
|
||||
break;
|
||||
case 1:
|
||||
chunk[i++] = b64[t | b >> 4];
|
||||
t = (b & 15) << 2;
|
||||
j = 2;
|
||||
break;
|
||||
case 2:
|
||||
chunk[i++] = b64[t | b >> 6];
|
||||
chunk[i++] = b64[b & 63];
|
||||
j = 0;
|
||||
break;
|
||||
}
|
||||
if (i > 8191) {
|
||||
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
if (j) {
|
||||
chunk[i++] = b64[t];
|
||||
chunk[i++] = 61;
|
||||
if (j === 1)
|
||||
chunk[i++] = 61;
|
||||
}
|
||||
if (parts) {
|
||||
if (i)
|
||||
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
||||
return parts.join("");
|
||||
}
|
||||
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
||||
};
|
||||
|
||||
var invalidEncoding = "invalid encoding";
|
||||
|
||||
/**
|
||||
* Decodes a base64 encoded string to a buffer.
|
||||
* @param {string} string Source string
|
||||
* @param {Uint8Array} buffer Destination buffer
|
||||
* @param {number} offset Destination offset
|
||||
* @returns {number} Number of bytes written
|
||||
* @throws {Error} If encoding is invalid
|
||||
*/
|
||||
base64.decode = function decode(string, buffer, offset) {
|
||||
var start = offset;
|
||||
var j = 0, // goto index
|
||||
t; // temporary
|
||||
for (var i = 0; i < string.length;) {
|
||||
var c = string.charCodeAt(i++);
|
||||
if (c === 61 && j > 1)
|
||||
break;
|
||||
if ((c = s64[c]) === undefined)
|
||||
throw Error(invalidEncoding);
|
||||
switch (j) {
|
||||
case 0:
|
||||
t = c;
|
||||
j = 1;
|
||||
break;
|
||||
case 1:
|
||||
buffer[offset++] = t << 2 | (c & 48) >> 4;
|
||||
t = c;
|
||||
j = 2;
|
||||
break;
|
||||
case 2:
|
||||
buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
|
||||
t = c;
|
||||
j = 3;
|
||||
break;
|
||||
case 3:
|
||||
buffer[offset++] = (t & 3) << 6 | c;
|
||||
j = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j === 1)
|
||||
throw Error(invalidEncoding);
|
||||
return offset - start;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests if the specified string appears to be base64 encoded.
|
||||
* @param {string} string String to test
|
||||
* @returns {boolean} `true` if probably base64 encoded, otherwise false
|
||||
*/
|
||||
base64.test = function test(string) {
|
||||
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696692);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,112 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696693, function(require, module, exports) {
|
||||
|
||||
module.exports = codegen;
|
||||
|
||||
/**
|
||||
* Begins generating a function.
|
||||
* @memberof util
|
||||
* @param {string[]} functionParams Function parameter names
|
||||
* @param {string} [functionName] Function name if not anonymous
|
||||
* @returns {Codegen} Appender that appends code to the function's body
|
||||
*/
|
||||
function codegen(functionParams, functionName) {
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (typeof functionParams === "string") {
|
||||
functionName = functionParams;
|
||||
functionParams = undefined;
|
||||
}
|
||||
|
||||
var body = [];
|
||||
|
||||
/**
|
||||
* Appends code to the function's body or finishes generation.
|
||||
* @typedef Codegen
|
||||
* @type {function}
|
||||
* @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
||||
* @param {...*} [formatParams] Format parameters
|
||||
* @returns {Codegen|Function} Itself or the generated function if finished
|
||||
* @throws {Error} If format parameter counts do not match
|
||||
*/
|
||||
|
||||
function Codegen(formatStringOrScope) {
|
||||
// note that explicit array handling below makes this ~50% faster
|
||||
|
||||
// finish the function
|
||||
if (typeof formatStringOrScope !== "string") {
|
||||
var source = toString();
|
||||
if (codegen.verbose)
|
||||
console.log("codegen: " + source); // eslint-disable-line no-console
|
||||
source = "return " + source;
|
||||
if (formatStringOrScope) {
|
||||
var scopeKeys = Object.keys(formatStringOrScope),
|
||||
scopeParams = new Array(scopeKeys.length + 1),
|
||||
scopeValues = new Array(scopeKeys.length),
|
||||
scopeOffset = 0;
|
||||
while (scopeOffset < scopeKeys.length) {
|
||||
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
||||
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
||||
}
|
||||
scopeParams[scopeOffset] = source;
|
||||
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
||||
}
|
||||
return Function(source)(); // eslint-disable-line no-new-func
|
||||
}
|
||||
|
||||
// otherwise append to body
|
||||
var formatParams = new Array(arguments.length - 1),
|
||||
formatOffset = 0;
|
||||
while (formatOffset < formatParams.length)
|
||||
formatParams[formatOffset] = arguments[++formatOffset];
|
||||
formatOffset = 0;
|
||||
formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
|
||||
var value = formatParams[formatOffset++];
|
||||
switch ($1) {
|
||||
case "d": case "f": return String(Number(value));
|
||||
case "i": return String(Math.floor(value));
|
||||
case "j": return JSON.stringify(value);
|
||||
case "s": return String(value);
|
||||
}
|
||||
return "%";
|
||||
});
|
||||
if (formatOffset !== formatParams.length)
|
||||
throw Error("parameter count mismatch");
|
||||
body.push(formatStringOrScope);
|
||||
return Codegen;
|
||||
}
|
||||
|
||||
function toString(functionNameOverride) {
|
||||
return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
|
||||
}
|
||||
|
||||
Codegen.toString = toString;
|
||||
return Codegen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins generating a function.
|
||||
* @memberof util
|
||||
* @function codegen
|
||||
* @param {string} [functionName] Function name if not anonymous
|
||||
* @returns {Codegen} Appender that appends code to the function's body
|
||||
* @variation 2
|
||||
*/
|
||||
|
||||
/**
|
||||
* When set to `true`, codegen will log generated code to console. Useful for debugging.
|
||||
* @name util.codegen.verbose
|
||||
* @type {boolean}
|
||||
*/
|
||||
codegen.verbose = false;
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696693);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\nmodule.exports = codegen;\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @param {string[]} functionParams Function parameter names\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n */\r\nfunction codegen(functionParams, functionName) {\r\n\r\n /* istanbul ignore if */\r\n if (typeof functionParams === \"string\") {\r\n functionName = functionParams;\r\n functionParams = undefined;\r\n }\r\n\r\n var body = [];\r\n\r\n /**\r\n * Appends code to the function's body or finishes generation.\r\n * @typedef Codegen\r\n * @type {function}\r\n * @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any\r\n * @param {...*} [formatParams] Format parameters\r\n * @returns {Codegen|Function} Itself or the generated function if finished\r\n * @throws {Error} If format parameter counts do not match\r\n */\r\n\r\n function Codegen(formatStringOrScope) {\r\n // note that explicit array handling below makes this ~50% faster\r\n\r\n // finish the function\r\n if (typeof formatStringOrScope !== \"string\") {\r\n var source = toString();\r\n if (codegen.verbose)\r\n console.log(\"codegen: \" + source); // eslint-disable-line no-console\r\n source = \"return \" + source;\r\n if (formatStringOrScope) {\r\n var scopeKeys = Object.keys(formatStringOrScope),\r\n scopeParams = new Array(scopeKeys.length + 1),\r\n scopeValues = new Array(scopeKeys.length),\r\n scopeOffset = 0;\r\n while (scopeOffset < scopeKeys.length) {\r\n scopeParams[scopeOffset] = scopeKeys[scopeOffset];\r\n scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];\r\n }\r\n scopeParams[scopeOffset] = source;\r\n return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func\r\n }\r\n return Function(source)(); // eslint-disable-line no-new-func\r\n }\r\n\r\n // otherwise append to body\r\n var formatParams = new Array(arguments.length - 1),\r\n formatOffset = 0;\r\n while (formatOffset < formatParams.length)\r\n formatParams[formatOffset] = arguments[++formatOffset];\r\n formatOffset = 0;\r\n formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {\r\n var value = formatParams[formatOffset++];\r\n switch ($1) {\r\n case \"d\": case \"f\": return String(Number(value));\r\n case \"i\": return String(Math.floor(value));\r\n case \"j\": return JSON.stringify(value);\r\n case \"s\": return String(value);\r\n }\r\n return \"%\";\r\n });\r\n if (formatOffset !== formatParams.length)\r\n throw Error(\"parameter count mismatch\");\r\n body.push(formatStringOrScope);\r\n return Codegen;\r\n }\r\n\r\n function toString(functionNameOverride) {\r\n return \"function \" + (functionNameOverride || functionName || \"\") + \"(\" + (functionParams && functionParams.join(\",\") || \"\") + \"){\\n \" + body.join(\"\\n \") + \"\\n}\";\r\n }\r\n\r\n Codegen.toString = toString;\r\n return Codegen;\r\n}\r\n\r\n/**\r\n * Begins generating a function.\r\n * @memberof util\r\n * @function codegen\r\n * @param {string} [functionName] Function name if not anonymous\r\n * @returns {Codegen} Appender that appends code to the function's body\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * When set to `true`, codegen will log generated code to console. Useful for debugging.\r\n * @name util.codegen.verbose\r\n * @type {boolean}\r\n */\r\ncodegen.verbose = false;\r\n"]}
|
@ -0,0 +1,89 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696694, function(require, module, exports) {
|
||||
|
||||
module.exports = EventEmitter;
|
||||
|
||||
/**
|
||||
* Constructs a new event emitter instance.
|
||||
* @classdesc A minimal event emitter.
|
||||
* @memberof util
|
||||
* @constructor
|
||||
*/
|
||||
function EventEmitter() {
|
||||
|
||||
/**
|
||||
* Registered listeners.
|
||||
* @type {Object.<string,*>}
|
||||
* @private
|
||||
*/
|
||||
this._listeners = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param {string} evt Event name
|
||||
* @param {function} fn Listener
|
||||
* @param {*} [ctx] Listener context
|
||||
* @returns {util.EventEmitter} `this`
|
||||
*/
|
||||
EventEmitter.prototype.on = function on(evt, fn, ctx) {
|
||||
(this._listeners[evt] || (this._listeners[evt] = [])).push({
|
||||
fn : fn,
|
||||
ctx : ctx || this
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes an event listener or any matching listeners if arguments are omitted.
|
||||
* @param {string} [evt] Event name. Removes all listeners if omitted.
|
||||
* @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
|
||||
* @returns {util.EventEmitter} `this`
|
||||
*/
|
||||
EventEmitter.prototype.off = function off(evt, fn) {
|
||||
if (evt === undefined)
|
||||
this._listeners = {};
|
||||
else {
|
||||
if (fn === undefined)
|
||||
this._listeners[evt] = [];
|
||||
else {
|
||||
var listeners = this._listeners[evt];
|
||||
for (var i = 0; i < listeners.length;)
|
||||
if (listeners[i].fn === fn)
|
||||
listeners.splice(i, 1);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emits an event by calling its listeners with the specified arguments.
|
||||
* @param {string} evt Event name
|
||||
* @param {...*} args Arguments
|
||||
* @returns {util.EventEmitter} `this`
|
||||
*/
|
||||
EventEmitter.prototype.emit = function emit(evt) {
|
||||
var listeners = this._listeners[evt];
|
||||
if (listeners) {
|
||||
var args = [],
|
||||
i = 1;
|
||||
for (; i < arguments.length;)
|
||||
args.push(arguments[i++]);
|
||||
for (i = 0; i < listeners.length;)
|
||||
listeners[i].fn.apply(listeners[i++].ctx, args);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696694);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.<string,*>}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n"]}
|
@ -0,0 +1,128 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696695, function(require, module, exports) {
|
||||
|
||||
module.exports = fetch;
|
||||
|
||||
var asPromise = require("@protobufjs/aspromise"),
|
||||
inquire = require("@protobufjs/inquire");
|
||||
|
||||
var fs = inquire("fs");
|
||||
|
||||
/**
|
||||
* Node-style callback as used by {@link util.fetch}.
|
||||
* @typedef FetchCallback
|
||||
* @type {function}
|
||||
* @param {?Error} error Error, if any, otherwise `null`
|
||||
* @param {string} [contents] File contents, if there hasn't been an error
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options as used by {@link util.fetch}.
|
||||
* @typedef FetchOptions
|
||||
* @type {Object}
|
||||
* @property {boolean} [binary=false] Whether expecting a binary response
|
||||
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetches the contents of a file.
|
||||
* @memberof util
|
||||
* @param {string} filename File path or url
|
||||
* @param {FetchOptions} options Fetch options
|
||||
* @param {FetchCallback} callback Callback function
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function fetch(filename, options, callback) {
|
||||
if (typeof options === "function") {
|
||||
callback = options;
|
||||
options = {};
|
||||
} else if (!options)
|
||||
options = {};
|
||||
|
||||
if (!callback)
|
||||
return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
|
||||
|
||||
// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
|
||||
if (!options.xhr && fs && fs.readFile)
|
||||
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
|
||||
return err && typeof XMLHttpRequest !== "undefined"
|
||||
? fetch.xhr(filename, options, callback)
|
||||
: err
|
||||
? callback(err)
|
||||
: callback(null, options.binary ? contents : contents.toString("utf8"));
|
||||
});
|
||||
|
||||
// use the XHR version otherwise.
|
||||
return fetch.xhr(filename, options, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the contents of a file.
|
||||
* @name util.fetch
|
||||
* @function
|
||||
* @param {string} path File path or url
|
||||
* @param {FetchCallback} callback Callback function
|
||||
* @returns {undefined}
|
||||
* @variation 2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetches the contents of a file.
|
||||
* @name util.fetch
|
||||
* @function
|
||||
* @param {string} path File path or url
|
||||
* @param {FetchOptions} [options] Fetch options
|
||||
* @returns {Promise<string|Uint8Array>} Promise
|
||||
* @variation 3
|
||||
*/
|
||||
|
||||
/**/
|
||||
fetch.xhr = function fetch_xhr(filename, options, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
|
||||
|
||||
if (xhr.readyState !== 4)
|
||||
return undefined;
|
||||
|
||||
// local cors security errors return status 0 / empty string, too. afaik this cannot be
|
||||
// reliably distinguished from an actually empty file for security reasons. feel free
|
||||
// to send a pull request if you are aware of a solution.
|
||||
if (xhr.status !== 0 && xhr.status !== 200)
|
||||
return callback(Error("status " + xhr.status));
|
||||
|
||||
// if binary data is expected, make sure that some sort of array is returned, even if
|
||||
// ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
|
||||
if (options.binary) {
|
||||
var buffer = xhr.response;
|
||||
if (!buffer) {
|
||||
buffer = [];
|
||||
for (var i = 0; i < xhr.responseText.length; ++i)
|
||||
buffer.push(xhr.responseText.charCodeAt(i) & 255);
|
||||
}
|
||||
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
|
||||
}
|
||||
return callback(null, xhr.responseText);
|
||||
};
|
||||
|
||||
if (options.binary) {
|
||||
// ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
|
||||
if ("overrideMimeType" in xhr)
|
||||
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
||||
xhr.responseType = "arraybuffer";
|
||||
}
|
||||
|
||||
xhr.open("GET", filename);
|
||||
xhr.send();
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696695);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["@protobufjs/aspromise","@protobufjs/inquire"]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\nmodule.exports = fetch;\r\n\r\nvar asPromise = require(\"@protobufjs/aspromise\"),\r\n inquire = require(\"@protobufjs/inquire\");\r\n\r\nvar fs = inquire(\"fs\");\r\n\r\n/**\r\n * Node-style callback as used by {@link util.fetch}.\r\n * @typedef FetchCallback\r\n * @type {function}\r\n * @param {?Error} error Error, if any, otherwise `null`\r\n * @param {string} [contents] File contents, if there hasn't been an error\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Options as used by {@link util.fetch}.\r\n * @typedef FetchOptions\r\n * @type {Object}\r\n * @property {boolean} [binary=false] Whether expecting a binary response\r\n * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @memberof util\r\n * @param {string} filename File path or url\r\n * @param {FetchOptions} options Fetch options\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n */\r\nfunction fetch(filename, options, callback) {\r\n if (typeof options === \"function\") {\r\n callback = options;\r\n options = {};\r\n } else if (!options)\r\n options = {};\r\n\r\n if (!callback)\r\n return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this\r\n\r\n // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.\r\n if (!options.xhr && fs && fs.readFile)\r\n return fs.readFile(filename, function fetchReadFileCallback(err, contents) {\r\n return err && typeof XMLHttpRequest !== \"undefined\"\r\n ? fetch.xhr(filename, options, callback)\r\n : err\r\n ? callback(err)\r\n : callback(null, options.binary ? contents : contents.toString(\"utf8\"));\r\n });\r\n\r\n // use the XHR version otherwise.\r\n return fetch.xhr(filename, options, callback);\r\n}\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchCallback} callback Callback function\r\n * @returns {undefined}\r\n * @variation 2\r\n */\r\n\r\n/**\r\n * Fetches the contents of a file.\r\n * @name util.fetch\r\n * @function\r\n * @param {string} path File path or url\r\n * @param {FetchOptions} [options] Fetch options\r\n * @returns {Promise<string|Uint8Array>} Promise\r\n * @variation 3\r\n */\r\n\r\n/**/\r\nfetch.xhr = function fetch_xhr(filename, options, callback) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {\r\n\r\n if (xhr.readyState !== 4)\r\n return undefined;\r\n\r\n // local cors security errors return status 0 / empty string, too. afaik this cannot be\r\n // reliably distinguished from an actually empty file for security reasons. feel free\r\n // to send a pull request if you are aware of a solution.\r\n if (xhr.status !== 0 && xhr.status !== 200)\r\n return callback(Error(\"status \" + xhr.status));\r\n\r\n // if binary data is expected, make sure that some sort of array is returned, even if\r\n // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.\r\n if (options.binary) {\r\n var buffer = xhr.response;\r\n if (!buffer) {\r\n buffer = [];\r\n for (var i = 0; i < xhr.responseText.length; ++i)\r\n buffer.push(xhr.responseText.charCodeAt(i) & 255);\r\n }\r\n return callback(null, typeof Uint8Array !== \"undefined\" ? new Uint8Array(buffer) : buffer);\r\n }\r\n return callback(null, xhr.responseText);\r\n };\r\n\r\n if (options.binary) {\r\n // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers\r\n if (\"overrideMimeType\" in xhr)\r\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n xhr.open(\"GET\", filename);\r\n xhr.send();\r\n};\r\n"]}
|
@ -0,0 +1,348 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696696, function(require, module, exports) {
|
||||
|
||||
|
||||
module.exports = factory(factory);
|
||||
|
||||
/**
|
||||
* Reads / writes floats / doubles from / to buffers.
|
||||
* @name util.float
|
||||
* @namespace
|
||||
*/
|
||||
|
||||
/**
|
||||
* Writes a 32 bit float to a buffer using little endian byte order.
|
||||
* @name util.float.writeFloatLE
|
||||
* @function
|
||||
* @param {number} val Value to write
|
||||
* @param {Uint8Array} buf Target buffer
|
||||
* @param {number} pos Target buffer offset
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Writes a 32 bit float to a buffer using big endian byte order.
|
||||
* @name util.float.writeFloatBE
|
||||
* @function
|
||||
* @param {number} val Value to write
|
||||
* @param {Uint8Array} buf Target buffer
|
||||
* @param {number} pos Target buffer offset
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reads a 32 bit float from a buffer using little endian byte order.
|
||||
* @name util.float.readFloatLE
|
||||
* @function
|
||||
* @param {Uint8Array} buf Source buffer
|
||||
* @param {number} pos Source buffer offset
|
||||
* @returns {number} Value read
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reads a 32 bit float from a buffer using big endian byte order.
|
||||
* @name util.float.readFloatBE
|
||||
* @function
|
||||
* @param {Uint8Array} buf Source buffer
|
||||
* @param {number} pos Source buffer offset
|
||||
* @returns {number} Value read
|
||||
*/
|
||||
|
||||
/**
|
||||
* Writes a 64 bit double to a buffer using little endian byte order.
|
||||
* @name util.float.writeDoubleLE
|
||||
* @function
|
||||
* @param {number} val Value to write
|
||||
* @param {Uint8Array} buf Target buffer
|
||||
* @param {number} pos Target buffer offset
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Writes a 64 bit double to a buffer using big endian byte order.
|
||||
* @name util.float.writeDoubleBE
|
||||
* @function
|
||||
* @param {number} val Value to write
|
||||
* @param {Uint8Array} buf Target buffer
|
||||
* @param {number} pos Target buffer offset
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reads a 64 bit double from a buffer using little endian byte order.
|
||||
* @name util.float.readDoubleLE
|
||||
* @function
|
||||
* @param {Uint8Array} buf Source buffer
|
||||
* @param {number} pos Source buffer offset
|
||||
* @returns {number} Value read
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reads a 64 bit double from a buffer using big endian byte order.
|
||||
* @name util.float.readDoubleBE
|
||||
* @function
|
||||
* @param {Uint8Array} buf Source buffer
|
||||
* @param {number} pos Source buffer offset
|
||||
* @returns {number} Value read
|
||||
*/
|
||||
|
||||
// Factory function for the purpose of node-based testing in modified global environments
|
||||
function factory(exports) {
|
||||
|
||||
// float: typed array
|
||||
if (typeof Float32Array !== "undefined") (function() {
|
||||
|
||||
var f32 = new Float32Array([ -0 ]),
|
||||
f8b = new Uint8Array(f32.buffer),
|
||||
le = f8b[3] === 128;
|
||||
|
||||
function writeFloat_f32_cpy(val, buf, pos) {
|
||||
f32[0] = val;
|
||||
buf[pos ] = f8b[0];
|
||||
buf[pos + 1] = f8b[1];
|
||||
buf[pos + 2] = f8b[2];
|
||||
buf[pos + 3] = f8b[3];
|
||||
}
|
||||
|
||||
function writeFloat_f32_rev(val, buf, pos) {
|
||||
f32[0] = val;
|
||||
buf[pos ] = f8b[3];
|
||||
buf[pos + 1] = f8b[2];
|
||||
buf[pos + 2] = f8b[1];
|
||||
buf[pos + 3] = f8b[0];
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
|
||||
/* istanbul ignore next */
|
||||
exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
|
||||
|
||||
function readFloat_f32_cpy(buf, pos) {
|
||||
f8b[0] = buf[pos ];
|
||||
f8b[1] = buf[pos + 1];
|
||||
f8b[2] = buf[pos + 2];
|
||||
f8b[3] = buf[pos + 3];
|
||||
return f32[0];
|
||||
}
|
||||
|
||||
function readFloat_f32_rev(buf, pos) {
|
||||
f8b[3] = buf[pos ];
|
||||
f8b[2] = buf[pos + 1];
|
||||
f8b[1] = buf[pos + 2];
|
||||
f8b[0] = buf[pos + 3];
|
||||
return f32[0];
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
|
||||
/* istanbul ignore next */
|
||||
exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
|
||||
|
||||
// float: ieee754
|
||||
})(); else (function() {
|
||||
|
||||
function writeFloat_ieee754(writeUint, val, buf, pos) {
|
||||
var sign = val < 0 ? 1 : 0;
|
||||
if (sign)
|
||||
val = -val;
|
||||
if (val === 0)
|
||||
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);
|
||||
else if (isNaN(val))
|
||||
writeUint(2143289344, buf, pos);
|
||||
else if (val > 3.4028234663852886e+38) // +-Infinity
|
||||
writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
|
||||
else if (val < 1.1754943508222875e-38) // denormal
|
||||
writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);
|
||||
else {
|
||||
var exponent = Math.floor(Math.log(val) / Math.LN2),
|
||||
mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
|
||||
writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
|
||||
}
|
||||
}
|
||||
|
||||
exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
|
||||
exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
|
||||
|
||||
function readFloat_ieee754(readUint, buf, pos) {
|
||||
var uint = readUint(buf, pos),
|
||||
sign = (uint >> 31) * 2 + 1,
|
||||
exponent = uint >>> 23 & 255,
|
||||
mantissa = uint & 8388607;
|
||||
return exponent === 255
|
||||
? mantissa
|
||||
? NaN
|
||||
: sign * Infinity
|
||||
: exponent === 0 // denormal
|
||||
? sign * 1.401298464324817e-45 * mantissa
|
||||
: sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
|
||||
}
|
||||
|
||||
exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
|
||||
exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
|
||||
|
||||
})();
|
||||
|
||||
// double: typed array
|
||||
if (typeof Float64Array !== "undefined") (function() {
|
||||
|
||||
var f64 = new Float64Array([-0]),
|
||||
f8b = new Uint8Array(f64.buffer),
|
||||
le = f8b[7] === 128;
|
||||
|
||||
function writeDouble_f64_cpy(val, buf, pos) {
|
||||
f64[0] = val;
|
||||
buf[pos ] = f8b[0];
|
||||
buf[pos + 1] = f8b[1];
|
||||
buf[pos + 2] = f8b[2];
|
||||
buf[pos + 3] = f8b[3];
|
||||
buf[pos + 4] = f8b[4];
|
||||
buf[pos + 5] = f8b[5];
|
||||
buf[pos + 6] = f8b[6];
|
||||
buf[pos + 7] = f8b[7];
|
||||
}
|
||||
|
||||
function writeDouble_f64_rev(val, buf, pos) {
|
||||
f64[0] = val;
|
||||
buf[pos ] = f8b[7];
|
||||
buf[pos + 1] = f8b[6];
|
||||
buf[pos + 2] = f8b[5];
|
||||
buf[pos + 3] = f8b[4];
|
||||
buf[pos + 4] = f8b[3];
|
||||
buf[pos + 5] = f8b[2];
|
||||
buf[pos + 6] = f8b[1];
|
||||
buf[pos + 7] = f8b[0];
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
|
||||
/* istanbul ignore next */
|
||||
exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
|
||||
|
||||
function readDouble_f64_cpy(buf, pos) {
|
||||
f8b[0] = buf[pos ];
|
||||
f8b[1] = buf[pos + 1];
|
||||
f8b[2] = buf[pos + 2];
|
||||
f8b[3] = buf[pos + 3];
|
||||
f8b[4] = buf[pos + 4];
|
||||
f8b[5] = buf[pos + 5];
|
||||
f8b[6] = buf[pos + 6];
|
||||
f8b[7] = buf[pos + 7];
|
||||
return f64[0];
|
||||
}
|
||||
|
||||
function readDouble_f64_rev(buf, pos) {
|
||||
f8b[7] = buf[pos ];
|
||||
f8b[6] = buf[pos + 1];
|
||||
f8b[5] = buf[pos + 2];
|
||||
f8b[4] = buf[pos + 3];
|
||||
f8b[3] = buf[pos + 4];
|
||||
f8b[2] = buf[pos + 5];
|
||||
f8b[1] = buf[pos + 6];
|
||||
f8b[0] = buf[pos + 7];
|
||||
return f64[0];
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
|
||||
/* istanbul ignore next */
|
||||
exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
|
||||
|
||||
// double: ieee754
|
||||
})(); else (function() {
|
||||
|
||||
function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
|
||||
var sign = val < 0 ? 1 : 0;
|
||||
if (sign)
|
||||
val = -val;
|
||||
if (val === 0) {
|
||||
writeUint(0, buf, pos + off0);
|
||||
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);
|
||||
} else if (isNaN(val)) {
|
||||
writeUint(0, buf, pos + off0);
|
||||
writeUint(2146959360, buf, pos + off1);
|
||||
} else if (val > 1.7976931348623157e+308) { // +-Infinity
|
||||
writeUint(0, buf, pos + off0);
|
||||
writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
|
||||
} else {
|
||||
var mantissa;
|
||||
if (val < 2.2250738585072014e-308) { // denormal
|
||||
mantissa = val / 5e-324;
|
||||
writeUint(mantissa >>> 0, buf, pos + off0);
|
||||
writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
|
||||
} else {
|
||||
var exponent = Math.floor(Math.log(val) / Math.LN2);
|
||||
if (exponent === 1024)
|
||||
exponent = 1023;
|
||||
mantissa = val * Math.pow(2, -exponent);
|
||||
writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
|
||||
writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
|
||||
exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
|
||||
|
||||
function readDouble_ieee754(readUint, off0, off1, buf, pos) {
|
||||
var lo = readUint(buf, pos + off0),
|
||||
hi = readUint(buf, pos + off1);
|
||||
var sign = (hi >> 31) * 2 + 1,
|
||||
exponent = hi >>> 20 & 2047,
|
||||
mantissa = 4294967296 * (hi & 1048575) + lo;
|
||||
return exponent === 2047
|
||||
? mantissa
|
||||
? NaN
|
||||
: sign * Infinity
|
||||
: exponent === 0 // denormal
|
||||
? sign * 5e-324 * mantissa
|
||||
: sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
|
||||
}
|
||||
|
||||
exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
|
||||
exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
|
||||
|
||||
})();
|
||||
|
||||
return exports;
|
||||
}
|
||||
|
||||
// uint helpers
|
||||
|
||||
function writeUintLE(val, buf, pos) {
|
||||
buf[pos ] = val & 255;
|
||||
buf[pos + 1] = val >>> 8 & 255;
|
||||
buf[pos + 2] = val >>> 16 & 255;
|
||||
buf[pos + 3] = val >>> 24;
|
||||
}
|
||||
|
||||
function writeUintBE(val, buf, pos) {
|
||||
buf[pos ] = val >>> 24;
|
||||
buf[pos + 1] = val >>> 16 & 255;
|
||||
buf[pos + 2] = val >>> 8 & 255;
|
||||
buf[pos + 3] = val & 255;
|
||||
}
|
||||
|
||||
function readUintLE(buf, pos) {
|
||||
return (buf[pos ]
|
||||
| buf[pos + 1] << 8
|
||||
| buf[pos + 2] << 16
|
||||
| buf[pos + 3] << 24) >>> 0;
|
||||
}
|
||||
|
||||
function readUintBE(buf, pos) {
|
||||
return (buf[pos ] << 24
|
||||
| buf[pos + 1] << 16
|
||||
| buf[pos + 2] << 8
|
||||
| buf[pos + 3]) >>> 0;
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696696);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,30 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696697, function(require, module, exports) {
|
||||
|
||||
module.exports = inquire;
|
||||
|
||||
/**
|
||||
* Requires a module only if available.
|
||||
* @memberof util
|
||||
* @param {string} moduleName Module to require
|
||||
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
||||
*/
|
||||
function inquire(moduleName) {
|
||||
try {
|
||||
var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
|
||||
if (mod && (mod.length || Object.keys(mod).length))
|
||||
return mod;
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
return null;
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696697);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n"]}
|
@ -0,0 +1,78 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696698, function(require, module, exports) {
|
||||
|
||||
|
||||
/**
|
||||
* A minimal path module to resolve Unix, Windows and URL paths alike.
|
||||
* @memberof util
|
||||
* @namespace
|
||||
*/
|
||||
var path = exports;
|
||||
|
||||
var isAbsolute =
|
||||
/**
|
||||
* Tests if the specified path is absolute.
|
||||
* @param {string} path Path to test
|
||||
* @returns {boolean} `true` if path is absolute
|
||||
*/
|
||||
path.isAbsolute = function isAbsolute(path) {
|
||||
return /^(?:\/|\w+:)/.test(path);
|
||||
};
|
||||
|
||||
var normalize =
|
||||
/**
|
||||
* Normalizes the specified path.
|
||||
* @param {string} path Path to normalize
|
||||
* @returns {string} Normalized path
|
||||
*/
|
||||
path.normalize = function normalize(path) {
|
||||
path = path.replace(/\\/g, "/")
|
||||
.replace(/\/{2,}/g, "/");
|
||||
var parts = path.split("/"),
|
||||
absolute = isAbsolute(path),
|
||||
prefix = "";
|
||||
if (absolute)
|
||||
prefix = parts.shift() + "/";
|
||||
for (var i = 0; i < parts.length;) {
|
||||
if (parts[i] === "..") {
|
||||
if (i > 0 && parts[i - 1] !== "..")
|
||||
parts.splice(--i, 2);
|
||||
else if (absolute)
|
||||
parts.splice(i, 1);
|
||||
else
|
||||
++i;
|
||||
} else if (parts[i] === ".")
|
||||
parts.splice(i, 1);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
return prefix + parts.join("/");
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves the specified include path against the specified origin path.
|
||||
* @param {string} originPath Path to the origin file
|
||||
* @param {string} includePath Include path relative to origin path
|
||||
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
||||
* @returns {string} Path to the include file
|
||||
*/
|
||||
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
||||
if (!alreadyNormalized)
|
||||
includePath = normalize(includePath);
|
||||
if (isAbsolute(includePath))
|
||||
return includePath;
|
||||
if (!alreadyNormalized)
|
||||
originPath = normalize(originPath);
|
||||
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696698);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\n/**\r\n * A minimal path module to resolve Unix, Windows and URL paths alike.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar path = exports;\r\n\r\nvar isAbsolute =\r\n/**\r\n * Tests if the specified path is absolute.\r\n * @param {string} path Path to test\r\n * @returns {boolean} `true` if path is absolute\r\n */\r\npath.isAbsolute = function isAbsolute(path) {\r\n return /^(?:\\/|\\w+:)/.test(path);\r\n};\r\n\r\nvar normalize =\r\n/**\r\n * Normalizes the specified path.\r\n * @param {string} path Path to normalize\r\n * @returns {string} Normalized path\r\n */\r\npath.normalize = function normalize(path) {\r\n path = path.replace(/\\\\/g, \"/\")\r\n .replace(/\\/{2,}/g, \"/\");\r\n var parts = path.split(\"/\"),\r\n absolute = isAbsolute(path),\r\n prefix = \"\";\r\n if (absolute)\r\n prefix = parts.shift() + \"/\";\r\n for (var i = 0; i < parts.length;) {\r\n if (parts[i] === \"..\") {\r\n if (i > 0 && parts[i - 1] !== \"..\")\r\n parts.splice(--i, 2);\r\n else if (absolute)\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n } else if (parts[i] === \".\")\r\n parts.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n return prefix + parts.join(\"/\");\r\n};\r\n\r\n/**\r\n * Resolves the specified include path against the specified origin path.\r\n * @param {string} originPath Path to the origin file\r\n * @param {string} includePath Include path relative to origin path\r\n * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized\r\n * @returns {string} Path to the include file\r\n */\r\npath.resolve = function resolve(originPath, includePath, alreadyNormalized) {\r\n if (!alreadyNormalized)\r\n includePath = normalize(includePath);\r\n if (isAbsolute(includePath))\r\n return includePath;\r\n if (!alreadyNormalized)\r\n originPath = normalize(originPath);\r\n return (originPath = originPath.replace(/(?:\\/|^)[^/]+$/, \"\")).length ? normalize(originPath + \"/\" + includePath) : includePath;\r\n};\r\n"]}
|
@ -0,0 +1,61 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696699, function(require, module, exports) {
|
||||
|
||||
module.exports = pool;
|
||||
|
||||
/**
|
||||
* An allocator as used by {@link util.pool}.
|
||||
* @typedef PoolAllocator
|
||||
* @type {function}
|
||||
* @param {number} size Buffer size
|
||||
* @returns {Uint8Array} Buffer
|
||||
*/
|
||||
|
||||
/**
|
||||
* A slicer as used by {@link util.pool}.
|
||||
* @typedef PoolSlicer
|
||||
* @type {function}
|
||||
* @param {number} start Start offset
|
||||
* @param {number} end End offset
|
||||
* @returns {Uint8Array} Buffer slice
|
||||
* @this {Uint8Array}
|
||||
*/
|
||||
|
||||
/**
|
||||
* A general purpose buffer pool.
|
||||
* @memberof util
|
||||
* @function
|
||||
* @param {PoolAllocator} alloc Allocator
|
||||
* @param {PoolSlicer} slice Slicer
|
||||
* @param {number} [size=8192] Slab size
|
||||
* @returns {PoolAllocator} Pooled allocator
|
||||
*/
|
||||
function pool(alloc, slice, size) {
|
||||
var SIZE = size || 8192;
|
||||
var MAX = SIZE >>> 1;
|
||||
var slab = null;
|
||||
var offset = SIZE;
|
||||
return function pool_alloc(size) {
|
||||
if (size < 1 || size > MAX)
|
||||
return alloc(size);
|
||||
if (offset + size > SIZE) {
|
||||
slab = alloc(SIZE);
|
||||
offset = 0;
|
||||
}
|
||||
var buf = slice.call(slab, offset, offset += size);
|
||||
if (offset & 7) // align to 32 bit
|
||||
offset = (offset | 7) + 1;
|
||||
return buf;
|
||||
};
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696699);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n"]}
|
@ -0,0 +1,118 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696700, function(require, module, exports) {
|
||||
|
||||
|
||||
/**
|
||||
* A minimal UTF8 implementation for number arrays.
|
||||
* @memberof util
|
||||
* @namespace
|
||||
*/
|
||||
var utf8 = exports;
|
||||
|
||||
/**
|
||||
* Calculates the UTF8 byte length of a string.
|
||||
* @param {string} string String
|
||||
* @returns {number} Byte length
|
||||
*/
|
||||
utf8.length = function utf8_length(string) {
|
||||
var len = 0,
|
||||
c = 0;
|
||||
for (var i = 0; i < string.length; ++i) {
|
||||
c = string.charCodeAt(i);
|
||||
if (c < 128)
|
||||
len += 1;
|
||||
else if (c < 2048)
|
||||
len += 2;
|
||||
else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
|
||||
++i;
|
||||
len += 4;
|
||||
} else
|
||||
len += 3;
|
||||
}
|
||||
return len;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reads UTF8 bytes as a string.
|
||||
* @param {Uint8Array} buffer Source buffer
|
||||
* @param {number} start Source start
|
||||
* @param {number} end Source end
|
||||
* @returns {string} String read
|
||||
*/
|
||||
utf8.read = function utf8_read(buffer, start, end) {
|
||||
var len = end - start;
|
||||
if (len < 1)
|
||||
return "";
|
||||
var parts = null,
|
||||
chunk = [],
|
||||
i = 0, // char offset
|
||||
t; // temporary
|
||||
while (start < end) {
|
||||
t = buffer[start++];
|
||||
if (t < 128)
|
||||
chunk[i++] = t;
|
||||
else if (t > 191 && t < 224)
|
||||
chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
|
||||
else if (t > 239 && t < 365) {
|
||||
t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
|
||||
chunk[i++] = 0xD800 + (t >> 10);
|
||||
chunk[i++] = 0xDC00 + (t & 1023);
|
||||
} else
|
||||
chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
|
||||
if (i > 8191) {
|
||||
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
if (parts) {
|
||||
if (i)
|
||||
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
||||
return parts.join("");
|
||||
}
|
||||
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes a string as UTF8 bytes.
|
||||
* @param {string} string Source string
|
||||
* @param {Uint8Array} buffer Destination buffer
|
||||
* @param {number} offset Destination offset
|
||||
* @returns {number} Bytes written
|
||||
*/
|
||||
utf8.write = function utf8_write(string, buffer, offset) {
|
||||
var start = offset,
|
||||
c1, // character 1
|
||||
c2; // character 2
|
||||
for (var i = 0; i < string.length; ++i) {
|
||||
c1 = string.charCodeAt(i);
|
||||
if (c1 < 128) {
|
||||
buffer[offset++] = c1;
|
||||
} else if (c1 < 2048) {
|
||||
buffer[offset++] = c1 >> 6 | 192;
|
||||
buffer[offset++] = c1 & 63 | 128;
|
||||
} else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
|
||||
c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
|
||||
++i;
|
||||
buffer[offset++] = c1 >> 18 | 240;
|
||||
buffer[offset++] = c1 >> 12 & 63 | 128;
|
||||
buffer[offset++] = c1 >> 6 & 63 | 128;
|
||||
buffer[offset++] = c1 & 63 | 128;
|
||||
} else {
|
||||
buffer[offset++] = c1 >> 12 | 224;
|
||||
buffer[offset++] = c1 >> 6 & 63 | 128;
|
||||
buffer[offset++] = c1 & 63 | 128;
|
||||
}
|
||||
}
|
||||
return offset - start;
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696700);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n"]}
|
@ -0,0 +1,494 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696701, function(require, module, exports) {
|
||||
|
||||
|
||||
module.exports = require('./lib/agent');
|
||||
module.exports.HttpsAgent = require('./lib/https_agent');
|
||||
module.exports.constants = require('./lib/constants');
|
||||
|
||||
}, function(modId) {var map = {"./lib/agent":1733997696702,"./lib/https_agent":1733997696704,"./lib/constants":1733997696703}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696702, function(require, module, exports) {
|
||||
|
||||
|
||||
const OriginalAgent = require('http').Agent;
|
||||
const ms = require('humanize-ms');
|
||||
const debug = require('util').debuglog('agentkeepalive');
|
||||
const {
|
||||
INIT_SOCKET,
|
||||
CURRENT_ID,
|
||||
CREATE_ID,
|
||||
SOCKET_CREATED_TIME,
|
||||
SOCKET_NAME,
|
||||
SOCKET_REQUEST_COUNT,
|
||||
SOCKET_REQUEST_FINISHED_COUNT,
|
||||
} = require('./constants');
|
||||
|
||||
// OriginalAgent come from
|
||||
// - https://github.com/nodejs/node/blob/v8.12.0/lib/_http_agent.js
|
||||
// - https://github.com/nodejs/node/blob/v10.12.0/lib/_http_agent.js
|
||||
|
||||
// node <= 10
|
||||
let defaultTimeoutListenerCount = 1;
|
||||
const majorVersion = parseInt(process.version.split('.', 1)[0].substring(1));
|
||||
if (majorVersion >= 11 && majorVersion <= 12) {
|
||||
defaultTimeoutListenerCount = 2;
|
||||
} else if (majorVersion >= 13) {
|
||||
defaultTimeoutListenerCount = 3;
|
||||
}
|
||||
|
||||
function deprecate(message) {
|
||||
console.log('[agentkeepalive:deprecated] %s', message);
|
||||
}
|
||||
|
||||
class Agent extends OriginalAgent {
|
||||
constructor(options) {
|
||||
options = options || {};
|
||||
options.keepAlive = options.keepAlive !== false;
|
||||
// default is keep-alive and 4s free socket timeout
|
||||
// see https://medium.com/ssense-tech/reduce-networking-errors-in-nodejs-23b4eb9f2d83
|
||||
if (options.freeSocketTimeout === undefined) {
|
||||
options.freeSocketTimeout = 4000;
|
||||
}
|
||||
// Legacy API: keepAliveTimeout should be rename to `freeSocketTimeout`
|
||||
if (options.keepAliveTimeout) {
|
||||
deprecate('options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead');
|
||||
options.freeSocketTimeout = options.keepAliveTimeout;
|
||||
delete options.keepAliveTimeout;
|
||||
}
|
||||
// Legacy API: freeSocketKeepAliveTimeout should be rename to `freeSocketTimeout`
|
||||
if (options.freeSocketKeepAliveTimeout) {
|
||||
deprecate('options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead');
|
||||
options.freeSocketTimeout = options.freeSocketKeepAliveTimeout;
|
||||
delete options.freeSocketKeepAliveTimeout;
|
||||
}
|
||||
|
||||
// Sets the socket to timeout after timeout milliseconds of inactivity on the socket.
|
||||
// By default is double free socket timeout.
|
||||
if (options.timeout === undefined) {
|
||||
// make sure socket default inactivity timeout >= 8s
|
||||
options.timeout = Math.max(options.freeSocketTimeout * 2, 8000);
|
||||
}
|
||||
|
||||
// support humanize format
|
||||
options.timeout = ms(options.timeout);
|
||||
options.freeSocketTimeout = ms(options.freeSocketTimeout);
|
||||
options.socketActiveTTL = options.socketActiveTTL ? ms(options.socketActiveTTL) : 0;
|
||||
|
||||
super(options);
|
||||
|
||||
this[CURRENT_ID] = 0;
|
||||
|
||||
// create socket success counter
|
||||
this.createSocketCount = 0;
|
||||
this.createSocketCountLastCheck = 0;
|
||||
|
||||
this.createSocketErrorCount = 0;
|
||||
this.createSocketErrorCountLastCheck = 0;
|
||||
|
||||
this.closeSocketCount = 0;
|
||||
this.closeSocketCountLastCheck = 0;
|
||||
|
||||
// socket error event count
|
||||
this.errorSocketCount = 0;
|
||||
this.errorSocketCountLastCheck = 0;
|
||||
|
||||
// request finished counter
|
||||
this.requestCount = 0;
|
||||
this.requestCountLastCheck = 0;
|
||||
|
||||
// including free socket timeout counter
|
||||
this.timeoutSocketCount = 0;
|
||||
this.timeoutSocketCountLastCheck = 0;
|
||||
|
||||
this.on('free', socket => {
|
||||
// https://github.com/nodejs/node/pull/32000
|
||||
// Node.js native agent will check socket timeout eqs agent.options.timeout.
|
||||
// Use the ttl or freeSocketTimeout to overwrite.
|
||||
const timeout = this.calcSocketTimeout(socket);
|
||||
if (timeout > 0 && socket.timeout !== timeout) {
|
||||
socket.setTimeout(timeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get freeSocketKeepAliveTimeout() {
|
||||
deprecate('agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead');
|
||||
return this.options.freeSocketTimeout;
|
||||
}
|
||||
|
||||
get timeout() {
|
||||
deprecate('agent.timeout is deprecated, please use agent.options.timeout instead');
|
||||
return this.options.timeout;
|
||||
}
|
||||
|
||||
get socketActiveTTL() {
|
||||
deprecate('agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead');
|
||||
return this.options.socketActiveTTL;
|
||||
}
|
||||
|
||||
calcSocketTimeout(socket) {
|
||||
/**
|
||||
* return <= 0: should free socket
|
||||
* return > 0: should update socket timeout
|
||||
* return undefined: not find custom timeout
|
||||
*/
|
||||
let freeSocketTimeout = this.options.freeSocketTimeout;
|
||||
const socketActiveTTL = this.options.socketActiveTTL;
|
||||
if (socketActiveTTL) {
|
||||
// check socketActiveTTL
|
||||
const aliveTime = Date.now() - socket[SOCKET_CREATED_TIME];
|
||||
const diff = socketActiveTTL - aliveTime;
|
||||
if (diff <= 0) {
|
||||
return diff;
|
||||
}
|
||||
if (freeSocketTimeout && diff < freeSocketTimeout) {
|
||||
freeSocketTimeout = diff;
|
||||
}
|
||||
}
|
||||
// set freeSocketTimeout
|
||||
if (freeSocketTimeout) {
|
||||
// set free keepalive timer
|
||||
// try to use socket custom freeSocketTimeout first, support headers['keep-alive']
|
||||
// https://github.com/node-modules/urllib/blob/b76053020923f4d99a1c93cf2e16e0c5ba10bacf/lib/urllib.js#L498
|
||||
const customFreeSocketTimeout = socket.freeSocketTimeout || socket.freeSocketKeepAliveTimeout;
|
||||
return customFreeSocketTimeout || freeSocketTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
keepSocketAlive(socket) {
|
||||
const result = super.keepSocketAlive(socket);
|
||||
// should not keepAlive, do nothing
|
||||
if (!result) return result;
|
||||
|
||||
const customTimeout = this.calcSocketTimeout(socket);
|
||||
if (typeof customTimeout === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
if (customTimeout <= 0) {
|
||||
debug('%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s',
|
||||
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT], customTimeout);
|
||||
return false;
|
||||
}
|
||||
if (socket.timeout !== customTimeout) {
|
||||
socket.setTimeout(customTimeout);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// only call on addRequest
|
||||
reuseSocket(...args) {
|
||||
// reuseSocket(socket, req)
|
||||
super.reuseSocket(...args);
|
||||
const socket = args[0];
|
||||
const req = args[1];
|
||||
req.reusedSocket = true;
|
||||
const agentTimeout = this.options.timeout;
|
||||
if (getSocketTimeout(socket) !== agentTimeout) {
|
||||
// reset timeout before use
|
||||
socket.setTimeout(agentTimeout);
|
||||
debug('%s reset timeout to %sms', socket[SOCKET_NAME], agentTimeout);
|
||||
}
|
||||
socket[SOCKET_REQUEST_COUNT]++;
|
||||
debug('%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms',
|
||||
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT],
|
||||
getSocketTimeout(socket));
|
||||
}
|
||||
|
||||
[CREATE_ID]() {
|
||||
const id = this[CURRENT_ID]++;
|
||||
if (this[CURRENT_ID] === Number.MAX_SAFE_INTEGER) this[CURRENT_ID] = 0;
|
||||
return id;
|
||||
}
|
||||
|
||||
[INIT_SOCKET](socket, options) {
|
||||
// bugfix here.
|
||||
// https on node 8, 10 won't set agent.options.timeout by default
|
||||
// TODO: need to fix on node itself
|
||||
if (options.timeout) {
|
||||
const timeout = getSocketTimeout(socket);
|
||||
if (!timeout) {
|
||||
socket.setTimeout(options.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.keepAlive) {
|
||||
// Disable Nagle's algorithm: http://blog.caustik.com/2012/04/08/scaling-node-js-to-100k-concurrent-connections/
|
||||
// https://fengmk2.com/benchmark/nagle-algorithm-delayed-ack-mock.html
|
||||
socket.setNoDelay(true);
|
||||
}
|
||||
this.createSocketCount++;
|
||||
if (this.options.socketActiveTTL) {
|
||||
socket[SOCKET_CREATED_TIME] = Date.now();
|
||||
}
|
||||
// don't show the hole '-----BEGIN CERTIFICATE----' key string
|
||||
socket[SOCKET_NAME] = `sock[${this[CREATE_ID]()}#${options._agentKey}]`.split('-----BEGIN', 1)[0];
|
||||
socket[SOCKET_REQUEST_COUNT] = 1;
|
||||
socket[SOCKET_REQUEST_FINISHED_COUNT] = 0;
|
||||
installListeners(this, socket, options);
|
||||
}
|
||||
|
||||
createConnection(options, oncreate) {
|
||||
let called = false;
|
||||
const onNewCreate = (err, socket) => {
|
||||
if (called) return;
|
||||
called = true;
|
||||
|
||||
if (err) {
|
||||
this.createSocketErrorCount++;
|
||||
return oncreate(err);
|
||||
}
|
||||
this[INIT_SOCKET](socket, options);
|
||||
oncreate(err, socket);
|
||||
};
|
||||
|
||||
const newSocket = super.createConnection(options, onNewCreate);
|
||||
if (newSocket) onNewCreate(null, newSocket);
|
||||
return newSocket;
|
||||
}
|
||||
|
||||
get statusChanged() {
|
||||
const changed = this.createSocketCount !== this.createSocketCountLastCheck ||
|
||||
this.createSocketErrorCount !== this.createSocketErrorCountLastCheck ||
|
||||
this.closeSocketCount !== this.closeSocketCountLastCheck ||
|
||||
this.errorSocketCount !== this.errorSocketCountLastCheck ||
|
||||
this.timeoutSocketCount !== this.timeoutSocketCountLastCheck ||
|
||||
this.requestCount !== this.requestCountLastCheck;
|
||||
if (changed) {
|
||||
this.createSocketCountLastCheck = this.createSocketCount;
|
||||
this.createSocketErrorCountLastCheck = this.createSocketErrorCount;
|
||||
this.closeSocketCountLastCheck = this.closeSocketCount;
|
||||
this.errorSocketCountLastCheck = this.errorSocketCount;
|
||||
this.timeoutSocketCountLastCheck = this.timeoutSocketCount;
|
||||
this.requestCountLastCheck = this.requestCount;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
getCurrentStatus() {
|
||||
return {
|
||||
createSocketCount: this.createSocketCount,
|
||||
createSocketErrorCount: this.createSocketErrorCount,
|
||||
closeSocketCount: this.closeSocketCount,
|
||||
errorSocketCount: this.errorSocketCount,
|
||||
timeoutSocketCount: this.timeoutSocketCount,
|
||||
requestCount: this.requestCount,
|
||||
freeSockets: inspect(this.freeSockets),
|
||||
sockets: inspect(this.sockets),
|
||||
requests: inspect(this.requests),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// node 8 don't has timeout attribute on socket
|
||||
// https://github.com/nodejs/node/pull/21204/files#diff-e6ef024c3775d787c38487a6309e491dR408
|
||||
function getSocketTimeout(socket) {
|
||||
return socket.timeout || socket._idleTimeout;
|
||||
}
|
||||
|
||||
function installListeners(agent, socket, options) {
|
||||
debug('%s create, timeout %sms', socket[SOCKET_NAME], getSocketTimeout(socket));
|
||||
|
||||
// listener socket events: close, timeout, error, free
|
||||
function onFree() {
|
||||
// create and socket.emit('free') logic
|
||||
// https://github.com/nodejs/node/blob/master/lib/_http_agent.js#L311
|
||||
// no req on the socket, it should be the new socket
|
||||
if (!socket._httpMessage && socket[SOCKET_REQUEST_COUNT] === 1) return;
|
||||
|
||||
socket[SOCKET_REQUEST_FINISHED_COUNT]++;
|
||||
agent.requestCount++;
|
||||
debug('%s(requests: %s, finished: %s) free',
|
||||
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT]);
|
||||
|
||||
// should reuse on pedding requests?
|
||||
const name = agent.getName(options);
|
||||
if (socket.writable && agent.requests[name] && agent.requests[name].length) {
|
||||
// will be reuse on agent free listener
|
||||
socket[SOCKET_REQUEST_COUNT]++;
|
||||
debug('%s(requests: %s, finished: %s) will be reuse on agent free event',
|
||||
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT]);
|
||||
}
|
||||
}
|
||||
socket.on('free', onFree);
|
||||
|
||||
function onClose(isError) {
|
||||
debug('%s(requests: %s, finished: %s) close, isError: %s',
|
||||
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT], isError);
|
||||
agent.closeSocketCount++;
|
||||
}
|
||||
socket.on('close', onClose);
|
||||
|
||||
// start socket timeout handler
|
||||
function onTimeout() {
|
||||
// onTimeout and emitRequestTimeout(_http_client.js)
|
||||
// https://github.com/nodejs/node/blob/v12.x/lib/_http_client.js#L711
|
||||
const listenerCount = socket.listeners('timeout').length;
|
||||
// node <= 10, default listenerCount is 1, onTimeout
|
||||
// 11 < node <= 12, default listenerCount is 2, onTimeout and emitRequestTimeout
|
||||
// node >= 13, default listenerCount is 3, onTimeout,
|
||||
// onTimeout(https://github.com/nodejs/node/pull/32000/files#diff-5f7fb0850412c6be189faeddea6c5359R333)
|
||||
// and emitRequestTimeout
|
||||
const timeout = getSocketTimeout(socket);
|
||||
const req = socket._httpMessage;
|
||||
const reqTimeoutListenerCount = req && req.listeners('timeout').length || 0;
|
||||
debug('%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s',
|
||||
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT],
|
||||
timeout, listenerCount, defaultTimeoutListenerCount, !!req, reqTimeoutListenerCount);
|
||||
if (debug.enabled) {
|
||||
debug('timeout listeners: %s', socket.listeners('timeout').map(f => f.name).join(', '));
|
||||
}
|
||||
agent.timeoutSocketCount++;
|
||||
const name = agent.getName(options);
|
||||
if (agent.freeSockets[name] && agent.freeSockets[name].indexOf(socket) !== -1) {
|
||||
// free socket timeout, destroy quietly
|
||||
socket.destroy();
|
||||
// Remove it from freeSockets list immediately to prevent new requests
|
||||
// from being sent through this socket.
|
||||
agent.removeSocket(socket, options);
|
||||
debug('%s is free, destroy quietly', socket[SOCKET_NAME]);
|
||||
} else {
|
||||
// if there is no any request socket timeout handler,
|
||||
// agent need to handle socket timeout itself.
|
||||
//
|
||||
// custom request socket timeout handle logic must follow these rules:
|
||||
// 1. Destroy socket first
|
||||
// 2. Must emit socket 'agentRemove' event tell agent remove socket
|
||||
// from freeSockets list immediately.
|
||||
// Otherise you may be get 'socket hang up' error when reuse
|
||||
// free socket and timeout happen in the same time.
|
||||
if (reqTimeoutListenerCount === 0) {
|
||||
const error = new Error('Socket timeout');
|
||||
error.code = 'ERR_SOCKET_TIMEOUT';
|
||||
error.timeout = timeout;
|
||||
// must manually call socket.end() or socket.destroy() to end the connection.
|
||||
// https://nodejs.org/dist/latest-v10.x/docs/api/net.html#net_socket_settimeout_timeout_callback
|
||||
socket.destroy(error);
|
||||
agent.removeSocket(socket, options);
|
||||
debug('%s destroy with timeout error', socket[SOCKET_NAME]);
|
||||
}
|
||||
}
|
||||
}
|
||||
socket.on('timeout', onTimeout);
|
||||
|
||||
function onError(err) {
|
||||
const listenerCount = socket.listeners('error').length;
|
||||
debug('%s(requests: %s, finished: %s) error: %s, listenerCount: %s',
|
||||
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT],
|
||||
err, listenerCount);
|
||||
agent.errorSocketCount++;
|
||||
if (listenerCount === 1) {
|
||||
// if socket don't contain error event handler, don't catch it, emit it again
|
||||
debug('%s emit uncaught error event', socket[SOCKET_NAME]);
|
||||
socket.removeListener('error', onError);
|
||||
socket.emit('error', err);
|
||||
}
|
||||
}
|
||||
socket.on('error', onError);
|
||||
|
||||
function onRemove() {
|
||||
debug('%s(requests: %s, finished: %s) agentRemove',
|
||||
socket[SOCKET_NAME],
|
||||
socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT]);
|
||||
// We need this function for cases like HTTP 'upgrade'
|
||||
// (defined by WebSockets) where we need to remove a socket from the
|
||||
// pool because it'll be locked up indefinitely
|
||||
socket.removeListener('close', onClose);
|
||||
socket.removeListener('error', onError);
|
||||
socket.removeListener('free', onFree);
|
||||
socket.removeListener('timeout', onTimeout);
|
||||
socket.removeListener('agentRemove', onRemove);
|
||||
}
|
||||
socket.on('agentRemove', onRemove);
|
||||
}
|
||||
|
||||
module.exports = Agent;
|
||||
|
||||
function inspect(obj) {
|
||||
const res = {};
|
||||
for (const key in obj) {
|
||||
res[key] = obj[key].length;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./constants":1733997696703}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696703, function(require, module, exports) {
|
||||
|
||||
|
||||
module.exports = {
|
||||
// agent
|
||||
CURRENT_ID: Symbol('agentkeepalive#currentId'),
|
||||
CREATE_ID: Symbol('agentkeepalive#createId'),
|
||||
INIT_SOCKET: Symbol('agentkeepalive#initSocket'),
|
||||
CREATE_HTTPS_CONNECTION: Symbol('agentkeepalive#createHttpsConnection'),
|
||||
// socket
|
||||
SOCKET_CREATED_TIME: Symbol('agentkeepalive#socketCreatedTime'),
|
||||
SOCKET_NAME: Symbol('agentkeepalive#socketName'),
|
||||
SOCKET_REQUEST_COUNT: Symbol('agentkeepalive#socketRequestCount'),
|
||||
SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
|
||||
};
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696704, function(require, module, exports) {
|
||||
|
||||
|
||||
const OriginalHttpsAgent = require('https').Agent;
|
||||
const HttpAgent = require('./agent');
|
||||
const {
|
||||
INIT_SOCKET,
|
||||
CREATE_HTTPS_CONNECTION,
|
||||
} = require('./constants');
|
||||
|
||||
class HttpsAgent extends HttpAgent {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
this.defaultPort = 443;
|
||||
this.protocol = 'https:';
|
||||
this.maxCachedSessions = this.options.maxCachedSessions;
|
||||
/* istanbul ignore next */
|
||||
if (this.maxCachedSessions === undefined) {
|
||||
this.maxCachedSessions = 100;
|
||||
}
|
||||
|
||||
this._sessionCache = {
|
||||
map: {},
|
||||
list: [],
|
||||
};
|
||||
}
|
||||
|
||||
createConnection(options, oncreate) {
|
||||
const socket = this[CREATE_HTTPS_CONNECTION](options, oncreate);
|
||||
this[INIT_SOCKET](socket, options);
|
||||
return socket;
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/node/blob/master/lib/https.js#L89
|
||||
HttpsAgent.prototype[CREATE_HTTPS_CONNECTION] = OriginalHttpsAgent.prototype.createConnection;
|
||||
|
||||
[
|
||||
'getName',
|
||||
'_getSession',
|
||||
'_cacheSession',
|
||||
// https://github.com/nodejs/node/pull/4982
|
||||
'_evictSession',
|
||||
].forEach(function(method) {
|
||||
/* istanbul ignore next */
|
||||
if (typeof OriginalHttpsAgent.prototype[method] === 'function') {
|
||||
HttpsAgent.prototype[method] = OriginalHttpsAgent.prototype[method];
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = HttpsAgent;
|
||||
|
||||
}, function(modId) { var map = {"./agent":1733997696702,"./constants":1733997696703}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696701);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["http","humanize-ms","util","https"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,703 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696747, function(require, module, exports) {
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
// If you have no idea what ASN.1 or BER is, see this:
|
||||
// ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
|
||||
|
||||
var Ber = require('./ber/index');
|
||||
|
||||
|
||||
|
||||
// --- Exported API
|
||||
|
||||
module.exports = {
|
||||
|
||||
Ber: Ber,
|
||||
|
||||
BerReader: Ber.Reader,
|
||||
|
||||
BerWriter: Ber.Writer
|
||||
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {"./ber/index":1733997696748}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696748, function(require, module, exports) {
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
var errors = require('./errors');
|
||||
var types = require('./types');
|
||||
|
||||
var Reader = require('./reader');
|
||||
var Writer = require('./writer');
|
||||
|
||||
|
||||
// --- Exports
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reader: Reader,
|
||||
|
||||
Writer: Writer
|
||||
|
||||
};
|
||||
|
||||
for (var t in types) {
|
||||
if (types.hasOwnProperty(t))
|
||||
module.exports[t] = types[t];
|
||||
}
|
||||
for (var e in errors) {
|
||||
if (errors.hasOwnProperty(e))
|
||||
module.exports[e] = errors[e];
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./errors":1733997696749,"./types":1733997696750,"./reader":1733997696751,"./writer":1733997696752}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696749, function(require, module, exports) {
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
newInvalidAsn1Error: function (msg) {
|
||||
var e = new Error();
|
||||
e.name = 'InvalidAsn1Error';
|
||||
e.message = msg || '';
|
||||
return e;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696750, function(require, module, exports) {
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
|
||||
module.exports = {
|
||||
EOC: 0,
|
||||
Boolean: 1,
|
||||
Integer: 2,
|
||||
BitString: 3,
|
||||
OctetString: 4,
|
||||
Null: 5,
|
||||
OID: 6,
|
||||
ObjectDescriptor: 7,
|
||||
External: 8,
|
||||
Real: 9, // float
|
||||
Enumeration: 10,
|
||||
PDV: 11,
|
||||
Utf8String: 12,
|
||||
RelativeOID: 13,
|
||||
Sequence: 16,
|
||||
Set: 17,
|
||||
NumericString: 18,
|
||||
PrintableString: 19,
|
||||
T61String: 20,
|
||||
VideotexString: 21,
|
||||
IA5String: 22,
|
||||
UTCTime: 23,
|
||||
GeneralizedTime: 24,
|
||||
GraphicString: 25,
|
||||
VisibleString: 26,
|
||||
GeneralString: 28,
|
||||
UniversalString: 29,
|
||||
CharacterString: 30,
|
||||
BMPString: 31,
|
||||
Constructor: 32,
|
||||
Context: 128
|
||||
};
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696751, function(require, module, exports) {
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
var assert = require('assert');
|
||||
var Buffer = require('safer-buffer').Buffer;
|
||||
|
||||
var ASN1 = require('./types');
|
||||
var errors = require('./errors');
|
||||
|
||||
|
||||
// --- Globals
|
||||
|
||||
var newInvalidAsn1Error = errors.newInvalidAsn1Error;
|
||||
|
||||
|
||||
|
||||
// --- API
|
||||
|
||||
function Reader(data) {
|
||||
if (!data || !Buffer.isBuffer(data))
|
||||
throw new TypeError('data must be a node Buffer');
|
||||
|
||||
this._buf = data;
|
||||
this._size = data.length;
|
||||
|
||||
// These hold the "current" state
|
||||
this._len = 0;
|
||||
this._offset = 0;
|
||||
}
|
||||
|
||||
Object.defineProperty(Reader.prototype, 'length', {
|
||||
enumerable: true,
|
||||
get: function () { return (this._len); }
|
||||
});
|
||||
|
||||
Object.defineProperty(Reader.prototype, 'offset', {
|
||||
enumerable: true,
|
||||
get: function () { return (this._offset); }
|
||||
});
|
||||
|
||||
Object.defineProperty(Reader.prototype, 'remain', {
|
||||
get: function () { return (this._size - this._offset); }
|
||||
});
|
||||
|
||||
Object.defineProperty(Reader.prototype, 'buffer', {
|
||||
get: function () { return (this._buf.slice(this._offset)); }
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Reads a single byte and advances offset; you can pass in `true` to make this
|
||||
* a "peek" operation (i.e., get the byte, but don't advance the offset).
|
||||
*
|
||||
* @param {Boolean} peek true means don't move offset.
|
||||
* @return {Number} the next byte, null if not enough data.
|
||||
*/
|
||||
Reader.prototype.readByte = function (peek) {
|
||||
if (this._size - this._offset < 1)
|
||||
return null;
|
||||
|
||||
var b = this._buf[this._offset] & 0xff;
|
||||
|
||||
if (!peek)
|
||||
this._offset += 1;
|
||||
|
||||
return b;
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.peek = function () {
|
||||
return this.readByte(true);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Reads a (potentially) variable length off the BER buffer. This call is
|
||||
* not really meant to be called directly, as callers have to manipulate
|
||||
* the internal buffer afterwards.
|
||||
*
|
||||
* As a result of this call, you can call `Reader.length`, until the
|
||||
* next thing called that does a readLength.
|
||||
*
|
||||
* @return {Number} the amount of offset to advance the buffer.
|
||||
* @throws {InvalidAsn1Error} on bad ASN.1
|
||||
*/
|
||||
Reader.prototype.readLength = function (offset) {
|
||||
if (offset === undefined)
|
||||
offset = this._offset;
|
||||
|
||||
if (offset >= this._size)
|
||||
return null;
|
||||
|
||||
var lenB = this._buf[offset++] & 0xff;
|
||||
if (lenB === null)
|
||||
return null;
|
||||
|
||||
if ((lenB & 0x80) === 0x80) {
|
||||
lenB &= 0x7f;
|
||||
|
||||
if (lenB === 0)
|
||||
throw newInvalidAsn1Error('Indefinite length not supported');
|
||||
|
||||
if (lenB > 4)
|
||||
throw newInvalidAsn1Error('encoding too long');
|
||||
|
||||
if (this._size - offset < lenB)
|
||||
return null;
|
||||
|
||||
this._len = 0;
|
||||
for (var i = 0; i < lenB; i++)
|
||||
this._len = (this._len << 8) + (this._buf[offset++] & 0xff);
|
||||
|
||||
} else {
|
||||
// Wasn't a variable length
|
||||
this._len = lenB;
|
||||
}
|
||||
|
||||
return offset;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Parses the next sequence in this BER buffer.
|
||||
*
|
||||
* To get the length of the sequence, call `Reader.length`.
|
||||
*
|
||||
* @return {Number} the sequence's tag.
|
||||
*/
|
||||
Reader.prototype.readSequence = function (tag) {
|
||||
var seq = this.peek();
|
||||
if (seq === null)
|
||||
return null;
|
||||
if (tag !== undefined && tag !== seq)
|
||||
throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
|
||||
': got 0x' + seq.toString(16));
|
||||
|
||||
var o = this.readLength(this._offset + 1); // stored in `length`
|
||||
if (o === null)
|
||||
return null;
|
||||
|
||||
this._offset = o;
|
||||
return seq;
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readInt = function () {
|
||||
return this._readTag(ASN1.Integer);
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readBoolean = function () {
|
||||
return (this._readTag(ASN1.Boolean) === 0 ? false : true);
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readEnumeration = function () {
|
||||
return this._readTag(ASN1.Enumeration);
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readString = function (tag, retbuf) {
|
||||
if (!tag)
|
||||
tag = ASN1.OctetString;
|
||||
|
||||
var b = this.peek();
|
||||
if (b === null)
|
||||
return null;
|
||||
|
||||
if (b !== tag)
|
||||
throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
|
||||
': got 0x' + b.toString(16));
|
||||
|
||||
var o = this.readLength(this._offset + 1); // stored in `length`
|
||||
|
||||
if (o === null)
|
||||
return null;
|
||||
|
||||
if (this.length > this._size - o)
|
||||
return null;
|
||||
|
||||
this._offset = o;
|
||||
|
||||
if (this.length === 0)
|
||||
return retbuf ? Buffer.alloc(0) : '';
|
||||
|
||||
var str = this._buf.slice(this._offset, this._offset + this.length);
|
||||
this._offset += this.length;
|
||||
|
||||
return retbuf ? str : str.toString('utf8');
|
||||
};
|
||||
|
||||
Reader.prototype.readOID = function (tag) {
|
||||
if (!tag)
|
||||
tag = ASN1.OID;
|
||||
|
||||
var b = this.readString(tag, true);
|
||||
if (b === null)
|
||||
return null;
|
||||
|
||||
var values = [];
|
||||
var value = 0;
|
||||
|
||||
for (var i = 0; i < b.length; i++) {
|
||||
var byte = b[i] & 0xff;
|
||||
|
||||
value <<= 7;
|
||||
value += byte & 0x7f;
|
||||
if ((byte & 0x80) === 0) {
|
||||
values.push(value);
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
value = values.shift();
|
||||
values.unshift(value % 40);
|
||||
values.unshift((value / 40) >> 0);
|
||||
|
||||
return values.join('.');
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype._readTag = function (tag) {
|
||||
assert.ok(tag !== undefined);
|
||||
|
||||
var b = this.peek();
|
||||
|
||||
if (b === null)
|
||||
return null;
|
||||
|
||||
if (b !== tag)
|
||||
throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
|
||||
': got 0x' + b.toString(16));
|
||||
|
||||
var o = this.readLength(this._offset + 1); // stored in `length`
|
||||
if (o === null)
|
||||
return null;
|
||||
|
||||
if (this.length > 4)
|
||||
throw newInvalidAsn1Error('Integer too long: ' + this.length);
|
||||
|
||||
if (this.length > this._size - o)
|
||||
return null;
|
||||
this._offset = o;
|
||||
|
||||
var fb = this._buf[this._offset];
|
||||
var value = 0;
|
||||
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
value <<= 8;
|
||||
value |= (this._buf[this._offset++] & 0xff);
|
||||
}
|
||||
|
||||
if ((fb & 0x80) === 0x80 && i !== 4)
|
||||
value -= (1 << (i * 8));
|
||||
|
||||
return value >> 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// --- Exported API
|
||||
|
||||
module.exports = Reader;
|
||||
|
||||
}, function(modId) { var map = {"./types":1733997696750,"./errors":1733997696749}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696752, function(require, module, exports) {
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
var assert = require('assert');
|
||||
var Buffer = require('safer-buffer').Buffer;
|
||||
var ASN1 = require('./types');
|
||||
var errors = require('./errors');
|
||||
|
||||
|
||||
// --- Globals
|
||||
|
||||
var newInvalidAsn1Error = errors.newInvalidAsn1Error;
|
||||
|
||||
var DEFAULT_OPTS = {
|
||||
size: 1024,
|
||||
growthFactor: 8
|
||||
};
|
||||
|
||||
|
||||
// --- Helpers
|
||||
|
||||
function merge(from, to) {
|
||||
assert.ok(from);
|
||||
assert.equal(typeof (from), 'object');
|
||||
assert.ok(to);
|
||||
assert.equal(typeof (to), 'object');
|
||||
|
||||
var keys = Object.getOwnPropertyNames(from);
|
||||
keys.forEach(function (key) {
|
||||
if (to[key])
|
||||
return;
|
||||
|
||||
var value = Object.getOwnPropertyDescriptor(from, key);
|
||||
Object.defineProperty(to, key, value);
|
||||
});
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --- API
|
||||
|
||||
function Writer(options) {
|
||||
options = merge(DEFAULT_OPTS, options || {});
|
||||
|
||||
this._buf = Buffer.alloc(options.size || 1024);
|
||||
this._size = this._buf.length;
|
||||
this._offset = 0;
|
||||
this._options = options;
|
||||
|
||||
// A list of offsets in the buffer where we need to insert
|
||||
// sequence tag/len pairs.
|
||||
this._seq = [];
|
||||
}
|
||||
|
||||
Object.defineProperty(Writer.prototype, 'buffer', {
|
||||
get: function () {
|
||||
if (this._seq.length)
|
||||
throw newInvalidAsn1Error(this._seq.length + ' unended sequence(s)');
|
||||
|
||||
return (this._buf.slice(0, this._offset));
|
||||
}
|
||||
});
|
||||
|
||||
Writer.prototype.writeByte = function (b) {
|
||||
if (typeof (b) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
|
||||
this._ensure(1);
|
||||
this._buf[this._offset++] = b;
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeInt = function (i, tag) {
|
||||
if (typeof (i) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Integer;
|
||||
|
||||
var sz = 4;
|
||||
|
||||
while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000 >> 0)) &&
|
||||
(sz > 1)) {
|
||||
sz--;
|
||||
i <<= 8;
|
||||
}
|
||||
|
||||
if (sz > 4)
|
||||
throw newInvalidAsn1Error('BER ints cannot be > 0xffffffff');
|
||||
|
||||
this._ensure(2 + sz);
|
||||
this._buf[this._offset++] = tag;
|
||||
this._buf[this._offset++] = sz;
|
||||
|
||||
while (sz-- > 0) {
|
||||
this._buf[this._offset++] = ((i & 0xff000000) >>> 24);
|
||||
i <<= 8;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeNull = function () {
|
||||
this.writeByte(ASN1.Null);
|
||||
this.writeByte(0x00);
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeEnumeration = function (i, tag) {
|
||||
if (typeof (i) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Enumeration;
|
||||
|
||||
return this.writeInt(i, tag);
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeBoolean = function (b, tag) {
|
||||
if (typeof (b) !== 'boolean')
|
||||
throw new TypeError('argument must be a Boolean');
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Boolean;
|
||||
|
||||
this._ensure(3);
|
||||
this._buf[this._offset++] = tag;
|
||||
this._buf[this._offset++] = 0x01;
|
||||
this._buf[this._offset++] = b ? 0xff : 0x00;
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeString = function (s, tag) {
|
||||
if (typeof (s) !== 'string')
|
||||
throw new TypeError('argument must be a string (was: ' + typeof (s) + ')');
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.OctetString;
|
||||
|
||||
var len = Buffer.byteLength(s);
|
||||
this.writeByte(tag);
|
||||
this.writeLength(len);
|
||||
if (len) {
|
||||
this._ensure(len);
|
||||
this._buf.write(s, this._offset);
|
||||
this._offset += len;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeBuffer = function (buf, tag) {
|
||||
if (typeof (tag) !== 'number')
|
||||
throw new TypeError('tag must be a number');
|
||||
if (!Buffer.isBuffer(buf))
|
||||
throw new TypeError('argument must be a buffer');
|
||||
|
||||
this.writeByte(tag);
|
||||
this.writeLength(buf.length);
|
||||
this._ensure(buf.length);
|
||||
buf.copy(this._buf, this._offset, 0, buf.length);
|
||||
this._offset += buf.length;
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeStringArray = function (strings) {
|
||||
if ((!strings instanceof Array))
|
||||
throw new TypeError('argument must be an Array[String]');
|
||||
|
||||
var self = this;
|
||||
strings.forEach(function (s) {
|
||||
self.writeString(s);
|
||||
});
|
||||
};
|
||||
|
||||
// This is really to solve DER cases, but whatever for now
|
||||
Writer.prototype.writeOID = function (s, tag) {
|
||||
if (typeof (s) !== 'string')
|
||||
throw new TypeError('argument must be a string');
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.OID;
|
||||
|
||||
if (!/^([0-9]+\.){3,}[0-9]+$/.test(s))
|
||||
throw new Error('argument is not a valid OID string');
|
||||
|
||||
function encodeOctet(bytes, octet) {
|
||||
if (octet < 128) {
|
||||
bytes.push(octet);
|
||||
} else if (octet < 16384) {
|
||||
bytes.push((octet >>> 7) | 0x80);
|
||||
bytes.push(octet & 0x7F);
|
||||
} else if (octet < 2097152) {
|
||||
bytes.push((octet >>> 14) | 0x80);
|
||||
bytes.push(((octet >>> 7) | 0x80) & 0xFF);
|
||||
bytes.push(octet & 0x7F);
|
||||
} else if (octet < 268435456) {
|
||||
bytes.push((octet >>> 21) | 0x80);
|
||||
bytes.push(((octet >>> 14) | 0x80) & 0xFF);
|
||||
bytes.push(((octet >>> 7) | 0x80) & 0xFF);
|
||||
bytes.push(octet & 0x7F);
|
||||
} else {
|
||||
bytes.push(((octet >>> 28) | 0x80) & 0xFF);
|
||||
bytes.push(((octet >>> 21) | 0x80) & 0xFF);
|
||||
bytes.push(((octet >>> 14) | 0x80) & 0xFF);
|
||||
bytes.push(((octet >>> 7) | 0x80) & 0xFF);
|
||||
bytes.push(octet & 0x7F);
|
||||
}
|
||||
}
|
||||
|
||||
var tmp = s.split('.');
|
||||
var bytes = [];
|
||||
bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10));
|
||||
tmp.slice(2).forEach(function (b) {
|
||||
encodeOctet(bytes, parseInt(b, 10));
|
||||
});
|
||||
|
||||
var self = this;
|
||||
this._ensure(2 + bytes.length);
|
||||
this.writeByte(tag);
|
||||
this.writeLength(bytes.length);
|
||||
bytes.forEach(function (b) {
|
||||
self.writeByte(b);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeLength = function (len) {
|
||||
if (typeof (len) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
|
||||
this._ensure(4);
|
||||
|
||||
if (len <= 0x7f) {
|
||||
this._buf[this._offset++] = len;
|
||||
} else if (len <= 0xff) {
|
||||
this._buf[this._offset++] = 0x81;
|
||||
this._buf[this._offset++] = len;
|
||||
} else if (len <= 0xffff) {
|
||||
this._buf[this._offset++] = 0x82;
|
||||
this._buf[this._offset++] = len >> 8;
|
||||
this._buf[this._offset++] = len;
|
||||
} else if (len <= 0xffffff) {
|
||||
this._buf[this._offset++] = 0x83;
|
||||
this._buf[this._offset++] = len >> 16;
|
||||
this._buf[this._offset++] = len >> 8;
|
||||
this._buf[this._offset++] = len;
|
||||
} else {
|
||||
throw newInvalidAsn1Error('Length too long (> 4 bytes)');
|
||||
}
|
||||
};
|
||||
|
||||
Writer.prototype.startSequence = function (tag) {
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Sequence | ASN1.Constructor;
|
||||
|
||||
this.writeByte(tag);
|
||||
this._seq.push(this._offset);
|
||||
this._ensure(3);
|
||||
this._offset += 3;
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.endSequence = function () {
|
||||
var seq = this._seq.pop();
|
||||
var start = seq + 3;
|
||||
var len = this._offset - start;
|
||||
|
||||
if (len <= 0x7f) {
|
||||
this._shift(start, len, -2);
|
||||
this._buf[seq] = len;
|
||||
} else if (len <= 0xff) {
|
||||
this._shift(start, len, -1);
|
||||
this._buf[seq] = 0x81;
|
||||
this._buf[seq + 1] = len;
|
||||
} else if (len <= 0xffff) {
|
||||
this._buf[seq] = 0x82;
|
||||
this._buf[seq + 1] = len >> 8;
|
||||
this._buf[seq + 2] = len;
|
||||
} else if (len <= 0xffffff) {
|
||||
this._shift(start, len, 1);
|
||||
this._buf[seq] = 0x83;
|
||||
this._buf[seq + 1] = len >> 16;
|
||||
this._buf[seq + 2] = len >> 8;
|
||||
this._buf[seq + 3] = len;
|
||||
} else {
|
||||
throw newInvalidAsn1Error('Sequence too long');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype._shift = function (start, len, shift) {
|
||||
assert.ok(start !== undefined);
|
||||
assert.ok(len !== undefined);
|
||||
assert.ok(shift);
|
||||
|
||||
this._buf.copy(this._buf, start + shift, start, start + len);
|
||||
this._offset += shift;
|
||||
};
|
||||
|
||||
Writer.prototype._ensure = function (len) {
|
||||
assert.ok(len);
|
||||
|
||||
if (this._size - this._offset < len) {
|
||||
var sz = this._size * this._options.growthFactor;
|
||||
if (sz - this._offset < len)
|
||||
sz += len;
|
||||
|
||||
var buf = Buffer.alloc(sz);
|
||||
|
||||
this._buf.copy(buf, 0, 0, this._offset);
|
||||
this._buf = buf;
|
||||
this._size = sz;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// --- Exported API
|
||||
|
||||
module.exports = Writer;
|
||||
|
||||
}, function(modId) { var map = {"./types":1733997696750,"./errors":1733997696749}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696747);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["assert","safer-buffer"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,224 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696753, function(require, module, exports) {
|
||||
// Copyright (c) 2012, Mark Cavage. All rights reserved.
|
||||
// Copyright 2015 Joyent, Inc.
|
||||
|
||||
var assert = require('assert');
|
||||
var Stream = require('stream').Stream;
|
||||
var util = require('util');
|
||||
|
||||
|
||||
///--- Globals
|
||||
|
||||
/* JSSTYLED */
|
||||
var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
|
||||
|
||||
|
||||
///--- Internal
|
||||
|
||||
function _capitalize(str) {
|
||||
return (str.charAt(0).toUpperCase() + str.slice(1));
|
||||
}
|
||||
|
||||
function _toss(name, expected, oper, arg, actual) {
|
||||
throw new assert.AssertionError({
|
||||
message: util.format('%s (%s) is required', name, expected),
|
||||
actual: (actual === undefined) ? typeof (arg) : actual(arg),
|
||||
expected: expected,
|
||||
operator: oper || '===',
|
||||
stackStartFunction: _toss.caller
|
||||
});
|
||||
}
|
||||
|
||||
function _getClass(arg) {
|
||||
return (Object.prototype.toString.call(arg).slice(8, -1));
|
||||
}
|
||||
|
||||
function noop() {
|
||||
// Why even bother with asserts?
|
||||
}
|
||||
|
||||
|
||||
///--- Exports
|
||||
|
||||
var types = {
|
||||
bool: {
|
||||
check: function (arg) { return typeof (arg) === 'boolean'; }
|
||||
},
|
||||
func: {
|
||||
check: function (arg) { return typeof (arg) === 'function'; }
|
||||
},
|
||||
string: {
|
||||
check: function (arg) { return typeof (arg) === 'string'; }
|
||||
},
|
||||
object: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'object' && arg !== null;
|
||||
}
|
||||
},
|
||||
number: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'number' && !isNaN(arg);
|
||||
}
|
||||
},
|
||||
finite: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg);
|
||||
}
|
||||
},
|
||||
buffer: {
|
||||
check: function (arg) { return Buffer.isBuffer(arg); },
|
||||
operator: 'Buffer.isBuffer'
|
||||
},
|
||||
array: {
|
||||
check: function (arg) { return Array.isArray(arg); },
|
||||
operator: 'Array.isArray'
|
||||
},
|
||||
stream: {
|
||||
check: function (arg) { return arg instanceof Stream; },
|
||||
operator: 'instanceof',
|
||||
actual: _getClass
|
||||
},
|
||||
date: {
|
||||
check: function (arg) { return arg instanceof Date; },
|
||||
operator: 'instanceof',
|
||||
actual: _getClass
|
||||
},
|
||||
regexp: {
|
||||
check: function (arg) { return arg instanceof RegExp; },
|
||||
operator: 'instanceof',
|
||||
actual: _getClass
|
||||
},
|
||||
uuid: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'string' && UUID_REGEXP.test(arg);
|
||||
},
|
||||
operator: 'isUUID'
|
||||
}
|
||||
};
|
||||
|
||||
function _setExports(ndebug) {
|
||||
var keys = Object.keys(types);
|
||||
var out;
|
||||
|
||||
/* re-export standard assert */
|
||||
if (process.env.NODE_NDEBUG) {
|
||||
out = noop;
|
||||
} else {
|
||||
out = function (arg, msg) {
|
||||
if (!arg) {
|
||||
_toss(msg, 'true', arg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* standard checks */
|
||||
keys.forEach(function (k) {
|
||||
if (ndebug) {
|
||||
out[k] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
out[k] = function (arg, msg) {
|
||||
if (!type.check(arg)) {
|
||||
_toss(msg, k, type.operator, arg, type.actual);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* optional checks */
|
||||
keys.forEach(function (k) {
|
||||
var name = 'optional' + _capitalize(k);
|
||||
if (ndebug) {
|
||||
out[name] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
out[name] = function (arg, msg) {
|
||||
if (arg === undefined || arg === null) {
|
||||
return;
|
||||
}
|
||||
if (!type.check(arg)) {
|
||||
_toss(msg, k, type.operator, arg, type.actual);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* arrayOf checks */
|
||||
keys.forEach(function (k) {
|
||||
var name = 'arrayOf' + _capitalize(k);
|
||||
if (ndebug) {
|
||||
out[name] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
var expected = '[' + k + ']';
|
||||
out[name] = function (arg, msg) {
|
||||
if (!Array.isArray(arg)) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < arg.length; i++) {
|
||||
if (!type.check(arg[i])) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* optionalArrayOf checks */
|
||||
keys.forEach(function (k) {
|
||||
var name = 'optionalArrayOf' + _capitalize(k);
|
||||
if (ndebug) {
|
||||
out[name] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
var expected = '[' + k + ']';
|
||||
out[name] = function (arg, msg) {
|
||||
if (arg === undefined || arg === null) {
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(arg)) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < arg.length; i++) {
|
||||
if (!type.check(arg[i])) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* re-export built-in assertions */
|
||||
Object.keys(assert).forEach(function (k) {
|
||||
if (k === 'AssertionError') {
|
||||
out[k] = assert[k];
|
||||
return;
|
||||
}
|
||||
if (ndebug) {
|
||||
out[k] = noop;
|
||||
return;
|
||||
}
|
||||
out[k] = assert[k];
|
||||
});
|
||||
|
||||
/* export ourselves (for unit tests _only_) */
|
||||
out._setExports = _setExports;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
module.exports = _setExports(process.env.NODE_NDEBUG);
|
||||
|
||||
}, function(modId) {var map = {"assert":1733997696753}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696753);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["stream","util"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,411 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696754, function(require, module, exports) {
|
||||
module.exports =
|
||||
{
|
||||
parallel : require('./parallel.js'),
|
||||
serial : require('./serial.js'),
|
||||
serialOrdered : require('./serialOrdered.js')
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {"./parallel.js":1733997696755,"./serial.js":1733997696762,"./serialOrdered.js":1733997696763}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696755, function(require, module, exports) {
|
||||
var iterate = require('./lib/iterate.js')
|
||||
, initState = require('./lib/state.js')
|
||||
, terminator = require('./lib/terminator.js')
|
||||
;
|
||||
|
||||
// Public API
|
||||
module.exports = parallel;
|
||||
|
||||
/**
|
||||
* Runs iterator over provided array elements in parallel
|
||||
*
|
||||
* @param {array|object} list - array or object (named list) to iterate over
|
||||
* @param {function} iterator - iterator to run
|
||||
* @param {function} callback - invoked when all elements processed
|
||||
* @returns {function} - jobs terminator
|
||||
*/
|
||||
function parallel(list, iterator, callback)
|
||||
{
|
||||
var state = initState(list);
|
||||
|
||||
while (state.index < (state['keyedList'] || list).length)
|
||||
{
|
||||
iterate(list, iterator, state, function(error, result)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
callback(error, result);
|
||||
return;
|
||||
}
|
||||
|
||||
// looks like it's the last one
|
||||
if (Object.keys(state.jobs).length === 0)
|
||||
{
|
||||
callback(null, state.results);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
state.index++;
|
||||
}
|
||||
|
||||
return terminator.bind(state, callback);
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./lib/iterate.js":1733997696756,"./lib/state.js":1733997696760,"./lib/terminator.js":1733997696761}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696756, function(require, module, exports) {
|
||||
var async = require('./async.js')
|
||||
, abort = require('./abort.js')
|
||||
;
|
||||
|
||||
// API
|
||||
module.exports = iterate;
|
||||
|
||||
/**
|
||||
* Iterates over each job object
|
||||
*
|
||||
* @param {array|object} list - array or object (named list) to iterate over
|
||||
* @param {function} iterator - iterator to run
|
||||
* @param {object} state - current job status
|
||||
* @param {function} callback - invoked when all elements processed
|
||||
*/
|
||||
function iterate(list, iterator, state, callback)
|
||||
{
|
||||
// store current index
|
||||
var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
|
||||
|
||||
state.jobs[key] = runJob(iterator, key, list[key], function(error, output)
|
||||
{
|
||||
// don't repeat yourself
|
||||
// skip secondary callbacks
|
||||
if (!(key in state.jobs))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// clean up jobs
|
||||
delete state.jobs[key];
|
||||
|
||||
if (error)
|
||||
{
|
||||
// don't process rest of the results
|
||||
// stop still active jobs
|
||||
// and reset the list
|
||||
abort(state);
|
||||
}
|
||||
else
|
||||
{
|
||||
state.results[key] = output;
|
||||
}
|
||||
|
||||
// return salvaged results
|
||||
callback(error, state.results);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs iterator over provided job element
|
||||
*
|
||||
* @param {function} iterator - iterator to invoke
|
||||
* @param {string|number} key - key/index of the element in the list of jobs
|
||||
* @param {mixed} item - job description
|
||||
* @param {function} callback - invoked after iterator is done with the job
|
||||
* @returns {function|mixed} - job abort function or something else
|
||||
*/
|
||||
function runJob(iterator, key, item, callback)
|
||||
{
|
||||
var aborter;
|
||||
|
||||
// allow shortcut if iterator expects only two arguments
|
||||
if (iterator.length == 2)
|
||||
{
|
||||
aborter = iterator(item, async(callback));
|
||||
}
|
||||
// otherwise go with full three arguments
|
||||
else
|
||||
{
|
||||
aborter = iterator(item, key, async(callback));
|
||||
}
|
||||
|
||||
return aborter;
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./async.js":1733997696757,"./abort.js":1733997696759}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696757, function(require, module, exports) {
|
||||
var defer = require('./defer.js');
|
||||
|
||||
// API
|
||||
module.exports = async;
|
||||
|
||||
/**
|
||||
* Runs provided callback asynchronously
|
||||
* even if callback itself is not
|
||||
*
|
||||
* @param {function} callback - callback to invoke
|
||||
* @returns {function} - augmented callback
|
||||
*/
|
||||
function async(callback)
|
||||
{
|
||||
var isAsync = false;
|
||||
|
||||
// check if async happened
|
||||
defer(function() { isAsync = true; });
|
||||
|
||||
return function async_callback(err, result)
|
||||
{
|
||||
if (isAsync)
|
||||
{
|
||||
callback(err, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
defer(function nextTick_callback()
|
||||
{
|
||||
callback(err, result);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./defer.js":1733997696758}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696758, function(require, module, exports) {
|
||||
module.exports = defer;
|
||||
|
||||
/**
|
||||
* Runs provided function on next iteration of the event loop
|
||||
*
|
||||
* @param {function} fn - function to run
|
||||
*/
|
||||
function defer(fn)
|
||||
{
|
||||
var nextTick = typeof setImmediate == 'function'
|
||||
? setImmediate
|
||||
: (
|
||||
typeof process == 'object' && typeof process.nextTick == 'function'
|
||||
? process.nextTick
|
||||
: null
|
||||
);
|
||||
|
||||
if (nextTick)
|
||||
{
|
||||
nextTick(fn);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout(fn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696759, function(require, module, exports) {
|
||||
// API
|
||||
module.exports = abort;
|
||||
|
||||
/**
|
||||
* Aborts leftover active jobs
|
||||
*
|
||||
* @param {object} state - current state object
|
||||
*/
|
||||
function abort(state)
|
||||
{
|
||||
Object.keys(state.jobs).forEach(clean.bind(state));
|
||||
|
||||
// reset leftover jobs
|
||||
state.jobs = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up leftover job by invoking abort function for the provided job id
|
||||
*
|
||||
* @this state
|
||||
* @param {string|number} key - job id to abort
|
||||
*/
|
||||
function clean(key)
|
||||
{
|
||||
if (typeof this.jobs[key] == 'function')
|
||||
{
|
||||
this.jobs[key]();
|
||||
}
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696760, function(require, module, exports) {
|
||||
// API
|
||||
module.exports = state;
|
||||
|
||||
/**
|
||||
* Creates initial state object
|
||||
* for iteration over list
|
||||
*
|
||||
* @param {array|object} list - list to iterate over
|
||||
* @param {function|null} sortMethod - function to use for keys sort,
|
||||
* or `null` to keep them as is
|
||||
* @returns {object} - initial state object
|
||||
*/
|
||||
function state(list, sortMethod)
|
||||
{
|
||||
var isNamedList = !Array.isArray(list)
|
||||
, initState =
|
||||
{
|
||||
index : 0,
|
||||
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
||||
jobs : {},
|
||||
results : isNamedList ? {} : [],
|
||||
size : isNamedList ? Object.keys(list).length : list.length
|
||||
}
|
||||
;
|
||||
|
||||
if (sortMethod)
|
||||
{
|
||||
// sort array keys based on it's values
|
||||
// sort object's keys just on own merit
|
||||
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
||||
{
|
||||
return sortMethod(list[a], list[b]);
|
||||
});
|
||||
}
|
||||
|
||||
return initState;
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696761, function(require, module, exports) {
|
||||
var abort = require('./abort.js')
|
||||
, async = require('./async.js')
|
||||
;
|
||||
|
||||
// API
|
||||
module.exports = terminator;
|
||||
|
||||
/**
|
||||
* Terminates jobs in the attached state context
|
||||
*
|
||||
* @this AsyncKitState#
|
||||
* @param {function} callback - final callback to invoke after termination
|
||||
*/
|
||||
function terminator(callback)
|
||||
{
|
||||
if (!Object.keys(this.jobs).length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// fast forward iteration index
|
||||
this.index = this.size;
|
||||
|
||||
// abort jobs
|
||||
abort(this);
|
||||
|
||||
// send back results we have so far
|
||||
async(callback)(null, this.results);
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./abort.js":1733997696759,"./async.js":1733997696757}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696762, function(require, module, exports) {
|
||||
var serialOrdered = require('./serialOrdered.js');
|
||||
|
||||
// Public API
|
||||
module.exports = serial;
|
||||
|
||||
/**
|
||||
* Runs iterator over provided array elements in series
|
||||
*
|
||||
* @param {array|object} list - array or object (named list) to iterate over
|
||||
* @param {function} iterator - iterator to run
|
||||
* @param {function} callback - invoked when all elements processed
|
||||
* @returns {function} - jobs terminator
|
||||
*/
|
||||
function serial(list, iterator, callback)
|
||||
{
|
||||
return serialOrdered(list, iterator, null, callback);
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./serialOrdered.js":1733997696763}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696763, function(require, module, exports) {
|
||||
var iterate = require('./lib/iterate.js')
|
||||
, initState = require('./lib/state.js')
|
||||
, terminator = require('./lib/terminator.js')
|
||||
;
|
||||
|
||||
// Public API
|
||||
module.exports = serialOrdered;
|
||||
// sorting helpers
|
||||
module.exports.ascending = ascending;
|
||||
module.exports.descending = descending;
|
||||
|
||||
/**
|
||||
* Runs iterator over provided sorted array elements in series
|
||||
*
|
||||
* @param {array|object} list - array or object (named list) to iterate over
|
||||
* @param {function} iterator - iterator to run
|
||||
* @param {function} sortMethod - custom sort function
|
||||
* @param {function} callback - invoked when all elements processed
|
||||
* @returns {function} - jobs terminator
|
||||
*/
|
||||
function serialOrdered(list, iterator, sortMethod, callback)
|
||||
{
|
||||
var state = initState(list, sortMethod);
|
||||
|
||||
iterate(list, iterator, state, function iteratorHandler(error, result)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
callback(error, result);
|
||||
return;
|
||||
}
|
||||
|
||||
state.index++;
|
||||
|
||||
// are we there yet?
|
||||
if (state.index < (state['keyedList'] || list).length)
|
||||
{
|
||||
iterate(list, iterator, state, iteratorHandler);
|
||||
return;
|
||||
}
|
||||
|
||||
// done here
|
||||
callback(null, state.results);
|
||||
});
|
||||
|
||||
return terminator.bind(state, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
* -- Sort methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* sort helper to sort array elements in ascending order
|
||||
*
|
||||
* @param {mixed} a - an item to compare
|
||||
* @param {mixed} b - an item to compare
|
||||
* @returns {number} - comparison result
|
||||
*/
|
||||
function ascending(a, b)
|
||||
{
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* sort helper to sort array elements in descending order
|
||||
*
|
||||
* @param {mixed} a - an item to compare
|
||||
* @param {mixed} b - an item to compare
|
||||
* @returns {number} - comparison result
|
||||
*/
|
||||
function descending(a, b)
|
||||
{
|
||||
return -1 * ascending(a, b);
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./lib/iterate.js":1733997696756,"./lib/state.js":1733997696760,"./lib/terminator.js":1733997696761}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696754);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,225 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696764, function(require, module, exports) {
|
||||
|
||||
/*!
|
||||
* Copyright 2010 LearnBoost <dev@learnboost.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var crypto = require('crypto')
|
||||
, parse = require('url').parse
|
||||
;
|
||||
|
||||
/**
|
||||
* Valid keys.
|
||||
*/
|
||||
|
||||
var keys =
|
||||
[ 'acl'
|
||||
, 'location'
|
||||
, 'logging'
|
||||
, 'notification'
|
||||
, 'partNumber'
|
||||
, 'policy'
|
||||
, 'requestPayment'
|
||||
, 'torrent'
|
||||
, 'uploadId'
|
||||
, 'uploads'
|
||||
, 'versionId'
|
||||
, 'versioning'
|
||||
, 'versions'
|
||||
, 'website'
|
||||
]
|
||||
|
||||
/**
|
||||
* Return an "Authorization" header value with the given `options`
|
||||
* in the form of "AWS <key>:<signature>"
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function authorization (options) {
|
||||
return 'AWS ' + options.key + ':' + sign(options)
|
||||
}
|
||||
|
||||
module.exports = authorization
|
||||
module.exports.authorization = authorization
|
||||
|
||||
/**
|
||||
* Simple HMAC-SHA1 Wrapper
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function hmacSha1 (options) {
|
||||
return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64')
|
||||
}
|
||||
|
||||
module.exports.hmacSha1 = hmacSha1
|
||||
|
||||
/**
|
||||
* Create a base64 sha1 HMAC for `options`.
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function sign (options) {
|
||||
options.message = stringToSign(options)
|
||||
return hmacSha1(options)
|
||||
}
|
||||
module.exports.sign = sign
|
||||
|
||||
/**
|
||||
* Create a base64 sha1 HMAC for `options`.
|
||||
*
|
||||
* Specifically to be used with S3 presigned URLs
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function signQuery (options) {
|
||||
options.message = queryStringToSign(options)
|
||||
return hmacSha1(options)
|
||||
}
|
||||
module.exports.signQuery= signQuery
|
||||
|
||||
/**
|
||||
* Return a string for sign() with the given `options`.
|
||||
*
|
||||
* Spec:
|
||||
*
|
||||
* <verb>\n
|
||||
* <md5>\n
|
||||
* <content-type>\n
|
||||
* <date>\n
|
||||
* [headers\n]
|
||||
* <resource>
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function stringToSign (options) {
|
||||
var headers = options.amazonHeaders || ''
|
||||
if (headers) headers += '\n'
|
||||
var r =
|
||||
[ options.verb
|
||||
, options.md5
|
||||
, options.contentType
|
||||
, options.date ? options.date.toUTCString() : ''
|
||||
, headers + options.resource
|
||||
]
|
||||
return r.join('\n')
|
||||
}
|
||||
module.exports.stringToSign = stringToSign
|
||||
|
||||
/**
|
||||
* Return a string for sign() with the given `options`, but is meant exclusively
|
||||
* for S3 presigned URLs
|
||||
*
|
||||
* Spec:
|
||||
*
|
||||
* <date>\n
|
||||
* <resource>
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function queryStringToSign (options){
|
||||
return 'GET\n\n\n' + options.date + '\n' + options.resource
|
||||
}
|
||||
module.exports.queryStringToSign = queryStringToSign
|
||||
|
||||
/**
|
||||
* Perform the following:
|
||||
*
|
||||
* - ignore non-amazon headers
|
||||
* - lowercase fields
|
||||
* - sort lexicographically
|
||||
* - trim whitespace between ":"
|
||||
* - join with newline
|
||||
*
|
||||
* @param {Object} headers
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function canonicalizeHeaders (headers) {
|
||||
var buf = []
|
||||
, fields = Object.keys(headers)
|
||||
;
|
||||
for (var i = 0, len = fields.length; i < len; ++i) {
|
||||
var field = fields[i]
|
||||
, val = headers[field]
|
||||
, field = field.toLowerCase()
|
||||
;
|
||||
if (0 !== field.indexOf('x-amz')) continue
|
||||
buf.push(field + ':' + val)
|
||||
}
|
||||
return buf.sort().join('\n')
|
||||
}
|
||||
module.exports.canonicalizeHeaders = canonicalizeHeaders
|
||||
|
||||
/**
|
||||
* Perform the following:
|
||||
*
|
||||
* - ignore non sub-resources
|
||||
* - sort lexicographically
|
||||
*
|
||||
* @param {String} resource
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function canonicalizeResource (resource) {
|
||||
var url = parse(resource, true)
|
||||
, path = url.pathname
|
||||
, buf = []
|
||||
;
|
||||
|
||||
Object.keys(url.query).forEach(function(key){
|
||||
if (!~keys.indexOf(key)) return
|
||||
var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key])
|
||||
buf.push(key + val)
|
||||
})
|
||||
|
||||
return path + (buf.length ? '?' + buf.sort().join('&') : '')
|
||||
}
|
||||
module.exports.canonicalizeResource = canonicalizeResource
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696764);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["crypto","url"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,163 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696797, function(require, module, exports) {
|
||||
|
||||
|
||||
exports.byteLength = byteLength
|
||||
exports.toByteArray = toByteArray
|
||||
exports.fromByteArray = fromByteArray
|
||||
|
||||
var lookup = []
|
||||
var revLookup = []
|
||||
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
||||
|
||||
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
for (var i = 0, len = code.length; i < len; ++i) {
|
||||
lookup[i] = code[i]
|
||||
revLookup[code.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
revLookup['-'.charCodeAt(0)] = 62
|
||||
revLookup['_'.charCodeAt(0)] = 63
|
||||
|
||||
function getLens (b64) {
|
||||
var len = b64.length
|
||||
|
||||
if (len % 4 > 0) {
|
||||
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||
}
|
||||
|
||||
// Trim off extra bytes after placeholder bytes are found
|
||||
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||
var validLen = b64.indexOf('=')
|
||||
if (validLen === -1) validLen = len
|
||||
|
||||
var placeHoldersLen = validLen === len
|
||||
? 0
|
||||
: 4 - (validLen % 4)
|
||||
|
||||
return [validLen, placeHoldersLen]
|
||||
}
|
||||
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
function byteLength (b64) {
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function _byteLength (b64, validLen, placeHoldersLen) {
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function toByteArray (b64) {
|
||||
var tmp
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
|
||||
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
||||
|
||||
var curByte = 0
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
var len = placeHoldersLen > 0
|
||||
? validLen - 4
|
||||
: validLen
|
||||
|
||||
var i
|
||||
for (i = 0; i < len; i += 4) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||
revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[curByte++] = (tmp >> 16) & 0xFF
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 2) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 1) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
function tripletToBase64 (num) {
|
||||
return lookup[num >> 18 & 0x3F] +
|
||||
lookup[num >> 12 & 0x3F] +
|
||||
lookup[num >> 6 & 0x3F] +
|
||||
lookup[num & 0x3F]
|
||||
}
|
||||
|
||||
function encodeChunk (uint8, start, end) {
|
||||
var tmp
|
||||
var output = []
|
||||
for (var i = start; i < end; i += 3) {
|
||||
tmp =
|
||||
((uint8[i] << 16) & 0xFF0000) +
|
||||
((uint8[i + 1] << 8) & 0xFF00) +
|
||||
(uint8[i + 2] & 0xFF)
|
||||
output.push(tripletToBase64(tmp))
|
||||
}
|
||||
return output.join('')
|
||||
}
|
||||
|
||||
function fromByteArray (uint8) {
|
||||
var tmp
|
||||
var len = uint8.length
|
||||
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||
var parts = []
|
||||
var maxChunkLength = 16383 // must be multiple of 3
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
if (extraBytes === 1) {
|
||||
tmp = uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 2] +
|
||||
lookup[(tmp << 4) & 0x3F] +
|
||||
'=='
|
||||
)
|
||||
} else if (extraBytes === 2) {
|
||||
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 10] +
|
||||
lookup[(tmp >> 4) & 0x3F] +
|
||||
lookup[(tmp << 2) & 0x3F] +
|
||||
'='
|
||||
)
|
||||
}
|
||||
|
||||
return parts.join('')
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696797);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,569 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696798, function(require, module, exports) {
|
||||
|
||||
|
||||
var crypto_hash_sha512 = require('tweetnacl').lowlevel.crypto_hash;
|
||||
|
||||
/*
|
||||
* This file is a 1:1 port from the OpenBSD blowfish.c and bcrypt_pbkdf.c. As a
|
||||
* result, it retains the original copyright and license. The two files are
|
||||
* under slightly different (but compatible) licenses, and are here combined in
|
||||
* one file.
|
||||
*
|
||||
* Credit for the actual porting work goes to:
|
||||
* Devi Mandiri <me@devi.web.id>
|
||||
*/
|
||||
|
||||
/*
|
||||
* The Blowfish portions are under the following license:
|
||||
*
|
||||
* Blowfish block cipher for OpenBSD
|
||||
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Implementation advice by David Mazieres <dm@lcs.mit.edu>.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The bcrypt_pbkdf portions are under the following license:
|
||||
*
|
||||
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Performance improvements (Javascript-specific):
|
||||
*
|
||||
* Copyright 2016, Joyent Inc
|
||||
* Author: Alex Wilson <alex.wilson@joyent.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
// Ported from OpenBSD bcrypt_pbkdf.c v1.9
|
||||
|
||||
var BLF_J = 0;
|
||||
|
||||
var Blowfish = function() {
|
||||
this.S = [
|
||||
new Uint32Array([
|
||||
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
|
||||
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
|
||||
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
|
||||
0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
|
||||
0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
|
||||
0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
|
||||
0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
|
||||
0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
|
||||
0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
|
||||
0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
|
||||
0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
|
||||
0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
|
||||
0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
|
||||
0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
|
||||
0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
|
||||
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
|
||||
0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
|
||||
0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
|
||||
0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
|
||||
0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
|
||||
0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
|
||||
0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
|
||||
0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
|
||||
0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
|
||||
0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
|
||||
0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
|
||||
0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
|
||||
0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
|
||||
0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
|
||||
0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
|
||||
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
|
||||
0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
|
||||
0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
|
||||
0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
|
||||
0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
|
||||
0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
|
||||
0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
|
||||
0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
|
||||
0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
|
||||
0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
|
||||
0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
|
||||
0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
|
||||
0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
|
||||
0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
|
||||
0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
|
||||
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
|
||||
0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
|
||||
0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
|
||||
0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
|
||||
0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
|
||||
0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
|
||||
0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
|
||||
0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
|
||||
0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
|
||||
0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
|
||||
0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
|
||||
0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
|
||||
0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
|
||||
0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
|
||||
0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
|
||||
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
|
||||
0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
|
||||
0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
|
||||
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a]),
|
||||
new Uint32Array([
|
||||
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
|
||||
0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
|
||||
0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
|
||||
0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
|
||||
0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
|
||||
0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
|
||||
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
|
||||
0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
|
||||
0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
|
||||
0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
|
||||
0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
|
||||
0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
|
||||
0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
|
||||
0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
|
||||
0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
|
||||
0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
|
||||
0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
|
||||
0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
|
||||
0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
|
||||
0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
|
||||
0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
|
||||
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
|
||||
0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
|
||||
0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
|
||||
0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
|
||||
0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
|
||||
0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
|
||||
0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
|
||||
0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
|
||||
0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
|
||||
0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
|
||||
0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
|
||||
0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
|
||||
0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
|
||||
0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
|
||||
0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
|
||||
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
|
||||
0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
|
||||
0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
|
||||
0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
|
||||
0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
|
||||
0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
|
||||
0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
|
||||
0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
|
||||
0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
|
||||
0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
|
||||
0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
|
||||
0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
|
||||
0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
|
||||
0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
|
||||
0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
|
||||
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
|
||||
0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
|
||||
0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
|
||||
0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
|
||||
0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
|
||||
0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
|
||||
0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
|
||||
0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
|
||||
0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
|
||||
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
|
||||
0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
|
||||
0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
|
||||
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7]),
|
||||
new Uint32Array([
|
||||
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
|
||||
0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
|
||||
0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
|
||||
0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
|
||||
0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
|
||||
0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
|
||||
0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
|
||||
0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
|
||||
0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
|
||||
0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
|
||||
0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
|
||||
0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
|
||||
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
|
||||
0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
|
||||
0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
|
||||
0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
|
||||
0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
|
||||
0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
|
||||
0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
|
||||
0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
|
||||
0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
|
||||
0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
|
||||
0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
|
||||
0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
|
||||
0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
|
||||
0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
|
||||
0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
|
||||
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
|
||||
0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
|
||||
0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
|
||||
0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
|
||||
0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
|
||||
0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
|
||||
0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
|
||||
0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
|
||||
0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
|
||||
0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
|
||||
0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
|
||||
0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
|
||||
0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
|
||||
0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
|
||||
0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
|
||||
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
|
||||
0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
|
||||
0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
|
||||
0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
|
||||
0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
|
||||
0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
|
||||
0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
|
||||
0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
|
||||
0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
|
||||
0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
|
||||
0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
|
||||
0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
|
||||
0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
|
||||
0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
|
||||
0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
|
||||
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
|
||||
0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
|
||||
0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
|
||||
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
|
||||
0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
|
||||
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
|
||||
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0]),
|
||||
new Uint32Array([
|
||||
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
|
||||
0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
|
||||
0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
|
||||
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
|
||||
0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
|
||||
0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
|
||||
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
|
||||
0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
|
||||
0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
|
||||
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
|
||||
0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
|
||||
0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
|
||||
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
|
||||
0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
|
||||
0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
|
||||
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
|
||||
0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
|
||||
0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
|
||||
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
|
||||
0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
|
||||
0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
|
||||
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
|
||||
0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
|
||||
0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
|
||||
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
|
||||
0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
|
||||
0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
|
||||
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
|
||||
0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
|
||||
0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
|
||||
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
|
||||
0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
|
||||
0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
|
||||
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
|
||||
0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
|
||||
0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
|
||||
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
|
||||
0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
|
||||
0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
|
||||
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
|
||||
0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
|
||||
0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
|
||||
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
|
||||
0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
|
||||
0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
|
||||
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
|
||||
0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
|
||||
0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
|
||||
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
|
||||
0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
|
||||
0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
|
||||
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
|
||||
0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
|
||||
0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
|
||||
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
|
||||
0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
|
||||
0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
|
||||
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
|
||||
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
|
||||
0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
|
||||
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
|
||||
0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
|
||||
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
|
||||
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6])
|
||||
];
|
||||
this.P = new Uint32Array([
|
||||
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
|
||||
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
|
||||
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
|
||||
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
|
||||
0x9216d5d9, 0x8979fb1b]);
|
||||
};
|
||||
|
||||
function F(S, x8, i) {
|
||||
return (((S[0][x8[i+3]] +
|
||||
S[1][x8[i+2]]) ^
|
||||
S[2][x8[i+1]]) +
|
||||
S[3][x8[i]]);
|
||||
};
|
||||
|
||||
Blowfish.prototype.encipher = function(x, x8) {
|
||||
if (x8 === undefined) {
|
||||
x8 = new Uint8Array(x.buffer);
|
||||
if (x.byteOffset !== 0)
|
||||
x8 = x8.subarray(x.byteOffset);
|
||||
}
|
||||
x[0] ^= this.P[0];
|
||||
for (var i = 1; i < 16; i += 2) {
|
||||
x[1] ^= F(this.S, x8, 0) ^ this.P[i];
|
||||
x[0] ^= F(this.S, x8, 4) ^ this.P[i+1];
|
||||
}
|
||||
var t = x[0];
|
||||
x[0] = x[1] ^ this.P[17];
|
||||
x[1] = t;
|
||||
};
|
||||
|
||||
Blowfish.prototype.decipher = function(x) {
|
||||
var x8 = new Uint8Array(x.buffer);
|
||||
if (x.byteOffset !== 0)
|
||||
x8 = x8.subarray(x.byteOffset);
|
||||
x[0] ^= this.P[17];
|
||||
for (var i = 16; i > 0; i -= 2) {
|
||||
x[1] ^= F(this.S, x8, 0) ^ this.P[i];
|
||||
x[0] ^= F(this.S, x8, 4) ^ this.P[i-1];
|
||||
}
|
||||
var t = x[0];
|
||||
x[0] = x[1] ^ this.P[0];
|
||||
x[1] = t;
|
||||
};
|
||||
|
||||
function stream2word(data, databytes){
|
||||
var i, temp = 0;
|
||||
for (i = 0; i < 4; i++, BLF_J++) {
|
||||
if (BLF_J >= databytes) BLF_J = 0;
|
||||
temp = (temp << 8) | data[BLF_J];
|
||||
}
|
||||
return temp;
|
||||
};
|
||||
|
||||
Blowfish.prototype.expand0state = function(key, keybytes) {
|
||||
var d = new Uint32Array(2), i, k;
|
||||
var d8 = new Uint8Array(d.buffer);
|
||||
|
||||
for (i = 0, BLF_J = 0; i < 18; i++) {
|
||||
this.P[i] ^= stream2word(key, keybytes);
|
||||
}
|
||||
BLF_J = 0;
|
||||
|
||||
for (i = 0; i < 18; i += 2) {
|
||||
this.encipher(d, d8);
|
||||
this.P[i] = d[0];
|
||||
this.P[i+1] = d[1];
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (k = 0; k < 256; k += 2) {
|
||||
this.encipher(d, d8);
|
||||
this.S[i][k] = d[0];
|
||||
this.S[i][k+1] = d[1];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blowfish.prototype.expandstate = function(data, databytes, key, keybytes) {
|
||||
var d = new Uint32Array(2), i, k;
|
||||
|
||||
for (i = 0, BLF_J = 0; i < 18; i++) {
|
||||
this.P[i] ^= stream2word(key, keybytes);
|
||||
}
|
||||
|
||||
for (i = 0, BLF_J = 0; i < 18; i += 2) {
|
||||
d[0] ^= stream2word(data, databytes);
|
||||
d[1] ^= stream2word(data, databytes);
|
||||
this.encipher(d);
|
||||
this.P[i] = d[0];
|
||||
this.P[i+1] = d[1];
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (k = 0; k < 256; k += 2) {
|
||||
d[0] ^= stream2word(data, databytes);
|
||||
d[1] ^= stream2word(data, databytes);
|
||||
this.encipher(d);
|
||||
this.S[i][k] = d[0];
|
||||
this.S[i][k+1] = d[1];
|
||||
}
|
||||
}
|
||||
BLF_J = 0;
|
||||
};
|
||||
|
||||
Blowfish.prototype.enc = function(data, blocks) {
|
||||
for (var i = 0; i < blocks; i++) {
|
||||
this.encipher(data.subarray(i*2));
|
||||
}
|
||||
};
|
||||
|
||||
Blowfish.prototype.dec = function(data, blocks) {
|
||||
for (var i = 0; i < blocks; i++) {
|
||||
this.decipher(data.subarray(i*2));
|
||||
}
|
||||
};
|
||||
|
||||
var BCRYPT_BLOCKS = 8,
|
||||
BCRYPT_HASHSIZE = 32;
|
||||
|
||||
function bcrypt_hash(sha2pass, sha2salt, out) {
|
||||
var state = new Blowfish(),
|
||||
cdata = new Uint32Array(BCRYPT_BLOCKS), i,
|
||||
ciphertext = new Uint8Array([79,120,121,99,104,114,111,109,97,116,105,
|
||||
99,66,108,111,119,102,105,115,104,83,119,97,116,68,121,110,97,109,
|
||||
105,116,101]); //"OxychromaticBlowfishSwatDynamite"
|
||||
|
||||
state.expandstate(sha2salt, 64, sha2pass, 64);
|
||||
for (i = 0; i < 64; i++) {
|
||||
state.expand0state(sha2salt, 64);
|
||||
state.expand0state(sha2pass, 64);
|
||||
}
|
||||
|
||||
for (i = 0; i < BCRYPT_BLOCKS; i++)
|
||||
cdata[i] = stream2word(ciphertext, ciphertext.byteLength);
|
||||
for (i = 0; i < 64; i++)
|
||||
state.enc(cdata, cdata.byteLength / 8);
|
||||
|
||||
for (i = 0; i < BCRYPT_BLOCKS; i++) {
|
||||
out[4*i+3] = cdata[i] >>> 24;
|
||||
out[4*i+2] = cdata[i] >>> 16;
|
||||
out[4*i+1] = cdata[i] >>> 8;
|
||||
out[4*i+0] = cdata[i];
|
||||
}
|
||||
};
|
||||
|
||||
function bcrypt_pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds) {
|
||||
var sha2pass = new Uint8Array(64),
|
||||
sha2salt = new Uint8Array(64),
|
||||
out = new Uint8Array(BCRYPT_HASHSIZE),
|
||||
tmpout = new Uint8Array(BCRYPT_HASHSIZE),
|
||||
countsalt = new Uint8Array(saltlen+4),
|
||||
i, j, amt, stride, dest, count,
|
||||
origkeylen = keylen;
|
||||
|
||||
if (rounds < 1)
|
||||
return -1;
|
||||
if (passlen === 0 || saltlen === 0 || keylen === 0 ||
|
||||
keylen > (out.byteLength * out.byteLength) || saltlen > (1<<20))
|
||||
return -1;
|
||||
|
||||
stride = Math.floor((keylen + out.byteLength - 1) / out.byteLength);
|
||||
amt = Math.floor((keylen + stride - 1) / stride);
|
||||
|
||||
for (i = 0; i < saltlen; i++)
|
||||
countsalt[i] = salt[i];
|
||||
|
||||
crypto_hash_sha512(sha2pass, pass, passlen);
|
||||
|
||||
for (count = 1; keylen > 0; count++) {
|
||||
countsalt[saltlen+0] = count >>> 24;
|
||||
countsalt[saltlen+1] = count >>> 16;
|
||||
countsalt[saltlen+2] = count >>> 8;
|
||||
countsalt[saltlen+3] = count;
|
||||
|
||||
crypto_hash_sha512(sha2salt, countsalt, saltlen + 4);
|
||||
bcrypt_hash(sha2pass, sha2salt, tmpout);
|
||||
for (i = out.byteLength; i--;)
|
||||
out[i] = tmpout[i];
|
||||
|
||||
for (i = 1; i < rounds; i++) {
|
||||
crypto_hash_sha512(sha2salt, tmpout, tmpout.byteLength);
|
||||
bcrypt_hash(sha2pass, sha2salt, tmpout);
|
||||
for (j = 0; j < out.byteLength; j++)
|
||||
out[j] ^= tmpout[j];
|
||||
}
|
||||
|
||||
amt = Math.min(amt, keylen);
|
||||
for (i = 0; i < amt; i++) {
|
||||
dest = i * stride + (count - 1);
|
||||
if (dest >= origkeylen)
|
||||
break;
|
||||
key[dest] = out[i];
|
||||
}
|
||||
keylen -= i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
BLOCKS: BCRYPT_BLOCKS,
|
||||
HASHSIZE: BCRYPT_HASHSIZE,
|
||||
hash: bcrypt_hash,
|
||||
pbkdf: bcrypt_pbkdf
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696798);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["tweetnacl"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,54 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696826, function(require, module, exports) {
|
||||
/*jshint node:true */
|
||||
|
||||
var Buffer = require('buffer').Buffer; // browserify
|
||||
var SlowBuffer = require('buffer').SlowBuffer;
|
||||
|
||||
module.exports = bufferEq;
|
||||
|
||||
function bufferEq(a, b) {
|
||||
|
||||
// shortcutting on type is necessary for correctness
|
||||
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// buffer sizes should be well-known information, so despite this
|
||||
// shortcutting, it doesn't leak any information about the *contents* of the
|
||||
// buffers.
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var c = 0;
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
/*jshint bitwise:false */
|
||||
c |= a[i] ^ b[i]; // XOR
|
||||
}
|
||||
return c === 0;
|
||||
}
|
||||
|
||||
bufferEq.install = function() {
|
||||
Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
|
||||
return bufferEq(this, that);
|
||||
};
|
||||
};
|
||||
|
||||
var origBufEqual = Buffer.prototype.equal;
|
||||
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
||||
bufferEq.restore = function() {
|
||||
Buffer.prototype.equal = origBufEqual;
|
||||
SlowBuffer.prototype.equal = origSlowBufEqual;
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696826);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["buffer"]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["/*jshint node:true */\r\n\r\nvar Buffer = require('buffer').Buffer; // browserify\r\nvar SlowBuffer = require('buffer').SlowBuffer;\r\n\r\nmodule.exports = bufferEq;\r\n\r\nfunction bufferEq(a, b) {\r\n\r\n // shortcutting on type is necessary for correctness\r\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\r\n return false;\r\n }\r\n\r\n // buffer sizes should be well-known information, so despite this\r\n // shortcutting, it doesn't leak any information about the *contents* of the\r\n // buffers.\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n\r\n var c = 0;\r\n for (var i = 0; i < a.length; i++) {\r\n /*jshint bitwise:false */\r\n c |= a[i] ^ b[i]; // XOR\r\n }\r\n return c === 0;\r\n}\r\n\r\nbufferEq.install = function() {\r\n Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {\r\n return bufferEq(this, that);\r\n };\r\n};\r\n\r\nvar origBufEqual = Buffer.prototype.equal;\r\nvar origSlowBufEqual = SlowBuffer.prototype.equal;\r\nbufferEq.restore = function() {\r\n Buffer.prototype.equal = origBufEqual;\r\n SlowBuffer.prototype.equal = origSlowBufEqual;\r\n};\r\n"]}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,48 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696828, function(require, module, exports) {
|
||||
|
||||
|
||||
var bind = require('function-bind');
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var setFunctionLength = require('set-function-length');
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
||||
var $call = GetIntrinsic('%Function.prototype.call%');
|
||||
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
||||
|
||||
var $defineProperty = require('es-define-property');
|
||||
var $max = GetIntrinsic('%Math.max%');
|
||||
|
||||
module.exports = function callBind(originalFunction) {
|
||||
if (typeof originalFunction !== 'function') {
|
||||
throw new $TypeError('a function is required');
|
||||
}
|
||||
var func = $reflectApply(bind, $call, arguments);
|
||||
return setFunctionLength(
|
||||
func,
|
||||
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
var applyBind = function applyBind() {
|
||||
return $reflectApply(bind, $apply, arguments);
|
||||
};
|
||||
|
||||
if ($defineProperty) {
|
||||
$defineProperty(module.exports, 'apply', { value: applyBind });
|
||||
} else {
|
||||
module.exports.apply = applyBind;
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696828);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["function-bind","get-intrinsic","set-function-length","es-errors/type","es-define-property"]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\nvar bind = require('function-bind');\r\nvar GetIntrinsic = require('get-intrinsic');\r\nvar setFunctionLength = require('set-function-length');\r\n\r\nvar $TypeError = require('es-errors/type');\r\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\r\nvar $call = GetIntrinsic('%Function.prototype.call%');\r\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\r\n\r\nvar $defineProperty = require('es-define-property');\r\nvar $max = GetIntrinsic('%Math.max%');\r\n\r\nmodule.exports = function callBind(originalFunction) {\r\n\tif (typeof originalFunction !== 'function') {\r\n\t\tthrow new $TypeError('a function is required');\r\n\t}\r\n\tvar func = $reflectApply(bind, $call, arguments);\r\n\treturn setFunctionLength(\r\n\t\tfunc,\r\n\t\t1 + $max(0, originalFunction.length - (arguments.length - 1)),\r\n\t\ttrue\r\n\t);\r\n};\r\n\r\nvar applyBind = function applyBind() {\r\n\treturn $reflectApply(bind, $apply, arguments);\r\n};\r\n\r\nif ($defineProperty) {\r\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\r\n} else {\r\n\tmodule.exports.apply = applyBind;\r\n}\r\n"]}
|
@ -0,0 +1,80 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696829, function(require, module, exports) {
|
||||
function Caseless (dict) {
|
||||
this.dict = dict || {}
|
||||
}
|
||||
Caseless.prototype.set = function (name, value, clobber) {
|
||||
if (typeof name === 'object') {
|
||||
for (var i in name) {
|
||||
this.set(i, name[i], value)
|
||||
}
|
||||
} else {
|
||||
if (typeof clobber === 'undefined') clobber = true
|
||||
var has = this.has(name)
|
||||
|
||||
if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value
|
||||
else this.dict[has || name] = value
|
||||
return has
|
||||
}
|
||||
}
|
||||
Caseless.prototype.has = function (name) {
|
||||
var keys = Object.keys(this.dict)
|
||||
, name = name.toLowerCase()
|
||||
;
|
||||
for (var i=0;i<keys.length;i++) {
|
||||
if (keys[i].toLowerCase() === name) return keys[i]
|
||||
}
|
||||
return false
|
||||
}
|
||||
Caseless.prototype.get = function (name) {
|
||||
name = name.toLowerCase()
|
||||
var result, _key
|
||||
var headers = this.dict
|
||||
Object.keys(headers).forEach(function (key) {
|
||||
_key = key.toLowerCase()
|
||||
if (name === _key) result = headers[key]
|
||||
})
|
||||
return result
|
||||
}
|
||||
Caseless.prototype.swap = function (name) {
|
||||
var has = this.has(name)
|
||||
if (has === name) return
|
||||
if (!has) throw new Error('There is no header than matches "'+name+'"')
|
||||
this.dict[name] = this.dict[has]
|
||||
delete this.dict[has]
|
||||
}
|
||||
Caseless.prototype.del = function (name) {
|
||||
var has = this.has(name)
|
||||
return delete this.dict[has || name]
|
||||
}
|
||||
|
||||
module.exports = function (dict) {return new Caseless(dict)}
|
||||
module.exports.httpify = function (resp, headers) {
|
||||
var c = new Caseless(headers)
|
||||
resp.setHeader = function (key, value, clobber) {
|
||||
if (typeof value === 'undefined') return
|
||||
return c.set(key, value, clobber)
|
||||
}
|
||||
resp.hasHeader = function (key) {
|
||||
return c.has(key)
|
||||
}
|
||||
resp.getHeader = function (key) {
|
||||
return c.get(key)
|
||||
}
|
||||
resp.removeHeader = function (key) {
|
||||
return c.del(key)
|
||||
}
|
||||
resp.headers = c.dict
|
||||
return c
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696829);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["function Caseless (dict) {\r\n this.dict = dict || {}\r\n}\r\nCaseless.prototype.set = function (name, value, clobber) {\r\n if (typeof name === 'object') {\r\n for (var i in name) {\r\n this.set(i, name[i], value)\r\n }\r\n } else {\r\n if (typeof clobber === 'undefined') clobber = true\r\n var has = this.has(name)\r\n\r\n if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value\r\n else this.dict[has || name] = value\r\n return has\r\n }\r\n}\r\nCaseless.prototype.has = function (name) {\r\n var keys = Object.keys(this.dict)\r\n , name = name.toLowerCase()\r\n ;\r\n for (var i=0;i<keys.length;i++) {\r\n if (keys[i].toLowerCase() === name) return keys[i]\r\n }\r\n return false\r\n}\r\nCaseless.prototype.get = function (name) {\r\n name = name.toLowerCase()\r\n var result, _key\r\n var headers = this.dict\r\n Object.keys(headers).forEach(function (key) {\r\n _key = key.toLowerCase()\r\n if (name === _key) result = headers[key]\r\n })\r\n return result\r\n}\r\nCaseless.prototype.swap = function (name) {\r\n var has = this.has(name)\r\n if (has === name) return\r\n if (!has) throw new Error('There is no header than matches \"'+name+'\"')\r\n this.dict[name] = this.dict[has]\r\n delete this.dict[has]\r\n}\r\nCaseless.prototype.del = function (name) {\r\n var has = this.has(name)\r\n return delete this.dict[has || name]\r\n}\r\n\r\nmodule.exports = function (dict) {return new Caseless(dict)}\r\nmodule.exports.httpify = function (resp, headers) {\r\n var c = new Caseless(headers)\r\n resp.setHeader = function (key, value, clobber) {\r\n if (typeof value === 'undefined') return\r\n return c.set(key, value, clobber)\r\n }\r\n resp.hasHeader = function (key) {\r\n return c.has(key)\r\n }\r\n resp.getHeader = function (key) {\r\n return c.get(key)\r\n }\r\n resp.removeHeader = function (key) {\r\n return c.del(key)\r\n }\r\n resp.headers = c.dict\r\n return c\r\n}\r\n"]}
|
@ -0,0 +1,270 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696830, function(require, module, exports) {
|
||||
var clone = (function() {
|
||||
|
||||
|
||||
function _instanceof(obj, type) {
|
||||
return type != null && obj instanceof type;
|
||||
}
|
||||
|
||||
var nativeMap;
|
||||
try {
|
||||
nativeMap = Map;
|
||||
} catch(_) {
|
||||
// maybe a reference error because no `Map`. Give it a dummy value that no
|
||||
// value will ever be an instanceof.
|
||||
nativeMap = function() {};
|
||||
}
|
||||
|
||||
var nativeSet;
|
||||
try {
|
||||
nativeSet = Set;
|
||||
} catch(_) {
|
||||
nativeSet = function() {};
|
||||
}
|
||||
|
||||
var nativePromise;
|
||||
try {
|
||||
nativePromise = Promise;
|
||||
} catch(_) {
|
||||
nativePromise = function() {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones (copies) an Object using deep copying.
|
||||
*
|
||||
* This function supports circular references by default, but if you are certain
|
||||
* there are no circular references in your object, you can save some CPU time
|
||||
* by calling clone(obj, false).
|
||||
*
|
||||
* Caution: if `circular` is false and `parent` contains circular references,
|
||||
* your program may enter an infinite loop and crash.
|
||||
*
|
||||
* @param `parent` - the object to be cloned
|
||||
* @param `circular` - set to true if the object to be cloned may contain
|
||||
* circular references. (optional - true by default)
|
||||
* @param `depth` - set to a number if the object is only to be cloned to
|
||||
* a particular depth. (optional - defaults to Infinity)
|
||||
* @param `prototype` - sets the prototype to be used when cloning an object.
|
||||
* (optional - defaults to parent prototype).
|
||||
* @param `includeNonEnumerable` - set to true if the non-enumerable properties
|
||||
* should be cloned as well. Non-enumerable properties on the prototype
|
||||
* chain will be ignored. (optional - false by default)
|
||||
*/
|
||||
function clone(parent, circular, depth, prototype, includeNonEnumerable) {
|
||||
if (typeof circular === 'object') {
|
||||
depth = circular.depth;
|
||||
prototype = circular.prototype;
|
||||
includeNonEnumerable = circular.includeNonEnumerable;
|
||||
circular = circular.circular;
|
||||
}
|
||||
// maintain two arrays for circular references, where corresponding parents
|
||||
// and children have the same index
|
||||
var allParents = [];
|
||||
var allChildren = [];
|
||||
|
||||
var useBuffer = typeof Buffer != 'undefined';
|
||||
|
||||
if (typeof circular == 'undefined')
|
||||
circular = true;
|
||||
|
||||
if (typeof depth == 'undefined')
|
||||
depth = Infinity;
|
||||
|
||||
// recurse this function so we don't reset allParents and allChildren
|
||||
function _clone(parent, depth) {
|
||||
// cloning null always returns null
|
||||
if (parent === null)
|
||||
return null;
|
||||
|
||||
if (depth === 0)
|
||||
return parent;
|
||||
|
||||
var child;
|
||||
var proto;
|
||||
if (typeof parent != 'object') {
|
||||
return parent;
|
||||
}
|
||||
|
||||
if (_instanceof(parent, nativeMap)) {
|
||||
child = new nativeMap();
|
||||
} else if (_instanceof(parent, nativeSet)) {
|
||||
child = new nativeSet();
|
||||
} else if (_instanceof(parent, nativePromise)) {
|
||||
child = new nativePromise(function (resolve, reject) {
|
||||
parent.then(function(value) {
|
||||
resolve(_clone(value, depth - 1));
|
||||
}, function(err) {
|
||||
reject(_clone(err, depth - 1));
|
||||
});
|
||||
});
|
||||
} else if (clone.__isArray(parent)) {
|
||||
child = [];
|
||||
} else if (clone.__isRegExp(parent)) {
|
||||
child = new RegExp(parent.source, __getRegExpFlags(parent));
|
||||
if (parent.lastIndex) child.lastIndex = parent.lastIndex;
|
||||
} else if (clone.__isDate(parent)) {
|
||||
child = new Date(parent.getTime());
|
||||
} else if (useBuffer && Buffer.isBuffer(parent)) {
|
||||
if (Buffer.allocUnsafe) {
|
||||
// Node.js >= 4.5.0
|
||||
child = Buffer.allocUnsafe(parent.length);
|
||||
} else {
|
||||
// Older Node.js versions
|
||||
child = new Buffer(parent.length);
|
||||
}
|
||||
parent.copy(child);
|
||||
return child;
|
||||
} else if (_instanceof(parent, Error)) {
|
||||
child = Object.create(parent);
|
||||
} else {
|
||||
if (typeof prototype == 'undefined') {
|
||||
proto = Object.getPrototypeOf(parent);
|
||||
child = Object.create(proto);
|
||||
}
|
||||
else {
|
||||
child = Object.create(prototype);
|
||||
proto = prototype;
|
||||
}
|
||||
}
|
||||
|
||||
if (circular) {
|
||||
var index = allParents.indexOf(parent);
|
||||
|
||||
if (index != -1) {
|
||||
return allChildren[index];
|
||||
}
|
||||
allParents.push(parent);
|
||||
allChildren.push(child);
|
||||
}
|
||||
|
||||
if (_instanceof(parent, nativeMap)) {
|
||||
parent.forEach(function(value, key) {
|
||||
var keyChild = _clone(key, depth - 1);
|
||||
var valueChild = _clone(value, depth - 1);
|
||||
child.set(keyChild, valueChild);
|
||||
});
|
||||
}
|
||||
if (_instanceof(parent, nativeSet)) {
|
||||
parent.forEach(function(value) {
|
||||
var entryChild = _clone(value, depth - 1);
|
||||
child.add(entryChild);
|
||||
});
|
||||
}
|
||||
|
||||
for (var i in parent) {
|
||||
var attrs;
|
||||
if (proto) {
|
||||
attrs = Object.getOwnPropertyDescriptor(proto, i);
|
||||
}
|
||||
|
||||
if (attrs && attrs.set == null) {
|
||||
continue;
|
||||
}
|
||||
child[i] = _clone(parent[i], depth - 1);
|
||||
}
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(parent);
|
||||
for (var i = 0; i < symbols.length; i++) {
|
||||
// Don't need to worry about cloning a symbol because it is a primitive,
|
||||
// like a number or string.
|
||||
var symbol = symbols[i];
|
||||
var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
|
||||
if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
|
||||
continue;
|
||||
}
|
||||
child[symbol] = _clone(parent[symbol], depth - 1);
|
||||
if (!descriptor.enumerable) {
|
||||
Object.defineProperty(child, symbol, {
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (includeNonEnumerable) {
|
||||
var allPropertyNames = Object.getOwnPropertyNames(parent);
|
||||
for (var i = 0; i < allPropertyNames.length; i++) {
|
||||
var propertyName = allPropertyNames[i];
|
||||
var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
|
||||
if (descriptor && descriptor.enumerable) {
|
||||
continue;
|
||||
}
|
||||
child[propertyName] = _clone(parent[propertyName], depth - 1);
|
||||
Object.defineProperty(child, propertyName, {
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
return _clone(parent, depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple flat clone using prototype, accepts only objects, usefull for property
|
||||
* override on FLAT configuration object (no nested props).
|
||||
*
|
||||
* USE WITH CAUTION! This may not behave as you wish if you do not know how this
|
||||
* works.
|
||||
*/
|
||||
clone.clonePrototype = function clonePrototype(parent) {
|
||||
if (parent === null)
|
||||
return null;
|
||||
|
||||
var c = function () {};
|
||||
c.prototype = parent;
|
||||
return new c();
|
||||
};
|
||||
|
||||
// private utility functions
|
||||
|
||||
function __objToStr(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
clone.__objToStr = __objToStr;
|
||||
|
||||
function __isDate(o) {
|
||||
return typeof o === 'object' && __objToStr(o) === '[object Date]';
|
||||
}
|
||||
clone.__isDate = __isDate;
|
||||
|
||||
function __isArray(o) {
|
||||
return typeof o === 'object' && __objToStr(o) === '[object Array]';
|
||||
}
|
||||
clone.__isArray = __isArray;
|
||||
|
||||
function __isRegExp(o) {
|
||||
return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
|
||||
}
|
||||
clone.__isRegExp = __isRegExp;
|
||||
|
||||
function __getRegExpFlags(re) {
|
||||
var flags = '';
|
||||
if (re.global) flags += 'g';
|
||||
if (re.ignoreCase) flags += 'i';
|
||||
if (re.multiline) flags += 'm';
|
||||
return flags;
|
||||
}
|
||||
clone.__getRegExpFlags = __getRegExpFlags;
|
||||
|
||||
return clone;
|
||||
})();
|
||||
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = clone;
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696830);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,221 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696831, function(require, module, exports) {
|
||||
var util = require('util');
|
||||
var Stream = require('stream').Stream;
|
||||
var DelayedStream = require('delayed-stream');
|
||||
|
||||
module.exports = CombinedStream;
|
||||
function CombinedStream() {
|
||||
this.writable = false;
|
||||
this.readable = true;
|
||||
this.dataSize = 0;
|
||||
this.maxDataSize = 2 * 1024 * 1024;
|
||||
this.pauseStreams = true;
|
||||
|
||||
this._released = false;
|
||||
this._streams = [];
|
||||
this._currentStream = null;
|
||||
this._insideLoop = false;
|
||||
this._pendingNext = false;
|
||||
}
|
||||
util.inherits(CombinedStream, Stream);
|
||||
|
||||
CombinedStream.create = function(options) {
|
||||
var combinedStream = new this();
|
||||
|
||||
options = options || {};
|
||||
for (var option in options) {
|
||||
combinedStream[option] = options[option];
|
||||
}
|
||||
|
||||
return combinedStream;
|
||||
};
|
||||
|
||||
CombinedStream.isStreamLike = function(stream) {
|
||||
return (typeof stream !== 'function')
|
||||
&& (typeof stream !== 'string')
|
||||
&& (typeof stream !== 'boolean')
|
||||
&& (typeof stream !== 'number')
|
||||
&& (!Buffer.isBuffer(stream));
|
||||
};
|
||||
|
||||
CombinedStream.prototype.append = function(stream) {
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
|
||||
if (isStreamLike) {
|
||||
if (!(stream instanceof DelayedStream)) {
|
||||
var newStream = DelayedStream.create(stream, {
|
||||
maxDataSize: Infinity,
|
||||
pauseStream: this.pauseStreams,
|
||||
});
|
||||
stream.on('data', this._checkDataSize.bind(this));
|
||||
stream = newStream;
|
||||
}
|
||||
|
||||
this._handleErrors(stream);
|
||||
|
||||
if (this.pauseStreams) {
|
||||
stream.pause();
|
||||
}
|
||||
}
|
||||
|
||||
this._streams.push(stream);
|
||||
return this;
|
||||
};
|
||||
|
||||
CombinedStream.prototype.pipe = function(dest, options) {
|
||||
Stream.prototype.pipe.call(this, dest, options);
|
||||
this.resume();
|
||||
return dest;
|
||||
};
|
||||
|
||||
CombinedStream.prototype._getNext = function() {
|
||||
this._currentStream = null;
|
||||
|
||||
if (this._insideLoop) {
|
||||
this._pendingNext = true;
|
||||
return; // defer call
|
||||
}
|
||||
|
||||
this._insideLoop = true;
|
||||
try {
|
||||
do {
|
||||
this._pendingNext = false;
|
||||
this._realGetNext();
|
||||
} while (this._pendingNext);
|
||||
} finally {
|
||||
this._insideLoop = false;
|
||||
}
|
||||
};
|
||||
|
||||
CombinedStream.prototype._realGetNext = function() {
|
||||
var stream = this._streams.shift();
|
||||
|
||||
|
||||
if (typeof stream == 'undefined') {
|
||||
this.end();
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof stream !== 'function') {
|
||||
this._pipeNext(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
var getStream = stream;
|
||||
getStream(function(stream) {
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
if (isStreamLike) {
|
||||
stream.on('data', this._checkDataSize.bind(this));
|
||||
this._handleErrors(stream);
|
||||
}
|
||||
|
||||
this._pipeNext(stream);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
CombinedStream.prototype._pipeNext = function(stream) {
|
||||
this._currentStream = stream;
|
||||
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
if (isStreamLike) {
|
||||
stream.on('end', this._getNext.bind(this));
|
||||
stream.pipe(this, {end: false});
|
||||
return;
|
||||
}
|
||||
|
||||
var value = stream;
|
||||
this.write(value);
|
||||
this._getNext();
|
||||
};
|
||||
|
||||
CombinedStream.prototype._handleErrors = function(stream) {
|
||||
var self = this;
|
||||
stream.on('error', function(err) {
|
||||
self._emitError(err);
|
||||
});
|
||||
};
|
||||
|
||||
CombinedStream.prototype.write = function(data) {
|
||||
this.emit('data', data);
|
||||
};
|
||||
|
||||
CombinedStream.prototype.pause = function() {
|
||||
if (!this.pauseStreams) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();
|
||||
this.emit('pause');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.resume = function() {
|
||||
if (!this._released) {
|
||||
this._released = true;
|
||||
this.writable = true;
|
||||
this._getNext();
|
||||
}
|
||||
|
||||
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();
|
||||
this.emit('resume');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.end = function() {
|
||||
this._reset();
|
||||
this.emit('end');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.destroy = function() {
|
||||
this._reset();
|
||||
this.emit('close');
|
||||
};
|
||||
|
||||
CombinedStream.prototype._reset = function() {
|
||||
this.writable = false;
|
||||
this._streams = [];
|
||||
this._currentStream = null;
|
||||
};
|
||||
|
||||
CombinedStream.prototype._checkDataSize = function() {
|
||||
this._updateDataSize();
|
||||
if (this.dataSize <= this.maxDataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
var message =
|
||||
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';
|
||||
this._emitError(new Error(message));
|
||||
};
|
||||
|
||||
CombinedStream.prototype._updateDataSize = function() {
|
||||
this.dataSize = 0;
|
||||
|
||||
var self = this;
|
||||
this._streams.forEach(function(stream) {
|
||||
if (!stream.dataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.dataSize += stream.dataSize;
|
||||
});
|
||||
|
||||
if (this._currentStream && this._currentStream.dataSize) {
|
||||
this.dataSize += this._currentStream.dataSize;
|
||||
}
|
||||
};
|
||||
|
||||
CombinedStream.prototype._emitError = function(err) {
|
||||
this._reset();
|
||||
this.emit('error', err);
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696831);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["util","stream","delayed-stream"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,120 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696832, function(require, module, exports) {
|
||||
// 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.
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
|
||||
function isArray(arg) {
|
||||
if (Array.isArray) {
|
||||
return Array.isArray(arg);
|
||||
}
|
||||
return objectToString(arg) === '[object Array]';
|
||||
}
|
||||
exports.isArray = isArray;
|
||||
|
||||
function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
exports.isBoolean = isBoolean;
|
||||
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
exports.isNull = isNull;
|
||||
|
||||
function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
exports.isNullOrUndefined = isNullOrUndefined;
|
||||
|
||||
function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
exports.isNumber = isNumber;
|
||||
|
||||
function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
|
||||
function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
exports.isSymbol = isSymbol;
|
||||
|
||||
function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
exports.isUndefined = isUndefined;
|
||||
|
||||
function isRegExp(re) {
|
||||
return objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
exports.isRegExp = isRegExp;
|
||||
|
||||
function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
exports.isObject = isObject;
|
||||
|
||||
function isDate(d) {
|
||||
return objectToString(d) === '[object Date]';
|
||||
}
|
||||
exports.isDate = isDate;
|
||||
|
||||
function isError(e) {
|
||||
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
exports.isError = isError;
|
||||
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
|
||||
function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
exports.isBuffer = Buffer.isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696832);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["util.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\r\n//\r\n// Permission is hereby granted, free of charge, to any person obtaining a\r\n// copy of this software and associated documentation files (the\r\n// \"Software\"), to deal in the Software without restriction, including\r\n// without limitation the rights to use, copy, modify, merge, publish,\r\n// distribute, sublicense, and/or sell copies of the Software, and to permit\r\n// persons to whom the Software is furnished to do so, subject to the\r\n// following conditions:\r\n//\r\n// The above copyright notice and this permission notice shall be included\r\n// in all copies or substantial portions of the Software.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\r\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\r\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\r\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\r\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n// NOTE: These type checking functions intentionally don't use `instanceof`\r\n// because it is fragile and can be easily faked with `Object.create()`.\r\n\r\nfunction isArray(arg) {\r\n if (Array.isArray) {\r\n return Array.isArray(arg);\r\n }\r\n return objectToString(arg) === '[object Array]';\r\n}\r\nexports.isArray = isArray;\r\n\r\nfunction isBoolean(arg) {\r\n return typeof arg === 'boolean';\r\n}\r\nexports.isBoolean = isBoolean;\r\n\r\nfunction isNull(arg) {\r\n return arg === null;\r\n}\r\nexports.isNull = isNull;\r\n\r\nfunction isNullOrUndefined(arg) {\r\n return arg == null;\r\n}\r\nexports.isNullOrUndefined = isNullOrUndefined;\r\n\r\nfunction isNumber(arg) {\r\n return typeof arg === 'number';\r\n}\r\nexports.isNumber = isNumber;\r\n\r\nfunction isString(arg) {\r\n return typeof arg === 'string';\r\n}\r\nexports.isString = isString;\r\n\r\nfunction isSymbol(arg) {\r\n return typeof arg === 'symbol';\r\n}\r\nexports.isSymbol = isSymbol;\r\n\r\nfunction isUndefined(arg) {\r\n return arg === void 0;\r\n}\r\nexports.isUndefined = isUndefined;\r\n\r\nfunction isRegExp(re) {\r\n return objectToString(re) === '[object RegExp]';\r\n}\r\nexports.isRegExp = isRegExp;\r\n\r\nfunction isObject(arg) {\r\n return typeof arg === 'object' && arg !== null;\r\n}\r\nexports.isObject = isObject;\r\n\r\nfunction isDate(d) {\r\n return objectToString(d) === '[object Date]';\r\n}\r\nexports.isDate = isDate;\r\n\r\nfunction isError(e) {\r\n return (objectToString(e) === '[object Error]' || e instanceof Error);\r\n}\r\nexports.isError = isError;\r\n\r\nfunction isFunction(arg) {\r\n return typeof arg === 'function';\r\n}\r\nexports.isFunction = isFunction;\r\n\r\nfunction isPrimitive(arg) {\r\n return arg === null ||\r\n typeof arg === 'boolean' ||\r\n typeof arg === 'number' ||\r\n typeof arg === 'string' ||\r\n typeof arg === 'symbol' || // ES6 symbol\r\n typeof arg === 'undefined';\r\n}\r\nexports.isPrimitive = isPrimitive;\r\n\r\nexports.isBuffer = Buffer.isBuffer;\r\n\r\nfunction objectToString(o) {\r\n return Object.prototype.toString.call(o);\r\n}\r\n"]}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,69 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696834, function(require, module, exports) {
|
||||
|
||||
|
||||
var $defineProperty = require('es-define-property');
|
||||
|
||||
var $SyntaxError = require('es-errors/syntax');
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var gopd = require('gopd');
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = function defineDataProperty(
|
||||
obj,
|
||||
property,
|
||||
value
|
||||
) {
|
||||
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
throw new $TypeError('`obj` must be an object or a function`');
|
||||
}
|
||||
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
||||
throw new $TypeError('`property` must be a string or a symbol`');
|
||||
}
|
||||
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
||||
throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
|
||||
}
|
||||
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
||||
throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
|
||||
}
|
||||
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
||||
throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
|
||||
}
|
||||
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
||||
throw new $TypeError('`loose`, if provided, must be a boolean');
|
||||
}
|
||||
|
||||
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
||||
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
||||
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
||||
var loose = arguments.length > 6 ? arguments[6] : false;
|
||||
|
||||
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
||||
var desc = !!gopd && gopd(obj, property);
|
||||
|
||||
if ($defineProperty) {
|
||||
$defineProperty(obj, property, {
|
||||
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
||||
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
||||
value: value,
|
||||
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
||||
});
|
||||
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
||||
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
||||
obj[property] = value; // eslint-disable-line no-param-reassign
|
||||
} else {
|
||||
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
||||
}
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696834);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["es-define-property","es-errors/syntax","es-errors/type","gopd"]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\nvar $defineProperty = require('es-define-property');\r\n\r\nvar $SyntaxError = require('es-errors/syntax');\r\nvar $TypeError = require('es-errors/type');\r\n\r\nvar gopd = require('gopd');\r\n\r\n/** @type {import('.')} */\r\nmodule.exports = function defineDataProperty(\r\n\tobj,\r\n\tproperty,\r\n\tvalue\r\n) {\r\n\tif (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {\r\n\t\tthrow new $TypeError('`obj` must be an object or a function`');\r\n\t}\r\n\tif (typeof property !== 'string' && typeof property !== 'symbol') {\r\n\t\tthrow new $TypeError('`property` must be a string or a symbol`');\r\n\t}\r\n\tif (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {\r\n\t\tthrow new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');\r\n\t}\r\n\tif (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {\r\n\t\tthrow new $TypeError('`nonWritable`, if provided, must be a boolean or null');\r\n\t}\r\n\tif (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {\r\n\t\tthrow new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');\r\n\t}\r\n\tif (arguments.length > 6 && typeof arguments[6] !== 'boolean') {\r\n\t\tthrow new $TypeError('`loose`, if provided, must be a boolean');\r\n\t}\r\n\r\n\tvar nonEnumerable = arguments.length > 3 ? arguments[3] : null;\r\n\tvar nonWritable = arguments.length > 4 ? arguments[4] : null;\r\n\tvar nonConfigurable = arguments.length > 5 ? arguments[5] : null;\r\n\tvar loose = arguments.length > 6 ? arguments[6] : false;\r\n\r\n\t/* @type {false | TypedPropertyDescriptor<unknown>} */\r\n\tvar desc = !!gopd && gopd(obj, property);\r\n\r\n\tif ($defineProperty) {\r\n\t\t$defineProperty(obj, property, {\r\n\t\t\tconfigurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,\r\n\t\t\tenumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,\r\n\t\t\tvalue: value,\r\n\t\t\twritable: nonWritable === null && desc ? desc.writable : !nonWritable\r\n\t\t});\r\n\t} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {\r\n\t\t// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable\r\n\t\tobj[property] = value; // eslint-disable-line no-param-reassign\r\n\t} else {\r\n\t\tthrow new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');\r\n\t}\r\n};\r\n"]}
|
@ -0,0 +1,120 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696835, function(require, module, exports) {
|
||||
var Stream = require('stream').Stream;
|
||||
var util = require('util');
|
||||
|
||||
module.exports = DelayedStream;
|
||||
function DelayedStream() {
|
||||
this.source = null;
|
||||
this.dataSize = 0;
|
||||
this.maxDataSize = 1024 * 1024;
|
||||
this.pauseStream = true;
|
||||
|
||||
this._maxDataSizeExceeded = false;
|
||||
this._released = false;
|
||||
this._bufferedEvents = [];
|
||||
}
|
||||
util.inherits(DelayedStream, Stream);
|
||||
|
||||
DelayedStream.create = function(source, options) {
|
||||
var delayedStream = new this();
|
||||
|
||||
options = options || {};
|
||||
for (var option in options) {
|
||||
delayedStream[option] = options[option];
|
||||
}
|
||||
|
||||
delayedStream.source = source;
|
||||
|
||||
var realEmit = source.emit;
|
||||
source.emit = function() {
|
||||
delayedStream._handleEmit(arguments);
|
||||
return realEmit.apply(source, arguments);
|
||||
};
|
||||
|
||||
source.on('error', function() {});
|
||||
if (delayedStream.pauseStream) {
|
||||
source.pause();
|
||||
}
|
||||
|
||||
return delayedStream;
|
||||
};
|
||||
|
||||
Object.defineProperty(DelayedStream.prototype, 'readable', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.source.readable;
|
||||
}
|
||||
});
|
||||
|
||||
DelayedStream.prototype.setEncoding = function() {
|
||||
return this.source.setEncoding.apply(this.source, arguments);
|
||||
};
|
||||
|
||||
DelayedStream.prototype.resume = function() {
|
||||
if (!this._released) {
|
||||
this.release();
|
||||
}
|
||||
|
||||
this.source.resume();
|
||||
};
|
||||
|
||||
DelayedStream.prototype.pause = function() {
|
||||
this.source.pause();
|
||||
};
|
||||
|
||||
DelayedStream.prototype.release = function() {
|
||||
this._released = true;
|
||||
|
||||
this._bufferedEvents.forEach(function(args) {
|
||||
this.emit.apply(this, args);
|
||||
}.bind(this));
|
||||
this._bufferedEvents = [];
|
||||
};
|
||||
|
||||
DelayedStream.prototype.pipe = function() {
|
||||
var r = Stream.prototype.pipe.apply(this, arguments);
|
||||
this.resume();
|
||||
return r;
|
||||
};
|
||||
|
||||
DelayedStream.prototype._handleEmit = function(args) {
|
||||
if (this._released) {
|
||||
this.emit.apply(this, args);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0] === 'data') {
|
||||
this.dataSize += args[1].length;
|
||||
this._checkIfMaxDataSizeExceeded();
|
||||
}
|
||||
|
||||
this._bufferedEvents.push(args);
|
||||
};
|
||||
|
||||
DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
||||
if (this._maxDataSizeExceeded) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.dataSize <= this.maxDataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._maxDataSizeExceeded = true;
|
||||
var message =
|
||||
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
|
||||
this.emit('error', new Error(message));
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696835);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["stream","util"]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["delayed_stream.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["var Stream = require('stream').Stream;\r\nvar util = require('util');\r\n\r\nmodule.exports = DelayedStream;\r\nfunction DelayedStream() {\r\n this.source = null;\r\n this.dataSize = 0;\r\n this.maxDataSize = 1024 * 1024;\r\n this.pauseStream = true;\r\n\r\n this._maxDataSizeExceeded = false;\r\n this._released = false;\r\n this._bufferedEvents = [];\r\n}\r\nutil.inherits(DelayedStream, Stream);\r\n\r\nDelayedStream.create = function(source, options) {\r\n var delayedStream = new this();\r\n\r\n options = options || {};\r\n for (var option in options) {\r\n delayedStream[option] = options[option];\r\n }\r\n\r\n delayedStream.source = source;\r\n\r\n var realEmit = source.emit;\r\n source.emit = function() {\r\n delayedStream._handleEmit(arguments);\r\n return realEmit.apply(source, arguments);\r\n };\r\n\r\n source.on('error', function() {});\r\n if (delayedStream.pauseStream) {\r\n source.pause();\r\n }\r\n\r\n return delayedStream;\r\n};\r\n\r\nObject.defineProperty(DelayedStream.prototype, 'readable', {\r\n configurable: true,\r\n enumerable: true,\r\n get: function() {\r\n return this.source.readable;\r\n }\r\n});\r\n\r\nDelayedStream.prototype.setEncoding = function() {\r\n return this.source.setEncoding.apply(this.source, arguments);\r\n};\r\n\r\nDelayedStream.prototype.resume = function() {\r\n if (!this._released) {\r\n this.release();\r\n }\r\n\r\n this.source.resume();\r\n};\r\n\r\nDelayedStream.prototype.pause = function() {\r\n this.source.pause();\r\n};\r\n\r\nDelayedStream.prototype.release = function() {\r\n this._released = true;\r\n\r\n this._bufferedEvents.forEach(function(args) {\r\n this.emit.apply(this, args);\r\n }.bind(this));\r\n this._bufferedEvents = [];\r\n};\r\n\r\nDelayedStream.prototype.pipe = function() {\r\n var r = Stream.prototype.pipe.apply(this, arguments);\r\n this.resume();\r\n return r;\r\n};\r\n\r\nDelayedStream.prototype._handleEmit = function(args) {\r\n if (this._released) {\r\n this.emit.apply(this, args);\r\n return;\r\n }\r\n\r\n if (args[0] === 'data') {\r\n this.dataSize += args[1].length;\r\n this._checkIfMaxDataSizeExceeded();\r\n }\r\n\r\n this._bufferedEvents.push(args);\r\n};\r\n\r\nDelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {\r\n if (this._maxDataSizeExceeded) {\r\n return;\r\n }\r\n\r\n if (this.dataSize <= this.maxDataSize) {\r\n return;\r\n }\r\n\r\n this._maxDataSizeExceeded = true;\r\n var message =\r\n 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'\r\n this.emit('error', new Error(message));\r\n};\r\n"]}
|
@ -0,0 +1,808 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696836, function(require, module, exports) {
|
||||
var crypto = require("crypto");
|
||||
var BigInteger = require("jsbn").BigInteger;
|
||||
var ECPointFp = require("./lib/ec.js").ECPointFp;
|
||||
var Buffer = require("safer-buffer").Buffer;
|
||||
exports.ECCurves = require("./lib/sec.js");
|
||||
|
||||
// zero prepad
|
||||
function unstupid(hex,len)
|
||||
{
|
||||
return (hex.length >= len) ? hex : unstupid("0"+hex,len);
|
||||
}
|
||||
|
||||
exports.ECKey = function(curve, key, isPublic)
|
||||
{
|
||||
var priv;
|
||||
var c = curve();
|
||||
var n = c.getN();
|
||||
var bytes = Math.floor(n.bitLength()/8);
|
||||
|
||||
if(key)
|
||||
{
|
||||
if(isPublic)
|
||||
{
|
||||
var curve = c.getCurve();
|
||||
// var x = key.slice(1,bytes+1); // skip the 04 for uncompressed format
|
||||
// var y = key.slice(bytes+1);
|
||||
// this.P = new ECPointFp(curve,
|
||||
// curve.fromBigInteger(new BigInteger(x.toString("hex"), 16)),
|
||||
// curve.fromBigInteger(new BigInteger(y.toString("hex"), 16)));
|
||||
this.P = curve.decodePointHex(key.toString("hex"));
|
||||
}else{
|
||||
if(key.length != bytes) return false;
|
||||
priv = new BigInteger(key.toString("hex"), 16);
|
||||
}
|
||||
}else{
|
||||
var n1 = n.subtract(BigInteger.ONE);
|
||||
var r = new BigInteger(crypto.randomBytes(n.bitLength()));
|
||||
priv = r.mod(n1).add(BigInteger.ONE);
|
||||
this.P = c.getG().multiply(priv);
|
||||
}
|
||||
if(this.P)
|
||||
{
|
||||
// var pubhex = unstupid(this.P.getX().toBigInteger().toString(16),bytes*2)+unstupid(this.P.getY().toBigInteger().toString(16),bytes*2);
|
||||
// this.PublicKey = Buffer.from("04"+pubhex,"hex");
|
||||
this.PublicKey = Buffer.from(c.getCurve().encodeCompressedPointHex(this.P),"hex");
|
||||
}
|
||||
if(priv)
|
||||
{
|
||||
this.PrivateKey = Buffer.from(unstupid(priv.toString(16),bytes*2),"hex");
|
||||
this.deriveSharedSecret = function(key)
|
||||
{
|
||||
if(!key || !key.P) return false;
|
||||
var S = key.P.multiply(priv);
|
||||
return Buffer.from(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, function(modId) {var map = {"./lib/ec.js":1733997696837,"./lib/sec.js":1733997696838}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696837, function(require, module, exports) {
|
||||
// Basic Javascript Elliptic Curve implementation
|
||||
// Ported loosely from BouncyCastle's Java EC code
|
||||
// Only Fp curves implemented for now
|
||||
|
||||
// Requires jsbn.js and jsbn2.js
|
||||
var BigInteger = require('jsbn').BigInteger
|
||||
var Barrett = BigInteger.prototype.Barrett
|
||||
|
||||
// ----------------
|
||||
// ECFieldElementFp
|
||||
|
||||
// constructor
|
||||
function ECFieldElementFp(q,x) {
|
||||
this.x = x;
|
||||
// TODO if(x.compareTo(q) >= 0) error
|
||||
this.q = q;
|
||||
}
|
||||
|
||||
function feFpEquals(other) {
|
||||
if(other == this) return true;
|
||||
return (this.q.equals(other.q) && this.x.equals(other.x));
|
||||
}
|
||||
|
||||
function feFpToBigInteger() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
function feFpNegate() {
|
||||
return new ECFieldElementFp(this.q, this.x.negate().mod(this.q));
|
||||
}
|
||||
|
||||
function feFpAdd(b) {
|
||||
return new ECFieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q));
|
||||
}
|
||||
|
||||
function feFpSubtract(b) {
|
||||
return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q));
|
||||
}
|
||||
|
||||
function feFpMultiply(b) {
|
||||
return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q));
|
||||
}
|
||||
|
||||
function feFpSquare() {
|
||||
return new ECFieldElementFp(this.q, this.x.square().mod(this.q));
|
||||
}
|
||||
|
||||
function feFpDivide(b) {
|
||||
return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q));
|
||||
}
|
||||
|
||||
ECFieldElementFp.prototype.equals = feFpEquals;
|
||||
ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger;
|
||||
ECFieldElementFp.prototype.negate = feFpNegate;
|
||||
ECFieldElementFp.prototype.add = feFpAdd;
|
||||
ECFieldElementFp.prototype.subtract = feFpSubtract;
|
||||
ECFieldElementFp.prototype.multiply = feFpMultiply;
|
||||
ECFieldElementFp.prototype.square = feFpSquare;
|
||||
ECFieldElementFp.prototype.divide = feFpDivide;
|
||||
|
||||
// ----------------
|
||||
// ECPointFp
|
||||
|
||||
// constructor
|
||||
function ECPointFp(curve,x,y,z) {
|
||||
this.curve = curve;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
// Projective coordinates: either zinv == null or z * zinv == 1
|
||||
// z and zinv are just BigIntegers, not fieldElements
|
||||
if(z == null) {
|
||||
this.z = BigInteger.ONE;
|
||||
}
|
||||
else {
|
||||
this.z = z;
|
||||
}
|
||||
this.zinv = null;
|
||||
//TODO: compression flag
|
||||
}
|
||||
|
||||
function pointFpGetX() {
|
||||
if(this.zinv == null) {
|
||||
this.zinv = this.z.modInverse(this.curve.q);
|
||||
}
|
||||
var r = this.x.toBigInteger().multiply(this.zinv);
|
||||
this.curve.reduce(r);
|
||||
return this.curve.fromBigInteger(r);
|
||||
}
|
||||
|
||||
function pointFpGetY() {
|
||||
if(this.zinv == null) {
|
||||
this.zinv = this.z.modInverse(this.curve.q);
|
||||
}
|
||||
var r = this.y.toBigInteger().multiply(this.zinv);
|
||||
this.curve.reduce(r);
|
||||
return this.curve.fromBigInteger(r);
|
||||
}
|
||||
|
||||
function pointFpEquals(other) {
|
||||
if(other == this) return true;
|
||||
if(this.isInfinity()) return other.isInfinity();
|
||||
if(other.isInfinity()) return this.isInfinity();
|
||||
var u, v;
|
||||
// u = Y2 * Z1 - Y1 * Z2
|
||||
u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q);
|
||||
if(!u.equals(BigInteger.ZERO)) return false;
|
||||
// v = X2 * Z1 - X1 * Z2
|
||||
v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q);
|
||||
return v.equals(BigInteger.ZERO);
|
||||
}
|
||||
|
||||
function pointFpIsInfinity() {
|
||||
if((this.x == null) && (this.y == null)) return true;
|
||||
return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO);
|
||||
}
|
||||
|
||||
function pointFpNegate() {
|
||||
return new ECPointFp(this.curve, this.x, this.y.negate(), this.z);
|
||||
}
|
||||
|
||||
function pointFpAdd(b) {
|
||||
if(this.isInfinity()) return b;
|
||||
if(b.isInfinity()) return this;
|
||||
|
||||
// u = Y2 * Z1 - Y1 * Z2
|
||||
var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q);
|
||||
// v = X2 * Z1 - X1 * Z2
|
||||
var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q);
|
||||
|
||||
if(BigInteger.ZERO.equals(v)) {
|
||||
if(BigInteger.ZERO.equals(u)) {
|
||||
return this.twice(); // this == b, so double
|
||||
}
|
||||
return this.curve.getInfinity(); // this = -b, so infinity
|
||||
}
|
||||
|
||||
var THREE = new BigInteger("3");
|
||||
var x1 = this.x.toBigInteger();
|
||||
var y1 = this.y.toBigInteger();
|
||||
var x2 = b.x.toBigInteger();
|
||||
var y2 = b.y.toBigInteger();
|
||||
|
||||
var v2 = v.square();
|
||||
var v3 = v2.multiply(v);
|
||||
var x1v2 = x1.multiply(v2);
|
||||
var zu2 = u.square().multiply(this.z);
|
||||
|
||||
// x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
|
||||
var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q);
|
||||
// y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
|
||||
var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q);
|
||||
// z3 = v^3 * z1 * z2
|
||||
var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q);
|
||||
|
||||
return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
|
||||
}
|
||||
|
||||
function pointFpTwice() {
|
||||
if(this.isInfinity()) return this;
|
||||
if(this.y.toBigInteger().signum() == 0) return this.curve.getInfinity();
|
||||
|
||||
// TODO: optimized handling of constants
|
||||
var THREE = new BigInteger("3");
|
||||
var x1 = this.x.toBigInteger();
|
||||
var y1 = this.y.toBigInteger();
|
||||
|
||||
var y1z1 = y1.multiply(this.z);
|
||||
var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q);
|
||||
var a = this.curve.a.toBigInteger();
|
||||
|
||||
// w = 3 * x1^2 + a * z1^2
|
||||
var w = x1.square().multiply(THREE);
|
||||
if(!BigInteger.ZERO.equals(a)) {
|
||||
w = w.add(this.z.square().multiply(a));
|
||||
}
|
||||
w = w.mod(this.curve.q);
|
||||
//this.curve.reduce(w);
|
||||
// x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
|
||||
var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q);
|
||||
// y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
|
||||
var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q);
|
||||
// z3 = 8 * (y1 * z1)^3
|
||||
var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q);
|
||||
|
||||
return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
|
||||
}
|
||||
|
||||
// Simple NAF (Non-Adjacent Form) multiplication algorithm
|
||||
// TODO: modularize the multiplication algorithm
|
||||
function pointFpMultiply(k) {
|
||||
if(this.isInfinity()) return this;
|
||||
if(k.signum() == 0) return this.curve.getInfinity();
|
||||
|
||||
var e = k;
|
||||
var h = e.multiply(new BigInteger("3"));
|
||||
|
||||
var neg = this.negate();
|
||||
var R = this;
|
||||
|
||||
var i;
|
||||
for(i = h.bitLength() - 2; i > 0; --i) {
|
||||
R = R.twice();
|
||||
|
||||
var hBit = h.testBit(i);
|
||||
var eBit = e.testBit(i);
|
||||
|
||||
if (hBit != eBit) {
|
||||
R = R.add(hBit ? this : neg);
|
||||
}
|
||||
}
|
||||
|
||||
return R;
|
||||
}
|
||||
|
||||
// Compute this*j + x*k (simultaneous multiplication)
|
||||
function pointFpMultiplyTwo(j,x,k) {
|
||||
var i;
|
||||
if(j.bitLength() > k.bitLength())
|
||||
i = j.bitLength() - 1;
|
||||
else
|
||||
i = k.bitLength() - 1;
|
||||
|
||||
var R = this.curve.getInfinity();
|
||||
var both = this.add(x);
|
||||
while(i >= 0) {
|
||||
R = R.twice();
|
||||
if(j.testBit(i)) {
|
||||
if(k.testBit(i)) {
|
||||
R = R.add(both);
|
||||
}
|
||||
else {
|
||||
R = R.add(this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(k.testBit(i)) {
|
||||
R = R.add(x);
|
||||
}
|
||||
}
|
||||
--i;
|
||||
}
|
||||
|
||||
return R;
|
||||
}
|
||||
|
||||
ECPointFp.prototype.getX = pointFpGetX;
|
||||
ECPointFp.prototype.getY = pointFpGetY;
|
||||
ECPointFp.prototype.equals = pointFpEquals;
|
||||
ECPointFp.prototype.isInfinity = pointFpIsInfinity;
|
||||
ECPointFp.prototype.negate = pointFpNegate;
|
||||
ECPointFp.prototype.add = pointFpAdd;
|
||||
ECPointFp.prototype.twice = pointFpTwice;
|
||||
ECPointFp.prototype.multiply = pointFpMultiply;
|
||||
ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo;
|
||||
|
||||
// ----------------
|
||||
// ECCurveFp
|
||||
|
||||
// constructor
|
||||
function ECCurveFp(q,a,b) {
|
||||
this.q = q;
|
||||
this.a = this.fromBigInteger(a);
|
||||
this.b = this.fromBigInteger(b);
|
||||
this.infinity = new ECPointFp(this, null, null);
|
||||
this.reducer = new Barrett(this.q);
|
||||
}
|
||||
|
||||
function curveFpGetQ() {
|
||||
return this.q;
|
||||
}
|
||||
|
||||
function curveFpGetA() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
function curveFpGetB() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
function curveFpEquals(other) {
|
||||
if(other == this) return true;
|
||||
return(this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b));
|
||||
}
|
||||
|
||||
function curveFpGetInfinity() {
|
||||
return this.infinity;
|
||||
}
|
||||
|
||||
function curveFpFromBigInteger(x) {
|
||||
return new ECFieldElementFp(this.q, x);
|
||||
}
|
||||
|
||||
function curveReduce(x) {
|
||||
this.reducer.reduce(x);
|
||||
}
|
||||
|
||||
// for now, work with hex strings because they're easier in JS
|
||||
function curveFpDecodePointHex(s) {
|
||||
switch(parseInt(s.substr(0,2), 16)) { // first byte
|
||||
case 0:
|
||||
return this.infinity;
|
||||
case 2:
|
||||
case 3:
|
||||
// point compression not supported yet
|
||||
return null;
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
var len = (s.length - 2) / 2;
|
||||
var xHex = s.substr(2, len);
|
||||
var yHex = s.substr(len+2, len);
|
||||
|
||||
return new ECPointFp(this,
|
||||
this.fromBigInteger(new BigInteger(xHex, 16)),
|
||||
this.fromBigInteger(new BigInteger(yHex, 16)));
|
||||
|
||||
default: // unsupported
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function curveFpEncodePointHex(p) {
|
||||
if (p.isInfinity()) return "00";
|
||||
var xHex = p.getX().toBigInteger().toString(16);
|
||||
var yHex = p.getY().toBigInteger().toString(16);
|
||||
var oLen = this.getQ().toString(16).length;
|
||||
if ((oLen % 2) != 0) oLen++;
|
||||
while (xHex.length < oLen) {
|
||||
xHex = "0" + xHex;
|
||||
}
|
||||
while (yHex.length < oLen) {
|
||||
yHex = "0" + yHex;
|
||||
}
|
||||
return "04" + xHex + yHex;
|
||||
}
|
||||
|
||||
ECCurveFp.prototype.getQ = curveFpGetQ;
|
||||
ECCurveFp.prototype.getA = curveFpGetA;
|
||||
ECCurveFp.prototype.getB = curveFpGetB;
|
||||
ECCurveFp.prototype.equals = curveFpEquals;
|
||||
ECCurveFp.prototype.getInfinity = curveFpGetInfinity;
|
||||
ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger;
|
||||
ECCurveFp.prototype.reduce = curveReduce;
|
||||
//ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex;
|
||||
ECCurveFp.prototype.encodePointHex = curveFpEncodePointHex;
|
||||
|
||||
// from: https://github.com/kaielvin/jsbn-ec-point-compression
|
||||
ECCurveFp.prototype.decodePointHex = function(s)
|
||||
{
|
||||
var yIsEven;
|
||||
switch(parseInt(s.substr(0,2), 16)) { // first byte
|
||||
case 0:
|
||||
return this.infinity;
|
||||
case 2:
|
||||
yIsEven = false;
|
||||
case 3:
|
||||
if(yIsEven == undefined) yIsEven = true;
|
||||
var len = s.length - 2;
|
||||
var xHex = s.substr(2, len);
|
||||
var x = this.fromBigInteger(new BigInteger(xHex,16));
|
||||
var alpha = x.multiply(x.square().add(this.getA())).add(this.getB());
|
||||
var beta = alpha.sqrt();
|
||||
|
||||
if (beta == null) throw "Invalid point compression";
|
||||
|
||||
var betaValue = beta.toBigInteger();
|
||||
if (betaValue.testBit(0) != yIsEven)
|
||||
{
|
||||
// Use the other root
|
||||
beta = this.fromBigInteger(this.getQ().subtract(betaValue));
|
||||
}
|
||||
return new ECPointFp(this,x,beta);
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
var len = (s.length - 2) / 2;
|
||||
var xHex = s.substr(2, len);
|
||||
var yHex = s.substr(len+2, len);
|
||||
|
||||
return new ECPointFp(this,
|
||||
this.fromBigInteger(new BigInteger(xHex, 16)),
|
||||
this.fromBigInteger(new BigInteger(yHex, 16)));
|
||||
|
||||
default: // unsupported
|
||||
return null;
|
||||
}
|
||||
}
|
||||
ECCurveFp.prototype.encodeCompressedPointHex = function(p)
|
||||
{
|
||||
if (p.isInfinity()) return "00";
|
||||
var xHex = p.getX().toBigInteger().toString(16);
|
||||
var oLen = this.getQ().toString(16).length;
|
||||
if ((oLen % 2) != 0) oLen++;
|
||||
while (xHex.length < oLen)
|
||||
xHex = "0" + xHex;
|
||||
var yPrefix;
|
||||
if(p.getY().toBigInteger().isEven()) yPrefix = "02";
|
||||
else yPrefix = "03";
|
||||
|
||||
return yPrefix + xHex;
|
||||
}
|
||||
|
||||
|
||||
ECFieldElementFp.prototype.getR = function()
|
||||
{
|
||||
if(this.r != undefined) return this.r;
|
||||
|
||||
this.r = null;
|
||||
var bitLength = this.q.bitLength();
|
||||
if (bitLength > 128)
|
||||
{
|
||||
var firstWord = this.q.shiftRight(bitLength - 64);
|
||||
if (firstWord.intValue() == -1)
|
||||
{
|
||||
this.r = BigInteger.ONE.shiftLeft(bitLength).subtract(this.q);
|
||||
}
|
||||
}
|
||||
return this.r;
|
||||
}
|
||||
ECFieldElementFp.prototype.modMult = function(x1,x2)
|
||||
{
|
||||
return this.modReduce(x1.multiply(x2));
|
||||
}
|
||||
ECFieldElementFp.prototype.modReduce = function(x)
|
||||
{
|
||||
if (this.getR() != null)
|
||||
{
|
||||
var qLen = q.bitLength();
|
||||
while (x.bitLength() > (qLen + 1))
|
||||
{
|
||||
var u = x.shiftRight(qLen);
|
||||
var v = x.subtract(u.shiftLeft(qLen));
|
||||
if (!this.getR().equals(BigInteger.ONE))
|
||||
{
|
||||
u = u.multiply(this.getR());
|
||||
}
|
||||
x = u.add(v);
|
||||
}
|
||||
while (x.compareTo(q) >= 0)
|
||||
{
|
||||
x = x.subtract(q);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x.mod(q);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
ECFieldElementFp.prototype.sqrt = function()
|
||||
{
|
||||
if (!this.q.testBit(0)) throw "unsupported";
|
||||
|
||||
// p mod 4 == 3
|
||||
if (this.q.testBit(1))
|
||||
{
|
||||
var z = new ECFieldElementFp(this.q,this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),this.q));
|
||||
return z.square().equals(this) ? z : null;
|
||||
}
|
||||
|
||||
// p mod 4 == 1
|
||||
var qMinusOne = this.q.subtract(BigInteger.ONE);
|
||||
|
||||
var legendreExponent = qMinusOne.shiftRight(1);
|
||||
if (!(this.x.modPow(legendreExponent, this.q).equals(BigInteger.ONE)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var u = qMinusOne.shiftRight(2);
|
||||
var k = u.shiftLeft(1).add(BigInteger.ONE);
|
||||
|
||||
var Q = this.x;
|
||||
var fourQ = modDouble(modDouble(Q));
|
||||
|
||||
var U, V;
|
||||
do
|
||||
{
|
||||
var P;
|
||||
do
|
||||
{
|
||||
P = new BigInteger(this.q.bitLength(), new SecureRandom());
|
||||
}
|
||||
while (P.compareTo(this.q) >= 0
|
||||
|| !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, this.q).equals(qMinusOne)));
|
||||
|
||||
var result = this.lucasSequence(P, Q, k);
|
||||
U = result[0];
|
||||
V = result[1];
|
||||
|
||||
if (this.modMult(V, V).equals(fourQ))
|
||||
{
|
||||
// Integer division by 2, mod q
|
||||
if (V.testBit(0))
|
||||
{
|
||||
V = V.add(q);
|
||||
}
|
||||
|
||||
V = V.shiftRight(1);
|
||||
|
||||
return new ECFieldElementFp(q,V);
|
||||
}
|
||||
}
|
||||
while (U.equals(BigInteger.ONE) || U.equals(qMinusOne));
|
||||
|
||||
return null;
|
||||
}
|
||||
ECFieldElementFp.prototype.lucasSequence = function(P,Q,k)
|
||||
{
|
||||
var n = k.bitLength();
|
||||
var s = k.getLowestSetBit();
|
||||
|
||||
var Uh = BigInteger.ONE;
|
||||
var Vl = BigInteger.TWO;
|
||||
var Vh = P;
|
||||
var Ql = BigInteger.ONE;
|
||||
var Qh = BigInteger.ONE;
|
||||
|
||||
for (var j = n - 1; j >= s + 1; --j)
|
||||
{
|
||||
Ql = this.modMult(Ql, Qh);
|
||||
|
||||
if (k.testBit(j))
|
||||
{
|
||||
Qh = this.modMult(Ql, Q);
|
||||
Uh = this.modMult(Uh, Vh);
|
||||
Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
|
||||
Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Qh = Ql;
|
||||
Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql));
|
||||
Vh = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
|
||||
Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1)));
|
||||
}
|
||||
}
|
||||
|
||||
Ql = this.modMult(Ql, Qh);
|
||||
Qh = this.modMult(Ql, Q);
|
||||
Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql));
|
||||
Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
|
||||
Ql = this.modMult(Ql, Qh);
|
||||
|
||||
for (var j = 1; j <= s; ++j)
|
||||
{
|
||||
Uh = this.modMult(Uh, Vl);
|
||||
Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1)));
|
||||
Ql = this.modMult(Ql, Ql);
|
||||
}
|
||||
|
||||
return [ Uh, Vl ];
|
||||
}
|
||||
|
||||
var exports = {
|
||||
ECCurveFp: ECCurveFp,
|
||||
ECPointFp: ECPointFp,
|
||||
ECFieldElementFp: ECFieldElementFp
|
||||
}
|
||||
|
||||
module.exports = exports
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696838, function(require, module, exports) {
|
||||
// Named EC curves
|
||||
|
||||
// Requires ec.js, jsbn.js, and jsbn2.js
|
||||
var BigInteger = require('jsbn').BigInteger
|
||||
var ECCurveFp = require('./ec.js').ECCurveFp
|
||||
|
||||
|
||||
// ----------------
|
||||
// X9ECParameters
|
||||
|
||||
// constructor
|
||||
function X9ECParameters(curve,g,n,h) {
|
||||
this.curve = curve;
|
||||
this.g = g;
|
||||
this.n = n;
|
||||
this.h = h;
|
||||
}
|
||||
|
||||
function x9getCurve() {
|
||||
return this.curve;
|
||||
}
|
||||
|
||||
function x9getG() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
function x9getN() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
function x9getH() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
X9ECParameters.prototype.getCurve = x9getCurve;
|
||||
X9ECParameters.prototype.getG = x9getG;
|
||||
X9ECParameters.prototype.getN = x9getN;
|
||||
X9ECParameters.prototype.getH = x9getH;
|
||||
|
||||
// ----------------
|
||||
// SECNamedCurves
|
||||
|
||||
function fromHex(s) { return new BigInteger(s, 16); }
|
||||
|
||||
function secp128r1() {
|
||||
// p = 2^128 - 2^97 - 1
|
||||
var p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF");
|
||||
var a = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC");
|
||||
var b = fromHex("E87579C11079F43DD824993C2CEE5ED3");
|
||||
//byte[] S = Hex.decode("000E0D4D696E6768756151750CC03A4473D03679");
|
||||
var n = fromHex("FFFFFFFE0000000075A30D1B9038A115");
|
||||
var h = BigInteger.ONE;
|
||||
var curve = new ECCurveFp(p, a, b);
|
||||
var G = curve.decodePointHex("04"
|
||||
+ "161FF7528B899B2D0C28607CA52C5B86"
|
||||
+ "CF5AC8395BAFEB13C02DA292DDED7A83");
|
||||
return new X9ECParameters(curve, G, n, h);
|
||||
}
|
||||
|
||||
function secp160k1() {
|
||||
// p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
|
||||
var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73");
|
||||
var a = BigInteger.ZERO;
|
||||
var b = fromHex("7");
|
||||
//byte[] S = null;
|
||||
var n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3");
|
||||
var h = BigInteger.ONE;
|
||||
var curve = new ECCurveFp(p, a, b);
|
||||
var G = curve.decodePointHex("04"
|
||||
+ "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"
|
||||
+ "938CF935318FDCED6BC28286531733C3F03C4FEE");
|
||||
return new X9ECParameters(curve, G, n, h);
|
||||
}
|
||||
|
||||
function secp160r1() {
|
||||
// p = 2^160 - 2^31 - 1
|
||||
var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF");
|
||||
var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC");
|
||||
var b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45");
|
||||
//byte[] S = Hex.decode("1053CDE42C14D696E67687561517533BF3F83345");
|
||||
var n = fromHex("0100000000000000000001F4C8F927AED3CA752257");
|
||||
var h = BigInteger.ONE;
|
||||
var curve = new ECCurveFp(p, a, b);
|
||||
var G = curve.decodePointHex("04"
|
||||
+ "4A96B5688EF573284664698968C38BB913CBFC82"
|
||||
+ "23A628553168947D59DCC912042351377AC5FB32");
|
||||
return new X9ECParameters(curve, G, n, h);
|
||||
}
|
||||
|
||||
function secp192k1() {
|
||||
// p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1
|
||||
var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37");
|
||||
var a = BigInteger.ZERO;
|
||||
var b = fromHex("3");
|
||||
//byte[] S = null;
|
||||
var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D");
|
||||
var h = BigInteger.ONE;
|
||||
var curve = new ECCurveFp(p, a, b);
|
||||
var G = curve.decodePointHex("04"
|
||||
+ "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D"
|
||||
+ "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D");
|
||||
return new X9ECParameters(curve, G, n, h);
|
||||
}
|
||||
|
||||
function secp192r1() {
|
||||
// p = 2^192 - 2^64 - 1
|
||||
var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF");
|
||||
var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC");
|
||||
var b = fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1");
|
||||
//byte[] S = Hex.decode("3045AE6FC8422F64ED579528D38120EAE12196D5");
|
||||
var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831");
|
||||
var h = BigInteger.ONE;
|
||||
var curve = new ECCurveFp(p, a, b);
|
||||
var G = curve.decodePointHex("04"
|
||||
+ "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"
|
||||
+ "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
|
||||
return new X9ECParameters(curve, G, n, h);
|
||||
}
|
||||
|
||||
function secp224r1() {
|
||||
// p = 2^224 - 2^96 + 1
|
||||
var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001");
|
||||
var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE");
|
||||
var b = fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4");
|
||||
//byte[] S = Hex.decode("BD71344799D5C7FCDC45B59FA3B9AB8F6A948BC5");
|
||||
var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D");
|
||||
var h = BigInteger.ONE;
|
||||
var curve = new ECCurveFp(p, a, b);
|
||||
var G = curve.decodePointHex("04"
|
||||
+ "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21"
|
||||
+ "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34");
|
||||
return new X9ECParameters(curve, G, n, h);
|
||||
}
|
||||
|
||||
function secp256r1() {
|
||||
// p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1
|
||||
var p = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF");
|
||||
var a = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC");
|
||||
var b = fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B");
|
||||
//byte[] S = Hex.decode("C49D360886E704936A6678E1139D26B7819F7E90");
|
||||
var n = fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551");
|
||||
var h = BigInteger.ONE;
|
||||
var curve = new ECCurveFp(p, a, b);
|
||||
var G = curve.decodePointHex("04"
|
||||
+ "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"
|
||||
+ "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5");
|
||||
return new X9ECParameters(curve, G, n, h);
|
||||
}
|
||||
|
||||
// TODO: make this into a proper hashtable
|
||||
function getSECCurveByName(name) {
|
||||
if(name == "secp128r1") return secp128r1();
|
||||
if(name == "secp160k1") return secp160k1();
|
||||
if(name == "secp160r1") return secp160r1();
|
||||
if(name == "secp192k1") return secp192k1();
|
||||
if(name == "secp192r1") return secp192r1();
|
||||
if(name == "secp224r1") return secp224r1();
|
||||
if(name == "secp256r1") return secp256r1();
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
"secp128r1":secp128r1,
|
||||
"secp160k1":secp160k1,
|
||||
"secp160r1":secp160r1,
|
||||
"secp192k1":secp192k1,
|
||||
"secp192r1":secp192r1,
|
||||
"secp224r1":secp224r1,
|
||||
"secp256r1":secp256r1
|
||||
}
|
||||
|
||||
}, function(modId) { var map = {"./ec.js":1733997696837}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696836);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["crypto","jsbn","safer-buffer"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,226 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696839, function(require, module, exports) {
|
||||
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
|
||||
var getParamBytesForAlg = require('./param-bytes-for-alg');
|
||||
|
||||
var MAX_OCTET = 0x80,
|
||||
CLASS_UNIVERSAL = 0,
|
||||
PRIMITIVE_BIT = 0x20,
|
||||
TAG_SEQ = 0x10,
|
||||
TAG_INT = 0x02,
|
||||
ENCODED_TAG_SEQ = (TAG_SEQ | PRIMITIVE_BIT) | (CLASS_UNIVERSAL << 6),
|
||||
ENCODED_TAG_INT = TAG_INT | (CLASS_UNIVERSAL << 6);
|
||||
|
||||
function base64Url(base64) {
|
||||
return base64
|
||||
.replace(/=/g, '')
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_');
|
||||
}
|
||||
|
||||
function signatureAsBuffer(signature) {
|
||||
if (Buffer.isBuffer(signature)) {
|
||||
return signature;
|
||||
} else if ('string' === typeof signature) {
|
||||
return Buffer.from(signature, 'base64');
|
||||
}
|
||||
|
||||
throw new TypeError('ECDSA signature must be a Base64 string or a Buffer');
|
||||
}
|
||||
|
||||
function derToJose(signature, alg) {
|
||||
signature = signatureAsBuffer(signature);
|
||||
var paramBytes = getParamBytesForAlg(alg);
|
||||
|
||||
// the DER encoded param should at most be the param size, plus a padding
|
||||
// zero, since due to being a signed integer
|
||||
var maxEncodedParamLength = paramBytes + 1;
|
||||
|
||||
var inputLength = signature.length;
|
||||
|
||||
var offset = 0;
|
||||
if (signature[offset++] !== ENCODED_TAG_SEQ) {
|
||||
throw new Error('Could not find expected "seq"');
|
||||
}
|
||||
|
||||
var seqLength = signature[offset++];
|
||||
if (seqLength === (MAX_OCTET | 1)) {
|
||||
seqLength = signature[offset++];
|
||||
}
|
||||
|
||||
if (inputLength - offset < seqLength) {
|
||||
throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
|
||||
}
|
||||
|
||||
if (signature[offset++] !== ENCODED_TAG_INT) {
|
||||
throw new Error('Could not find expected "int" for "r"');
|
||||
}
|
||||
|
||||
var rLength = signature[offset++];
|
||||
|
||||
if (inputLength - offset - 2 < rLength) {
|
||||
throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
|
||||
}
|
||||
|
||||
if (maxEncodedParamLength < rLength) {
|
||||
throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
||||
}
|
||||
|
||||
var rOffset = offset;
|
||||
offset += rLength;
|
||||
|
||||
if (signature[offset++] !== ENCODED_TAG_INT) {
|
||||
throw new Error('Could not find expected "int" for "s"');
|
||||
}
|
||||
|
||||
var sLength = signature[offset++];
|
||||
|
||||
if (inputLength - offset !== sLength) {
|
||||
throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
|
||||
}
|
||||
|
||||
if (maxEncodedParamLength < sLength) {
|
||||
throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
||||
}
|
||||
|
||||
var sOffset = offset;
|
||||
offset += sLength;
|
||||
|
||||
if (offset !== inputLength) {
|
||||
throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
|
||||
}
|
||||
|
||||
var rPadding = paramBytes - rLength,
|
||||
sPadding = paramBytes - sLength;
|
||||
|
||||
var dst = Buffer.allocUnsafe(rPadding + rLength + sPadding + sLength);
|
||||
|
||||
for (offset = 0; offset < rPadding; ++offset) {
|
||||
dst[offset] = 0;
|
||||
}
|
||||
signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
|
||||
|
||||
offset = paramBytes;
|
||||
|
||||
for (var o = offset; offset < o + sPadding; ++offset) {
|
||||
dst[offset] = 0;
|
||||
}
|
||||
signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
|
||||
|
||||
dst = dst.toString('base64');
|
||||
dst = base64Url(dst);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
function countPadding(buf, start, stop) {
|
||||
var padding = 0;
|
||||
while (start + padding < stop && buf[start + padding] === 0) {
|
||||
++padding;
|
||||
}
|
||||
|
||||
var needsSign = buf[start + padding] >= MAX_OCTET;
|
||||
if (needsSign) {
|
||||
--padding;
|
||||
}
|
||||
|
||||
return padding;
|
||||
}
|
||||
|
||||
function joseToDer(signature, alg) {
|
||||
signature = signatureAsBuffer(signature);
|
||||
var paramBytes = getParamBytesForAlg(alg);
|
||||
|
||||
var signatureBytes = signature.length;
|
||||
if (signatureBytes !== paramBytes * 2) {
|
||||
throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
|
||||
}
|
||||
|
||||
var rPadding = countPadding(signature, 0, paramBytes);
|
||||
var sPadding = countPadding(signature, paramBytes, signature.length);
|
||||
var rLength = paramBytes - rPadding;
|
||||
var sLength = paramBytes - sPadding;
|
||||
|
||||
var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
|
||||
|
||||
var shortLength = rsBytes < MAX_OCTET;
|
||||
|
||||
var dst = Buffer.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
|
||||
|
||||
var offset = 0;
|
||||
dst[offset++] = ENCODED_TAG_SEQ;
|
||||
if (shortLength) {
|
||||
// Bit 8 has value "0"
|
||||
// bits 7-1 give the length.
|
||||
dst[offset++] = rsBytes;
|
||||
} else {
|
||||
// Bit 8 of first octet has value "1"
|
||||
// bits 7-1 give the number of additional length octets.
|
||||
dst[offset++] = MAX_OCTET | 1;
|
||||
// length, base 256
|
||||
dst[offset++] = rsBytes & 0xff;
|
||||
}
|
||||
dst[offset++] = ENCODED_TAG_INT;
|
||||
dst[offset++] = rLength;
|
||||
if (rPadding < 0) {
|
||||
dst[offset++] = 0;
|
||||
offset += signature.copy(dst, offset, 0, paramBytes);
|
||||
} else {
|
||||
offset += signature.copy(dst, offset, rPadding, paramBytes);
|
||||
}
|
||||
dst[offset++] = ENCODED_TAG_INT;
|
||||
dst[offset++] = sLength;
|
||||
if (sPadding < 0) {
|
||||
dst[offset++] = 0;
|
||||
signature.copy(dst, offset, paramBytes);
|
||||
} else {
|
||||
signature.copy(dst, offset, paramBytes + sPadding);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
derToJose: derToJose,
|
||||
joseToDer: joseToDer
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {"./param-bytes-for-alg":1733997696840}; return __REQUIRE__(map[modId], modId); })
|
||||
__DEFINE__(1733997696840, function(require, module, exports) {
|
||||
|
||||
|
||||
function getParamSize(keySize) {
|
||||
var result = ((keySize / 8) | 0) + (keySize % 8 === 0 ? 0 : 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
var paramBytesForAlg = {
|
||||
ES256: getParamSize(256),
|
||||
ES384: getParamSize(384),
|
||||
ES512: getParamSize(521)
|
||||
};
|
||||
|
||||
function getParamBytesForAlg(alg) {
|
||||
var paramBytes = paramBytesForAlg[alg];
|
||||
if (paramBytes) {
|
||||
return paramBytes;
|
||||
}
|
||||
|
||||
throw new Error('Unknown algorithm "' + alg + '"');
|
||||
}
|
||||
|
||||
module.exports = getParamBytesForAlg;
|
||||
|
||||
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696839);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["safe-buffer"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,29 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696841, function(require, module, exports) {
|
||||
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
/** @type {import('.')} */
|
||||
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;
|
||||
if ($defineProperty) {
|
||||
try {
|
||||
$defineProperty({}, 'a', { value: 1 });
|
||||
} catch (e) {
|
||||
// IE 8 has a broken defineProperty
|
||||
$defineProperty = false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = $defineProperty;
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696841);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["get-intrinsic"]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\nvar GetIntrinsic = require('get-intrinsic');\r\n\r\n/** @type {import('.')} */\r\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;\r\nif ($defineProperty) {\r\n\ttry {\r\n\t\t$defineProperty({}, 'a', { value: 1 });\r\n\t} catch (e) {\r\n\t\t// IE 8 has a broken defineProperty\r\n\t\t$defineProperty = false;\r\n\t}\r\n}\r\n\r\nmodule.exports = $defineProperty;\r\n"]}
|
@ -0,0 +1,17 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696842, function(require, module, exports) {
|
||||
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = Error;
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696842);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\n/** @type {import('.')} */\r\nmodule.exports = Error;\r\n"]}
|
@ -0,0 +1,130 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696843, function(require, module, exports) {
|
||||
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
var toStr = Object.prototype.toString;
|
||||
var defineProperty = Object.defineProperty;
|
||||
var gOPD = Object.getOwnPropertyDescriptor;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
|
||||
var setProperty = function setProperty(target, options) {
|
||||
if (defineProperty && options.name === '__proto__') {
|
||||
defineProperty(target, options.name, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: options.newValue,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
target[options.name] = options.newValue;
|
||||
}
|
||||
};
|
||||
|
||||
// Return undefined instead of __proto__ if '__proto__' is not an own property
|
||||
var getProperty = function getProperty(obj, name) {
|
||||
if (name === '__proto__') {
|
||||
if (!hasOwn.call(obj, name)) {
|
||||
return void 0;
|
||||
} else if (gOPD) {
|
||||
// In early versions of node, obj['__proto__'] is buggy when obj has
|
||||
// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
|
||||
return gOPD(obj, name).value;
|
||||
}
|
||||
}
|
||||
|
||||
return obj[name];
|
||||
};
|
||||
|
||||
module.exports = 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;
|
||||
target = arguments[1] || {};
|
||||
// skip the boolean and the target
|
||||
i = 2;
|
||||
}
|
||||
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
|
||||
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 = getProperty(target, name);
|
||||
copy = getProperty(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
|
||||
setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
|
||||
|
||||
// Don't bring in undefined values
|
||||
} else if (typeof copy !== 'undefined') {
|
||||
setProperty(target, { name: name, newValue: copy });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the modified object
|
||||
return target;
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696843);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\nvar hasOwn = Object.prototype.hasOwnProperty;\r\nvar toStr = Object.prototype.toString;\r\nvar defineProperty = Object.defineProperty;\r\nvar gOPD = Object.getOwnPropertyDescriptor;\r\n\r\nvar isArray = function isArray(arr) {\r\n\tif (typeof Array.isArray === 'function') {\r\n\t\treturn Array.isArray(arr);\r\n\t}\r\n\r\n\treturn toStr.call(arr) === '[object Array]';\r\n};\r\n\r\nvar isPlainObject = function isPlainObject(obj) {\r\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\r\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\r\n\t// Not own constructor property must be Object\r\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// Own properties are enumerated firstly, so to speed up,\r\n\t// if last one is own, then all properties are own.\r\n\tvar key;\r\n\tfor (key in obj) { /**/ }\r\n\r\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\r\n};\r\n\r\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\r\nvar setProperty = function setProperty(target, options) {\r\n\tif (defineProperty && options.name === '__proto__') {\r\n\t\tdefineProperty(target, options.name, {\r\n\t\t\tenumerable: true,\r\n\t\t\tconfigurable: true,\r\n\t\t\tvalue: options.newValue,\r\n\t\t\twritable: true\r\n\t\t});\r\n\t} else {\r\n\t\ttarget[options.name] = options.newValue;\r\n\t}\r\n};\r\n\r\n// Return undefined instead of __proto__ if '__proto__' is not an own property\r\nvar getProperty = function getProperty(obj, name) {\r\n\tif (name === '__proto__') {\r\n\t\tif (!hasOwn.call(obj, name)) {\r\n\t\t\treturn void 0;\r\n\t\t} else if (gOPD) {\r\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\r\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\r\n\t\t\treturn gOPD(obj, name).value;\r\n\t\t}\r\n\t}\r\n\r\n\treturn obj[name];\r\n};\r\n\r\nmodule.exports = function extend() {\r\n\tvar options, name, src, copy, copyIsArray, clone;\r\n\tvar target = arguments[0];\r\n\tvar i = 1;\r\n\tvar length = arguments.length;\r\n\tvar deep = false;\r\n\r\n\t// Handle a deep copy situation\r\n\tif (typeof target === 'boolean') {\r\n\t\tdeep = target;\r\n\t\ttarget = arguments[1] || {};\r\n\t\t// skip the boolean and the target\r\n\t\ti = 2;\r\n\t}\r\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\r\n\t\ttarget = {};\r\n\t}\r\n\r\n\tfor (; i < length; ++i) {\r\n\t\toptions = arguments[i];\r\n\t\t// Only deal with non-null/undefined values\r\n\t\tif (options != null) {\r\n\t\t\t// Extend the base object\r\n\t\t\tfor (name in options) {\r\n\t\t\t\tsrc = getProperty(target, name);\r\n\t\t\t\tcopy = getProperty(options, name);\r\n\r\n\t\t\t\t// Prevent never-ending loop\r\n\t\t\t\tif (target !== copy) {\r\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\r\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\r\n\t\t\t\t\t\tif (copyIsArray) {\r\n\t\t\t\t\t\t\tcopyIsArray = false;\r\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Never move original objects, clone them\r\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\r\n\r\n\t\t\t\t\t// Don't bring in undefined values\r\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\r\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Return the modified object\r\n\treturn target;\r\n};\r\n"]}
|
@ -0,0 +1,196 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696844, function(require, module, exports) {
|
||||
/*
|
||||
* extsprintf.js: extended POSIX-style sprintf
|
||||
*/
|
||||
|
||||
var mod_assert = require('assert');
|
||||
var mod_util = require('util');
|
||||
|
||||
/*
|
||||
* Public interface
|
||||
*/
|
||||
exports.sprintf = jsSprintf;
|
||||
exports.printf = jsPrintf;
|
||||
exports.fprintf = jsFprintf;
|
||||
|
||||
/*
|
||||
* Stripped down version of s[n]printf(3c). We make a best effort to throw an
|
||||
* exception when given a format string we don't understand, rather than
|
||||
* ignoring it, so that we won't break existing programs if/when we go implement
|
||||
* the rest of this.
|
||||
*
|
||||
* This implementation currently supports specifying
|
||||
* - field alignment ('-' flag),
|
||||
* - zero-pad ('0' flag)
|
||||
* - always show numeric sign ('+' flag),
|
||||
* - field width
|
||||
* - conversions for strings, decimal integers, and floats (numbers).
|
||||
* - argument size specifiers. These are all accepted but ignored, since
|
||||
* Javascript has no notion of the physical size of an argument.
|
||||
*
|
||||
* Everything else is currently unsupported, most notably precision, unsigned
|
||||
* numbers, non-decimal numbers, and characters.
|
||||
*/
|
||||
function jsSprintf(fmt)
|
||||
{
|
||||
var regex = [
|
||||
'([^%]*)', /* normal text */
|
||||
'%', /* start of format */
|
||||
'([\'\\-+ #0]*?)', /* flags (optional) */
|
||||
'([1-9]\\d*)?', /* width (optional) */
|
||||
'(\\.([1-9]\\d*))?', /* precision (optional) */
|
||||
'[lhjztL]*?', /* length mods (ignored) */
|
||||
'([diouxXfFeEgGaAcCsSp%jr])' /* conversion */
|
||||
].join('');
|
||||
|
||||
var re = new RegExp(regex);
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var flags, width, precision, conversion;
|
||||
var left, pad, sign, arg, match;
|
||||
var ret = '';
|
||||
var argn = 1;
|
||||
|
||||
mod_assert.equal('string', typeof (fmt));
|
||||
|
||||
while ((match = re.exec(fmt)) !== null) {
|
||||
ret += match[1];
|
||||
fmt = fmt.substring(match[0].length);
|
||||
|
||||
flags = match[2] || '';
|
||||
width = match[3] || 0;
|
||||
precision = match[4] || '';
|
||||
conversion = match[6];
|
||||
left = false;
|
||||
sign = false;
|
||||
pad = ' ';
|
||||
|
||||
if (conversion == '%') {
|
||||
ret += '%';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (args.length === 0)
|
||||
throw (new Error('too few args to sprintf'));
|
||||
|
||||
arg = args.shift();
|
||||
argn++;
|
||||
|
||||
if (flags.match(/[\' #]/))
|
||||
throw (new Error(
|
||||
'unsupported flags: ' + flags));
|
||||
|
||||
if (precision.length > 0)
|
||||
throw (new Error(
|
||||
'non-zero precision not supported'));
|
||||
|
||||
if (flags.match(/-/))
|
||||
left = true;
|
||||
|
||||
if (flags.match(/0/))
|
||||
pad = '0';
|
||||
|
||||
if (flags.match(/\+/))
|
||||
sign = true;
|
||||
|
||||
switch (conversion) {
|
||||
case 's':
|
||||
if (arg === undefined || arg === null)
|
||||
throw (new Error('argument ' + argn +
|
||||
': attempted to print undefined or null ' +
|
||||
'as a string'));
|
||||
ret += doPad(pad, width, left, arg.toString());
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
arg = Math.floor(arg);
|
||||
/*jsl:fallthru*/
|
||||
case 'f':
|
||||
sign = sign && arg > 0 ? '+' : '';
|
||||
ret += sign + doPad(pad, width, left,
|
||||
arg.toString());
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
ret += doPad(pad, width, left, arg.toString(16));
|
||||
break;
|
||||
|
||||
case 'j': /* non-standard */
|
||||
if (width === 0)
|
||||
width = 10;
|
||||
ret += mod_util.inspect(arg, false, width);
|
||||
break;
|
||||
|
||||
case 'r': /* non-standard */
|
||||
ret += dumpException(arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw (new Error('unsupported conversion: ' +
|
||||
conversion));
|
||||
}
|
||||
}
|
||||
|
||||
ret += fmt;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
function jsPrintf() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(process.stdout);
|
||||
jsFprintf.apply(null, args);
|
||||
}
|
||||
|
||||
function jsFprintf(stream) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return (stream.write(jsSprintf.apply(this, args)));
|
||||
}
|
||||
|
||||
function doPad(chr, width, left, str)
|
||||
{
|
||||
var ret = str;
|
||||
|
||||
while (ret.length < width) {
|
||||
if (left)
|
||||
ret += chr;
|
||||
else
|
||||
ret = chr + ret;
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function dumps long stack traces for exceptions having a cause() method.
|
||||
* See node-verror for an example.
|
||||
*/
|
||||
function dumpException(ex)
|
||||
{
|
||||
var ret;
|
||||
|
||||
if (!(ex instanceof Error))
|
||||
throw (new Error(jsSprintf('invalid type for %%r: %j', ex)));
|
||||
|
||||
/* Note that V8 prepends "ex.stack" with ex.toString(). */
|
||||
ret = 'EXCEPTION: ' + ex.constructor.name + ': ' + ex.stack;
|
||||
|
||||
if (ex.cause && typeof (ex.cause) === 'function') {
|
||||
var cex = ex.cause();
|
||||
if (cex) {
|
||||
ret += '\nCaused by: ' + dumpException(cex);
|
||||
}
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696844);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["assert","util"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,59 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696845, function(require, module, exports) {
|
||||
|
||||
|
||||
// do not edit .js files directly - edit src/index.jst
|
||||
|
||||
|
||||
|
||||
module.exports = function equal(a, b) {
|
||||
if (a === b) return true;
|
||||
|
||||
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
||||
if (a.constructor !== b.constructor) return false;
|
||||
|
||||
var length, i, keys;
|
||||
if (Array.isArray(a)) {
|
||||
length = a.length;
|
||||
if (length != b.length) return false;
|
||||
for (i = length; i-- !== 0;)
|
||||
if (!equal(a[i], b[i])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
||||
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
||||
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
||||
|
||||
keys = Object.keys(a);
|
||||
length = keys.length;
|
||||
if (length !== Object.keys(b).length) return false;
|
||||
|
||||
for (i = length; i-- !== 0;)
|
||||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
||||
|
||||
for (i = length; i-- !== 0;) {
|
||||
var key = keys[i];
|
||||
|
||||
if (!equal(a[key], b[key])) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// true if both NaN, false otherwise
|
||||
return a!==a && b!==b;
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696845);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\n// do not edit .js files directly - edit src/index.jst\r\n\r\n\r\n\r\nmodule.exports = function equal(a, b) {\r\n if (a === b) return true;\r\n\r\n if (a && b && typeof a == 'object' && typeof b == 'object') {\r\n if (a.constructor !== b.constructor) return false;\r\n\r\n var length, i, keys;\r\n if (Array.isArray(a)) {\r\n length = a.length;\r\n if (length != b.length) return false;\r\n for (i = length; i-- !== 0;)\r\n if (!equal(a[i], b[i])) return false;\r\n return true;\r\n }\r\n\r\n\r\n\r\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\r\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\r\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\r\n\r\n keys = Object.keys(a);\r\n length = keys.length;\r\n if (length !== Object.keys(b).length) return false;\r\n\r\n for (i = length; i-- !== 0;)\r\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\r\n\r\n for (i = length; i-- !== 0;) {\r\n var key = keys[i];\r\n\r\n if (!equal(a[key], b[key])) return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n // true if both NaN, false otherwise\r\n return a!==a && b!==b;\r\n};\r\n"]}
|
@ -0,0 +1,72 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696846, function(require, module, exports) {
|
||||
|
||||
|
||||
module.exports = function (data, opts) {
|
||||
if (!opts) opts = {};
|
||||
if (typeof opts === 'function') opts = { cmp: opts };
|
||||
var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;
|
||||
|
||||
var cmp = opts.cmp && (function (f) {
|
||||
return function (node) {
|
||||
return function (a, b) {
|
||||
var aobj = { key: a, value: node[a] };
|
||||
var bobj = { key: b, value: node[b] };
|
||||
return f(aobj, bobj);
|
||||
};
|
||||
};
|
||||
})(opts.cmp);
|
||||
|
||||
var seen = [];
|
||||
return (function stringify (node) {
|
||||
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
||||
node = node.toJSON();
|
||||
}
|
||||
|
||||
if (node === undefined) return;
|
||||
if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';
|
||||
if (typeof node !== 'object') return JSON.stringify(node);
|
||||
|
||||
var i, out;
|
||||
if (Array.isArray(node)) {
|
||||
out = '[';
|
||||
for (i = 0; i < node.length; i++) {
|
||||
if (i) out += ',';
|
||||
out += stringify(node[i]) || 'null';
|
||||
}
|
||||
return out + ']';
|
||||
}
|
||||
|
||||
if (node === null) return 'null';
|
||||
|
||||
if (seen.indexOf(node) !== -1) {
|
||||
if (cycles) return JSON.stringify('__cycle__');
|
||||
throw new TypeError('Converting circular structure to JSON');
|
||||
}
|
||||
|
||||
var seenIndex = seen.push(node) - 1;
|
||||
var keys = Object.keys(node).sort(cmp && cmp(node));
|
||||
out = '';
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var value = stringify(node[key]);
|
||||
|
||||
if (!value) continue;
|
||||
if (out) out += ',';
|
||||
out += JSON.stringify(key) + ':' + value;
|
||||
}
|
||||
seen.splice(seenIndex, 1);
|
||||
return '{' + out + '}';
|
||||
})(data);
|
||||
};
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696846);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["\r\n\r\nmodule.exports = function (data, opts) {\r\n if (!opts) opts = {};\r\n if (typeof opts === 'function') opts = { cmp: opts };\r\n var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;\r\n\r\n var cmp = opts.cmp && (function (f) {\r\n return function (node) {\r\n return function (a, b) {\r\n var aobj = { key: a, value: node[a] };\r\n var bobj = { key: b, value: node[b] };\r\n return f(aobj, bobj);\r\n };\r\n };\r\n })(opts.cmp);\r\n\r\n var seen = [];\r\n return (function stringify (node) {\r\n if (node && node.toJSON && typeof node.toJSON === 'function') {\r\n node = node.toJSON();\r\n }\r\n\r\n if (node === undefined) return;\r\n if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';\r\n if (typeof node !== 'object') return JSON.stringify(node);\r\n\r\n var i, out;\r\n if (Array.isArray(node)) {\r\n out = '[';\r\n for (i = 0; i < node.length; i++) {\r\n if (i) out += ',';\r\n out += stringify(node[i]) || 'null';\r\n }\r\n return out + ']';\r\n }\r\n\r\n if (node === null) return 'null';\r\n\r\n if (seen.indexOf(node) !== -1) {\r\n if (cycles) return JSON.stringify('__cycle__');\r\n throw new TypeError('Converting circular structure to JSON');\r\n }\r\n\r\n var seenIndex = seen.push(node) - 1;\r\n var keys = Object.keys(node).sort(cmp && cmp(node));\r\n out = '';\r\n for (i = 0; i < keys.length; i++) {\r\n var key = keys[i];\r\n var value = stringify(node[key]);\r\n\r\n if (!value) continue;\r\n if (out) out += ',';\r\n out += JSON.stringify(key) + ':' + value;\r\n }\r\n seen.splice(seenIndex, 1);\r\n return '{' + out + '}';\r\n })(data);\r\n};\r\n"]}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,151 @@
|
||||
module.exports = (function() {
|
||||
var __MODS__ = {};
|
||||
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1733997696851, function(require, module, exports) {
|
||||
module.exports = ForeverAgent
|
||||
ForeverAgent.SSL = ForeverAgentSSL
|
||||
|
||||
var util = require('util')
|
||||
, Agent = require('http').Agent
|
||||
, net = require('net')
|
||||
, tls = require('tls')
|
||||
, AgentSSL = require('https').Agent
|
||||
|
||||
function getConnectionName(host, port) {
|
||||
var name = ''
|
||||
if (typeof host === 'string') {
|
||||
name = host + ':' + port
|
||||
} else {
|
||||
// For node.js v012.0 and iojs-v1.5.1, host is an object. And any existing localAddress is part of the connection name.
|
||||
name = host.host + ':' + host.port + ':' + (host.localAddress ? (host.localAddress + ':') : ':')
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
function ForeverAgent(options) {
|
||||
var self = this
|
||||
self.options = options || {}
|
||||
self.requests = {}
|
||||
self.sockets = {}
|
||||
self.freeSockets = {}
|
||||
self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets
|
||||
self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets
|
||||
self.on('free', function(socket, host, port) {
|
||||
var name = getConnectionName(host, port)
|
||||
|
||||
if (self.requests[name] && self.requests[name].length) {
|
||||
self.requests[name].shift().onSocket(socket)
|
||||
} else if (self.sockets[name].length < self.minSockets) {
|
||||
if (!self.freeSockets[name]) self.freeSockets[name] = []
|
||||
self.freeSockets[name].push(socket)
|
||||
|
||||
// if an error happens while we don't use the socket anyway, meh, throw the socket away
|
||||
var onIdleError = function() {
|
||||
socket.destroy()
|
||||
}
|
||||
socket._onIdleError = onIdleError
|
||||
socket.on('error', onIdleError)
|
||||
} else {
|
||||
// If there are no pending requests just destroy the
|
||||
// socket and it will get removed from the pool. This
|
||||
// gets us out of timeout issues and allows us to
|
||||
// default to Connection:keep-alive.
|
||||
socket.destroy()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
util.inherits(ForeverAgent, Agent)
|
||||
|
||||
ForeverAgent.defaultMinSockets = 5
|
||||
|
||||
|
||||
ForeverAgent.prototype.createConnection = net.createConnection
|
||||
ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest
|
||||
ForeverAgent.prototype.addRequest = function(req, host, port) {
|
||||
var name = getConnectionName(host, port)
|
||||
|
||||
if (typeof host !== 'string') {
|
||||
var options = host
|
||||
port = options.port
|
||||
host = options.host
|
||||
}
|
||||
|
||||
if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) {
|
||||
var idleSocket = this.freeSockets[name].pop()
|
||||
idleSocket.removeListener('error', idleSocket._onIdleError)
|
||||
delete idleSocket._onIdleError
|
||||
req._reusedSocket = true
|
||||
req.onSocket(idleSocket)
|
||||
} else {
|
||||
this.addRequestNoreuse(req, host, port)
|
||||
}
|
||||
}
|
||||
|
||||
ForeverAgent.prototype.removeSocket = function(s, name, host, port) {
|
||||
if (this.sockets[name]) {
|
||||
var index = this.sockets[name].indexOf(s)
|
||||
if (index !== -1) {
|
||||
this.sockets[name].splice(index, 1)
|
||||
}
|
||||
} else if (this.sockets[name] && this.sockets[name].length === 0) {
|
||||
// don't leak
|
||||
delete this.sockets[name]
|
||||
delete this.requests[name]
|
||||
}
|
||||
|
||||
if (this.freeSockets[name]) {
|
||||
var index = this.freeSockets[name].indexOf(s)
|
||||
if (index !== -1) {
|
||||
this.freeSockets[name].splice(index, 1)
|
||||
if (this.freeSockets[name].length === 0) {
|
||||
delete this.freeSockets[name]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.requests[name] && this.requests[name].length) {
|
||||
// If we have pending requests and a socket gets closed a new one
|
||||
// needs to be created to take over in the pool for the one that closed.
|
||||
this.createSocket(name, host, port).emit('free')
|
||||
}
|
||||
}
|
||||
|
||||
function ForeverAgentSSL (options) {
|
||||
ForeverAgent.call(this, options)
|
||||
}
|
||||
util.inherits(ForeverAgentSSL, ForeverAgent)
|
||||
|
||||
ForeverAgentSSL.prototype.createConnection = createConnectionSSL
|
||||
ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest
|
||||
|
||||
function createConnectionSSL (port, host, options) {
|
||||
if (typeof port === 'object') {
|
||||
options = port;
|
||||
} else if (typeof host === 'object') {
|
||||
options = host;
|
||||
} else if (typeof options === 'object') {
|
||||
options = options;
|
||||
} else {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof port === 'number') {
|
||||
options.port = port;
|
||||
}
|
||||
|
||||
if (typeof host === 'string') {
|
||||
options.host = host;
|
||||
}
|
||||
|
||||
return tls.connect(options);
|
||||
}
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1733997696851);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=["util","http","net","tls","https"]
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue