commit 8fa31df250781ff7a44091d59b8938feb5e56122 Author: juncaiq Date: Sun Jan 4 11:09:06 2026 +0800 初始提交 diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..53d9e42 --- /dev/null +++ b/App.vue @@ -0,0 +1,308 @@ + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3408858 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +#jnpf-app-vue3 + +## 一 环境要求 + +### 1.1 开发环境 + +- 操作系统:`Windows 10/11`,`MacOS`; +- `Node.js` v16.15.x(某些情况下可能需要安装 Python3)及以上版本; +- `HBuilder X` (最新版) + +### 1.2 运行环境 + +`Nginx` 建议使用 `1.18.0` 及以上版本、兼容 `OpenResty` 或 `TongHttpServer` 6.0(国产信创) + +## 二 关联项目 + +> 需要使用下表中的对应分支 + +| 项目 | 分支 | 说明 | +| ------------------------- | ------------- | ------------------------------------------| +| **后端**(任一后端服务) | | | +| jnpf-java-boot | v6.0.x-stable | Java 单体项目源码 | +| jnpf-java-cloud | v6.0.x-stable | Java 微服务项目源码 | +| jnpf-dotnet | v6.0.x-stable | .NET 单体项目源码 | +| jnpf-dotnet-cloud | v6.0.x-stable | .NET 微服务项目源码 | + +## 三 使用说明 + +### 3.1 高德地图配置 + +打开 `/utils/define.ts` 配置文件,修改 `aMapWebKey` 值 + +打开 `manifest.json` 文件,点击app模块配置,修改高德地图相关配置信息。点击web配置,修改高德地图相关配置信息。 diff --git a/api/apply/apply.js b/api/apply/apply.js new file mode 100644 index 0000000..efb1668 --- /dev/null +++ b/api/apply/apply.js @@ -0,0 +1,102 @@ +import request from '@/utils/request' +// 获取应用菜单 +export function getMenuList(data) { + return request({ + url: '/api/app/Menu', + method: 'get', + data, + options: { + load: false + } + }) +} +// 获取常用 1-流程 2-应用 +export function getUsualList() { + return request({ + url: '/api/system/MenuData', + method: 'get', + options: { + load: false + } + }) +} +//流程常用更多 +export function getCommonFlowTree(id) { + return request({ + url: `/api/workflow/template/CommonFlowTree`, + method: 'get' + }) +} +// 获取常用流程 +export function getFlowUsualList(data) { + return request({ + url: '/api/workflow/template/Selector', + method: 'get', + data, + options: { + load: false + } + }) +} +// 获取常用全部 1-流程 2-应用 +export function getAppDataList(data) { + return request({ + url: '/api/system/MenuData/getAppDataList', + data, + options: { + load: false + } + }) +} +// 获取添加流程 +export function setCommonFlow(id) { + return request({ + url: `/api/workflow/template/SetCommonFlow/${id}`, + method: 'post' + }) +} +export function addUsual(id) { + return request({ + url: `/api/system/MenuData/${id}`, + method: 'post' + }) +} +export function delUsual(id) { + return request({ + url: `/api/system/MenuData/${id}`, + method: 'delete' + }) +} +export function getFlowList(data) { + return request({ + url: '/api/workflow/template/Selector', + data + }) +} +export function getDataList(data) { + return request({ + url: `/api/system/MenuData/getDataList`, + data + }) +} +export function getChildList(id) { + return request({ + url: `/api/app/Menu/getChildList/${id}` + }) +} +export function getChildMenuList(data) { + return request({ + url: '/api/app/Menu/getMenuList?keyword=' + data.keyword, + data + }) +} +// 获取应用菜单 +export function getMenuSys() { + return request({ + url: '/api/app/Menu/sys', + method: 'get', + options: { + load: false + } + }) +} \ No newline at end of file diff --git a/api/apply/order.js b/api/apply/order.js new file mode 100644 index 0000000..d1180dc --- /dev/null +++ b/api/apply/order.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +// 删除订单 +export function Delete(id) { + return request({ + url: `/api/extend/CrmOrder/${id}`, + method: 'DELETE' + }) +} +// 获取订单列表 +export function getOrderList(data, options) { + return request({ + url: `/api/extend/CrmOrder`, + method: 'get', + data, + options + }) +} +// 获取商品列表 +export function getGoodsList(data) { + return request({ + url: `/api/extend/CrmOrder/Goods`, + method: 'get', + data, + options: { + load: false + } + }) +} +// 获取客户列表 +export function getCustomerList(keyword) { + return request({ + url: `/api/extend/CrmOrder/Customer`, + method: 'get', + data: { + keyword: keyword || '' + }, + options: { + load: false + } + }) +} diff --git a/api/apply/reportLog.js b/api/apply/reportLog.js new file mode 100644 index 0000000..a44d426 --- /dev/null +++ b/api/apply/reportLog.js @@ -0,0 +1,49 @@ +import request from '@/utils/request' +//获取我发出的日志 +export function getSendList(data, options) { + return request({ + url: `/api/extend/WorkLog/Send`, + method: 'GET', + data, + options + }) +} +//获取收到的日志 +export function getReceiveList(data, options) { + return request({ + url: `/api/extend/WorkLog/Receive`, + method: 'GET', + data, + options + }) +} +//日志info +export function getLogInfo(id) { + return request({ + url: `/api/extend/WorkLog/${id}`, + method: 'GET', + }) +} +//日志保存 +export function createLog(data) { + return request({ + url: `/api/extend/WorkLog`, + method: 'POST', + data + }) +} +//日志修改 +export function updateLog(data) { + return request({ + url: `/api/extend/WorkLog/${data.id}`, + method: 'PUT', + data + }) +} +//日志删除 +export function delLog(id) { + return request({ + url: `/api/extend/WorkLog/${id}`, + method: 'DELETE' + }) +} diff --git a/api/apply/visualDev.js b/api/apply/visualDev.js new file mode 100644 index 0000000..11fd15b --- /dev/null +++ b/api/apply/visualDev.js @@ -0,0 +1,88 @@ +import request from '@/utils/request' +// 获取列表表单配置JSON +export function getConfigData(modelId, menuId) { + return request({ + url: `/api/visualdev/OnlineDev/${modelId}/Config?menuId=${menuId}`, + method: 'GET' + }) +} +// 通过菜单id获取列表表单配置JSON +export function getConfigDataByMenuId(data = {}) { + return request({ + url: `/api/visualdev/OnlineDev/Config`, + method: 'GET', + data + }, ); +} +// 获取数据列表 +export function getModelList(modelId, data, options) { + return request({ + url: `/api/visualdev/OnlineDev/${modelId}/List`, + method: 'POST', + data, + options: { + load: false + } + }) +} +// 添加数据 +export function createModel(modelId, data) { + return request({ + url: `/api/visualdev/OnlineDev/${modelId}?menuId=${data.menuId}`, + method: 'POST', + data + }) +} +// 修改数据 +export function updateModel(modelId, data) { + return request({ + url: `/api/visualdev/OnlineDev/${modelId}/${data.id}?menuId=${data.menuId}`, + method: 'PUT', + data + }) +} +// 获取数据信息 +export function getModelInfo(modelId, id, menuId) { + return request({ + url: `/api/visualdev/OnlineDev/${modelId}/${id}?menuId=${menuId}`, + method: 'GET' + }) +} +// 删除数据 +export function deteleModel(data, id) { + return request({ + url: `/api/visualdev/OnlineDev/batchDelete/${id}`, + method: 'POST', + data + }) +} +// 表单外链 +export function getConfig(id) { + return request({ + url: `/api/visualdev/OnlineDev/${id}/Config`, + method: 'GET' + }) +} +// 修改记录 +export function getOnlineLog(modelId, id) { + return request({ + url: `/api/visualdev/OnlineLog?modelId=${modelId}&dataId=${id}`, + method: 'GET' + }) +} +//自定义按钮发起流程 +export function launchFlow(data, id) { + return request({ + url: `/api/visualdev/OnlineDev/${id}/actionLaunchFlow`, + method: 'POST', + data + }) +} +// 获取关联表单数据详情 +export function getDataChange(data, modelId) { + return request({ + url: `/api/visualdev/OnlineDev/${modelId}/DataChange`, + method: 'post', + data + }) +} \ No newline at end of file diff --git a/api/apply/webDesign.js b/api/apply/webDesign.js new file mode 100644 index 0000000..1208c3d --- /dev/null +++ b/api/apply/webDesign.js @@ -0,0 +1,46 @@ +import request from '@/utils/request' +// 获取列表表单配置JSON +export function getConfig(modelId, encryption) { + return request({ + url: `/api/visualdev/ShortLink/${modelId}/Config?encryption=${encryption}`, + method: 'GET' + }) +} +// 获取数据详情 +export function getDataChange(modelId, id, encryption) { + return request({ + url: `/api/visualdev/ShortLink/${modelId}/${id}/DataChange` + (encryption ? '?encryption=' + + encryption : ''), + method: 'GET' + }) +} +export function createModel(modelId, data, encryption) { + return request({ + url: `/api/visualdev/ShortLink/${modelId}?encryption=${encryption}`, + method: 'POST', + data + }) +} +// 表单外链表单信息 +export function getShortLink(id, encryption) { + return request({ + url: `/api/visualdev/ShortLink/getConfig/${id}?encryption=${encryption}`, + method: 'GET' + }) +} +//表单外链密码验证 +export function checkPwd(data) { + return request({ + url: `/api/visualdev/ShortLink/checkPwd`, + method: 'POST', + data + }) +} +// 表单外链列表 +export function listLink(id, data, encryption) { + return request({ + url: `/api/visualdev/ShortLink/${id}/ListLink?encryption=${encryption}`, + method: 'POST', + data + }) +} diff --git a/api/common.js b/api/common.js new file mode 100644 index 0000000..b495612 --- /dev/null +++ b/api/common.js @@ -0,0 +1,651 @@ +import request from '@/utils/request' + +//app版本升级 +export function versionUpgrade(appName) { + return request({ + url: `/api/file/AppStartInfo/${appName}`, + }) +} +export function getAppVersion() { + return request({ + url: `/api/app/Version` + }) +} +// 获取数据字典数据 +export function getDictionaryDataAll() { + return request({ + url: '/api/system/DictionaryData/All', + options: { + load: false + } + }) +} +// 获取字典数据下拉框列表 +export function getDictionaryDataSelector(dictionaryTypeId) { + return request({ + url: `/api/system/DictionaryData/${dictionaryTypeId}/Data/Selector`, + options: { + load: false + } + }) +} +// 获取关联表单数据详情 +export function getRelationFormDetail(modelId, data) { + return request({ + url: `/api/visualdev/OnlineDev/${modelId}/DataChange`, + method: 'post', + data + }) +} +// 获取关联表单弹窗列表 +export function getRelationSelect(id, data, options) { + return request({ + url: `/api/visualdev/Base/${id}/FieldDataSelect`, + data, + options: { + load: false + } + }) +} +// 获取弹窗选择远端接口数据 +export function getPopSelect(id, data, options) { + return request({ + url: `/api/system/DataInterface/${id}/Actions/List`, + method: 'POST', + data, + options: { + load: true + } + }) +} +// 获取多条接口数据 +export function getDataInterfaceDataInfoByIds(id, data) { + return request({ + url: `/api/system/DataInterface/${id}/Actions/InfoByIds`, + method: 'POST', + data + }) +} +// 获取组织/公司下拉框列表 +export function getOrganizeSelector(data) { + if (!data) data = { + parentId: '0' + }; + return request({ + url: '/api/permission/Organize/Selector', + options: { + load: false + }, + data + }) +} +// 获取组织和岗位下拉框列表 +export function getOrgAndPosSelector(data) { + if (!data) data = { + id: '0', + type: 'organize' + }; + return request({ + url: '/api/permission/Organize/AsyncPosList', + options: { + load: false + }, + data + }) +} +// 获取选中组织基本信息 +export function getOrgSelectedList(data) { + return request({ + url: `/api/permission/Organize/SelectedList`, + method: 'POST', + options: { + load: false + }, + data + }) +} +// 获取岗位下拉列表 +export function getPositionSelector(data) { + return request({ + url: '/api/permission/Position/Selector', + options: { + load: false + }, + data + }) +} +// 获取选中岗位信息 +export function getPositionSelectedList(data) { + return request({ + url: `/api/permission/Position/SelectedList`, + method: 'POST', + options: { + load: false + }, + data + }) +} +// 获取用户下拉框列表(公司+部门+用户) +export function getUserSelector() { + return request({ + url: '/api/permission/Users/Selector', + options: { + load: false + } + }) +} + +// 通过部门id,岗位id,角色id,分组id,用户id获取用户列表(带分页) +export const getUsersByUserCondition = (data) => { + return request({ + url: '/api/permission/Users/UserCondition', + method: 'post', + data + }) +} +// 通过部门id获取部门树形 +export const getOrgByOrganizeCondition = (data) => { + return request({ + url: `/api/permission/Organize/OrganizeCondition`, + method: 'post', + data + }) +} +// 通过部门id,岗位id获取岗位树形 +export const getPositionByCondition = (data) => { + return request({ + url: `/api/permission/Position/PositionCondition`, + method: 'post', + data + }) +} + +// 获取用户基本信息 +export const getUserInfoList = ids => { + return request({ + url: '/api/permission/Users/getUserList', + method: 'post', + data: { + ids + } + }) +} + +// 获取当前组织用户 +export const getOrganization = (keyword) => { + return request({ + url: '/api/permission/Users/getOrganization', + method: 'get', + data: { + keyword, + organizeId: '0' + } + }) +} +//获取用户详情 +export function getUesrDetail(id) { + return request({ + url: '/api/app/User/' + id, + method: 'GET' + }) +} +// 获取接口数据 +export function getDataInterfaceRes(id, data) { + return request({ + url: `/api/system/DataInterface/${id}/Actions/Preview`, + method: 'post', + options: { + load: false + }, + data: data || {} + }) +} +// 用户登录 +export function login(data) { + return request({ + url: '/api/oauth/Login', + method: 'post', + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + } + }) +} +// 账号注销 +export function accountCancel(token) { + return request({ + url: '/api/oauth/logoutCurrentUser', + method: 'post', + token, + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + } + }) +} +//获取验证码 +export function clickSms(account) { + return request({ + url: 'https://app.jnpfsoft.com/api/Saas/Tenant/SmsCode/' + account, + method: 'GET', + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + } + }) +} +//验证码登录 +export function loginSms(data) { + return request({ + url: 'https://app.jnpfsoft.com/api/Saas/Tenant/LoginSms', + method: 'POST', + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + } + }) +} +// 退出登录 +export function logout() { + return request({ + url: '/api/oauth/Logout', + method: 'POST' + }) +} + +// 获取当前用户信息 +export function getCurrentUser() { + return request({ + url: '/api/oauth/CurrentUser?type=app', + options: { + load: false + }, + header: { + 'App-Code': '' + } + }) +} +// 获取当前用户个人资料 +export function getUserSettingInfo() { + return request({ + url: '/api/permission/Users/Current/BaseInfo', + method: 'GET', + options: { + load: false + } + }) +} +// 更新当前用户个人资料 +export function updateUserInfo(data) { + return request({ + url: '/api/permission/Users/Current/BaseInfo', + method: 'PUT', + data: data, + options: { + load: false + } + }) +} +// 修改密码信息发送 +export function updatePasswordMessage() { + return request({ + url: '/api/oauth/updatePasswordMessage', + method: 'POST', + data: {}, + options: { + load: false + } + }) +} + +// 用户登录测试 +export function login2(data) { + return request({ + url: '/api/oauth', + method: 'GET', + data, + options: { + load: false + } + }) +} +export function getBillNumber(enCode) { + return request({ + url: `/api/system/BillRule/BillNumber/${enCode}`, + method: 'GET', + options: { + load: false + } + }) +} + +// 获取下载文件链接 +export function getDownloadUrl(type, fileId) { + return request({ + url: `/api/file/Download/${type}/${fileId}`, + method: 'GET' + }) +} +// 修改当前用户密码 +export function updatePassword(data) { + return request({ + url: '/api/permission/Users/Current/Actions/ModifyPassword', + method: 'POST', + data + }) +} +// 获取我的下属 +export function getSubordinate(id) { + return request({ + url: `/api/permission/Users/Current/Subordinate/${id ? id : '0'}`, + method: 'GET' + }) +} +// 获取默认配置 +export function getConfig(account) { + return request({ + url: `/api/oauth/getConfig/${account}`, + method: 'get', + options: { + load: false + } + }) +} +// 获取行政区划下拉框数据 +export function getProvinceSelector(id) { + return request({ + url: `/api/system/Area/${id}/Selector/0`, + method: 'GET' + }) +} +// 获取行政区划下拉框数据 +export function getProvinceSelectorInfoList(idsList) { + return request({ + url: `/api/system/Area/GetAreaByIds`, + method: 'post', + data: { + idsList + } + }) +} +// 设置主要组织、主要岗位 +export function setMajor(data) { + return request({ + url: `/api/permission/Users/Current/major`, + method: 'put', + data + }) +} +// 获取当前用户所有组织 +export function getUserOrganizes(data) { + return request({ + url: `/api/permission/Users/Current/getUserOrganizes`, + method: 'GET', + data + }) +} +// 获取当前用户所有岗位 +export function getUserPositions(data) { + return request({ + url: `/api/permission/Users/Current/getUserPositions`, + method: 'GET', + data + }) +} +// 获取当前用户个人资料 +export function UserSettingInfo() { + return request({ + url: '/api/permission/Users/Current/BaseInfo', + method: 'GET' + }) +} +// 更新当前用户个人资料 +export function UpdateUser(data) { + return request({ + url: '/api/permission/Users/Current/BaseInfo', + method: 'PUT', + data + }) +} +// 更新当前用户头像 +export function UpdateAvatar(name) { + return request({ + url: `/api/permission/Users/Current/Avatar/${name}`, + method: 'PUT' + }) +} +// 获取分组下拉框列表 +export const getGroupSelector = () => { + return request({ + url: '/api/permission/Group/Selector', + method: 'GET' + }) +} +// 获取分组列表 +export const getGroupCondition = (data) => { + return request({ + url: '/api/permission/Group/GroupCondition', + method: 'POST', + data + }) +} +// 获取角色下拉框列表 +export const getRoleSelector = () => { + return request({ + url: '/api/permission/Role/Selector', + method: 'GET', + data: { + type: 'user', + isSystem: 0 + }, + options: { + load: false + } + }) +} +// 获取角色下拉框列表 +export const getRoleCondition = (data) => { + return request({ + url: '/api/permission/Role/RoleCondition', + method: 'POST', + data + }) +} +// app第三方登录 +export const getCallback = (data) => { + return request({ + url: `/api/oauth/socials/app/callback/${data.source}?uuid=` + data.uuid, + method: 'GET' + }) +} +// 第三方登录 +export function otherlogin(data, ticket) { + return request({ + url: `/api/oauth/socials/render/${data}` + '?ticket=' + ticket, + method: 'get' + }) +} +// 获取登陆配置 +export function getLoginConfig() { + return request({ + url: '/api/oauth/getLoginConfig', + }) +} +//获取登录票据 +export function getTicket() { + return request({ + url: `/api/oauth/getTicket`, + method: 'GET', + }) +} +// 轮询获取登陆状态 +export function getTicketStatus(ticket) { + return request({ + url: `/api/oauth/getTicketStatus/${ticket}`, + method: 'GET', + options: { + load: false + } + }) +} +// 获取第三方列表 +export const getSocialsUserList = () => { + return request({ + url: '/api/permission/socials/login', + method: 'GET' + }) +} +// 第三方登录回调列表后点击登录 +export function socialsLogin(data) { + return request({ + url: `/api/oauth/Login/socials`, + data, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + }) +} +// 获取签名列表 +export const getSignImgList = () => { + return request({ + url: '/api/permission/Users/Current/SignImg', + method: 'GET', + options: { + load: false + } + }) +} +// 新增签名 +export const createSignImg = (data) => { + return request({ + url: '/api/permission/Users/Current/SignImg', + method: 'post', + data, + options: { + load: false + } + }) +} +// 设置默认签名 +export const setDefSignImg = (id) => { + return request({ + url: `/api/permission/Users/Current/${id}/SignImg`, + method: 'put', + options: { + load: false + } + }) +} +// 删除签名 +export const delSignImg = (id) => { + return request({ + url: `/api/permission/Users/Current/${id}/SignImg`, + method: 'delete', + options: { + load: false + } + }) +} +// 获取选中组织、岗位、角色、用户基本信息 +export const getSelectedList = ids => { + return request({ + url: '/api/permission/Users/getSelectedList', + method: 'post', + data: { + ids + } + }) +} +// 通过组织、岗位、角色、用户ids获取选中用户基本信息 +export const getSelectedUserList = data => { + return request({ + url: '/api/permission/Users/getSelectedUserList', + method: 'post', + data + }) +} +// 委托选择用户 +export const getReceiveUserList = data => { + return request({ + url: '/api/permission/Users/ReceiveUserList', + method: 'get', + data, + options: { + load: true + } + }) +} +// 获取用户下拉框列表 +export const getListByAuthorize = (organizeId, keyword) => { + return request({ + url: `/api/permission/Users/GetListByAuthorize/${organizeId}`, + method: 'post', + data: { + keyword + } + }) +} + +// 查询附近数据 +export function getAroundList(data) { + return request({ + url: '/api/system/Location/around', + method: 'get', + data + }) +} +//根据关键字查询附近数据 +export function getTextList(data) { + return request({ + url: '/api/system/Location/text', + method: 'get', + data + }) +} +//逆地理编码 +export function getAddress(data) { + return request({ + url: '/api/system/Location/regeo', + method: 'get', + data + }) +} +// 更改扫码凭证状态-已扫码 +export function setCodeCertificateStatus(ticket, status) { + return request({ + url: `/api/oauth/setCodeCertificateStatus/${ticket}/${status}`, + method: 'GET', + options: { + load: false + } + }) +} +// 扫码确认登录 +export function confirmLogin(ticket) { + return request({ + url: `/api/oauth/confirmLogin/${ticket}`, + method: 'GET', + options: { + load: false + } + }) +} +export function getLangJson(locale) { + const header = locale ? { + "Accept-Language": locale + } : {} + return request({ + url: '/api/system/BaseLang/LangJson', + method: 'GET', + header + }) +} +//获取用户列表 +export function getUserList(data) { + return request({ + url: '/api/permission/Users', + method: 'GET', + data, + options: { + load: false + } + }) +} \ No newline at end of file diff --git a/api/commonWords.js b/api/commonWords.js new file mode 100644 index 0000000..4815e48 --- /dev/null +++ b/api/commonWords.js @@ -0,0 +1,40 @@ +import request from '@/utils/request' +//获取常用语 +export function getSelector() { + return request({ + url: `/api/system/CommonWords/Selector?type=App`, + method: 'get' + }) +} + +// 获取常用语列表 +export function commonWords(data) { + return request({ + url: `/api/system/CommonWords`, + method: 'get', + data + }) +} +// 审批常用语新建 +export function Create(data) { + return request({ + url: '/api/system/CommonWords', + method: 'post', + data + }) +} +// 审批常用语编辑 +export function Update(data) { + return request({ + url: `/api/system/CommonWords/${data.id}`, + method: 'put', + data + }) +} +// 删除审批常用语详情 +export function Delete(id) { + return request({ + url: `/api/system/CommonWords/${id}`, + method: 'DELETE' + }) +} \ No newline at end of file diff --git a/api/home.js b/api/home.js new file mode 100644 index 0000000..75e9008 --- /dev/null +++ b/api/home.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + + +// 获取通知公告 +export function getNotice(data) { + return request({ + url: '/api/visualdev/Dashboard/Notice', + method: 'post', + data, + options: { + load: false + } + }) +} +// 获取未读邮件 +export function getEmail() { + return request({ + url: '/api/visualdev/Dashboard/Email', + method: 'get', + options: { + load: false + } + }) +} +// 获取待办事项 +export function getFlowTodo(type) { + return request({ + url: `/api/workflow/monitor/FlowTodo?type=${type}`, + method: 'get', + options: { + load: false + } + }) +} +// 获取我的待办事项 +export function getMyFlowTodo() { + return request({ + url: '/api/visualdev/Dashboard/MyFlowTodo', + method: 'get', + options: { + load: false + } + }) +} \ No newline at end of file diff --git a/api/index/index.js b/api/index/index.js new file mode 100644 index 0000000..e35e230 --- /dev/null +++ b/api/index/index.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' +export function getHomeData(id) { + return request({ + url: `/api/system/HomeData/app`, + method: 'get', + options: { + load: true + } + }) +} \ No newline at end of file diff --git a/api/message.js b/api/message.js new file mode 100644 index 0000000..b761bd8 --- /dev/null +++ b/api/message.js @@ -0,0 +1,73 @@ +import request from '@/utils/request' + +// 获取IM对话列表 +export function getIMReply(data) { + return request({ + url: '/api/message/imreply', + method: 'Get', + options: { + load: true + }, + data + }) +} +//获取消息列表 +export function getMessageList(data) { + return request({ + url: '/api/message', + data, + options: { + load: false + } + }) +} +//获取消息列表 +export function getUnReadMsgNum(data) { + return request({ + url: '/api/message/getUnReadMsgNum', + data, + options: { + load: false + } + }) +} +// 全部已读 +export function MessageAllRead(data) { + return request({ + url: '/api/message/Actions/ReadAll', + method: 'POST', + data + }) +} +//消息详情 +export function getMessageDetail(id) { + return request({ + url: `/api/message/ReadInfo/${id}`, + method: 'get' + }) +} +// 判断是否有查看消息详情权限(消息通知用) +export function checkInfo(taskOperatorId, opType) { + return request({ + url: `/api/workflow/operator/${taskOperatorId}/Info?opType=${opType}`, + method: 'get' + }) +} +// 删除会话列表 +export function relocation(id) { + return request({ + url: `/api/message/imreply/relocation/${id}`, + method: 'delete' + }) +} +// 获取组织下拉框列表 +export function getOrgAndPosSelector(data) { + return request({ + url: '/api/permission/Organize/AsyncPosList', + method: 'get', + data, + options: { + load: false + } + }) +} \ No newline at end of file diff --git a/api/portal/portal.js b/api/portal/portal.js new file mode 100644 index 0000000..4fef9b0 --- /dev/null +++ b/api/portal/portal.js @@ -0,0 +1,73 @@ +import request from '@/utils/request' +//门户列表 +export function PortalList() { + return request({ + url: `/api/visualdev/Portal/Selector/Menu`, + method: 'get', + options: { + load: false + } + }) +} +//更新门户 +export function SetPortal(id) { + return request({ + url: `/api/visualdev/Portal/${id}/Actions/SetDefault?platform=App`, + method: 'put', + options: { + load: false + } + }) +} +//门户列表切换后列表 +export function auth(id) { + return request({ + url: `/api/visualdev/Portal/${id}/auth?platform=App`, + method: 'get', + options: { + load: false + } + }) +} +//获取门户地图数据 +export function geojson(code) { + return request({ + url: `/api/system/atlas/geojson?code=${code}&hasChildren=true`, + method: 'get', + options: { + load: false + } + }) +} +//获取省市区树 +export function getAtlas() { + return request({ + url: `/api/system/atlas`, + method: 'get', + options: { + load: false + } + }) +} + +// 获取发送配置列表列表 +export const getMsgTemplate = data => { + return request({ + url: '/api/message/SendMessageConfig/getSendConfigList', + method: 'GET', + data, + options: { + load: false + } + }) +} +// 预览 +export const getPreviewPortal = id => { + return request({ + url: '/api/visualdev/Portal/' + id, + method: 'GET', + options: { + load: false + } + }) +} \ No newline at end of file diff --git a/api/signature.js b/api/signature.js new file mode 100644 index 0000000..7d70f5a --- /dev/null +++ b/api/signature.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + + +// 通过id获取签章下拉框列表 +export function getListByIds(data) { + return request({ + url: '/api/system/Signature/ListByIds', + method: 'post', + data + }) +} \ No newline at end of file diff --git a/api/system.js b/api/system.js new file mode 100644 index 0000000..dce29b2 --- /dev/null +++ b/api/system.js @@ -0,0 +1,14 @@ +import request from '@/utils/request' + + +// 获取应用列表 +export function getSystemList(data) { + return request({ + url: '/api/system/System/userAuthList', + method: 'get', + data, + options: { + load: true + } + }) +} \ No newline at end of file diff --git a/api/workFlow/document.js b/api/workFlow/document.js new file mode 100644 index 0000000..29f80f6 --- /dev/null +++ b/api/workFlow/document.js @@ -0,0 +1,139 @@ +import request from '@/utils/request' +// 获取文档列表 +export function getDocumentList(data) { + return request({ + url: `/api/file/Document?keyword=${data.keyword}&parentId=${data.parentId}`, + method: 'get' + }) +} + +// 文件下载 +export function packDownload(e) { + return request({ + url: `/api/file/Document/PackDownload`, + method: 'POST', + data:JSON.parse(e) + }) +} +// 文件重命名 +export function resetFileName(data) { + return request({ + url: `/api/file/Document/${data.id}`, + method: 'PUT', + data + }) +} +// 文件重命名详情 +export function fileDetail(id) { + return request({ + url: `/api/file/Document/${id}`, + method: 'get' + }) +} +// 新建文件夹 +export function addFolder(data) { + return request({ + url: `/api/file/Document`, + method: 'POST', + data + }) +} +// 文件删除 +export function batchDelete(e) { + return request({ + url: `/api/file/Document/BatchDelete`, + method: 'POST', + data:JSON.parse(e) + }) +} +// 文件回收站 +export function trash(data) { + return request({ + url: `/api/file/Document/Trash`, + method: 'GET', + data + }) +} +// 文件回收站删除 +export function trashDelete(data) { + return request({ + url: `/api/file/Document/Trash`, + method: 'post', + data + }) +} + +// 文件还原 +export function recovery(data) { + return request({ + url: `/api/file/Document/Trash/Actions/Recovery`, + method: 'POST', + data + }) +} + +// 文件树列表 +export function folderTree(data) { + return request({ + url: `/api/file/Document/FolderTree`, + method: 'POST', + data + }) +} + +// 文件移动 +export function folderMove(data) { + return request({ + url: `/api/file/Document/Actions/MoveTo/${data.id}`, + method: 'PUT', + data + }) +} + +// 文件共享列表 +export function shareFolderList(data) { + return request({ + url: `/api/file/Document/Share`, + method: 'GET', + data + }) +} +// 文件共享 +export function shareFolder(data) { + return request({ + url: `/api/file/Document/Actions/Share`, + method: 'POST', + data + }) +} +// 共享给我 +export function shareTome(data) { + return request({ + url: `/api/file/Document/ShareTome`, + method: 'GET', + data + }) +} +// 取消共享 +export function cancelShare(data) { + return request({ + url: `/api/file/Document/Actions/CancelShare`, + method: 'POST', + data + }) +} +// 获取共享人员 +export function shareUser(id) { + return request({ + url: `/api/file/Document/ShareUser/${id}`, + method: 'GET' + }) +} +// 更新共享人员 +export function shareAdjustment(data) { + return request({ + url: `/api/file/Document/Actions/ShareAdjustment/${data.ids}`, + method: 'POST', + data + }) +} \ No newline at end of file diff --git a/api/workFlow/entrust.js b/api/workFlow/entrust.js new file mode 100644 index 0000000..73d4622 --- /dev/null +++ b/api/workFlow/entrust.js @@ -0,0 +1,84 @@ +import request from '@/utils/request' + +// 获取流程委托列表 +export function FlowDelegateList(data) { + return request({ + url: `/api/workflow/delegate`, + method: 'get', + data + }) +} +// 获取流程委托信息 +export function FlowDelegateInfo(id) { + return request({ + url: `/api/workflow/delegate/${id}`, + method: 'get' + }) +} +// 删除流程委托 +export function DeleteDelagate(id) { + return request({ + url: `/api/workflow/delegate/${id}`, + method: 'DELETE' + }) +} +// 新建流程委托 +export function Create(data) { + return request({ + url: `/api/workflow/delegate`, + method: 'post', + data + }) +} +// 更新流程委托 +export function Update(data) { + return request({ + url: `/api/workflow/delegate/${data.id}`, + method: 'PUT', + data + }) +} + +// 获取流程的所有委托人 +export function getDelegateUser(id) { + return request({ + url: `/api/workflow/delegate/UserList?templateId=${id}`, + method: 'get' + }) +} + +// 获取一个委托终止 +export function entrustStop(id) { + return request({ + url: `/api/workflow/delegate/Stop/${id}`, + method: 'put', + data: {} + }) +} + +// 获取用户下拉框列表 +export const getListByAuthorize = (organizeId, keyword) => { + return request({ + url: `/api/permission/Users/GetListByAuthorize/${organizeId}`, + method: 'post', + data: { + keyword + } + }) +} +// 获取用户下拉框列表 +export function getPrincipalDetails(id) { + return request({ + url: `/api/workflow/delegate/Info/${id}`, + method: 'get' + + }) +} +// 接受委托 +export function entrustHandle(id, data) { + return request({ + url: `/api/workflow/delegate/Notarize/${id}?type=${data.type}`, + method: 'post', + data: {} + }) +} \ No newline at end of file diff --git a/api/workFlow/flowBefore.js b/api/workFlow/flowBefore.js new file mode 100644 index 0000000..d9f37f7 --- /dev/null +++ b/api/workFlow/flowBefore.js @@ -0,0 +1,232 @@ +import request from '@/utils/request' +import jnpf from '@/utils/jnpf' + +// 获取待我审批信息 +export function FlowTask(id, data) { + const userInfo = uni.getStorageSync('userInfo') || {} + const newId = jnpf.aesEncryption.encrypt(id + ',' + userInfo.userId + ',' + jnpf.idGenerator()); + return request({ + url: `/api/workflow/task/${newId}`, + method: 'get', + data, + options: { + load: true + } + }) +} + +// 流程记录 +export function recordList(data) { + return request({ + url: `/api/workflow/operator/RecordList`, + method: 'get', + data + }) +} + +// 获取流程任务 +export function taskList(data) { + return request({ + url: `/api/workflow/trigger/task/List`, + method: 'get', + data + }) +} + +//减签列表 +export function AddSignUserIdList(data, id) { + return request({ + url: `/api/workflow/operator/AddSignUserIdList/${id}`, + method: 'post', + data + }) +} +//减签 +export function ReduceApprover(data, id) { + return request({ + url: `/api/workflow/operator/ReduceApprover/${id}`, + method: 'post', + data + }) +} +// 流程签收 +export function SignFor(data) { + return request({ + url: `/api/workflow/operator/Sign`, + method: 'post', + data + }) +} + +// 退回 +export function back(id) { + return request({ + url: `/api/workflow/operator/SendBackNodeList/${id}`, + method: 'get' + }) +} +// 确认退回 +export function sendBack(data, id) { + return request({ + url: `/api/workflow/operator/SendBack/${id}`, + method: 'post', + data + }) +} +// 开始办理 +export function Transact(data) { + return request({ + url: `/api/workflow/operator/Transact`, + method: 'post', + data + }) +} + + +// 待我审核审核 +export function Audit(id, data) { + return request({ + url: `/api/workflow/operator/Audit/${id}`, + method: 'post', + data, + options: { + load: true + } + }) +} +// 待我审核退回 +export function Reject(id, data) { + return request({ + url: `/api/workflow/operator/Audit/${id}`, + method: 'post', + data + }) +} +// 撤回审核 +export function auditRecall(id, data) { + return request({ + url: `/api/workflow/operator/Recall/${id}`, + method: 'post', + data + }) +} +export function launchRecall(id, data) { + return request({ + url: `/api/workflow/task/Recall/${id}`, + method: 'PUT', + data + }) +} + +//减签 +export function addSignUserIdList(id, data) { + return request({ + url: `/api/workflow/operator/AddSignUserIdList/${id}`, + method: 'POST', + data + }) +} + +// 驳回审核 +export function cancel(id, data) { + return request({ + url: `/api/workflow/Engine/FlowBefore/Cancel/${id}`, + method: 'post', + data + }) +} +// 待我审核转审 +export function Transfer(id, data) { + return request({ + url: `/api/workflow/operator/Transfer/${id}`, + method: 'post', + data + }) +} +// 审批汇总 +export function getRecordList(id, data) { + return request({ + url: `/api/workflow/Engine/FlowBefore/RecordList/${id}`, + method: 'get', + data + }) +} +// 待我审核保存草稿 +export function saveAudit(id, data) { + return request({ + url: `/api/workflow/operator/SaveAudit/${id}`, + method: 'post', + data + }) +} +export function saveAssist(id, data) { + return request({ + url: `/api/workflow/operator/AssistSave/${id}`, + method: 'post', + data + }) +} + +// 判断是否有候选人 +export function Candidates(id, data) { + return request({ + url: `/api/workflow/operator/CandidateNode/${id}`, + method: 'post', + data + }) +} +// 获取候选人列表(分页) +export function CandidateUser(id, data) { + return request({ + url: `/api/workflow/operator/CandidateUser/${id}`, + method: 'post', + data + }) +} +// 获取审批退回类型 +export function RejectList(id) { + return request({ + url: `/api/workflow/Engine/FlowBefore/RejectList/${id}`, + method: 'get' + }) +} +//协办 +export function Assist(id, data) { + return request({ + url: `/api/workflow/operator/Assist/${id}`, + method: 'post', + data + }) +} +// 加签 +export function FreeApprover(id, data) { + return request({ + url: `/api/workflow/operator/AddSign/${id}`, + method: 'post', + data + }) +} +// 返回多个子流程信息 +export function SubFlowInfo(id) { + return request({ + url: `/api/workflow/Engine/FlowBefore/SubFlowInfo/${id}`, + method: 'get' + }) +} + +// 获取流程实例相关人员(分页) +export function getTaskUserList(taskId, data) { + return request({ + url: `/api/workflow/task/TaskUserList/${taskId}`, + method: 'get', + data + }) +} + +// 外部节点重试 +export function retryOutside(nodeId) { + return request({ + url: `/api/workflow/task/Hooks/Retry/${nodeId}`, + method: 'get', + }) +} \ No newline at end of file diff --git a/api/workFlow/flowEngine.js b/api/workFlow/flowEngine.js new file mode 100644 index 0000000..2b5d155 --- /dev/null +++ b/api/workFlow/flowEngine.js @@ -0,0 +1,120 @@ +import request from '@/utils/request' + +// 获取流程引擎列表 +export function FlowEngineList(data) { + return request({ + url: `/api/workflow/Engine/flowTemplate`, + method: 'get', + data + }) +} +// 获取流程引擎信息 +export function FlowEngineInfo(id) { + return request({ + url: `/api/workflow/Engine/flowTemplate/${id}`, + method: 'get' + }) +} + +//获取流程引擎分页 +export function getFlowSelector(data) { + return request({ + url: `/api/workflow/template/Selector`, + method: 'get', + data, + options: { + load: true + } + }) +} + +//表单预览 +export function flowForm(id) { + return request({ + url: `/api/flowForm/Form/${id}`, + method: 'get' + }) +} + +// 列表ListAll +export function FlowEngineListAll() { + return request({ + url: `/api/workflow/Engine/flowTemplate/ListAll`, + method: 'get', + options: { + load: false + } + }) +} +// 流程引擎下拉框 +export function FlowEngineSelector(type) { + return request({ + url: `/api/workflow/Engine/flowTemplate/Selector`, + method: 'get', + data: { + type + } + }) +} +// 获取流程评论列表 +export function getCommentList(data) { + return request({ + url: `/api/workflow/comment`, + method: 'get', + data + }) +} +// 新建流程评论 +export function createComment(data) { + return request({ + url: `/api/workflow/comment`, + method: 'post', + data + }) +} +// 删除流程评论 +export function delComment(id) { + return request({ + url: `/api/workflow/comment/${id}`, + method: 'delete' + }) +} +// 委托可选全部流程 +export function FlowEngineAll(data) { + return request({ + url: `/api/workflow/Engine/flowTemplate/getflowAll`, + method: 'get', + data + }) +} +// 获取引擎id +export function getFlowIdByCode() { + return request({ + url: `/api/extend/CrmOrder`, + method: 'get' + }) +} +// 获取待办未读 +export function getFlowTodoCount(data) { + return request({ + url: `/api/workflow/monitor/FlowTodoCount`, + method: 'post', + data + }) +} + +// 委托 通过list获取流程引擎列表 +export function getFlowEngineListByIds(data) { + return request({ + url: `/api/workflow/template/GetFlowList`, + method: 'post', + data + }) +} +// 获取流程版本Id和发起节点表单id(大流程id) +export function getFlowStartFormId(id) { + return request({ + url: `/api/workflow/template/StartFormId/${id}`, + method: 'get', + }) +} \ No newline at end of file diff --git a/api/workFlow/flowLaunch.js b/api/workFlow/flowLaunch.js new file mode 100644 index 0000000..e509bd1 --- /dev/null +++ b/api/workFlow/flowLaunch.js @@ -0,0 +1,16 @@ +import request from '@/utils/request' +// 撤销 +export function Revoke(id, data) { + return request({ + url: `/api/workflow/task/Revoke/${id}`, + method: 'PUT', + data + }) +} +// 发起催办 +export function Press(id) { + return request({ + url: `/api/workflow/task/Press/${id}`, + method: 'post' + }) +} \ No newline at end of file diff --git a/api/workFlow/schedule.js b/api/workFlow/schedule.js new file mode 100644 index 0000000..7500818 --- /dev/null +++ b/api/workFlow/schedule.js @@ -0,0 +1,65 @@ +import request from '@/utils/request' + +// 获取日程安排列表 +export function List(data) { + return request({ + url: '/api/system/Schedule/AppList', + method: 'get', + data, + options: { + load: false + } + }) +} +// 新建日程安排 +export function ScheduleCreate(data) { + return request({ + url: '/api/system/Schedule', + method: 'post', + data, + options: { + load: false + } + }) +} +// 删除日程安排 +export function ScheduleDelete(id, type) { + return request({ + url: `/api/system/Schedule/${id}/${type}`, + method: 'DELETE', + options: { + load: false + } + }) +} +// 获取日程安排信息 +export function ScheduleInfo(id) { + return request({ + url: `/api/system/Schedule/${id}`, + method: 'get', + options: { + load: false + } + }) +} +// 更新日程安排 +export function ScheduleUpdate(data, type) { + return request({ + url: `/api/system/Schedule/${data.id}/${type}`, + method: 'PUT', + data, + options: { + load: false + } + }) +} +//查看日程详情 +export function ScheduleDetail(groupId, id) { + return request({ + url: `/api/system/Schedule/detail?groupId=${groupId}&id=${id}`, + method: 'get', + options: { + load: false + } + }) +} \ No newline at end of file diff --git a/api/workFlow/template.js b/api/workFlow/template.js new file mode 100644 index 0000000..faf7aaa --- /dev/null +++ b/api/workFlow/template.js @@ -0,0 +1,49 @@ +import request from '@/utils/request' + +// 获取发起 +export function getFlowLaunchList(data) { + return request({ + url: `/api/workflow/task`, + method: 'get', + data, + options: { + load: false + } + }) +} +// 删除流程发起 +export function delFlowLaunch(id) { + return request({ + url: '/api/workflow/task/' + id, + method: 'delete', + }); +} +// 获取待签 +export function getOperatorList(data) { + return request({ + url: `/api/workflow/operator/List/${data.category}`, + method: 'get', + data, + options: { + load: false + } + }) +} + + + +// 获取流程发起列表 +// export function TreeList() { +// return request({ +// url: `/api/workflow/template/TreeList`, +// method: 'get' +// }) +// } + +// 获取流程发起列表 +// export function OperatorList() { +// return request({ +// url: `api/workflow/operator/List/0`, +// method: 'get' +// }) +// } \ No newline at end of file diff --git a/api/workFlow/workFlowForm.js b/api/workFlow/workFlowForm.js new file mode 100644 index 0000000..5187440 --- /dev/null +++ b/api/workFlow/workFlowForm.js @@ -0,0 +1,35 @@ +import request from '@/utils/request' + +// 新建表单 +export function Create(data) { + return request({ + url: `/api/workflow/task`, + method: 'post', + data, + options: { + load: true + } + }) +} +// 修改表单 +export function Update(data) { + return request({ + url: `/api/workflow/task/${data.id}`, + method: 'put', + data + }) +} +//通过表单id获取流程id +export function getFormById(id) { + return request({ + url: `/api/flowForm/Form/getFormById/${id}`, + method: 'get' + }) +} +//查看发起表单 +export function getStartFormInfo(id) { + return request({ + url: `/api/workflow/task/ViewStartForm/${id}`, + method: 'get' + }) +} \ No newline at end of file diff --git a/assets/iconfont/custom/iconfont.css b/assets/iconfont/custom/iconfont.css new file mode 100644 index 0000000..db72079 --- /dev/null +++ b/assets/iconfont/custom/iconfont.css @@ -0,0 +1,7203 @@ +@font-face { + font-family: 'ym-custom'; + /* Project id 2016749 */ + src: url('https://at.alicdn.com/t/font_2016749_kum5osnby7n.woff2?t=1620963605001') format('woff2'), + url('https://at.alicdn.com/t/font_2016749_kum5osnby7n.woff?t=1620963605001') format('woff'), + url('https://at.alicdn.com/t/font_2016749_kum5osnby7n.ttf?t=1620963605001') format('truetype'); +} + +.ym-custom { + font-family: "ym-custom" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.ym-custom-battery-charging-3:before { + content: "\e6a2"; +} + +.ym-custom-cloud-print-outline:before { + content: "\e7a2"; +} + +.ym-custom-filter-outline:before { + content: "\e8a2"; +} + +.ym-custom-instapaper:before { + content: "\e9a2"; +} + +.ym-custom-package-variant-closed:before { + content: "\eaa2"; +} + +.ym-custom-signal-g2:before { + content: "\eba2"; +} + +.ym-custom-view-module:before { + content: "\eca2"; +} + +.ym-custom-battery-charging-4:before { + content: "\e6a3"; +} + +.ym-custom-cloud-upload:before { + content: "\e7a3"; +} + +.ym-custom-filter-variant:before { + content: "\e8a3"; +} + +.ym-custom-invert-colors:before { + content: "\e9a3"; +} + +.ym-custom-page-first:before { + content: "\eaa3"; +} + +.ym-custom-signal-hspa:before { + content: "\eba3"; +} + +.ym-custom-view-parallel:before { + content: "\eca3"; +} + +.ym-custom-battery-charging-5:before { + content: "\e6a4"; +} + +.ym-custom-cloud-sync:before { + content: "\e7a4"; +} + +.ym-custom-fish:before { + content: "\e8a4"; +} + +.ym-custom-itunes:before { + content: "\e9a4"; +} + +.ym-custom-palette:before { + content: "\eaa4"; +} + +.ym-custom-signal-hspa-plus:before { + content: "\eba4"; +} + +.ym-custom-view-quilt:before { + content: "\eca4"; +} + +.ym-custom-battery-charging-6:before { + content: "\e6a5"; +} + +.ym-custom-code-array:before { + content: "\e7a5"; +} + +.ym-custom-flag:before { + content: "\e8a5"; +} + +.ym-custom-internet-explorer:before { + content: "\e9a5"; +} + +.ym-custom-page-last:before { + content: "\eaa5"; +} + +.ym-custom-signal-variant:before { + content: "\eba5"; +} + +.ym-custom-view-stream:before { + content: "\eca5"; +} + +.ym-custom-battery-minus:before { + content: "\e6a6"; +} + +.ym-custom-code-brackets:before { + content: "\e7a6"; +} + +.ym-custom-firefox:before { + content: "\e8a6"; +} + +.ym-custom-jeepney:before { + content: "\e9a6"; +} + +.ym-custom-palette-advanced:before { + content: "\eaa6"; +} + +.ym-custom-silverware-fork:before { + content: "\eba6"; +} + +.ym-custom-view-sequential:before { + content: "\eca6"; +} + +.ym-custom-battery-outline:before { + content: "\e6a7"; +} + +.ym-custom-code-braces:before { + content: "\e7a7"; +} + +.ym-custom-fingerprint:before { + content: "\e8a7"; +} + +.ym-custom-jira:before { + content: "\e9a7"; +} + +.ym-custom-panda:before { + content: "\eaa7"; +} + +.ym-custom-sign-caution:before { + content: "\eba7"; +} + +.ym-custom-view-headline:before { + content: "\eca7"; +} + +.ym-custom-battery-negative:before { + content: "\e6a8"; +} + +.ym-custom-code-equal:before { + content: "\e7a8"; +} + +.ym-custom-fire:before { + content: "\e8a8"; +} + +.ym-custom-jsfiddle:before { + content: "\e9a8"; +} + +.ym-custom-pandora:before { + content: "\eaa8"; +} + +.ym-custom-silverware:before { + content: "\eba8"; +} + +.ym-custom-view-week:before { + content: "\eca8"; +} + +.ym-custom-battery-positive:before { + content: "\e6a9"; +} + +.ym-custom-code-greater-than:before { + content: "\e7a9"; +} + +.ym-custom-flag-checkered:before { + content: "\e8a9"; +} + +.ym-custom-keg:before { + content: "\e9a9"; +} + +.ym-custom-panorama:before { + content: "\eaa9"; +} + +.ym-custom-silverware-spoon:before { + content: "\eba9"; +} + +.ym-custom-vimeo:before { + content: "\eca9"; +} + +.ym-custom-battery-plus:before { + content: "\e6aa"; +} + +.ym-custom-code-less-than:before { + content: "\e7aa"; +} + +.ym-custom-flag-triangle:before { + content: "\e8aa"; +} + +.ym-custom-json:before { + content: "\e9aa"; +} + +.ym-custom-panorama-fisheye:before { + content: "\eaaa"; +} + +.ym-custom-silverware-variant:before { + content: "\ebaa"; +} + +.ym-custom-vine:before { + content: "\ecaa"; +} + +.ym-custom-battery-unknown:before { + content: "\e6ab"; +} + +.ym-custom-code-greater-than-or-equal:before { + content: "\e7ab"; +} + +.ym-custom-flag-outline:before { + content: "\e8ab"; +} + +.ym-custom-kettle:before { + content: "\e9ab"; +} + +.ym-custom-panorama-horizontal:before { + content: "\eaab"; +} + +.ym-custom-sim:before { + content: "\ebab"; +} + +.ym-custom-view-grid:before { + content: "\ecab"; +} + +.ym-custom-beach:before { + content: "\e6ac"; +} + +.ym-custom-code-less-than-or-equal:before { + content: "\e7ac"; +} + +.ym-custom-flag-variant:before { + content: "\e8ac"; +} + +.ym-custom-key:before { + content: "\e9ac"; +} + +.ym-custom-panorama-vertical:before { + content: "\eaac"; +} + +.ym-custom-sim-alert:before { + content: "\ebac"; +} + +.ym-custom-visualstudio:before { + content: "\ecac"; +} + +.ym-custom-beats:before { + content: "\e6ad"; +} + +.ym-custom-code-not-equal:before { + content: "\e7ad"; +} + +.ym-custom-flag-outline-variant:before { + content: "\e8ad"; +} + +.ym-custom-key-change:before { + content: "\e9ad"; +} + +.ym-custom-panorama-wide-angle:before { + content: "\eaad"; +} + +.ym-custom-skip-backward:before { + content: "\ebad"; +} + +.ym-custom-violin:before { + content: "\ecad"; +} + +.ym-custom-beaker:before { + content: "\e6ae"; +} + +.ym-custom-code-not-equal-variant:before { + content: "\e7ae"; +} + +.ym-custom-flash-auto:before { + content: "\e8ae"; +} + +.ym-custom-key-minus:before { + content: "\e9ae"; +} + +.ym-custom-paper-cut-vertical:before { + content: "\eaae"; +} + +.ym-custom-sitemap:before { + content: "\ebae"; +} + +.ym-custom-vk:before { + content: "\ecae"; +} + +.ym-custom-bell:before { + content: "\e6af"; +} + +.ym-custom-code-parentheses:before { + content: "\e7af"; +} + +.ym-custom-flash:before { + content: "\e8af"; +} + +.ym-custom-key-remove:before { + content: "\e9af"; +} + +.ym-custom-paperclip:before { + content: "\eaaf"; +} + +.ym-custom-skip-next:before { + content: "\ebaf"; +} + +.ym-custom-vk-box:before { + content: "\ecaf"; +} + +.ym-custom-beer:before { + content: "\e6b0"; +} + +.ym-custom-code-string:before { + content: "\e7b0"; +} + +.ym-custom-flashlight:before { + content: "\e8b0"; +} + +.ym-custom-key-plus:before { + content: "\e9b0"; +} + +.ym-custom-parking:before { + content: "\eab0"; +} + +.ym-custom-skip-forward:before { + content: "\ebb0"; +} + +.ym-custom-vk-circle:before { + content: "\ecb0"; +} + +.ym-custom-behance:before { + content: "\e6b1"; +} + +.ym-custom-codepen:before { + content: "\e7b1"; +} + +.ym-custom-flash-outline:before { + content: "\e8b1"; +} + +.ym-custom-keyboard:before { + content: "\e9b1"; +} + +.ym-custom-pause:before { + content: "\eab1"; +} + +.ym-custom-sim-off:before { + content: "\ebb1"; +} + +.ym-custom-vlc:before { + content: "\ecb1"; +} + +.ym-custom-bell-off:before { + content: "\e6b2"; +} + +.ym-custom-code-tags:before { + content: "\e7b2"; +} + +.ym-custom-flash-off:before { + content: "\e8b2"; +} + +.ym-custom-keyboard-caps:before { + content: "\e9b2"; +} + +.ym-custom-pause-circle:before { + content: "\eab2"; +} + +.ym-custom-skip-next-circle:before { + content: "\ebb2"; +} + +.ym-custom-voice:before { + content: "\ecb2"; +} + +.ym-custom-bell-plus:before { + content: "\e6b3"; +} + +.ym-custom-code-tags-check:before { + content: "\e7b3"; +} + +.ym-custom-flask:before { + content: "\e8b3"; +} + +.ym-custom-keyboard-backspace:before { + content: "\e9b3"; +} + +.ym-custom-pause-circle-outline:before { + content: "\eab3"; +} + +.ym-custom-skip-previous:before { + content: "\ebb3"; +} + +.ym-custom-voicemail:before { + content: "\ecb3"; +} + +.ym-custom-bell-outline:before { + content: "\e6b4"; +} + +.ym-custom-coffee:before { + content: "\e7b4"; +} + +.ym-custom-flashlight-off:before { + content: "\e8b4"; +} + +.ym-custom-keyboard-close:before { + content: "\e9b4"; +} + +.ym-custom-pause-octagon:before { + content: "\eab4"; +} + +.ym-custom-skip-previous-circle:before { + content: "\ebb4"; +} + +.ym-custom-volume-high:before { + content: "\ecb4"; +} + +.ym-custom-bell-ring:before { + content: "\e6b5"; +} + +.ym-custom-coffee-outline:before { + content: "\e7b5"; +} + +.ym-custom-flash-red-eye:before { + content: "\e8b5"; +} + +.ym-custom-keyboard-return:before { + content: "\e9b5"; +} + +.ym-custom-pause-octagon-outline:before { + content: "\eab5"; +} + +.ym-custom-skip-next-circle-outline:before { + content: "\ebb5"; +} + +.ym-custom-volume-low:before { + content: "\ecb5"; +} + +.ym-custom-bell-ring-outline:before { + content: "\e6b6"; +} + +.ym-custom-coffee-to-go:before { + content: "\e7b6"; +} + +.ym-custom-flask-empty:before { + content: "\e8b6"; +} + +.ym-custom-keyboard-off:before { + content: "\e9b6"; +} + +.ym-custom-paw:before { + content: "\eab6"; +} + +.ym-custom-skip-previous-circle-outline:before { + content: "\ebb6"; +} + +.ym-custom-volume-medium:before { + content: "\ecb6"; +} + +.ym-custom-bell-sleep:before { + content: "\e6b7"; +} + +.ym-custom-coin:before { + content: "\e7b7"; +} + +.ym-custom-flask-outline:before { + content: "\e8b7"; +} + +.ym-custom-key-variant:before { + content: "\e9b7"; +} + +.ym-custom-pencil:before { + content: "\eab7"; +} + +.ym-custom-skull:before { + content: "\ebb7"; +} + +.ym-custom-volume-off:before { + content: "\ecb7"; +} + +.ym-custom-beta:before { + content: "\e6b8"; +} + +.ym-custom-coins:before { + content: "\e7b8"; +} + +.ym-custom-flip-to-back:before { + content: "\e8b8"; +} + +.ym-custom-keyboard-variant:before { + content: "\e9b8"; +} + +.ym-custom-paw-off:before { + content: "\eab8"; +} + +.ym-custom-skype:before { + content: "\ebb8"; +} + +.ym-custom-walk:before { + content: "\ecb8"; +} + +.ym-custom-bible:before { + content: "\e6b9"; +} + +.ym-custom-collage:before { + content: "\e7b9"; +} + +.ym-custom-flattr:before { + content: "\e8b9"; +} + +.ym-custom-label:before { + content: "\e9b9"; +} + +.ym-custom-pencil-box:before { + content: "\eab9"; +} + +.ym-custom-skype-business:before { + content: "\ebb9"; +} + +.ym-custom-vpn:before { + content: "\ecb9"; +} + +.ym-custom-bike:before { + content: "\e6ba"; +} + +.ym-custom-color-helper:before { + content: "\e7ba"; +} + +.ym-custom-flask-empty-outline:before { + content: "\e8ba"; +} + +.ym-custom-kodi:before { + content: "\e9ba"; +} + +.ym-custom-pencil-box-outline:before { + content: "\eaba"; +} + +.ym-custom-slack:before { + content: "\ebba"; +} + +.ym-custom-wallet:before { + content: "\ecba"; +} + +.ym-custom-bing:before { + content: "\e6bb"; +} + +.ym-custom-comment:before { + content: "\e7bb"; +} + +.ym-custom-flip-to-front:before { + content: "\e8bb"; +} + +.ym-custom-keyboard-tab:before { + content: "\e9bb"; +} + +.ym-custom-pencil-circle:before { + content: "\eabb"; +} + +.ym-custom-sleep:before { + content: "\ebbb"; +} + +.ym-custom-wallet-giftcard:before { + content: "\ecbb"; +} + +.ym-custom-binoculars:before { + content: "\e6bc"; +} + +.ym-custom-comment-account:before { + content: "\e7bc"; +} + +.ym-custom-floppy:before { + content: "\e8bc"; +} + +.ym-custom-label-outline:before { + content: "\e9bc"; +} + +.ym-custom-pencil-lock:before { + content: "\eabc"; +} + +.ym-custom-smoking:before { + content: "\ebbc"; +} + +.ym-custom-wallet-travel:before { + content: "\ecbc"; +} + +.ym-custom-bio:before { + content: "\e6bd"; +} + +.ym-custom-comment-alert:before { + content: "\e7bd"; +} + +.ym-custom-flower:before { + content: "\e8bd"; +} + +.ym-custom-lambda:before { + content: "\e9bd"; +} + +.ym-custom-pencil-off:before { + content: "\eabd"; +} + +.ym-custom-sleep-off:before { + content: "\ebbd"; +} + +.ym-custom-wallet-membership:before { + content: "\ecbd"; +} + +.ym-custom-biohazard:before { + content: "\e6be"; +} + +.ym-custom-comment-account-outline:before { + content: "\e7be"; +} + +.ym-custom-folder:before { + content: "\e8be"; +} + +.ym-custom-lamp:before { + content: "\e9be"; +} + +.ym-custom-pen:before { + content: "\eabe"; +} + +.ym-custom-smoking-off:before { + content: "\ebbe"; +} + +.ym-custom-wan:before { + content: "\ecbe"; +} + +.ym-custom-bitbucket:before { + content: "\e6bf"; +} + +.ym-custom-comment-alert-outline:before { + content: "\e7bf"; +} + +.ym-custom-folder-account:before { + content: "\e8bf"; +} + +.ym-custom-lan:before { + content: "\e9bf"; +} + +.ym-custom-pentagon-outline:before { + content: "\eabf"; +} + +.ym-custom-snapchat:before { + content: "\ebbf"; +} + +.ym-custom-washing-machine:before { + content: "\ecbf"; +} + +.ym-custom-black-mesa:before { + content: "\e6c0"; +} + +.ym-custom-comment-check:before { + content: "\e7c0"; +} + +.ym-custom-folder-google-drive:before { + content: "\e8c0"; +} + +.ym-custom-lan-disconnect:before { + content: "\e9c0"; +} + +.ym-custom-pentagon:before { + content: "\eac0"; +} + +.ym-custom-sofa:before { + content: "\ebc0"; +} + +.ym-custom-watch:before { + content: "\ecc0"; +} + +.ym-custom-blackberry:before { + content: "\e6c1"; +} + +.ym-custom-comment-check-outline:before { + content: "\e7c1"; +} + +.ym-custom-folder-download:before { + content: "\e8c1"; +} + +.ym-custom-language-c:before { + content: "\e9c1"; +} + +.ym-custom-pharmacy:before { + content: "\eac1"; +} + +.ym-custom-snowman:before { + content: "\ebc1"; +} + +.ym-custom-watch-import:before { + content: "\ecc1"; +} + +.ym-custom-blender:before { + content: "\e6c2"; +} + +.ym-custom-comment-multiple-outline:before { + content: "\e7c2"; +} + +.ym-custom-folder-image:before { + content: "\e8c2"; +} + +.ym-custom-lan-connect:before { + content: "\e9c2"; +} + +.ym-custom-percent:before { + content: "\eac2"; +} + +.ym-custom-soccer:before { + content: "\ebc2"; +} + +.ym-custom-watch-export:before { + content: "\ecc2"; +} + +.ym-custom-blinds:before { + content: "\e6c3"; +} + +.ym-custom-comment-outline:before { + content: "\e7c3"; +} + +.ym-custom-folder-lock:before { + content: "\e8c3"; +} + +.ym-custom-language-cpp:before { + content: "\e9c3"; +} + +.ym-custom-phone:before { + content: "\eac3"; +} + +.ym-custom-solid:before { + content: "\ebc3"; +} + +.ym-custom-water:before { + content: "\ecc3"; +} + +.ym-custom-block-helper:before { + content: "\e6c4"; +} + +.ym-custom-comment-plus-outline:before { + content: "\e7c4"; +} + +.ym-custom-folder-lock-open:before { + content: "\e8c4"; +} + +.ym-custom-language-css:before { + content: "\e9c4"; +} + +.ym-custom-phone-bluetooth:before { + content: "\eac4"; +} + +.ym-custom-sort:before { + content: "\ebc4"; +} + +.ym-custom-watch-vibrate:before { + content: "\ecc4"; +} + +.ym-custom-bluetooth:before { + content: "\e6c5"; +} + +.ym-custom-comment-processing:before { + content: "\e7c5"; +} + +.ym-custom-folder-multiple:before { + content: "\e8c5"; +} + +.ym-custom-language-csharp:before { + content: "\e9c5"; +} + +.ym-custom-phone-classic:before { + content: "\eac5"; +} + +.ym-custom-sort-descending:before { + content: "\ebc5"; +} + +.ym-custom-watermark:before { + content: "\ecc5"; +} + +.ym-custom-bluetooth-audio:before { + content: "\e6c6"; +} + +.ym-custom-comment-processing-outline:before { + content: "\e7c6"; +} + +.ym-custom-folder-multiple-image:before { + content: "\e8c6"; +} + +.ym-custom-language-html:before { + content: "\e9c6"; +} + +.ym-custom-phone-incoming:before { + content: "\eac6"; +} + +.ym-custom-sort-alphabetical:before { + content: "\ebc6"; +} + +.ym-custom-water-percent:before { + content: "\ecc6"; +} + +.ym-custom-blogger:before { + content: "\e6c7"; +} + +.ym-custom-comment-question-outline:before { + content: "\e7c7"; +} + +.ym-custom-folder-outline:before { + content: "\e8c7"; +} + +.ym-custom-language-javascript:before { + content: "\e9c7"; +} + +.ym-custom-phone-hangup:before { + content: "\eac7"; +} + +.ym-custom-sort-ascending:before { + content: "\ebc7"; +} + +.ym-custom-weather-cloudy:before { + content: "\ecc7"; +} + +.ym-custom-bluetooth-connect:before { + content: "\e6c8"; +} + +.ym-custom-comment-text-outline:before { + content: "\e7c8"; +} + +.ym-custom-folder-remove:before { + content: "\e8c8"; +} + +.ym-custom-language-php:before { + content: "\e9c8"; +} + +.ym-custom-phone-in-talk:before { + content: "\eac8"; +} + +.ym-custom-sort-numeric:before { + content: "\ebc8"; +} + +.ym-custom-water-pump:before { + content: "\ecc8"; +} + +.ym-custom-bluetooth-off:before { + content: "\e6c9"; +} + +.ym-custom-comment-remove-outline:before { + content: "\e7c9"; +} + +.ym-custom-folder-star:before { + content: "\e8c9"; +} + +.ym-custom-language-python-text:before { + content: "\e9c9"; +} + +.ym-custom-phone-forward:before { + content: "\eac9"; +} + +.ym-custom-sort-variant:before { + content: "\ebc9"; +} + +.ym-custom-water-off:before { + content: "\ecc9"; +} + +.ym-custom-bluetooth-settings:before { + content: "\e6ca"; +} + +.ym-custom-comment-text:before { + content: "\e7ca"; +} + +.ym-custom-folder-upload:before { + content: "\e8ca"; +} + +.ym-custom-language-python:before { + content: "\e9ca"; +} + +.ym-custom-phone-locked:before { + content: "\eaca"; +} + +.ym-custom-soundcloud:before { + content: "\ebca"; +} + +.ym-custom-weather-fog:before { + content: "\ecca"; +} + +.ym-custom-bluetooth-transfer:before { + content: "\e6cb"; +} + +.ym-custom-compare:before { + content: "\e7cb"; +} + +.ym-custom-food:before { + content: "\e8cb"; +} + +.ym-custom-laptop:before { + content: "\e9cb"; +} + +.ym-custom-phone-minus:before { + content: "\eacb"; +} + +.ym-custom-source-commit:before { + content: "\ebcb"; +} + +.ym-custom-weather-night:before { + content: "\eccb"; +} + +.ym-custom-blur:before { + content: "\e6cc"; +} + +.ym-custom-compass:before { + content: "\e7cc"; +} + +.ym-custom-folder-move:before { + content: "\e8cc"; +} + +.ym-custom-language-swift:before { + content: "\e9cc"; +} + +.ym-custom-phone-log:before { + content: "\eacc"; +} + +.ym-custom-source-branch:before { + content: "\ebcc"; +} + +.ym-custom-weather-lightning-rainy:before { + content: "\eccc"; +} + +.ym-custom-blur-linear:before { + content: "\e6cd"; +} + +.ym-custom-compass-outline:before { + content: "\e7cd"; +} + +.ym-custom-folder-plus:before { + content: "\e8cd"; +} + +.ym-custom-lan-pending:before { + content: "\e9cd"; +} + +.ym-custom-phone-outgoing:before { + content: "\eacd"; +} + +.ym-custom-source-commit-end:before { + content: "\ebcd"; +} + +.ym-custom-weather-hail:before { + content: "\eccd"; +} + +.ym-custom-blur-off:before { + content: "\e6ce"; +} + +.ym-custom-contact-mail:before { + content: "\e7ce"; +} + +.ym-custom-food-apple:before { + content: "\e8ce"; +} + +.ym-custom-laptop-chromebook:before { + content: "\e9ce"; +} + +.ym-custom-phone-plus:before { + content: "\eace"; +} + +.ym-custom-source-commit-end-local:before { + content: "\ebce"; +} + +.ym-custom-weather-lightning:before { + content: "\ecce"; +} + +.ym-custom-blur-radial:before { + content: "\e6cf"; +} + +.ym-custom-console:before { + content: "\e7cf"; +} + +.ym-custom-food-fork-drink:before { + content: "\e8cf"; +} + +.ym-custom-laptop-off:before { + content: "\e9cf"; +} + +.ym-custom-phone-missed:before { + content: "\eacf"; +} + +.ym-custom-source-commit-next-local:before { + content: "\ebcf"; +} + +.ym-custom-weather-partlycloudy:before { + content: "\eccf"; +} + +.ym-custom-bomb:before { + content: "\e6d0"; +} + +.ym-custom-contacts:before { + content: "\e7d0"; +} + +.ym-custom-food-variant:before { + content: "\e8d0"; +} + +.ym-custom-laptop-mac:before { + content: "\e9d0"; +} + +.ym-custom-phone-paused:before { + content: "\ead0"; +} + +.ym-custom-source-commit-start:before { + content: "\ebd0"; +} + +.ym-custom-weather-pouring:before { + content: "\ecd0"; +} + +.ym-custom-bomb-off:before { + content: "\e6d1"; +} + +.ym-custom-content-duplicate:before { + content: "\e7d1"; +} + +.ym-custom-football:before { + content: "\e8d1"; +} + +.ym-custom-laptop-windows:before { + content: "\e9d1"; +} + +.ym-custom-phone-settings:before { + content: "\ead1"; +} + +.ym-custom-source-commit-local:before { + content: "\ebd1"; +} + +.ym-custom-weather-rainy:before { + content: "\ecd1"; +} + +.ym-custom-bone:before { + content: "\e6d2"; +} + +.ym-custom-content-copy:before { + content: "\e7d2"; +} + +.ym-custom-food-off:before { + content: "\e8d2"; +} + +.ym-custom-lastfm:before { + content: "\e9d2"; +} + +.ym-custom-phone-voip:before { + content: "\ead2"; +} + +.ym-custom-source-commit-start-next-local:before { + content: "\ebd2"; +} + +.ym-custom-weather-sunny:before { + content: "\ecd2"; +} + +.ym-custom-book:before { + content: "\e6d3"; +} + +.ym-custom-content-paste:before { + content: "\e7d3"; +} + +.ym-custom-football-australian:before { + content: "\e8d3"; +} + +.ym-custom-launch:before { + content: "\e9d3"; +} + +.ym-custom-pi-box:before { + content: "\ead3"; +} + +.ym-custom-source-fork:before { + content: "\ebd3"; +} + +.ym-custom-weather-snowy:before { + content: "\ecd3"; +} + +.ym-custom-bookmark:before { + content: "\e6d4"; +} + +.ym-custom-content-cut:before { + content: "\e7d4"; +} + +.ym-custom-football-helmet:before { + content: "\e8d4"; +} + +.ym-custom-layers:before { + content: "\e9d4"; +} + +.ym-custom-pi:before { + content: "\ead4"; +} + +.ym-custom-speaker:before { + content: "\ebd4"; +} + +.ym-custom-weather-snowy-rainy:before { + content: "\ecd4"; +} + +.ym-custom-bookmark-check:before { + content: "\e6d5"; +} + +.ym-custom-content-save-all:before { + content: "\e7d5"; +} + +.ym-custom-format-align-center:before { + content: "\e8d5"; +} + +.ym-custom-layers-off:before { + content: "\e9d5"; +} + +.ym-custom-piano:before { + content: "\ead5"; +} + +.ym-custom-source-pull:before { + content: "\ebd5"; +} + +.ym-custom-weather-sunset-down:before { + content: "\ecd5"; +} + +.ym-custom-bookmark-music:before { + content: "\e6d6"; +} + +.ym-custom-content-save:before { + content: "\e7d6"; +} + +.ym-custom-format-align-justify:before { + content: "\e8d6"; +} + +.ym-custom-leaf:before { + content: "\e9d6"; +} + +.ym-custom-pig:before { + content: "\ead6"; +} + +.ym-custom-source-merge:before { + content: "\ebd6"; +} + +.ym-custom-weather-sunset:before { + content: "\ecd6"; +} + +.ym-custom-bookmark-plus:before { + content: "\e6d7"; +} + +.ym-custom-content-save-settings:before { + content: "\e7d7"; +} + +.ym-custom-format-align-left:before { + content: "\e8d7"; +} + +.ym-custom-lead-pencil:before { + content: "\e9d7"; +} + +.ym-custom-pill:before { + content: "\ead7"; +} + +.ym-custom-speaker-off:before { + content: "\ebd7"; +} + +.ym-custom-weather-sunset-up:before { + content: "\ecd7"; +} + +.ym-custom-bookmark-plus-outline:before { + content: "\e6d8"; +} + +.ym-custom-contrast-circle:before { + content: "\e7d8"; +} + +.ym-custom-format-align-right:before { + content: "\e8d8"; +} + +.ym-custom-led-off:before { + content: "\e9d8"; +} + +.ym-custom-pillar:before { + content: "\ead8"; +} + +.ym-custom-speaker-wireless:before { + content: "\ebd8"; +} + +.ym-custom-weather-windy:before { + content: "\ecd8"; +} + +.ym-custom-bookmark-outline:before { + content: "\e6d9"; +} + +.ym-custom-contrast:before { + content: "\e7d9"; +} + +.ym-custom-format-annotation-plus:before { + content: "\e8d9"; +} + +.ym-custom-led-on:before { + content: "\e9d9"; +} + +.ym-custom-pine-tree:before { + content: "\ead9"; +} + +.ym-custom-spellcheck:before { + content: "\ebd9"; +} + +.ym-custom-weather-windy-variant:before { + content: "\ecd9"; +} + +.ym-custom-bookmark-remove:before { + content: "\e6da"; +} + +.ym-custom-contrast-box:before { + content: "\e7da"; +} + +.ym-custom-format-bold:before { + content: "\e8da"; +} + +.ym-custom-led-outline:before { + content: "\e9da"; +} + +.ym-custom-pin:before { + content: "\eada"; +} + +.ym-custom-speedometer:before { + content: "\ebda"; +} + +.ym-custom-web:before { + content: "\ecda"; +} + +.ym-custom-book-minus:before { + content: "\e6db"; +} + +.ym-custom-cookie:before { + content: "\e7db"; +} + +.ym-custom-format-clear:before { + content: "\e8db"; +} + +.ym-custom-led-variant-on:before { + content: "\e9db"; +} + +.ym-custom-pin-off:before { + content: "\eadb"; +} + +.ym-custom-spotify:before { + content: "\ebdb"; +} + +.ym-custom-weight:before { + content: "\ecdb"; +} + +.ym-custom-book-multiple:before { + content: "\e6dc"; +} + +.ym-custom-copyright:before { + content: "\e7dc"; +} + +.ym-custom-format-color-fill:before { + content: "\e8dc"; +} + +.ym-custom-led-variant-off:before { + content: "\e9dc"; +} + +.ym-custom-pine-tree-box:before { + content: "\eadc"; +} + +.ym-custom-spotlight:before { + content: "\ebdc"; +} + +.ym-custom-webhook:before { + content: "\ecdc"; +} + +.ym-custom-book-multiple-variant:before { + content: "\e6dd"; +} + +.ym-custom-counter:before { + content: "\e7dd"; +} + +.ym-custom-format-color-text:before { + content: "\e8dd"; +} + +.ym-custom-led-variant-outline:before { + content: "\e9dd"; +} + +.ym-custom-pinterest:before { + content: "\eadd"; +} + +.ym-custom-spotlight-beam:before { + content: "\ebdd"; +} + +.ym-custom-weight-kilogram:before { + content: "\ecdd"; +} + +.ym-custom-book-open:before { + content: "\e6de"; +} + +.ym-custom-creation:before { + content: "\e7de"; +} + +.ym-custom-format-float-center:before { + content: "\e8de"; +} + +.ym-custom-library:before { + content: "\e9de"; +} + +.ym-custom-pinterest-box:before { + content: "\eade"; +} + +.ym-custom-spray:before { + content: "\ebde"; +} + +.ym-custom-whatsapp:before { + content: "\ecde"; +} + +.ym-custom-book-open-page-variant:before { + content: "\e6df"; +} + +.ym-custom-cow:before { + content: "\e7df"; +} + +.ym-custom-format-float-left:before { + content: "\e8df"; +} + +.ym-custom-library-books:before { + content: "\e9df"; +} + +.ym-custom-pistol:before { + content: "\eadf"; +} + +.ym-custom-square-inc:before { + content: "\ebdf"; +} + +.ym-custom-webcam:before { + content: "\ecdf"; +} + +.ym-custom-book-plus:before { + content: "\e6e0"; +} + +.ym-custom-credit-card:before { + content: "\e7e0"; +} + +.ym-custom-format-float-none:before { + content: "\e8e0"; +} + +.ym-custom-library-music:before { + content: "\e9e0"; +} + +.ym-custom-pizza:before { + content: "\eae0"; +} + +.ym-custom-stackexchange:before { + content: "\ebe0"; +} + +.ym-custom-wechat:before { + content: "\ece0"; +} + +.ym-custom-book-open-variant:before { + content: "\e6e1"; +} + +.ym-custom-credit-card-multiple:before { + content: "\e7e1"; +} + +.ym-custom-format-float-right:before { + content: "\e8e1"; +} + +.ym-custom-library-plus:before { + content: "\e9e1"; +} + +.ym-custom-plane-shield:before { + content: "\eae1"; +} + +.ym-custom-square-inc-cash:before { + content: "\ebe1"; +} + +.ym-custom-white-balance-auto:before { + content: "\ece1"; +} + +.ym-custom-book-variant:before { + content: "\e6e2"; +} + +.ym-custom-credit-card-off:before { + content: "\e7e2"; +} + +.ym-custom-format-header-:before { + content: "\e8e2"; +} + +.ym-custom-lightbulb-on-outline:before { + content: "\e9e2"; +} + +.ym-custom-play:before { + content: "\eae2"; +} + +.ym-custom-stackoverflow:before { + content: "\ebe2"; +} + +.ym-custom-white-balance-iridescent:before { + content: "\ece2"; +} + +.ym-custom-boombox:before { + content: "\e6e3"; +} + +.ym-custom-credit-card-plus:before { + content: "\e7e3"; +} + +.ym-custom-format-header-1:before { + content: "\e8e3"; +} + +.ym-custom-lightbulb:before { + content: "\e9e3"; +} + +.ym-custom-play-box-outline:before { + content: "\eae3"; +} + +.ym-custom-stadium:before { + content: "\ebe3"; +} + +.ym-custom-wheelchair-accessibility:before { + content: "\ece3"; +} + +.ym-custom-border-all:before { + content: "\e6e4"; +} + +.ym-custom-crop:before { + content: "\e7e4"; +} + +.ym-custom-format-header-2:before { + content: "\e8e4"; +} + +.ym-custom-lightbulb-on:before { + content: "\e9e4"; +} + +.ym-custom-play-circle:before { + content: "\eae4"; +} + +.ym-custom-stairs:before { + content: "\ebe4"; +} + +.ym-custom-white-balance-incandescent:before { + content: "\ece4"; +} + +.ym-custom-border-bottom:before { + content: "\e6e5"; +} + +.ym-custom-crop-free:before { + content: "\e7e5"; +} + +.ym-custom-format-header-3:before { + content: "\e8e5"; +} + +.ym-custom-lightbulb-outline:before { + content: "\e9e5"; +} + +.ym-custom-play-circle-outline:before { + content: "\eae5"; +} + +.ym-custom-star-circle:before { + content: "\ebe5"; +} + +.ym-custom-widgets:before { + content: "\ece5"; +} + +.ym-custom-border-color:before { + content: "\e6e6"; +} + +.ym-custom-credit-card-scan:before { + content: "\e7e6"; +} + +.ym-custom-format-header-4:before { + content: "\e8e6"; +} + +.ym-custom-link:before { + content: "\e9e6"; +} + +.ym-custom-playlist-check:before { + content: "\eae6"; +} + +.ym-custom-star-half:before { + content: "\ebe6"; +} + +.ym-custom-white-balance-sunny:before { + content: "\ece6"; +} + +.ym-custom-border-horizontal:before { + content: "\e6e7"; +} + +.ym-custom-crop-landscape:before { + content: "\e7e7"; +} + +.ym-custom-format-header-decrease:before { + content: "\e8e7"; +} + +.ym-custom-linkedin:before { + content: "\e9e7"; +} + +.ym-custom-playlist-play:before { + content: "\eae7"; +} + +.ym-custom-star:before { + content: "\ebe7"; +} + +.ym-custom-wiiu:before { + content: "\ece7"; +} + +.ym-custom-border-inside:before { + content: "\e6e8"; +} + +.ym-custom-crop-portrait:before { + content: "\e7e8"; +} + +.ym-custom-format-header-5:before { + content: "\e8e8"; +} + +.ym-custom-link-off:before { + content: "\e9e8"; +} + +.ym-custom-playlist-minus:before { + content: "\eae8"; +} + +.ym-custom-star-off:before { + content: "\ebe8"; +} + +.ym-custom-wifi:before { + content: "\ece8"; +} + +.ym-custom-border-none:before { + content: "\e6e9"; +} + +.ym-custom-crop-rotate:before { + content: "\e7e9"; +} + +.ym-custom-format-header-equal:before { + content: "\e8e9"; +} + +.ym-custom-link-variant-off:before { + content: "\e9e9"; +} + +.ym-custom-playlist-remove:before { + content: "\eae9"; +} + +.ym-custom-star-outline:before { + content: "\ebe9"; +} + +.ym-custom-wifi-off:before { + content: "\ece9"; +} + +.ym-custom-border-left:before { + content: "\e6ea"; +} + +.ym-custom-crop-square:before { + content: "\e7ea"; +} + +.ym-custom-format-header-increase:before { + content: "\e8ea"; +} + +.ym-custom-link-variant:before { + content: "\e9ea"; +} + +.ym-custom-playlist-plus:before { + content: "\eaea"; +} + +.ym-custom-steam:before { + content: "\ebea"; +} + +.ym-custom-wii:before { + content: "\ecea"; +} + +.ym-custom-border-outside:before { + content: "\e6eb"; +} + +.ym-custom-crosshairs:before { + content: "\e7eb"; +} + +.ym-custom-format-header-pound:before { + content: "\e8eb"; +} + +.ym-custom-linkedin-box:before { + content: "\e9eb"; +} + +.ym-custom-play-pause:before { + content: "\eaeb"; +} + +.ym-custom-steering:before { + content: "\ebeb"; +} + +.ym-custom-window-close:before { + content: "\eceb"; +} + +.ym-custom-border-right:before { + content: "\e6ec"; +} + +.ym-custom-crosshairs-gps:before { + content: "\e7ec"; +} + +.ym-custom-format-horizontal-align-center:before { + content: "\e8ec"; +} + +.ym-custom-linux:before { + content: "\e9ec"; +} + +.ym-custom-playstation:before { + content: "\eaec"; +} + +.ym-custom-step-backward:before { + content: "\ebec"; +} + +.ym-custom-wikipedia:before { + content: "\ecec"; +} + +.ym-custom-border-top:before { + content: "\e6ed"; +} + +.ym-custom-cube:before { + content: "\e7ed"; +} + +.ym-custom-format-horizontal-align-left:before { + content: "\e8ed"; +} + +.ym-custom-lock:before { + content: "\e9ed"; +} + +.ym-custom-plex:before { + content: "\eaed"; +} + +.ym-custom-step-forward:before { + content: "\ebed"; +} + +.ym-custom-window-maximize:before { + content: "\eced"; +} + +.ym-custom-border-style:before { + content: "\e6ee"; +} + +.ym-custom-crown:before { + content: "\e7ee"; +} + +.ym-custom-format-indent-increase:before { + content: "\e8ee"; +} + +.ym-custom-lock-outline:before { + content: "\e9ee"; +} + +.ym-custom-plus:before { + content: "\eaee"; +} + +.ym-custom-step-forward-:before { + content: "\ebee"; +} + +.ym-custom-window-open:before { + content: "\ecee"; +} + +.ym-custom-border-vertical:before { + content: "\e6ef"; +} + +.ym-custom-cube-outline:before { + content: "\e7ef"; +} + +.ym-custom-format-indent-decrease:before { + content: "\e8ef"; +} + +.ym-custom-lock-open-outline:before { + content: "\e9ef"; +} + +.ym-custom-plus-box-outline:before { + content: "\eaef"; +} + +.ym-custom-step-backward-:before { + content: "\ebef"; +} + +.ym-custom-window-restore:before { + content: "\ecef"; +} + +.ym-custom-bowl:before { + content: "\e6f0"; +} + +.ym-custom-cube-send:before { + content: "\e7f0"; +} + +.ym-custom-format-line-spacing:before { + content: "\e8f0"; +} + +.ym-custom-lock-open:before { + content: "\e9f0"; +} + +.ym-custom-plus-box:before { + content: "\eaf0"; +} + +.ym-custom-stethoscope:before { + content: "\ebf0"; +} + +.ym-custom-windows:before { + content: "\ecf0"; +} + +.ym-custom-box-shadow:before { + content: "\e6f1"; +} + +.ym-custom-cup:before { + content: "\e7f1"; +} + +.ym-custom-format-italic:before { + content: "\e8f1"; +} + +.ym-custom-lock-pattern:before { + content: "\e9f1"; +} + +.ym-custom-plus-circle:before { + content: "\eaf1"; +} + +.ym-custom-sticker:before { + content: "\ebf1"; +} + +.ym-custom-window-minimize:before { + content: "\ecf1"; +} + +.ym-custom-bow-tie:before { + content: "\e6f2"; +} + +.ym-custom-cube-unfolded:before { + content: "\e7f2"; +} + +.ym-custom-format-line-style:before { + content: "\e8f2"; +} + +.ym-custom-login:before { + content: "\e9f2"; +} + +.ym-custom-plus-circle-multiple-outline:before { + content: "\eaf2"; +} + +.ym-custom-stocking:before { + content: "\ebf2"; +} + +.ym-custom-window-closed:before { + content: "\ecf2"; +} + +.ym-custom-bowling:before { + content: "\e6f3"; +} + +.ym-custom-cup-off:before { + content: "\e7f3"; +} + +.ym-custom-format-horizontal-align-right:before { + content: "\e8f3"; +} + +.ym-custom-lock-plus:before { + content: "\e9f3"; +} + +.ym-custom-plus-network:before { + content: "\eaf3"; +} + +.ym-custom-stop:before { + content: "\ebf3"; +} + +.ym-custom-worker:before { + content: "\ecf3"; +} + +.ym-custom-box-cutter:before { + content: "\e6f4"; +} + +.ym-custom-cup-water:before { + content: "\e7f4"; +} + +.ym-custom-format-line-weight:before { + content: "\e8f4"; +} + +.ym-custom-login-variant:before { + content: "\e9f4"; +} + +.ym-custom-plus-one:before { + content: "\eaf4"; +} + +.ym-custom-stop-circle-outline:before { + content: "\ebf4"; +} + +.ym-custom-wordpress:before { + content: "\ecf4"; +} + +.ym-custom-box:before { + content: "\e6f5"; +} + +.ym-custom-currency-btc:before { + content: "\e7f5"; +} + +.ym-custom-format-list-bulleted:before { + content: "\e8f5"; +} + +.ym-custom-logout:before { + content: "\e9f5"; +} + +.ym-custom-plus-circle-outline:before { + content: "\eaf5"; +} + +.ym-custom-stop-circle:before { + content: "\ebf5"; +} + +.ym-custom-wrench:before { + content: "\ecf5"; +} + +.ym-custom-bridge:before { + content: "\e6f6"; +} + +.ym-custom-currency-gbp:before { + content: "\e7f6"; +} + +.ym-custom-format-list-bulleted-type:before { + content: "\e8f6"; +} + +.ym-custom-logout-variant:before { + content: "\e9f6"; +} + +.ym-custom-pocket:before { + content: "\eaf6"; +} + +.ym-custom-store:before { + content: "\ebf6"; +} + +.ym-custom-wrap:before { + content: "\ecf6"; +} + +.ym-custom-briefcase:before { + content: "\e6f7"; +} + +.ym-custom-currency-eur:before { + content: "\e7f7"; +} + +.ym-custom-format-page-break:before { + content: "\e8f7"; +} + +.ym-custom-looks:before { + content: "\e9f7"; +} + +.ym-custom-plus-outline:before { + content: "\eaf7"; +} + +.ym-custom-store--hour:before { + content: "\ebf7"; +} + +.ym-custom-wunderlist:before { + content: "\ecf7"; +} + +.ym-custom-briefcase-check:before { + content: "\e6f8"; +} + +.ym-custom-currency-inr:before { + content: "\e7f8"; +} + +.ym-custom-format-list-numbers:before { + content: "\e8f8"; +} + +.ym-custom-loop:before { + content: "\e9f8"; +} + +.ym-custom-polaroid:before { + content: "\eaf8"; +} + +.ym-custom-stove:before { + content: "\ebf8"; +} + +.ym-custom-xaml:before { + content: "\ecf8"; +} + +.ym-custom-briefcase-download:before { + content: "\e6f9"; +} + +.ym-custom-currency-ngn:before { + content: "\e7f9"; +} + +.ym-custom-format-paragraph:before { + content: "\e8f9"; +} + +.ym-custom-loupe:before { + content: "\e9f9"; +} + +.ym-custom-poll:before { + content: "\eaf9"; +} + +.ym-custom-subway:before { + content: "\ebf9"; +} + +.ym-custom-xbox:before { + content: "\ecf9"; +} + +.ym-custom-briefcase-upload:before { + content: "\e6fa"; +} + +.ym-custom-currency-rub:before { + content: "\e7fa"; +} + +.ym-custom-format-pilcrow:before { + content: "\e8fa"; +} + +.ym-custom-lumx:before { + content: "\e9fa"; +} + +.ym-custom-pokeball:before { + content: "\eafa"; +} + +.ym-custom-subdirectory-arrow-left:before { + content: "\ebfa"; +} + +.ym-custom-xbox-controller:before { + content: "\ecfa"; +} + +.ym-custom-brightness-:before { + content: "\e6fb"; +} + +.ym-custom-currency-try:before { + content: "\e7fb"; +} + +.ym-custom-format-quote:before { + content: "\e8fb"; +} + +.ym-custom-magnet:before { + content: "\e9fb"; +} + +.ym-custom-poll-box:before { + content: "\eafb"; +} + +.ym-custom-subdirectory-arrow-right:before { + content: "\ebfb"; +} + +.ym-custom-xbox-controller-off:before { + content: "\ecfb"; +} + +.ym-custom-brightness-1:before { + content: "\e6fc"; +} + +.ym-custom-currency-usd:before { + content: "\e7fc"; +} + +.ym-custom-format-paint:before { + content: "\e8fc"; +} + +.ym-custom-magnet-on:before { + content: "\e9fc"; +} + +.ym-custom-polymer:before { + content: "\eafc"; +} + +.ym-custom-subway-variant:before { + content: "\ebfc"; +} + +.ym-custom-xda:before { + content: "\ecfc"; +} + +.ym-custom-brightness-2:before { + content: "\e6fd"; +} + +.ym-custom-currency-usd-off:before { + content: "\e7fd"; +} + +.ym-custom-format-size:before { + content: "\e8fd"; +} + +.ym-custom-magnify:before { + content: "\e9fd"; +} + +.ym-custom-play-protected-content:before { + content: "\eafd"; +} + +.ym-custom-sunglasses:before { + content: "\ebfd"; +} + +.ym-custom-xing:before { + content: "\ecfd"; +} + +.ym-custom-brightness-3:before { + content: "\e6fe"; +} + +.ym-custom-cursor-default:before { + content: "\e7fe"; +} + +.ym-custom-format-section:before { + content: "\e8fe"; +} + +.ym-custom-magnify-plus:before { + content: "\e9fe"; +} + +.ym-custom-pool:before { + content: "\eafe"; +} + +.ym-custom-swap-horizontal:before { + content: "\ebfe"; +} + +.ym-custom-xing-circle:before { + content: "\ecfe"; +} + +.ym-custom-brightness-4:before { + content: "\e6ff"; +} + +.ym-custom-cursor-default-outline:before { + content: "\e7ff"; +} + +.ym-custom-format-strikethrough:before { + content: "\e8ff"; +} + +.ym-custom-magnify-minus:before { + content: "\e9ff"; +} + +.ym-custom-pot:before { + content: "\eaff"; +} + +.ym-custom-surround-sound:before { + content: "\ebff"; +} + +.ym-custom-xing-box:before { + content: "\ecff"; +} + +.ym-custom-brightness-5:before { + content: "\e700"; +} + +.ym-custom-cursor-pointer:before { + content: "\e800"; +} + +.ym-custom-format-strikethrough-variant:before { + content: "\e900"; +} + +.ym-custom-map:before { + content: "\ea00"; +} + +.ym-custom-popcorn:before { + content: "\eb00"; +} + +.ym-custom-swap-vertical:before { + content: "\ec00"; +} + +.ym-custom-xml:before { + content: "\ed00"; +} + +.ym-custom-access-point:before { + content: "\e601"; +} + +.ym-custom-brightness-6:before { + content: "\e701"; +} + +.ym-custom-cursor-move:before { + content: "\e801"; +} + +.ym-custom-format-subscript:before { + content: "\e901"; +} + +.ym-custom-mail-ru:before { + content: "\ea01"; +} + +.ym-custom-pound:before { + content: "\eb01"; +} + +.ym-custom-swim:before { + content: "\ec01"; +} + +.ym-custom-yelp:before { + content: "\ed01"; +} + +.ym-custom-account-box-outline:before { + content: "\e602"; +} + +.ym-custom-broom:before { + content: "\e702"; +} + +.ym-custom-cursor-text:before { + content: "\e802"; +} + +.ym-custom-format-superscript:before { + content: "\e902"; +} + +.ym-custom-map-marker:before { + content: "\ea02"; +} + +.ym-custom-pound-box:before { + content: "\eb02"; +} + +.ym-custom-switch:before { + content: "\ec02"; +} + +.ym-custom-yeast:before { + content: "\ed02"; +} + +.ym-custom-account-box:before { + content: "\e603"; +} + +.ym-custom-brightness-auto:before { + content: "\e703"; +} + +.ym-custom-database:before { + content: "\e803"; +} + +.ym-custom-format-text:before { + content: "\e903"; +} + +.ym-custom-map-marker-minus:before { + content: "\ea03"; +} + +.ym-custom-pot-mix:before { + content: "\eb03"; +} + +.ym-custom-sync:before { + content: "\ec03"; +} + +.ym-custom-yin-yang:before { + content: "\ed03"; +} + +.ym-custom-access-point-network:before { + content: "\e604"; +} + +.ym-custom-brush:before { + content: "\e704"; +} + +.ym-custom-database-minus:before { + content: "\e804"; +} + +.ym-custom-format-textdirection-l-to-r:before { + content: "\e904"; +} + +.ym-custom-map-marker-circle:before { + content: "\ea04"; +} + +.ym-custom-power:before { + content: "\eb04"; +} + +.ym-custom-sync-alert:before { + content: "\ec04"; +} + +.ym-custom-youtube-play:before { + content: "\ed04"; +} + +.ym-custom-account-alert:before { + content: "\e605"; +} + +.ym-custom-bug:before { + content: "\e705"; +} + +.ym-custom-database-plus:before { + content: "\e805"; +} + +.ym-custom-format-textdirection-r-to-l:before { + content: "\e905"; +} + +.ym-custom-map-marker-multiple:before { + content: "\ea05"; +} + +.ym-custom-power-plug:before { + content: "\eb05"; +} + +.ym-custom-tab:before { + content: "\ec05"; +} + +.ym-custom-zip-box:before { + content: "\ed05"; +} + +.ym-custom-account-card-details:before { + content: "\e606"; +} + +.ym-custom-buffer:before { + content: "\e706"; +} + +.ym-custom-debug-step-into:before { + content: "\e806"; +} + +.ym-custom-format-title:before { + content: "\e906"; +} + +.ym-custom-map-marker-off:before { + content: "\ea06"; +} + +.ym-custom-power-settings:before { + content: "\eb06"; +} + +.ym-custom-table:before { + content: "\ec06"; +} + +.ym-custom-account:before { + content: "\e607"; +} + +.ym-custom-bulletin-board:before { + content: "\e707"; +} + +.ym-custom-debug-step-over:before { + content: "\e807"; +} + +.ym-custom-format-vertical-align-bottom:before { + content: "\e907"; +} + +.ym-custom-map-marker-plus:before { + content: "\ea07"; +} + +.ym-custom-power-plug-off:before { + content: "\eb07"; +} + +.ym-custom-table-column-plus-before:before { + content: "\ec07"; +} + +.ym-custom-account-check:before { + content: "\e608"; +} + +.ym-custom-bullhorn:before { + content: "\e708"; +} + +.ym-custom-debug-step-out:before { + content: "\e808"; +} + +.ym-custom-format-underline:before { + content: "\e908"; +} + +.ym-custom-map-marker-radius:before { + content: "\ea08"; +} + +.ym-custom-power-socket:before { + content: "\eb08"; +} + +.ym-custom-table-column-plus-after:before { + content: "\ec08"; +} + +.ym-custom-account-key:before { + content: "\e609"; +} + +.ym-custom-bullseye:before { + content: "\e709"; +} + +.ym-custom-decimal-decrease:before { + content: "\e809"; +} + +.ym-custom-format-vertical-align-center:before { + content: "\e909"; +} + +.ym-custom-markdown:before { + content: "\ea09"; +} + +.ym-custom-prescription:before { + content: "\eb09"; +} + +.ym-custom-table-column-remove:before { + content: "\ec09"; +} + +.ym-custom-account-convert:before { + content: "\e60a"; +} + +.ym-custom-bus:before { + content: "\e70a"; +} + +.ym-custom-delete:before { + content: "\e80a"; +} + +.ym-custom-format-vertical-align-top:before { + content: "\e90a"; +} + +.ym-custom-margin:before { + content: "\ea0a"; +} + +.ym-custom-presentation:before { + content: "\eb0a"; +} + +.ym-custom-table-column-width:before { + content: "\ec0a"; +} + +.ym-custom-account-circle:before { + content: "\e60b"; +} + +.ym-custom-burst-mode:before { + content: "\e70b"; +} + +.ym-custom-decimal-increase:before { + content: "\e80b"; +} + +.ym-custom-format-wrap-inline:before { + content: "\e90b"; +} + +.ym-custom-marker:before { + content: "\ea0b"; +} + +.ym-custom-presentation-play:before { + content: "\eb0b"; +} + +.ym-custom-table-large:before { + content: "\ec0b"; +} + +.ym-custom-account-minus:before { + content: "\e60c"; +} + +.ym-custom-cake:before { + content: "\e70c"; +} + +.ym-custom-delete-circle:before { + content: "\e80c"; +} + +.ym-custom-format-wrap-tight:before { + content: "\e90c"; +} + +.ym-custom-marker-check:before { + content: "\ea0c"; +} + +.ym-custom-printer:before { + content: "\eb0c"; +} + +.ym-custom-table-row-height:before { + content: "\ec0c"; +} + +.ym-custom-account-location:before { + content: "\e60d"; +} + +.ym-custom-cake-layered:before { + content: "\e70d"; +} + +.ym-custom-delete-empty:before { + content: "\e80d"; +} + +.ym-custom-format-wrap-top-bottom:before { + content: "\e90d"; +} + +.ym-custom-material-ui:before { + content: "\ea0d"; +} + +.ym-custom-printer-d:before { + content: "\eb0d"; +} + +.ym-custom-table-edit:before { + content: "\ec0d"; +} + +.ym-custom-account-multiple:before { + content: "\e60e"; +} + +.ym-custom-cached:before { + content: "\e70e"; +} + +.ym-custom-delete-forever:before { + content: "\e80e"; +} + +.ym-custom-format-wrap-square:before { + content: "\e90e"; +} + +.ym-custom-martini:before { + content: "\ea0e"; +} + +.ym-custom-printer-alert:before { + content: "\eb0e"; +} + +.ym-custom-table-row-plus-after:before { + content: "\ec0e"; +} + +.ym-custom-account-multiple-minus:before { + content: "\e60f"; +} + +.ym-custom-calculator:before { + content: "\e70f"; +} + +.ym-custom-delete-sweep:before { + content: "\e80f"; +} + +.ym-custom-forum:before { + content: "\e90f"; +} + +.ym-custom-math-compass:before { + content: "\ea0f"; +} + +.ym-custom-printer-settings:before { + content: "\eb0f"; +} + +.ym-custom-sword:before { + content: "\ec0f"; +} + +.ym-custom-account-multiple-plus:before { + content: "\e610"; +} + +.ym-custom-cake-variant:before { + content: "\e710"; +} + +.ym-custom-delete-variant:before { + content: "\e810"; +} + +.ym-custom-forward:before { + content: "\e910"; +} + +.ym-custom-matrix:before { + content: "\ea10"; +} + +.ym-custom-priority-high:before { + content: "\eb10"; +} + +.ym-custom-sync-off:before { + content: "\ec10"; +} + +.ym-custom-account-multiple-outline:before { + content: "\e611"; +} + +.ym-custom-calendar:before { + content: "\e711"; +} + +.ym-custom-delta:before { + content: "\e811"; +} + +.ym-custom-foursquare:before { + content: "\e911"; +} + +.ym-custom-maxcdn:before { + content: "\ea11"; +} + +.ym-custom-priority-low:before { + content: "\eb11"; +} + +.ym-custom-table-row-plus-before:before { + content: "\ec11"; +} + +.ym-custom-account-plus:before { + content: "\e612"; +} + +.ym-custom-calendar-blank:before { + content: "\e712"; +} + +.ym-custom-deskphone:before { + content: "\e812"; +} + +.ym-custom-fridge:before { + content: "\e912"; +} + +.ym-custom-medical-bag:before { + content: "\ea12"; +} + +.ym-custom-professional-hexagon:before { + content: "\eb12"; +} + +.ym-custom-tablet:before { + content: "\ec12"; +} + +.ym-custom-account-network:before { + content: "\e613"; +} + +.ym-custom-calendar-check:before { + content: "\e713"; +} + +.ym-custom-desktop-mac:before { + content: "\e813"; +} + +.ym-custom-fridge-filled:before { + content: "\e913"; +} + +.ym-custom-medium:before { + content: "\ea13"; +} + +.ym-custom-projector-screen:before { + content: "\eb13"; +} + +.ym-custom-table-row-remove:before { + content: "\ec13"; +} + +.ym-custom-account-off:before { + content: "\e614"; +} + +.ym-custom-calendar-clock:before { + content: "\e714"; +} + +.ym-custom-deviantart:before { + content: "\e814"; +} + +.ym-custom-fridge-filled-bottom:before { + content: "\e914"; +} + +.ym-custom-memory:before { + content: "\ea14"; +} + +.ym-custom-projector:before { + content: "\eb14"; +} + +.ym-custom-tablet-android:before { + content: "\ec14"; +} + +.ym-custom-account-outline:before { + content: "\e615"; +} + +.ym-custom-calendar-plus:before { + content: "\e715"; +} + +.ym-custom-desktop-tower:before { + content: "\e815"; +} + +.ym-custom-fridge-filled-top:before { + content: "\e915"; +} + +.ym-custom-menu:before { + content: "\ea15"; +} + +.ym-custom-publish:before { + content: "\eb15"; +} + +.ym-custom-tablet-ipad:before { + content: "\ec15"; +} + +.ym-custom-account-remove:before { + content: "\e616"; +} + +.ym-custom-calendar-multiple:before { + content: "\e716"; +} + +.ym-custom-details:before { + content: "\e816"; +} + +.ym-custom-fullscreen:before { + content: "\e916"; +} + +.ym-custom-menu-down:before { + content: "\ea16"; +} + +.ym-custom-pulse:before { + content: "\eb16"; +} + +.ym-custom-tab-unselected:before { + content: "\ec16"; +} + +.ym-custom-account-star:before { + content: "\e617"; +} + +.ym-custom-calendar-multiple-check:before { + content: "\e717"; +} + +.ym-custom-developer-board:before { + content: "\e817"; +} + +.ym-custom-fullscreen-exit:before { + content: "\e917"; +} + +.ym-custom-menu-down-outline:before { + content: "\ea17"; +} + +.ym-custom-puzzle:before { + content: "\eb17"; +} + +.ym-custom-tag-heart:before { + content: "\ec17"; +} + +.ym-custom-account-settings:before { + content: "\e618"; +} + +.ym-custom-calendar-range:before { + content: "\e718"; +} + +.ym-custom-dialpad:before { + content: "\e818"; +} + +.ym-custom-gamepad:before { + content: "\e918"; +} + +.ym-custom-menu-left:before { + content: "\ea18"; +} + +.ym-custom-qrcode:before { + content: "\eb18"; +} + +.ym-custom-tag:before { + content: "\ec18"; +} + +.ym-custom-account-settings-variant:before { + content: "\e619"; +} + +.ym-custom-calendar-question:before { + content: "\e719"; +} + +.ym-custom-dice-:before { + content: "\e819"; +} + +.ym-custom-function:before { + content: "\e919"; +} + +.ym-custom-menu-right:before { + content: "\ea19"; +} + +.ym-custom-qrcode-scan:before { + content: "\eb19"; +} + +.ym-custom-tag-faces:before { + content: "\ec19"; +} + +.ym-custom-account-search:before { + content: "\e61a"; +} + +.ym-custom-calendar-remove:before { + content: "\e71a"; +} + +.ym-custom-diamond:before { + content: "\e81a"; +} + +.ym-custom-garage:before { + content: "\e91a"; +} + +.ym-custom-menu-up:before { + content: "\ea1a"; +} + +.ym-custom-qqchat:before { + content: "\eb1a"; +} + +.ym-custom-tag-multiple:before { + content: "\ec1a"; +} + +.ym-custom-account-star-variant:before { + content: "\e61b"; +} + +.ym-custom-calendar-today:before { + content: "\e71b"; +} + +.ym-custom-dice-1:before { + content: "\e81b"; +} + +.ym-custom-gamepad-variant:before { + content: "\e91b"; +} + +.ym-custom-message:before { + content: "\ea1b"; +} + +.ym-custom-quadcopter:before { + content: "\eb1b"; +} + +.ym-custom-tag-outline:before { + content: "\ec1b"; +} + +.ym-custom-account-switch:before { + content: "\e61c"; +} + +.ym-custom-call-merge:before { + content: "\e71c"; +} + +.ym-custom-dice-2:before { + content: "\e81c"; +} + +.ym-custom-garage-open:before { + content: "\e91c"; +} + +.ym-custom-message-bulleted:before { + content: "\ea1c"; +} + +.ym-custom-quality-high:before { + content: "\eb1c"; +} + +.ym-custom-tag-text-outline:before { + content: "\ec1c"; +} + +.ym-custom-adjust:before { + content: "\e61d"; +} + +.ym-custom-call-made:before { + content: "\e71d"; +} + +.ym-custom-dice-d:before { + content: "\e81d"; +} + +.ym-custom-gas-cylinder:before { + content: "\e91d"; +} + +.ym-custom-menu-up-outline:before { + content: "\ea1d"; +} + +.ym-custom-quicktime:before { + content: "\eb1d"; +} + +.ym-custom-target:before { + content: "\ec1d"; +} + +.ym-custom-air-conditioner:before { + content: "\e61e"; +} + +.ym-custom-calendar-text:before { + content: "\e71e"; +} + +.ym-custom-dice-3:before { + content: "\e81e"; +} + +.ym-custom-gas-station:before { + content: "\e91e"; +} + +.ym-custom-message-alert:before { + content: "\ea1e"; +} + +.ym-custom-radar:before { + content: "\eb1e"; +} + +.ym-custom-teamviewer:before { + content: "\ec1e"; +} + +.ym-custom-airballoon:before { + content: "\e61f"; +} + +.ym-custom-call-missed:before { + content: "\e71f"; +} + +.ym-custom-dice-d1:before { + content: "\e81f"; +} + +.ym-custom-gate:before { + content: "\e91f"; +} + +.ym-custom-message-bulleted-off:before { + content: "\ea1f"; +} + +.ym-custom-radio:before { + content: "\eb1f"; +} + +.ym-custom-taxi:before { + content: "\ec1f"; +} + +.ym-custom-airplane-landing:before { + content: "\e620"; +} + +.ym-custom-call-received:before { + content: "\e720"; +} + +.ym-custom-dice-d2:before { + content: "\e820"; +} + +.ym-custom-gauge:before { + content: "\e920"; +} + +.ym-custom-message-draw:before { + content: "\ea20"; +} + +.ym-custom-radiator:before { + content: "\eb20"; +} + +.ym-custom-telegram:before { + content: "\ec20"; +} + +.ym-custom-airplane-off:before { + content: "\e621"; +} + +.ym-custom-call-split:before { + content: "\e721"; +} + +.ym-custom-dice-4:before { + content: "\e821"; +} + +.ym-custom-gavel:before { + content: "\e921"; +} + +.ym-custom-message-image:before { + content: "\ea21"; +} + +.ym-custom-radioactive:before { + content: "\eb21"; +} + +.ym-custom-television:before { + content: "\ec21"; +} + +.ym-custom-airplay:before { + content: "\e622"; +} + +.ym-custom-camcorder-box:before { + content: "\e722"; +} + +.ym-custom-dice-d3:before { + content: "\e822"; +} + +.ym-custom-gender-female:before { + content: "\e922"; +} + +.ym-custom-message-outline:before { + content: "\ea22"; +} + +.ym-custom-radiobox-marked:before { + content: "\eb22"; +} + +.ym-custom-television-guide:before { + content: "\ec22"; +} + +.ym-custom-airplane-takeoff:before { + content: "\e623"; +} + +.ym-custom-camcorder:before { + content: "\e723"; +} + +.ym-custom-dictionary:before { + content: "\e823"; +} + +.ym-custom-gender-male:before { + content: "\e923"; +} + +.ym-custom-message-processing:before { + content: "\ea23"; +} + +.ym-custom-radiobox-blank:before { + content: "\eb23"; +} + +.ym-custom-temperature-celsius:before { + content: "\ec23"; +} + +.ym-custom-airplane:before { + content: "\e624"; +} + +.ym-custom-camcorder-box-off:before { + content: "\e724"; +} + +.ym-custom-dice-5:before { + content: "\e824"; +} + +.ym-custom-gender-male-female:before { + content: "\e924"; +} + +.ym-custom-message-reply:before { + content: "\ea24"; +} + +.ym-custom-radio-handheld:before { + content: "\eb24"; +} + +.ym-custom-temperature-kelvin:before { + content: "\ec24"; +} + +.ym-custom-alarm:before { + content: "\e625"; +} + +.ym-custom-camcorder-off:before { + content: "\e725"; +} + +.ym-custom-directions-fork:before { + content: "\e825"; +} + +.ym-custom-gender-transgender:before { + content: "\e925"; +} + +.ym-custom-message-plus:before { + content: "\ea25"; +} + +.ym-custom-radio-tower:before { + content: "\eb25"; +} + +.ym-custom-temperature-fahrenheit:before { + content: "\ec25"; +} + +.ym-custom-alarm-check:before { + content: "\e626"; +} + +.ym-custom-camera:before { + content: "\e726"; +} + +.ym-custom-directions:before { + content: "\e826"; +} + +.ym-custom-ghost:before { + content: "\e926"; +} + +.ym-custom-message-reply-text:before { + content: "\ea26"; +} + +.ym-custom-raspberrypi:before { + content: "\eb26"; +} + +.ym-custom-tennis:before { + content: "\ec26"; +} + +.ym-custom-alarm-multiple:before { + content: "\e627"; +} + +.ym-custom-camera-enhance:before { + content: "\e727"; +} + +.ym-custom-discord:before { + content: "\e827"; +} + +.ym-custom-git:before { + content: "\e927"; +} + +.ym-custom-message-text:before { + content: "\ea27"; +} + +.ym-custom-ray-end:before { + content: "\eb27"; +} + +.ym-custom-tent:before { + content: "\ec27"; +} + +.ym-custom-alarm-snooze:before { + content: "\e628"; +} + +.ym-custom-camera-burst:before { + content: "\e728"; +} + +.ym-custom-disk:before { + content: "\e828"; +} + +.ym-custom-gift:before { + content: "\e928"; +} + +.ym-custom-message-text-outline:before { + content: "\ea28"; +} + +.ym-custom-ray-end-arrow:before { + content: "\eb28"; +} + +.ym-custom-terrain:before { + content: "\ec28"; +} + +.ym-custom-alarm-off:before { + content: "\e629"; +} + +.ym-custom-camera-front:before { + content: "\e729"; +} + +.ym-custom-disk-alert:before { + content: "\e829"; +} + +.ym-custom-github-box:before { + content: "\e929"; +} + +.ym-custom-message-video:before { + content: "\ea29"; +} + +.ym-custom-ray-start:before { + content: "\eb29"; +} + +.ym-custom-test-tube:before { + content: "\ec29"; +} + +.ym-custom-alarm-plus:before { + content: "\e62a"; +} + +.ym-custom-camera-front-variant:before { + content: "\e72a"; +} + +.ym-custom-disqus:before { + content: "\e82a"; +} + +.ym-custom-github-circle:before { + content: "\e92a"; +} + +.ym-custom-meteor:before { + content: "\ea2a"; +} + +.ym-custom-ray-start-arrow:before { + content: "\eb2a"; +} + +.ym-custom-text-shadow:before { + content: "\ec2a"; +} + +.ym-custom-alert:before { + content: "\e62b"; +} + +.ym-custom-camera-iris:before { + content: "\e72b"; +} + +.ym-custom-disqus-outline:before { + content: "\e82b"; +} + +.ym-custom-glass-stange:before { + content: "\e92b"; +} + +.ym-custom-microphone:before { + content: "\ea2b"; +} + +.ym-custom-ray-start-end:before { + content: "\eb2b"; +} + +.ym-custom-textbox:before { + content: "\ec2b"; +} + +.ym-custom-alert-box:before { + content: "\e62c"; +} + +.ym-custom-camera-off:before { + content: "\e72c"; +} + +.ym-custom-division-box:before { + content: "\e82c"; +} + +.ym-custom-glassdoor:before { + content: "\e92c"; +} + +.ym-custom-microphone-off:before { + content: "\ea2c"; +} + +.ym-custom-ray-vertex:before { + content: "\eb2c"; +} + +.ym-custom-text-to-speech:before { + content: "\ec2c"; +} + +.ym-custom-alert-circle:before { + content: "\e62d"; +} + +.ym-custom-camera-party-mode:before { + content: "\e72d"; +} + +.ym-custom-division:before { + content: "\e82d"; +} + +.ym-custom-glasses:before { + content: "\e92d"; +} + +.ym-custom-microphone-outline:before { + content: "\ea2d"; +} + +.ym-custom-rdio:before { + content: "\eb2d"; +} + +.ym-custom-text-to-speech-off:before { + content: "\ec2d"; +} + +.ym-custom-alert-circle-outline:before { + content: "\e62e"; +} + +.ym-custom-camera-rear:before { + content: "\e72e"; +} + +.ym-custom-dna:before { + content: "\e82e"; +} + +.ym-custom-glass-mug:before { + content: "\e92e"; +} + +.ym-custom-microphone-settings:before { + content: "\ea2e"; +} + +.ym-custom-readability:before { + content: "\eb2e"; +} + +.ym-custom-texture:before { + content: "\ec2e"; +} + +.ym-custom-alert-octagon:before { + content: "\e62f"; +} + +.ym-custom-camera-rear-variant:before { + content: "\e72f"; +} + +.ym-custom-dns:before { + content: "\e82f"; +} + +.ym-custom-glass-flute:before { + content: "\e92f"; +} + +.ym-custom-microphone-variant:before { + content: "\ea2f"; +} + +.ym-custom-receipt:before { + content: "\eb2f"; +} + +.ym-custom-theater:before { + content: "\ec2f"; +} + +.ym-custom-all-inclusive:before { + content: "\e630"; +} + +.ym-custom-camera-switch:before { + content: "\e730"; +} + +.ym-custom-dolby:before { + content: "\e830"; +} + +.ym-custom-glass-tulip:before { + content: "\e930"; +} + +.ym-custom-microphone-variant-off:before { + content: "\ea30"; +} + +.ym-custom-read:before { + content: "\eb30"; +} + +.ym-custom-theme-light-dark:before { + content: "\ec30"; +} + +.ym-custom-alert-outline:before { + content: "\e631"; +} + +.ym-custom-camera-timer:before { + content: "\e731"; +} + +.ym-custom-do-not-disturb-off:before { + content: "\e831"; +} + +.ym-custom-gnome:before { + content: "\e931"; +} + +.ym-custom-microscope:before { + content: "\ea31"; +} + +.ym-custom-recycle:before { + content: "\eb31"; +} + +.ym-custom-thermometer-lines:before { + content: "\ec31"; +} + +.ym-custom-alpha:before { + content: "\e632"; +} + +.ym-custom-candle:before { + content: "\e732"; +} + +.ym-custom-do-not-disturb:before { + content: "\e832"; +} + +.ym-custom-google:before { + content: "\e932"; +} + +.ym-custom-minecraft:before { + content: "\ea32"; +} + +.ym-custom-record:before { + content: "\eb32"; +} + +.ym-custom-thumb-down:before { + content: "\ec32"; +} + +.ym-custom-alphabetical:before { + content: "\e633"; +} + +.ym-custom-candycane:before { + content: "\e733"; +} + +.ym-custom-domain:before { + content: "\e833"; +} + +.ym-custom-gondola:before { + content: "\e933"; +} + +.ym-custom-microsoft:before { + content: "\ea33"; +} + +.ym-custom-record-rec:before { + content: "\eb33"; +} + +.ym-custom-thermometer:before { + content: "\ec33"; +} + +.ym-custom-altimeter:before { + content: "\e634"; +} + +.ym-custom-car:before { + content: "\e734"; +} + +.ym-custom-dots-horizontal:before { + content: "\e834"; +} + +.ym-custom-google-cardboard:before { + content: "\e934"; +} + +.ym-custom-minus:before { + content: "\ea34"; +} + +.ym-custom-redo:before { + content: "\eb34"; +} + +.ym-custom-thumbs-up-down:before { + content: "\ec34"; +} + +.ym-custom-amazon:before { + content: "\e635"; +} + +.ym-custom-car-battery:before { + content: "\e735"; +} + +.ym-custom-dots-vertical:before { + content: "\e835"; +} + +.ym-custom-gmail:before { + content: "\e935"; +} + +.ym-custom-minus-box:before { + content: "\ea35"; +} + +.ym-custom-redo-variant:before { + content: "\eb35"; +} + +.ym-custom-thumb-down-outline:before { + content: "\ec35"; +} + +.ym-custom-amazon-clouddrive:before { + content: "\e636"; +} + +.ym-custom-car-connected:before { + content: "\e736"; +} + +.ym-custom-douban:before { + content: "\e836"; +} + +.ym-custom-google-chrome:before { + content: "\e936"; +} + +.ym-custom-minus-circle:before { + content: "\ea36"; +} + +.ym-custom-reddit:before { + content: "\eb36"; +} + +.ym-custom-thumb-up:before { + content: "\ec36"; +} + +.ym-custom-amplifier:before { + content: "\e637"; +} + +.ym-custom-cards:before { + content: "\e737"; +} + +.ym-custom-drag:before { + content: "\e837"; +} + +.ym-custom-google-circles-communities:before { + content: "\e937"; +} + +.ym-custom-minus-circle-outline:before { + content: "\ea37"; +} + +.ym-custom-refresh:before { + content: "\eb37"; +} + +.ym-custom-thumb-up-outline:before { + content: "\ec37"; +} + +.ym-custom-ambulance:before { + content: "\e638"; +} + +.ym-custom-cards-outline:before { + content: "\e738"; +} + +.ym-custom-download:before { + content: "\e838"; +} + +.ym-custom-google-circles:before { + content: "\e938"; +} + +.ym-custom-minus-network:before { + content: "\ea38"; +} + +.ym-custom-regex:before { + content: "\eb38"; +} + +.ym-custom-ticket:before { + content: "\ec38"; +} + +.ym-custom-android-debug-bridge:before { + content: "\e639"; +} + +.ym-custom-cards-variant:before { + content: "\e739"; +} + +.ym-custom-drag-horizontal:before { + content: "\e839"; +} + +.ym-custom-google-circles-group:before { + content: "\e939"; +} + +.ym-custom-mixcloud:before { + content: "\ea39"; +} + +.ym-custom-relative-scale:before { + content: "\eb39"; +} + +.ym-custom-ticket-account:before { + content: "\ec39"; +} + +.ym-custom-anchor:before { + content: "\e63a"; +} + +.ym-custom-cards-playing-outline:before { + content: "\e73a"; +} + +.ym-custom-drag-vertical:before { + content: "\e83a"; +} + +.ym-custom-google-circles-extended:before { + content: "\e93a"; +} + +.ym-custom-monitor:before { + content: "\ea3a"; +} + +.ym-custom-reload:before { + content: "\eb3a"; +} + +.ym-custom-ticket-confirmation:before { + content: "\ec3a"; +} + +.ym-custom-android:before { + content: "\e63b"; +} + +.ym-custom-cart:before { + content: "\e73b"; +} + +.ym-custom-drawing:before { + content: "\e83b"; +} + +.ym-custom-google-controller:before { + content: "\e93b"; +} + +.ym-custom-monitor-multiple:before { + content: "\ea3b"; +} + +.ym-custom-remote:before { + content: "\eb3b"; +} + +.ym-custom-ticket-percent:before { + content: "\ec3b"; +} + +.ym-custom-angular:before { + content: "\e63c"; +} + +.ym-custom-carrot:before { + content: "\e73c"; +} + +.ym-custom-drawing-box:before { + content: "\e83c"; +} + +.ym-custom-google-drive:before { + content: "\e93c"; +} + +.ym-custom-motorbike:before { + content: "\ea3c"; +} + +.ym-custom-reorder-horizontal:before { + content: "\eb3c"; +} + +.ym-custom-tie:before { + content: "\ec3c"; +} + +.ym-custom-apple-ios:before { + content: "\e63d"; +} + +.ym-custom-cart-off:before { + content: "\e73d"; +} + +.ym-custom-drone:before { + content: "\e83d"; +} + +.ym-custom-google-controller-off:before { + content: "\e93d"; +} + +.ym-custom-more:before { + content: "\ea3d"; +} + +.ym-custom-rename-box:before { + content: "\eb3d"; +} + +.ym-custom-tilde:before { + content: "\ec3d"; +} + +.ym-custom-apple-finder:before { + content: "\e63e"; +} + +.ym-custom-cart-outline:before { + content: "\e73e"; +} + +.ym-custom-dribbble:before { + content: "\e83e"; +} + +.ym-custom-google-earth:before { + content: "\e93e"; +} + +.ym-custom-mouse:before { + content: "\ea3e"; +} + +.ym-custom-reorder-vertical:before { + content: "\eb3e"; +} + +.ym-custom-timelapse:before { + content: "\ec3e"; +} + +.ym-custom-animation:before { + content: "\e63f"; +} + +.ym-custom-cart-plus:before { + content: "\e73f"; +} + +.ym-custom-dribbble-box:before { + content: "\e83f"; +} + +.ym-custom-google-glass:before { + content: "\e93f"; +} + +.ym-custom-mouse-variant:before { + content: "\ea3f"; +} + +.ym-custom-repeat:before { + content: "\eb3f"; +} + +.ym-custom-timer-:before { + content: "\ec3f"; +} + +.ym-custom-android-studio:before { + content: "\e640"; +} + +.ym-custom-car-wash:before { + content: "\e740"; +} + +.ym-custom-dropbox:before { + content: "\e840"; +} + +.ym-custom-google-keep:before { + content: "\e940"; +} + +.ym-custom-mouse-off:before { + content: "\ea40"; +} + +.ym-custom-repeat-off:before { + content: "\eb40"; +} + +.ym-custom-timer:before { + content: "\ec40"; +} + +.ym-custom-apple:before { + content: "\e641"; +} + +.ym-custom-case-sensitive-alt:before { + content: "\e741"; +} + +.ym-custom-drupal:before { + content: "\e841"; +} + +.ym-custom-google-maps:before { + content: "\e941"; +} + +.ym-custom-mouse-variant-off:before { + content: "\ea41"; +} + +.ym-custom-reply:before { + content: "\eb41"; +} + +.ym-custom-timer-1:before { + content: "\ec41"; +} + +.ym-custom-apple-keyboard-caps:before { + content: "\e642"; +} + +.ym-custom-cash:before { + content: "\e742"; +} + +.ym-custom-duck:before { + content: "\e842"; +} + +.ym-custom-google-nearby:before { + content: "\e942"; +} + +.ym-custom-move-resize:before { + content: "\ea42"; +} + +.ym-custom-repeat-once:before { + content: "\eb42"; +} + +.ym-custom-timer-off:before { + content: "\ec42"; +} + +.ym-custom-apple-keyboard-command:before { + content: "\e643"; +} + +.ym-custom-cash-multiple:before { + content: "\e743"; +} + +.ym-custom-dumbbell:before { + content: "\e843"; +} + +.ym-custom-google-pages:before { + content: "\e943"; +} + +.ym-custom-move-resize-variant:before { + content: "\ea43"; +} + +.ym-custom-replay:before { + content: "\eb43"; +} + +.ym-custom-timer-sand:before { + content: "\ec43"; +} + +.ym-custom-apple-keyboard-control:before { + content: "\e644"; +} + +.ym-custom-cash-:before { + content: "\e744"; +} + +.ym-custom-earth-box:before { + content: "\e844"; +} + +.ym-custom-google-photos:before { + content: "\e944"; +} + +.ym-custom-movie:before { + content: "\ea44"; +} + +.ym-custom-reply-all:before { + content: "\eb44"; +} + +.ym-custom-timer-sand-empty:before { + content: "\ec44"; +} + +.ym-custom-apple-keyboard-shift:before { + content: "\e645"; +} + +.ym-custom-cash-usd:before { + content: "\e745"; +} + +.ym-custom-earth:before { + content: "\e845"; +} + +.ym-custom-google-physical-web:before { + content: "\e945"; +} + +.ym-custom-multiplication:before { + content: "\ea45"; +} + +.ym-custom-reproduction:before { + content: "\eb45"; +} + +.ym-custom-toggle-switch:before { + content: "\ec45"; +} + +.ym-custom-apple-keyboard-option:before { + content: "\e646"; +} + +.ym-custom-cast-connected:before { + content: "\e746"; +} + +.ym-custom-earth-box-off:before { + content: "\e846"; +} + +.ym-custom-google-play:before { + content: "\e946"; +} + +.ym-custom-music-box-outline:before { + content: "\ea46"; +} + +.ym-custom-rewind:before { + content: "\eb46"; +} + +.ym-custom-timetable:before { + content: "\ec46"; +} + +.ym-custom-apple-mobileme:before { + content: "\e647"; +} + +.ym-custom-cast:before { + content: "\e747"; +} + +.ym-custom-edge:before { + content: "\e847"; +} + +.ym-custom-google-plus:before { + content: "\e947"; +} + +.ym-custom-multiplication-box:before { + content: "\ea47"; +} + +.ym-custom-resize-bottom-right:before { + content: "\eb47"; +} + +.ym-custom-toggle-switch-off:before { + content: "\ec47"; +} + +.ym-custom-apple-safari:before { + content: "\e648"; +} + +.ym-custom-cellphone:before { + content: "\e748"; +} + +.ym-custom-elevation-decline:before { + content: "\e848"; +} + +.ym-custom-google-translate:before { + content: "\e948"; +} + +.ym-custom-music-box:before { + content: "\ea48"; +} + +.ym-custom-responsive:before { + content: "\eb48"; +} + +.ym-custom-tooltip:before { + content: "\ec48"; +} + +.ym-custom-appnet:before { + content: "\e649"; +} + +.ym-custom-castle:before { + content: "\e749"; +} + +.ym-custom-eject:before { + content: "\e849"; +} + +.ym-custom-google-plus-box:before { + content: "\e949"; +} + +.ym-custom-music-circle:before { + content: "\ea49"; +} + +.ym-custom-restore:before { + content: "\eb49"; +} + +.ym-custom-tooltip-edit:before { + content: "\ec49"; +} + +.ym-custom-application:before { + content: "\e64a"; +} + +.ym-custom-cat:before { + content: "\e74a"; +} + +.ym-custom-earth-off:before { + content: "\e84a"; +} + +.ym-custom-google-wallet:before { + content: "\e94a"; +} + +.ym-custom-music-note:before { + content: "\ea4a"; +} + +.ym-custom-rewind-outline:before { + content: "\eb4a"; +} + +.ym-custom-tooltip-image:before { + content: "\ec4a"; +} + +.ym-custom-apps:before { + content: "\e64b"; +} + +.ym-custom-cellphone-android:before { + content: "\e74b"; +} + +.ym-custom-elevator:before { + content: "\e84b"; +} + +.ym-custom-gradient:before { + content: "\e94b"; +} + +.ym-custom-music-note-bluetooth:before { + content: "\ea4b"; +} + +.ym-custom-rhombus:before { + content: "\eb4b"; +} + +.ym-custom-tooltip-outline:before { + content: "\ec4b"; +} + +.ym-custom-arrange-send-to-back:before { + content: "\e64c"; +} + +.ym-custom-cellphone-dock:before { + content: "\e74c"; +} + +.ym-custom-elevation-rise:before { + content: "\e84c"; +} + +.ym-custom-grease-pencil:before { + content: "\e94c"; +} + +.ym-custom-music-note-bluetooth-off:before { + content: "\ea4c"; +} + +.ym-custom-road:before { + content: "\eb4c"; +} + +.ym-custom-tooltip-outline-plus:before { + content: "\ec4c"; +} + +.ym-custom-arrange-send-backward:before { + content: "\e64d"; +} + +.ym-custom-cellphone-iphone:before { + content: "\e74d"; +} + +.ym-custom-email:before { + content: "\e84d"; +} + +.ym-custom-grid:before { + content: "\e94d"; +} + +.ym-custom-music-note-half:before { + content: "\ea4d"; +} + +.ym-custom-ribbon:before { + content: "\eb4d"; +} + +.ym-custom-tooltip-text:before { + content: "\ec4d"; +} + +.ym-custom-arrange-bring-forward:before { + content: "\e64e"; +} + +.ym-custom-cellphone-basic:before { + content: "\e74e"; +} + +.ym-custom-email-open:before { + content: "\e84e"; +} + +.ym-custom-guitar-electric:before { + content: "\e94e"; +} + +.ym-custom-music-note-eighth:before { + content: "\ea4e"; +} + +.ym-custom-road-variant:before { + content: "\eb4e"; +} + +.ym-custom-tooth:before { + content: "\ec4e"; +} + +.ym-custom-archive:before { + content: "\e64f"; +} + +.ym-custom-cellphone-link:before { + content: "\e74f"; +} + +.ym-custom-email-outline:before { + content: "\e84f"; +} + +.ym-custom-grid-off:before { + content: "\e94f"; +} + +.ym-custom-music-note-off:before { + content: "\ea4f"; +} + +.ym-custom-rhombus-outline:before { + content: "\eb4f"; +} + +.ym-custom-tor:before { + content: "\ec4f"; +} + +.ym-custom-arrange-bring-to-front:before { + content: "\e650"; +} + +.ym-custom-cellphone-link-off:before { + content: "\e750"; +} + +.ym-custom-email-open-outline:before { + content: "\e850"; +} + +.ym-custom-guitar-pick:before { + content: "\e950"; +} + +.ym-custom-music-note-quarter:before { + content: "\ea50"; +} + +.ym-custom-robot:before { + content: "\eb50"; +} + +.ym-custom-tower-beach:before { + content: "\ec50"; +} + +.ym-custom-arrow-all:before { + content: "\e651"; +} + +.ym-custom-cellphone-settings:before { + content: "\e751"; +} + +.ym-custom-email-variant:before { + content: "\e851"; +} + +.ym-custom-group:before { + content: "\e951"; +} + +.ym-custom-music-note-sixteenth:before { + content: "\ea51"; +} + +.ym-custom-rocket:before { + content: "\eb51"; +} + +.ym-custom-train:before { + content: "\ec51"; +} + +.ym-custom-arrow-bottom-right:before { + content: "\e652"; +} + +.ym-custom-certificate:before { + content: "\e752"; +} + +.ym-custom-email-secure:before { + content: "\e852"; +} + +.ym-custom-guitar-pick-outline:before { + content: "\e952"; +} + +.ym-custom-music-note-whole:before { + content: "\ea52"; +} + +.ym-custom-roomba:before { + content: "\eb52"; +} + +.ym-custom-tower-fire:before { + content: "\ec52"; +} + +.ym-custom-arrow-bottom-left:before { + content: "\e653"; +} + +.ym-custom-chair-school:before { + content: "\e753"; +} + +.ym-custom-emoticon:before { + content: "\e853"; +} + +.ym-custom-hackernews:before { + content: "\e953"; +} + +.ym-custom-nature:before { + content: "\ea53"; +} + +.ym-custom-rotate-d:before { + content: "\eb53"; +} + +.ym-custom-traffic-light:before { + content: "\ec53"; +} + +.ym-custom-arrow-compress:before { + content: "\e654"; +} + +.ym-custom-chart-arc:before { + content: "\e754"; +} + +.ym-custom-emby:before { + content: "\e854"; +} + +.ym-custom-hand-pointing-right:before { + content: "\e954"; +} + +.ym-custom-nature-people:before { + content: "\ea54"; +} + +.ym-custom-rotate-left:before { + content: "\eb54"; +} + +.ym-custom-transfer:before { + content: "\ec54"; +} + +.ym-custom-arrow-compress-all:before { + content: "\e655"; +} + +.ym-custom-chart-areaspline:before { + content: "\e755"; +} + +.ym-custom-emoticon-dead:before { + content: "\e855"; +} + +.ym-custom-hamburger:before { + content: "\e955"; +} + +.ym-custom-needle:before { + content: "\ea55"; +} + +.ym-custom-rotate-:before { + content: "\eb55"; +} + +.ym-custom-transcribe-close:before { + content: "\ec55"; +} + +.ym-custom-arrow-down:before { + content: "\e656"; +} + +.ym-custom-chart-bar:before { + content: "\e756"; +} + +.ym-custom-emoticon-cool:before { + content: "\e856"; +} + +.ym-custom-hangouts:before { + content: "\e956"; +} + +.ym-custom-navigation:before { + content: "\ea56"; +} + +.ym-custom-rotate-right:before { + content: "\eb56"; +} + +.ym-custom-transcribe:before { + content: "\ec56"; +} + +.ym-custom-arrow-down-bold:before { + content: "\e657"; +} + +.ym-custom-chart-bubble:before { + content: "\e757"; +} + +.ym-custom-emoticon-devil:before { + content: "\e857"; +} + +.ym-custom-harddisk:before { + content: "\e957"; +} + +.ym-custom-near-me:before { + content: "\ea57"; +} + +.ym-custom-rotate-left-variant:before { + content: "\eb57"; +} + +.ym-custom-translate:before { + content: "\ec57"; +} + +.ym-custom-arrow-down-bold-circle-outline:before { + content: "\e658"; +} + +.ym-custom-chart-histogram:before { + content: "\e758"; +} + +.ym-custom-emoticon-excited:before { + content: "\e858"; +} + +.ym-custom-headphones:before { + content: "\e958"; +} + +.ym-custom-nest-protect:before { + content: "\ea58"; +} + +.ym-custom-rotate-right-variant:before { + content: "\eb58"; +} + +.ym-custom-transit-transfer:before { + content: "\ec58"; +} + +.ym-custom-arrow-down-bold-circle:before { + content: "\e659"; +} + +.ym-custom-chart-line:before { + content: "\e759"; +} + +.ym-custom-emoticon-happy:before { + content: "\e859"; +} + +.ym-custom-headphones-box:before { + content: "\e959"; +} + +.ym-custom-nest-thermostat:before { + content: "\ea59"; +} + +.ym-custom-rounded-corner:before { + content: "\eb59"; +} + +.ym-custom-tram:before { + content: "\ec59"; +} + +.ym-custom-arrow-down-box:before { + content: "\e65a"; +} + +.ym-custom-chart-pie:before { + content: "\e75a"; +} + +.ym-custom-emoticon-neutral:before { + content: "\e85a"; +} + +.ym-custom-headphones-settings:before { + content: "\e95a"; +} + +.ym-custom-new-box:before { + content: "\ea5a"; +} + +.ym-custom-routes:before { + content: "\eb5a"; +} + +.ym-custom-tree:before { + content: "\ec5a"; +} + +.ym-custom-arrow-down-drop-circle-outline:before { + content: "\e65b"; +} + +.ym-custom-chart-gantt:before { + content: "\e75b"; +} + +.ym-custom-emoticon-sad:before { + content: "\e85b"; +} + +.ym-custom-headset:before { + content: "\e95b"; +} + +.ym-custom-newspaper:before { + content: "\ea5b"; +} + +.ym-custom-router-wireless:before { + content: "\eb5b"; +} + +.ym-custom-treasure-chest:before { + content: "\ec5b"; +} + +.ym-custom-arrow-expand:before { + content: "\e65c"; +} + +.ym-custom-chart-scatterplot-hexbin:before { + content: "\e75c"; +} + +.ym-custom-emoticon-poop:before { + content: "\e85c"; +} + +.ym-custom-hanger:before { + content: "\e95c"; +} + +.ym-custom-nfc:before { + content: "\ea5c"; +} + +.ym-custom-rowing:before { + content: "\eb5c"; +} + +.ym-custom-trending-up:before { + content: "\ec5c"; +} + +.ym-custom-arrow-down-drop-circle:before { + content: "\e65d"; +} + +.ym-custom-chart-timeline:before { + content: "\e75d"; +} + +.ym-custom-emoticon-tongue:before { + content: "\e85d"; +} + +.ym-custom-headset-dock:before { + content: "\e95d"; +} + +.ym-custom-nfc-variant:before { + content: "\ea5d"; +} + +.ym-custom-rss:before { + content: "\eb5d"; +} + +.ym-custom-trending-neutral:before { + content: "\ec5d"; +} + +.ym-custom-arrow-down-bold-hexagon-outline:before { + content: "\e65e"; +} + +.ym-custom-check:before { + content: "\e75e"; +} + +.ym-custom-engine:before { + content: "\e85e"; +} + +.ym-custom-headset-off:before { + content: "\e95e"; +} + +.ym-custom-nodejs:before { + content: "\ea5e"; +} + +.ym-custom-rss-box:before { + content: "\eb5e"; +} + +.ym-custom-trello:before { + content: "\ec5e"; +} + +.ym-custom-arrow-expand-all:before { + content: "\e65f"; +} + +.ym-custom-check-all:before { + content: "\e75f"; +} + +.ym-custom-engine-outline:before { + content: "\e85f"; +} + +.ym-custom-heart:before { + content: "\e95f"; +} + +.ym-custom-note:before { + content: "\ea5f"; +} + +.ym-custom-ruler:before { + content: "\eb5f"; +} + +.ym-custom-trending-down:before { + content: "\ec5f"; +} + +.ym-custom-arrow-left:before { + content: "\e660"; +} + +.ym-custom-checkbox-blank:before { + content: "\e760"; +} + +.ym-custom-equal:before { + content: "\e860"; +} + +.ym-custom-heart-box-outline:before { + content: "\e960"; +} + +.ym-custom-nfc-tap:before { + content: "\ea60"; +} + +.ym-custom-sale:before { + content: "\eb60"; +} + +.ym-custom-triangle:before { + content: "\ec60"; +} + +.ym-custom-arrow-left-bold:before { + content: "\e661"; +} + +.ym-custom-checkbox-blank-circle:before { + content: "\e761"; +} + +.ym-custom-eraser:before { + content: "\e861"; +} + +.ym-custom-heart-broken:before { + content: "\e961"; +} + +.ym-custom-note-multiple:before { + content: "\ea61"; +} + +.ym-custom-run:before { + content: "\eb61"; +} + +.ym-custom-triangle-outline:before { + content: "\ec61"; +} + +.ym-custom-arrow-left-bold-circle:before { + content: "\e662"; +} + +.ym-custom-checkbox-blank-circle-outline:before { + content: "\e762"; +} + +.ym-custom-eraser-variant:before { + content: "\e862"; +} + +.ym-custom-heart-box:before { + content: "\e962"; +} + +.ym-custom-note-multiple-outline:before { + content: "\ea62"; +} + +.ym-custom-satellite:before { + content: "\eb62"; +} + +.ym-custom-trophy-award:before { + content: "\ec62"; +} + +.ym-custom-arrow-left-bold-circle-outline:before { + content: "\e663"; +} + +.ym-custom-checkbox-blank-outline:before { + content: "\e763"; +} + +.ym-custom-equal-box:before { + content: "\e863"; +} + +.ym-custom-heart-half-outline:before { + content: "\e963"; +} + +.ym-custom-note-outline:before { + content: "\ea63"; +} + +.ym-custom-satellite-variant:before { + content: "\eb63"; +} + +.ym-custom-trophy-outline:before { + content: "\ec63"; +} + +.ym-custom-arrow-left-bold-hexagon-outline:before { + content: "\e664"; +} + +.ym-custom-checkbox-marked-circle:before { + content: "\e764"; +} + +.ym-custom-escalator:before { + content: "\e864"; +} + +.ym-custom-heart-half-part:before { + content: "\e964"; +} + +.ym-custom-note-plus:before { + content: "\ea64"; +} + +.ym-custom-saxophone:before { + content: "\eb64"; +} + +.ym-custom-trophy:before { + content: "\ec64"; +} + +.ym-custom-arrow-left-box:before { + content: "\e665"; +} + +.ym-custom-checkbox-marked-circle-outline:before { + content: "\e765"; +} + +.ym-custom-ethernet-cable:before { + content: "\e865"; +} + +.ym-custom-heart-half-part-outline:before { + content: "\e965"; +} + +.ym-custom-note-text:before { + content: "\ea65"; +} + +.ym-custom-scale:before { + content: "\eb65"; +} + +.ym-custom-trophy-variant:before { + content: "\ec65"; +} + +.ym-custom-arrow-left-drop-circle:before { + content: "\e666"; +} + +.ym-custom-checkbox-marked-outline:before { + content: "\e766"; +} + +.ym-custom-ethernet:before { + content: "\e866"; +} + +.ym-custom-help:before { + content: "\e966"; +} + +.ym-custom-note-plus-outline:before { + content: "\ea66"; +} + +.ym-custom-scale-balance:before { + content: "\eb66"; +} + +.ym-custom-trophy-variant-outline:before { + content: "\ec66"; +} + +.ym-custom-arrow-left-drop-circle-outline:before { + content: "\e667"; +} + +.ym-custom-checkbox-marked:before { + content: "\e767"; +} + +.ym-custom-ethernet-cable-off:before { + content: "\e867"; +} + +.ym-custom-heart-outline:before { + content: "\e967"; +} + +.ym-custom-notification-clear-all:before { + content: "\ea67"; +} + +.ym-custom-scale-bathroom:before { + content: "\eb67"; +} + +.ym-custom-truck-delivery:before { + content: "\ec67"; +} + +.ym-custom-arrow-right:before { + content: "\e668"; +} + +.ym-custom-checkbox-multiple-blank-circle:before { + content: "\e768"; +} + +.ym-custom-etsy:before { + content: "\e868"; +} + +.ym-custom-heart-pulse:before { + content: "\e968"; +} + +.ym-custom-npm:before { + content: "\ea68"; +} + +.ym-custom-scanner:before { + content: "\eb68"; +} + +.ym-custom-truck-trailer:before { + content: "\ec68"; +} + +.ym-custom-arrow-right-bold-circle:before { + content: "\e669"; +} + +.ym-custom-checkbox-multiple-blank:before { + content: "\e769"; +} + +.ym-custom-evernote:before { + content: "\e869"; +} + +.ym-custom-help-circle:before { + content: "\e969"; +} + +.ym-custom-nuke:before { + content: "\ea69"; +} + +.ym-custom-school:before { + content: "\eb69"; +} + +.ym-custom-tshirt-crew:before { + content: "\ec69"; +} + +.ym-custom-arrow-right-bold:before { + content: "\e66a"; +} + +.ym-custom-checkbox-multiple-blank-circle-outline:before { + content: "\e76a"; +} + +.ym-custom-ev-station:before { + content: "\e86a"; +} + +.ym-custom-help-circle-outline:before { + content: "\e96a"; +} + +.ym-custom-numeric:before { + content: "\ea6a"; +} + +.ym-custom-screen-rotation:before { + content: "\eb6a"; +} + +.ym-custom-tshirt-v:before { + content: "\ec6a"; +} + +.ym-custom-arrow-right-bold-circle-outline:before { + content: "\e66b"; +} + +.ym-custom-checkbox-multiple-blank-outline:before { + content: "\e76b"; +} + +.ym-custom-exclamation:before { + content: "\e86b"; +} + +.ym-custom-hexagon:before { + content: "\e96b"; +} + +.ym-custom-numeric--box:before { + content: "\ea6b"; +} + +.ym-custom-screen-rotation-lock:before { + content: "\eb6b"; +} + +.ym-custom-tumblr:before { + content: "\ec6b"; +} + +.ym-custom-arrow-right-box:before { + content: "\e66c"; +} + +.ym-custom-checkbox-multiple-marked:before { + content: "\e76c"; +} + +.ym-custom-exit-to-app:before { + content: "\e86c"; +} + +.ym-custom-highway:before { + content: "\e96c"; +} + +.ym-custom-numeric--box-multiple-outline:before { + content: "\ea6c"; +} + +.ym-custom-screwdriver:before { + content: "\eb6c"; +} + +.ym-custom-tumblr-reblog:before { + content: "\ec6c"; +} + +.ym-custom-arrow-right-bold-hexagon-outline:before { + content: "\e66d"; +} + +.ym-custom-checkbox-multiple-marked-circle:before { + content: "\e76d"; +} + +.ym-custom-export:before { + content: "\e86d"; +} + +.ym-custom-hexagon-outline:before { + content: "\e96d"; +} + +.ym-custom-numeric--box-outline:before { + content: "\ea6d"; +} + +.ym-custom-script:before { + content: "\eb6d"; +} + +.ym-custom-tune:before { + content: "\ec6d"; +} + +.ym-custom-arrow-right-drop-circle:before { + content: "\e66e"; +} + +.ym-custom-checkbox-multiple-marked-circle-outline:before { + content: "\e76e"; +} + +.ym-custom-eye:before { + content: "\e86e"; +} + +.ym-custom-history:before { + content: "\e96e"; +} + +.ym-custom-numeric--box1:before { + content: "\ea6e"; +} + +.ym-custom-sd:before { + content: "\eb6e"; +} + +.ym-custom-truck:before { + content: "\ec6e"; +} + +.ym-custom-arrow-right-drop-circle-outline:before { + content: "\e66f"; +} + +.ym-custom-check-circle:before { + content: "\e76f"; +} + +.ym-custom-eyedropper:before { + content: "\e86f"; +} + +.ym-custom-home:before { + content: "\e96f"; +} + +.ym-custom-numeric--box-outline1:before { + content: "\ea6f"; +} + +.ym-custom-seat-flat:before { + content: "\eb6f"; +} + +.ym-custom-tune-vertical:before { + content: "\ec6f"; +} + +.ym-custom-arrow-top-right:before { + content: "\e670"; +} + +.ym-custom-checkbox-multiple-marked-outline:before { + content: "\e770"; +} + +.ym-custom-eye-off:before { + content: "\e870"; +} + +.ym-custom-hololens:before { + content: "\e970"; +} + +.ym-custom-numeric--box-multiple-outline1:before { + content: "\ea70"; +} + +.ym-custom-seat-flat-angled:before { + content: "\eb70"; +} + +.ym-custom-twitch:before { + content: "\ec70"; +} + +.ym-custom-arrow-up:before { + content: "\e671"; +} + +.ym-custom-checkerboard:before { + content: "\e771"; +} + +.ym-custom-eyedropper-variant:before { + content: "\e871"; +} + +.ym-custom-home-modern:before { + content: "\e971"; +} + +.ym-custom-numeric--box2:before { + content: "\ea71"; +} + +.ym-custom-seat-individual-suite:before { + content: "\eb71"; +} + +.ym-custom-twitter:before { + content: "\ec71"; +} + +.ym-custom-arrow-up-bold:before { + content: "\e672"; +} + +.ym-custom-check-circle-outline:before { + content: "\e772"; +} + +.ym-custom-face:before { + content: "\e872"; +} + +.ym-custom-home-outline:before { + content: "\e972"; +} + +.ym-custom-numeric--box-multiple-outline2:before { + content: "\ea72"; +} + +.ym-custom-seal:before { + content: "\eb72"; +} + +.ym-custom-twitter-circle:before { + content: "\ec72"; +} + +.ym-custom-arrow-top-left:before { + content: "\e673"; +} + +.ym-custom-chemical-weapon:before { + content: "\e773"; +} + +.ym-custom-facebook-box:before { + content: "\e873"; +} + +.ym-custom-home-variant:before { + content: "\e973"; +} + +.ym-custom-numeric--box-outline2:before { + content: "\ea73"; +} + +.ym-custom-seat-legroom-extra:before { + content: "\eb73"; +} + +.ym-custom-twitter-box:before { + content: "\ec73"; +} + +.ym-custom-arrow-up-bold-circle:before { + content: "\e674"; +} + +.ym-custom-chevron-double-down:before { + content: "\e774"; +} + +.ym-custom-facebook:before { + content: "\e874"; +} + +.ym-custom-home-map-marker:before { + content: "\e974"; +} + +.ym-custom-numeric--box-multiple-outline3:before { + content: "\ea74"; +} + +.ym-custom-seat-legroom-normal:before { + content: "\eb74"; +} + +.ym-custom-umbraco:before { + content: "\ec74"; +} + +.ym-custom-arrow-up-bold-circle-outline:before { + content: "\e675"; +} + +.ym-custom-chevron-double-left:before { + content: "\e775"; +} + +.ym-custom-face-profile:before { + content: "\e875"; +} + +.ym-custom-hook:before { + content: "\e975"; +} + +.ym-custom-numeric--box-outline3:before { + content: "\ea75"; +} + +.ym-custom-seat-recline-extra:before { + content: "\eb75"; +} + +.ym-custom-twitter-retweet:before { + content: "\ec75"; +} + +.ym-custom-arrow-up-bold-hexagon-outline:before { + content: "\e676"; +} + +.ym-custom-chevron-double-right:before { + content: "\e776"; +} + +.ym-custom-facebook-messenger:before { + content: "\e876"; +} + +.ym-custom-hook-off:before { + content: "\e976"; +} + +.ym-custom-numeric--box3:before { + content: "\ea76"; +} + +.ym-custom-seat-legroom-reduced:before { + content: "\eb76"; +} + +.ym-custom-ubuntu:before { + content: "\ec76"; +} + +.ym-custom-arrow-up-box:before { + content: "\e677"; +} + +.ym-custom-chevron-double-up:before { + content: "\e777"; +} + +.ym-custom-factory:before { + content: "\e877"; +} + +.ym-custom-hops:before { + content: "\e977"; +} + +.ym-custom-numeric--box4:before { + content: "\ea77"; +} + +.ym-custom-seat-recline-normal:before { + content: "\eb77"; +} + +.ym-custom-umbrella:before { + content: "\ec77"; +} + +.ym-custom-album:before { + content: "\e678"; +} + +.ym-custom-chevron-down:before { + content: "\e778"; +} + +.ym-custom-fast-forward:before { + content: "\e878"; +} + +.ym-custom-hospital:before { + content: "\e978"; +} + +.ym-custom-numeric--box-outline4:before { + content: "\ea78"; +} + +.ym-custom-security:before { + content: "\eb78"; +} + +.ym-custom-unfold-less:before { + content: "\ec78"; +} + +.ym-custom-assistant:before { + content: "\e679"; +} + +.ym-custom-chevron-left:before { + content: "\e779"; +} + +.ym-custom-fan:before { + content: "\e879"; +} + +.ym-custom-hospital-building:before { + content: "\e979"; +} + +.ym-custom-numeric--box-multiple-outline4:before { + content: "\ea79"; +} + +.ym-custom-security-home:before { + content: "\eb79"; +} + +.ym-custom-undo-variant:before { + content: "\ec79"; +} + +.ym-custom-arrow-up-drop-circle-outline:before { + content: "\e67a"; +} + +.ym-custom-chevron-right:before { + content: "\e77a"; +} + +.ym-custom-fast-forward-outline:before { + content: "\e87a"; +} + +.ym-custom-hospital-marker:before { + content: "\e97a"; +} + +.ym-custom-numeric--box5:before { + content: "\ea7a"; +} + +.ym-custom-security-network:before { + content: "\eb7a"; +} + +.ym-custom-undo:before { + content: "\ec7a"; +} + +.ym-custom-arrow-up-drop-circle:before { + content: "\e67b"; +} + +.ym-custom-chevron-up:before { + content: "\e77b"; +} + +.ym-custom-fax:before { + content: "\e87b"; +} + +.ym-custom-hotel:before { + content: "\e97b"; +} + +.ym-custom-numeric--box-multiple-outline5:before { + content: "\ea7b"; +} + +.ym-custom-select-all:before { + content: "\eb7b"; +} + +.ym-custom-unfold-more:before { + content: "\ec7b"; +} + +.ym-custom-attachment:before { + content: "\e67c"; +} + +.ym-custom-church:before { + content: "\e77c"; +} + +.ym-custom-feather:before { + content: "\e87c"; +} + +.ym-custom-houzz:before { + content: "\e97c"; +} + +.ym-custom-numeric--box-outline5:before { + content: "\ea7c"; +} + +.ym-custom-select-inverse:before { + content: "\eb7c"; +} + +.ym-custom-ungroup:before { + content: "\ec7c"; +} + +.ym-custom-asterisk:before { + content: "\e67d"; +} + +.ym-custom-chip:before { + content: "\e77d"; +} + +.ym-custom-ferry:before { + content: "\e87d"; +} + +.ym-custom-houzz-box:before { + content: "\e97d"; +} + +.ym-custom-numeric--box6:before { + content: "\ea7d"; +} + +.ym-custom-select:before { + content: "\eb7d"; +} + +.ym-custom-umbrella-outline:before { + content: "\ec7d"; +} + +.ym-custom-at:before { + content: "\e67e"; +} + +.ym-custom-cisco-webex:before { + content: "\e77e"; +} + +.ym-custom-file:before { + content: "\e87e"; +} + +.ym-custom-human-child:before { + content: "\e97e"; +} + +.ym-custom-numeric--box-multiple-outline6:before { + content: "\ea7e"; +} + +.ym-custom-selection:before { + content: "\eb7e"; +} + +.ym-custom-update:before { + content: "\ec7e"; +} + +.ym-custom-audiobook:before { + content: "\e67f"; +} + +.ym-custom-city:before { + content: "\e77f"; +} + +.ym-custom-file-chart:before { + content: "\e87f"; +} + +.ym-custom-human:before { + content: "\e97f"; +} + +.ym-custom-numeric--box7:before { + content: "\ea7f"; +} + +.ym-custom-select-off:before { + content: "\eb7f"; +} + +.ym-custom-untappd:before { + content: "\ec7f"; +} + +.ym-custom-auto-fix:before { + content: "\e680"; +} + +.ym-custom-clipboard:before { + content: "\e780"; +} + +.ym-custom-file-check:before { + content: "\e880"; +} + +.ym-custom-human-greeting:before { + content: "\e980"; +} + +.ym-custom-numeric--box-outline6:before { + content: "\ea80"; +} + +.ym-custom-send:before { + content: "\eb80"; +} + +.ym-custom-unity:before { + content: "\ec80"; +} + +.ym-custom-auto-upload:before { + content: "\e681"; +} + +.ym-custom-clipboard-account:before { + content: "\e781"; +} + +.ym-custom-file-cloud:before { + content: "\e881"; +} + +.ym-custom-human-female:before { + content: "\e981"; +} + +.ym-custom-numeric--box-multiple-outline7:before { + content: "\ea81"; +} + +.ym-custom-serial-port:before { + content: "\eb81"; +} + +.ym-custom-upload:before { + content: "\ec81"; +} + +.ym-custom-autorenew:before { + content: "\e682"; +} + +.ym-custom-clipboard-arrow-down:before { + content: "\e782"; +} + +.ym-custom-file-delimited:before { + content: "\e882"; +} + +.ym-custom-human-handsup:before { + content: "\e982"; +} + +.ym-custom-numeric--box-outline7:before { + content: "\ea82"; +} + +.ym-custom-server-minus:before { + content: "\eb82"; +} + +.ym-custom-vector-arrange-above:before { + content: "\ec82"; +} + +.ym-custom-av-timer:before { + content: "\e683"; +} + +.ym-custom-clipboard-alert:before { + content: "\e783"; +} + +.ym-custom-file-document-box:before { + content: "\e883"; +} + +.ym-custom-human-handsdown:before { + content: "\e983"; +} + +.ym-custom-numeric--box8:before { + content: "\ea83"; +} + +.ym-custom-server:before { + content: "\eb83"; +} + +.ym-custom-usb:before { + content: "\ec83"; +} + +.ym-custom-backspace:before { + content: "\e684"; +} + +.ym-custom-clipboard-arrow-left:before { + content: "\e784"; +} + +.ym-custom-file-excel:before { + content: "\e884"; +} + +.ym-custom-human-male-female:before { + content: "\e984"; +} + +.ym-custom-numeric--box-multiple-outline8:before { + content: "\ea84"; +} + +.ym-custom-server-network-off:before { + content: "\eb84"; +} + +.ym-custom-vector-arrange-below:before { + content: "\ec84"; +} + +.ym-custom-backburger:before { + content: "\e685"; +} + +.ym-custom-clipboard-check:before { + content: "\e785"; +} + +.ym-custom-file-document:before { + content: "\e885"; +} + +.ym-custom-human-male:before { + content: "\e985"; +} + +.ym-custom-numeric--box9:before { + content: "\ea85"; +} + +.ym-custom-server-network:before { + content: "\eb85"; +} + +.ym-custom-vector-circle:before { + content: "\ec85"; +} + +.ym-custom-baby-buggy:before { + content: "\e686"; +} + +.ym-custom-clipboard-flow:before { + content: "\e786"; +} + +.ym-custom-file-excel-box:before { + content: "\e886"; +} + +.ym-custom-human-pregnant:before { + content: "\e986"; +} + +.ym-custom-numeric--box-outline8:before { + content: "\ea86"; +} + +.ym-custom-server-off:before { + content: "\eb86"; +} + +.ym-custom-vector-combine:before { + content: "\ec86"; +} + +.ym-custom-baby:before { + content: "\e687"; +} + +.ym-custom-clipboard-outline:before { + content: "\e787"; +} + +.ym-custom-file-export:before { + content: "\e887"; +} + +.ym-custom-image:before { + content: "\e987"; +} + +.ym-custom-numeric--box-multiple-outline9:before { + content: "\ea87"; +} + +.ym-custom-server-plus:before { + content: "\eb87"; +} + +.ym-custom-vector-circle-variant:before { + content: "\ec87"; +} + +.ym-custom-bandcamp:before { + content: "\e688"; +} + +.ym-custom-clipboard-text:before { + content: "\e788"; +} + +.ym-custom-file-find:before { + content: "\e888"; +} + +.ym-custom-image-album:before { + content: "\e988"; +} + +.ym-custom-numeric--box-outline9:before { + content: "\ea88"; +} + +.ym-custom-server-remove:before { + content: "\eb88"; +} + +.ym-custom-vector-curve:before { + content: "\ec88"; +} + +.ym-custom-bank:before { + content: "\e689"; +} + +.ym-custom-clippy:before { + content: "\e789"; +} + +.ym-custom-file-image:before { + content: "\e889"; +} + +.ym-custom-image-area:before { + content: "\e989"; +} + +.ym-custom-numeric--plus-box:before { + content: "\ea89"; +} + +.ym-custom-shape-circle-plus:before { + content: "\eb89"; +} + +.ym-custom-vector-difference:before { + content: "\ec89"; +} + +.ym-custom-backup-restore:before { + content: "\e68a"; +} + +.ym-custom-clock:before { + content: "\e78a"; +} + +.ym-custom-file-hidden:before { + content: "\e88a"; +} + +.ym-custom-image-area-close:before { + content: "\e98a"; +} + +.ym-custom-numeric--plus-box-multiple-outline:before { + content: "\ea8a"; +} + +.ym-custom-server-security:before { + content: "\eb8a"; +} + +.ym-custom-vector-difference-ba:before { + content: "\ec8a"; +} + +.ym-custom-barley:before { + content: "\e68b"; +} + +.ym-custom-clock-end:before { + content: "\e78b"; +} + +.ym-custom-file-import:before { + content: "\e88b"; +} + +.ym-custom-image-filter-black-white:before { + content: "\e98b"; +} + +.ym-custom-nutrition:before { + content: "\ea8b"; +} + +.ym-custom-settings-box:before { + content: "\eb8b"; +} + +.ym-custom-vector-difference-ab:before { + content: "\ec8b"; +} + +.ym-custom-barcode-scan:before { + content: "\e68c"; +} + +.ym-custom-clock-alert:before { + content: "\e78c"; +} + +.ym-custom-file-lock:before { + content: "\e88c"; +} + +.ym-custom-image-filter:before { + content: "\e98c"; +} + +.ym-custom-numeric--plus-box-outline:before { + content: "\ea8c"; +} + +.ym-custom-shape-polygon-plus:before { + content: "\eb8c"; +} + +.ym-custom-vector-line:before { + content: "\ec8c"; +} + +.ym-custom-barcode:before { + content: "\e68d"; +} + +.ym-custom-clock-in:before { + content: "\e78d"; +} + +.ym-custom-file-multiple:before { + content: "\e88d"; +} + +.ym-custom-image-broken-variant:before { + content: "\e98d"; +} + +.ym-custom-oar:before { + content: "\ea8d"; +} + +.ym-custom-settings:before { + content: "\eb8d"; +} + +.ym-custom-vector-intersection:before { + content: "\ec8d"; +} + +.ym-custom-barrel:before { + content: "\e68e"; +} + +.ym-custom-clock-out:before { + content: "\e78e"; +} + +.ym-custom-file-outline:before { + content: "\e88e"; +} + +.ym-custom-image-broken:before { + content: "\e98e"; +} + +.ym-custom-octagon:before { + content: "\ea8e"; +} + +.ym-custom-shape-plus:before { + content: "\eb8e"; +} + +.ym-custom-vector-point:before { + content: "\ec8e"; +} + +.ym-custom-basecamp:before { + content: "\e68f"; +} + +.ym-custom-clock-fast:before { + content: "\e78f"; +} + +.ym-custom-file-music:before { + content: "\e88f"; +} + +.ym-custom-image-filter-center-focus-weak:before { + content: "\e98f"; +} + +.ym-custom-octagon-outline:before { + content: "\ea8f"; +} + +.ym-custom-share:before { + content: "\eb8f"; +} + +.ym-custom-vector-polygon:before { + content: "\ec8f"; +} + +.ym-custom-basket:before { + content: "\e690"; +} + +.ym-custom-clock-start:before { + content: "\e790"; +} + +.ym-custom-file-pdf:before { + content: "\e890"; +} + +.ym-custom-image-filter-center-focus:before { + content: "\e990"; +} + +.ym-custom-odnoklassniki:before { + content: "\ea90"; +} + +.ym-custom-shape-square-plus:before { + content: "\eb90"; +} + +.ym-custom-vector-polyline:before { + content: "\ec90"; +} + +.ym-custom-basket-fill:before { + content: "\e691"; +} + +.ym-custom-close-box:before { + content: "\e791"; +} + +.ym-custom-file-powerpoint:before { + content: "\e891"; +} + +.ym-custom-image-filter-drama:before { + content: "\e991"; +} + +.ym-custom-office:before { + content: "\ea91"; +} + +.ym-custom-share-variant:before { + content: "\eb91"; +} + +.ym-custom-vector-rectangle:before { + content: "\ec91"; +} + +.ym-custom-battery:before { + content: "\e692"; +} + +.ym-custom-close-box-outline:before { + content: "\e792"; +} + +.ym-custom-file-pdf-box:before { + content: "\e892"; +} + +.ym-custom-image-filter-frames:before { + content: "\e992"; +} + +.ym-custom-oil-temperature:before { + content: "\ea92"; +} + +.ym-custom-shield:before { + content: "\eb92"; +} + +.ym-custom-vector-selection:before { + content: "\ec92"; +} + +.ym-custom-basket-unfill:before { + content: "\e693"; +} + +.ym-custom-close-circle:before { + content: "\e793"; +} + +.ym-custom-file-powerpoint-box:before { + content: "\e893"; +} + +.ym-custom-image-filter-hdr:before { + content: "\e993"; +} + +.ym-custom-oil:before { + content: "\ea93"; +} + +.ym-custom-shopping:before { + content: "\eb93"; +} + +.ym-custom-vector-square:before { + content: "\ec93"; +} + +.ym-custom-battery-:before { + content: "\e694"; +} + +.ym-custom-close-circle-outline:before { + content: "\e794"; +} + +.ym-custom-file-restore:before { + content: "\e894"; +} + +.ym-custom-image-filter-none:before { + content: "\e994"; +} + +.ym-custom-omega:before { + content: "\ea94"; +} + +.ym-custom-shovel:before { + content: "\eb94"; +} + +.ym-custom-vector-triangle:before { + content: "\ec94"; +} + +.ym-custom-battery-1:before { + content: "\e695"; +} + +.ym-custom-close:before { + content: "\e795"; +} + +.ym-custom-file-send:before { + content: "\e895"; +} + +.ym-custom-image-filter-tilt-shift:before { + content: "\e995"; +} + +.ym-custom-opacity:before { + content: "\ea95"; +} + +.ym-custom-shopping-music:before { + content: "\eb95"; +} + +.ym-custom-vector-union:before { + content: "\ec95"; +} + +.ym-custom-battery-2:before { + content: "\e696"; +} + +.ym-custom-closed-caption:before { + content: "\e796"; +} + +.ym-custom-file-tree:before { + content: "\e896"; +} + +.ym-custom-image-filter-vintage:before { + content: "\e996"; +} + +.ym-custom-onedrive:before { + content: "\ea96"; +} + +.ym-custom-shovel-off:before { + content: "\eb96"; +} + +.ym-custom-vibrate:before { + content: "\ec96"; +} + +.ym-custom-battery-3:before { + content: "\e697"; +} + +.ym-custom-close-octagon:before { + content: "\e797"; +} + +.ym-custom-file-video:before { + content: "\e897"; +} + +.ym-custom-image-multiple:before { + content: "\e997"; +} + +.ym-custom-openid:before { + content: "\ea97"; +} + +.ym-custom-shredder:before { + content: "\eb97"; +} + +.ym-custom-verified:before { + content: "\ec97"; +} + +.ym-custom-battery-4:before { + content: "\e698"; +} + +.ym-custom-close-outline:before { + content: "\e798"; +} + +.ym-custom-file-word:before { + content: "\e898"; +} + +.ym-custom-import:before { + content: "\e998"; +} + +.ym-custom-open-in-new:before { + content: "\ea98"; +} + +.ym-custom-shuffle:before { + content: "\eb98"; +} + +.ym-custom-video:before { + content: "\ec98"; +} + +.ym-custom-battery-5:before { + content: "\e699"; +} + +.ym-custom-close-network:before { + content: "\e799"; +} + +.ym-custom-file-presentation-box:before { + content: "\e899"; +} + +.ym-custom-inbox-arrow-down:before { + content: "\e999"; +} + +.ym-custom-open-in-app:before { + content: "\ea99"; +} + +.ym-custom-shuffle-disabled:before { + content: "\eb99"; +} + +.ym-custom-video-off:before { + content: "\ec99"; +} + +.ym-custom-battery-6:before { + content: "\e69a"; +} + +.ym-custom-cloud:before { + content: "\e79a"; +} + +.ym-custom-file-word-box:before { + content: "\e89a"; +} + +.ym-custom-inbox:before { + content: "\e99a"; +} + +.ym-custom-opera:before { + content: "\ea9a"; +} + +.ym-custom-shuffle-variant:before { + content: "\eb9a"; +} + +.ym-custom-video-switch:before { + content: "\ec9a"; +} + +.ym-custom-battery-7:before { + content: "\e69b"; +} + +.ym-custom-close-octagon-outline:before { + content: "\e79b"; +} + +.ym-custom-file-xml:before { + content: "\e89b"; +} + +.ym-custom-incognito:before { + content: "\e99b"; +} + +.ym-custom-ornament:before { + content: "\ea9b"; +} + +.ym-custom-shape-rectangle-plus:before { + content: "\eb9b"; +} + +.ym-custom-view-agenda:before { + content: "\ec9b"; +} + +.ym-custom-battery-8:before { + content: "\e69c"; +} + +.ym-custom-cloud-check:before { + content: "\e79c"; +} + +.ym-custom-film:before { + content: "\e89c"; +} + +.ym-custom-inbox-arrow-up:before { + content: "\e99c"; +} + +.ym-custom-ornament-variant:before { + content: "\ea9c"; +} + +.ym-custom-shield-outline:before { + content: "\eb9c"; +} + +.ym-custom-view-array:before { + content: "\ec9c"; +} + +.ym-custom-battery-charging-:before { + content: "\e69d"; +} + +.ym-custom-cloud-download:before { + content: "\e79d"; +} + +.ym-custom-filmstrip:before { + content: "\e89d"; +} + +.ym-custom-infinity:before { + content: "\e99d"; +} + +.ym-custom-owl:before { + content: "\ea9d"; +} + +.ym-custom-sigma:before { + content: "\eb9d"; +} + +.ym-custom-view-carousel:before { + content: "\ec9d"; +} + +.ym-custom-battery-alert:before { + content: "\e69e"; +} + +.ym-custom-cloud-outline-off:before { + content: "\e79e"; +} + +.ym-custom-filmstrip-off:before { + content: "\e89e"; +} + +.ym-custom-information-outline:before { + content: "\e99e"; +} + +.ym-custom-package:before { + content: "\ea9e"; +} + +.ym-custom-sigma-lower:before { + content: "\eb9e"; +} + +.ym-custom-view-column:before { + content: "\ec9e"; +} + +.ym-custom-battery-charging:before { + content: "\e69f"; +} + +.ym-custom-cloud-outline:before { + content: "\e79f"; +} + +.ym-custom-filter:before { + content: "\e89f"; +} + +.ym-custom-information:before { + content: "\e99f"; +} + +.ym-custom-package-down:before { + content: "\ea9f"; +} + +.ym-custom-signal:before { + content: "\eb9f"; +} + +.ym-custom-view-dashboard:before { + content: "\ec9f"; +} + +.ym-custom-battery-charging-1:before { + content: "\e6a0"; +} + +.ym-custom-cloud-circle:before { + content: "\e7a0"; +} + +.ym-custom-filter-remove:before { + content: "\e8a0"; +} + +.ym-custom-information-variant:before { + content: "\e9a0"; +} + +.ym-custom-package-up:before { + content: "\eaa0"; +} + +.ym-custom-signal-g:before { + content: "\eba0"; +} + +.ym-custom-view-day:before { + content: "\eca0"; +} + +.ym-custom-battery-charging-2:before { + content: "\e6a1"; +} + +.ym-custom-cloud-print:before { + content: "\e7a1"; +} + +.ym-custom-filter-remove-outline:before { + content: "\e8a1"; +} + +.ym-custom-instagram:before { + content: "\e9a1"; +} + +.ym-custom-package-variant:before { + content: "\eaa1"; +} + +.ym-custom-signal-g1:before { + content: "\eba1"; +} + +.ym-custom-view-list:before { + content: "\eca1"; +} diff --git a/assets/iconfont/ym/iconfont.css b/assets/iconfont/ym/iconfont.css new file mode 100644 index 0000000..c4c8789 --- /dev/null +++ b/assets/iconfont/ym/iconfont.css @@ -0,0 +1,2767 @@ +@font-face { + font-family: 'icon-ym'; + /* Project id 3271933 */ + src: url('https://at.alicdn.com/t/c/font_3271933_06d8qx72dz03.woff2?t=1747647124244') format('woff2'), + url('https://at.alicdn.com/t/c/font_3271933_06d8qx72dz03.woff?t=1747647124244') format('woff'), + url('https://at.alicdn.com/t/c/font_3271933_06d8qx72dz03.ttf?t=1747647124244') format('truetype'); +} + +.icon-ym { + font-family: "icon-ym" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-ym-route-appCenter:before { + content: "\e97b"; +} + +.icon-ym-route-integrationCenter:before { + content: "\e9a1"; +} + +.icon-ym-route-dataCenter:before { + content: "\e9b6"; +} + +.icon-ym-id-experiencer:before { + content: "\e9a3"; +} + +.icon-ym-id-developer:before { + content: "\e9a8"; +} + +.icon-ym-id-manager:before { + content: "\e9ac"; +} + +.icon-ym-id-user:before { + content: "\e9af"; +} + +.icon-ym-id-admin:before { + content: "\e9b5"; +} + +.icon-ym-chat-checked:before { + content: "\e9b3"; +} + +.icon-ym-chat:before { + content: "\e9b4"; +} + +.icon-ym-route-appMenu:before { + content: "\e9aa"; +} + +.icon-ym-flow-node-external:before { + content: "\e9ab"; +} + +.icon-ym-contacts:before { + content: "\e9ad"; +} + +.icon-ym-developSystem:before { + content: "\e9ae"; +} + +.icon-ym-contacts-checked:before { + content: "\e9b0"; +} + +.icon-ym-add-action:before { + content: "\e9b1"; +} + +.icon-ym-reduce:before { + content: "\e9b2"; +} + +.icon-ym-route-monitor:before { + content: "\e99f"; +} + +.icon-ym-route-email:before { + content: "\e9a0"; +} + +.icon-ym-route-appAuth:before { + content: "\e9a2"; +} + +.icon-ym-route-errorLog:before { + content: "\e9a4"; +} + +.icon-ym-route-appResource:before { + content: "\e9a5"; +} + +.icon-ym-enlarge:before { + content: "\e9a6"; +} + +.icon-ym-route-baseConfig:before { + content: "\e9a7"; +} + +.icon-ym-add-action1:before { + content: "\e9a9"; +} + +.icon-ym-route-dataSource:before { + content: "\e996"; +} + +.icon-ym-route-resource:before { + content: "\e997"; +} + +.icon-ym-route-dictionary:before { + content: "\e998"; +} + +.icon-ym-route-action:before { + content: "\e999"; +} + +.icon-ym-route-sms:before { + content: "\e99a"; +} + +.icon-ym-route-menu:before { + content: "\e99b"; +} + +.icon-ym-route-cache:before { + content: "\e99c"; +} + +.icon-ym-generator-calculate:before { + content: "\e99d"; +} + +.icon-ym-route-dingTalk:before { + content: "\e99e"; +} + +.icon-ym-route-interfaceOauth:before { + content: "\e98b"; +} + +.icon-ym-select-action:before { + content: "\e98c"; +} + +.icon-ym-route-icons:before { + content: "\e98d"; +} + +.icon-ym-route-loginLog:before { + content: "\e98e"; +} + +.icon-ym-workSystem:before { + content: "\e98f"; +} + +.icon-ym-route-operateLog:before { + content: "\e990"; +} + +.icon-ym-route-teamwork:before { + content: "\e991"; +} + +.icon-ym-route-dataInterface:before { + content: "\e992"; +} + +.icon-ym-route-language:before { + content: "\e993"; +} + +.icon-ym-route-dataModel:before { + content: "\e994"; +} + +.icon-ym-route-area:before { + content: "\e995"; +} + +.icon-ym-video-help:before { + content: "\e97f"; +} + +.icon-ym-route-strategy:before { + content: "\e980"; +} + +.icon-ym-route-appConfig:before { + content: "\e981"; +} + +.icon-ym-route-requestLog:before { + content: "\e982"; +} + +.icon-ym-route-platformMonitor:before { + content: "\e983"; +} + +.icon-ym-route-task:before { + content: "\e984"; +} + +.icon-ym-route-sysService:before { + content: "\e985"; +} + +.icon-ym-route-sysData:before { + content: "\e986"; +} + +.icon-ym-route-sysForm:before { + content: "\e987"; +} + +.icon-ym-secure:before { + content: "\e988"; +} + +.icon-ym-route-msgMonitor:before { + content: "\e989"; +} + +.icon-ym-route-flowMonitor:before { + content: "\e98a"; +} + +.icon-ym-userSync:before { + content: "\e8ec"; +} + +.icon-ym-route-weCom:before { + content: "\e8f9"; +} + +.icon-ym-route-workFlow:before { + content: "\e97c"; +} + +.icon-ym-route-sysLog:before { + content: "\e97d"; +} + +.icon-ym-route-parameter:before { + content: "\e97e"; +} + +.icon-ym-ai:before { + content: "\e97a"; +} + +.icon-ym-harmonyOS:before { + content: "\e979"; +} + +.icon-ym-flow-node-paste:before { + content: "\e974"; +} + +.icon-ym-flow-node-parallel:before { + content: "\e975"; +} + +.icon-ym-flow-node-copy:before { + content: "\e976"; +} + +.icon-ym-ai-list:before { + content: "\e977"; +} + +.icon-ym-flow-node-condition-multiple:before { + content: "\e978"; +} + +.icon-ym-flow-node-cope:before { + content: "\e96f"; +} + +.icon-ym-select-cell:before { + content: "\e970"; +} + +.icon-ym-flow-node-condition-single:before { + content: "\e971"; +} + +.icon-ym-shortcut1:before { + content: "\e972"; +} + +.icon-ym-ai-form:before { + content: "\e973"; +} + +.icon-ym-right-join:before { + content: "\e96b"; +} + +.icon-ym-left-join:before { + content: "\e96c"; +} + +.icon-ym-inner-join:before { + content: "\e96d"; +} + +.icon-ym-full-join:before { + content: "\e96e"; +} + +.icon-ym-flow-trigger-timer:before { + content: "\e968"; +} + +.icon-ym-flow-trigger-event:before { + content: "\e969"; +} + +.icon-ym-dataLog:before { + content: "\e96a"; +} + +.icon-ym-save:before { + content: "\e962"; +} + +.icon-ym-flow-view:before { + content: "\e963"; +} + +.icon-ym-batch-action:before { + content: "\e964"; +} + +.icon-ym-print-template:before { + content: "\e965"; +} + +.icon-ym-flow-trigger-webhook:before { + content: "\e966"; +} + +.icon-ym-flow-trigger-notice:before { + content: "\e967"; +} + +.icon-ym-kit:before { + content: "\e960"; +} + +.icon-ym-kit-fill:before { + content: "\e961"; +} + +.icon-ym-tip:before { + content: "\e934"; +} + +.icon-ym-flow-minus:before { + content: "\e935"; +} + +.icon-ym-flow-history:before { + content: "\e936"; +} + +.icon-ym-flow-align-middle:before { + content: "\e938"; +} + +.icon-ym-flow-align-bottom:before { + content: "\e93c"; +} + +.icon-ym-beautify-horizontal:before { + content: "\e949"; +} + +.icon-ym-flow-aerial-view:before { + content: "\e94a"; +} + +.icon-ym-flow-align-center:before { + content: "\e950"; +} + +.icon-ym-beautify-vertical:before { + content: "\e954"; +} + +.icon-ym-flow-align-left:before { + content: "\e90a"; +} + +.icon-ym-flow-selection:before { + content: "\e911"; +} + +.icon-ym-flow-node-timer1:before { + content: "\e915"; +} + +.icon-ym-flow-shortcut:before { + content: "\e91d"; +} + +.icon-ym-flow-focus:before { + content: "\e922"; +} + +.icon-ym-flow-node-approve:before { + content: "\e923"; +} + +.icon-ym-flow-plus:before { + content: "\e925"; +} + +.icon-ym-flow-node-system-task:before { + content: "\e927"; +} + +.icon-ym-flow-move:before { + content: "\e92b"; +} + +.icon-ym-flow-align-let:before { + content: "\e92c"; +} + +.icon-ym-redo:before { + content: "\e92d"; +} + +.icon-ym-flow-align-right:before { + content: "\e930"; +} + +.icon-ym-undo:before { + content: "\e932"; +} + +.icon-ym-flow-align-top:before { + content: "\e904"; +} + +.icon-ym-hLine:before { + content: "\e951"; +} + +.icon-ym-vLine:before { + content: "\e953"; +} + +.icon-ym-header-notice:before { + content: "\e95f"; +} + +.icon-ym-header-fullscreen1:before { + content: "\e917"; +} + +.icon-ym-cell:before { + content: "\e928"; +} + +.icon-ym-header-search:before { + content: "\e92e"; +} + +.icon-ym-header-config:before { + content: "\e92f"; +} + +.icon-ym-header-fullscreen-exit1:before { + content: "\e956"; +} + +.icon-ym-flowToSign:before { + content: "\e95d"; +} + +.icon-ym-flowDoing:before { + content: "\e95e"; +} + +.icon-ym-header-chat:before { + content: "\e907"; +} + +.icon-ym-header-sys-toggle:before { + content: "\e90d"; +} + +.icon-ym-schedule:before { + content: "\e910"; +} + +.icon-ym-caret-left:before { + content: "\e95c"; +} + +.icon-ym-btn-export1:before { + content: "\e959"; +} + +.icon-ym-caret-right:before { + content: "\e95a"; +} + +.icon-ym-btn-import1:before { + content: "\e95b"; +} + +.icon-ym-rect:before { + content: "\e955"; +} + +.icon-ym-combination:before { + content: "\e957"; +} + +.icon-ym-oval:before { + content: "\e958"; +} + +.icon-ym-header-star-fill:before { + content: "\e952"; +} + +.icon-ym-flow-node-subFlow:before { + content: "\e93a"; +} + +.icon-ym-flow-node-end:before { + content: "\e93d"; +} + +.icon-ym-flow-node-branch:before { + content: "\e943"; +} + +.icon-ym-flow-node-condition:before { + content: "\e919"; +} + +.icon-ym-flow-node-timer:before { + content: "\e92a"; +} + +.icon-ym-flow-node-interflow:before { + content: "\e933"; +} + +.icon-ym-recovery:before { + content: "\e94f"; +} + +.icon-ym-share-cancel:before { + content: "\e94e"; +} + +.icon-ym-upload1:before { + content: "\e91f"; +} + +.icon-ym-add-folder:before { + content: "\e94d"; +} + +.icon-ym-tile-mode:before { + content: "\e94b"; +} + +.icon-ym-folder:before { + content: "\e94c"; +} + +.icon-ym-app-more:before { + content: "\e916"; +} + +.icon-ym-add-cancel:before { + content: "\e940"; +} + +.icon-ym-app-rename:before { + content: "\e941"; +} + +.icon-ym-flow-node-start:before { + content: "\e942"; +} + +.icon-ym-app-role-toggle:before { + content: "\e944"; +} + +.icon-ym-auth-group:before { + content: "\e945"; +} + +.icon-ym-app-delete:before { + content: "\e946"; +} + +.icon-ym-app-share:before { + content: "\e947"; +} + +.icon-ym-app-schedule:before { + content: "\e948"; +} + +.icon-ym-dark:before { + content: "\e937"; +} + +.icon-ym-app-todo:before { + content: "\e939"; +} + +.icon-ym-app-download:before { + content: "\e93b"; +} + +.icon-ym-app-move:before { + content: "\e93e"; +} + +.icon-ym-app-document:before { + content: "\e93f"; +} + +.icon-ym-header-star:before { + content: "\e929"; +} + +.icon-ym-msg-read-all:before { + content: "\e931"; +} + +.icon-ym-more-vertical:before { + content: "\e91e"; +} + +.icon-ym-more:before { + content: "\e920"; +} + +.icon-ym-header-fullscreen:before { + content: "\e921"; +} + +.icon-ym-nav-home-fill:before { + content: "\e924"; +} + +.icon-ym-tip-filled:before { + content: "\e926"; +} + +.icon-ym-flow-line:before { + content: "\e912"; +} + +.icon-ym-header-refresh:before { + content: "\e913"; +} + +.icon-ym-shareMe-filled:before { + content: "\e914"; +} + +.icon-ym-share-filled:before { + content: "\e918"; +} + +.icon-ym-trash-filled:before { + content: "\e91a"; +} + +.icon-ym-header-lang:before { + content: "\e91b"; +} + +.icon-ym-app-entrust:before { + content: "\e91c"; +} + +.icon-ym-release:before { + content: "\e90e"; +} + +.icon-ym-star-filled:before { + content: "\e90f"; +} + +.icon-ym-header-role-toggle:before { + content: "\e906"; +} + +.icon-ym-light:before { + content: "\e908"; +} + +.icon-ym-header-fullscreen-exit:before { + content: "\e909"; +} + +.icon-ym-org-tree:before { + content: "\e90b"; +} + +.icon-ym-app-checkAll:before { + content: "\e90c"; +} + +.icon-ym-thumb-mode:before { + content: "\e905"; +} + +.icon-ym-generator-steps:before { + content: "\e7ed"; +} + +.icon-ym-portal-custom-echart:before { + content: "\e903"; +} + +.icon-ym-signature1:before { + content: "\e902"; +} + +.icon-ym-launch:before { + content: "\e901"; +} + +.icon-ym-turn:before { + content: "\e8fa"; +} + +.icon-ym-roll-call:before { + content: "\e8fb"; +} + +.icon-ym-comment-img:before { + content: "\e8fc"; +} + +.icon-ym-condition:before { + content: "\e8fd"; +} + +.icon-ym-generator-iframe:before { + content: "\e8fe"; +} + +.icon-ym-edit:before { + content: "\e8ff"; +} + +.icon-ym-comment-file:before { + content: "\e900"; +} + +.icon-ym-emoji:before { + content: "\e8f7"; +} + +.icon-ym-generator-location:before { + content: "\e8f8"; +} + +.icon-ym-synForThird:before { + content: "\e8f6"; +} + +.icon-ym-authGroup:before { + content: "\e8f2"; +} + +.icon-ym-fail:before { + content: "\e8f3"; +} + +.icon-ym-success:before { + content: "\e8f4"; +} + +.icon-ym-clock:before { + content: "\e8f5"; +} + +.icon-ym-view:before { + content: "\e8f1"; +} + +.icon-ym-shortcut:before { + content: "\e8f0"; +} + +.icon-ym-liveData:before { + content: "\e8ef"; +} + +.icon-ym-generator-autoComplete:before { + content: "\e8eb"; +} + +.icon-ym-portal-text:before { + content: "\e8ed"; +} + +.icon-ym-portal-mapChart:before { + content: "\e8ee"; +} + +.icon-ym-generator-tableGrid:before { + content: "\e8db"; +} + +.icon-ym-portal-card:before { + content: "\e8dc"; +} + +.icon-ym-portal-carousel:before { + content: "\e8dd"; +} + +.icon-ym-generator-insertCol:before { + content: "\e8de"; +} + +.icon-ym-generator-insertRow:before { + content: "\e8df"; +} + +.icon-ym-btn-batch:before { + content: "\e8e0"; +} + +.icon-ym-portal-collapse:before { + content: "\e8e1"; +} + +.icon-ym-portal-rankList:before { + content: "\e8e2"; +} + +.icon-ym-portal-image:before { + content: "\e8e3"; +} + +.icon-ym-portal-tab:before { + content: "\e8e4"; +} + +.icon-ym-portal-video:before { + content: "\e8e5"; +} + +.icon-ym-generator-TableSettings:before { + content: "\e8e6"; +} + +.icon-ym-btn-common:before { + content: "\e8e7"; +} + +.icon-ym-portal-iframe:before { + content: "\e8e8"; +} + +.icon-ym-portal-timeAxis:before { + content: "\e8e9"; +} + +.icon-ym-portal-schedule:before { + content: "\e8ea"; +} + +.icon-ym-flowEntrust-app:before { + content: "\e8da"; +} + +.icon-ym-btn-download:before { + content: "\e8d9"; +} + +.icon-ym-btn-upload:before { + content: "\e8d7"; +} + +.icon-ym-right:before { + content: "\e8d4"; +} + +.icon-ym-left:before { + content: "\e8d5"; +} + +.icon-ym-arrow-down:before { + content: "\e8d6"; +} + +.icon-ym-add-flow:before { + content: "\e8d8"; +} + +.icon-ym-launchFlow:before { + content: "\e8d2"; +} + +.icon-ym-funcFlow:before { + content: "\e8d3"; +} + +.icon-ym-accountConfig:before { + content: "\e8cb"; +} + +.icon-ym-sendConfig:before { + content: "\e8cc"; +} + +.icon-ym-smsConfig:before { + content: "\e8cd"; +} + +.icon-ym-emailConfig:before { + content: "\e8ce"; +} + +.icon-ym-msgCenter:before { + content: "\e8cf"; +} + +.icon-ym-msgTemplate:before { + content: "\e8d0"; +} + +.icon-ym-msgMonitor:before { + content: "\e8d1"; +} + +.icon-ym-logo-webhook:before { + content: "\e8ca"; +} + +.icon-ym-logo-github:before { + content: "\e8b0"; +} + +.icon-ym-logo-feishu:before { + content: "\e8c5"; +} + +.icon-ym-logo-dingding:before { + content: "\e8c6"; +} + +.icon-ym-logo-wechat:before { + content: "\e8c7"; +} + +.icon-ym-logo-qq:before { + content: "\e8c8"; +} + +.icon-ym-logo-wxWork:before { + content: "\e8c9"; +} + +.icon-ym-position1:before { + content: "\e8c3"; +} + +.icon-ym-generator-popupTableSelect:before { + content: "\e8c4"; +} + +.icon-ym-gradeManage:before { + content: "\e8c2"; +} + +.icon-ym-fold:before { + content: "\e829"; +} + +.icon-ym-customForm:before { + content: "\e857"; +} + +.icon-ym-branch:before { + content: "\e8b1"; +} + +.icon-ym-codeGeneration1:before { + content: "\e8b2"; +} + +.icon-ym-filter:before { + content: "\e8b3"; +} + +.icon-ym-download:before { + content: "\e8b4"; +} + +.icon-ym-functionForm:before { + content: "\e8b5"; +} + +.icon-ym-unfold:before { + content: "\e8b6"; +} + +.icon-ym-node:before { + content: "\e8b7"; +} + +.icon-ym-nav-home:before { + content: "\e8b8"; +} + +.icon-ym-systemForm:before { + content: "\e8b9"; +} + +.icon-ym-generator-link:before { + content: "\e8ba"; +} + +.icon-ym-timer:before { + content: "\e8bb"; +} + +.icon-ym-generator-alert:before { + content: "\e8bc"; +} + +.icon-ym-generator-group1:before { + content: "\e8bd"; +} + +.icon-ym-generator-role:before { + content: "\e8be"; +} + +.icon-ym-systemToggle:before { + content: "\e8bf"; +} + +.icon-ym-upload:before { + content: "\e8c0"; +} + +.icon-ym-generator-department1:before { + content: "\e8c1"; +} + +.icon-ym-signature:before { + content: "\e8af"; +} + +.icon-ym-yingyong:before { + content: "\e81e"; +} + +.icon-ym-generator-section:before { + content: "\e853"; +} + +.icon-ym-lianxi:before { + content: "\e873"; +} + +.icon-ym-bigScreenExampl:before { + content: "\e755"; +} + +.icon-ym-appForm:before { + content: "\e756"; +} + +.icon-ym-authorize:before { + content: "\e75c"; +} + +.icon-ym-dataApplication:before { + content: "\e75d"; +} + +.icon-ym-dataDictionary:before { + content: "\e76c"; +} + +.icon-ym-codeGeneration:before { + content: "\e76f"; +} + +.icon-ym-documentPreviewExample:before { + content: "\e77b"; +} + +.icon-ym-dataInterface:before { + content: "\e78f"; +} + +.icon-ym-bigScreenDesign:before { + content: "\e7a7"; +} + +.icon-ym-dataSync:before { + content: "\e7ab"; +} + +.icon-ym-extend:before { + content: "\e7b1"; +} + +.icon-ym-flowForm:before { + content: "\e7b2"; +} + +.icon-ym-dataModel:before { + content: "\e7bb"; +} + +.icon-ym-formExample:before { + content: "\e7c8"; +} + +.icon-ym-department:before { + content: "\e812"; +} + +.icon-ym-dataSource:before { + content: "\e816"; +} + +.icon-ym-flowLaunch:before { + content: "\e81b"; +} + +.icon-ym-flowForm1:before { + content: "\e81f"; +} + +.icon-ym-formDesign:before { + content: "\e827"; +} + +.icon-ym-highchartsWordcloud:before { + content: "\e82c"; +} + +.icon-ym-dataBackup:before { + content: "\e830"; +} + +.icon-ym-flowEntrust:before { + content: "\e831"; +} + +.icon-ym-role:before { + content: "\e832"; +} + +.icon-ym-information:before { + content: "\e834"; +} + +.icon-ym-portalDesign:before { + content: "\e83b"; +} + +.icon-ym-highchartsColumn:before { + content: "\e83c"; +} + +.icon-ym-onlineUser:before { + content: "\e83f"; +} + +.icon-ym-sysMonitor:before { + content: "\e842"; +} + +.icon-ym-sysCache:before { + content: "\e843"; +} + +.icon-ym-organization:before { + content: "\e845"; +} + +.icon-ym-flowTodo:before { + content: "\e847"; +} + +.icon-ym-pause:before { + content: "\e849"; +} + +.icon-ym-report-icon-preview-pageIndex:before { + content: "\e84c"; +} + +.icon-ym-sysProvince:before { + content: "\e850"; +} + +.icon-ym-sysNotice:before { + content: "\e851"; +} + +.icon-ym-wf-finishedProduct:before { + content: "\e852"; +} + +.icon-ym-reportExample:before { + content: "\e85d"; +} + +.icon-ym-wf-crmOrder:before { + content: "\e864"; +} + +.icon-ym-signetExample:before { + content: "\e866"; +} + +.icon-ym-position:before { + content: "\e867"; +} + +.icon-ym-permission:before { + content: "\e868"; +} + +.icon-ym-user:before { + content: "\e871"; +} + +.icon-ym-wf-expenseExpenditure:before { + content: "\e877"; +} + +.icon-ym-onlineDevelopment:before { + content: "\e87a"; +} + +.icon-ym-sysBillRule:before { + content: "\e88b"; +} + +.icon-ym-system:before { + content: "\e892"; +} + +.icon-ym-reportDesign:before { + content: "\e896"; +} + +.icon-ym-sysQuartz:before { + content: "\e897"; +} + +.icon-ym-workFlow:before { + content: "\e89e"; +} + +.icon-ym-sysIcon:before { + content: "\e8a4"; +} + +.icon-ym-huibao:before { + content: "\e8a5"; +} + +.icon-ym-webForm:before { + content: "\e8a6"; +} + +.icon-ym-wf-staffOvertime:before { + content: "\e8a7"; +} + +.icon-ym-tree-manage1:before { + content: "\e8a8"; +} + +.icon-ym-webDesign:before { + content: "\e8a9"; +} + +.icon-ym-wf-receiptSign:before { + content: "\e8aa"; +} + +.icon-ym-windows:before { + content: "\e8ab"; +} + +.icon-ym-systemTemplate:before { + content: "\e8ac"; +} + +.icon-ym-sysLog:before { + content: "\e8ad"; +} + +.icon-ym-sysConfig:before { + content: "\e8ae"; +} + +.icon-ym-header-pannel:before { + content: "\e7cf"; +} + +.icon-ym-search:before { + content: "\e804"; +} + +.icon-ym-header-message:before { + content: "\e810"; +} + +.icon-ym-generator-jobs:before { + content: "\e819"; +} + +.icon-ym-clean:before { + content: "\e83e"; +} + +.icon-ym-header-IM:before { + content: "\e899"; +} + +.icon-ym-header-language:before { + content: "\e8a3"; +} + +.icon-ym-flowDone-app:before { + content: "\e7a6"; +} + +.icon-ym-flowLaunch-app:before { + content: "\e7b3"; +} + +.icon-ym-addFlow:before { + content: "\e7b8"; +} + +.icon-ym-flowCopy-app:before { + content: "\e7bf"; +} + +.icon-ym-flowTodo-app:before { + content: "\e8a2"; +} + +.icon-ym-mobile:before { + content: "\e7dc"; +} + +.icon-ym-pc:before { + content: "\e7ee"; +} + +.icon-ym-video-play:before { + content: "\e8a1"; +} + +.icon-ym-header-collapse1:before { + content: "\e809"; +} + +.icon-ym-xitong:before { + content: "\e814"; +} + +.icon-ym-full-screen1:before { + content: "\e7d0"; +} + +.icon-ym-file-html1:before { + content: "\e7d1"; +} + +.icon-ym-generator-area:before { + content: "\e7d2"; +} + +.icon-ym-generator-modifytime:before { + content: "\e7d3"; +} + +.icon-ym-generator-fold:before { + content: "\e7d4"; +} + +.icon-ym-generator-founder:before { + content: "\e7d5"; +} + +.icon-ym-generator-line:before { + content: "\e7d6"; +} + +.icon-ym-generator-department:before { + content: "\e7d7"; +} + +.icon-ym-generator-function:before { + content: "\e7d8"; +} + +.icon-ym-generator-notice:before { + content: "\e7d9"; +} + +.icon-ym-generator-Provinces:before { + content: "\e7da"; +} + +.icon-ym-generator-popup-attr:before { + content: "\e7dd"; +} + +.icon-ym-generator-divider:before { + content: "\e7de"; +} + +.icon-ym-generator-radio:before { + content: "\e7df"; +} + +.icon-ym-generator-menu:before { + content: "\e7e0"; +} + +.icon-ym-generator-popup:before { + content: "\e7e1"; +} + +.icon-ym-generator-input:before { + content: "\e7e2"; +} + +.icon-ym-generator-rich-text:before { + content: "\e7e3"; +} + +.icon-ym-generator-Panel:before { + content: "\e7e4"; +} + +.icon-ym-generator-table:before { + content: "\e7e5"; +} + +.icon-ym-generator-radar:before { + content: "\e7e6"; +} + +.icon-ym-generator-password:before { + content: "\e7e7"; +} + +.icon-ym-generator-component:before { + content: "\e7e8"; +} + +.icon-ym-generator-station:before { + content: "\e7e9"; +} + +.icon-ym-generator-rate:before { + content: "\e7ea"; +} + +.icon-ym-generator-subFlow1:before { + content: "\e7eb"; +} + +.icon-ym-generator-number:before { + content: "\e7ec"; +} + +.icon-ym-generator-flow:before { + content: "\e7ef"; +} + +.icon-ym-generator-color:before { + content: "\e7f0"; +} + +.icon-ym-generator-label:before { + content: "\e7f1"; +} + +.icon-ym-generator-nature:before { + content: "\e7f2"; +} + +.icon-ym-generator-select:before { + content: "\e7f3"; +} + +.icon-ym-generator-slider:before { + content: "\e7f4"; +} + +.icon-ym-generator-qrcode:before { + content: "\e7f5"; +} + +.icon-ym-generator-group:before { + content: "\e7f6"; +} + +.icon-ym-generator-time:before { + content: "\e7f7"; +} + +.icon-ym-generator-user:before { + content: "\e7f8"; +} + +.icon-ym-generator-modifier:before { + content: "\e7f9"; +} + +.icon-ym-h5:before { + content: "\e7fa"; +} + +.icon-ym-generator-tree:before { + content: "\e7fb"; +} + +.icon-ym-gonggao:before { + content: "\e7fc"; +} + +.icon-ym-generator-kanban:before { + content: "\e7fd"; +} + +.icon-ym-generator-textarea:before { + content: "\e7fe"; +} + +.icon-ym-generator-todo:before { + content: "\e7ff"; +} + +.icon-ym-header-loginOut:before { + content: "\e800"; +} + +.icon-ym-header-expand:before { + content: "\e801"; +} + +.icon-ym-generator-time-range:before { + content: "\e802"; +} + +.icon-ym-header-lockScreen:before { + content: "\e803"; +} + +.icon-ym-generator-switch:before { + content: "\e805"; +} + +.icon-ym-header-feedBack:before { + content: "\e806"; +} + +.icon-ym-header-skins:before { + content: "\e807"; +} + +.icon-ym-global-role:before { + content: "\e808"; +} + +.icon-ym-highchartsBullet:before { + content: "\e80b"; +} + +.icon-ym-header-userInfo:before { + content: "\e80c"; +} + +.icon-ym-generator-upload:before { + content: "\e80d"; +} + +.icon-ym-generator-todolist:before { + content: "\e80e"; +} + +.icon-ym-highchartsArea:before { + content: "\e80f"; +} + +.icon-ym-highchartsFunnel:before { + content: "\e811"; +} + +.icon-ym-highcharts:before { + content: "\e813"; +} + +.icon-ym-header-about:before { + content: "\e815"; +} + +.icon-ym-importAndExportExample:before { + content: "\e817"; +} + +.icon-ym-highchartsScatter:before { + content: "\e818"; +} + +.icon-ym-header-language1:before { + content: "\e81a"; +} + +.icon-ym-mpMenu:before { + content: "\e81c"; +} + +.icon-ym-group:before { + content: "\e81d"; +} + +.icon-ym-nav-close:before { + content: "\e820"; +} + +.icon-ym-highchartsLine:before { + content: "\e821"; +} + +.icon-ym-ios:before { + content: "\e822"; +} + +.icon-ym-highchartsBellcurve:before { + content: "\e823"; +} + +.icon-ym-mpMaterial:before { + content: "\e824"; +} + +.icon-ym-mpMessage:before { + content: "\e825"; +} + +.icon-ym-message:before { + content: "\e826"; +} + +.icon-ym-java:before { + content: "\e828"; +} + +.icon-ym-orderDemo:before { + content: "\e82a"; +} + +.icon-ym-position-1:before { + content: "\e82b"; +} + +.icon-ym-nav-next:before { + content: "\e82d"; +} + +.icon-ym-projectExample:before { + content: "\e82f"; +} + +.icon-ym-mapExample:before { + content: "\e833"; +} + +.icon-ym-qyUser:before { + content: "\e835"; +} + +.icon-ym-scanCode1:before { + content: "\e836"; +} + +.icon-ym-report-icon-picture:before { + content: "\e837"; +} + +.icon-ym-mpConfig:before { + content: "\e838"; +} + +.icon-ym-options1:before { + content: "\e839"; +} + +.icon-ym-nav-prev:before { + content: "\e83a"; +} + +.icon-ym-scheduleExample:before { + content: "\e83d"; +} + +.icon-ym-Refresh:before { + content: "\e840"; +} + +.icon-ym-options:before { + content: "\e841"; +} + +.icon-ym-saolian:before { + content: "\e844"; +} + +.icon-ym-shezhi:before { + content: "\e846"; +} + +.icon-ym-sysMenu:before { + content: "\e848"; +} + +.icon-ym-barCodeExample:before { + content: "\e73b"; +} + +.icon-ym-sysLanguage:before { + content: "\e84a"; +} + +.icon-ym-report-icon-pie:before { + content: "\e84b"; +} + +.icon-ym-bigScreenExample1:before { + content: "\e73e"; +} + +.icon-ym-bigDataExample:before { + content: "\e73f"; +} + +.icon-ym-orderExample:before { + content: "\e84d"; +} + +.icon-ym-preview-excel-paging:before { + content: "\e84e"; +} + +.icon-ym-btn-import:before { + content: "\e741"; +} + +.icon-ym-tableExample:before { + content: "\e84f"; +} + +.icon-ym-btn-collapse:before { + content: "\e742"; +} + +.icon-ym-btn-edit:before { + content: "\e743"; +} + +.icon-ym-chartExample:before { + content: "\e744"; +} + +.icon-ym-btn-refresh:before { + content: "\e746"; +} + +.icon-ym-tree-department:before { + content: "\e855"; +} + +.icon-ym-checktriangle:before { + content: "\e747"; +} + +.icon-ym-btn-fields:before { + content: "\e748"; +} + +.icon-ym-tree-department2:before { + content: "\e858"; +} + +.icon-ym-btn-export:before { + content: "\e749"; +} + +.icon-ym-tree-normal1:before { + content: "\e859"; +} + +.icon-ym-btn-preview:before { + content: "\e74a"; +} + +.icon-ym-tree-normal:before { + content: "\e85a"; +} + +.icon-ym-tree-organization3:before { + content: "\e85b"; +} + +.icon-ym-btn-add:before { + content: "\e74c"; +} + +.icon-ym-tree-position2:before { + content: "\e85c"; +} + +.icon-ym-btn-expand:before { + content: "\e74e"; +} + +.icon-ym-tree-user2:before { + content: "\e85e"; +} + +.icon-ym-daiban1:before { + content: "\e74f"; +} + +.icon-ym-tree-department1:before { + content: "\e85f"; +} + +.icon-ym-daka:before { + content: "\e750"; +} + +.icon-ym-tableExample1:before { + content: "\e860"; +} + +.icon-ym-tree-manage:before { + content: "\e861"; +} + +.icon-ym-android:before { + content: "\e752"; +} + +.icon-ym-wf-applyDeliverGoods:before { + content: "\e862"; +} + +.icon-ym-darg:before { + content: "\e753"; +} + +.icon-ym-wechat1:before { + content: "\e863"; +} + +.icon-ym-duties:before { + content: "\e754"; +} + +.icon-ym-tree-position1:before { + content: "\e865"; +} + +.icon-ym-echartsColumn:before { + content: "\e757"; +} + +.icon-ym-delete:before { + content: "\e758"; +} + +.icon-ym-echartsCandlestick:before { + content: "\e759"; +} + +.icon-ym-visual-studio:before { + content: "\e869"; +} + +.icon-ym-btn-remove:before { + content: "\e75a"; +} + +.icon-ym-wf-conBilling:before { + content: "\e86a"; +} + +.icon-ym-echartsFunnel:before { + content: "\e75b"; +} + +.icon-ym-wf-batchPack:before { + content: "\e86b"; +} + +.icon-ym-tree-department-1:before { + content: "\e86c"; +} + +.icon-ym-wf-articlesWarehous:before { + content: "\e86d"; +} + +.icon-ym-emailExample:before { + content: "\e75e"; +} + +.icon-ym-wf-applyMeeting:before { + content: "\e86e"; +} + +.icon-ym-dingdang:before { + content: "\e75f"; +} + +.icon-ym-wf-batchTable:before { + content: "\e86f"; +} + +.icon-ym-echartsLineArea:before { + content: "\e760"; +} + +.icon-ym-wf-applyBanquet:before { + content: "\e870"; +} + +.icon-ym-crm:before { + content: "\e761"; +} + +.icon-ym-extend-ambulance:before { + content: "\e762"; +} + +.icon-ym-wf-documentApproval:before { + content: "\e872"; +} + +.icon-ym-echartsScatter:before { + content: "\e763"; +} + +.icon-ym-wf-archivalBorrow:before { + content: "\e874"; +} + +.icon-ym-dbLink:before { + content: "\e764"; +} + +.icon-ym-wf-debitBill:before { + content: "\e875"; +} + +.icon-ym-dot-net:before { + content: "\e765"; +} + +.icon-ym-weChat:before { + content: "\e876"; +} + +.icon-ym-extend-exclamation-triangle:before { + content: "\e766"; +} + +.icon-ym-btn-copy:before { + content: "\e767"; +} + +.icon-ym-wf-contractApproval:before { + content: "\e879"; +} + +.icon-ym-documentExample:before { + content: "\e768"; +} + +.icon-ym-echartsLineBar:before { + content: "\e769"; +} + +.icon-ym-wf-documentSigning:before { + content: "\e87b"; +} + +.icon-ym-extend-clock:before { + content: "\e76a"; +} + +.icon-ym-wf-contractApprovalSheet:before { + content: "\e87d"; +} + +.icon-ym-extend-check-circle-o:before { + content: "\e76b"; +} + +.icon-ym-wf-leaveApply:before { + content: "\e87f"; +} + +.icon-ym-wf-letterService:before { + content: "\e880"; +} + +.icon-ym-erweima:before { + content: "\e76d"; +} + +.icon-ym-wf-officeSupplies:before { + content: "\e881"; +} + +.icon-ym-echartsBarAcross:before { + content: "\e76e"; +} + +.icon-ym-wf-payDistribution:before { + content: "\e882"; +} + +.icon-ym-wf-incomeRecognition:before { + content: "\e883"; +} + +.icon-ym-extend-eye:before { + content: "\e770"; +} + +.icon-ym-wf-postBatchTab:before { + content: "\e884"; +} + +.icon-ym-extend-circle:before { + content: "\e771"; +} + +.icon-ym-wf-quotationApproval:before { + content: "\e885"; +} + +.icon-ym-extend-bar-chart:before { + content: "\e772"; +} + +.icon-ym-wf-rewardPunishment:before { + content: "\e886"; +} + +.icon-ym-extend-mail-forward:before { + content: "\e773"; +} + +.icon-ym-wf-monthlyReport:before { + content: "\e887"; +} + +.icon-ym-extend-car:before { + content: "\e774"; +} + +.icon-ym-wf-materialRequisition:before { + content: "\e888"; +} + +.icon-ym-extend-meh:before { + content: "\e775"; +} + +.icon-ym-wf-procurementMaterial:before { + content: "\e889"; +} + +.icon-ym-extend-cog:before { + content: "\e776"; +} + +.icon-ym-wf-outboundOrder:before { + content: "\e88a"; +} + +.icon-ym-extend-minus-circle:before { + content: "\e777"; +} + +.icon-ym-echartsPie:before { + content: "\e778"; +} + +.icon-ym-wf-receiptProcessing:before { + content: "\e88c"; +} + +.icon-ym-extend-envelope:before { + content: "\e779"; +} + +.icon-ym-wf-salesOrder:before { + content: "\e88d"; +} + +.icon-ym-compress-screen:before { + content: "\e77a"; +} + +.icon-ym-wf-salesSupport:before { + content: "\e88e"; +} + +.icon-ym-wf-travelApply:before { + content: "\e88f"; +} + +.icon-ym-echartsTree:before { + content: "\e77c"; +} + +.icon-ym-wf-paymentApply:before { + content: "\e890"; +} + +.icon-ym-extend-star-o:before { + content: "\e77d"; +} + +.icon-ym-wf-violationHandling:before { + content: "\e891"; +} + +.icon-ym-extend-paper-plane:before { + content: "\e77e"; +} + +.icon-ym-extend-history:before { + content: "\e77f"; +} + +.icon-ym-wf-purchaseList:before { + content: "\e893"; +} + +.icon-ym-echartsGauge:before { + content: "\e780"; +} + +.icon-ym-wf-warehouseReceipt:before { + content: "\e894"; +} + +.icon-ym-extend-edit:before { + content: "\e781"; +} + +.icon-ym-wf-workContactSheet:before { + content: "\e895"; +} + +.icon-ym-extend-plane:before { + content: "\e782"; +} + +.icon-ym-file-blank:before { + content: "\e783"; +} + +.icon-ym-extend-folder-open:before { + content: "\e784"; +} + +.icon-ym-wf-travelReimbursement:before { + content: "\e898"; +} + +.icon-ym-extend-thumbs-up:before { + content: "\e785"; +} + +.icon-ym-extend-truck:before { + content: "\e786"; +} + +.icon-ym-wf-supplementCard:before { + content: "\e89a"; +} + +.icon-ym-extend-folder:before { + content: "\e787"; +} + +.icon-ym-zhanghao:before { + content: "\e89b"; +} + +.icon-ym-extend-paperclip:before { + content: "\e788"; +} + +.icon-ym-zuzhi:before { + content: "\e89c"; +} + +.icon-ym-extend-star:before { + content: "\e789"; +} + +.icon-ym-xingcheng:before { + content: "\e89d"; +} + +.icon-ym-extend-train:before { + content: "\e78a"; +} + +.icon-ym-extend-motorcycle:before { + content: "\e78b"; +} + +.icon-ym-wf-vehicleApply:before { + content: "\e89f"; +} + +.icon-ym-file-photo:before { + content: "\e78c"; +} + +.icon-ym-zujian:before { + content: "\e8a0"; +} + +.icon-ym-extend-subway:before { + content: "\e78d"; +} + +.icon-ym-extend-envelope-open-o:before { + content: "\e78e"; +} + +.icon-ym-file-csv1:before { + content: "\e790"; +} + +.icon-ym-extend-pencil:before { + content: "\e791"; +} + +.icon-ym-extend-bicycle:before { + content: "\e792"; +} + +.icon-ym-extend-save:before { + content: "\e793"; +} + +.icon-ym-extend-trash:before { + content: "\e795"; +} + +.icon-ym-extend-bus:before { + content: "\e796"; +} + +.icon-ym-file-eps:before { + content: "\e797"; +} + +.icon-ym-file-ai:before { + content: "\e798"; +} + +.icon-ym-extend-share:before { + content: "\e799"; +} + +.icon-ym-file-audio:before { + content: "\e79b"; +} + +.icon-ym-file-word:before { + content: "\e79c"; +} + +.icon-ym-file-pdf:before { + content: "\e79d"; +} + +.icon-ym-file-code:before { + content: "\e79f"; +} + +.icon-ym-flowCirculate:before { + content: "\e7a1"; +} + +.icon-ym-file-ppt:before { + content: "\e7a4"; +} + +.icon-ym-file-video:before { + content: "\e7a5"; +} + +.icon-ym-file-zip:before { + content: "\e7a8"; +} + +.icon-ym-flowDone:before { + content: "\e7a9"; +} + +.icon-ym-file-psd:before { + content: "\e7aa"; +} + +.icon-ym-gangwei2:before { + content: "\e7ac"; +} + +.icon-ym-full-screen:before { + content: "\e7ad"; +} + +.icon-ym-file-rar:before { + content: "\e7ae"; +} + +.icon-ym-file-visio-1:before { + content: "\e7af"; +} + +.icon-ym-file-movie:before { + content: "\e7b0"; +} + +.icon-ym-generator-barcode:before { + content: "\e7b4"; +} + +.icon-ym-flowDesign:before { + content: "\e7b5"; +} + +.icon-ym-formExample1:before { + content: "\e7b7"; +} + +.icon-ym-file-xml:before { + content: "\e7b9"; +} + +.icon-ym-flowMonitor:before { + content: "\e7ba"; +} + +.icon-ym-extend-rocket:before { + content: "\e7bc"; +} + +.icon-ym-file-image:before { + content: "\e7bd"; +} + +.icon-ym-generator-bar:before { + content: "\e7be"; +} + +.icon-ym-generator-date-range:before { + content: "\e7c0"; +} + +.icon-ym-generator-date:before { + content: "\e7c1"; +} + +.icon-ym-generator-card:before { + content: "\e7c2"; +} + +.icon-ym-file-visio:before { + content: "\e7c3"; +} + +.icon-ym-generator-dictionary:before { + content: "\e7c4"; +} + +.icon-ym-generator-email:before { + content: "\e7c5"; +} + +.icon-ym-generator-company:before { + content: "\e7c6"; +} + +.icon-ym-generator-annular:before { + content: "\e7c7"; +} + +.icon-ym-generator-button:before { + content: "\e7c9"; +} + +.icon-ym-generator-count:before { + content: "\e7ca"; +} + +.icon-ym-generator-layout:before { + content: "\e7cb"; +} + +.icon-ym-file-excel:before { + content: "\e7cc"; +} + +.icon-ym-generator-cascader:before { + content: "\e7cd"; +} + +.icon-ym-generator-checkbox:before { + content: "\e7ce"; +} + +.icon-ym-highchartsGauge:before { + content: "\e856"; +} + +.icon-ym-wf-outgoingApply:before { + content: "\e854"; +} + +.icon-ym-mac:before { + content: "\e7db"; +} + +.icon-ym-appDesign:before { + content: "\e6f9"; +} + +.icon-ym-generator-pie:before { + content: "\e60b"; +} + +.icon-ym-scanCode:before { + content: "\e87e"; +} + +.icon-ym-mpUser:before { + content: "\e794"; +} + +.icon-ym-printExample:before { + content: "\e79a"; +} + +.icon-ym-qyOrg:before { + content: "\e79e"; +} + +.icon-ym-qyMessage:before { + content: "\e7a0"; +} + +.icon-ym-generator-subFlow:before { + content: "\e61b"; +} + +.icon-ym-reportExample1:before { + content: "\e7a2"; +} + +.icon-ym-qyConfig:before { + content: "\e7a3"; +} + +.icon-ym-saoyisao:before { + content: "\e623"; +} + +.icon-ym-highcharts-Pie:before { + content: "\e7b6"; +} + +.icon-ym-report-icon-area:before { + content: "\e63e"; +} + +.icon-ym-report-icon-arrow-down:before { + content: "\e63f"; +} + +.icon-ym-report-icon-align-left:before { + content: "\e640"; +} + +.icon-ym-report-icon-align-top:before { + content: "\e641"; +} + +.icon-ym-report-icon-border-all:before { + content: "\e642"; +} + +.icon-ym-report-icon-align-bottom:before { + content: "\e643"; +} + +.icon-ym-report-icon-align-right:before { + content: "\e644"; +} + +.icon-ym-report-icon-bold:before { + content: "\e645"; +} + +.icon-ym-report-icon-border-bottom:before { + content: "\e646"; +} + +.icon-ym-report-icon-align-center:before { + content: "\e647"; +} + +.icon-ym-report-icon-border-right:before { + content: "\e648"; +} + +.icon-ym-report-icon-bubble:before { + content: "\e649"; +} + +.icon-ym-report-icon-diagram:before { + content: "\e64a"; +} + +.icon-ym-report-icon-enlarge:before { + content: "\e64b"; +} + +.icon-ym-report-icon-align-middle:before { + content: "\e64c"; +} + +.icon-ym-report-icon-preview-pagePre:before { + content: "\e64e"; +} + +.icon-ym-report-icon-border-left:before { + content: "\e64f"; +} + +.icon-ym-report-icon-font:before { + content: "\e652"; +} + +.icon-ym-report-icon-border-top:before { + content: "\e653"; +} + +.icon-ym-report-icon-background-color:before { + content: "\e656"; +} + +.icon-ym-report-icon-border-custom:before { + content: "\e657"; +} + +.icon-ym-report-icon-horizontal-column:before { + content: "\e65c"; +} + +.icon-ym-report-icon-column:before { + content: "\e65d"; +} + +.icon-ym-report-icon-font-type:before { + content: "\e65e"; +} + +.icon-ym-report-icon-import-excel:before { + content: "\e65f"; +} + +.icon-ym-report-icon-restore:before { + content: "\e662"; +} + +.icon-ym-report-icon-oblique-head:before { + content: "\e663"; +} + +.icon-ym-report-icon-preview-pdf:before { + content: "\e664"; +} + +.icon-ym-report-icon-preview-pageNext:before { + content: "\e665"; +} + +.icon-ym-report-icon-preview-print:before { + content: "\e666"; +} + +.icon-ym-report-icon-preview-pageLast:before { + content: "\e667"; +} + +.icon-ym-report-icon-preview-excel-paging:before { + content: "\e669"; +} + +.icon-ym-report-icon-radar:before { + content: "\e66a"; +} + +.icon-ym-report-icon-border-none:before { + content: "\e66b"; +} + +.icon-ym-report-icon-preview-word:before { + content: "\e66c"; +} + +.icon-ym-report-icon-scatter:before { + content: "\e66f"; +} + +.icon-ym-report-icon-preview-printPreview:before { + content: "\e670"; +} + +.icon-ym-report-icon-preview-excel-with-paging-sheet:before { + content: "\e671"; +} + +.icon-ym-report-icon-fontsize:before { + content: "\e672"; +} + +.icon-ym-report-icon-search-setting:before { + content: "\e673"; +} + +.icon-ym-report-icon-preview-excel:before { + content: "\e674"; +} + +.icon-ym-report-icon-undo:before { + content: "\e675"; +} + +.icon-ym-report-icon-shrink:before { + content: "\e676"; +} + +.icon-ym-report-icon-configuration:before { + content: "\e677"; +} + +.icon-ym-report-icon-preview-refresh:before { + content: "\e678"; +} + +.icon-ym-report-icon-underline:before { + content: "\e679"; +} + +.icon-ym-report-icon-italic:before { + content: "\e67b"; +} + +.icon-ym-report-icon-preview-printPdf:before { + content: "\e67c"; +} + +.icon-ym-report-icon-merge-cell:before { + content: "\e67a"; +} + +.icon-ym-report-icon-polar-plot:before { + content: "\e650"; +} + +.icon-ym-report-icon-page-preview:before { + content: "\e668"; +} + +.icon-ym-report-icon-doughnut:before { + content: "\e66e"; +} + +.icon-ym-report-icon-preview:before { + content: "\e655"; +} + +.icon-ym-pageDesign:before { + content: "\e684"; +} + +.icon-ym-customUrl:before { + content: "\e685"; +} + +.icon-ym-btn-clearn:before { + content: "\e80a"; +} + +.icon-ym-tree-organization1:before { + content: "\e82e"; +} + +.icon-ym-generator-documents:before { + content: "\e878"; +} + +.icon-ym-generator-createtime:before { + content: "\e87c"; +} \ No newline at end of file diff --git a/assets/scss/common.scss b/assets/scss/common.scss new file mode 100644 index 0000000..ad891c5 --- /dev/null +++ b/assets/scss/common.scss @@ -0,0 +1,1265 @@ +.portal-nodata { + position: absolute; + top: 450rpx; + width: 100%; + text-align: center; + z-index: 100; + background-color: #f0f2f6; + .portal-nodata-inner{ + align-items: center; + .portal-nodata-text{ + color: #909399; + } + } + } + .tree-main { + .ly-tree-node__icon { + width: 60rpx; + height: 60rpx !important; + overflow: hidden; + margin-right: 16rpx; + border-radius: 100rpx; + } + } + + .uni-page-head-hd { + .uni-page-head-ft { + padding-left: 20rpx; + + .uni-page-head-btn { + width: 48rpx; + height: 48rpx; + background: #f0f2f6 !important; + line-height: 58rpx; + text-align: center; + border-radius: 50%; + margin: 0; + } + } + } + + .u-model__content__message { + word-break: break-all; + } + + .u-input__input { + color: #606266 !important; + } + + .u-select__header { + position: relative; + &::after { + content: ""; + position: absolute; + border-bottom: 0.5px solid #eaeef1; + -webkit-transform: scaleY(0.5); + transform: scaleY(0.5); + bottom: 0; + right: 0; + left: 0; + } + } + + .u-input__textarea { + padding: 18rpx 0 !important; + } + + .u-select__body__multiple { + .u-checkbox-group, + .u-radio-group { + width: 100%; + padding: 0 30rpx; + + .u-checkbox, + .u-radio { + width: 100% !important; + height: 70rpx; + } + + .u-checkbox__label, + .u-radio__label { + flex: 1; + margin-left: 40rpx; + } + } + } + + .jnpf-city-select { + .u-close { + line-height: 1; + } + } + + .u-select__body__treeSelect { + height: 780rpx !important; + + .treeSelect-search { + padding: 20rpx 40rpx 0; + } + + .u-select-head { + width: 100%; + height: 100rpx; + align-items: center; + padding: 0 16rpx !important; + + .backIcon { + font-size: 40rpx; + color: #000; + } + + .title { + width: 100%; + height: 100%; + text-align: center; + } + } + } + + .swiper-box { + .ly-tree-node__icon { + // height: 70rpx; + } + } + + .popup-content, + .user-select { + .ly-tree { + padding: 10rpx 0 0 0 !important; + } + + .ly-tree-node__icon { + /* #ifdef APP */ + line-height: 40rpx; + /* #endif */ + /* #ifndef APP */ + line-height: 74rpx; + /* #endif */ + height: 70rpx; + } + } + + .buttom-actions { + position: fixed; + z-index: 20; + bottom: 0; + } + + .buttom-actions, + .flowBefore-actions { + background-color: #fff; + position: fixed; + bottom: 0; + display: flex; + width: 100%; + height: 88rpx; + box-shadow: 0 -2rpx 8rpx #e1e5ec; + z-index: 20; + .buttom-btn-left-inner{ + width: 30%; + align-items: center; + justify-content: space-evenly; + height: 88rpx; + } + .reject{ + color: #fff; + /* #ifdef MP-WEIXIN */ + width: 100% !important; + /* #endif */ + /* #ifndef APP */ + width: 30%; + /* #endif */ + background-color: #ED6F6F; + } + .rightBtn{ + flex: 1; + } + .buttom-btn { + width: 100%; + /* #ifndef MP */ + height: 88rpx !important; + line-height: 88rpx !important; + border-radius: 0 !important; + + &::after { + border: none !important; + } + + /* #endif */ + /* #ifdef MP */ + .u-btn { + width: 100%; + height: 88rpx !important; + line-height: 88rpx !important; + border-radius: 0 !important; + + &::after { + border: none !important; + } + } + + /* #endif */ + } + } + .workFlow-list { + + .part { + background: #fff; + margin-bottom: 20rpx; + + .caption { + padding: 0 32rpx; + font-size: 36rpx; + line-height: 100rpx; + font-weight: bold; + } + .item { + padding: 1rem 0; + width: 25%; + + .item-icon { + width: 88rpx; + height: 88rpx; + margin-bottom: 8rpx; + line-height: 88rpx; + text-align: center; + border-radius: 30rpx; + color: #fff; + font-size: 40rpx; + + &.more { + background: #ececec; + color: #666666; + font-size: 50rpx; + } + } + + .item-text { + width: 100%; + text-align: center; + padding: 0 16rpx; + } + } + } + } + .apply-v { + .banner { + .u-indicator-item-round.u-indicator-item-round-active { + background-color: $u-type-primary; + } + } + } + .flow-list { + .uni-swipe { + margin-bottom: 20rpx; + border-radius: 8rpx; + + .item { + border-radius: 0 !important; + } + } + + .flow-list-box { + margin: 20rpx; + + .u-swipe-content { + width: calc(100% - 180rpx); + } + + .u-swipe-action { + border-radius: 20rpx; + margin-bottom: 20rpx; + } + + .item { + width: 100%; + display: flex; + flex-direction: row; + padding: 20rpx 20rpx; + background-color: #fff; + border-radius: 8rpx; + height: 170rpx; + + .item-left { + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-start; + overflow: hidden; + text-overflow: ellipsis; + + .title { + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + color: #303133; + + .titInner { + // margin-left: 10rpx; + color: #606266; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 50px; + } + } + } + + .item-right { + display: flex; + align-items: center; + justify-content: flex-end; + + .item-right-img { + width: 102rpx; + } + } + } + } + + &.flowBefore .item { + margin-bottom: 20rpx; + } + } + .flow-v { + .flow-list-box { + width: 95%; + margin: 20rpx; + } + .u-tab-bar { + bottom: -6rpx !important; + } + .flow-tabs{ + border-bottom: 1rpx solid #EEF0F4; + } + .flow-status-tabs{ + padding: 12rpx 20rpx; + background-color:#fff + } + } + .search-box { + padding: 20rpx; + } + .notice-warp { + z-index: 9; + position: fixed; + top: var(--window-top); + left: 0; + width: 100%; + height: 200rpx; + /*对应mescroll-body的top值*/ + font-size: 26rpx; + text-align: center; + background-color: #fff; + } + .search-box_sticky { + z-index: 990; + position: sticky; + top: var(--window-top); + background-color: #fff; + } + + .copyright { + position: fixed; + bottom: 40rpx; + left: 0; + right: 0; + text-align: center; + color: #A2A7BE; + font-size: 26rpx; + } + + .com-addBtn { + width: 76rpx; + height: 76rpx; + border-radius: 50%; + background-color: rgba(41, 121, 255, 0.7); + position: fixed; + bottom: 9rem; + right: 40rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 100; + } + .com-batch{ + width: 76rpx; + height: 76rpx; + border-radius: 50%; + background-color: #ffffff; + position: fixed; + bottom: 6rem; + right: 40rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 10; + } + + .com-saveBox { + width: 100%; + position: fixed; + bottom: 30rpx; + left: 0; + padding: 0 20rpx; + } + + .u-dropdown__content { + transition: none !important; + } + + .com-dropdown { + + .u-dropdown__content__popup, + .u-dropdown-item { + height: 100%; + /* #ifndef APP-HARMONY */ + // height: 100%; + /* #endif */ + + } + } + + .u-input { + align-items: center; + } + + .dropdown-slot-content { + height: 100%; + display: flex; + flex-direction: column; + + .dropdown-slot-content-main { + background-color: #fff; + height: 100%; + overflow: auto; + + &.search-main { + overflow: hidden; + } + + .search-form { + height: calc(100% - 88rpx); + overflow: auto; + + .u-form { + .u-form-item { + min-height: 112rpx; + } + } + } + } + + .buttom-actions { + position: static !important; + box-shadow: none; + } + + .dropdown-slot-bg { + flex: 1; + opacity: 0; + } + } + + .slider-badge-button { + padding: 4rpx 6rpx; + background-color: $u-type-primary; + color: #fff; + border-radius: 10rpx; + font-size: 22rpx; + line-height: 1; + } + + /* #ifdef MP */ + .u-form-item-switch { + padding-top: 26rpx; + box-sizing: border-box; + height: 70rpx; + } + + /* #endif */ + .dynamicModel-list-v, + .order-v { + height: 100%; + display: flex; + flex-direction: column; + + .head-warp { + background-color: #fff; + } + + .list-warp { + flex: 1; + min-width: 0; + min-height: 0; + + .mescroll-empty { + padding: 400rpx 27px; + } + } + + .list { + .list-box { + width: 100%; + + + .uni-swipe { + margin-top: 20rpx; + border-radius: 8rpx; + } + + .u-swipe-content { + width: calc(100% - 180rpx); + } + + .u-swipe-action { + border-radius: 10rpx; + margin-bottom: 20rpx; + } + + .item { + height: 100%; + background-color: #fff; + padding: 20rpx 20rpx 0 20rpx !important; + + .uni-collapse-item__title-box { + padding: 0 26rpx; + + .uni-collapse-item__title-text { + font-size: 28rpx; + } + } + + .item-cell-c { + padding-top: 20rpx; + border-bottom: 1px solid #efefef; + } + + .item-cell { + font-size: 24rpx; + color: #303133; + margin-bottom: 20rpx; + display: flex; + align-items: center; + + + .item-cell-label { + width: 124rpx; + text-align: right; + margin-right: 10rpx; + flex-shrink: 0; + word-break: break-all; + } + + .item-cell-content { + color: #606266; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + flex: 1; + + .jnpf-rate { + justify-content: flex-start; + } + + &.item-cell-slider { + height: 36rpx; + padding: 16rpx 20rpx 0; + margin: 0 -20rpx; + } + } + + .text-primary { + color: #1890ff; + } + + .item-cell-children { + padding-top: 10px; + border-bottom: 1px solid #efefef; + } + + .loadMore { + color: #379dfa; + text-align: center; + height: 80rpx; + line-height: 80rpx; + } + + .tableCell { + width: 100%; + } + + .uni-collapse-item-border { + border: 0 !important; + } + + .uni-collapse-item--border { + border-bottom-width: 0 !important; + } + } + } + } + } + } + .dynamicModel-list-v,.order-v{ + .screen-box { + background-color: #fff; + height: 100%; + .screen-btn { + width: 100%; + height: 2.75rem; + + .btn { + width: 50%; + height: 2.75rem; + text-align: center; + line-height: 2.75rem; + box-shadow: 0px -4rpx 20rpx #F8F8F8 + } + + .btn1 { + color: #606266; + } + + .btn2 { + background-color: #2979ff; + color: #fff; + } + } + + .screen-list { + width: 100%; + height: 100%; + + .list { + height: calc(100% - 88rpx); + overflow-y: scroll; + } + } + } + } + + .order-v { + height: 100%; + display: flex; + flex-direction: column; + + .mescroll-empty { + padding: 211px 27px + } + + .head-warp { + background-color: #fff; + } + + .list-warp { + flex: 1; + min-width: 0; + min-height: 0; + + .flow-list { + margin: 0 20rpx; + + :deep(.uni-swipe) { + border-radius: 10rpx; + } + + .order-item { + background-color: #fff; + padding: 0 32rpx; + + .order-item-down { + .order-item-cell { + font-size: 28rpx; + color: #333333; + justify-content: space-between; + padding: 10rpx 0; + } + } + + .order-item-title { + height: 90rpx; + line-height: 90rpx; + width: 100%; + font-size: 30rpx; + + .order-title { + display: block; + } + } + } + } + } + } + + .uni-input-wrapper { + color: #606266 !important; + } + + .jnpf-detail-text { + text-align: right; + width: 100%; + word-break: break-all; + color: #606266; + } + + .preview-image-box { + width: 100%; + display: flex; + justify-content: flex-end; + flex-wrap: wrap; + + .u-preview-image { + width: 146rpx; + height: 146rpx; + margin-left: 20rpx; + border-radius: 10rpx; + } + } + + .editor-box { + width: 100%; + word-break: break-all; + } + + .jnpf-wrap { + .jnpf-table-addBtn { + color: #2979ff; + height: 88rpx; + text-align: center; + line-height: 88rpx; + font-size: 28rpx; + background-color: #fff; + } + .u-form { + .u-form-item { + min-height: 112rpx; + } + + .form-item-box { + background-color: #fff; + } + } + + .jnpf-card { + margin: 20rpx 0; + + &+.jnpf-table { + margin-top: -20rpx; + } + + .jnpf-card-cap { + min-height: 80rpx; + margin-top: -20rpx; + line-height: 80rpx; + font-size: 26rpx; + padding: 0 20rpx; + } + } + + .jnpf-group+.jnpf-card { + margin-top: 0; + } + + .jnpf-text+.jnpf-card { + margin-top: 0; + } + + .step-container{ + background-color: #fff; + padding: 10px 0; + width: 100%; + overflow-x: scroll; + .u-steps .u-steps__item{ + min-width: unset; + margin:0 2px; + } + .u-steps .u-steps__item .u-steps__item__text--row{ + width: 70px; + } + } + + &.jnpf-wrap-form { + padding-bottom: 88rpx; + } + + .u-form-item { + background-color: #fff; + box-sizing: border-box; + padding: 20rpx !important; + + .u-form-item--right__content { + height: 100%; + } + } + } + + .jnpf-table { + margin-bottom: 0.625rem; + + .jnpf-table-title { + flex: 1; + min-width: 0; + padding: 20rpx; + } + + .jnpf-table-item-title { + width: 100%; + font-size: 26rpx; + display: flex; + justify-content: space-between; + padding: 20rpx; + + .jnpf-table-item-title-num { + flex: 1; + } + + .jnpf-table-delete-btn { + color: #fa3534; + flex-shrink: 0; + padding-left: 20rpx; + } + + .jnpf-table-copy-btn { + color: #2979ff; + flex-shrink: 0; + } + } + + .jnpf-table-footer-btn { + background-color: #fff; + display: flex; + flex-wrap: nowrap; + padding: 20rpx; + + .jnpf-table-btn { + margin: 0; + flex: 1; + flex-shrink: 0; + min-width: 0; + display: flex; + align-items: center; + justify-content: center; + color: #303133; + + .jnpf-table-btn-icon { + padding-right: 8rpx; + } + + .jnpf-table-btn-text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + + .jnpf-table-btn:not(:last-child) { + padding-right: 10rpx; + } + + .jnpf-table-text-btn, + .jnpf-table-primary-btn { + color: $u-type-primary; + } + + .jnpf-table-success-btn { + color: $u-type-success; + } + + .jnpf-table-info-btn { + color: $u-type-info; + } + + .jnpf-table-warning-btn { + color: $u-type-warning; + } + + .jnpf-table-danger-btn { + color: $u-type-error; + } + } + } + + .jnpf-checkbox { + width: 100%; + display: flex; + justify-content: flex-end; + + .u-checkbox { + justify-content: flex-end; + flex: unset !important; + + .u-checkbox__label { + line-height: 1.5; + } + } + } + + .jnpf-radio { + width: 100%; + display: flex; + justify-content: flex-end; + + .u-radio { + justify-content: flex-end; + flex: unset !important; + + .u-radio__label { + line-height: 1.5; + } + } + } + + .link-style { + + :deep(.uni-input-wrapper), + .u-input__input { + color: #1890ff !important; + text-decoration: underline; + cursor: pointer !important; + -webkit-text-fill-color: #1890ff !important; + } + } + + .screen-box { + background-color: #fff; + height: 100%; + + .screen-list { + width: 100%; + height: 100%; + + .list { + height: calc(100% - 88rpx); + overflow-y: scroll; + } + } + } + .opinion{ + .opinion-box { + ::v-deep .uni-easyinput { + .uni-easyinput__content { + background: #f5f5f5 !important; + } + } + } + } + .flowStep{ + ::v-deep .u-time-axis-item { + margin-bottom: 0 !important; + /* #ifdef MP */ + padding-bottom: 20rpx; + /* #endif */ + } + } + .diyPopup,.personalData-v{ + .popup-dialog { + .uni-dialog-title { + height: 80rpx; + background-color: #f2f2f2; + border-bottom: 1px solid #f0f2f6; + padding: 0 20rpx; + line-height: 80rpx; + justify-content: left; + border-radius: 20rpx 20rpx 0 0; + + .uni-popup__info { + color: #333; + } + } + + .uni-dialog-content { + padding: 0 20rpx; + } + + .uni-dialog-button-group { + .uni-border-left { + background-color: #409eff; + border-radius: 0 0 20rpx 0; + + .uni-button-color { + color: #fff; + } + } + } + } + } + .dynamicModel-form-v{ + .buttom-btn-left-inner { + width: 50%; + } + .dataLog-box { + width: 100%; + background-color: #fff; + + .title { + height: 80rpx; + margin-bottom: 20rpx; + border-bottom: 1rpx solid #ebebeb; + padding: 0 20rpx; + } + + .dataLog-v { + padding: 0 20rpx; + } + } + .buttom-actions{ + z-index: 1; + :deep(.cancel) { + width: 100%; + border-radius: 0 !important; + border: none; + margin: 0; + height: 2.75rem; + line-height: 1.2rem; + font-size: 28rpx; + + &::after { + height: 0; + border-radius: 0; + border: none; + } + } + } + + :deep(.u-form-item) { + min-height: 112rpx; + background-color: #fff; + } + } + /* 状态栏高度 */ + .status_bar { + height: var(--status-bar-height); + width: 100%; + background-color: #fff; + z-index: 9999; + position: fixed; + top: 0; + } + .nav-bar-box { + z-index: 99999; + position: absolute; + top: 0; + :deep(.uni-navbar__content) { + z-index: 99999; + } + + :deep(.uni-navbar__header-container) { + justify-content: center; + } + + .nav-left { + max-width: 100%; + display: flex; + align-items: center; + + .nav-left-text { + font-weight: 700; + font-size: 29rpx; + flex: 1; + min-width: 0; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .right-icons { + font-weight: 700; + margin-top: 2px; + margin-left: 4px; + transition-duration: 0.3s; + } + + .select-right-icons { + transform: rotate(-180deg); + } + } + } + + .placeholder { + color: #c0c4cc !important; + } + .relation-item--left{ + .u-form-item--left{ + align-items: flex-start !important; + } + } + .popup-select { + ::v-deep .u-form-item__body { + .u-form-item--left { + align-items: flex-start !important; + } + } + } + .w-full{ + width: 100%; + } + .h-full{ + height: 100%; + } + + /* 筛选排序下拉 */ + @keyframes slideIn { + from { + transform: translateY(-100%); + } + + to { + transform: translateY(0); + } + } + .dropdown-panel { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: white; + z-index: 1000; + display: flex; + flex-direction: column; + animation: slideIn 0.3s ease-out; + overflow: hidden; + /* 面板内容 - 可滚动 */ + .panel-content { + flex: 1; + height: 0; + background: white; + } + /* 面板底部 - 固定按钮 */ + .panel-footer { + display: flex; + border-top: 1rpx solid #f0f0f0; + background: white; + flex-shrink: 0; + box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1); + .action-btn { + flex: 1; + height: 88rpx; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.2s ease; + &:active{ + transform: scale(0.98); + } + .action-text { + font-size: 30rpx; + font-weight: 500; + } + } + .btn1 { + background: #fff; + .action-text { + color: #606266; + } + } + .btn2 { + background-color: #2979ff; + .action-text { + color: #fff; + } + + } + } + } + /* 列表批量选择弹窗 */ + .top-btn { + height: 80rpx; + position: fixed; + width: 100%; + top: 0; + left: 0; + background-color: #fff; + /* #ifdef MP-WEIXIN */ + z-index: 99; + /* #endif */ + /* #ifndef MP-WEIXIN */ + z-index: 999; + /* #endif */ + justify-content: space-between; + padding: 0 20rpx; + + .button-left { + color: #0293fc; + } + + .button-right { + width: 30rpx; + height: 30rpx; + } + } + + .slide-down2 { + animation: slide-down2 0.5s forwards; + opacity: 1; + transform: translateY(0); + } + + .slide-up2 { + animation: slide-up2 0.5s forwards; + opacity: 0; + transform: translateY(-100%); + } + + .slide-down { + animation: slide-down 0.5s forwards; + opacity: 1; + transform: translateY(0); + } + + .slide-up { + animation: slide-up 0.5s forwards; + opacity: 0; + transform: translateY(100%); + } + + .bottom-btn { + height: 100rpx; + position: fixed; + width: 100%; + bottom: 0; + left: 0; + background-color: #0293fc; + z-index: 9; + justify-content: space-around; + + .button-preIcon { + color: #fff; + text-align: center; + width: 20%; + + .btn-icon { + height: 32rpx; + } + } + } + + @keyframes slide-up { + to { + transform: translateY(0); + opacity: 1; + } + } + + @keyframes slide-down { + to { + transform: translateY(100%); + opacity: 0; + } + } + + @keyframes slide-up2 { + to { + transform: translateY(0); + opacity: 1; + } + } + + @keyframes slide-down2 { + to { + transform: translateY(-100%); + opacity: 0; + } + } \ No newline at end of file diff --git a/assets/scss/components.scss b/assets/scss/components.scss new file mode 100644 index 0000000..43c8282 --- /dev/null +++ b/assets/scss/components.scss @@ -0,0 +1,271 @@ +.jnpf-tree-select-popup { + height: 100%; + z-index: 9999 !important; + .jnpf-tree-select-body { + height: 100%; + display: flex; + flex-direction: column; + .jnpf-tree-select-title { + display: flex; + align-items: center; + height: 100rpx; + padding: 0 16rpx !important; + .backIcon { + font-size: 40rpx; + color: #000; + } + .title { + flex: 1; + text-align: center; + padding-right: 40rpx; + font-size: 32rpx; + } + } + .jnpf-tree-select-search { + padding: 10px 12px; + } + .jnpf-tree-selected { + width: 100%; + padding: 0 24rpx 0; + .jnpf-tree-selected-head { + width: 100%; + height: 60rpx; + display: flex; + justify-content: space-between; + .clear-btn { + color: #2979ff; + } + } + .jnpf-tree-selected-box { + width: 100%; + display: flex; + justify-content: center; + border-radius: 8rpx; + border: 1rpx dashed #c0c4cc; + margin-top: 10rpx; + .select-list { + height: 150rpx; + max-height: 150rpx; + justify-content: flex-start; + flex-wrap: wrap; + .u-selectTag { + margin-bottom: 10rpx; + margin-left: 10rpx; + } + } + .jnpf-tree-selected-list{ + display: flex; + justify-content: flex-start; + flex-wrap: wrap; + padding-top: 10rpx; + .u-selectTag { + width: 310rpx; + border: 1px solid #2194fa; + background-color: #e8f4fe; + line-height: 40rpx; + margin: 10rpx; + padding-left: 10rpx; + display: flex; + align-items: center; + border-radius: 8rpx; + &.u-selectTag-flow{ + .jnpf-tree-selected-content{ + width: 100%; + margin-left: 0; + } + } + .jnpf-tree-selected-content { + width: 74%; + margin-left: 10rpx; + .name-box{ + color: #353535; + display: flex; + .name { + flex: 1; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + .close { + width: 26px; + padding-right: 8rpx; + justify-content: flex-end; + color: #2194fa; + } + } + .organize { + color: #a0a1a1; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis + } + } + } + } + .user-select-list{ + max-height: 240rpx; + display: flex; + justify-content: flex-start; + flex-wrap: wrap; + padding-top: 10rpx; + } + } + } + .jnpf-tree-selected-line{ + height: 20rpx; + background-color: #eaecf0; + margin-top: 8rpx; + } + .jnpf-tree-selected-tabs{ + height: 70rpx; + padding: 0 20rpx; + border-bottom: 1rpx solid #e4e4e7; + display: flex; + align-items: center; + .tab-item{ + line-height: 66rpx; + margin-right: 30rpx; + border-bottom: 4rpx solid transparent; + &.tab-item-active{ + z-index: 1; + color: #2979ff; + border-bottom: 4rpx solid #2979ff; + } + } + } + .jnpf-tree-selected-breadcrumb{ + height: 70rpx; + padding: 0 20rpx; + background-color: #eaecf0; + display: flex; + align-items: center; + .breadcrumb-item{ + margin-right: 10rpx; + &.icon-ym{ + font-size: 20rpx; + margin-right: 10rpx; + color: #a0a1a1; + } + &.breadcrumb-item-active{ + color: #2979ff; + } + } + } + .jnpf-tree-select-tree { + flex: 1; + overflow: auto; + + .ly-tree{ + padding: 0 20rpx 20rpx; + } + + .list-box{ + height: 100%; + .list-item{ + display: flex; + width: 100%; + padding: 0 10px; + box-sizing: border-box; + .radio-label{ + display: flex; + width: 100%; + } + .list-item-content{ + flex: 1; + } + } + } + .jnpf-selcet-list{ + padding: 0 20rpx; + } + .jnpf-selcet-cell{ + height: 70rpx; + border-bottom: 1rpx solid #e4e4e7; + display: flex; + align-items: center; + .jnpf-selcet-cell-action{ + height: 70rpx; + display: flex; + align-items: center; + position: relative; + margin-right: 16rpx; + flex-shrink: 0; + .ly-radio, + .ly-checkbox{ + padding-right: 0; + } + &::after { + position: absolute; + display: block; + content: ''; + left: 0; + top: 0; + height: 100%; + width: 100%; + z-index: 1; + } + } + .jnpf-selcet-cell-avatar{ + margin-right: 10rpx; + } + .jnpf-selcet-cell-icon{ + margin-right: 10rpx; + } + .jnpf-selcet-cell-name{ + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + } + + } + } + .nodata { + height: 100%; + margin: auto; + align-items: center; + justify-content: center; + color: #909399; + } + .jnpf-date-range { + width: 100%; + display: flex; + .u-input__input { + text-align: center !important; + } + } + .jnpf-bottom-actions, + .jnpf-tree-select-actions { + background-color: #fff; + display: flex; + width: 100%; + height: 88rpx; + box-shadow: 0 -2rpx 8rpx #e1e5ec; + z-index: 999999; + flex-shrink: 0; + .buttom-btn { + width: 100%; + /* #ifndef MP */ + height: 88rpx !important; + line-height: 88rpx !important; + border-radius: 0 !important; + &::after { + border: none !important; + } + /* #endif */ + /* #ifdef MP */ + .u-btn { + width: 100%; + height: 88rpx !important; + line-height: 88rpx !important; + border-radius: 0 !important; + + &::after { + border: none !important; + } + } + /* #endif */ + } + } \ No newline at end of file diff --git a/components/CommonPane/index.vue b/components/CommonPane/index.vue new file mode 100644 index 0000000..07362ae --- /dev/null +++ b/components/CommonPane/index.vue @@ -0,0 +1,204 @@ + + + + + \ No newline at end of file diff --git a/components/CommonTabs/index.vue b/components/CommonTabs/index.vue new file mode 100644 index 0000000..a8bf473 --- /dev/null +++ b/components/CommonTabs/index.vue @@ -0,0 +1,168 @@ + + + + \ No newline at end of file diff --git a/components/CustomButton/index.vue b/components/CustomButton/index.vue new file mode 100644 index 0000000..b534d95 --- /dev/null +++ b/components/CustomButton/index.vue @@ -0,0 +1,53 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/Alert/index.vue b/components/Jnpf/Alert/index.vue new file mode 100644 index 0000000..4fce4cd --- /dev/null +++ b/components/Jnpf/Alert/index.vue @@ -0,0 +1,59 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/AreaSelect/Tree.vue b/components/Jnpf/AreaSelect/Tree.vue new file mode 100644 index 0000000..080e0b2 --- /dev/null +++ b/components/Jnpf/AreaSelect/Tree.vue @@ -0,0 +1,242 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/AreaSelect/index.vue b/components/Jnpf/AreaSelect/index.vue new file mode 100644 index 0000000..f66fe0c --- /dev/null +++ b/components/Jnpf/AreaSelect/index.vue @@ -0,0 +1,113 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/AutoComplete/SearchForm.vue b/components/Jnpf/AutoComplete/SearchForm.vue new file mode 100644 index 0000000..ef9d80a --- /dev/null +++ b/components/Jnpf/AutoComplete/SearchForm.vue @@ -0,0 +1,203 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/AutoComplete/index.vue b/components/Jnpf/AutoComplete/index.vue new file mode 100644 index 0000000..0fea00a --- /dev/null +++ b/components/Jnpf/AutoComplete/index.vue @@ -0,0 +1,139 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Barcode/index.vue b/components/Jnpf/Barcode/index.vue new file mode 100644 index 0000000..c532fa3 --- /dev/null +++ b/components/Jnpf/Barcode/index.vue @@ -0,0 +1,116 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcode.js b/components/Jnpf/Barcode/tki-barcode/barcode.js new file mode 100644 index 0000000..3bbd372 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcode.js @@ -0,0 +1,212 @@ +import barcodes from './barcodes/index.js' +let barcode = {}; +(function() { + // 初始化 + barcode = function(cont, ctxid, options, ctxsize, result) { + let ops = {}, + newOptions, encodings, globaContext, ctx, globaCtxid, cbCanvasSize, cbResult; + globaCtxid = ctxid + cbCanvasSize = ctxsize + cbResult = result + newOptions = Object.assign(ops, options); + // 修成margin + fixMargin(newOptions) + // 处理options 数据 + if (newOptions.text == '' || !cont) { + return false + } + // 获取ctx + globaContext = cont + ctx = uni.createCanvasContext(globaCtxid, globaContext) + // 获取编码数据 + encodings = new barcodes[newOptions.format.toUpperCase()](newOptions.text, newOptions).encode() + let fixencodings = fixEncodings(encodings, newOptions) + // 返回canvas实际大小 + cbCanvasSize({ + width: fixencodings.width, + height: fixencodings.height + }) + // 绘制canvas + setTimeout(() => { + drawCanvas.render(newOptions, fixencodings) + }, 50); + // 绘制canvas + let drawCanvas = { + render(options, encoding) { + this.prepare(options, encoding) + encoding.encodings.forEach((v, i) => { + this.barcode(options, v) + this.text(options, v) + this.move(v) + }); + this.draw(options, encoding) + }, + barcode(options, encoding) { + let binary = encoding.data; + let yFrom; + if (options.textPosition == "top") { + yFrom = options.marginTop + options.fontSize + options.textMargin; + } else { + yFrom = options.marginTop; + } + // 绘制条码 + ctx.fillStyle = options.lineColor; + for (let b = 0; b < binary.length; b++) { + let x = b * options.width + encoding.barcodePadding; + let height = options.height + if (encoding.options) { + if (encoding.options.height != undefined) { + height = encoding.options.height + } + } + if (binary[b] === "1") { + ctx.fillRect(x, yFrom, options.width, height); + } else if (binary[b]) { + ctx.fillRect(x, yFrom, options.width, height * binary[b]); + } + } + }, + text(options, encoding) { + if (options.displayValue) { + let x, y, align, size; + if (options.textPosition == "top") { + y = options.marginTop + options.fontSize; + } else { + y = options.height + options.textMargin + options.marginTop + options.fontSize; + } + if (encoding.options) { + if (encoding.options.textAlign != undefined) { + align = encoding.options.textAlign + } + if (encoding.options.fontSize != undefined) { + size = encoding.options.fontSize + } + } else { + align = options.textAlign + size = options.fontSize + } + ctx.setFontSize(size) + if (align == "left" || encoding.barcodePadding > 0) { + x = 0; + ctx.setTextAlign('left') + } else if (align == "right") { + x = encoding.width - 1; + ctx.setTextAlign('right') + } else { + x = encoding.width / 2; + ctx.setTextAlign('center'); + } + ctx.fillStyle = options.fontColor; + if (encoding.text != undefined) { + ctx.fillText(encoding.text, x, y); + } + } + }, + move(encoding) { + ctx.translate(encoding.width, 0); + }, + prepare(options, encoding) { + // 绘制背景 + if (options.background) { + ctx.fillStyle = options.background; + ctx.fillRect(0, 0, encoding.width, encoding.height); + } + ctx.translate(options.marginLeft, 0); + }, + draw(options, encoding) { + ctx.draw(false, () => { + this.toImgs(options, encoding) + }) + }, + toImgs(options, encoding) { + setTimeout(() => { + try { + uni.canvasToTempFilePath({ + width: encoding.width, + height: encoding.height, + destWidth: encoding.width, + destHeight: encoding.height, + canvasId: globaCtxid, + fileType: 'png', + success: function(res) { + cbResult(res.tempFilePath) + }, + fail: function(res) { + cbResult(res) + }, + complete: function() { + uni.hideLoading(); + }, + }, globaContext); + } catch (e) { + //TODO handle the exception + } + }, options.text.length + 100); + } + } + // 混入canvas数据 + function fixEncodings(encoding, options) { + let encodingArr = [], + width = options.marginLeft + options.marginRight, + height; + if (!Array.isArray(encoding)) { + encodingArr[0] = JSON.parse(JSON.stringify(encoding)) + } else { + encodingArr = [...encoding] + } + encodingArr.forEach((v, i) => { + // 获取文本宽度 + let textWidth = ctx.measureText(encodingArr[i].text ? encodingArr[i].text : '').width; + // 获取条形码宽度 + let barcodeWidth = encodingArr[i].data.length * options.width; + // 获取内边距 + let barcodePadding = 0; + if (options.displayValue && barcodeWidth < textWidth) { + if (options.textAlign == "center") { + barcodePadding = Math.floor((textWidth - barcodeWidth) / 2); + } else if (options.textAlign == "left") { + barcodePadding = 0; + } else if (options.textAlign == "right") { + barcodePadding = Math.floor(textWidth - barcodeWidth); + } + } + // 混入encodingArr[i] + encodingArr[i].barcodePadding = barcodePadding + encodingArr[i].width = Math.ceil(Math.max(textWidth, barcodeWidth)) + width += encodingArr[i].width + if (encodingArr[i].options) { + if (encodingArr[i].options.height != undefined) { + encodingArr[i].height = encodingArr[i].options.height + (options.displayValue && + (encodingArr[i].text ? encodingArr[i].text : '').length > 0 ? options + .fontSize + options.textMargin : 0) + options.marginTop + options + .marginBottom; + } else { + encodingArr[i].height = height = options.height + (options.displayValue && ( + encodingArr[i].text ? encodingArr[i].text : '').length > 0 ? options + .fontSize + options.textMargin : 0) + options.marginTop + options + .marginBottom; + } + } else { + encodingArr[i].height = height = options.height + (options.displayValue && ( + encodingArr[i].text ? encodingArr[i].text : '').length > 0 ? options + .fontSize + options.textMargin : 0) + options.marginTop + options + .marginBottom; + } + }); + return { + encodings: encodingArr, + width, + height + }; + } + // 修正Margin + function fixMargin(options) { + options.marginTop = options.marginTop == undefined ? options.margin : options.marginTop; + options.marginBottom = options.marginBottom == undefined ? options.margin : options.marginBottom; + options.marginRight = options.marginRight == undefined ? options.margin : options.marginRight; + options.marginLeft = options.marginLeft == undefined ? options.margin : options.marginLeft; + } + }; +})() + +export default barcode \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/Barcode.js b/components/Jnpf/Barcode/tki-barcode/barcodes/Barcode.js new file mode 100644 index 0000000..8cf0575 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/Barcode.js @@ -0,0 +1,19 @@ +"use strict"; + + + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +var Barcode = function Barcode(data, options) { + _classCallCheck(this, Barcode); + + this.data = data; + this.text = options.text || data; + this.options = options; +}; + +export default Barcode \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128.js new file mode 100644 index 0000000..e52349c --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128.js @@ -0,0 +1,208 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _Barcode3 from '../Barcode.js' + +import _constants from './constants' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +// This is the master class, +// it does require the start code to be included in the string +var CODE128 = function(_Barcode) { + _inherits(CODE128, _Barcode); + + function CODE128(data, options) { + _classCallCheck(this, CODE128); + + // Get array of ascii codes from data + var _this = _possibleConstructorReturn(this, (CODE128.__proto__ || Object.getPrototypeOf(CODE128)).call( + this, data.substring(1), options)); + + _this.bytes = data.split('').map(function(char) { + return char.charCodeAt(0); + }); + return _this; + } + + _createClass(CODE128, [{ + key: 'valid', + value: function valid() { + // ASCII value ranges 0-127, 200-211 + return (/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)); + } + + // The public encoding function + + }, { + key: 'encode', + value: function encode() { + var bytes = this.bytes; + // Remove the start code from the bytes and set its index + var startIndex = bytes.shift() - 105; + // Get start set by index + var startSet = _constants.SET_BY_CODE[startIndex]; + + if (startSet === undefined) { + throw new RangeError('The encoding does not start with a start character.'); + } + + if (this.shouldEncodeAsEan128() === true) { + bytes.unshift(_constants.FNC1); + } + + // Start encode with the right type + var encodingResult = CODE128.next(bytes, 1, startSet); + + return { + text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, '') : this.text, + data: + // Add the start bits + CODE128.getBar(startIndex) + + // Add the encoded bits + encodingResult.result + + // Add the checksum + CODE128.getBar((encodingResult.checksum + startIndex) % _constants.MODULO) + + // Add the end bits + CODE128.getBar(_constants.STOP) + }; + } + + // GS1-128/EAN-128 + + }, { + key: 'shouldEncodeAsEan128', + value: function shouldEncodeAsEan128() { + var isEAN128 = this.options.ean128 || false; + if (typeof isEAN128 === 'string') { + isEAN128 = isEAN128.toLowerCase() === 'true'; + } + return isEAN128; + } + + // Get a bar symbol by index + + }], [{ + key: 'getBar', + value: function getBar(index) { + return _constants.BARS[index] ? _constants.BARS[index].toString() : ''; + } + + // Correct an index by a set and shift it from the bytes array + + }, { + key: 'correctIndex', + value: function correctIndex(bytes, set) { + if (set === _constants.SET_A) { + var charCode = bytes.shift(); + return charCode < 32 ? charCode + 64 : charCode - 32; + } else if (set === _constants.SET_B) { + return bytes.shift() - 32; + } else { + return (bytes.shift() - 48) * 10 + bytes.shift() - 48; + } + } + }, { + key: 'next', + value: function next(bytes, pos, set) { + if (!bytes.length) { + return { + result: '', + checksum: 0 + }; + } + + var nextCode = void 0, + index = void 0; + + // Special characters + if (bytes[0] >= 200) { + index = bytes.shift() - 105; + var nextSet = _constants.SWAP[index]; + + // Swap to other set + if (nextSet !== undefined) { + nextCode = CODE128.next(bytes, pos + 1, nextSet); + } + // Continue on current set but encode a special character + else { + // Shift + if ((set === _constants.SET_A || set === _constants.SET_B) && index === + _constants.SHIFT) { + // Convert the next character so that is encoded correctly + bytes[0] = set === _constants.SET_A ? bytes[0] > 95 ? bytes[0] - 96 : bytes[ + 0] : bytes[0] < 32 ? bytes[0] + 96 : bytes[0]; + } + nextCode = CODE128.next(bytes, pos + 1, set); + } + } + // Continue encoding + else { + index = CODE128.correctIndex(bytes, set); + nextCode = CODE128.next(bytes, pos + 1, set); + } + + // Get the correct binary encoding and calculate the weight + var enc = CODE128.getBar(index); + var weight = index * pos; + + return { + result: enc + nextCode.result, + checksum: weight + nextCode.checksum + }; + } + }]); + + return CODE128; +}(_Barcode3); + +export default CODE128; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128A.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128A.js new file mode 100644 index 0000000..30bc71a --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128A.js @@ -0,0 +1,80 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + + +import _CODE3 from './CODE128' + +import _constants from './constants' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var CODE128A = function(_CODE) { + _inherits(CODE128A, _CODE); + + function CODE128A(string, options) { + _classCallCheck(this, CODE128A); + + return _possibleConstructorReturn(this, (CODE128A.__proto__ || Object.getPrototypeOf(CODE128A)).call(this, + _constants.A_START_CHAR + string, options)); + } + + _createClass(CODE128A, [{ + key: 'valid', + value: function valid() { + return new RegExp('^' + _constants.A_CHARS + '+$').test(this.data); + } + }]); + + return CODE128A; +}(_CODE3); + +export default CODE128A; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128B.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128B.js new file mode 100644 index 0000000..d1805f1 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128B.js @@ -0,0 +1,79 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _CODE3 from './CODE128' + +import _constants from './constants' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var CODE128B = function(_CODE) { + _inherits(CODE128B, _CODE); + + function CODE128B(string, options) { + _classCallCheck(this, CODE128B); + + return _possibleConstructorReturn(this, (CODE128B.__proto__ || Object.getPrototypeOf(CODE128B)).call(this, + _constants.B_START_CHAR + string, options)); + } + + _createClass(CODE128B, [{ + key: 'valid', + value: function valid() { + return new RegExp('^' + _constants.B_CHARS + '+$').test(this.data); + } + }]); + + return CODE128B; +}(_CODE3); + +export default CODE128B; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128C.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128C.js new file mode 100644 index 0000000..124e739 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128C.js @@ -0,0 +1,79 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _CODE3 from './CODE128' + +import _constants from './constants' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var CODE128C = function(_CODE) { + _inherits(CODE128C, _CODE); + + function CODE128C(string, options) { + _classCallCheck(this, CODE128C); + + return _possibleConstructorReturn(this, (CODE128C.__proto__ || Object.getPrototypeOf(CODE128C)).call(this, + _constants.C_START_CHAR + string, options)); + } + + _createClass(CODE128C, [{ + key: 'valid', + value: function valid() { + return new RegExp('^' + _constants.C_CHARS + '+$').test(this.data); + } + }]); + + return CODE128C; +}(_CODE3); + +export default CODE128C; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128_AUTO.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128_AUTO.js new file mode 100644 index 0000000..ea5351a --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/CODE128_AUTO.js @@ -0,0 +1,63 @@ +'use strict'; + +import _CODE3 from './CODE128' + +import _auto2 from './auto' + + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var CODE128AUTO = function(_CODE) { + _inherits(CODE128AUTO, _CODE); + + function CODE128AUTO(data, options) { + _classCallCheck(this, CODE128AUTO); + + // ASCII value ranges 0-127, 200-211 + if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) { + var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf( + CODE128AUTO)).call(this, (0, _auto2)(data), options)); + } else { + var _this = _possibleConstructorReturn(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf( + CODE128AUTO)).call(this, data, options)); + } + return _possibleConstructorReturn(_this); + } + + return CODE128AUTO; +}(_CODE3); + +export default CODE128AUTO; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/auto.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/auto.js new file mode 100644 index 0000000..6bfd3f7 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/auto.js @@ -0,0 +1,71 @@ +'use strict'; + +import _constants from './constants' + +// Match Set functions +var matchSetALength = function matchSetALength(string) { + return string.match(new RegExp('^' + _constants.A_CHARS + '*'))[0].length; +}; +var matchSetBLength = function matchSetBLength(string) { + return string.match(new RegExp('^' + _constants.B_CHARS + '*'))[0].length; +}; +var matchSetC = function matchSetC(string) { + return string.match(new RegExp('^' + _constants.C_CHARS + '*'))[0]; +}; + +// CODE128A or CODE128B +function autoSelectFromAB(string, isA) { + var ranges = isA ? _constants.A_CHARS : _constants.B_CHARS; + var untilC = string.match(new RegExp('^(' + ranges + '+?)(([0-9]{2}){2,})([^0-9]|$)')); + + if (untilC) { + return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length)); + } + + var chars = string.match(new RegExp('^' + ranges + '+'))[0]; + + if (chars.length === string.length) { + return string; + } + + return chars + String.fromCharCode(isA ? 205 : 206) + autoSelectFromAB(string.substring(chars.length), !isA); +} + +// CODE128C +function autoSelectFromC(string) { + var cMatch = matchSetC(string); + var length = cMatch.length; + + if (length === string.length) { + return string; + } + + string = string.substring(length); + + // Select A/B depending on the longest match + var isA = matchSetALength(string) >= matchSetBLength(string); + return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA); +} + +// Detect Code Set (A, B or C) and format the string + +function auto(string) { + var newString = void 0; + var cLength = matchSetC(string).length; + + // Select 128C if the string start with enough digits + if (cLength >= 2) { + newString = _constants.C_START_CHAR + autoSelectFromC(string); + } else { + // Select A/B depending on the longest match + var isA = matchSetALength(string) > matchSetBLength(string); + newString = (isA ? _constants.A_START_CHAR : _constants.B_START_CHAR) + autoSelectFromAB(string, isA); + } + + return newString.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, // Any sequence between 205 and 206 characters + function(match, char) { + return String.fromCharCode(203) + char; + }); +}; + +export default auto \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/constants.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/constants.js new file mode 100644 index 0000000..ac84a1d --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/constants.js @@ -0,0 +1,99 @@ +"use strict"; + +var _SET_BY_CODE; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} + +// constants for internal usage +var SET_A = 0; +var SET_B = 1; +var SET_C = 2; + +// Special characters +var SHIFT = 98; +var START_A = 103; +var START_B = 104; +var START_C = 105; +var MODULO = 103; +var STOP = 106; +var FNC1 = 207; + +// Get set by start code +var SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), + _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE); + +// Get next set by code +var SWAP = { + 101: SET_A, + 100: SET_B, + 99: SET_C +}; + +var A_START_CHAR = String.fromCharCode(208); // START_A + 105 +var B_START_CHAR = String.fromCharCode(209); // START_B + 105 +var C_START_CHAR = String.fromCharCode(210); // START_C + 105 + +// 128A (Code Set A) +// ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4 +var A_CHARS = "[\x00-\x5F\xC8-\xCF]"; + +// 128B (Code Set B) +// ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4 +var B_CHARS = "[\x20-\x7F\xC8-\xCF]"; + +// 128C (Code Set C) +// 00–99 (encodes two digits with a single code point) and FNC1 +var C_CHARS = "(\xCF*[0-9]{2}\xCF*)"; + +// CODE128 includes 107 symbols: +// 103 data symbols, 3 start symbols (A, B and C), and 1 stop symbol (the last one) +// Each symbol consist of three black bars (1) and three white spaces (0). +var BARS = [11011001100, 11001101100, 11001100110, 10010011000, 10010001100, 10001001100, 10011001000, + 10011000100, 10001100100, 11001001000, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, + 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, + 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011000, + 11011000110, 11000110110, 10100011000, 10001011000, 10001000110, 10110001000, 10001101000, 10001100010, + 11010001000, 11000101000, 11000100010, 10110111000, 10110001110, 10001101110, 10111011000, 10111000110, + 10001110110, 11101110110, 11010001110, 11000101110, 11011101000, 11011100010, 11011101110, 11101011000, + 11101000110, 11100010110, 11101101000, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, + 10100110000, 10100001100, 10010110000, 10010000110, 10000101100, 10000100110, 10110010000, 10110000100, + 10011010000, 10011000010, 10000110100, 10000110010, 11000010010, 11001010000, 11110111010, 11000010100, + 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, + 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111000, 10100011110, 10001011110, + 10111101000, 10111100010, 11110101000, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, + 11010000100, 11010010000, 11010011100, 1100011101011 +]; + +export default { + SET_A, + SET_B, + SET_C, + SHIFT, + START_A, + START_B, + START_C, + MODULO, + STOP, + FNC1, + SET_BY_CODE, + SWAP, + A_START_CHAR, + B_START_CHAR, + C_START_CHAR, + A_CHARS, + B_CHARS, + C_CHARS, + BARS +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/index.js new file mode 100644 index 0000000..85564c2 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE128/index.js @@ -0,0 +1,17 @@ +'use strict'; + +import CODE128 from './CODE128_AUTO.js' + +import CODE128A from './CODE128A.js' + +import CODE128B from './CODE128B.js' + +import CODE128C from './CODE128C.js' + + +export default { + CODE128, + CODE128A, + CODE128B, + CODE128C, +}; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/CODE39/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE39/index.js new file mode 100644 index 0000000..6757a2c --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/CODE39/index.js @@ -0,0 +1,141 @@ +"use strict"; + + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _Barcode3 from '../Barcode.js' + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation: +// https://en.wikipedia.org/wiki/Code_39#Encoding + +var CODE39 = function(_Barcode) { + _inherits(CODE39, _Barcode); + + function CODE39(data, options) { + _classCallCheck(this, CODE39); + + data = data.toUpperCase(); + + // Calculate mod43 checksum if enabled + if (options.mod43) { + data += getCharacter(mod43checksum(data)); + } + + return _possibleConstructorReturn(this, (CODE39.__proto__ || Object.getPrototypeOf(CODE39)).call(this, data, + options)); + } + + _createClass(CODE39, [{ + key: "encode", + value: function encode() { + // First character is always a * + var result = getEncoding("*"); + + // Take every character and add the binary representation to the result + for (var i = 0; i < this.data.length; i++) { + result += getEncoding(this.data[i]) + "0"; + } + + // Last character is always a * + result += getEncoding("*"); + return { + data: result, + text: this.text + }; + } + }, { + key: "valid", + value: function valid() { + return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; + } + }]); + + return CODE39; +}(_Barcode3); + +// All characters. The position in the array is the (checksum) value + + +var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", + "%", "*" +]; + +// The decimal representation of the characters, is converted to the +// corresponding binary with the getEncoding function +var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, + 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, + 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770 +]; + +// Get the binary representation of a character by converting the encodings +// from decimal to binary +function getEncoding(character) { + return getBinary(characterValue(character)); +} + +function getBinary(characterValue) { + return encodings[characterValue].toString(2); +} + +function getCharacter(characterValue) { + return characters[characterValue]; +} + +function characterValue(character) { + return characters.indexOf(character); +} + +function mod43checksum(data) { + var checksum = 0; + for (var i = 0; i < data.length; i++) { + checksum += characterValue(data[i]); + } + + checksum = checksum % 43; + return checksum; +} + +export default CODE39; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN.js new file mode 100644 index 0000000..c92abf6 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN.js @@ -0,0 +1,151 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _constants from './constants' + +import _encoder2 from './encoder' + +import _Barcode3 from '../Barcode.js' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +// Base class for EAN8 & EAN13 +var EAN = function(_Barcode) { + _inherits(EAN, _Barcode); + + function EAN(data, options) { + _classCallCheck(this, EAN); + + // Make sure the font is not bigger than the space between the guard bars + var _this = _possibleConstructorReturn(this, (EAN.__proto__ || Object.getPrototypeOf(EAN)).call(this, data, + options)); + + _this.fontSize = !options.flat && options.fontSize > options.width * 10 ? options.width * 10 : options + .fontSize; + + // Make the guard bars go down half the way of the text + _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; + return _this; + } + + _createClass(EAN, [{ + key: 'encode', + value: function encode() { + return this.options.flat ? this.encodeFlat() : this.encodeGuarded(); + } + }, { + key: 'leftText', + value: function leftText(from, to) { + return this.text.substr(from, to); + } + }, { + key: 'leftEncode', + value: function leftEncode(data, structure) { + return (0, _encoder2)(data, structure); + } + }, { + key: 'rightText', + value: function rightText(from, to) { + return this.text.substr(from, to); + } + }, { + key: 'rightEncode', + value: function rightEncode(data, structure) { + return (0, _encoder2)(data, structure); + } + }, { + key: 'encodeGuarded', + value: function encodeGuarded() { + var textOptions = { + fontSize: this.fontSize + }; + var guardOptions = { + height: this.guardHeight + }; + + return [{ + data: _constants.SIDE_BIN, + options: guardOptions + }, { + data: this.leftEncode(), + text: this.leftText(), + options: textOptions + }, { + data: _constants.MIDDLE_BIN, + options: guardOptions + }, { + data: this.rightEncode(), + text: this.rightText(), + options: textOptions + }, { + data: _constants.SIDE_BIN, + options: guardOptions + }]; + } + }, { + key: 'encodeFlat', + value: function encodeFlat() { + var data = [_constants.SIDE_BIN, this.leftEncode(), _constants.MIDDLE_BIN, this + .rightEncode(), _constants.SIDE_BIN + ]; + + return { + data: data.join(''), + text: this.text + }; + } + }]); + + return EAN; +}(_Barcode3); + +export default EAN; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN13.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN13.js new file mode 100644 index 0000000..adf2b2f --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN13.js @@ -0,0 +1,186 @@ +'use strict'; + + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var _get = function get(object, property, receiver) { + if (object === null) object = Function.prototype; + var desc = Object.getOwnPropertyDescriptor(object, property); + if (desc === undefined) { + var parent = Object.getPrototypeOf(object); + if (parent === null) { + return undefined; + } else { + return get(parent, property, receiver); + } + } else if ("value" in desc) { + return desc.value; + } else { + var getter = desc.get; + if (getter === undefined) { + return undefined; + } + return getter.call(receiver); + } +}; + +import _constants from './constants' + +import _EAN3 from './EAN' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation: +// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode + +// Calculate the checksum digit +// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit +var checksum = function checksum(number) { + var res = number.substr(0, 12).split('').map(function(n) { + return +n; + }).reduce(function(sum, a, idx) { + return idx % 2 ? sum + a * 3 : sum + a; + }, 0); + + return (10 - res % 10) % 10; +}; + +var EAN13 = function(_EAN) { + _inherits(EAN13, _EAN); + + function EAN13(data, options) { + _classCallCheck(this, EAN13); + + // Add checksum if it does not exist + if (data.search(/^[0-9]{12}$/) !== -1) { + data += checksum(data); + } + + // Adds a last character to the end of the barcode + var _this = _possibleConstructorReturn(this, (EAN13.__proto__ || Object.getPrototypeOf(EAN13)).call(this, + data, options)); + + _this.lastChar = options.lastChar; + return _this; + } + + _createClass(EAN13, [{ + key: 'valid', + value: function valid() { + return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum(this.data); + } + }, { + key: 'leftText', + value: function leftText() { + return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), + 'leftText', this).call(this, 1, 6); + } + }, { + key: 'leftEncode', + value: function leftEncode() { + var data = this.data.substr(1, 6); + var structure = _constants.EAN13_STRUCTURE[this.data[0]]; + return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), + 'leftEncode', this).call(this, data, structure); + } + }, { + key: 'rightText', + value: function rightText() { + return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), + 'rightText', this).call(this, 7, 6); + } + }, { + key: 'rightEncode', + value: function rightEncode() { + var data = this.data.substr(7, 6); + return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), + 'rightEncode', this).call(this, data, 'RRRRRR'); + } + + // The "standard" way of printing EAN13 barcodes with guard bars + + }, { + key: 'encodeGuarded', + value: function encodeGuarded() { + var data = _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), + 'encodeGuarded', this).call(this); + + // Extend data with left digit & last character + if (this.options.displayValue) { + data.unshift({ + data: '000000000000', + text: this.text.substr(0, 1), + options: { + textAlign: 'left', + fontSize: this.fontSize + } + }); + + if (this.options.lastChar) { + data.push({ + data: '00' + }); + data.push({ + data: '00000', + text: this.options.lastChar, + options: { + fontSize: this.fontSize + } + }); + } + } + + return data; + } + }]); + + return EAN13; +}(_EAN3); + +export default EAN13; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN2.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN2.js new file mode 100644 index 0000000..5b55e69 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN2.js @@ -0,0 +1,93 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _constants from './constants' + +import _encoder2 from './encoder' + +import _Barcode3 from '../Barcode.js' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation: +// https://en.wikipedia.org/wiki/EAN_2#Encoding + +var EAN2 = function(_Barcode) { + _inherits(EAN2, _Barcode); + + function EAN2(data, options) { + _classCallCheck(this, EAN2); + + return _possibleConstructorReturn(this, (EAN2.__proto__ || Object.getPrototypeOf(EAN2)).call(this, data, + options)); + } + + _createClass(EAN2, [{ + key: 'valid', + value: function valid() { + return this.data.search(/^[0-9]{2}$/) !== -1; + } + }, { + key: 'encode', + value: function encode() { + // Choose the structure based on the number mod 4 + var structure = _constants.EAN2_STRUCTURE[parseInt(this.data) % 4]; + return { + // Start bits + Encode the two digits with 01 in between + data: '1011' + (0, _encoder2)(this.data, structure, '01'), + text: this.text + }; + } + }]); + + return EAN2; +}(_Barcode3); + +export default EAN2; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN5.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN5.js new file mode 100644 index 0000000..6678cdc --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN5.js @@ -0,0 +1,100 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _constants from './constants' + +import _encoder2 from './encoder' + +import _Barcode3 from '../Barcode.js' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation: +// https://en.wikipedia.org/wiki/EAN_5#Encoding + +var checksum = function checksum(data) { + var result = data.split('').map(function(n) { + return +n; + }).reduce(function(sum, a, idx) { + return idx % 2 ? sum + a * 9 : sum + a * 3; + }, 0); + return result % 10; +}; + +var EAN5 = function(_Barcode) { + _inherits(EAN5, _Barcode); + + function EAN5(data, options) { + _classCallCheck(this, EAN5); + + return _possibleConstructorReturn(this, (EAN5.__proto__ || Object.getPrototypeOf(EAN5)).call(this, data, + options)); + } + + _createClass(EAN5, [{ + key: 'valid', + value: function valid() { + return this.data.search(/^[0-9]{5}$/) !== -1; + } + }, { + key: 'encode', + value: function encode() { + var structure = _constants.EAN5_STRUCTURE[checksum(this.data)]; + return { + data: '1011' + (0, _encoder2)(this.data, structure, '01'), + text: this.text + }; + } + }]); + + return EAN5; +}(_Barcode3); + +export default EAN5; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN8.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN8.js new file mode 100644 index 0000000..f7211c4 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/EAN8.js @@ -0,0 +1,142 @@ +'use strict'; + + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var _get = function get(object, property, receiver) { + if (object === null) object = Function.prototype; + var desc = Object.getOwnPropertyDescriptor(object, property); + if (desc === undefined) { + var parent = Object.getPrototypeOf(object); + if (parent === null) { + return undefined; + } else { + return get(parent, property, receiver); + } + } else if ("value" in desc) { + return desc.value; + } else { + var getter = desc.get; + if (getter === undefined) { + return undefined; + } + return getter.call(receiver); + } +}; + +import _EAN3 from './EAN' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation: +// http://www.barcodeisland.com/ean8.phtml + +// Calculate the checksum digit +var checksum = function checksum(number) { + var res = number.substr(0, 7).split('').map(function(n) { + return +n; + }).reduce(function(sum, a, idx) { + return idx % 2 ? sum + a : sum + a * 3; + }, 0); + + return (10 - res % 10) % 10; +}; + +var EAN8 = function(_EAN) { + _inherits(EAN8, _EAN); + + function EAN8(data, options) { + _classCallCheck(this, EAN8); + + // Add checksum if it does not exist + if (data.search(/^[0-9]{7}$/) !== -1) { + data += checksum(data); + } + + return _possibleConstructorReturn(this, (EAN8.__proto__ || Object.getPrototypeOf(EAN8)).call(this, data, + options)); + } + + _createClass(EAN8, [{ + key: 'valid', + value: function valid() { + return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum(this.data); + } + }, { + key: 'leftText', + value: function leftText() { + return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), + 'leftText', this).call(this, 0, 4); + } + }, { + key: 'leftEncode', + value: function leftEncode() { + var data = this.data.substr(0, 4); + return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), + 'leftEncode', this).call(this, data, 'LLLL'); + } + }, { + key: 'rightText', + value: function rightText() { + return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), + 'rightText', this).call(this, 4, 4); + } + }, { + key: 'rightEncode', + value: function rightEncode() { + var data = this.data.substr(4, 4); + return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), + 'rightEncode', this).call(this, data, 'RRRR'); + } + }]); + + return EAN8; +}(_EAN3); + +export default EAN8; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/UPC.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/UPC.js new file mode 100644 index 0000000..a12c322 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/UPC.js @@ -0,0 +1,210 @@ +"use strict"; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _encoder2 from './encoder' + +import _Barcode3 from '../Barcode.js' + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation: +// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding + +var UPC = function(_Barcode) { + + + function UPC(data, options) { + _classCallCheck(this, UPC); + + // Add checksum if it does not exist + if (data.search(/^[0-9]{11}$/) !== -1) { + data += checksum(data); + } + + var _this = _possibleConstructorReturn(this, (UPC.__proto__ || Object.getPrototypeOf(UPC)).call(this, data, + options)); + + _this.displayValue = options.displayValue; + + // Make sure the font is not bigger than the space between the guard bars + if (options.fontSize > options.width * 10) { + _this.fontSize = options.width * 10; + } else { + _this.fontSize = options.fontSize; + } + + // Make the guard bars go down half the way of the text + _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; + return _this; + } + + _createClass(UPC, [{ + key: "valid", + value: function valid() { + return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data); + } + }, { + key: "encode", + value: function encode() { + if (this.options.flat) { + return this.flatEncoding(); + } else { + return this.guardedEncoding(); + } + } + }, { + key: "flatEncoding", + value: function flatEncoding() { + var result = ""; + + result += "101"; + result += (0, _encoder2)(this.data.substr(0, 6), "LLLLLL"); + result += "01010"; + result += (0, _encoder2)(this.data.substr(6, 6), "RRRRRR"); + result += "101"; + + return { + data: result, + text: this.text + }; + } + }, { + key: "guardedEncoding", + value: function guardedEncoding() { + var result = []; + + // Add the first digit + if (this.displayValue) { + result.push({ + data: "00000000", + text: this.text.substr(0, 1), + options: { + textAlign: "left", + fontSize: this.fontSize + } + }); + } + + // Add the guard bars + result.push({ + data: "101" + (0, _encoder2)(this.data[0], "L"), + options: { + height: this.guardHeight + } + }); + + // Add the left side + result.push({ + data: (0, _encoder2)(this.data.substr(1, 5), "LLLLL"), + text: this.text.substr(1, 5), + options: { + fontSize: this.fontSize + } + }); + + // Add the middle bits + result.push({ + data: "01010", + options: { + height: this.guardHeight + } + }); + + // Add the right side + result.push({ + data: (0, _encoder2)(this.data.substr(6, 5), "RRRRR"), + text: this.text.substr(6, 5), + options: { + fontSize: this.fontSize + } + }); + + // Add the end bits + result.push({ + data: (0, _encoder2)(this.data[11], "R") + "101", + options: { + height: this.guardHeight + } + }); + + // Add the last digit + if (this.displayValue) { + result.push({ + data: "00000000", + text: this.text.substr(11, 1), + options: { + textAlign: "right", + fontSize: this.fontSize + } + }); + } + + return result; + } + }]); + + return UPC; +}(_Barcode3); + +// Calulate the checksum digit +// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit + + +function checksum(number) { + var result = 0; + + var i; + for (i = 1; i < 11; i += 2) { + result += parseInt(number[i]); + } + for (i = 0; i < 11; i += 2) { + result += parseInt(number[i]) * 3; + } + + return (10 - result % 10) % 10; +} +export default { + UPC, + checksum +}; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/UPCE.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/UPCE.js new file mode 100644 index 0000000..c3cdc8a --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/UPCE.js @@ -0,0 +1,245 @@ +'use strict'; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _encoder2 from './encoder' + +import _Barcode3 from '../Barcode.js' + +import _UPC from './UPC.js' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation: +// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding +// +// UPC-E documentation: +// https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E + +var EXPANSIONS = ["XX00000XXX", "XX10000XXX", "XX20000XXX", "XXX00000XX", "XXXX00000X", "XXXXX00005", "XXXXX00006", + "XXXXX00007", "XXXXX00008", "XXXXX00009" +]; + +var PARITIES = [ + ["EEEOOO", "OOOEEE"], + ["EEOEOO", "OOEOEE"], + ["EEOOEO", "OOEEOE"], + ["EEOOOE", "OOEEEO"], + ["EOEEOO", "OEOOEE"], + ["EOOEEO", "OEEOOE"], + ["EOOOEE", "OEEEOO"], + ["EOEOEO", "OEOEOE"], + ["EOEOOE", "OEOEEO"], + ["EOOEOE", "OEEOEO"] +]; + +var UPCE = function(_Barcode) { + _inherits(UPCE, _Barcode); + + function UPCE(data, options) { + _classCallCheck(this, UPCE); + + var _this = _possibleConstructorReturn(this, (UPCE.__proto__ || Object.getPrototypeOf(UPCE)).call(this, + data, options)); + // Code may be 6 or 8 digits; + // A 7 digit code is ambiguous as to whether the extra digit + // is a UPC-A check or number system digit. + + + _this.isValid = false; + if (data.search(/^[0-9]{6}$/) !== -1) { + _this.middleDigits = data; + _this.upcA = expandToUPCA(data, "0"); + _this.text = options.text || '' + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1]; + _this.isValid = true; + } else if (data.search(/^[01][0-9]{7}$/) !== -1) { + _this.middleDigits = data.substring(1, data.length - 1); + _this.upcA = expandToUPCA(_this.middleDigits, data[0]); + + if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) { + _this.isValid = true; + } else { + // checksum mismatch + return _possibleConstructorReturn(_this); + } + } else { + return _possibleConstructorReturn(_this); + } + + _this.displayValue = options.displayValue; + + // Make sure the font is not bigger than the space between the guard bars + if (options.fontSize > options.width * 10) { + _this.fontSize = options.width * 10; + } else { + _this.fontSize = options.fontSize; + } + + // Make the guard bars go down half the way of the text + _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; + return _this; + } + + _createClass(UPCE, [{ + key: 'valid', + value: function valid() { + return this.isValid; + } + }, { + key: 'encode', + value: function encode() { + if (this.options.flat) { + return this.flatEncoding(); + } else { + return this.guardedEncoding(); + } + } + }, { + key: 'flatEncoding', + value: function flatEncoding() { + var result = ""; + + result += "101"; + result += this.encodeMiddleDigits(); + result += "010101"; + + return { + data: result, + text: this.text + }; + } + }, { + key: 'guardedEncoding', + value: function guardedEncoding() { + var result = []; + + // Add the UPC-A number system digit beneath the quiet zone + if (this.displayValue) { + result.push({ + data: "00000000", + text: this.text[0], + options: { + textAlign: "left", + fontSize: this.fontSize + } + }); + } + + // Add the guard bars + result.push({ + data: "101", + options: { + height: this.guardHeight + } + }); + + // Add the 6 UPC-E digits + result.push({ + data: this.encodeMiddleDigits(), + text: this.text.substring(1, 7), + options: { + fontSize: this.fontSize + } + }); + + // Add the end bits + result.push({ + data: "010101", + options: { + height: this.guardHeight + } + }); + + // Add the UPC-A check digit beneath the quiet zone + if (this.displayValue) { + result.push({ + data: "00000000", + text: this.text[7], + options: { + textAlign: "right", + fontSize: this.fontSize + } + }); + } + + return result; + } + }, { + key: 'encodeMiddleDigits', + value: function encodeMiddleDigits() { + var numberSystem = this.upcA[0]; + var checkDigit = this.upcA[this.upcA.length - 1]; + var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)]; + return (0, _encoder2)(this.middleDigits, parity); + } + }]); + + return UPCE; +}(_Barcode3); + +function expandToUPCA(middleDigits, numberSystem) { + var lastUpcE = parseInt(middleDigits[middleDigits.length - 1]); + var expansion = EXPANSIONS[lastUpcE]; + + var result = ""; + var digitIndex = 0; + for (var i = 0; i < expansion.length; i++) { + var c = expansion[i]; + if (c === 'X') { + result += middleDigits[digitIndex++]; + } else { + result += c; + } + } + + result = '' + numberSystem + result; + return '' + result + (0, _UPC.checksum)(result); +} + +export default UPCE; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/constants.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/constants.js new file mode 100644 index 0000000..bf9336f --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/constants.js @@ -0,0 +1,48 @@ +'use strict'; + +// Standard start end and middle bits +var SIDE_BIN = '101'; +var MIDDLE_BIN = '01010'; + +var BINARIES = { + 'L': [ // The L (left) type of encoding + '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', + '0001011' + ], + 'G': [ // The G type of encoding + '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', + '0010111' + ], + 'R': [ // The R (right) type of encoding + '1110010', '1100110', '1101100', '1000010', '1011100', '1001110', '1010000', '1000100', '1001000', + '1110100' + ], + 'O': [ // The O (odd) encoding for UPC-E + '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', + '0001011' + ], + 'E': [ // The E (even) encoding for UPC-E + '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', + '0010111' + ] +}; + +// Define the EAN-2 structure +var EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG']; + +// Define the EAN-5 structure +var EAN5_STRUCTURE = ['GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG']; + +// Define the EAN-13 structure +var EAN13_STRUCTURE = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', + 'LGGLGL' +]; + +export default { + SIDE_BIN, + MIDDLE_BIN, + BINARIES, + EAN2_STRUCTURE, + EAN5_STRUCTURE, + EAN13_STRUCTURE +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/encoder.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/encoder.js new file mode 100644 index 0000000..449bd65 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/encoder.js @@ -0,0 +1,23 @@ +'use strict'; + +import _constants from './constants' + +// Encode data string +var encode = function encode(data, structure, separator) { + var encoded = data.split('').map(function(val, idx) { + return _constants.BINARIES[structure[idx]]; + }).map(function(val, idx) { + return val ? val[data[idx]] : ''; + }); + + if (separator) { + var last = data.length - 1; + encoded = encoded.map(function(val, idx) { + return idx < last ? val + separator : val; + }); + } + + return encoded.join(''); +}; + +export default encode \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/index.js new file mode 100644 index 0000000..6873ba6 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/EAN_UPC/index.js @@ -0,0 +1,22 @@ +'use strict'; + +import EAN13 from './EAN13' + +import EAN8 from './EAN8.js' + +import EAN5 from './EAN5.js' + +import EAN2 from './EAN2.js' + +import UPC from './UPC.js' + +import UPCE from './UPCE.js' + +export default { + EAN13, + EAN8, + EAN5, + EAN2, + UPC: UPC.UPC, + UPCE +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/ITF.js b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/ITF.js new file mode 100644 index 0000000..775ddce --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/ITF.js @@ -0,0 +1,100 @@ +'use strict'; + + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _constants from './constants' +import _Barcode3 from '../Barcode' + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var ITF = function(_Barcode) { + _inherits(ITF, _Barcode); + + function ITF() { + _classCallCheck(this, ITF); + + return _possibleConstructorReturn(this, (ITF.__proto__ || Object.getPrototypeOf(ITF)).apply(this, + arguments)); + } + + _createClass(ITF, [{ + key: 'valid', + value: function valid() { + return this.data.search(/^([0-9]{2})+$/) !== -1; + } + }, { + key: 'encode', + value: function encode() { + var _this2 = this; + + // Calculate all the digit pairs + var encoded = this.data.match(/.{2}/g).map(function(pair) { + return _this2.encodePair(pair); + }).join(''); + + return { + data: _constants.START_BIN + encoded + _constants.END_BIN, + text: this.text + }; + } + + // Calculate the data of a number pair + + }, { + key: 'encodePair', + value: function encodePair(pair) { + var second = _constants.BINARIES[pair[1]]; + + return _constants.BINARIES[pair[0]].split('').map(function(first, idx) { + return (first === '1' ? '111' : '1') + (second[idx] === '1' ? '000' : '0'); + }).join(''); + } + }]); + + return ITF; +}(_Barcode3); + +export default ITF; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/ITF14.js b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/ITF14.js new file mode 100644 index 0000000..e5cfab5 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/ITF14.js @@ -0,0 +1,93 @@ +'use strict'; + + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _ITF3 from './ITF' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +// Calculate the checksum digit +var checksum = function checksum(data) { + var res = data.substr(0, 13).split('').map(function(num) { + return parseInt(num, 10); + }).reduce(function(sum, n, idx) { + return sum + n * (3 - idx % 2 * 2); + }, 0); + + return Math.ceil(res / 10) * 10 - res; +}; + +var ITF14 = function(_ITF) { + _inherits(ITF14, _ITF); + + function ITF14(data, options) { + _classCallCheck(this, ITF14); + + // Add checksum if it does not exist + if (data.search(/^[0-9]{13}$/) !== -1) { + data += checksum(data); + } + return _possibleConstructorReturn(this, (ITF14.__proto__ || Object.getPrototypeOf(ITF14)).call(this, data, + options)); + } + + _createClass(ITF14, [{ + key: 'valid', + value: function valid() { + return this.data.search(/^[0-9]{14}$/) !== -1 && +this.data[13] === checksum(this.data); + } + }]); + + return ITF14; +}(_ITF3); + +export default ITF14; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/constants.js b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/constants.js new file mode 100644 index 0000000..6dd948a --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/constants.js @@ -0,0 +1,11 @@ +'use strict'; + +var START_BIN = '1010'; +var END_BIN = '11101'; +var BINARIES = ['00110', '10001', '01001', '11000', '00101', '10100', '01100', '00011', '10010', '01010']; + +export default { + START_BIN, + END_BIN, + BINARIES +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/index.js new file mode 100644 index 0000000..135d2c2 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/ITF/index.js @@ -0,0 +1,9 @@ +'use strict'; + +import ITF from './ITF' +import ITF14 from './ITF14' + +export default { + ITF, + ITF14 +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI.js b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI.js new file mode 100644 index 0000000..b402920 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI.js @@ -0,0 +1,111 @@ +"use strict"; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _Barcode3 from '../Barcode.js' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation +// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup + +var MSI = function(_Barcode) { + _inherits(MSI, _Barcode); + + function MSI(data, options) { + _classCallCheck(this, MSI); + + return _possibleConstructorReturn(this, (MSI.__proto__ || Object.getPrototypeOf(MSI)).call(this, data, + options)); + } + + _createClass(MSI, [{ + key: "encode", + value: function encode() { + // Start bits + var ret = "110"; + + for (var i = 0; i < this.data.length; i++) { + // Convert the character to binary (always 4 binary digits) + var digit = parseInt(this.data[i]); + var bin = digit.toString(2); + bin = addZeroes(bin, 4 - bin.length); + + // Add 100 for every zero and 110 for every 1 + for (var b = 0; b < bin.length; b++) { + ret += bin[b] == "0" ? "100" : "110"; + } + } + + // End bits + ret += "1001"; + + return { + data: ret, + text: this.text + }; + } + }, { + key: "valid", + value: function valid() { + return this.data.search(/^[0-9]+$/) !== -1; + } + }]); + + return MSI; +}(_Barcode3); + +function addZeroes(number, n) { + for (var i = 0; i < n; i++) { + number = "0" + number; + } + return number; +} + +export default MSI; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI10.js b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI10.js new file mode 100644 index 0000000..f059a35 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI10.js @@ -0,0 +1,49 @@ +'use strict'; + +import _MSI3 from './MSI.js' + +import _checksums from './checksums.js' + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var MSI10 = function(_MSI) { + _inherits(MSI10, _MSI); + + function MSI10(data, options) { + _classCallCheck(this, MSI10); + + return _possibleConstructorReturn(this, (MSI10.__proto__ || Object.getPrototypeOf(MSI10)).call(this, data + + (0, _checksums.mod10)(data), options)); + } + + return MSI10; +}(_MSI3); + +export default MSI10; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI1010.js b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI1010.js new file mode 100644 index 0000000..6613378 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI1010.js @@ -0,0 +1,51 @@ +'use strict'; + +import _MSI3 from './MSI.js' + +import _checksums from './checksums.js' + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var MSI1010 = function(_MSI) { + _inherits(MSI1010, _MSI); + + function MSI1010(data, options) { + _classCallCheck(this, MSI1010); + + data += (0, _checksums.mod10)(data); + data += (0, _checksums.mod10)(data); + return _possibleConstructorReturn(this, (MSI1010.__proto__ || Object.getPrototypeOf(MSI1010)).call(this, + data, options)); + } + + return MSI1010; +}(_MSI3); + +export default MSI1010; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI11.js b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI11.js new file mode 100644 index 0000000..8e87809 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI11.js @@ -0,0 +1,50 @@ +'use strict'; + +import _MSI3 from './MSI.js' + +import _checksums from './checksums.js' + + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var MSI11 = function(_MSI) { + _inherits(MSI11, _MSI); + + function MSI11(data, options) { + _classCallCheck(this, MSI11); + + return _possibleConstructorReturn(this, (MSI11.__proto__ || Object.getPrototypeOf(MSI11)).call(this, data + + (0, _checksums.mod11)(data), options)); + } + + return MSI11; +}(_MSI3); + +export default MSI11; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI1110.js b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI1110.js new file mode 100644 index 0000000..97df483 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/MSI1110.js @@ -0,0 +1,51 @@ +'use strict'; + +import _MSI3 from './MSI.js' + +import _checksums from './checksums.js' + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} + +var MSI1110 = function(_MSI) { + _inherits(MSI1110, _MSI); + + function MSI1110(data, options) { + _classCallCheck(this, MSI1110); + + data += (0, _checksums.mod11)(data); + data += (0, _checksums.mod10)(data); + return _possibleConstructorReturn(this, (MSI1110.__proto__ || Object.getPrototypeOf(MSI1110)).call(this, + data, options)); + } + + return MSI1110; +}(_MSI3); + +export default MSI1110; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/checksums.js b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/checksums.js new file mode 100644 index 0000000..1bd53f9 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/checksums.js @@ -0,0 +1,29 @@ +"use strict"; + +function mod10(number) { + var sum = 0; + for (var i = 0; i < number.length; i++) { + var n = parseInt(number[i]); + if ((i + number.length) % 2 === 0) { + sum += n; + } else { + sum += n * 2 % 10 + Math.floor(n * 2 / 10); + } + } + return (10 - sum % 10) % 10; +} + +function mod11(number) { + var sum = 0; + var weights = [2, 3, 4, 5, 6, 7]; + for (var i = 0; i < number.length; i++) { + var n = parseInt(number[number.length - 1 - i]); + sum += weights[i % weights.length] * n; + } + return (11 - sum % 11) % 11; +} + +export default { + mod10, + mod11 +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/index.js new file mode 100644 index 0000000..a0524eb --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/MSI/index.js @@ -0,0 +1,19 @@ +'use strict'; + +import MSI from './MSI.js' + +import MSI10 from './MSI10.js' + +import MSI11 from './MSI11.js' + +import MSI1010 from './MSI1010.js' + +import MSI1110 from './MSI1110.js' + +export default { + MSI, + MSI10, + MSI11, + MSI1010, + MSI1110 +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/codabar/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/codabar/index.js new file mode 100644 index 0000000..9d84016 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/codabar/index.js @@ -0,0 +1,129 @@ +"use strict"; + + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _Barcode3 from '../Barcode.js' + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding specification: +// http://www.barcodeisland.com/codabar.phtml + +var codabar = function(_Barcode) { + _inherits(codabar, _Barcode); + + function codabar(data, options) { + _classCallCheck(this, codabar); + + if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { + data = "A" + data + "A"; + } + + var _this = _possibleConstructorReturn(this, (codabar.__proto__ || Object.getPrototypeOf(codabar)).call( + this, data.toUpperCase(), options)); + + _this.text = _this.options.text || _this.text.replace(/[A-D]/g, ''); + return _this; + } + + _createClass(codabar, [{ + key: "valid", + value: function valid() { + return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; + } + }, { + key: "encode", + value: function encode() { + var result = []; + var encodings = this.getEncodings(); + for (var i = 0; i < this.data.length; i++) { + result.push(encodings[this.data.charAt(i)]); + // for all characters except the last, append a narrow-space ("0") + if (i !== this.data.length - 1) { + result.push("0"); + } + } + return { + text: this.text, + data: result.join('') + }; + } + }, { + key: "getEncodings", + value: function getEncodings() { + return { + "0": "101010011", + "1": "101011001", + "2": "101001011", + "3": "110010101", + "4": "101101001", + "5": "110101001", + "6": "100101011", + "7": "100101101", + "8": "100110101", + "9": "110100101", + "-": "101001101", + "$": "101100101", + ":": "1101011011", + "/": "1101101011", + ".": "1101101101", + "+": "101100110011", + "A": "1011001001", + "B": "1001001011", + "C": "1010010011", + "D": "1010011001" + }; + } + }]); + + return codabar; +}(_Barcode3); + +export default codabar; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/index.js new file mode 100644 index 0000000..ce52c95 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/index.js @@ -0,0 +1,37 @@ +'use strict'; + +import _CODE from './CODE39/' + +import _CODE2 from './CODE128/' + +import _EAN_UPC from './EAN_UPC/' + +import _ITF from './ITF/' + +import _MSI from './MSI/' + +import _pharmacode from './pharmacode/' + +import _codabar from './codabar' +export default { + CODE128: _CODE2.CODE128, + CODE128A: _CODE2.CODE128A, + CODE128B: _CODE2.CODE128B, + CODE128C: _CODE2.CODE128C, + EAN13: _EAN_UPC.EAN13, + EAN8: _EAN_UPC.EAN8, + EAN5: _EAN_UPC.EAN5, + EAN2: _EAN_UPC.EAN2, + UPC: _EAN_UPC.UPCE, + UPCE: _EAN_UPC.UPCE, + ITF14: _ITF.ITF14, + ITF: _ITF.ITF, + MSI: _MSI.MSI, + MSI10: _MSI.MSI10, + MSI11: _MSI.MSI11, + MSI1010: _MSI.MSI1010, + MSI1110: _MSI.MSI1110, + PHARMACODE: _pharmacode, + CODABAR: _codabar, + CODE39: _CODE, +} \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/barcodes/pharmacode/index.js b/components/Jnpf/Barcode/tki-barcode/barcodes/pharmacode/index.js new file mode 100644 index 0000000..de5cbde --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/barcodes/pharmacode/index.js @@ -0,0 +1,103 @@ +"use strict"; + +var _createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +import _Barcode3 from '../Barcode.js' + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = + superClass; +} // Encoding documentation +// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf + +var pharmacode = function(_Barcode) { + _inherits(pharmacode, _Barcode); + + function pharmacode(data, options) { + _classCallCheck(this, pharmacode); + + var _this = _possibleConstructorReturn(this, (pharmacode.__proto__ || Object.getPrototypeOf(pharmacode)) + .call(this, data, options)); + + _this.number = parseInt(data, 10); + return _this; + } + + _createClass(pharmacode, [{ + key: "encode", + value: function encode() { + var z = this.number; + var result = ""; + + // http://i.imgur.com/RMm4UDJ.png + // (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34) + while (!isNaN(z) && z != 0) { + if (z % 2 === 0) { + // Even + result = "11100" + result; + z = (z - 2) / 2; + } else { + // Odd + result = "100" + result; + z = (z - 1) / 2; + } + } + + // Remove the two last zeroes + result = result.slice(0, -2); + + return { + data: result, + text: this.text + }; + } + }, { + key: "valid", + value: function valid() { + return this.number >= 3 && this.number <= 131070; + } + }]); + + return pharmacode; +}(_Barcode3); + +export default pharmacode; \ No newline at end of file diff --git a/components/Jnpf/Barcode/tki-barcode/tki-barcode.vue b/components/Jnpf/Barcode/tki-barcode/tki-barcode.vue new file mode 100644 index 0000000..13b5304 --- /dev/null +++ b/components/Jnpf/Barcode/tki-barcode/tki-barcode.vue @@ -0,0 +1,203 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Button/index.vue b/components/Jnpf/Button/index.vue new file mode 100644 index 0000000..3755750 --- /dev/null +++ b/components/Jnpf/Button/index.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Calculate/index.vue b/components/Jnpf/Calculate/index.vue new file mode 100644 index 0000000..1994176 --- /dev/null +++ b/components/Jnpf/Calculate/index.vue @@ -0,0 +1,303 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Cascader/Tree.vue b/components/Jnpf/Cascader/Tree.vue new file mode 100644 index 0000000..4d9dcb3 --- /dev/null +++ b/components/Jnpf/Cascader/Tree.vue @@ -0,0 +1,277 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Cascader/index.vue b/components/Jnpf/Cascader/index.vue new file mode 100644 index 0000000..e8e8964 --- /dev/null +++ b/components/Jnpf/Cascader/index.vue @@ -0,0 +1,151 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Checkbox/index.vue b/components/Jnpf/Checkbox/index.vue new file mode 100644 index 0000000..219d24c --- /dev/null +++ b/components/Jnpf/Checkbox/index.vue @@ -0,0 +1,97 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/ColorPicker/index.vue b/components/Jnpf/ColorPicker/index.vue new file mode 100644 index 0000000..4c3027c --- /dev/null +++ b/components/Jnpf/ColorPicker/index.vue @@ -0,0 +1,129 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/ColorPicker/t-color-picker.vue b/components/Jnpf/ColorPicker/t-color-picker.vue new file mode 100644 index 0000000..d73fc77 --- /dev/null +++ b/components/Jnpf/ColorPicker/t-color-picker.vue @@ -0,0 +1,633 @@ + + + + diff --git a/components/Jnpf/DateCalculate/index.vue b/components/Jnpf/DateCalculate/index.vue new file mode 100644 index 0000000..a1dd8fb --- /dev/null +++ b/components/Jnpf/DateCalculate/index.vue @@ -0,0 +1,221 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/DatePicker/Select.vue b/components/Jnpf/DatePicker/Select.vue new file mode 100644 index 0000000..6f3b929 --- /dev/null +++ b/components/Jnpf/DatePicker/Select.vue @@ -0,0 +1,633 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/DatePicker/index.vue b/components/Jnpf/DatePicker/index.vue new file mode 100644 index 0000000..3330a17 --- /dev/null +++ b/components/Jnpf/DatePicker/index.vue @@ -0,0 +1,210 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/DateRange/index.vue b/components/Jnpf/DateRange/index.vue new file mode 100644 index 0000000..b2d40d8 --- /dev/null +++ b/components/Jnpf/DateRange/index.vue @@ -0,0 +1,141 @@ + + \ No newline at end of file diff --git a/components/Jnpf/Divider/index.vue b/components/Jnpf/Divider/index.vue new file mode 100644 index 0000000..d0a82dd --- /dev/null +++ b/components/Jnpf/Divider/index.vue @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/components/Jnpf/Editor/Pacifico-Regular.ttf b/components/Jnpf/Editor/Pacifico-Regular.ttf new file mode 100644 index 0000000..e7def95 Binary files /dev/null and b/components/Jnpf/Editor/Pacifico-Regular.ttf differ diff --git a/components/Jnpf/Editor/editor-icon.css b/components/Jnpf/Editor/editor-icon.css new file mode 100644 index 0000000..e8f0345 --- /dev/null +++ b/components/Jnpf/Editor/editor-icon.css @@ -0,0 +1,238 @@ +@font-face { + font-family: 'iconfont'; + src: url('data:font/truetype;charset=utf-8;base64,AAEAAAANAIAAAwBQRkZUTYZt980AACuYAAAAHEdERUYAKQBBAAAreAAAAB5PUy8yPJdOmAAAAVgAAABWY21hcLyvuFAAAAJMAAACGmdhc3D//wADAAArcAAAAAhnbHlm1+PZcgAABOAAACD0aGVhZBRVFL8AAADcAAAANmhoZWEISgQAAAABFAAAACRobXR4TS8LYAAAAbAAAACcbG9jYQhHD/wAAARoAAAAeG1heHABTgChAAABOAAAACBuYW1lKeYRVQAAJdQAAAKIcG9zdLoCe30AAChcAAADEgABAAAAAQAAUo9exF8PPPUACwQAAAAAANhk6GIAAAAA2GToYgAA/34EbAOAAAAACAACAAAAAAAAAAEAAAOA/4AAXARsAAAAAARsAAEAAAAAAAAAAAAAAAAAAAATAAEAAAA7AJUACQAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQQBAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5ifspQOA/4AAXAOAAIIAAAABAAAAAAAABAAAAAAAAAABVQAABAAALwQAAJ0EAAAeBAAAQARsAAAEAAACBAAANwQAADcEAACVBAAAmgQAAJoEAAA+BAAAQAQAACUEAQAABAAAQAAnAIAAgABgAIAAgACAAIAAeAAAAFAAMABgAEAAYAAgAEAAOQAgAGAAYACAAD8AYAAgAEAA1wBeACEAwACAAOAAogBgABoAIQBgADIAiwBAAAAAAwAAAAMAAAAcAAEAAAAAARQAAwABAAAAHAAEAPgAAAA6ACAABAAa5ifmK+Yx5jPmPuZN5mDmZOZu5njmfuaE5ujm/ecs513n+Ohg6GXpZOso7AnsE+x87JTsnuyg7KX//wAA5ifmK+Yx5jPmPuZN5l/mZOZt5njmfuaE5ujm/ecs51zn+Ohg6GPpZOso7AnsE+x67H/snuyg7KX//xncGdkZ1BnTGckZuxmqGacZnxmWGZEZjBkpGRUY5xi4GB4Xtxe1FrcU9BQUFAsTpROjE5oTmROVAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBgAAAQAAAAAAAAABAgAAAAIAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGgB8ANIA7AGaAiwCugNGBCAEgATiBRgFfgXyBl4GfAbGBwAHOAeWB7wH5ggoCGgI5AlSCaIKIgqmCxILPAtKC64L+gw8DIQMpgzKDQYNKA1GDaAN4g4MDlIObA6gDs4O6g8MD2APpA/GD+gQHhB6AAEAL/+AA8ADgAAJAAABNQkBNQQCFyYSAkABgP6A/r1YYdeEAoj4/oD+gP4G/rCo+QIEAAACAJ0ACANqAtQAKwA9AAAlIS4BJxE+ATchHgEXFQ4BIiY9AS4BJyEOAQcRHgEzITI2NzU0NjIWFxUOASUiLwEmNDYyHwEBNjIWFAcBBgL2/hsxQQICQTEB6y4+AgESGxIBGhP+FRYdAQEdFgHlFh0BEhsSAQJB/qoNCqMKFBkKjQFgChkUCv6KCggBQTEB5jBCAQE+Lx4NEhINHhQZAQEdFf4aFh0dFvkOEhIO+TFBnwqjChoTCY0BYAoUGQr+iQkAAAAABAAeAEoD4gJoAA8AGwAnADAAAAEGBAcmJC8BNzYkNxYEHwElDgEHHgEXPgE3LgEDLgEnPgE3HgEXDgEnDgEUFjI2NCYD0Ar+/sTE/v4LERELAQLExAECChL+Ho3WKirWjY3WKirWjTpNAQFNOjpNAQFNOh8qKj4qKgFEFtUPD9UWFRUX1Q4O1RcVzgeVMjKUCAiUMjKV/qwCTzw8UAEBUDw8T9cBK0ArK0ArAAEAQP+AA9EDgAAJAAAFNgIlFQkBFQQSAvphWP69/oABgAGNhICoAVAG/gGAAYD4C/38AAAIAAD/gARsA4AAHwArAEAATABVAGIAaAB1AAAFIikBLgEnET4BNzMVIyIGHQEhNS4BKwE1Mx4BFxEOARMiKQERFBYzITI2NwEwDwEGDwEjNzEuASc+ATceARcUBycOARQWMj8BNjcuAQUGDwE1NzMRIwEuASc1PgEyFh0BFAYlMjMhFSEHLgE9ATQ2MhYdARQGBAA5/m/+Ni49AQE9LlFRFx8EAAEeF1FRLj0BAT0IQP5A/gAfFwOUFx4B/uUCAgUGhTpiM0UBAUUzNEQBDmscJiY5FAkJAQEm/q0FIylTNDYCAAsPAQEPFw8P/aMi7AEN/eU1DA8PFw8PgAE9LgLXLj0BNh8Xa2sXHzYBPS79KS49AqH9yhcfHxcBIAMDCQjSoAJMOTlMAgJMOSIcjwEuRC4YEBIWIi4VBCAkQ1D+UgKGAQ8LogsQEAuiCw+GNlEBDwuiCxAQC6ILDwADAAL/fgPvA3AAKwBNAGcAAAEjNS4BJyMOAQcVIw4BBxUUFhcDHgE3ITUzFjI3MxYyNzMWNjcRPgE9AS4BAyM1NCYiBh0BIzU0JiIGBxUjNS4BIgYdASMiJicRIREUBhMUBiMhIiYnNT4BMyE1PgE3Mx4BFxUhMhYVA3/fAS8kpyQvAeAvPwEeGgEKYAYBMxUEBwO2AwcEhQZgCRoeAT+DVBAYEIwQGA8BiwEPGBBUJC8BAw4vZyAY/PIXIAEBIBcBGAEvIzgkLwEBFxggAnSoIzABATAjqAE/MDcgMg/+hlEjBAEBAQEBBCNQAXoPMiA3MD/9SN4MEBAM3t4MEBAM398MEBAM3ywoAU/+sScsAhIYICAYNxggqCMwAQEwI6ggGAAABQA3/8ED2gNPABEAIAAzAEQAXwAAASIjISYnJj4BMyEyFxYOASMGAzI7AR4BBwYHIS4BNzYzBSIjJSInJjY3NjMlIR4BFAYHIxUyOwEWFxYGBwYjBS4BNDYzATQmIg8BNTQmIgYdAScmIgYUFzEXFjI/ATE2ApxL0v7jHQgEBxgOAwQhCAQGGBBnZzlQiRcWBwke/LkXFwYIIAIjRs3+7RwJBAYKDQ8BcAFvFBYWFLwuJVQcCQQGCgwP/TcTFhYSAjQVHwotFB8ULQogFAlrCiEKawkB0AEZDBcOGgwXDgEBgAEeFBgBARwUG+YBGQwWBwkBARUiFAHoARgMFwcIAQEUIhX+2g8UCzKpDxQUD6kyCxQdCnYMDHYKAAAFADf/wQPaA00AEQAgADMARABeAAAlIiMhJicmPgE3ITIXFg4BIwYDMjsBHgEHBiMhIiY3NjcFIiMhJicmNjc2NykBMhYUBisBFTIzFxYXFgYHBgchIiY0NjMBMScmIg8BMQYUFjI/ARUUFjI2PQEXFjI2NAKcS9L+4x0IBAcYDgMEIQgEBhgQZ2c5UIkXFgcJHvy5FxcGCCACI0bN/u0cCQQGCg0PAXABbxQWFhS8LiVUHAkEBgoMD/03ExYWEgIrawohCmsJFCAKLRQfFC0KHxVbARkNFw0BGg0WDgEBgAEeFRgdFBoB5gEYDBcHCAEVIhXoAQEYCxcHCAEVIRUCv3cLC3cKHRQMMagPFBQPqDEMFB0AAAAACQCV/4EDawN+AB8ALwA9AE4AWgBrAHcAiACUAAABIzUuAScjLgEiBgcjDgEHFSMiBhURFBYXIT4BNRE0JiUzMjY3PgEyFhceATsBFSEBIREzFR4BMyEyNjc1MwUHJyYiBhQfARYyPwE2NCYiFyIGFBYzITI2NCYjBQcnJiIGFB8BFjI/ATY0JiIFIQ4BFBYzITI2NCYFBycmIgYUHwEWMj8BNjQmIgUhIgYUFhchPgE0JgNZVQEKB4IJPVQ9CYIHCgFVCAoKCAKyCAoK/b9/BwoBAyxALAMBCgd//kACJ/1yQwEKBwHkBwoBQ/4zSiEFDwoFLQYOBlYFCw5WBwoKBwEpBwoKB/58SiEFDwoFLQYOBlYFCw4Bf/7XBwoKBwEpBwoK/nVKIQUPCgUtBg4GVgULDgF//tcHCgoHASkHCgoC4TEHCgEoMjIoAQoHMQoI/MQHCgEBCgcDPAgKHwkIICkpIAgJbf0SAxg8CAoKCDzCSiEFCg8FLgUFVwUOCysKDwsLDwqlSSEFCw4GLQUFVgYOCysBCg8KCg8KpEohBgsPBS4FBVcFDgsrCg8KAQEKDwoAAAMAmv+AAzMDTQAXADQAPQAAJScmIgYUHwEhDgEUFhchBwYUFjI/ATY0ESEOAQceARczFRQWMjY1ETMRHgEyNjcRMzI2NCYBIy4BJz4BNzMDEmYIFBAIOv4kCg8PCgHcOggPFQhmCP5MV3MCAnNXNA4WD5kBDhYOAYAKDw/+djRBVwEBV0E0EmcHEBQIOgEOFg4BOggVDwhmCBQDQwJ0V1d0AuYLDw8LAk39swsPDwsCTQ4WD/6ZAldBQVcCAAAAAAMAmv+AAzMDTQAcACUAPQAAASEOAQceARczFRQWMjY1ETMRHgEyNjcRMzI2NCYBIy4BJz4BNzMBITc2LgEiDwEGFB8BFjI2NC8BIT4BNCYDGv5MV3MCAnNXNA4WD5kBDhYOAYAKDw/+djRBVwEBV0E0AUz+JToIAQ8UCGYICGYIFQ8IOgHbCw8PA00CdFdXdALmCw4OCwJN/bMLDg4LAk0OFg/+mQJXQUFXAv0AOggUEAdnCBQIZggPFQg6AQ4WDgAAAAADAD7/vgPCA0IADwAXABsAAAEhDgEHER4BFyE+ATcRLgEDJyMHIxMzEwEDMwMDUv1cL0ABAUAvAqQvQAEBQM82+DZn4m7i/uZevl0DQgFAL/1cL0ABAUAvAqQvQPzuqKgCav2WAfr+5wEZAAADAEAAAAPAAsAAFgAjAD8AAAEzPgE0JichDgEUFhczBwMGHgE2NxM2AT4BNyEeARQGByEuASUnJiIGFB8BBwYUFjI/ARcWMjY0LwE3NjQmIgcBtMwbJCQb/gAbJCQbuQEtBB02KgUtAv6IASQbAYAbJCQb/oAbJAK/VxMxJRJXVxIlMRNXVxMxJRJXVxIlMRMCQAEkNiQBASQ2JAEH/tgfMQsiHwEoEf4QGyQBASQ2JAEBJPJXEiUxE1dXEzElEldXEiUxE1dXEzElEgACACX/yQPbAzcABwBLAAABAxcWMzI3JgE3PgQ3GwEzFhcTHgEXHgEXFhceARcWHQEiJiMiBiM0PwI2PwE+ATU0Ji8BJQ4BFB4CHwEWFRQHIiYjIgYjBgHDYU47IAsWMv4rAQ0mGx0WB4egSQUCdRNTFwkxEQsJC04JAySRJSufFgJbCAYDBgQCIxcY/v4OOhAiFRYXAQEhhSIEFQIuAkH+/gEBAZH9+i0EBwULFhIBYAGeCAT+7i3NNhR+IRoHCBEDFgsPCQgYFBQCAgIFAgcFCVw3OgEhnhoSCgYCAgsWBQsMBQgAAAAABQAAABIEAAM3AA0AHQAtAD0ATQAAExEUBiIvASY0PwE2MhYBFRQGIyEiJj0BNDYzITIWNRUUBiMhIiY9ATQ2MyEyFjUVFAYjISImPQE0NjMhMhY1FRQGIyEiJj0BNDYzITIW2woQBaUFBaUFEAoDJQsH/CQHCwsHA9wHCwsH/ZIHCwsHAm4HCwsH/ZIHCwsHAm4HCwsH/CQHCwsHA9wHCwJJ/rcHCwWkBhAFpAUK/kFtCAsLCG0ICwvUbgcLCwduBwsL1G4HCwsHbggKCtRuCAoKCG4HCwsAAgBA/4ADwAMAAAcADwAAEyEVIxEjESMBIxEjESM1IUABgICAgAOA/Ij8AoABgID+gAGAAYD9AAMAgAAAAwAn/88D2QMxABgAHAAsAAA3MzI2PwEhFx4BOwE+AScDJicjIgYHAwYWATMXIwEhIgYHFR4BMyEyNjc1LgHNUQkPAz8BCEUDDwlRCwsE7AcTjAkPA9kECwEqElWyAhj8igwRAQERDAN2DBEBARG7DQmvrwkNAQ8KAkkSAQoJ/bcKDwH/xf5PEQ07DBERDDsNEQAAAAIAgACAA4AC1QALACQAABMzETMRMxEjESMRIykBIiY0PwE2NCYiBhUjPgE3HgEXFAYPASGAVatVVatVAwD/ACMyF88ZMkYyVQFhSElgAhsXzgEAAtX/AAEA/asBAP8AMkYX4BhHMjIjSGEBAWFIJD0Y3QAAAgCAAIADgALVAAsAJwAAEzMRMxEzESMRIxEjATMyFhURFAYrASImPQEzFTM1IzUzNSMVIzU0NoBVq1VVq1UCAKsjMjIjqyMyVaurq6tVMgLV/wABAP2rAQD/AAJVMiP+VSMyMiMrK6tVqysrIzIAAAIAYAAgA6EC4AAjAD0AAAEhBgcVFhczNjc1MxEjBgcVFhchNjc1JicjETMVFhczNjc1JgEjETMyNi8BJg8BBhY7AREjIgYfARY/ATYmAoj94AcBAQc4BwGoXAcBAQcBCAcBAQdcqAEHOAcBAQEKQUEEBAJlBgZkAwQEQUEEBANkBgZkAwQC4AEHgAcBAQdA/dABBzgHAQEHOAcBAjBABwEBB4AH/d8BhAgEfwYGfwQI/nwIBH8GBn8ECAAAAgCAAIADVQLVAAsAFgAAEzMRMxEzESMRIxEjITUzEQc1NzMRMxWAVatVVatVAdVWa2tVVQLV/wABAP2rAQD/AFUBnj5jPf4AVQAAAAMAgACAA4AC1QALABYAGQAAEzMRMxEzESMRIxEjITUjNRMzETMVIxUDNQeAVatVVatVAoDV1VUrK1VtAtX/AAEA/asBAP8A1VYBKv7WVtUBK5iYAAIAgACAA4AC1QALACsAABMzETMRMxEjESMRIwEzFSMVMx4BFw4BByMuASc1MxUzPgE0JicjLgEnNT4BgFWrVVWrVQIA1dVVSWACAmBJVSQwAVVVJDExJFUkMAEBMALV/wABAP2rAQD/AAJVVasBYUhJYAIBMCQrKwExSDABATAkqyQwAAMAgACAA4AC1QALACQAKAAAEzMRMxEzESMRIxEjATMeARcVIzUjFTMeARcVDgEHIy4BJxE+ARMVMzWAVatVVatVAgCrJDABVaurJDABATAkqyQwAQEwJKsC1f8AAQD9qwEA/wACVQEwJCsrqwEwJKskMAEBMCQBqyQw/qyrqwAAAgB4/6IDiQNeAC8AVgAAJSY1Ji8BJiIGFB8BITc2NCYiDwEOAR0BFBYfARYyPgEvASEHBhQWMj8CPgE1NyYBPgE9ASERIyIGFBY7ATI2NCYrAREhFRQWMjY9ATQmIyEiBh0BFBYDiAEBA2YFDgoFSf1jSQUKDgVmAgICAmYFDQoBBUkCnUkFCg4FZwEBAgEB/UUHCgERMwgJCQiICAkJCDMBEQoOCgoH/ZoHCgoeAQEDA2YFCg4FSUkFDgoFZwIFAwMCBQJoBAoNBUpKBQ4KBWYCAgQDAgIC2wEJCDP9MwoOCgoOCgLNMwgJCQhEBwoKB0QICQAAAAAFAAAAEgQAAzcADgAeAC4APgBOAAATFA8BBiImNRE0NjIfARYBFRQGIyEiJj0BNDYzITIWNRUUBiMhIiY9ATQ2MyEyFjUVFAYjISImPQE0NjMhMhY1FRQGIyEiJj0BNDYzITIWyQWlBQ8LCw8FpQUDNwsH/CQHCwsHA9wHCwsH/ZIHCwsHAm4HCwsH/ZIHCwsHAm4HCwsH/CQHCwsHA9wHCwGlCAakBQsHAUkICgWkBf7lbQgLCwhtCAsL1G4HCwsHbgcLC9RuBwsLB24ICgrUbggKCghuBwsLAAAABABQ/9ADsAMwABEAFQAZADIAAAkBJiMhDgEHER4BFyE+ATcRNCUzFSMBITUhFyM1NCYjISIGHQEjETMVFBYzITI2PQEzAQOd/v4TGv4iGyQBASQbAuAbJAH9cMDAAcD+QAHAkFASDv4ADhJQUBIOAQAOEk4BAgIbAQITASQb/SAbJAEBJBsB3hrocP2QkJCwDhISDrAC4JAOEhIOkP7+AAYAMP+wA9ADUAAQACEAMgBEAFQAWAAAASMiBh0BFBYyNj0BMzI2NCYhIyIGFBY7ARUUFjI2PQE0JgEjNTQmIgYdARQWOwEyNjQmJSIGHQEjIgYUFjsBMjY9ATQmEyEOAQcRHgEXIT4BNxEuAQERIREBcZEOEhIcEnENExMBk5EOEhIOcRIbExP+U3ESHBISDpENExMBkw4ScQ4SEg6RDRMTcvzgGyQBASQbAyAbJAEBJPzFAyACwBIOig0TEw1qEhwSEhwSag0TEw2KDhL9tmoOEhIOig4SEhwSihIOahIcEhIOig4SAlABJBv84BskAQEkGwMgGyT8oQMg/OAAAAAGAGD/wAOgA0AADwAfADMAPwBLAFcAAAEhDgEHER4BFyE+ATcRLgEDFAYjISImNRE0NjMhMhYVNyEiBhQWMyEyFhURFBYyNjURLgEBISIGFBYzITI2NCYHISIGFBYzITI2NCYHIyIGFBYXMz4BNCYC0P3gIi0BAS0iAiAiLQEBLRIJB/3gBwkJBwIgBwlw/eAOEhIOAiAHCRIcEgEt/u7+wA4SEg4BQA4SEg7+wA4SEg4BQA4SEo7ADhISDsAOEhICwAEtIv2gIi0BAS0iAmAiLf1RBwkJBwJgBwkJB9ASHBIJB/2gDhISDgJgIi3+2RIcEhIcEqASHBISHBKfEhsSAQESGxIAAAAFAED/oAPAA2AAHwAjAC0AOgBHAAABIzU0JiMhIgYdASMiBhQWOwETHgEXIT4BNxMzMjY0JiUhFSEBDgEjISImJwMhAzI2NRE0JiIGFREUFiMyNjURNCYiBhURFBYDoMASDv6ADhLADhISDiJOBDUmAaImNQROIg4SEv2yAUD+wAGRAhEN/l4NEQJNAnzeDhISHBISog4SEhwSEgLwUA4SEg5QEhwS/UUlLwEBLyUCuxIcEjAw/QwMEBAMArT9mxIOAdYNExMN/ioOEhIOAdYNExMN/ioOEgADAGD/wAOmAzcABAAPABMAAAEnAQc3AScjLgEPARc3NjQBIRUhAwib/jQnvwJpgwEEDQWDm4EF/LoDQPzAAfet/lm8DQJMlwUBBXitdwQN/WtAAAABACABQAPgAbAAAwAAEyEVISADwPxAAbBwAAAAAwBA/9UDwgMyAB4AJwA/AAABITY1LgEHDgEdAQ4BByMiBhURHgEzITI2NxM2LgIBETQ7AREjIiYBAw4BIyERPgE3NTY3NhYXFAcGFjMhMhYDWf73EwJUNi4sAUo5dhsoASYcAo0lOAdKBAseKf0QA01NAQIC/0kDFQ7+AE1fAQEiFiwBHAUSEQE0EhcCJ0I0PlcFB0QzOzpTBycc/nsdJi4lAYUXLCQT/fEBhQP+dQIBov57DhEBjhBzTjs5BgExIThUDxscAAADADn/uwPXAycAEwAlACkAAAEuAQ8BFzc2FhcWBg8BFzc+AiYBBiYnJjY/AScHDgEXHgE/AScTFwEnA45U82dlM2RNsz47E0lsMmwwOQ0i/k9Msz86E0lvMm9jGk9V82dpMzcz/qkzAqpjGk9SPlI6E0lMsz9XPlcnanp0/c06E0lMsz9aPlpU82djGk9VPwGBPv7iPQAAAAUAIAAAA+ADAAASABMAHAAgACQAAAE0LwEmDwEGIi8BLgEPAQYVESEDIx4BMjY0JiIGJREhEQMhESEDgAisDAlNBQ0E/QUMBbwFAwBgQAEkNiQkNiT9PwPAQPzAA0ABDQkFaQYJXgUF/AQBBaoFB/73AeAbJCQ2JCSl/QADAP1AAoAAAAkAYAARA6AC7wADAAcACwAMABUAFgAfACAAKQAAASEVIRUhFSEVIRUhAyMeATI2NCYiBhMjHgEyNjQmIgYTIx4BMjY0JiIGASACgP2AAoD9gAKA/YCAQAEkNiQkNiQ/QAEkNiQkNiQ/QAEkNiQkNiQC4GDQYNBgApAbJCQ2JCT+tRskJDYkJP61GyQkNiQkAAQAYAAAA6ADAAADAAcACwAPAAATIRUhESEVIRMhFSERIRUhYANA/MADQPzAgAJA/cACQP3AAwBg/qBgAUBg/qBgAAAABACAAFIDdQLAAAMABwALAA8AABMhESEREzMDKQERIRETMwOAAVX+q5BukAEyAVX+q5BukAGn/qsBVQEZ/uf+qwFVARn+5wAABgA//+ADoAMpAAUADwAbAB8AIwAnAAATMzUjFTMDMwcVMzUjNzUjETMVIxUzFSMVMzUjEyEVIRUhFSEVIRUhYzdbJCNAQIBAQIBJKipJgIDgAoD9gAKA/YACgP2AAmDJN/7AWzc3Wzf+iRI3EjfJAjdg0GDQYAAABABgAAADoAMAAAMABwALAA8AABMhFSERIRUhASEVIREhFSFgA0D8wANA/MABAAJA/cACQP3AAwBg/qBgAUBg/qBgAAACACAARAPUAqAABQALAAAJAjcnNyUHFwcXAQEs/vQBDEjU1AFUSNTUSAEMAqD+0v7SQO7uQEDu7kABLgAHAED/wAPAA0AACwAXABgAIQAiACsAMgAAAQ4BBx4BFz4BNy4BAy4BJz4BNx4BFw4BASMeATI2NCYiBgUjHgEyNjQmIgYFHgEXPgE3AgC+/QUF/b6+/QUF/b6j2QQE2aOj2QQE2f6dQAEkNiQkNiQBv0ABJDYkJDYk/l8Do3p6owMDQAX9vr79BQX9vr79/MUE2aOj2QQE2aOj2QH8GyQkNiQkGxskJDYkJJt6owMDo3oAAAADANf/7QMgAwYAEwAdACYAAAEmJzU+ATc2JzQmJyERITI3Njc0ATMWFxYUBwYrAQEGByM1Mx4BFAMBIUEiLw0YAXZ1/q4BbV0/PwH+OMNCHyAgH0LDATEfQ8/PQz4BQTMRAhAoFS0xX3QB/Oc+PGc+AY8BHyFgICL+yyMC7wFFYQAAAAADAF7/4AOdAyAACwATABcAAAEhIgYUFhchPgE0JiUzNSE1IRUhETMRIwN9/QANEhINAwAOEhL+NXABIP1QASBwcAGKEhsSAQESGxI28HBw/lD+4AAEACEAAAPgA2AABwALAA4AJwAACQEzNyEXMwEDEzMTBQchAw4BFSE1IzY3PgE1NCYjIgcXNjMyFhUUBgE7/uZ8PAEmPHv+56JwAnABc5ABINorOwEgnwkqOylHPXQaXwkhEBUhAwf8+a2tAwf+DgFT/q014AKHIlsxUBAhLzomNkFnDyYVERYqAAAAAAEAwP/AA0ADIAALAAABESERIxEzESERMxEC4P5AYGABwGADIP6AAYD8oAGg/mADYAAAAAACAID/ygOAAyYAEQAdAAAlPgE3ESMRDgEHLgEnESMRHgEFISIGFBYXIT4BNCYCAIWwA3ACcVVVcQJwA7AB5f1ADhISDgLADhISVQOwhQGZ/mdVcQICcVUBmf5nhbBOEhsSAQESGxIAAAEA4P/qAyADKgAbAAABISIGFBYXMwMjIgYUFhchPgE0JisBEzM+ATQmAwD+4A4SEg5g5loOEhIOASAOEhIOXudXDhISAyoSGxIB/UASGxIBARIbEgLAARIbEgAAAgCi/+YDgAMSAAcACgAABTcBIwEzNyElGwEDGWf+vVr+v2ZDAYr+nJ+fGgIDKvzWqGABjv5yAAAEAGAAAAOgAwAAAwAHAAsADwAAEyEVIREhFSERIRUhESEVIWADQPzAA0D8wAJA/cACQP3AAwBg/qBgAUBg/qBgAAAAAAQAGgAvA+4CvwALABcAIwAvAAABAiADDgEXFiA3NiYHBiAnJjQ3NiAXHgEBDgEHHgEXPgE3LgEHIi4BND4BMx4BFAYD0uP+K+QbARvPAgDPGwFLvv5AvgsM0gGW0wsB/lJffwICf19ffwICf58RHhERHhEbJCQBugEF/vsgUCH6+iFQSOTkDiIO8fEOIgEAAn9fX38CAn9fX3/eER4iHhEBJDYkAAAAAAQAIf+5A+ADJwACAAoADgAmAAABIRclATM3IRczAQMTMxMBNjc+ATU0JiMiBxc2MzIWFRQOAhUhNQPA/uCQ/gv+5nw8ASY8e/7nonACcAFkCSo7KUc9dBpfCSEQFSFYOwEgAyDg5/z5ra0DB/4OAVP+rf7UECEvOiY2QWcPJhURFipFWzFQAAAEAGAAAAOgAwAAAwAHAAsADwAAEyEVIREhFSERIRUhESEVIWADQPzAA0D8wANA/MADQPzAAwBg/qBgAUBg/qBgAAAAAAEAMgBGA+ICrwAPAAABNjIWFAcBDgEnASY+ARcBA6sKGhMJ/eYJGQr+rQ4HIg8BPAKlChMaCv3YCQEIASQMJAwM/vEAAQCLABsDZQL1ABoAAAkBNjQmIgcJASYiBhQXCQEGHgE3CQEWMjY0JwInATQKExoK/sz+ywoZFAoBNP7MDQojDQE1ATQKGhMKAYoBNAoaEwn+ywE1CRMaCv7M/ssOIwkMATX+ywkTGgoAAAAAAwBAABgDwALNABEAJgA5AAABNzYWFxEOAS8BIyImNRE0NjMBBiImNDc+ATU0JicmPgEXHgEVFAYXBi4BNz4BNCYnJj4BMhceARQGAQTNDyQBASQP0p8OEhIOAj8KGRMJHyEcHAwLJA0jJStwDSQJDDo9OzcJARMaCUBERwIbpAwRFP2eFBEMqBIOAQgOEv6VCRMaCh5PLChKHg4jCA4nYDQ5ZrMNCSMOO5ellDoKGhIKRKq/rQAAAAAAEgDeAAEAAAAAAAAAFQAsAAEAAAAAAAEACABUAAEAAAAAAAIABwBtAAEAAAAAAAMACACHAAEAAAAAAAQACACiAAEAAAAAAAUACwDDAAEAAAAAAAYACADhAAEAAAAAAAoAKwFCAAEAAAAAAAsAEwGWAAMAAQQJAAAAKgAAAAMAAQQJAAEAEABCAAMAAQQJAAIADgBdAAMAAQQJAAMAEAB1AAMAAQQJAAQAEACQAAMAAQQJAAUAFgCrAAMAAQQJAAYAEADPAAMAAQQJAAoAVgDqAAMAAQQJAAsAJgFuAAoAQwByAGUAYQB0AGUAZAAgAGIAeQAgAGkAYwBvAG4AZgBvAG4AdAAKAAAKQ3JlYXRlZCBieSBpY29uZm9udAoAAGkAYwBvAG4AZgBvAG4AdAAAaWNvbmZvbnQAAFIAZQBnAHUAbABhAHIAAFJlZ3VsYXIAAGkAYwBvAG4AZgBvAG4AdAAAaWNvbmZvbnQAAGkAYwBvAG4AZgBvAG4AdAAAaWNvbmZvbnQAAFYAZQByAHMAaQBvAG4AIAAxAC4AMAAAVmVyc2lvbiAxLjAAAGkAYwBvAG4AZgBvAG4AdAAAaWNvbmZvbnQAAEcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAAcwB2AGcAMgB0AHQAZgAgAGYAcgBvAG0AIABGAG8AbgB0AGUAbABsAG8AIABwAHIAbwBqAGUAYwB0AC4AAEdlbmVyYXRlZCBieSBzdmcydHRmIGZyb20gRm9udGVsbG8gcHJvamVjdC4AAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAGh0dHA6Ly9mb250ZWxsby5jb20AAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOwAAAAEAAgECAQMBBAEFAQYBBwEIAQkBCgELAQwBDQEOAQ8BEAERARIBEwEUARUBFgEXARgBGQEaARsBHAEdAR4BHwEgASEBIgEjASQBJQEmAScBKAEpASoBKwEsAS0BLgEvATABMQEyATMBNAE1ATYBNwE4ATkEcmVkbwlzZWxlY3RhbGwHcHJldmlldwR1bmRvBGRhdGUHY2xlYXJ1cBU3MjNiaWFuamlxaV9kdWFuaG91anUWNzIyYmlhbmppcWlfZHVhbnFpYW5qdQotY2hlY2tsaXN0DWRpcmVjdGlvbi1sdHINZGlyZWN0aW9uLXJ0bAtmb250Ymdjb2xvcg1jbGVhcmVkZm9ybWF0BGZvbnQHb3V0ZGVudAhmb250c2l6ZQp0ZXh0X2NvbG9yD2Zvcm1hdC1oZWFkZXItMg9mb3JtYXQtaGVhZGVyLTMLbGluZS1oZWlnaHQPZm9ybWF0LWhlYWRlci0xD2Zvcm1hdC1oZWFkZXItNA9mb3JtYXQtaGVhZGVyLTUPZm9ybWF0LWhlYWRlci02EUNoYXJhY3Rlci1TcGFjaW5nBmluZGVudAZiYW9jdW4IcXVhbnBpbmcFZnV6aGkHc2hhbmNodQxiaWFuamlzZWt1YWkJZmVuZ2V4aWFuB2RpYW56YW4MY2hhcnVsaWFuamllC2NoYXJ1dHVwaWFuCnd1eHVwYWlsaWUManV6aG9uZ2R1aXFpB3lpbnlvbmcLeW91eHVwYWlsaWUIeW91ZHVpcWkJeml0aWRhaW1hCHhpYW9saWFuCXppdGlqaWFjdQ96aXRpc2hhbmNodXhpYW4Neml0aXNoYW5nYmlhbwp6aXRpYmlhb3RpDnppdGl4aWFodWF4aWFuCXppdGl4aWV0aQl6aXRpeWFuc2UIenVvZHVpcWkJeml0aXl1bGFuC3ppdGl4aWFiaWFvC3p1b3lvdWR1aXFpB2R1aWdvdXgGZ3VhbmJpDnNoZW5neWluX3NoaXRpAAAAAAAB//8AAgABAAAADAAAABYAAAACAAEAAwA6AAEABAAAAAIAAAAAAAAAAQAAAADVpCcIAAAAANhk6GIAAAAA2GToYg==') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; +} +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-redo:before { + content: "\e627"; +} + +.icon-undo:before { + content: "\e633"; +} + +.icon-indent:before { + content: "\eb28"; +} + +.icon-outdent:before { + content: "\e6e8"; +} + +.icon-fontsize:before { + content: "\e6fd"; +} + +.icon-format-header-1:before { + content: "\e860"; +} + +.icon-format-header-4:before { + content: "\e863"; +} + +.icon-format-header-5:before { + content: "\e864"; +} + +.icon-format-header-6:before { + content: "\e865"; +} + +.icon-clearup:before { + content: "\e64d"; +} + +.icon-preview:before { + content: "\e631"; +} + +.icon-date:before { + content: "\e63e"; +} + +.icon-fontbgcolor:before { + content: "\e678"; +} + +.icon-clearedformat:before { + content: "\e67e"; +} + +.icon-font:before { + content: "\e684"; +} + +.icon-723bianjiqi_duanhouju:before { + content: "\e65f"; +} + +.icon-722bianjiqi_duanqianju:before { + content: "\e660"; +} + +.icon-text_color:before { + content: "\e72c"; +} + +.icon-format-header-2:before { + content: "\e75c"; +} + +.icon-format-header-3:before { + content: "\e75d"; +} + +.icon--checklist:before { + content: "\e664"; +} + +.icon-baocun:before { + content: "\ec09"; +} + +.icon-line-height:before { + content: "\e7f8"; +} + +.icon-quanping:before { + content: "\ec13"; +} + +.icon-direction-rtl:before { + content: "\e66e"; +} + +.icon-direction-ltr:before { + content: "\e66d"; +} + +.icon-selectall:before { + content: "\e62b"; +} + +.icon-fuzhi:before { + content: "\ec7a"; +} + +.icon-shanchu:before { + content: "\ec7b"; +} + +.icon-bianjisekuai:before { + content: "\ec7c"; +} + +.icon-fengexian:before { + content: "\ec7f"; +} + +.icon-dianzan:before { + content: "\ec80"; +} + +.icon-charulianjie:before { + content: "\ec81"; +} + +.icon-charutupian:before { + content: "\ec82"; +} + +.icon-wuxupailie:before { + content: "\ec83"; +} + +.icon-juzhongduiqi:before { + content: "\ec84"; +} + +.icon-yinyong:before { + content: "\ec85"; +} + +.icon-youxupailie:before { + content: "\ec86"; +} + +.icon-youduiqi:before { + content: "\ec87"; +} + +.icon-zitidaima:before { + content: "\ec88"; +} + +.icon-xiaolian:before { + content: "\ec89"; +} + +.icon-zitijiacu:before { + content: "\ec8a"; +} + +.icon-zitishanchuxian:before { + content: "\ec8b"; +} + +.icon-zitishangbiao:before { + content: "\ec8c"; +} + +.icon-zitibiaoti:before { + content: "\ec8d"; +} + +.icon-zitixiahuaxian:before { + content: "\ec8e"; +} + +.icon-zitixieti:before { + content: "\ec8f"; +} + +.icon-zitiyanse:before { + content: "\ec90"; +} + +.icon-zuoduiqi:before { + content: "\ec91"; +} + +.icon-zitiyulan:before { + content: "\ec92"; +} + +.icon-zitixiabiao:before { + content: "\ec93"; +} + +.icon-zuoyouduiqi:before { + content: "\ec94"; +} + +.icon-duigoux:before { + content: "\ec9e"; +} + +.icon-guanbi:before { + content: "\eca0"; +} + +.icon-shengyin_shiti:before { + content: "\eca5"; +} + +.icon-Character-Spacing:before { + content: "\e964"; +} diff --git a/components/Jnpf/Editor/iconfont.ttf b/components/Jnpf/Editor/iconfont.ttf new file mode 100644 index 0000000..8ade3a4 Binary files /dev/null and b/components/Jnpf/Editor/iconfont.ttf differ diff --git a/components/Jnpf/Editor/index.vue b/components/Jnpf/Editor/index.vue new file mode 100644 index 0000000..052bb00 --- /dev/null +++ b/components/Jnpf/Editor/index.vue @@ -0,0 +1,274 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/Empty/index.vue b/components/Jnpf/Empty/index.vue new file mode 100644 index 0000000..c46d04c --- /dev/null +++ b/components/Jnpf/Empty/index.vue @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/GroupSelect/SelectPopup.vue b/components/Jnpf/GroupSelect/SelectPopup.vue new file mode 100644 index 0000000..a48e2dc --- /dev/null +++ b/components/Jnpf/GroupSelect/SelectPopup.vue @@ -0,0 +1,160 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/GroupSelect/index.vue b/components/Jnpf/GroupSelect/index.vue new file mode 100644 index 0000000..359b1b9 --- /dev/null +++ b/components/Jnpf/GroupSelect/index.vue @@ -0,0 +1,136 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/GroupTitle/index.vue b/components/Jnpf/GroupTitle/index.vue new file mode 100644 index 0000000..121c028 --- /dev/null +++ b/components/Jnpf/GroupTitle/index.vue @@ -0,0 +1,40 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Input/index.vue b/components/Jnpf/Input/index.vue new file mode 100644 index 0000000..bf6b500 --- /dev/null +++ b/components/Jnpf/Input/index.vue @@ -0,0 +1,234 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Input/useTextMask.js b/components/Jnpf/Input/useTextMask.js new file mode 100644 index 0000000..a5df229 --- /dev/null +++ b/components/Jnpf/Input/useTextMask.js @@ -0,0 +1,170 @@ +/** + * maskType + * 1 - 全掩盖 + * 2 - 姓名-显示前1个字,后1个字 + * 3 - 手机号-显示前3位,后4位 + * 4 - 邮箱-显示前3个字,@和之后的字 + * 5 - 身份证-显示前6位,后3位,虚拟为4位 + * 6 - IP地址-显示第1段IP + * 7 - 车牌号-显示前1个字,后2位 + * 8 - 银行卡号-显示前6位,后4位 + * 0 - 自定义规则 + */ +export const defaultMaskOptions = { + filler: '*', // 填充符号 + maskType: 1, // 掩码规则 + prefixType: 1, // 开头显示 + prefixLimit: 0, // 开头字数 + prefixSpecifyChar: '', // 开头字符 + suffixType: 1, // 结尾显示 + suffixLimit: 0, // 结尾字数 + suffixSpecifyChar: '', // 结尾字符 + ignoreChar: '', // 显示字符 + useUnrealMask: false, // 虚拟掩码 + unrealMaskLength: 1, // 虚拟掩码长度 +}; + +export function useTextMask(options = {}) { + const config = { + ...defaultMaskOptions, + ...options + }; + + // 全掩盖 + function maskAll(str) { + return config.filler.repeat(str.length); + } + //姓名 显示前1个字,后1个字 + function maskName(str) { + if (str.length <= 1) return str; + const prefix = str[0]; + if (str.length === 2) return prefix + config.filler; + const suffix = str.slice(-1); + const maskedChars = config.filler.repeat(str.length - 2); + return prefix + maskedChars + suffix; + } + // 手机号 - 显示前3位,后4位 + function maskPhoneNumber(str) { + if (str.length <= 7) return str; + const prefix = str.slice(0, 3); + const suffix = str.slice(-4); + const maskedChars = config.filler.repeat(str.length - 7); + return prefix + maskedChars + suffix; + } + // 邮箱 - 显示前3个字,@和之后的字 + function maskEmailAddress(str) { + const atIndex = str.indexOf('@'); + if (str.length <= 3 || (atIndex > -1 && atIndex < 3)) return str; + let suffixLength = 0; + let maskedCharsLength = str.length - 3; + if (atIndex > 0) { + suffixLength = atIndex; + maskedCharsLength = atIndex - 3; + } + const prefix = str.slice(0, 3); + const suffix = suffixLength ? str.slice(suffixLength) : ''; + const maskedChars = config.filler.repeat(maskedCharsLength); + return prefix + maskedChars + suffix; + } + // 身份证 - 显示前6位,后3位,虚拟为4位 + function maskIdNumber(str) { + if (str.length <= 9) return str; + const prefix = str.slice(0, 6); + const suffix = str.slice(-3); + const maskedChars = config.filler.repeat(4); + return prefix + maskedChars + suffix; + } + // IP地址-显示第1段IP + function maskIPAddress(str) { + const segments = str.split('.'); + if (segments.length < 1) return str; + const maskedChars = ('.' + config.filler.repeat(3)).repeat(3); + return segments[0] + maskedChars; + } + // 车牌号-显示前1个字,后2位 + function maskLicensePlate(str) { + if (str.length <= 3) return str; + const prefix = str[0]; + const suffix = str.slice(-2); + const maskedChars = config.filler.repeat(str.length - 3); + return prefix + maskedChars + suffix; + } + // 银行卡号-显示前6位,后4位 + function maskBankCard(str) { + if (str.length <= 10) return str; + const prefix = str.slice(0, 6); + const suffix = str.slice(-4); + const maskedChars = config.filler.repeat(str.length - 10); + return prefix + maskedChars + suffix; + } + // 自定义掩码规则 + function maskCustom(str) { + let prefixLength = 0, + suffixLength = 0; + if (config.prefixType === 2) prefixLength = config.prefixLimit || 0; + if ((config.prefixType === 3 || config.prefixType === 4) && config.prefixSpecifyChar) { + let specifyCharIndex = str.indexOf(config.prefixSpecifyChar); + if (specifyCharIndex > -1) prefixLength = config.prefixType === 3 ? specifyCharIndex : + specifyCharIndex + config.prefixSpecifyChar.length; + } + if (config.suffixType === 2) suffixLength = config.suffixLimit || 0; + if ((config.suffixType === 3 || config.suffixType === 4) && config.suffixSpecifyChar) { + let specifyCharIndex = str.indexOf(config.suffixSpecifyChar); + if (specifyCharIndex > -1) suffixLength = config.suffixType === 3 ? + str.length - specifyCharIndex - config.suffixSpecifyChar.length : + str.length - specifyCharIndex; + } + if (prefixLength + suffixLength >= str.length) return str; + const prefix = prefixLength ? str.slice(0, prefixLength) : ''; + const suffix = suffixLength ? str.slice(-suffixLength) : ''; + let middleChar = ''; + if (!config.ignoreChar) { + const maskedLength = config.useUnrealMask ? config.unrealMaskLength || 1 : str.length - prefixLength - + suffixLength; + middleChar = config.filler.repeat(maskedLength); + } else { + const ignoreCharList = config.ignoreChar.split(','); + const middleStr = str.slice(prefixLength, str.length - suffixLength); + const reg = new RegExp('(' + ignoreCharList.map(o => o.replace(/\*/g, '\\*')).join('|') + ')', 'g'); + let list = middleStr.split(reg); + list = list.map(o => { + if (o && !ignoreCharList.includes(o)) { + const maskedLength = config.useUnrealMask ? config.unrealMaskLength || 1 : o.length; + o = config.filler.repeat(maskedLength); + } + return o; + }); + middleChar = list.join(''); + } + + return prefix + middleChar + suffix; + } + + // 获取掩码后文本 + function getMaskedText(str) { + if (!str) return ''; + if (config.maskType === 1) return maskAll(str); + if (config.maskType === 2) return maskName(str); + if (config.maskType === 3) return maskPhoneNumber(str); + if (config.maskType === 4) return maskEmailAddress(str); + if (config.maskType === 5) return maskIdNumber(str); + if (config.maskType === 6) return maskIPAddress(str); + if (config.maskType === 7) return maskLicensePlate(str); + if (config.maskType === 8) return maskBankCard(str); + if (config.maskType === 0) return maskCustom(str); + return str; + } + + return { + maskAll, + maskName, + maskPhoneNumber, + maskEmailAddress, + maskIdNumber, + maskIPAddress, + maskLicensePlate, + maskBankCard, + maskCustom, + getMaskedText + }; +} \ No newline at end of file diff --git a/components/Jnpf/InputNumber/index.vue b/components/Jnpf/InputNumber/index.vue new file mode 100644 index 0000000..87697f5 --- /dev/null +++ b/components/Jnpf/InputNumber/index.vue @@ -0,0 +1,260 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Link/index.vue b/components/Jnpf/Link/index.vue new file mode 100644 index 0000000..8ec7478 --- /dev/null +++ b/components/Jnpf/Link/index.vue @@ -0,0 +1,62 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Location/index.vue b/components/Jnpf/Location/index.vue new file mode 100644 index 0000000..b8e8461 --- /dev/null +++ b/components/Jnpf/Location/index.vue @@ -0,0 +1,274 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/NumberRange/index.vue b/components/Jnpf/NumberRange/index.vue new file mode 100644 index 0000000..9647719 --- /dev/null +++ b/components/Jnpf/NumberRange/index.vue @@ -0,0 +1,76 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/OpenData/index.vue b/components/Jnpf/OpenData/index.vue new file mode 100644 index 0000000..fdaeb27 --- /dev/null +++ b/components/Jnpf/OpenData/index.vue @@ -0,0 +1,54 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/OrganizeSelect/SelectPopup.vue b/components/Jnpf/OrganizeSelect/SelectPopup.vue new file mode 100644 index 0000000..b081715 --- /dev/null +++ b/components/Jnpf/OrganizeSelect/SelectPopup.vue @@ -0,0 +1,297 @@ + + \ No newline at end of file diff --git a/components/Jnpf/OrganizeSelect/index.vue b/components/Jnpf/OrganizeSelect/index.vue new file mode 100644 index 0000000..3b550a3 --- /dev/null +++ b/components/Jnpf/OrganizeSelect/index.vue @@ -0,0 +1,97 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Parser/Item.vue b/components/Jnpf/Parser/Item.vue new file mode 100644 index 0000000..7cce934 --- /dev/null +++ b/components/Jnpf/Parser/Item.vue @@ -0,0 +1,455 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Parser/childTable.vue b/components/Jnpf/Parser/childTable.vue new file mode 100644 index 0000000..930bbcc --- /dev/null +++ b/components/Jnpf/Parser/childTable.vue @@ -0,0 +1,1091 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Parser/index.vue b/components/Jnpf/Parser/index.vue new file mode 100644 index 0000000..2d44902 --- /dev/null +++ b/components/Jnpf/Parser/index.vue @@ -0,0 +1,765 @@ + + \ No newline at end of file diff --git a/components/Jnpf/Parser/mixin.js b/components/Jnpf/Parser/mixin.js new file mode 100644 index 0000000..2a07aa1 --- /dev/null +++ b/components/Jnpf/Parser/mixin.js @@ -0,0 +1,121 @@ +import { + getDataInterfaceRes +} from '@/api/common' +export default { + data() { + return { + ids: [], + selectItems: [] + } + }, + methods: { + checkboxChange(e, item) { + this.$nextTick(() => { + if (e.value) { + this.selectItems.push(item) + } else { + const i = this.selectItems.findIndex(o => !o.checked) + this.selectItems.splice(i, 1) + } + }) + }, + openSelectDialog(item) { + if (this.checkNumLimit()) return; + let actionConfig = item.actionConfig + const data = { + actionConfig, + formData: this.formData, + tableVmodel: this.config.__vModel__ + } + if (item.actionType == 1) return uni.navigateTo({ + url: '/pages/apply/tableLinkage/index?data=' + JSON.stringify(data) + }) + if (!this.tableFormData.some(item => item.checked)) return this.$u.toast('至少选中一条数据'); + if (item.actionType == 2) { + if (actionConfig.executeType == 2) { + this.handleScriptFunc(actionConfig) + } else { + this.handleInterface(actionConfig) + } + } + }, + //自定义按钮JS操作 + handleScriptFunc(item) { + let data = this.selectItems.map(child => { + let obj = {}; + child.forEach(item => { + obj[item.__vModel__] = item.value; + }); + return obj; + }); + const parameter = { + data, + refresh: this.initData, + onlineUtils: this.jnpf.onlineUtils, + } + const func = this.jnpf.getScriptFunc.call(this, item.executeFunc) + if (!func) return + func.call(this, parameter) + }, + //自定义按钮接口操作 + handleInterface(item) { + let data = this.selectItems.flatMap(child => { + return child.map(item => ({ + [item.__vModel__]: item.value + })); + }); + const handlerInterface = (data) => { + let query = { + paramList: this.getBatchParamList(item.executeTemplateJson, data) || [], + } + getDataInterfaceRes(item.executeInterfaceId, query).then(res => { + uni.showToast({ + title: res.msg, + icon: 'none' + }) + }) + } + if (!item.executeUseConfirm) return handlerInterface(data) + uni.showModal({ + title: this.$t('common.tipTitle'), + content: item.executeConfirmTitle || '确认执行此操作?', + showCancel: true, + confirmText: '确定', + success: function(res) { + if (res.confirm) { + handlerInterface(data) + } + } + }); + }, + getBatchParamList(templateJson, data) { + if (!templateJson || !templateJson.length) return []; + for (let i = 0; i < templateJson.length; i++) { + const e = templateJson[i]; + let defaultValue = []; + if (e.sourceType === 1 && data.length) { + data.forEach(o => { + if (o.hasOwnProperty(e.relationField)) { + defaultValue.push(o[e.relationField]); + } + }); + } + e.defaultValue = defaultValue; + if (e.sourceType === 4 && e.relationField === '@formId' && data.id !== undefined) { + e.defaultValue = [data.id]; + } else if (e.sourceType !== 1) { + e.defaultValue = []; + } + } + return templateJson; + }, + // 校验限制条数 + checkNumLimit() { + if (this.config.isNumLimit && this.tableFormData.length >= this.config.numLimit) { + this.$u.toast(`${this.config.__config__.label}超出条数限制`); + return true; + } + return false; + } + } +} \ No newline at end of file diff --git a/components/Jnpf/PopupAttr/index.vue b/components/Jnpf/PopupAttr/index.vue new file mode 100644 index 0000000..a359f6a --- /dev/null +++ b/components/Jnpf/PopupAttr/index.vue @@ -0,0 +1,55 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/PopupSelect/index.vue b/components/Jnpf/PopupSelect/index.vue new file mode 100644 index 0000000..cecfff9 --- /dev/null +++ b/components/Jnpf/PopupSelect/index.vue @@ -0,0 +1,220 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/PosSelect/SelectPopup.vue b/components/Jnpf/PosSelect/SelectPopup.vue new file mode 100644 index 0000000..3273f30 --- /dev/null +++ b/components/Jnpf/PosSelect/SelectPopup.vue @@ -0,0 +1,304 @@ + + \ No newline at end of file diff --git a/components/Jnpf/PosSelect/index.vue b/components/Jnpf/PosSelect/index.vue new file mode 100644 index 0000000..bcf57e6 --- /dev/null +++ b/components/Jnpf/PosSelect/index.vue @@ -0,0 +1,97 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Qrcode/index.vue b/components/Jnpf/Qrcode/index.vue new file mode 100644 index 0000000..cb93031 --- /dev/null +++ b/components/Jnpf/Qrcode/index.vue @@ -0,0 +1,115 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Qrcode/tki-qrcode/qrcode.js b/components/Jnpf/Qrcode/tki-qrcode/qrcode.js new file mode 100644 index 0000000..5717876 --- /dev/null +++ b/components/Jnpf/Qrcode/tki-qrcode/qrcode.js @@ -0,0 +1,1222 @@ +let QRCode = {}; +(function() { + /** + * 获取单个字符的utf8编码 + * unicode BMP平面约65535个字符 + * @param {num} code + * return {array} + */ + function unicodeFormat8(code) { + // 1 byte + var c0, c1, c2; + if (code < 128) { + return [code]; + // 2 bytes + } else if (code < 2048) { + c0 = 192 + (code >> 6); + c1 = 128 + (code & 63); + return [c0, c1]; + // 3 bytes + } else { + c0 = 224 + (code >> 12); + c1 = 128 + (code >> 6 & 63); + c2 = 128 + (code & 63); + return [c0, c1, c2]; + } + } + /** + * 获取字符串的utf8编码字节串 + * @param {string} string + * @return {array} + */ + function getUTF8Bytes(string) { + var utf8codes = []; + for (var i = 0; i < string.length; i++) { + var code = string.charCodeAt(i); + var utf8 = unicodeFormat8(code); + for (var j = 0; j < utf8.length; j++) { + utf8codes.push(utf8[j]); + } + } + return utf8codes; + } + /** + * 二维码算法实现 + * @param {string} data 要编码的信息字符串 + * @param {num} errorCorrectLevel 纠错等级 + */ + function QRCodeAlg(data, errorCorrectLevel) { + this.typeNumber = -1; //版本 + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; //二维矩阵,存放最终结果 + this.moduleCount = 0; //矩阵大小 + this.dataCache = null; //数据缓存 + this.rsBlocks = null; //版本数据信息 + this.totalDataCount = -1; //可使用的数据量 + this.data = data; + this.utf8bytes = getUTF8Bytes(data); + this.make(); + } + QRCodeAlg.prototype = { + constructor: QRCodeAlg, + /** + * 获取二维码矩阵大小 + * @return {num} 矩阵大小 + */ + getModuleCount: function() { + return this.moduleCount; + }, + /** + * 编码 + */ + make: function() { + this.getRightType(); + this.dataCache = this.createData(); + this.createQrcode(); + }, + /** + * 设置二位矩阵功能图形 + * @param {bool} test 表示是否在寻找最好掩膜阶段 + * @param {num} maskPattern 掩膜的版本 + */ + makeImpl: function(maskPattern) { + this.moduleCount = this.typeNumber * 4 + 17; + this.modules = new Array(this.moduleCount); + for (var row = 0; row < this.moduleCount; row++) { + this.modules[row] = new Array(this.moduleCount); + } + this.setupPositionProbePattern(0, 0); + this.setupPositionProbePattern(this.moduleCount - 7, 0); + this.setupPositionProbePattern(0, this.moduleCount - 7); + this.setupPositionAdjustPattern(); + this.setupTimingPattern(); + this.setupTypeInfo(true, maskPattern); + if (this.typeNumber >= 7) { + this.setupTypeNumber(true); + } + this.mapData(this.dataCache, maskPattern); + }, + /** + * 设置二维码的位置探测图形 + * @param {num} row 探测图形的中心横坐标 + * @param {num} col 探测图形的中心纵坐标 + */ + setupPositionProbePattern: function(row, col) { + for (var r = -1; r <= 7; r++) { + if (row + r <= -1 || this.moduleCount <= row + r) continue; + for (var c = -1; c <= 7; c++) { + if (col + c <= -1 || this.moduleCount <= col + c) continue; + if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == + 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { + this.modules[row + r][col + c] = true; + } else { + this.modules[row + r][col + c] = false; + } + } + } + }, + /** + * 创建二维码 + * @return {[type]} [description] + */ + createQrcode: function() { + var minLostPoint = 0; + var pattern = 0; + var bestModules = null; + for (var i = 0; i < 8; i++) { + this.makeImpl(i); + var lostPoint = QRUtil.getLostPoint(this); + if (i == 0 || minLostPoint > lostPoint) { + minLostPoint = lostPoint; + pattern = i; + bestModules = this.modules; + } + } + this.modules = bestModules; + this.setupTypeInfo(false, pattern); + if (this.typeNumber >= 7) { + this.setupTypeNumber(false); + } + }, + /** + * 设置定位图形 + * @return {[type]} [description] + */ + setupTimingPattern: function() { + for (var r = 8; r < this.moduleCount - 8; r++) { + if (this.modules[r][6] != null) { + continue; + } + this.modules[r][6] = (r % 2 == 0); + if (this.modules[6][r] != null) { + continue; + } + this.modules[6][r] = (r % 2 == 0); + } + }, + /** + * 设置矫正图形 + * @return {[type]} [description] + */ + setupPositionAdjustPattern: function() { + var pos = QRUtil.getPatternPosition(this.typeNumber); + for (var i = 0; i < pos.length; i++) { + for (var j = 0; j < pos.length; j++) { + var row = pos[i]; + var col = pos[j]; + if (this.modules[row][col] != null) { + continue; + } + for (var r = -2; r <= 2; r++) { + for (var c = -2; c <= 2; c++) { + if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { + this.modules[row + r][col + c] = true; + } else { + this.modules[row + r][col + c] = false; + } + } + } + } + } + }, + /** + * 设置版本信息(7以上版本才有) + * @param {bool} test 是否处于判断最佳掩膜阶段 + * @return {[type]} [description] + */ + setupTypeNumber: function(test) { + var bits = QRUtil.getBCHTypeNumber(this.typeNumber); + for (var i = 0; i < 18; i++) { + var mod = (!test && ((bits >> i) & 1) == 1); + this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; + this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; + } + }, + /** + * 设置格式信息(纠错等级和掩膜版本) + * @param {bool} test + * @param {num} maskPattern 掩膜版本 + * @return {} + */ + setupTypeInfo: function(test, maskPattern) { + var data = (QRErrorCorrectLevel[this.errorCorrectLevel] << 3) | maskPattern; + var bits = QRUtil.getBCHTypeInfo(data); + // vertical + for (var i = 0; i < 15; i++) { + var mod = (!test && ((bits >> i) & 1) == 1); + if (i < 6) { + this.modules[i][8] = mod; + } else if (i < 8) { + this.modules[i + 1][8] = mod; + } else { + this.modules[this.moduleCount - 15 + i][8] = mod; + } + // horizontal + var mod = (!test && ((bits >> i) & 1) == 1); + if (i < 8) { + this.modules[8][this.moduleCount - i - 1] = mod; + } else if (i < 9) { + this.modules[8][15 - i - 1 + 1] = mod; + } else { + this.modules[8][15 - i - 1] = mod; + } + } + // fixed module + this.modules[this.moduleCount - 8][8] = (!test); + }, + /** + * 数据编码 + * @return {[type]} [description] + */ + createData: function() { + var buffer = new QRBitBuffer(); + var lengthBits = this.typeNumber > 9 ? 16 : 8; + buffer.put(4, 4); //添加模式 + buffer.put(this.utf8bytes.length, lengthBits); + for (var i = 0, l = this.utf8bytes.length; i < l; i++) { + buffer.put(this.utf8bytes[i], 8); + } + if (buffer.length + 4 <= this.totalDataCount * 8) { + buffer.put(0, 4); + } + // padding + while (buffer.length % 8 != 0) { + buffer.putBit(false); + } + // padding + while (true) { + if (buffer.length >= this.totalDataCount * 8) { + break; + } + buffer.put(QRCodeAlg.PAD0, 8); + if (buffer.length >= this.totalDataCount * 8) { + break; + } + buffer.put(QRCodeAlg.PAD1, 8); + } + return this.createBytes(buffer); + }, + /** + * 纠错码编码 + * @param {buffer} buffer 数据编码 + * @return {[type]} + */ + createBytes: function(buffer) { + var offset = 0; + var maxDcCount = 0; + var maxEcCount = 0; + var length = this.rsBlock.length / 3; + var rsBlocks = new Array(); + for (var i = 0; i < length; i++) { + var count = this.rsBlock[i * 3 + 0]; + var totalCount = this.rsBlock[i * 3 + 1]; + var dataCount = this.rsBlock[i * 3 + 2]; + for (var j = 0; j < count; j++) { + rsBlocks.push([dataCount, totalCount]); + } + } + var dcdata = new Array(rsBlocks.length); + var ecdata = new Array(rsBlocks.length); + for (var r = 0; r < rsBlocks.length; r++) { + var dcCount = rsBlocks[r][0]; + var ecCount = rsBlocks[r][1] - dcCount; + maxDcCount = Math.max(maxDcCount, dcCount); + maxEcCount = Math.max(maxEcCount, ecCount); + dcdata[r] = new Array(dcCount); + for (var i = 0; i < dcdata[r].length; i++) { + dcdata[r][i] = 0xff & buffer.buffer[i + offset]; + } + offset += dcCount; + var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); + var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); + var modPoly = rawPoly.mod(rsPoly); + ecdata[r] = new Array(rsPoly.getLength() - 1); + for (var i = 0; i < ecdata[r].length; i++) { + var modIndex = i + modPoly.getLength() - ecdata[r].length; + ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; + } + } + var data = new Array(this.totalDataCount); + var index = 0; + for (var i = 0; i < maxDcCount; i++) { + for (var r = 0; r < rsBlocks.length; r++) { + if (i < dcdata[r].length) { + data[index++] = dcdata[r][i]; + } + } + } + for (var i = 0; i < maxEcCount; i++) { + for (var r = 0; r < rsBlocks.length; r++) { + if (i < ecdata[r].length) { + data[index++] = ecdata[r][i]; + } + } + } + return data; + + }, + /** + * 布置模块,构建最终信息 + * @param {} data + * @param {} maskPattern + * @return {} + */ + mapData: function(data, maskPattern) { + var inc = -1; + var row = this.moduleCount - 1; + var bitIndex = 7; + var byteIndex = 0; + for (var col = this.moduleCount - 1; col > 0; col -= 2) { + if (col == 6) col--; + while (true) { + for (var c = 0; c < 2; c++) { + if (this.modules[row][col - c] == null) { + var dark = false; + if (byteIndex < data.length) { + dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); + } + var mask = QRUtil.getMask(maskPattern, row, col - c); + if (mask) { + dark = !dark; + } + this.modules[row][col - c] = dark; + bitIndex--; + if (bitIndex == -1) { + byteIndex++; + bitIndex = 7; + } + } + } + row += inc; + if (row < 0 || this.moduleCount <= row) { + row -= inc; + inc = -inc; + break; + } + } + } + } + }; + /** + * 填充字段 + */ + QRCodeAlg.PAD0 = 0xEC; + QRCodeAlg.PAD1 = 0x11; + //--------------------------------------------------------------------- + // 纠错等级对应的编码 + //--------------------------------------------------------------------- + var QRErrorCorrectLevel = [1, 0, 3, 2]; + //--------------------------------------------------------------------- + // 掩膜版本 + //--------------------------------------------------------------------- + var QRMaskPattern = { + PATTERN000: 0, + PATTERN001: 1, + PATTERN010: 2, + PATTERN011: 3, + PATTERN100: 4, + PATTERN101: 5, + PATTERN110: 6, + PATTERN111: 7 + }; + //--------------------------------------------------------------------- + // 工具类 + //--------------------------------------------------------------------- + var QRUtil = { + /* + 每个版本矫正图形的位置 + */ + PATTERN_POSITION_TABLE: [ + [], + [6, 18], + [6, 22], + [6, 26], + [6, 30], + [6, 34], + [6, 22, 38], + [6, 24, 42], + [6, 26, 46], + [6, 28, 50], + [6, 30, 54], + [6, 32, 58], + [6, 34, 62], + [6, 26, 46, 66], + [6, 26, 48, 70], + [6, 26, 50, 74], + [6, 30, 54, 78], + [6, 30, 56, 82], + [6, 30, 58, 86], + [6, 34, 62, 90], + [6, 28, 50, 72, 94], + [6, 26, 50, 74, 98], + [6, 30, 54, 78, 102], + [6, 28, 54, 80, 106], + [6, 32, 58, 84, 110], + [6, 30, 58, 86, 114], + [6, 34, 62, 90, 118], + [6, 26, 50, 74, 98, 122], + [6, 30, 54, 78, 102, 126], + [6, 26, 52, 78, 104, 130], + [6, 30, 56, 82, 108, 134], + [6, 34, 60, 86, 112, 138], + [6, 30, 58, 86, 114, 142], + [6, 34, 62, 90, 118, 146], + [6, 30, 54, 78, 102, 126, 150], + [6, 24, 50, 76, 102, 128, 154], + [6, 28, 54, 80, 106, 132, 158], + [6, 32, 58, 84, 110, 136, 162], + [6, 26, 54, 82, 110, 138, 166], + [6, 30, 58, 86, 114, 142, 170] + ], + G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), + G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), + G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), + /* + BCH编码格式信息 + */ + getBCHTypeInfo: function(data) { + var d = data << 10; + while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { + d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); + } + return ((data << 10) | d) ^ QRUtil.G15_MASK; + }, + /* + BCH编码版本信息 + */ + getBCHTypeNumber: function(data) { + var d = data << 12; + while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { + d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); + } + return (data << 12) | d; + }, + /* + 获取BCH位信息 + */ + getBCHDigit: function(data) { + var digit = 0; + while (data != 0) { + digit++; + data >>>= 1; + } + return digit; + }, + /* + 获取版本对应的矫正图形位置 + */ + getPatternPosition: function(typeNumber) { + return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; + }, + /* + 掩膜算法 + */ + getMask: function(maskPattern, i, j) { + switch (maskPattern) { + case QRMaskPattern.PATTERN000: + return (i + j) % 2 == 0; + case QRMaskPattern.PATTERN001: + return i % 2 == 0; + case QRMaskPattern.PATTERN010: + return j % 3 == 0; + case QRMaskPattern.PATTERN011: + return (i + j) % 3 == 0; + case QRMaskPattern.PATTERN100: + return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; + case QRMaskPattern.PATTERN101: + return (i * j) % 2 + (i * j) % 3 == 0; + case QRMaskPattern.PATTERN110: + return ((i * j) % 2 + (i * j) % 3) % 2 == 0; + case QRMaskPattern.PATTERN111: + return ((i * j) % 3 + (i + j) % 2) % 2 == 0; + default: + throw new Error("bad maskPattern:" + maskPattern); + } + }, + /* + 获取RS的纠错多项式 + */ + getErrorCorrectPolynomial: function(errorCorrectLength) { + var a = new QRPolynomial([1], 0); + for (var i = 0; i < errorCorrectLength; i++) { + a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); + } + return a; + }, + /* + 获取评价 + */ + getLostPoint: function(qrCode) { + var moduleCount = qrCode.getModuleCount(), + lostPoint = 0, + darkCount = 0; + for (var row = 0; row < moduleCount; row++) { + var sameCount = 0; + var head = qrCode.modules[row][0]; + for (var col = 0; col < moduleCount; col++) { + var current = qrCode.modules[row][col]; + //level 3 评价 + if (col < moduleCount - 6) { + if (current && !qrCode.modules[row][col + 1] && qrCode.modules[row][col + 2] && + qrCode.modules[row][col + 3] && qrCode.modules[row][col + 4] && !qrCode.modules[ + row][col + 5] && qrCode.modules[row][col + 6]) { + if (col < moduleCount - 10) { + if (qrCode.modules[row][col + 7] && qrCode.modules[row][col + 8] && qrCode + .modules[row][col + 9] && qrCode.modules[row][col + 10]) { + lostPoint += 40; + } + } else if (col > 3) { + if (qrCode.modules[row][col - 1] && qrCode.modules[row][col - 2] && qrCode + .modules[row][col - 3] && qrCode.modules[row][col - 4]) { + lostPoint += 40; + } + } + } + } + //level 2 评价 + if ((row < moduleCount - 1) && (col < moduleCount - 1)) { + var count = 0; + if (current) count++; + if (qrCode.modules[row + 1][col]) count++; + if (qrCode.modules[row][col + 1]) count++; + if (qrCode.modules[row + 1][col + 1]) count++; + if (count == 0 || count == 4) { + lostPoint += 3; + } + } + //level 1 评价 + if (head ^ current) { + sameCount++; + } else { + head = current; + if (sameCount >= 5) { + lostPoint += (3 + sameCount - 5); + } + sameCount = 1; + } + //level 4 评价 + if (current) { + darkCount++; + } + } + } + for (var col = 0; col < moduleCount; col++) { + var sameCount = 0; + var head = qrCode.modules[0][col]; + for (var row = 0; row < moduleCount; row++) { + var current = qrCode.modules[row][col]; + //level 3 评价 + if (row < moduleCount - 6) { + if (current && !qrCode.modules[row + 1][col] && qrCode.modules[row + 2][col] && + qrCode.modules[row + 3][col] && qrCode.modules[row + 4][col] && !qrCode.modules[ + row + 5][col] && qrCode.modules[row + 6][col]) { + if (row < moduleCount - 10) { + if (qrCode.modules[row + 7][col] && qrCode.modules[row + 8][col] && qrCode + .modules[row + 9][col] && qrCode.modules[row + 10][col]) { + lostPoint += 40; + } + } else if (row > 3) { + if (qrCode.modules[row - 1][col] && qrCode.modules[row - 2][col] && qrCode + .modules[row - 3][col] && qrCode.modules[row - 4][col]) { + lostPoint += 40; + } + } + } + } + //level 1 评价 + if (head ^ current) { + sameCount++; + } else { + head = current; + if (sameCount >= 5) { + lostPoint += (3 + sameCount - 5); + } + sameCount = 1; + } + } + } + // LEVEL4 + var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; + lostPoint += ratio * 10; + return lostPoint; + } + + }; + //--------------------------------------------------------------------- + // QRMath使用的数学工具 + //--------------------------------------------------------------------- + var QRMath = { + /* + 将n转化为a^m + */ + glog: function(n) { + if (n < 1) { + throw new Error("glog(" + n + ")"); + } + return QRMath.LOG_TABLE[n]; + }, + /* + 将a^m转化为n + */ + gexp: function(n) { + while (n < 0) { + n += 255; + } + while (n >= 256) { + n -= 255; + } + return QRMath.EXP_TABLE[n]; + }, + EXP_TABLE: new Array(256), + LOG_TABLE: new Array(256) + + }; + for (var i = 0; i < 8; i++) { + QRMath.EXP_TABLE[i] = 1 << i; + } + for (var i = 8; i < 256; i++) { + QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath + .EXP_TABLE[i - 8]; + } + for (var i = 0; i < 255; i++) { + QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; + } + //--------------------------------------------------------------------- + // QRPolynomial 多项式 + //--------------------------------------------------------------------- + /** + * 多项式类 + * @param {Array} num 系数 + * @param {num} shift a^shift + */ + function QRPolynomial(num, shift) { + if (num.length == undefined) { + throw new Error(num.length + "/" + shift); + } + var offset = 0; + while (offset < num.length && num[offset] == 0) { + offset++; + } + this.num = new Array(num.length - offset + shift); + for (var i = 0; i < num.length - offset; i++) { + this.num[i] = num[i + offset]; + } + } + QRPolynomial.prototype = { + get: function(index) { + return this.num[index]; + }, + getLength: function() { + return this.num.length; + }, + /** + * 多项式乘法 + * @param {QRPolynomial} e 被乘多项式 + * @return {[type]} [description] + */ + multiply: function(e) { + var num = new Array(this.getLength() + e.getLength() - 1); + for (var i = 0; i < this.getLength(); i++) { + for (var j = 0; j < e.getLength(); j++) { + num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); + } + } + return new QRPolynomial(num, 0); + }, + /** + * 多项式模运算 + * @param {QRPolynomial} e 模多项式 + * @return {} + */ + mod: function(e) { + var tl = this.getLength(), + el = e.getLength(); + if (tl - el < 0) { + return this; + } + var num = new Array(tl); + for (var i = 0; i < tl; i++) { + num[i] = this.get(i); + } + while (num.length >= el) { + var ratio = QRMath.glog(num[0]) - QRMath.glog(e.get(0)); + + for (var i = 0; i < e.getLength(); i++) { + num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); + } + while (num[0] == 0) { + num.shift(); + } + } + return new QRPolynomial(num, 0); + } + }; + + //--------------------------------------------------------------------- + // RS_BLOCK_TABLE + //--------------------------------------------------------------------- + /* + 二维码各个版本信息[块数, 每块中的数据块数, 每块中的信息块数] + */ + var RS_BLOCK_TABLE = [ + // L + // M + // Q + // H + // 1 + [1, 26, 19], + [1, 26, 16], + [1, 26, 13], + [1, 26, 9], + + // 2 + [1, 44, 34], + [1, 44, 28], + [1, 44, 22], + [1, 44, 16], + + // 3 + [1, 70, 55], + [1, 70, 44], + [2, 35, 17], + [2, 35, 13], + + // 4 + [1, 100, 80], + [2, 50, 32], + [2, 50, 24], + [4, 25, 9], + + // 5 + [1, 134, 108], + [2, 67, 43], + [2, 33, 15, 2, 34, 16], + [2, 33, 11, 2, 34, 12], + + // 6 + [2, 86, 68], + [4, 43, 27], + [4, 43, 19], + [4, 43, 15], + + // 7 + [2, 98, 78], + [4, 49, 31], + [2, 32, 14, 4, 33, 15], + [4, 39, 13, 1, 40, 14], + + // 8 + [2, 121, 97], + [2, 60, 38, 2, 61, 39], + [4, 40, 18, 2, 41, 19], + [4, 40, 14, 2, 41, 15], + + // 9 + [2, 146, 116], + [3, 58, 36, 2, 59, 37], + [4, 36, 16, 4, 37, 17], + [4, 36, 12, 4, 37, 13], + + // 10 + [2, 86, 68, 2, 87, 69], + [4, 69, 43, 1, 70, 44], + [6, 43, 19, 2, 44, 20], + [6, 43, 15, 2, 44, 16], + + // 11 + [4, 101, 81], + [1, 80, 50, 4, 81, 51], + [4, 50, 22, 4, 51, 23], + [3, 36, 12, 8, 37, 13], + + // 12 + [2, 116, 92, 2, 117, 93], + [6, 58, 36, 2, 59, 37], + [4, 46, 20, 6, 47, 21], + [7, 42, 14, 4, 43, 15], + + // 13 + [4, 133, 107], + [8, 59, 37, 1, 60, 38], + [8, 44, 20, 4, 45, 21], + [12, 33, 11, 4, 34, 12], + + // 14 + [3, 145, 115, 1, 146, 116], + [4, 64, 40, 5, 65, 41], + [11, 36, 16, 5, 37, 17], + [11, 36, 12, 5, 37, 13], + + // 15 + [5, 109, 87, 1, 110, 88], + [5, 65, 41, 5, 66, 42], + [5, 54, 24, 7, 55, 25], + [11, 36, 12], + + // 16 + [5, 122, 98, 1, 123, 99], + [7, 73, 45, 3, 74, 46], + [15, 43, 19, 2, 44, 20], + [3, 45, 15, 13, 46, 16], + + // 17 + [1, 135, 107, 5, 136, 108], + [10, 74, 46, 1, 75, 47], + [1, 50, 22, 15, 51, 23], + [2, 42, 14, 17, 43, 15], + + // 18 + [5, 150, 120, 1, 151, 121], + [9, 69, 43, 4, 70, 44], + [17, 50, 22, 1, 51, 23], + [2, 42, 14, 19, 43, 15], + + // 19 + [3, 141, 113, 4, 142, 114], + [3, 70, 44, 11, 71, 45], + [17, 47, 21, 4, 48, 22], + [9, 39, 13, 16, 40, 14], + + // 20 + [3, 135, 107, 5, 136, 108], + [3, 67, 41, 13, 68, 42], + [15, 54, 24, 5, 55, 25], + [15, 43, 15, 10, 44, 16], + + // 21 + [4, 144, 116, 4, 145, 117], + [17, 68, 42], + [17, 50, 22, 6, 51, 23], + [19, 46, 16, 6, 47, 17], + + // 22 + [2, 139, 111, 7, 140, 112], + [17, 74, 46], + [7, 54, 24, 16, 55, 25], + [34, 37, 13], + + // 23 + [4, 151, 121, 5, 152, 122], + [4, 75, 47, 14, 76, 48], + [11, 54, 24, 14, 55, 25], + [16, 45, 15, 14, 46, 16], + + // 24 + [6, 147, 117, 4, 148, 118], + [6, 73, 45, 14, 74, 46], + [11, 54, 24, 16, 55, 25], + [30, 46, 16, 2, 47, 17], + + // 25 + [8, 132, 106, 4, 133, 107], + [8, 75, 47, 13, 76, 48], + [7, 54, 24, 22, 55, 25], + [22, 45, 15, 13, 46, 16], + + // 26 + [10, 142, 114, 2, 143, 115], + [19, 74, 46, 4, 75, 47], + [28, 50, 22, 6, 51, 23], + [33, 46, 16, 4, 47, 17], + + // 27 + [8, 152, 122, 4, 153, 123], + [22, 73, 45, 3, 74, 46], + [8, 53, 23, 26, 54, 24], + [12, 45, 15, 28, 46, 16], + + // 28 + [3, 147, 117, 10, 148, 118], + [3, 73, 45, 23, 74, 46], + [4, 54, 24, 31, 55, 25], + [11, 45, 15, 31, 46, 16], + + // 29 + [7, 146, 116, 7, 147, 117], + [21, 73, 45, 7, 74, 46], + [1, 53, 23, 37, 54, 24], + [19, 45, 15, 26, 46, 16], + + // 30 + [5, 145, 115, 10, 146, 116], + [19, 75, 47, 10, 76, 48], + [15, 54, 24, 25, 55, 25], + [23, 45, 15, 25, 46, 16], + + // 31 + [13, 145, 115, 3, 146, 116], + [2, 74, 46, 29, 75, 47], + [42, 54, 24, 1, 55, 25], + [23, 45, 15, 28, 46, 16], + + // 32 + [17, 145, 115], + [10, 74, 46, 23, 75, 47], + [10, 54, 24, 35, 55, 25], + [19, 45, 15, 35, 46, 16], + + // 33 + [17, 145, 115, 1, 146, 116], + [14, 74, 46, 21, 75, 47], + [29, 54, 24, 19, 55, 25], + [11, 45, 15, 46, 46, 16], + + // 34 + [13, 145, 115, 6, 146, 116], + [14, 74, 46, 23, 75, 47], + [44, 54, 24, 7, 55, 25], + [59, 46, 16, 1, 47, 17], + + // 35 + [12, 151, 121, 7, 152, 122], + [12, 75, 47, 26, 76, 48], + [39, 54, 24, 14, 55, 25], + [22, 45, 15, 41, 46, 16], + + // 36 + [6, 151, 121, 14, 152, 122], + [6, 75, 47, 34, 76, 48], + [46, 54, 24, 10, 55, 25], + [2, 45, 15, 64, 46, 16], + + // 37 + [17, 152, 122, 4, 153, 123], + [29, 74, 46, 14, 75, 47], + [49, 54, 24, 10, 55, 25], + [24, 45, 15, 46, 46, 16], + + // 38 + [4, 152, 122, 18, 153, 123], + [13, 74, 46, 32, 75, 47], + [48, 54, 24, 14, 55, 25], + [42, 45, 15, 32, 46, 16], + + // 39 + [20, 147, 117, 4, 148, 118], + [40, 75, 47, 7, 76, 48], + [43, 54, 24, 22, 55, 25], + [10, 45, 15, 67, 46, 16], + + // 40 + [19, 148, 118, 6, 149, 119], + [18, 75, 47, 31, 76, 48], + [34, 54, 24, 34, 55, 25], + [20, 45, 15, 61, 46, 16] + ]; + + /** + * 根据数据获取对应版本 + * @return {[type]} [description] + */ + QRCodeAlg.prototype.getRightType = function() { + for (var typeNumber = 1; typeNumber < 41; typeNumber++) { + var rsBlock = RS_BLOCK_TABLE[(typeNumber - 1) * 4 + this.errorCorrectLevel]; + if (rsBlock == undefined) { + throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + this + .errorCorrectLevel); + } + var length = rsBlock.length / 3; + var totalDataCount = 0; + for (var i = 0; i < length; i++) { + var count = rsBlock[i * 3 + 0]; + var dataCount = rsBlock[i * 3 + 2]; + totalDataCount += dataCount * count; + } + var lengthBytes = typeNumber > 9 ? 2 : 1; + if (this.utf8bytes.length + lengthBytes < totalDataCount || typeNumber == 40) { + this.typeNumber = typeNumber; + this.rsBlock = rsBlock; + this.totalDataCount = totalDataCount; + break; + } + } + }; + + //--------------------------------------------------------------------- + // QRBitBuffer + //--------------------------------------------------------------------- + function QRBitBuffer() { + this.buffer = new Array(); + this.length = 0; + } + QRBitBuffer.prototype = { + get: function(index) { + var bufIndex = Math.floor(index / 8); + return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1); + }, + put: function(num, length) { + for (var i = 0; i < length; i++) { + this.putBit(((num >>> (length - i - 1)) & 1)); + } + }, + putBit: function(bit) { + var bufIndex = Math.floor(this.length / 8); + if (this.buffer.length <= bufIndex) { + this.buffer.push(0); + } + if (bit) { + this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); + } + this.length++; + } + }; + + + + // xzedit + let qrcodeAlgObjCache = []; + /** + * 二维码构造函数,主要用于绘制 + * @param {参数列表} opt 传递参数 + * @return {} + */ + QRCode = function(opt) { + //设置默认参数 + this.options = { + text: '', + size: 256, + correctLevel: 3, + background: '#ffffff', + foreground: '#000000', + pdground: '#000000', + image: '', + imageSize: 30, + canvasId: opt.canvasId, + context: opt.context, + usingComponents: opt.usingComponents, + showLoading: opt.showLoading, + loadingText: opt.loadingText, + }; + if (typeof opt === 'string') { // 只编码ASCII字符串 + opt = { + text: opt + }; + } + if (opt) { + for (var i in opt) { + this.options[i] = opt[i]; + } + } + //使用QRCodeAlg创建二维码结构 + var qrCodeAlg = null; + for (var i = 0, l = qrcodeAlgObjCache.length; i < l; i++) { + if (qrcodeAlgObjCache[i].text == this.options.text && qrcodeAlgObjCache[i].text.correctLevel == this + .options.correctLevel) { + qrCodeAlg = qrcodeAlgObjCache[i].obj; + break; + } + } + if (i == l) { + qrCodeAlg = new QRCodeAlg(this.options.text, this.options.correctLevel); + qrcodeAlgObjCache.push({ + text: this.options.text, + correctLevel: this.options.correctLevel, + obj: qrCodeAlg + }); + } + /** + * 计算矩阵点的前景色 + * @param {Obj} config + * @param {Number} config.row 点x坐标 + * @param {Number} config.col 点y坐标 + * @param {Number} config.count 矩阵大小 + * @param {Number} config.options 组件的options + * @return {String} + */ + let getForeGround = function(config) { + var options = config.options; + if (options.pdground && ( + (config.row > 1 && config.row < 5 && config.col > 1 && config.col < 5) || + (config.row > (config.count - 6) && config.row < (config.count - 2) && config.col > 1 && + config.col < 5) || + (config.row > 1 && config.row < 5 && config.col > (config.count - 6) && config.col < ( + config.count - 2)) + )) { + return options.pdground; + } + return options.foreground; + } + // 创建canvas + let createCanvas = function(options) { + if (options.showLoading) { + uni.showLoading({ + title: options.loadingText, + mask: true + }); + } + var ctx = uni.createCanvasContext(options.canvasId, options.context); + var count = qrCodeAlg.getModuleCount(); + var ratioSize = options.size; + var ratioImgSize = options.imageSize; + //计算每个点的长宽 + var tileW = (ratioSize / count).toPrecision(4); + var tileH = (ratioSize / count).toPrecision(4); + //绘制 + for (var row = 0; row < count; row++) { + for (var col = 0; col < count; col++) { + var w = (Math.ceil((col + 1) * tileW) - Math.floor(col * tileW)); + var h = (Math.ceil((row + 1) * tileW) - Math.floor(row * tileW)); + var foreground = getForeGround({ + row: row, + col: col, + count: count, + options: options + }); + ctx.setFillStyle(qrCodeAlg.modules[row][col] ? foreground : options.background); + ctx.fillRect(Math.round(col * tileW), Math.round(row * tileH), w, h); + } + } + if (options.image) { + var x = Number(((ratioSize - ratioImgSize) / 2).toFixed(2)); + var y = Number(((ratioSize - ratioImgSize) / 2).toFixed(2)); + drawRoundedRect(ctx, x, y, ratioImgSize, ratioImgSize, 2, 6, true, true) + ctx.drawImage(options.image, x, y, ratioImgSize, ratioImgSize); + // 画圆角矩形 + function drawRoundedRect(ctxi, x, y, width, height, r, lineWidth, fill, stroke) { + ctxi.setLineWidth(lineWidth); + ctxi.setFillStyle(options.background); + ctxi.setStrokeStyle(options.background); + ctxi.beginPath(); // draw top and top right corner + ctxi.moveTo(x + r, y); + ctxi.arcTo(x + width, y, x + width, y + r, + r); // draw right side and bottom right corner + ctxi.arcTo(x + width, y + height, x + width - r, y + height, + r); // draw bottom and bottom left corner + ctxi.arcTo(x, y + height, x, y + height - r, r); // draw left and top left corner + ctxi.arcTo(x, y, x + r, y, r); + ctxi.closePath(); + if (fill) { + ctxi.fill(); + } + if (stroke) { + ctxi.stroke(); + } + } + } + setTimeout(() => { + ctx.draw(true, () => { + // 保存到临时区域 + setTimeout(() => { + try { + uni.canvasToTempFilePath({ + width: options.width, + height: options.height, + destWidth: options.width, + destHeight: options.height, + canvasId: options.canvasId, + quality: Number(1), + success: function(res) { + if (options.cbResult) { + options.cbResult(res + .tempFilePath) + } + }, + fail: function(res) { + if (options.cbResult) { + options.cbResult(res) + } + }, + complete: function() { + if (options.showLoading) { + uni.hideLoading(); + } + }, + }, options.context); + } catch (e) { + //TODO handle the exception + } + }, options.text.length + 100); + }); + }, options.usingComponents ? 0 : 150); + } + createCanvas(this.options); + // 空判定 + let empty = function(v) { + let tp = typeof v, + rt = false; + if (tp == "number" && String(v) == "") { + rt = true + } else if (tp == "undefined") { + rt = true + } else if (tp == "object") { + if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true + } else if (tp == "string") { + if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true + } else if (tp == "function") { + rt = false + } + return rt + } + }; + QRCode.prototype.clear = function(fn) { + var ctx = uni.createCanvasContext(this.options.canvasId, this.options.context) + ctx.clearRect(0, 0, this.options.size, this.options.size) + ctx.draw(false, () => { + if (fn) { + fn() + } + }) + }; +})() + +export default QRCode \ No newline at end of file diff --git a/components/Jnpf/Qrcode/tki-qrcode/tki-qrcode.vue b/components/Jnpf/Qrcode/tki-qrcode/tki-qrcode.vue new file mode 100644 index 0000000..1b7917f --- /dev/null +++ b/components/Jnpf/Qrcode/tki-qrcode/tki-qrcode.vue @@ -0,0 +1,217 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Radio/index.vue b/components/Jnpf/Radio/index.vue new file mode 100644 index 0000000..b01ee46 --- /dev/null +++ b/components/Jnpf/Radio/index.vue @@ -0,0 +1,72 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Rate/index.vue b/components/Jnpf/Rate/index.vue new file mode 100644 index 0000000..91bc32a --- /dev/null +++ b/components/Jnpf/Rate/index.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/RelationForm/index.vue b/components/Jnpf/RelationForm/index.vue new file mode 100644 index 0000000..3f3ece8 --- /dev/null +++ b/components/Jnpf/RelationForm/index.vue @@ -0,0 +1,194 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/RelationFormAttr/index.vue b/components/Jnpf/RelationFormAttr/index.vue new file mode 100644 index 0000000..71f0c15 --- /dev/null +++ b/components/Jnpf/RelationFormAttr/index.vue @@ -0,0 +1,76 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/RoleSelect/SelectPopup.vue b/components/Jnpf/RoleSelect/SelectPopup.vue new file mode 100644 index 0000000..0536089 --- /dev/null +++ b/components/Jnpf/RoleSelect/SelectPopup.vue @@ -0,0 +1,160 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/RoleSelect/index.vue b/components/Jnpf/RoleSelect/index.vue new file mode 100644 index 0000000..b10ab56 --- /dev/null +++ b/components/Jnpf/RoleSelect/index.vue @@ -0,0 +1,135 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Select/index.vue b/components/Jnpf/Select/index.vue new file mode 100644 index 0000000..2e210f7 --- /dev/null +++ b/components/Jnpf/Select/index.vue @@ -0,0 +1,149 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Sign/Sign.vue b/components/Jnpf/Sign/Sign.vue new file mode 100644 index 0000000..f76ed32 --- /dev/null +++ b/components/Jnpf/Sign/Sign.vue @@ -0,0 +1,452 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/Sign/index.vue b/components/Jnpf/Sign/index.vue new file mode 100644 index 0000000..f5261a5 --- /dev/null +++ b/components/Jnpf/Sign/index.vue @@ -0,0 +1,236 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Signature/index.vue b/components/Jnpf/Signature/index.vue new file mode 100644 index 0000000..ce0a8c4 --- /dev/null +++ b/components/Jnpf/Signature/index.vue @@ -0,0 +1,156 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Slider/index.vue b/components/Jnpf/Slider/index.vue new file mode 100644 index 0000000..ef76eed --- /dev/null +++ b/components/Jnpf/Slider/index.vue @@ -0,0 +1,87 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Steps/index.vue b/components/Jnpf/Steps/index.vue new file mode 100644 index 0000000..0247d61 --- /dev/null +++ b/components/Jnpf/Steps/index.vue @@ -0,0 +1,58 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/Switch/index.vue b/components/Jnpf/Switch/index.vue new file mode 100644 index 0000000..e804e21 --- /dev/null +++ b/components/Jnpf/Switch/index.vue @@ -0,0 +1,72 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Text/index.vue b/components/Jnpf/Text/index.vue new file mode 100644 index 0000000..d87d3ce --- /dev/null +++ b/components/Jnpf/Text/index.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/Textarea/index.vue b/components/Jnpf/Textarea/index.vue new file mode 100644 index 0000000..8d4ea82 --- /dev/null +++ b/components/Jnpf/Textarea/index.vue @@ -0,0 +1,89 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/TimePicker/index.vue b/components/Jnpf/TimePicker/index.vue new file mode 100644 index 0000000..3a6b970 --- /dev/null +++ b/components/Jnpf/TimePicker/index.vue @@ -0,0 +1,80 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/TimeRange/index.vue b/components/Jnpf/TimeRange/index.vue new file mode 100644 index 0000000..2a72d58 --- /dev/null +++ b/components/Jnpf/TimeRange/index.vue @@ -0,0 +1,53 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/TreeSelect/Tree.vue b/components/Jnpf/TreeSelect/Tree.vue new file mode 100644 index 0000000..c58d2a0 --- /dev/null +++ b/components/Jnpf/TreeSelect/Tree.vue @@ -0,0 +1,289 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/TreeSelect/index.vue b/components/Jnpf/TreeSelect/index.vue new file mode 100644 index 0000000..e75f883 --- /dev/null +++ b/components/Jnpf/TreeSelect/index.vue @@ -0,0 +1,143 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/UploadFile/index.vue b/components/Jnpf/UploadFile/index.vue new file mode 100644 index 0000000..c88c7d1 --- /dev/null +++ b/components/Jnpf/UploadFile/index.vue @@ -0,0 +1,353 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/UploadFileComment/index.vue b/components/Jnpf/UploadFileComment/index.vue new file mode 100644 index 0000000..11ce8f3 --- /dev/null +++ b/components/Jnpf/UploadFileComment/index.vue @@ -0,0 +1,253 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/UploadFileH/index.vue b/components/Jnpf/UploadFileH/index.vue new file mode 100644 index 0000000..fe42776 --- /dev/null +++ b/components/Jnpf/UploadFileH/index.vue @@ -0,0 +1,306 @@ + + + + + \ No newline at end of file diff --git a/components/Jnpf/UploadImg/index.vue b/components/Jnpf/UploadImg/index.vue new file mode 100644 index 0000000..6f2c01e --- /dev/null +++ b/components/Jnpf/UploadImg/index.vue @@ -0,0 +1,294 @@ + + + + \ No newline at end of file diff --git a/components/Jnpf/UserSelect/SelectPopup.vue b/components/Jnpf/UserSelect/SelectPopup.vue new file mode 100644 index 0000000..37784f7 --- /dev/null +++ b/components/Jnpf/UserSelect/SelectPopup.vue @@ -0,0 +1,407 @@ + + \ No newline at end of file diff --git a/components/Jnpf/UserSelect/index.vue b/components/Jnpf/UserSelect/index.vue new file mode 100644 index 0000000..6904066 --- /dev/null +++ b/components/Jnpf/UserSelect/index.vue @@ -0,0 +1,114 @@ + + + \ No newline at end of file diff --git a/components/Jnpf/UsersSelect/SelectPopup.vue b/components/Jnpf/UsersSelect/SelectPopup.vue new file mode 100644 index 0000000..91de832 --- /dev/null +++ b/components/Jnpf/UsersSelect/SelectPopup.vue @@ -0,0 +1,447 @@ + + \ No newline at end of file diff --git a/components/Jnpf/UsersSelect/index.vue b/components/Jnpf/UsersSelect/index.vue new file mode 100644 index 0000000..a78c58a --- /dev/null +++ b/components/Jnpf/UsersSelect/index.vue @@ -0,0 +1,92 @@ + + + \ No newline at end of file diff --git a/components/MultSelect/index.vue b/components/MultSelect/index.vue new file mode 100644 index 0000000..02a7c9b --- /dev/null +++ b/components/MultSelect/index.vue @@ -0,0 +1,304 @@ + + + \ No newline at end of file diff --git a/components/SwipeItem/index.vue b/components/SwipeItem/index.vue new file mode 100644 index 0000000..9bf6e12 --- /dev/null +++ b/components/SwipeItem/index.vue @@ -0,0 +1,254 @@ + + + + + \ No newline at end of file diff --git a/components/assistantMsg/index.vue b/components/assistantMsg/index.vue new file mode 100644 index 0000000..82206b9 --- /dev/null +++ b/components/assistantMsg/index.vue @@ -0,0 +1,300 @@ + + + + \ No newline at end of file diff --git a/components/dataLog/index.vue b/components/dataLog/index.vue new file mode 100644 index 0000000..cb27624 --- /dev/null +++ b/components/dataLog/index.vue @@ -0,0 +1,487 @@ + + + + \ No newline at end of file diff --git a/components/displayList/index.vue b/components/displayList/index.vue new file mode 100644 index 0000000..f2673a3 --- /dev/null +++ b/components/displayList/index.vue @@ -0,0 +1,142 @@ + + + + + \ No newline at end of file diff --git a/components/index.js b/components/index.js new file mode 100644 index 0000000..833a98a --- /dev/null +++ b/components/index.js @@ -0,0 +1,400 @@ +/* eslint-disable no-nested-ternary */ +/* eslint-disable no-restricted-syntax */ +/* eslint-disable guard-for-in */ +/** + * num 小于0,左缩进num*2个空格; 大于0,右缩进num*2个空格。 + * @param {string} str 代码 + * @param {number} num 缩进次数 + * @param {number} len 【可选】缩进单位,空格数 + */ +export function indent(str, num, len = 2) { + if (num === 0) return str + const isLeft = num < 0; + const result = []; + let reg; + let + spaces = '' + if (isLeft) { + num *= -1 + reg = new RegExp(`(^\\s{0,${num * len}})`, 'g') + } else { + for (let i = 0; i < num * len; i++) spaces += ' ' + } + + str.split('\n').forEach(line => { + line = isLeft ? line.replace(reg, '') : spaces + line + result.push(line) + }) + return result.join('\n') +} + +// 首字母大小 +export function titleCase(str) { + return str.replace(/( |^)[a-z]/g, L => L.toUpperCase()) +} + +// 下划转驼峰 +export function camelCase(str) { + return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase()) +} + +export function isNumberStr(str) { + return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str) +} + +export const exportDefault = 'export default ' + +export const beautifierConf = { + html: { + indent_size: '2', + indent_char: ' ', + max_preserve_newlines: '-1', + preserve_newlines: false, + keep_array_indentation: false, + break_chained_methods: false, + indent_scripts: 'separate', + brace_style: 'end-expand', + space_before_conditional: true, + unescape_strings: false, + jslint_happy: false, + end_with_newline: true, + wrap_line_length: '110', + indent_inner_html: true, + comma_first: false, + e4x: true, + indent_empty_lines: true + }, + js: { + indent_size: '2', + indent_char: ' ', + max_preserve_newlines: '-1', + preserve_newlines: false, + keep_array_indentation: false, + break_chained_methods: false, + indent_scripts: 'normal', + brace_style: 'end-expand', + space_before_conditional: true, + unescape_strings: false, + jslint_happy: true, + end_with_newline: true, + wrap_line_length: '110', + indent_inner_html: true, + comma_first: false, + e4x: true, + indent_empty_lines: true + } +} + +function stringify(obj) { + return JSON.stringify(obj, (key, val) => { + if (typeof val === 'function') { + return `${val}` + } + return val + }) +} + +function parse(str) { + JSON.parse(str, (k, v) => { + if (v.indexOf && v.indexOf('function') > -1) { + return eval(`(${v})`) + } + return v + }) +} + +export function jsonClone(obj) { + return parse(stringify(obj)) +} + +// 深拷贝对象 +export function deepClone(obj) { + const _toString = Object.prototype.toString + + // null, undefined, non-object, function + if (!obj || typeof obj !== 'object') { + return obj + } + + // DOM Node + if (obj.nodeType && 'cloneNode' in obj) { + return obj.cloneNode(true) + } + + // Date + if (_toString.call(obj) === '[object Date]') { + return new Date(obj.getTime()) + } + + // RegExp + if (_toString.call(obj) === '[object RegExp]') { + const flags = [] + if (obj.global) { + flags.push('g') + } + if (obj.multiline) { + flags.push('m') + } + if (obj.ignoreCase) { + flags.push('i') + } + + return new RegExp(obj.source, flags.join('')) + } + + const result = Array.isArray(obj) ? [] : obj.constructor ? new obj.constructor() : {} + + for (const key in obj) { + result[key] = deepClone(obj[key]) + } + + return result +} +/** + * 将用户输入的连续单个数字合并为一个数 + * @param {Array} expressions - 记录计算表达式的数组 + * @returns {Array} 新的数组 + */ +export const mergeNumberOfExps = expressions => { + const res = [] + const isNumChar = n => /^[\d|\.]$/.test(n) + for (let i = 0; i < expressions.length; i++) { + if (i > 0 && isNumChar(expressions[i - 1]) && isNumChar(expressions[i])) { + res[res.length - 1] += expressions[i] + continue + } + res.push(expressions[i]) + } + return res +} +/** + * 校验表达式是否符合计算法则 + * @param {Array} expressions - 合并数字后的表达式数组 + * @returns {Boolean} + */ +export const validExp = (expressions, mergeNum = true) => { + const temp = mergeNum ? mergeNumberOfExps(expressions) : expressions + const arr = temp.filter(t => !'()'.includes(t)) + // 去括号后 length应该为奇数 并且第一个字符和最后一个字符应该为数字而非计算符号 + if (temp.length % 2 === 0 || arr.length % 2 === 0 || Number.isNaN(+arr[0]) || Number.isNaN(+arr[arr.length - + 1])) { + return false + } + for (let i = 0; i < arr.length - 1; i += 2) { + if (typeof(+arr[i]) !== 'number' || !Number.isNaN(+arr[i + 1])) return false + } + return true +} +/** + * 中缀转后缀(逆波兰 Reverse Polish Notation) + * @param {Array} exps - 中缀表达式数组 + */ +export const toRPN = exps => { + const s1 = [] // 符号栈 + const s2 = [] // 输出栈 + const getTopVal = (stack) => stack.length > 0 ? stack[stack.length - 1] : null + const levelCompare = (c1, c2) => { + const getIndex = c => ['+-', '×÷', '()'].findIndex(t => t.includes(c)) + return getIndex(c1) - getIndex(c2) + } + exps.forEach(t => { + if (typeof t === 'string' && Number.isNaN(Number(t))) { // 是符号 + if (t === '(') { + s1.push(t) + } else if (t === ')') { + let popVal + do { + popVal = s1.pop() + popVal !== '(' && s2.push(popVal) + } while (s1.length && popVal !== '(') + } else { + let topVal = getTopVal(s1) + if (!topVal) { // s1 为空 直接push + s1.push(t) + } else { + while (topVal && topVal !== '(' && levelCompare(topVal, t) >= 0) { // 优先级 >= t 弹出到s2 + s2.push(s1.pop()) + topVal = getTopVal(s1) + } + s1.push(t) + } + } + return + } + s2.push(t) // 数字直接入栈 + }) + while (s1.length) { + s2.push(s1.pop()) + } + return s2 +} +/** + * 计算后缀表达式的值 + * @param {Array} rpnExps - 后缀表达式 + */ +export const calcRPN = rpnExps => { + rpnExps = rpnExps.concat() + const calc = (x, y, type) => { + let a1 = Number(x), + a2 = Number(y) + switch (type) { + case '+': + return a1 + a2; + case '-': + return a1 - a2; + case '×': + return a1 * a2; + case '÷': + return a1 / a2; + } + } + for (let i = 2; i < rpnExps.length; i++) { + if ('+-×÷'.includes(rpnExps[i])) { + let val = calc(rpnExps[i - 2], rpnExps[i - 1], rpnExps[i]) + rpnExps.splice(i - 2, 3, val) + i = i - 2 + } + } + return rpnExps[0] +} +/** + * 简易防抖函数 + * @param {Function} func -防抖目标函数 + * @param {Number} gap - 防抖时间间隔 + */ +export const debounce = (func, gap) => { + let timer + return function() { + timer && clearTimeout(timer) + timer = setTimeout(() => { + func.apply(this, arguments) + }, gap) + } +} + + + + +//计算年或者月 +export function getDateDay(Target, type, monthNum) { + let date = new Date() + let year = date.getFullYear() //获取当前日期的年份 + let month = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) //获取当前日期的月份 + let day = date.getDate() //获取当前日期的日 + let hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() + let minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() + let seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() + let days = new Date(year, month, 0) + days = days.getDate(); //获取当前日期中的月的天数 + let year2 = year; + let month2; + if (Target == 2) { + if (type == 5) { + month2 = parseInt(month) + parseInt(monthNum) + if (month2 > 12) { + year2 = parseInt(year2) + parseInt((parseInt(month2) / 12 == 0 ? 1 : parseInt(month2) / 12)); + month2 = parseInt(month2) % 12; + } + } else if (type == 4) { + month2 = parseInt(month) - monthNum; + if (month2 <= 0) { + let absM = Math.abs(month2); + year2 = parseInt(year2) - Math.ceil(absM / 12 == 0 ? 1 : parseInt(absM) / 12); + month2 = 12 - (absM % 12); + } + } + } else if (Target == 1) { + month2 = parseInt(month) + if (type == 5) { + year2 = parseInt(year) + parseInt(monthNum) + } else if (type == 4) { + year2 = parseInt(year) - parseInt(monthNum) + } + } + let day2 = day; + let days2 = new Date(year2, month2, 0); + days2 = days2.getDate(); + if (day2 > days2) { + day2 = days2; + } + if (month2 < 10) { + month2 = '0' + month2; + } + let t2 = year2 + '-' + month2 + '-' + day2 + ' ' + hours + ':' + minutes + ':' + seconds; + return t2; +} + +//计算日 +export function getLaterData(days) { + let date = new Date(); + date.setDate(date.getDate() + days); + let month = date.getMonth() + 1; + let day = date.getDate(); + let hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() + let minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() + let seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() + return date.getFullYear() + '-' + ('0' + month).slice(-2) + '-' + ('0' + day).slice(-2) + ' ' + hours + ':' + + minutes + ':' + seconds; +} +export function getBeforeData(num) { + let dateArray = [] + //获取今天日期 + let myDate = new Date() + let hours = myDate.getHours() < 10 ? '0' + myDate.getHours() : myDate.getHours() + let minutes = myDate.getMinutes() < 10 ? '0' + myDate.getMinutes() : myDate.getMinutes() + let seconds = myDate.getSeconds() < 10 ? '0' + myDate.getSeconds() : myDate.getSeconds() + let today = myDate.getFullYear() + '-' + (myDate.getMonth() + 1) + "-" + myDate.getDate(); + myDate.setDate(myDate.getDate() - num) + let dateTemp; // 临时日期数据 + let flag = 1; + for (let i = 0; i < num; i++) { + dateTemp = myDate.getFullYear() + '-' + (myDate.getMonth() + 1) + "-" + myDate.getDate() + dateArray.push({ + date: dateTemp + }) + myDate.setDate(myDate.getDate() + flag); + } + dateArray.push({ + date: today + }) + let arr = [] + let newArr = [] + dateArray.forEach(item => { + arr.push(item.date.split('-')) + }) + for (let i = 0; i < arr.length; i++) { + if (arr[i][1] < 10) { + arr[i][1] = "0" + arr[i][1] + } + if (arr[i][2] < 10) { + arr[i][2] = "0" + arr[i][2] + } + } + for (let j = 0; j < arr.length; j++) { + newArr.push(arr[j].join("-")) + } + return newArr[0] + ' ' + hours + ':' + minutes + ':' + seconds +} + +export function getBeforeTime(type, val) { + let date = new Date() + if (type == 4 || type == 1) { + date.setHours((Number(date.getHours()) - Number(val))) + } else if (type == 5 || type == 2) { + date.setMinutes((Number(date.getMinutes()) - Number(val))) + } else if (type == 6 || type == 3) { + date.setSeconds((Number(date.getSeconds()) - Number(val))) + } + return date +} +export function getLaterTime(type, val) { + let date = new Date() + if (type == 4 || type == 1) { + date.setHours((Number(date.getHours()) + Number(val))) + } else if (type == 5 || type == 2) { + date.setMinutes((Number(date.getMinutes()) + Number(val))) + } else if (type == 6 || type == 3) { + date.setSeconds((Number(date.getSeconds()) + Number(val))) + } + return date +} \ No newline at end of file diff --git a/components/ly-tree/components/ly-checkbox.vue b/components/ly-tree/components/ly-checkbox.vue new file mode 100644 index 0000000..6253292 --- /dev/null +++ b/components/ly-tree/components/ly-checkbox.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/components/ly-tree/ly-tree-node.vue b/components/ly-tree/ly-tree-node.vue new file mode 100644 index 0000000..e42c5d8 --- /dev/null +++ b/components/ly-tree/ly-tree-node.vue @@ -0,0 +1,402 @@ + + + + + \ No newline at end of file diff --git a/components/ly-tree/ly-tree.vue b/components/ly-tree/ly-tree.vue new file mode 100644 index 0000000..3ec941a --- /dev/null +++ b/components/ly-tree/ly-tree.vue @@ -0,0 +1,639 @@ + + + + + \ No newline at end of file diff --git a/components/ly-tree/model/node.js b/components/ly-tree/model/node.js new file mode 100644 index 0000000..d5f3567 --- /dev/null +++ b/components/ly-tree/model/node.js @@ -0,0 +1,538 @@ +import { + markNodeData, + objectAssign, + arrayFindIndex, + getChildState, + reInitChecked, + getPropertyFromData, + isNull, + NODE_KEY +} from '../tool/util'; + +const getStore = function(store) { + let thisStore = store; + + return function() { + return thisStore; + } +} + +let nodeIdSeed = 0; + +export default class Node { + constructor(options) { + this.time = new Date().getTime(); + this.id = nodeIdSeed++; + this.text = null; + this.checked = false; + this.indeterminate = false; + this.data = null; + this.expanded = false; + this.parentId = null; + this.visible = true; + this.isCurrent = false; + + for (let name in options) { + if (options.hasOwnProperty(name)) { + if (name === 'store') { + this.store = getStore(options[name]); + } else { + this[name] = options[name]; + } + } + } + + if (!this.store()) { + throw new Error('[Node]store is required!'); + } + + // internal + this.level = 0; + this.loaded = false; + this.childNodesId = []; + this.loading = false; + this.label = getPropertyFromData(this, 'label'); + this.key = this._getKey(); + this.disabled = getPropertyFromData(this, 'disabled'); + this.nextSibling = null; + this.previousSibling = null; + this.icon = ''; + + this._handleParentAndLevel(); + this._handleProps(); + this._handleExpand(); + this._handleCurrent(); + + if (this.store().lazy) { + this.store()._initDefaultCheckedNode(this); + } + + this.updateLeafState(); + } + + _getKey() { + if (!this.data || Array.isArray(this.data)) return null; + + if (typeof this.data === 'object') { + const nodeKey = this.store().key; + const key = this.data[nodeKey]; + + if (typeof key === 'undefined') { + throw new Error(`您配置的node-key为"${nodeKey}",但数据中并未找到对应"${nodeKey}"属性的值,请检查node-key的配置是否合理`) + } + + return key; + } + + throw new Error('不合法的data数据'); + } + + _handleParentAndLevel() { + if (this.parentId !== null) { + let parent = this.getParent(this.parentId); + + if (this.store().isInjectParentInNode) { + this.parent = parent; + } + + // 由于这里做了修改,默认第一个对象不会被注册到nodesMap中,所以找不到parent会报错,所以默认parent的level是0 + if (!parent) { + parent = { + level: 0 + } + } else { + const parentChildNodes = parent.getChildNodes(parent.childNodesId); + const index = parent.childNodesId.indexOf(this.key); + this.nextSibling = index > -1 ? parentChildNodes[index + 1] : null; + this.previousSibling = index > 0 ? parentChildNodes[index - 1] : null; + } + this.level = parent.level + 1; + } + } + + _handleProps() { + const props = this.store().props; + + if (this.store().showNodeIcon) { + if (props && typeof props.icon !== 'undefined') { + this.icon = getPropertyFromData(this, 'icon'); + } else { + console.warn('请配置props属性中的"icon"字段') + } + } + + this.store().registerNode(this); + + if (props && typeof props.isLeaf !== 'undefined') { + const isLeaf = getPropertyFromData(this, 'isLeaf'); + if (typeof isLeaf === 'boolean') { + this.isLeafByUser = isLeaf; + } + } + } + + _handleExpand() { + if (this.store().lazy !== true && this.data) { + this.setData(this.data); + + if (this.store().defaultExpandAll) { + this.expanded = true; + } + } else if (this.level > 0 && this.store().lazy && this.store().defaultExpandAll) { + this.expand(); + } + + if (!Array.isArray(this.data)) { + markNodeData(this, this.data); + } + + if (!this.data) return; + + const defaultExpandedKeys = this.store().defaultExpandedKeys; + const key = this.store().key; + if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) { + this.expand(null, this.store().autoExpandparent); + } + } + + _handleCurrent() { + const key = this.store().key; + + if (key && this.store().currentNodeKey !== undefined && this.key === this.store().currentNodeKey) { + this.store().currentNode = this; + this.store().currentNode.isCurrent = true; + } + } + + destroyStore() { + getStore(null) + } + + setData(data) { + if (!Array.isArray(data)) { + markNodeData(this, data); + } + + this.data = data; + this.childNodesId = []; + + let children; + if (this.level === 0 && Array.isArray(this.data)) { + children = this.data; + } else { + children = getPropertyFromData(this, 'children') || []; + } + + for (let i = 0, j = children.length; i < j; i++) { + this.insertChild({ + data: children[i] + }); + } + } + + contains(target, deep = true) { + const walk = function(parent) { + const children = parent.getChildNodes(parent.childNodesId) || []; + let result = false; + for (let i = 0, j = children.length; i < j; i++) { + const child = children[i]; + if (child === target || (deep && walk(child))) { + result = true; + break; + } + } + return result; + }; + + return walk(this); + } + + remove() { + if (this.parentId !== null) { + const parent = this.getParent(this.parentId); + parent.removeChild(this); + } + } + + insertChild(child, index, batch) { + if (!child) throw new Error('insertChild error: child is required.'); + + if (!(child instanceof Node)) { + if (!batch) { + const children = this.getChildren(true); + if (children.indexOf(child.data) === -1) { + if (typeof index === 'undefined' || index < 0) { + children.push(child.data); + } else { + children.splice(index, 0, child.data); + } + } + } + + objectAssign(child, { + parentId: isNull(this.key) ? '' : this.key, + store: this.store() + }); + child = new Node(child); + } + + child.level = this.level + 1; + + if (typeof index === 'undefined' || index < 0) { + this.childNodesId.push(child.key); + } else { + this.childNodesId.splice(index, 0, child.key); + } + + this.updateLeafState(); + } + + insertBefore(child, ref) { + let index; + if (ref) { + index = this.childNodesId.indexOf(ref.id); + } + this.insertChild(child, index); + } + + insertAfter(child, ref) { + let index; + if (ref) { + index = this.childNodesId.indexOf(ref.id); + if (index !== -1) index += 1; + } + this.insertChild(child, index); + } + + removeChild(child) { + const children = this.getChildren() || []; + const dataIndex = children.indexOf(child.data); + if (dataIndex > -1) { + children.splice(dataIndex, 1); + } + + const index = this.childNodesId.indexOf(child.key); + + if (index > -1) { + this.store() && this.store().deregisterNode(child); + child.parentId = null; + this.childNodesId.splice(index, 1); + } + + this.updateLeafState(); + } + + removeChildByData(data) { + let targetNode = null; + + for (let i = 0; i < this.childNodesId.length; i++) { + let node = this.getChildNodes(this.childNodesId); + if (node[i].data === data) { + targetNode = node[i]; + break; + } + } + + if (targetNode) { + this.removeChild(targetNode); + } + } + + // 为了避免APP端parent嵌套结构导致报错,这里parent需要从nodesMap中获取 + getParent(parentId) { + try { + if (!parentId.toString()) return null; + return this.store().nodesMap[parentId]; + } catch (error) { + return null; + } + } + + // 为了避免APP端childNodes嵌套结构导致报错,这里childNodes需要从nodesMap中获取 + getChildNodes(childNodesId) { + let childNodes = []; + if (childNodesId.length === 0) return childNodes; + childNodesId.forEach((key) => { + childNodes.push(this.store().nodesMap[key]); + }) + return childNodes; + } + + expand(callback, expandparent) { + const done = () => { + if (expandparent) { + let parent = this.getParent(this.parentId); + while (parent && parent.level > 0) { + parent.expanded = true; + parent = this.getParent(parent.parentId); + } + } + this.expanded = true; + if (callback) callback(); + }; + + if (this.shouldLoadData()) { + this.loadData(function(data) { + if (Array.isArray(data)) { + if (this.checked) { + this.setChecked(true, true); + } else if (!this.store().checkStrictly) { + reInitChecked(this); + } + done(); + } + }); + } else { + done(); + } + } + + doCreateChildren(array, defaultProps = {}) { + array.forEach((item) => { + this.insertChild(objectAssign({ + data: item + }, defaultProps), undefined, true); + }); + } + + collapse() { + this.expanded = false; + } + + shouldLoadData() { + return this.store().lazy === true && this.store().load && !this.loaded; + } + + updateLeafState() { + if (this.store().lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') { + this.isLeaf = this.isLeafByUser; + return; + } + const childNodesId = this.childNodesId; + if (!this.store().lazy || (this.store().lazy === true && this.loaded === true)) { + this.isLeaf = !childNodesId || childNodesId.length === 0; + return; + } + this.isLeaf = false; + } + + setChecked(value, deep, recursion, passValue) { + this.indeterminate = value === 'half'; + this.checked = value === true; + + if (this.checked && this.store().expandOnCheckNode) { + this.expand(null, true) + } + + if (this.store().checkStrictly) return; + if (this.store().showRadio) return; + + if (!(this.shouldLoadData() && !this.store().checkDescendants)) { + let childNodes = this.getChildNodes(this.childNodesId); + let { + all, + allWithoutDisable + } = getChildState(childNodes); + + if (!this.isLeaf && (!all && allWithoutDisable)) { + this.checked = false; + value = false; + } + + const handleDescendants = () => { + if (deep) { + let childNodes = this.getChildNodes(this.childNodesId) + for (let i = 0, j = childNodes.length; i < j; i++) { + const child = childNodes[i]; + passValue = passValue || value !== false; + const isCheck = child.disabled ? child.checked : passValue; + child.setChecked(isCheck, deep, true, passValue); + } + const { + half, + all + } = getChildState(childNodes); + + if (!all) { + this.checked = all; + this.indeterminate = half; + } + } + }; + + if (this.shouldLoadData()) { + this.loadData(() => { + handleDescendants(); + reInitChecked(this); + }, { + checked: value !== false + }); + return; + } else { + handleDescendants(); + } + } + + if (!this.parentId) return; + + let parent = this.getParent(this.parentId); + if (parent && parent.level === 0) return; + + if (!recursion) { + reInitChecked(parent); + } + } + + setRadioChecked(value) { + const allNodes = this.store()._getAllNodes().sort((a, b) => b.level - a.level); + allNodes.forEach(node => node.setChecked(false, false)); + this.checked = value === true; + } + + getChildren(forceInit = false) { + if (this.level === 0) return this.data; + const data = this.data; + if (!data) return null; + + const props = this.store().props; + let children = 'children'; + if (props) { + children = props.children || 'children'; + } + + if (data[children] === undefined) { + data[children] = null; + } + + if (forceInit && !data[children]) { + data[children] = []; + } + + return data[children]; + } + + updateChildren() { + let childNodes = this.getChildNodes(this.childNodesId); + const newData = this.getChildren() || []; + const oldData = childNodes.map((node) => node.data); + + const newDataMap = {}; + const newNodes = []; + + newData.forEach((item, index) => { + const key = item[NODE_KEY]; + const isNodeExists = !!key && arrayFindIndex(oldData, data => data[NODE_KEY] === key) >= 0; + if (isNodeExists) { + newDataMap[key] = { + index, + data: item + }; + } else { + newNodes.push({ + index, + data: item + }); + } + }); + + if (!this.store().lazy) { + oldData.forEach((item) => { + if (!newDataMap[item[NODE_KEY]]) this.removeChildByData(item); + }); + } + + newNodes.forEach(({ + index, + data + }) => { + this.insertChild({ + data + }, index); + }); + + this.updateLeafState(); + } + + loadData(callback, defaultProps = {}) { + if (this.store().lazy === true && + this.store().load && !this.loaded && + (!this.loading || Object.keys(defaultProps).length) + ) { + this.loading = true; + + const resolve = (children) => { + this.loaded = true; + this.loading = false; + this.childNodesId = []; + this.doCreateChildren(children, defaultProps); + this.updateLeafState(); + + callback && callback.call(this, children); + }; + + this.store().load(this, resolve); + } else { + callback && callback.call(this); + } + } +} \ No newline at end of file diff --git a/components/ly-tree/model/tree-store.js b/components/ly-tree/model/tree-store.js new file mode 100644 index 0000000..d92f794 --- /dev/null +++ b/components/ly-tree/model/tree-store.js @@ -0,0 +1,428 @@ +import Node from './node'; +import { + getNodeKey, + getPropertyFromData +} from '../tool/util'; + +export default class TreeStore { + constructor(options) { + this.ready = false; + this.currentNode = null; + this.currentNodeKey = null; + + Object.assign(this, options); + + if (!this.key) { + throw new Error('[Tree] nodeKey is required'); + } + + this.nodesMap = {}; + this.root = new Node({ + data: this.data, + store: this + }); + + if (this.lazy && this.load) { + const loadFn = this.load; + loadFn(this.root, (data) => { + this.root.doCreateChildren(data); + this._initDefaultCheckedNodes(); + this.ready = true; + uni.$emit('updateKey') //加了异步才会展示数据 + }); + } else { + this._initDefaultCheckedNodes(); + this.ready = true; + } + } + + getReady() { + return this.ready + } + filter(value, data) { + const filterNodeMethod = this.filterNodeMethod; + const lazy = this.lazy; + const _self = this; + const traverse = function(node) { + const childNodes = node.root ? node.root.getChildNodes(node.root.childNodesId) : node.getChildNodes( + node.childNodesId); + + childNodes.forEach((child) => { + if (data && typeof data === 'object') { + let nodePath = _self.getNodePath(child.data); + if (!nodePath.some(pathItem => pathItem[_self.key] === data[_self.key])) { + child.visible = false; + traverse(child); + return; + } + } + + if (_self.childVisibleForFilterNode) { + let parent = child.getParent(child.parentId); + child.visible = filterNodeMethod.call(child, value, child.data, child) || (parent && + parent.visible); + } else { + child.visible = filterNodeMethod.call(child, value, child.data, child); + } + + traverse(child); + }); + + if (!node.visible && childNodes.length) { + let allHidden = true; + allHidden = !childNodes.some(child => child.visible); + + if (node.root) { + node.root.visible = allHidden === false; + } else { + node.visible = allHidden === false; + } + } + + if (!value) return; + + if (node.visible && !node.isLeaf && !lazy) node.expand(); + }; + + traverse(this); + } + + setData(newVal) { + const instanceChanged = newVal !== this.root.data; + if (instanceChanged) { + this.root.setData(newVal); + this._initDefaultCheckedNodes(); + } else { + this.root.updateChildren(); + } + } + + getNode(data) { + if (data instanceof Node) return data; + const key = typeof data !== 'object' ? data : getNodeKey(this.key, data); + if (!key) return null; + return this.nodesMap[key] || null; + } + + insertBefore(data, refData) { + const refNode = this.getNode(refData); + let parent = refNode.getParent(refNode.parentId); + parent.insertBefore({ + data + }, refNode); + } + + insertAfter(data, refData) { + const refNode = this.getNode(refData); + let parent = refNode.getParent(refNode.parentId); + parent.insertAfter({ + data + }, refNode); + } + + remove(data) { + const node = this.getNode(data); + + if (node && node.parentId !== null) { + let parent = node.getParent(node.parentId); + if (node === this.currentNode) { + this.currentNode = null; + } + parent.removeChild(node); + } + } + + append(data, parentData) { + const parentNode = parentData ? this.getNode(parentData) : this.root; + + if (parentNode) { + parentNode.insertChild({ + data + }); + } + } + + _initDefaultCheckedNodes() { + const defaultCheckedKeys = this.defaultCheckedKeys || []; + const nodesMap = this.nodesMap; + let checkedKeyfromData = []; + let totalCheckedKeys = [] + + for (let key in nodesMap) { + let checked = getPropertyFromData(nodesMap[key], 'checked') || false; + checked && checkedKeyfromData.push(key); + } + + totalCheckedKeys = Array.from(new Set([...defaultCheckedKeys, ...checkedKeyfromData])); + totalCheckedKeys.forEach((checkedKey) => { + const node = nodesMap[checkedKey]; + + if (node) { + node.setChecked(true, !this.checkStrictly); + } + }); + } + + _initDefaultCheckedNode(node) { + const defaultCheckedKeys = this.defaultCheckedKeys || []; + + if (defaultCheckedKeys.indexOf(node.key) !== -1) { + node.setChecked(true, !this.checkStrictly); + } + } + + toggleExpendAll(isExpandAll) { + const allNodes = this._getAllNodes(); + + allNodes.forEach(item => { + const node = this.getNode(item.key); + + if (node) isExpandAll ? node.expand() : node.collapse(); + }); + } + + setCheckAll(isCkeckAll) { + const allNodes = this._getAllNodes(); + + allNodes.forEach(item => { + item.setChecked(isCkeckAll, false); + }); + } + + setDefaultCheckedKey(newVal) { + if (newVal !== this.defaultCheckedKeys) { + this.defaultCheckedKeys = newVal; + this._initDefaultCheckedNodes(); + } + } + + registerNode(node) { + + const key = this.key; + if (!key || !node || !node.data) return; + + const nodeKey = node.key; + if (nodeKey !== undefined) this.nodesMap[node.key] = node; + } + + deregisterNode(node) { + const key = this.key; + if (!key || !node || !node.data) return; + + let childNodes = node.getChildNodes(node.childNodesId); + childNodes.forEach(child => { + this.deregisterNode(child); + }); + + delete this.nodesMap[node.key]; + } + + getNodePath(data) { + if (!this.key) throw new Error('[Tree] nodeKey is required in getNodePath'); + const node = this.getNode(data); + if (!node) return []; + + const path = [node.data]; + let parent = node.getParent(node.parentId); + while (parent && parent !== this.root) { + path.push(parent.data); + parent = parent.getParent(parent.parentId); + } + return path.reverse(); + } + + getCheckedNodes(leafOnly = false, includeHalfChecked = false) { + const checkedNodes = []; + const traverse = function(node) { + const childNodes = node.root ? node.root.getChildNodes(node.root.childNodesId) : node.getChildNodes( + node.childNodesId); + + childNodes.forEach((child) => { + if ((child.checked || (includeHalfChecked && child.indeterminate)) && (!leafOnly || ( + leafOnly && child.isLeaf))) { + checkedNodes.push(child.data); + } + + traverse(child); + }); + }; + + traverse(this); + + return checkedNodes; + } + + getCheckedKeys(leafOnly = false, includeHalfChecked = false) { + return this.getCheckedNodes(leafOnly, includeHalfChecked).map((data) => (data || {})[this.key]); + } + + getHalfCheckedNodes() { + const nodes = []; + const traverse = function(node) { + const childNodes = node.root ? node.root.getChildNodes(node.root.childNodesId) : node.getChildNodes( + node.childNodesId); + + childNodes.forEach((child) => { + if (child.indeterminate) { + nodes.push(child.data); + } + + traverse(child); + }); + }; + + traverse(this); + + return nodes; + } + + getHalfCheckedKeys() { + return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]); + } + + _getAllNodes() { + const allNodes = []; + const nodesMap = this.nodesMap; + for (let nodeKey in nodesMap) { + if (nodesMap.hasOwnProperty(nodeKey)) { + allNodes.push(nodesMap[nodeKey]); + } + } + + return allNodes; + } + + updateChildren(key, data) { + const node = this.nodesMap[key]; + if (!node) return; + const childNodes = node.getChildNodes(node.childNodesId); + for (let i = childNodes.length - 1; i >= 0; i--) { + const child = childNodes[i]; + this.remove(child.data); + } + for (let i = 0, j = data.length; i < j; i++) { + const child = data[i]; + this.append(child, node.data); + } + } + + _setCheckedKeys(key, leafOnly = false, checkedKeys) { + const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level); + const cache = Object.create(null); + const keys = Object.keys(checkedKeys); + allNodes.forEach(node => node.setChecked(false, false)); + for (let i = 0, j = allNodes.length; i < j; i++) { + const node = allNodes[i]; + let nodeKey = node.data[key]; + + if (typeof nodeKey === 'undefined') continue; + + nodeKey = nodeKey.toString(); + let checked = keys.indexOf(nodeKey) > -1; + if (!checked) { + if (node.checked && !cache[nodeKey]) { + node.setChecked(false, false); + } + continue; + } + + let parent = node.getParent(node.parentId); + while (parent && parent.level > 0) { + cache[parent.data[key]] = true; + parent = parent.getParent(parent.parentId); + } + + if (node.isLeaf || this.checkStrictly) { + node.setChecked(true, false); + continue; + } + node.setChecked(true, true); + + if (leafOnly) { + node.setChecked(false, false); + const traverse = function(node) { + const childNodes = node.getChildNodes(node.childNodesId); + childNodes.forEach((child) => { + if (!child.isLeaf) { + child.setChecked(false, false); + } + traverse(child); + }); + }; + traverse(node); + } + } + } + + setCheckedNodes(array, leafOnly = false) { + const key = this.key; + const checkedKeys = {}; + array.forEach((item) => { + checkedKeys[(item || {})[key]] = true; + }); + + this._setCheckedKeys(key, leafOnly, checkedKeys); + } + + setCheckedKeys(keys, leafOnly = false) { + this.defaultCheckedKeys = keys; + const key = this.key; + const checkedKeys = {}; + keys.forEach((key) => { + checkedKeys[key] = true; + }); + + this._setCheckedKeys(key, leafOnly, checkedKeys); + } + + setDefaultExpandedKeys(keys) { + keys = keys || []; + this.defaultExpandedKeys = keys; + + keys.forEach((key) => { + const node = this.getNode(key); + if (node) node.expand(null, this.autoExpandParent); + }); + } + + setChecked(data, checked, deep) { + const node = this.getNode(data); + + if (node) { + node.setChecked(!!checked, deep); + } + } + + getCurrentNode() { + return this.currentNode; + } + + setCurrentNode(currentNode) { + const prevCurrentNode = this.currentNode; + if (prevCurrentNode) { + prevCurrentNode.isCurrent = false; + } + this.currentNode = currentNode; + this.currentNode.isCurrent = true; + + this.expandCurrentNodeParent && this.currentNode.expand(null, true) + } + + setUserCurrentNode(node) { + const key = node[this.key]; + const currNode = this.nodesMap[key]; + this.setCurrentNode(currNode); + } + + setCurrentNodeKey(key) { + if (key === null || key === undefined) { + this.currentNode && (this.currentNode.isCurrent = false); + this.currentNode = null; + return; + } + const node = this.getNode(key); + if (node) { + this.setCurrentNode(node); + } + } +}; \ No newline at end of file diff --git a/components/ly-tree/tool/util.js b/components/ly-tree/tool/util.js new file mode 100644 index 0000000..1118c5c --- /dev/null +++ b/components/ly-tree/tool/util.js @@ -0,0 +1,115 @@ +export const NODE_KEY = '$treeNodeId'; + +export const markNodeData = function(node, data) { + if (!data || data[NODE_KEY]) return; + Object.defineProperty(data, NODE_KEY, { + value: node.id, + enumerable: false, + configurable: false, + writable: false + }); +}; + +export const getNodeKey = function(key, data) { + if (!data) return null; + if (!key) return data[NODE_KEY]; + return data[key]; +}; + +export const objectAssign = function(target) { + for (let i = 1, j = arguments.length; i < j; i++) { + let source = arguments[i] || {}; + for (let prop in source) { + if (source.hasOwnProperty(prop)) { + let value = source[prop]; + if (value !== undefined) { + target[prop] = value; + } + } + } + } + + return target; +}; + +// TODO: use native Array.find, Array.findIndex when IE support is dropped +export const arrayFindIndex = function(arr, pred) { + for (let i = 0; i !== arr.length; ++i) { + if (pred(arr[i])) { + return i; + } + } + return -1; +}; + +export const getChildState = function(node) { + let all = true; + let none = true; + let allWithoutDisable = true; + for (let i = 0, j = node.length; i < j; i++) { + const n = node[i]; + if (n.checked !== true || n.indeterminate) { + all = false; + if (!n.disabled) { + allWithoutDisable = false; + } + } + if (n.checked !== false || n.indeterminate) { + none = false; + } + } + + return { + all, + none, + allWithoutDisable, + half: !all && !none + }; +}; + +export const reInitChecked = function(node) { + if (!node || node.childNodesId.length === 0) return; + + let childNodes = node.getChildNodes(node.childNodesId); + const { + all, + none, + half + } = getChildState(childNodes); + if (all) { + node.checked = true; + node.indeterminate = false; + } else if (half) { + node.checked = false; + node.indeterminate = true; + } else if (none) { + node.checked = false; + node.indeterminate = false; + } + + let parent = node.getParent(node.parentId); + if (!parent || parent.level === 0) return; + + if (!node.store().checkStrictly) { + reInitChecked(parent); + } +}; + +export const getPropertyFromData = function(node, prop) { + const props = node.store().props; + const data = node.data || {}; + const config = props[prop]; + + if (typeof config === 'function') { + return config(data, node); + } else if (typeof config === 'string') { + return data[config]; + } else if (typeof config === 'undefined') { + const dataProp = data[prop]; + return dataProp === undefined ? '' : dataProp; + } +}; + +export const isNull = function(v) { + return v === undefined || v === null || v === ''; +} diff --git a/components/selectBox/index.vue b/components/selectBox/index.vue new file mode 100644 index 0000000..6b9822e --- /dev/null +++ b/components/selectBox/index.vue @@ -0,0 +1,71 @@ + + + + + \ No newline at end of file diff --git a/components/treeCollapse/index.vue b/components/treeCollapse/index.vue new file mode 100644 index 0000000..e664c56 --- /dev/null +++ b/components/treeCollapse/index.vue @@ -0,0 +1,102 @@ + + + + \ No newline at end of file diff --git a/components/treeCollapse/ly-tree-node.vue b/components/treeCollapse/ly-tree-node.vue new file mode 100644 index 0000000..4ac1c5b --- /dev/null +++ b/components/treeCollapse/ly-tree-node.vue @@ -0,0 +1,377 @@ + + + + + \ No newline at end of file diff --git a/components/treeCollapse/ly-tree.vue b/components/treeCollapse/ly-tree.vue new file mode 100644 index 0000000..b09c369 --- /dev/null +++ b/components/treeCollapse/ly-tree.vue @@ -0,0 +1,625 @@ + + + + + \ No newline at end of file diff --git a/components/treeCollapse/model/node.js b/components/treeCollapse/model/node.js new file mode 100644 index 0000000..d5f3567 --- /dev/null +++ b/components/treeCollapse/model/node.js @@ -0,0 +1,538 @@ +import { + markNodeData, + objectAssign, + arrayFindIndex, + getChildState, + reInitChecked, + getPropertyFromData, + isNull, + NODE_KEY +} from '../tool/util'; + +const getStore = function(store) { + let thisStore = store; + + return function() { + return thisStore; + } +} + +let nodeIdSeed = 0; + +export default class Node { + constructor(options) { + this.time = new Date().getTime(); + this.id = nodeIdSeed++; + this.text = null; + this.checked = false; + this.indeterminate = false; + this.data = null; + this.expanded = false; + this.parentId = null; + this.visible = true; + this.isCurrent = false; + + for (let name in options) { + if (options.hasOwnProperty(name)) { + if (name === 'store') { + this.store = getStore(options[name]); + } else { + this[name] = options[name]; + } + } + } + + if (!this.store()) { + throw new Error('[Node]store is required!'); + } + + // internal + this.level = 0; + this.loaded = false; + this.childNodesId = []; + this.loading = false; + this.label = getPropertyFromData(this, 'label'); + this.key = this._getKey(); + this.disabled = getPropertyFromData(this, 'disabled'); + this.nextSibling = null; + this.previousSibling = null; + this.icon = ''; + + this._handleParentAndLevel(); + this._handleProps(); + this._handleExpand(); + this._handleCurrent(); + + if (this.store().lazy) { + this.store()._initDefaultCheckedNode(this); + } + + this.updateLeafState(); + } + + _getKey() { + if (!this.data || Array.isArray(this.data)) return null; + + if (typeof this.data === 'object') { + const nodeKey = this.store().key; + const key = this.data[nodeKey]; + + if (typeof key === 'undefined') { + throw new Error(`您配置的node-key为"${nodeKey}",但数据中并未找到对应"${nodeKey}"属性的值,请检查node-key的配置是否合理`) + } + + return key; + } + + throw new Error('不合法的data数据'); + } + + _handleParentAndLevel() { + if (this.parentId !== null) { + let parent = this.getParent(this.parentId); + + if (this.store().isInjectParentInNode) { + this.parent = parent; + } + + // 由于这里做了修改,默认第一个对象不会被注册到nodesMap中,所以找不到parent会报错,所以默认parent的level是0 + if (!parent) { + parent = { + level: 0 + } + } else { + const parentChildNodes = parent.getChildNodes(parent.childNodesId); + const index = parent.childNodesId.indexOf(this.key); + this.nextSibling = index > -1 ? parentChildNodes[index + 1] : null; + this.previousSibling = index > 0 ? parentChildNodes[index - 1] : null; + } + this.level = parent.level + 1; + } + } + + _handleProps() { + const props = this.store().props; + + if (this.store().showNodeIcon) { + if (props && typeof props.icon !== 'undefined') { + this.icon = getPropertyFromData(this, 'icon'); + } else { + console.warn('请配置props属性中的"icon"字段') + } + } + + this.store().registerNode(this); + + if (props && typeof props.isLeaf !== 'undefined') { + const isLeaf = getPropertyFromData(this, 'isLeaf'); + if (typeof isLeaf === 'boolean') { + this.isLeafByUser = isLeaf; + } + } + } + + _handleExpand() { + if (this.store().lazy !== true && this.data) { + this.setData(this.data); + + if (this.store().defaultExpandAll) { + this.expanded = true; + } + } else if (this.level > 0 && this.store().lazy && this.store().defaultExpandAll) { + this.expand(); + } + + if (!Array.isArray(this.data)) { + markNodeData(this, this.data); + } + + if (!this.data) return; + + const defaultExpandedKeys = this.store().defaultExpandedKeys; + const key = this.store().key; + if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) { + this.expand(null, this.store().autoExpandparent); + } + } + + _handleCurrent() { + const key = this.store().key; + + if (key && this.store().currentNodeKey !== undefined && this.key === this.store().currentNodeKey) { + this.store().currentNode = this; + this.store().currentNode.isCurrent = true; + } + } + + destroyStore() { + getStore(null) + } + + setData(data) { + if (!Array.isArray(data)) { + markNodeData(this, data); + } + + this.data = data; + this.childNodesId = []; + + let children; + if (this.level === 0 && Array.isArray(this.data)) { + children = this.data; + } else { + children = getPropertyFromData(this, 'children') || []; + } + + for (let i = 0, j = children.length; i < j; i++) { + this.insertChild({ + data: children[i] + }); + } + } + + contains(target, deep = true) { + const walk = function(parent) { + const children = parent.getChildNodes(parent.childNodesId) || []; + let result = false; + for (let i = 0, j = children.length; i < j; i++) { + const child = children[i]; + if (child === target || (deep && walk(child))) { + result = true; + break; + } + } + return result; + }; + + return walk(this); + } + + remove() { + if (this.parentId !== null) { + const parent = this.getParent(this.parentId); + parent.removeChild(this); + } + } + + insertChild(child, index, batch) { + if (!child) throw new Error('insertChild error: child is required.'); + + if (!(child instanceof Node)) { + if (!batch) { + const children = this.getChildren(true); + if (children.indexOf(child.data) === -1) { + if (typeof index === 'undefined' || index < 0) { + children.push(child.data); + } else { + children.splice(index, 0, child.data); + } + } + } + + objectAssign(child, { + parentId: isNull(this.key) ? '' : this.key, + store: this.store() + }); + child = new Node(child); + } + + child.level = this.level + 1; + + if (typeof index === 'undefined' || index < 0) { + this.childNodesId.push(child.key); + } else { + this.childNodesId.splice(index, 0, child.key); + } + + this.updateLeafState(); + } + + insertBefore(child, ref) { + let index; + if (ref) { + index = this.childNodesId.indexOf(ref.id); + } + this.insertChild(child, index); + } + + insertAfter(child, ref) { + let index; + if (ref) { + index = this.childNodesId.indexOf(ref.id); + if (index !== -1) index += 1; + } + this.insertChild(child, index); + } + + removeChild(child) { + const children = this.getChildren() || []; + const dataIndex = children.indexOf(child.data); + if (dataIndex > -1) { + children.splice(dataIndex, 1); + } + + const index = this.childNodesId.indexOf(child.key); + + if (index > -1) { + this.store() && this.store().deregisterNode(child); + child.parentId = null; + this.childNodesId.splice(index, 1); + } + + this.updateLeafState(); + } + + removeChildByData(data) { + let targetNode = null; + + for (let i = 0; i < this.childNodesId.length; i++) { + let node = this.getChildNodes(this.childNodesId); + if (node[i].data === data) { + targetNode = node[i]; + break; + } + } + + if (targetNode) { + this.removeChild(targetNode); + } + } + + // 为了避免APP端parent嵌套结构导致报错,这里parent需要从nodesMap中获取 + getParent(parentId) { + try { + if (!parentId.toString()) return null; + return this.store().nodesMap[parentId]; + } catch (error) { + return null; + } + } + + // 为了避免APP端childNodes嵌套结构导致报错,这里childNodes需要从nodesMap中获取 + getChildNodes(childNodesId) { + let childNodes = []; + if (childNodesId.length === 0) return childNodes; + childNodesId.forEach((key) => { + childNodes.push(this.store().nodesMap[key]); + }) + return childNodes; + } + + expand(callback, expandparent) { + const done = () => { + if (expandparent) { + let parent = this.getParent(this.parentId); + while (parent && parent.level > 0) { + parent.expanded = true; + parent = this.getParent(parent.parentId); + } + } + this.expanded = true; + if (callback) callback(); + }; + + if (this.shouldLoadData()) { + this.loadData(function(data) { + if (Array.isArray(data)) { + if (this.checked) { + this.setChecked(true, true); + } else if (!this.store().checkStrictly) { + reInitChecked(this); + } + done(); + } + }); + } else { + done(); + } + } + + doCreateChildren(array, defaultProps = {}) { + array.forEach((item) => { + this.insertChild(objectAssign({ + data: item + }, defaultProps), undefined, true); + }); + } + + collapse() { + this.expanded = false; + } + + shouldLoadData() { + return this.store().lazy === true && this.store().load && !this.loaded; + } + + updateLeafState() { + if (this.store().lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') { + this.isLeaf = this.isLeafByUser; + return; + } + const childNodesId = this.childNodesId; + if (!this.store().lazy || (this.store().lazy === true && this.loaded === true)) { + this.isLeaf = !childNodesId || childNodesId.length === 0; + return; + } + this.isLeaf = false; + } + + setChecked(value, deep, recursion, passValue) { + this.indeterminate = value === 'half'; + this.checked = value === true; + + if (this.checked && this.store().expandOnCheckNode) { + this.expand(null, true) + } + + if (this.store().checkStrictly) return; + if (this.store().showRadio) return; + + if (!(this.shouldLoadData() && !this.store().checkDescendants)) { + let childNodes = this.getChildNodes(this.childNodesId); + let { + all, + allWithoutDisable + } = getChildState(childNodes); + + if (!this.isLeaf && (!all && allWithoutDisable)) { + this.checked = false; + value = false; + } + + const handleDescendants = () => { + if (deep) { + let childNodes = this.getChildNodes(this.childNodesId) + for (let i = 0, j = childNodes.length; i < j; i++) { + const child = childNodes[i]; + passValue = passValue || value !== false; + const isCheck = child.disabled ? child.checked : passValue; + child.setChecked(isCheck, deep, true, passValue); + } + const { + half, + all + } = getChildState(childNodes); + + if (!all) { + this.checked = all; + this.indeterminate = half; + } + } + }; + + if (this.shouldLoadData()) { + this.loadData(() => { + handleDescendants(); + reInitChecked(this); + }, { + checked: value !== false + }); + return; + } else { + handleDescendants(); + } + } + + if (!this.parentId) return; + + let parent = this.getParent(this.parentId); + if (parent && parent.level === 0) return; + + if (!recursion) { + reInitChecked(parent); + } + } + + setRadioChecked(value) { + const allNodes = this.store()._getAllNodes().sort((a, b) => b.level - a.level); + allNodes.forEach(node => node.setChecked(false, false)); + this.checked = value === true; + } + + getChildren(forceInit = false) { + if (this.level === 0) return this.data; + const data = this.data; + if (!data) return null; + + const props = this.store().props; + let children = 'children'; + if (props) { + children = props.children || 'children'; + } + + if (data[children] === undefined) { + data[children] = null; + } + + if (forceInit && !data[children]) { + data[children] = []; + } + + return data[children]; + } + + updateChildren() { + let childNodes = this.getChildNodes(this.childNodesId); + const newData = this.getChildren() || []; + const oldData = childNodes.map((node) => node.data); + + const newDataMap = {}; + const newNodes = []; + + newData.forEach((item, index) => { + const key = item[NODE_KEY]; + const isNodeExists = !!key && arrayFindIndex(oldData, data => data[NODE_KEY] === key) >= 0; + if (isNodeExists) { + newDataMap[key] = { + index, + data: item + }; + } else { + newNodes.push({ + index, + data: item + }); + } + }); + + if (!this.store().lazy) { + oldData.forEach((item) => { + if (!newDataMap[item[NODE_KEY]]) this.removeChildByData(item); + }); + } + + newNodes.forEach(({ + index, + data + }) => { + this.insertChild({ + data + }, index); + }); + + this.updateLeafState(); + } + + loadData(callback, defaultProps = {}) { + if (this.store().lazy === true && + this.store().load && !this.loaded && + (!this.loading || Object.keys(defaultProps).length) + ) { + this.loading = true; + + const resolve = (children) => { + this.loaded = true; + this.loading = false; + this.childNodesId = []; + this.doCreateChildren(children, defaultProps); + this.updateLeafState(); + + callback && callback.call(this, children); + }; + + this.store().load(this, resolve); + } else { + callback && callback.call(this); + } + } +} \ No newline at end of file diff --git a/components/treeCollapse/model/tree-store.js b/components/treeCollapse/model/tree-store.js new file mode 100644 index 0000000..d92f794 --- /dev/null +++ b/components/treeCollapse/model/tree-store.js @@ -0,0 +1,428 @@ +import Node from './node'; +import { + getNodeKey, + getPropertyFromData +} from '../tool/util'; + +export default class TreeStore { + constructor(options) { + this.ready = false; + this.currentNode = null; + this.currentNodeKey = null; + + Object.assign(this, options); + + if (!this.key) { + throw new Error('[Tree] nodeKey is required'); + } + + this.nodesMap = {}; + this.root = new Node({ + data: this.data, + store: this + }); + + if (this.lazy && this.load) { + const loadFn = this.load; + loadFn(this.root, (data) => { + this.root.doCreateChildren(data); + this._initDefaultCheckedNodes(); + this.ready = true; + uni.$emit('updateKey') //加了异步才会展示数据 + }); + } else { + this._initDefaultCheckedNodes(); + this.ready = true; + } + } + + getReady() { + return this.ready + } + filter(value, data) { + const filterNodeMethod = this.filterNodeMethod; + const lazy = this.lazy; + const _self = this; + const traverse = function(node) { + const childNodes = node.root ? node.root.getChildNodes(node.root.childNodesId) : node.getChildNodes( + node.childNodesId); + + childNodes.forEach((child) => { + if (data && typeof data === 'object') { + let nodePath = _self.getNodePath(child.data); + if (!nodePath.some(pathItem => pathItem[_self.key] === data[_self.key])) { + child.visible = false; + traverse(child); + return; + } + } + + if (_self.childVisibleForFilterNode) { + let parent = child.getParent(child.parentId); + child.visible = filterNodeMethod.call(child, value, child.data, child) || (parent && + parent.visible); + } else { + child.visible = filterNodeMethod.call(child, value, child.data, child); + } + + traverse(child); + }); + + if (!node.visible && childNodes.length) { + let allHidden = true; + allHidden = !childNodes.some(child => child.visible); + + if (node.root) { + node.root.visible = allHidden === false; + } else { + node.visible = allHidden === false; + } + } + + if (!value) return; + + if (node.visible && !node.isLeaf && !lazy) node.expand(); + }; + + traverse(this); + } + + setData(newVal) { + const instanceChanged = newVal !== this.root.data; + if (instanceChanged) { + this.root.setData(newVal); + this._initDefaultCheckedNodes(); + } else { + this.root.updateChildren(); + } + } + + getNode(data) { + if (data instanceof Node) return data; + const key = typeof data !== 'object' ? data : getNodeKey(this.key, data); + if (!key) return null; + return this.nodesMap[key] || null; + } + + insertBefore(data, refData) { + const refNode = this.getNode(refData); + let parent = refNode.getParent(refNode.parentId); + parent.insertBefore({ + data + }, refNode); + } + + insertAfter(data, refData) { + const refNode = this.getNode(refData); + let parent = refNode.getParent(refNode.parentId); + parent.insertAfter({ + data + }, refNode); + } + + remove(data) { + const node = this.getNode(data); + + if (node && node.parentId !== null) { + let parent = node.getParent(node.parentId); + if (node === this.currentNode) { + this.currentNode = null; + } + parent.removeChild(node); + } + } + + append(data, parentData) { + const parentNode = parentData ? this.getNode(parentData) : this.root; + + if (parentNode) { + parentNode.insertChild({ + data + }); + } + } + + _initDefaultCheckedNodes() { + const defaultCheckedKeys = this.defaultCheckedKeys || []; + const nodesMap = this.nodesMap; + let checkedKeyfromData = []; + let totalCheckedKeys = [] + + for (let key in nodesMap) { + let checked = getPropertyFromData(nodesMap[key], 'checked') || false; + checked && checkedKeyfromData.push(key); + } + + totalCheckedKeys = Array.from(new Set([...defaultCheckedKeys, ...checkedKeyfromData])); + totalCheckedKeys.forEach((checkedKey) => { + const node = nodesMap[checkedKey]; + + if (node) { + node.setChecked(true, !this.checkStrictly); + } + }); + } + + _initDefaultCheckedNode(node) { + const defaultCheckedKeys = this.defaultCheckedKeys || []; + + if (defaultCheckedKeys.indexOf(node.key) !== -1) { + node.setChecked(true, !this.checkStrictly); + } + } + + toggleExpendAll(isExpandAll) { + const allNodes = this._getAllNodes(); + + allNodes.forEach(item => { + const node = this.getNode(item.key); + + if (node) isExpandAll ? node.expand() : node.collapse(); + }); + } + + setCheckAll(isCkeckAll) { + const allNodes = this._getAllNodes(); + + allNodes.forEach(item => { + item.setChecked(isCkeckAll, false); + }); + } + + setDefaultCheckedKey(newVal) { + if (newVal !== this.defaultCheckedKeys) { + this.defaultCheckedKeys = newVal; + this._initDefaultCheckedNodes(); + } + } + + registerNode(node) { + + const key = this.key; + if (!key || !node || !node.data) return; + + const nodeKey = node.key; + if (nodeKey !== undefined) this.nodesMap[node.key] = node; + } + + deregisterNode(node) { + const key = this.key; + if (!key || !node || !node.data) return; + + let childNodes = node.getChildNodes(node.childNodesId); + childNodes.forEach(child => { + this.deregisterNode(child); + }); + + delete this.nodesMap[node.key]; + } + + getNodePath(data) { + if (!this.key) throw new Error('[Tree] nodeKey is required in getNodePath'); + const node = this.getNode(data); + if (!node) return []; + + const path = [node.data]; + let parent = node.getParent(node.parentId); + while (parent && parent !== this.root) { + path.push(parent.data); + parent = parent.getParent(parent.parentId); + } + return path.reverse(); + } + + getCheckedNodes(leafOnly = false, includeHalfChecked = false) { + const checkedNodes = []; + const traverse = function(node) { + const childNodes = node.root ? node.root.getChildNodes(node.root.childNodesId) : node.getChildNodes( + node.childNodesId); + + childNodes.forEach((child) => { + if ((child.checked || (includeHalfChecked && child.indeterminate)) && (!leafOnly || ( + leafOnly && child.isLeaf))) { + checkedNodes.push(child.data); + } + + traverse(child); + }); + }; + + traverse(this); + + return checkedNodes; + } + + getCheckedKeys(leafOnly = false, includeHalfChecked = false) { + return this.getCheckedNodes(leafOnly, includeHalfChecked).map((data) => (data || {})[this.key]); + } + + getHalfCheckedNodes() { + const nodes = []; + const traverse = function(node) { + const childNodes = node.root ? node.root.getChildNodes(node.root.childNodesId) : node.getChildNodes( + node.childNodesId); + + childNodes.forEach((child) => { + if (child.indeterminate) { + nodes.push(child.data); + } + + traverse(child); + }); + }; + + traverse(this); + + return nodes; + } + + getHalfCheckedKeys() { + return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]); + } + + _getAllNodes() { + const allNodes = []; + const nodesMap = this.nodesMap; + for (let nodeKey in nodesMap) { + if (nodesMap.hasOwnProperty(nodeKey)) { + allNodes.push(nodesMap[nodeKey]); + } + } + + return allNodes; + } + + updateChildren(key, data) { + const node = this.nodesMap[key]; + if (!node) return; + const childNodes = node.getChildNodes(node.childNodesId); + for (let i = childNodes.length - 1; i >= 0; i--) { + const child = childNodes[i]; + this.remove(child.data); + } + for (let i = 0, j = data.length; i < j; i++) { + const child = data[i]; + this.append(child, node.data); + } + } + + _setCheckedKeys(key, leafOnly = false, checkedKeys) { + const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level); + const cache = Object.create(null); + const keys = Object.keys(checkedKeys); + allNodes.forEach(node => node.setChecked(false, false)); + for (let i = 0, j = allNodes.length; i < j; i++) { + const node = allNodes[i]; + let nodeKey = node.data[key]; + + if (typeof nodeKey === 'undefined') continue; + + nodeKey = nodeKey.toString(); + let checked = keys.indexOf(nodeKey) > -1; + if (!checked) { + if (node.checked && !cache[nodeKey]) { + node.setChecked(false, false); + } + continue; + } + + let parent = node.getParent(node.parentId); + while (parent && parent.level > 0) { + cache[parent.data[key]] = true; + parent = parent.getParent(parent.parentId); + } + + if (node.isLeaf || this.checkStrictly) { + node.setChecked(true, false); + continue; + } + node.setChecked(true, true); + + if (leafOnly) { + node.setChecked(false, false); + const traverse = function(node) { + const childNodes = node.getChildNodes(node.childNodesId); + childNodes.forEach((child) => { + if (!child.isLeaf) { + child.setChecked(false, false); + } + traverse(child); + }); + }; + traverse(node); + } + } + } + + setCheckedNodes(array, leafOnly = false) { + const key = this.key; + const checkedKeys = {}; + array.forEach((item) => { + checkedKeys[(item || {})[key]] = true; + }); + + this._setCheckedKeys(key, leafOnly, checkedKeys); + } + + setCheckedKeys(keys, leafOnly = false) { + this.defaultCheckedKeys = keys; + const key = this.key; + const checkedKeys = {}; + keys.forEach((key) => { + checkedKeys[key] = true; + }); + + this._setCheckedKeys(key, leafOnly, checkedKeys); + } + + setDefaultExpandedKeys(keys) { + keys = keys || []; + this.defaultExpandedKeys = keys; + + keys.forEach((key) => { + const node = this.getNode(key); + if (node) node.expand(null, this.autoExpandParent); + }); + } + + setChecked(data, checked, deep) { + const node = this.getNode(data); + + if (node) { + node.setChecked(!!checked, deep); + } + } + + getCurrentNode() { + return this.currentNode; + } + + setCurrentNode(currentNode) { + const prevCurrentNode = this.currentNode; + if (prevCurrentNode) { + prevCurrentNode.isCurrent = false; + } + this.currentNode = currentNode; + this.currentNode.isCurrent = true; + + this.expandCurrentNodeParent && this.currentNode.expand(null, true) + } + + setUserCurrentNode(node) { + const key = node[this.key]; + const currNode = this.nodesMap[key]; + this.setCurrentNode(currNode); + } + + setCurrentNodeKey(key) { + if (key === null || key === undefined) { + this.currentNode && (this.currentNode.isCurrent = false); + this.currentNode = null; + return; + } + const node = this.getNode(key); + if (node) { + this.setCurrentNode(node); + } + } +}; \ No newline at end of file diff --git a/components/treeCollapse/tool/util.js b/components/treeCollapse/tool/util.js new file mode 100644 index 0000000..1118c5c --- /dev/null +++ b/components/treeCollapse/tool/util.js @@ -0,0 +1,115 @@ +export const NODE_KEY = '$treeNodeId'; + +export const markNodeData = function(node, data) { + if (!data || data[NODE_KEY]) return; + Object.defineProperty(data, NODE_KEY, { + value: node.id, + enumerable: false, + configurable: false, + writable: false + }); +}; + +export const getNodeKey = function(key, data) { + if (!data) return null; + if (!key) return data[NODE_KEY]; + return data[key]; +}; + +export const objectAssign = function(target) { + for (let i = 1, j = arguments.length; i < j; i++) { + let source = arguments[i] || {}; + for (let prop in source) { + if (source.hasOwnProperty(prop)) { + let value = source[prop]; + if (value !== undefined) { + target[prop] = value; + } + } + } + } + + return target; +}; + +// TODO: use native Array.find, Array.findIndex when IE support is dropped +export const arrayFindIndex = function(arr, pred) { + for (let i = 0; i !== arr.length; ++i) { + if (pred(arr[i])) { + return i; + } + } + return -1; +}; + +export const getChildState = function(node) { + let all = true; + let none = true; + let allWithoutDisable = true; + for (let i = 0, j = node.length; i < j; i++) { + const n = node[i]; + if (n.checked !== true || n.indeterminate) { + all = false; + if (!n.disabled) { + allWithoutDisable = false; + } + } + if (n.checked !== false || n.indeterminate) { + none = false; + } + } + + return { + all, + none, + allWithoutDisable, + half: !all && !none + }; +}; + +export const reInitChecked = function(node) { + if (!node || node.childNodesId.length === 0) return; + + let childNodes = node.getChildNodes(node.childNodesId); + const { + all, + none, + half + } = getChildState(childNodes); + if (all) { + node.checked = true; + node.indeterminate = false; + } else if (half) { + node.checked = false; + node.indeterminate = true; + } else if (none) { + node.checked = false; + node.indeterminate = false; + } + + let parent = node.getParent(node.parentId); + if (!parent || parent.level === 0) return; + + if (!node.store().checkStrictly) { + reInitChecked(parent); + } +}; + +export const getPropertyFromData = function(node, prop) { + const props = node.store().props; + const data = node.data || {}; + const config = props[prop]; + + if (typeof config === 'function') { + return config(data, node); + } else if (typeof config === 'string') { + return data[config]; + } else if (typeof config === 'undefined') { + const dataProp = data[prop]; + return dataProp === undefined ? '' : dataProp; + } +}; + +export const isNull = function(v) { + return v === undefined || v === null || v === ''; +} diff --git a/harmony-configs/AppScope/app.json5 b/harmony-configs/AppScope/app.json5 new file mode 100644 index 0000000..0f574d6 --- /dev/null +++ b/harmony-configs/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.jnpf.java", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:layered_image", + "label": "$string:app_name" + } +} \ No newline at end of file diff --git a/harmony-configs/AppScope/resources/base/element/string.json b/harmony-configs/AppScope/resources/base/element/string.json new file mode 100644 index 0000000..d17b8be --- /dev/null +++ b/harmony-configs/AppScope/resources/base/element/string.json @@ -0,0 +1,27 @@ +{ + "string": [{ + "name": "app_name", + "value": "jnpf java vue3" + }, + { + "name": "Voice", + "value": "用于语音聊天" + }, + { + "name": "Camera", + "value": "用于拍照" + }, + { + "name": "permissionsReason", + "value": "用于发送当前位置" + }, + { + "name": "SaveFile", + "value": "用于保存下载后的文件" + }, + { + "name": "mkdir", + "value": "用于创建目录" + } + ] +} \ No newline at end of file diff --git a/harmony-configs/build-profile.json5 b/harmony-configs/build-profile.json5 new file mode 100644 index 0000000..ba6c048 --- /dev/null +++ b/harmony-configs/build-profile.json5 @@ -0,0 +1,62 @@ +{ + "app": { + "signingConfigs": [{ + "name": "default", + "type": "HarmonyOS", + "material": { + "certpath": "C:\\Users\\JNPF\\.ohos\\config\\default_jnpfjava_1sN_oqqYapOzI9oLrujNgwulFNvqN1QSC3248pw5yuE=.cer", + "storePassword": "0000001BD7F63885F10BC81317E0C644153B8232AEA2DF9F6D79B32F4813B285315C53EBCAEA302CF0B5DC", + "keyAlias": "debugKey", + "keyPassword": "0000001B47FAD77BCDCC3674C089D2FCF52F1E9E770C8435D667F5991AFF3E18C3BED2421605AB85A2577F", + "profile": "C:\\Users\\JNPF\\.ohos\\config\\default_jnpfjava_1sN_oqqYapOzI9oLrujNgwulFNvqN1QSC3248pw5yuE=.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\JNPF\\.ohos\\config\\default_jnpfjava_1sN_oqqYapOzI9oLrujNgwulFNvqN1QSC3248pw5yuE=.p12" + } + }], + "products": [{ + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + "compatibleSdkVersionStage":"beta6", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + }, + { + "name": "release", + "signingConfig": "release", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + "compatibleSdkVersionStage":"beta6", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [{ + "name": "debug", + }, + { + "name": "release" + } + ], + }, + "modules": [{ + "name": "entry", + "srcPath": "./entry", + "targets": [{ + "name": "default", + "applyToProducts": [ + "default", + "release" + ] + }] + }] +} \ No newline at end of file diff --git a/harmony-configs/entry/build-profile.json5 b/harmony-configs/entry/build-profile.json5 new file mode 100644 index 0000000..4d61187 --- /dev/null +++ b/harmony-configs/entry/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/harmony-configs/entry/obfuscation-rules.txt b/harmony-configs/entry/obfuscation-rules.txt new file mode 100644 index 0000000..272efb6 --- /dev/null +++ b/harmony-configs/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/harmony-configs/entry/oh-package.json5 b/harmony-configs/entry/oh-package.json5 new file mode 100644 index 0000000..248c3b7 --- /dev/null +++ b/harmony-configs/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/harmony-configs/entry/src/main/module.json5 b/harmony-configs/entry/src/main/module.json5 new file mode 100644 index 0000000..31eb7e0 --- /dev/null +++ b/harmony-configs/entry/src/main/module.json5 @@ -0,0 +1,92 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "definePermissions": [ + { + "name": "ohos.permission.WRITE_USER_STORAGE", + "description": "允许应用写入用户存储", + "grantMode": "user_grant" + }, + { + "name": "ohos.permission.READ_USER_STORAGE", + "description": "允许应用创建文件目录", + "grantMode": "user_grant" + } + + ], + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET" + }, + { + "name": "ohos.permission.LOCATION", + "reason": "$string:permissionsReason", + "usedScene": { + "abilities": ["EntryAbility"], + "when": "always" + } + }, + { + "name":"ohos.permission.CAMERA", + "reason":"$string:Camera", + "usedScene":{} + }, + { + "name":"ohos.permission.MICROPHONE", + "reason":"$string:Voice", + "usedScene":{ + "abilities":["EntryAbility"] + } + }, + { + "name":"ohos.permission.WRITE_USER_STORAGE", + "reason":"$string:SaveFile", + "usedScene":{ + "abilities":["com.example.MainAbility"], + "when": "inuse" + } + }, + { + "name":"ohos.permission.READ_USER_STORAGE", + "reason":"$string:mkdir", + "usedScene":{ + "abilities":["com.example.MainAbility"], + "when": "inuse" + } + } + ] + } +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..1e96158 --- /dev/null +++ b/index.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/libs/chat.js b/libs/chat.js new file mode 100644 index 0000000..820c6db --- /dev/null +++ b/libs/chat.js @@ -0,0 +1,204 @@ +import define from '@/utils/define' +import jnpf from '@/utils/jnpf' +import { + useChatStoreWithOut +} from '@/store/modules/chat' +import { + useUserStore +} from '@/store/modules/user' + +const chatStore = useChatStoreWithOut() +const userStore = useUserStore() +let socketTask = false +const Socket = { + conTime: 0, + initSocket() { + try { + const token = uni.getStorageSync('token') || '' + const sys = uni.getStorageSync('systemInfo') || '' + const userInfo = uni.getStorageSync('userInfo') || {} + socketTask = uni.connectSocket({ + url: define.webSocketUrl + '/' + encodeURIComponent(token), + // #ifdef APP + header: { + 'User-Agent': sys + }, + // #endif + success() { + setTimeout(() => chatStore.setSocket(socketTask), 0) + }, + }); + socketTask.onMessage((res) => { + let dataStr = res.data; + const data = JSON.parse(dataStr) + let options = { + cover: false, + sound: 'system', + title: data.title + }; + switch (data.method) { + case "initMessage": //初始化 + const msgInfo = { + messageText: data.messageDefaultText || '暂无数据', + messageCount: data.unreadMessageCount + data.unreadSystemMessageCount < 0 ? + 0 : data.unreadMessageCount + data.unreadSystemMessageCount + data + .unreadScheduleCount, + messageDate: data.messageDefaultTime || 0, + } + let badgeNum = data.unreadTotalCount + for (let i = 0; i < data.unreadNums.length; i++) { + badgeNum = badgeNum + data.unreadNums[i].unreadNum + } + chatStore.setBadgeNum(badgeNum) + chatStore.setMsgInfo(msgInfo) + break; + case "Online": //在线用户 + + break; + case "Offline": //离线用户 + + break; + case "sendMessage": //发送消息 + chatStore.sendMessage(data) + break; + case "receiveMessage": //接收消息 + // #ifdef APP + plus.push.createMessage('你有一条聊天消息', { + ...data, + messageType: 100 + }, options); + // #endif + chatStore.receiveMessage(data) + break; + case "messageList": //消息列表 + chatStore.getMessageList(data) + break; + case "messagePush": //消息推送 + // #ifdef APP + let content = "公告" + if (data.messageType == 2) content = '流程' + if (data.messageType == 3) content = '系统' + if (data.messageType == 4) content = '日程' + uni.createPushMessage(res => {}) + uniCloud.callFunction({ + name: 'jnpfPush', // 云函数名称 + data: { + "push_clientid": uni.getStorageSync('push_clientid'), + "title": data.title, + "content": `你有一条${content}消息`, + "payload": { + "data": { + ...data + }, + "options": { + ...options + } + } + }, + success: res => {}, + fail: err => {} + }); + // #endif + chatStore.messagePush(data) + break; + case "closeSocket": //断开websocket连接 + Socket.close() + break; + case "logout": + uni.showToast({ + title: data.msg || '登录已过期', + icon: 'none', + complete: () => { + setTimeout(() => { + userStore.resetToken() + setTimeout(() => { + Socket.close() + uni.reLaunch({ + url: '/pages/login/index' + }) + }, 500) + }, 1000) + } + }) + break; + case "refresh": + uni.showToast({ + title: '您的权限发生变更,正在刷新界面!', + icon: 'none', + complete: () => { + setTimeout(() => { + setTimeout(() => { + uni.reLaunch({ + url: '/pages/index/index' + }) + }, 500) + }, 1000) + } + }) + break; + default: + break; + } + }) + + socketTask.onOpen((data) => { + Socket.conTime = 0 + const msg = JSON.stringify({ + method: "OnConnection", + token, + mobileDevice: true, + systemId: userInfo.appSystemId + }); + Socket.sendMsg(msg) + }) + + socketTask.onClose((data) => { + socketTask = false + chatStore.setSocket(null) + }) + + socketTask.onError((data) => { + chatStore.setSocket(null) + setTimeout(() => { + Socket.conTime += 1 + if (Socket.conTime <= 10) { + if (Socket.conTime >= 3) { + uni.showToast({ + title: 'IM通讯正在连接:' + '连接第' + Socket.conTime + '次!稍后...', + icon: 'none' + }) + } + Socket.reConnect(); + } else { + uni.showToast({ + title: 'IM通讯连接失败,联系服务器管理员', + icon: 'none' + }) + } + }, 10000) + }) + } catch (e) {} + }, + sendMsg(data) { + if (socketTask === false) return Socket.reConnect() + let content = data; + socketTask.send({ + data: content, + complete(e) {} + }) + }, + //重连 + reConnect() { + Socket.initSocket() + }, + close() { + socketTask.close({ + complete(e) { + socketTask = false + chatStore.setSocket(null) + } + }) + } +}; + +export default Socket \ No newline at end of file diff --git a/libs/color-typeConversion.js b/libs/color-typeConversion.js new file mode 100644 index 0000000..51de0df --- /dev/null +++ b/libs/color-typeConversion.js @@ -0,0 +1,396 @@ +const conversion = { + colorList: [{ + r: 244, + g: 67, + b: 54, + a: 1 + }, { + r: 233, + g: 30, + b: 99, + a: 1 + }, { + r: 156, + g: 39, + b: 176, + a: 1 + }, { + r: 103, + g: 58, + b: 183, + a: 1 + }, { + r: 63, + g: 81, + b: 181, + a: 1 + }, { + r: 33, + g: 150, + b: 243, + a: 1 + }, { + r: 3, + g: 169, + b: 244, + a: 1 + }, { + r: 0, + g: 188, + b: 212, + a: 1 + }, { + r: 0, + g: 150, + b: 136, + a: 1 + }, { + r: 76, + g: 175, + b: 80, + a: 1 + }, { + r: 139, + g: 195, + b: 74, + a: 1 + }, { + r: 205, + g: 220, + b: 57, + a: 1 + }, { + r: 255, + g: 235, + b: 59, + a: 1 + }, { + r: 255, + g: 193, + b: 7, + a: 1 + }, { + r: 255, + g: 152, + b: 0, + a: 1 + }, { + r: 255, + g: 87, + b: 34, + a: 1 + }, { + r: 121, + g: 85, + b: 72, + a: 1 + }, { + r: 158, + g: 158, + b: 158, + a: 1 + }, { + r: 0, + g: 0, + b: 0, + a: 0.5 + }, { + r: 0, + g: 0, + b: 0, + a: 0 + }, ], + hsv2rgb(h, s, v) { + h = this.bound01(h, 360) * 6; + s = this.bound01(s, 100); + v = this.bound01(v, 100); + const i = Math.floor(h); + const f = h - i; + const p = v * (1 - s); + const q = v * (1 - f * s); + const t = v * (1 - (1 - f) * s); + const mod = i % 6; + const r = [v, q, p, p, t, v][mod]; + const g = [t, v, v, q, p, p][mod]; + const b = [p, p, t, v, v, q][mod]; + return { + r: Math.round(r * 255), + g: Math.round(g * 255), + b: Math.round(b * 255), + a: 1 + }; + }, + bound01(value, max) { + if (this.isOnePointZero(value)) value = '100%'; + const processPercent = this.isPercentage(value); + value = Math.min(max, Math.max(0, parseFloat(value))); + if (processPercent) { + value = parseInt(value * max, 10) / 100; + } + if ((Math.abs(value - max) < 0.000001)) { + return 1; + } + return (value % max) / parseFloat(max); + }, + isPercentage(n) { + return typeof n === 'string' && n.indexOf('%') !== -1; + }, + isOnePointZero(n) { + return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1; + }, + rgb2hsl(r, g, b) { + r = r / 255; + g = g / 255; + b = b / 255; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var l = (min + max) / 2; + var difference = max - min; + var h, s, l; + if (max == min) { + h = 0; + s = 0; + } else { + s = l > 0.5 ? difference / (2.0 - max - min) : difference / (max + min); + switch (max) { + case r: + h = (g - b) / difference + (g < b ? 6 : 0); + break; + case g: + h = 2.0 + (b - r) / difference; + break; + case b: + h = 4.0 + (r - g) / difference; + break; + } + h = Math.round(h * 60); + } + s = Math.round(s * 100); //转换成百分比的形式 + l = Math.round(l * 100); + + return { + h: h, + s: s + '%', + l: l + '%' + }; + }, + rgb2hsv(r, g, b) { + r = this.bound01(r, 255); + g = this.bound01(g, 255); + b = this.bound01(b, 255); + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + let h, s; + let v = max; + const d = max - min; + s = max === 0 ? 0 : d / max; + if (max === min) { + h = 0; // achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: parseInt(h * 360), + s: parseInt(s * 100), + v: parseInt(v * 100) + }; + }, + /** + * rgb 转 二进制 hex + * @param {Object} rgb + */ + rgbToHex(rgb) { + let hex = [rgb.r.toString(16), rgb.g.toString(16), rgb.b.toString(16)]; + hex.map(function(str, i) { + if (str.length == 1) { + hex[i] = '0' + str; + } + }); + return hex.join(''); + }, + hex2rgba(color) { + var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; + var sColor = color.toLowerCase(); + let rgbaObj = {} + let rgba = 'rgba' + let k = ['r', 'g', 'b'] + if (sColor && reg.test(sColor)) { + if (sColor.length === 4) { + var sColorNew = "#"; + for (var i = 1; i < 4; i += 1) { + sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1)); + } + sColor = sColorNew; + } + //处理六位的颜色值 + var sColorChange = []; + for (var i = 1; i < 7; i += 2) { + sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2))); + } + sColorChange.push(1) + sColorChange.forEach((o, i) => { + if (k[i]) { + rgbaObj[k[i]] = o + } + }) + return rgbaObj + } else { + return sColor; + } + }, + hsv2rgb(h, s, v) { + h = this.bound01(h, 360) * 6; + s = this.bound01(s, 100); + v = this.bound01(v, 100); + + const i = Math.floor(h); + const f = h - i; + const p = v * (1 - s); + const q = v * (1 - f * s); + const t = v * (1 - (1 - f) * s); + const mod = i % 6; + const r = [v, q, p, p, t, v][mod]; + const g = [t, v, v, q, p, p][mod]; + const b = [p, p, t, v, v, q][mod]; + + return { + r: Math.round(r * 255), + g: Math.round(g * 255), + b: Math.round(b * 255), + a: 1 + }; + }, + hsl2rgb(h, s, l) { + h = h / 360; + s = s / 100; + l = l / 100; + let rgb = []; + let rgbList = ['r', 'g', 'b']; + let rgbObj = { + r: 0, + g: 0, + b: 0, + a: 1 + } + if (s == 0) { + rgb = [Math.round(l * 255), Math.round(l * 255), Math.round(l * 255)]; + } else { + var q = l >= 0.5 ? (l + s - l * s) : (l * (1 + s)); + var p = 2 * l - q; + var tr = rgb[0] = h + 1 / 3; + var tg = rgb[1] = h; + var tb = rgb[2] = h - 1 / 3; + for (var i = 0; i < rgb.length; i++) { + var tc = rgb[i]; + if (tc < 0) { + tc = tc + 1; + } else if (tc > 1) { + tc = tc - 1; + } + switch (true) { + case (tc < (1 / 6)): + tc = p + (q - p) * 6 * tc; + break; + case ((1 / 6) <= tc && tc < 0.5): + tc = q; + break; + case (0.5 <= tc && tc < (2 / 3)): + tc = p + (q - p) * (4 - 6 * tc); + break; + default: + tc = p; + break; + } + rgb[i] = Math.round(tc * 255); + rgbObj[rgbList[i]] = rgb[i] + } + } + return rgbObj; + }, + rgbToHsb(rgb) { + let hsb = { + h: 0, + s: 0, + b: 0 + }; + let min = Math.min(rgb.r, rgb.g, rgb.b); + let max = Math.max(rgb.r, rgb.g, rgb.b); + let delta = max - min; + hsb.b = max; + hsb.s = max != 0 ? 255 * delta / max : 0; + if (hsb.s != 0) { + if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta; + else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta; + else hsb.h = 4 + (rgb.r - rgb.g) / delta; + } else hsb.h = -1; + hsb.h *= 60; + if (hsb.h < 0) hsb.h = 0; + hsb.s *= 100 / 255; + hsb.b *= 100 / 255; + return hsb; + }, + /** + * hsb 转 rgb + * @param {Object} 颜色模式 H(hues)表示色相,S(saturation)表示饱和度,B(brightness)表示亮度 + */ + HSBToRGB(hsb) { + let rgb = {}; + let h = Math.round(hsb.h); + let s = Math.round((hsb.s * 255) / 100); + let v = Math.round((hsb.b * 255) / 100); + if (s == 0) { + rgb.r = rgb.g = rgb.b = v; + } else { + let t1 = v; + let t2 = ((255 - s) * v) / 255; + let t3 = ((t1 - t2) * (h % 60)) / 60; + if (h == 360) h = 0; + if (h < 60) { + rgb.r = t1; + rgb.b = t2; + rgb.g = t2 + t3; + } else if (h < 120) { + rgb.g = t1; + rgb.b = t2; + rgb.r = t1 - t3; + } else if (h < 180) { + rgb.g = t1; + rgb.r = t2; + rgb.b = t2 + t3; + } else if (h < 240) { + rgb.b = t1; + rgb.r = t2; + rgb.g = t1 - t3; + } else if (h < 300) { + rgb.b = t1; + rgb.g = t2; + rgb.r = t2 + t3; + } else if (h < 360) { + rgb.r = t1; + rgb.g = t2; + rgb.b = t1 - t3; + } else { + rgb.r = 0; + rgb.g = 0; + rgb.b = 0; + } + } + return { + r: Math.round(rgb.r), + g: Math.round(rgb.g), + b: Math.round(rgb.b) + }; + }, +} +export default conversion diff --git a/libs/file.js b/libs/file.js new file mode 100644 index 0000000..79120ef --- /dev/null +++ b/libs/file.js @@ -0,0 +1,201 @@ +function getLocalFilePath(path) { + if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf( + '_downloads') === 0) { + return path + } + if (path.indexOf('file://') === 0) { + return path + } + if (path.indexOf('/storage/emulated/0/') === 0) { + return path + } + if (path.indexOf('/') === 0) { + var localFilePath = plus.io.convertAbsoluteFileSystem(path) + if (localFilePath !== path) { + return localFilePath + } else { + path = path.substr(1) + } + } + return '_www/' + path +} + +function dataUrlToBase64(str) { + var array = str.split(',') + return array[array.length - 1] +} + +var index = 0 + +function getNewFileId() { + return Date.now() + String(index++) +} + +function biggerThan(v1, v2) { + var v1Array = v1.split('.') + var v2Array = v2.split('.') + var update = false + for (var index = 0; index < v2Array.length; index++) { + var diff = v1Array[index] - v2Array[index] + if (diff !== 0) { + update = diff > 0 + break + } + } + return update +} + +export function pathToBase64(path) { + return new Promise(function(resolve, reject) { + if (typeof window === 'object' && 'document' in window) { + if (typeof FileReader === 'function') { + var xhr = new XMLHttpRequest() + xhr.open('GET', path, true) + xhr.responseType = 'blob' + xhr.onload = function() { + if (this.status === 200) { + let fileReader = new FileReader() + fileReader.onload = function(e) { + resolve(e.target.result) + } + fileReader.onerror = reject + fileReader.readAsDataURL(this.response) + } + } + xhr.onerror = reject + xhr.send() + return + } + var canvas = document.createElement('canvas') + var c2x = canvas.getContext('2d') + var img = new Image + img.onload = function() { + canvas.width = img.width + canvas.height = img.height + c2x.drawImage(img, 0, 0) + resolve(canvas.toDataURL()) + canvas.height = canvas.width = 0 + } + img.onerror = reject + img.src = path + return + } + if (typeof plus === 'object') { + plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) { + entry.file(function(file) { + var fileReader = new plus.io.FileReader() + fileReader.onload = function(data) { + resolve(data.target.result) + } + fileReader.onerror = function(error) { + reject(error) + } + fileReader.readAsDataURL(file) + }, function(error) { + reject(error) + }) + }, function(error) { + reject(error) + }) + return + } + if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) { + wx.getFileSystemManager().readFile({ + filePath: path, + encoding: 'base64', + success: function(res) { + resolve('data:image/png;base64,' + res.data) + }, + fail: function(error) { + reject(error) + } + }) + return + } + reject(new Error('not support')) + }) +} + +export function base64ToPath(base64) { + return new Promise(function(resolve, reject) { + if (typeof window === 'object' && 'document' in window) { + base64 = base64.split(',') + var type = base64[0].match(/:(.*?);/)[1] + var str = atob(base64[1]) + var n = str.length + var array = new Uint8Array(n) + while (n--) { + array[n] = str.charCodeAt(n) + } + return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], { + type: type + }))) + } + var extName = base64.split(',')[0].match(/data\:\S+\/(\S+);/) + if (extName) { + extName = extName[1] + } else { + reject(new Error('base64 error')) + } + var fileName = getNewFileId() + '.' + extName + if (typeof plus === 'object') { + var basePath = '_doc' + var dirPath = 'uniapp_temp' + var filePath = basePath + '/' + dirPath + '/' + fileName + if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime + .innerVersion)) { + plus.io.resolveLocalFileSystemURL(basePath, function(entry) { + entry.getDirectory(dirPath, { + create: true, + exclusive: false, + }, function(entry) { + entry.getFile(fileName, { + create: true, + exclusive: false, + }, function(entry) { + entry.createWriter(function(writer) { + writer.onwrite = function() { + resolve(filePath) + } + writer.onerror = reject + writer.seek(0) + writer.writeAsBinary(dataUrlToBase64(base64)) + }, reject) + }, reject) + }, reject) + }, reject) + return + } + var bitmap = new plus.nativeObj.Bitmap(fileName) + bitmap.loadBase64Data(base64, function() { + bitmap.save(filePath, {}, function() { + bitmap.clear() + resolve(filePath) + }, function(error) { + bitmap.clear() + reject(error) + }) + }, function(error) { + bitmap.clear() + reject(error) + }) + return + } + if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) { + var filePath = wx.env.USER_DATA_PATH + '/' + fileName + wx.getFileSystemManager().writeFile({ + filePath: filePath, + data: dataUrlToBase64(base64), + encoding: 'base64', + success: function() { + resolve(filePath) + }, + fail: function(error) { + reject(error) + } + }) + return + } + reject(new Error('not support')) + }) +} \ No newline at end of file diff --git a/libs/permission.js b/libs/permission.js new file mode 100644 index 0000000..8790238 --- /dev/null +++ b/libs/permission.js @@ -0,0 +1,148 @@ +import { + i18n +} from '../locale/setupI18n'; + +let permission = { + permissionList: uni.getStorageSync('permissionList') || [], + hasP(enCode, menuIds) { + if (!menuIds) return false + const list = permission.permissionList.filter(o => o.modelId === menuIds) + if (!list.length) return false + const columnList = list[0] && list[0].column ? list[0].column : [] + if (!columnList.length) return false + const hasPermission = columnList.some(column => column.enCode === enCode) + if (hasPermission) return true + return false + }, + hasFormP(enCode, menuIds) { + if (!menuIds) return false + const list = permission.permissionList.filter(o => o.modelId === menuIds) + if (!list.length) return false + const formList = list[0] && list[0].form ? list[0].form : [] + if (!formList.length) return false + const hasPermission = formList.some(form => form.enCode === enCode) + if (hasPermission) return true + return false + }, + hasBtnP(enCode, menuIds) { + if (!menuIds) return false + const list = permission.permissionList.filter(o => o.modelId === menuIds) + if (!list.length) return false + const btnList = list[0] && list[0].button ? list[0].button : [] + if (!btnList.length) return false + const hasPermission = btnList.some(btn => btn.enCode === enCode) + if (hasPermission) return true + return false + }, + getPermission(columnData, menuId, getScriptFunc) { + let btnsList = columnData.btnsList + let customBtnsList = columnData.customBtnsList + let columnBtnsList = columnData.columnBtnsList.filter(o => o.show) + const useBtnPermission = columnData.useBtnPermission + const useColumnPermission = columnData.useColumnPermission + const useFormPermission = columnData.useFormPermission + const useBtnPermissionList = [...btnsList, ...columnBtnsList] + let btnPermission = []; + let customBtnsPermission = []; + let columnPermission = []; + let formList = []; + let currentMenu = {} + let btn_list = ['detail', 'edit', 'add', 'remove', 'batchRemove'] + let labelS = {} + let enableFunc = {} + useBtnPermissionList.map((o) => { + if (btn_list.includes(o.value) && o.show) { + labelS['btn_' + o.value] = o.labelI18nCode ? i18n.global.t(o.labelI18nCode, o.label) : o + .label + } + }) + let isMenu = permission.permissionList.filter((o) => { + if (o.modelId === menuId) return currentMenu = o + }) + //按钮 + if (useBtnPermission) { + if (customBtnsList && customBtnsList.length) { + for (let i = 0; i < customBtnsList.length; i++) { + inner: for (let j = 0; j < currentMenu.button.length; j++) { + if (customBtnsList[i].value === currentMenu.button[j].enCode) { + customBtnsPermission.push(customBtnsList[i]) + break inner + } + } + } + } + if (!!isMenu.length) { + for (let i = 0; i < useBtnPermissionList.length; i++) { + inner: for (let j = 0; j < currentMenu.button.length; j++) { + if ('btn_' + useBtnPermissionList[i].value === currentMenu.button[j].enCode) { + btnPermission.push(currentMenu.button[j].enCode) + break inner + } + } + } + } + } else { + for (let i = 0; i < useBtnPermissionList.length; i++) { + inner: for (let j = 0; j < btn_list.length; j++) { + if (useBtnPermissionList[i].show && useBtnPermissionList[i].value === btn_list[j]) { + btnPermission.push('btn_' + useBtnPermissionList[i].value) + break inner + } + } + } + customBtnsPermission = customBtnsList + } + // 启用规则 + columnBtnsList.map((o) => { + enableFunc[o.value] = () => { + return true + } + if (o.event && o.event.enableFunc) { + const func = getScriptFunc(o.event.enableFunc) + enableFunc[o.value] = func + } + }) + // 启用规则自定义 + customBtnsList.map((o) => { + enableFunc[o.value] = () => { + return true + } + if (o.event && o.event.enableFunc) { + const func = getScriptFunc(o.event.enableFunc) + enableFunc[o.value] = func + } + }) + if (useColumnPermission) { + if (!!isMenu.length) { + columnData.columnList.forEach((o, i) => { + currentMenu.column.forEach((m, j) => { + if (o.prop === m.enCode) { + columnPermission.push(o) + } + }) + }) + } + } else { + columnPermission = columnData.columnList + } + + if (useFormPermission && !!isMenu.length) formList = currentMenu.form + return { + labelS, + btnPermission, + customBtnsPermission, + columnPermission, + formPermission: { + formList, + useFormPermission, + menuId + }, + enableFunc, + useBtnPermission + } + }, + updatePermissionList() { + permission.permissionList = uni.getStorageSync('permissionList') || [] + } +} +export default permission \ No newline at end of file diff --git a/libs/resources.js b/libs/resources.js new file mode 100644 index 0000000..42fa146 --- /dev/null +++ b/libs/resources.js @@ -0,0 +1,137 @@ +const resources = { + startup: { + main: "https://app.cdn.jnpfsoft.com/image/3.2/startup@2x.png", + }, + login: { + banner: "https://app.cdn.jnpfsoft.com/image/3.0/login/top.png", + logo: "https://app.cdn.jnpfsoft.com/image/banner/logo.png", + }, + banner: { + home1Url: "https://app.cdn.jnpfsoft.com/image/3.2/banner1.png", + home2Url: "https://app.cdn.jnpfsoft.com/image/3.2/banner2.png", + home3Url: "https://app.cdn.jnpfsoft.com/image/3.2/banner4.png", + contactus: "https://app.cdn.jnpfsoft.com/image/banner/contactus.png", + loginlogo: "https://app.cdn.jnpfsoft.com/image/banner/logo.png", + accountSecurity: "https://app.cdn.jnpfsoft.com/image/banner/accountSecurity.png" + }, + message: { + nocontent: "https://app.cdn.jnpfsoft.com/image/message/nocontent.png", + nodata: "https://app.cdn.jnpfsoft.com/image/message/nodata.png", + }, + //引导页 + guide: { + guide1: "https://app.cdn.jnpfsoft.com/image/v5.0/guide1.png", + guide2: "https://app.cdn.jnpfsoft.com/image/v5.0/guide2.png", + guide3: "https://app.cdn.jnpfsoft.com/image/v5.0/guide3.png", + }, + extend: { + againlocation: "https://app.cdn.jnpfsoft.com/image/extend/againlocation.png", + file: "https://app.cdn.jnpfsoft.com/image/extend/file.png", + location: "https://app.cdn.jnpfsoft.com/image/extend/location.png", + location3: "https://app.cdn.jnpfsoft.com/image/extend/location%403x.png", + pause: "https://app.cdn.jnpfsoft.com/image/extend/pause.png", + play: "https://app.cdn.jnpfsoft.com/image/extend/play.png", + pluse: "https://app.cdn.jnpfsoft.com/image/extend/plus.png", + record: "https://app.cdn.jnpfsoft.com/image/extend/record.png", + stop: "https://app.cdn.jnpfsoft.com/image/extend/stop.png", + trash: "https://app.cdn.jnpfsoft.com/image/extend/trash.png" + }, + common: { + currentIcon: "https://app.cdn.jnpfsoft.com/image/common/currentIcon.png", + defaultIcon: "https://app.cdn.jnpfsoft.com/image/common/defaultIcon.png", + agreement: "https://app.cdn.jnpfsoft.com/image/common/agreement.png", + wechat_qrcode: "https://app.cdn.jnpfsoft.com/image/common/wechat_qrcode.jpg", + new_edition: "https://app.cdn.jnpfsoft.com/image/common/new_edition.png" + }, + jnapp: "https://app.cdn.jnpfsoft.com/jnapp/20200415.apk", + userAgreement: "https://m.yinmaisoft.com/userAgreement.html", //用户协议 + privacyPolicy: "https://m.yinmaisoft.com/privacyPolicy.html", //隐私政策 + appStore: "https://apps.apple.com/cn/app/jnapp/id1490797314", + status: { + //前加签 + frontSign: "https://app.cdn.jnpfsoft.com/image/flow/frontSign.png", + //加签 + addSign: "https://app.cdn.jnpfsoft.com/image/flow/addSign.png", + //指派 + assign: "https://app.cdn.jnpfsoft.com/image/flow/assign.png", + //拒绝 + refuse: "https://app.cdn.jnpfsoft.com/image/flow/refuse.png", + //等待提交 + submit: "https://app.cdn.jnpfsoft.com/image/flow/submit.png", + //等待审核 + review: "https://app.cdn.jnpfsoft.com/image/flow/review.png", + //已通过 + adopt: "https://app.cdn.jnpfsoft.com/image/flow/adopt.png", + //审核通过 + reviewAdopt: "https://app.cdn.jnpfsoft.com/image/flow/reviewAdopt.png", + //审核退回 + reviewRefuse: "https://app.cdn.jnpfsoft.com/image/flow/reviewRefuse.png", + //流程撤回 + reviewUndo: "https://app.cdn.jnpfsoft.com/image/flow/reviewUndo.png", + //审核终止 + reviewStop: "https://app.cdn.jnpfsoft.com/image/flow/reviewStop.png", + //委托中 + entrusting: "https://app.cdn.jnpfsoft.com/image/flow/entrusting.png", + //已失效 + expired: "https://app.cdn.jnpfsoft.com/image/flow/expired.png", + //未生效 + notEffective: "https://app.cdn.jnpfsoft.com/image/flow/notEffective.png", + //生效中 + effectuate: "https://app.cdn.jnpfsoft.com/image/flow/effectuate.png", + //未开始 + notStarted: "https://app.cdn.jnpfsoft.com/image/flow/notStarted.png", + //已被挂起 + suspend: "https://app.cdn.jnpfsoft.com/image/flow/suspend.png", + //转向 + trun: "https://app.cdn.jnpfsoft.com/image/flow/trun.png", + //已退回 + back: "https://app.cdn.jnpfsoft.com/image/flow/back.png", + //已终止 + cancel: "https://app.cdn.jnpfsoft.com/image/flow/cancel.png", + //进行中 + doing: "https://app.cdn.jnpfsoft.com/image/flow/doing.png", + //待提交 + draft: "https://app.cdn.jnpfsoft.com/image/flow/draft.png", + //已暂停 + pause: "https://app.cdn.jnpfsoft.com/image/flow/pause.png", + //已撤回 + recall: "https://app.cdn.jnpfsoft.com/image/flow/recall.png", + //已拒绝 + reject: "https://app.cdn.jnpfsoft.com/image/flow/reject.png", + //已撤销 + revoke: "https://app.cdn.jnpfsoft.com/image/flow/revoke.png", + //撤销中 + revoking: "https://app.cdn.jnpfsoft.com/image/flow/revoking.png", + //待签收 + signfor: "https://app.cdn.jnpfsoft.com/image/flow/signfor.png", + //流转中 + circulation: "https://app.cdn.jnpfsoft.com/image/flow/circulation.png", + //退回 + return: "https://app.cdn.jnpfsoft.com/image/flow/return.png", + //加签 + addSign: "https://app.cdn.jnpfsoft.com/image/flow/addSign.png", + //同意 + agree: "https://app.cdn.jnpfsoft.com/image/flow/agree.png", + //转审 + transfer: "https://app.cdn.jnpfsoft.com/image/flow/transfer.png", + //转办 + transfer2: "https://app.cdn.jnpfsoft.com/image/flow/transfer2.png", + //协办 + assist: "https://app.cdn.jnpfsoft.com/image/flow/assist.png" + }, + document: { + wordImg: 'https://app.cdn.jnpfsoft.com/image/document/word.png', + excelImg: 'https://app.cdn.jnpfsoft.com/image/document/excel.png', + pptImg: 'https://app.cdn.jnpfsoft.com/image/document/ppt.png', + pdfImg: 'https://app.cdn.jnpfsoft.com/image/document/pdf.png', + rarImg: 'https://app.cdn.jnpfsoft.com/image/document/rar.png', + txtImg: 'https://app.cdn.jnpfsoft.com/image/document/txt.png', + codeImg: 'https://app.cdn.jnpfsoft.com/image/document/code.png', + imageImg: 'https://app.cdn.jnpfsoft.com/image/document/image.png', + audioImg: 'https://app.cdn.jnpfsoft.com/image/document/audio.png', + blankImg: 'https://app.cdn.jnpfsoft.com/image/document/blank.png', + folderImg: 'https://app.cdn.jnpfsoft.com/image/document/folder.png', + } +} + +export default resources \ No newline at end of file diff --git a/locale/en.json b/locale/en.json new file mode 100644 index 0000000..e3ead41 --- /dev/null +++ b/locale/en.json @@ -0,0 +1,697 @@ +{ + "common.okText": "OK", + "common.continueText": "OK & Continue", + "common.continueAndAddText": "OK & Add", + "common.closeText": "Close", + "common.cancelText": "Cancel", + "common.loadingText": "Loading...", + "common.saveText": "Save", + "common.delText": "Delete", + "common.resetText": "Reset", + "common.searchText": "Search", + "common.queryText": "Search", + "common.addText": "Add", + "common.add1Text": "Add", + "common.add2Text": "Add", + "common.editText": "Edit", + "common.detailText": "Detail", + "common.moreText": "More", + "common.exportText": "Export", + "common.importText": "Import", + "common.copyText": "Copy", + "common.printText": "Print", + "common.batchPrintText": "Batch Print", + "common.batchDelText": "Batch Delete", + "common.previewText": "Preview", + "common.submitText": "Submit", + "common.syncText": "Sync", + "common.cleanText": "Clean Up", + "common.closeList": "Close List", + "common.inputText": "Please enter", + "common.chooseText": "Please select", + "common.inputTextPrefix": "Please enter ", + "common.chooseTextPrefix": "Please select ", + "common.redo": "Refresh", + "common.back": "Back", + "common.expandAll": "Expand All", + "common.collapseAll": "Collapse All", + "common.superQuery": "Super Query", + "common.light": "Light", + "common.dark": "Dark", + "common.tipTitle": "Tips", + "common.delTip": "This operation will permanently delete the data. Do you want to continue?", + "common.batchDelTip": "Are you sure you want to delete these data? Do you want to continue?", + "common.selectDataTip": "Please select a piece of data", + "common.prev": "Prev", + "common.next": "Next", + "common.prevRecord": "Prev", + "common.nextRecord": "Next", + "common.keyword": "Keyword", + "common.enterKeyword": "Please Enter", + "common.leftTreeSearchText": "Enter Keyword", + "common.drawerSearchText": "Please Enter Keyword", + "common.inputPlaceholder": "Please enter", + "common.selectPlaceholder": "Please select", + "common.selectI18nCode": "Select translation markers", + "common.undoText": "undo", + "common.redoText": "redo", + "common.noData": "No Data", + "component.app.searchNotData": "No search results yet", + "component.app.toSearch": "to search", + "component.app.toNavigate": "to navigate", + "component.countdown.normalText": "Get SMS code", + "component.countdown.sendText": "Reacquire in {0}s", + "component.cropper.selectImage": "Select Image", + "component.cropper.uploadSuccess": "Uploaded success!", + "component.cropper.modalTitle": "Avatar upload", + "component.cropper.okText": "Confirm and upload", + "component.cropper.btn_reset": "Reset", + "component.cropper.btn_rotate_left": "Counterclockwise rotation", + "component.cropper.btn_rotate_right": "Clockwise rotation", + "component.cropper.btn_scale_x": "Flip horizontal", + "component.cropper.btn_scale_y": "Flip vertical", + "component.cropper.btn_zoom_in": "Zoom in", + "component.cropper.btn_zoom_out": "Zoom out", + "component.cropper.preview": "Preivew", + "component.drawer.loadingText": "Loading...", + "component.drawer.cancelText": "Close", + "component.drawer.okText": "Confirm", + "component.excel.exportModalTitle": "Export data", + "component.excel.fileType": "File type", + "component.excel.fileName": "File name", + "component.form.fold": "Fold", + "component.form.unfold": "Unfold", + "component.form.maxTip": "The number of characters should be less than {0}", + "component.form.apiSelectNotFound": "Wait for data loading to complete...", + "component.icon.placeholder": "Click the select icon", + "component.icon.search": "Search icon", + "component.icon.copy": "Copy icon successfully!", + "component.menu.search": "Menu search", + "component.modal.cancelText": "Close", + "component.modal.okText": "Confirm", + "component.modal.close": "Close", + "component.modal.maximize": "Maximize", + "component.modal.restore": "Restore", + "component.table.settingDens": "Density", + "component.table.settingDensDefault": "Default", + "component.table.settingDensMiddle": "Middle", + "component.table.settingDensSmall": "Compact", + "component.table.settingColumn": "Column settings", + "component.table.settingColumnShow": "Column display", + "component.table.settingIndexColumnShow": "Index Column", + "component.table.settingSelectColumnShow": "Selection Column", + "component.table.settingFixedLeft": "Fixed Left", + "component.table.settingFixedRight": "Fixed Right", + "component.table.settingFullScreen": "Full Screen", + "component.table.index": "No.", + "component.table.status": "Status", + "component.table.action": "Action", + "component.table.summary": "Total", + "component.table.total": "total of {total}", + "component.time.before": " ago", + "component.time.after": " after", + "component.time.just": "just now", + "component.time.seconds": " seconds", + "component.time.minutes": " minutes", + "component.time.hours": " hours", + "component.time.days": " days", + "component.tree.reload": "Reload", + "component.tree.selectAll": "Select All", + "component.tree.unSelectAll": "Cancel Select", + "component.tree.expandAll": "Expand All", + "component.tree.unExpandAll": "Collapse all", + "component.tree.checkStrictly": "Hierarchical association", + "component.tree.checkUnStrictly": "Hierarchical independence", + "component.upload.save": "Save", + "component.upload.upload": "Upload", + "component.upload.buttonText": "Upload", + "component.upload.imgUpload": "ImageUpload", + "component.upload.uploaded": "Uploaded", + "component.upload.operating": "Operating", + "component.upload.del": "Delete", + "component.upload.download": "Download", + "component.upload.downloadAll": "Download all", + "component.upload.saveWarn": "Please wait for the file to upload and save!", + "component.upload.saveError": "There is no file successfully uploaded and cannot be saved!", + "component.upload.preview": "Preview", + "component.upload.choose": "Select the file", + "component.upload.accept": "Support {0} format", + "component.upload.acceptUpload": "Only upload files in {0} format", + "component.upload.maxSize": "A single file does not exceed {0}MB ", + "component.upload.maxSizeMultiple": "Only upload files up to {0}MB!", + "component.upload.maxNumber": "Only upload up to {0} files", + "component.upload.legend": "Legend", + "component.upload.fileName": "File name", + "component.upload.fileSize": "File size", + "component.upload.fileStatue": "File status", + "component.upload.startUpload": "Start upload", + "component.upload.uploadSuccess": "Upload successfully", + "component.upload.uploadError": "Upload failed", + "component.upload.uploading": "Uploading", + "component.upload.paused": "Paused", + "component.upload.waiting": "Waiting", + "component.upload.checking": "Checking", + "component.upload.uploadWait": "Please wait for the file upload to finish", + "component.upload.reUploadFailed": "Re-upload failed files", + "component.upload.uploadImg": "Please upload Image", + "component.upload.viewImage": "View Image", + "component.upload.view": "View", + "component.upload.imageMaxNumber": "Up to {0} images can be uploaded", + "component.upload.imageMaxSize": "Image size exceeds {size}{unit}", + "component.upload.fileMaxNumber": "Up to {0} files can be uploaded", + "component.upload.fileMaxSize": "File size exceeds {size}{unit}", + "component.upload.fileTypeCheck": "Please select a file of {0} type", + "component.upload.fileReadError": "File {0} reading error, please check the file", + "component.upload.videoNoPreview": "Audio and video files cannot be previewed", + "component.upload.zipNoPreview": "Compressed package cannot be previewed", + "component.upload.image": "image", + "component.upload.video": "video", + "component.upload.audio": "audio", + "component.verify.error": "verification failed!", + "component.verify.time": "The verification is successful and it takes {time} seconds!", + "component.verify.redoTip": "Click the picture to refresh", + "component.verify.dragText": "Hold down the slider and drag", + "component.verify.successText": "Verified", + "component.jnpf.common.allData": "All data", + "component.jnpf.common.selected": "Selected", + "component.jnpf.common.clearAll": "Clear all", + "component.jnpf.common.autoGenerate": "Automatically generated by the system", + "component.jnpf.areaSelect.modalTitle": "Select area", + "component.jnpf.calculate.storage": "The data will also be saved and stored in the database", + "component.jnpf.calculate.unStorage": "The data will not be saved", + "component.jnpf.dateRange.startPlaceholder": "Start date", + "component.jnpf.dateRange.endPlaceholder": "End date", + "component.jnpf.timeRange.startPlaceholder": "Start time", + "component.jnpf.timeRange.endPlaceholder": "End time", + "component.jnpf.iconPicker.select": "Select", + "component.jnpf.iconPicker.modalTitle": "Select icon", + "component.jnpf.iconPicker.searchPlaceholder": "Please Enter Keyword", + "component.jnpf.iconPicker.ymIcon": "ymIcon icon", + "component.jnpf.iconPicker.ymCustom": "ymCustom icon", + "component.jnpf.location.modalTitle": "Select position", + "component.jnpf.location.searchPlaceholder": "Enter or click to select on the map", + "component.jnpf.location.relocation": "Relocation", + "component.jnpf.location.location": "Location", + "component.jnpf.numberRange.min": "Min", + "component.jnpf.numberRange.max": "Max", + "component.jnpf.organizeSelect.modalTitle": "Select organize", + "component.jnpf.posSelect.modalTitle": "Select position", + "component.jnpf.roleSelect.modalTitle": "Select role", + "component.jnpf.groupSelect.modalTitle": "Select group", + "component.jnpf.userSelect.modalTitle": "Select user", + "component.jnpf.popupAttr.storage": "The data will also be saved and stored in the database", + "component.jnpf.popupAttr.unStorage": "The data will not be saved", + "component.jnpf.popupSelect.modalTitle": "Select data", + "component.jnpf.relationFormAttr.storage": "The data will also be saved and stored in the database", + "component.jnpf.relationFormAttr.unStorage": "The data will not be saved", + "component.jnpf.sign.signTip": "signature", + "component.jnpf.sign.signPlaceholder": "Please signature", + "component.jnpf.sign.operateTip": "Please use the mouse to handwrite your signature in this area", + "layout.footer.onlinePreview": "Preview", + "layout.footer.onlineDocument": "Document", + "layout.header.dropdownItemDoc": "Document", + "layout.header.dropdownItemLoginOut": "Login Out", + "layout.header.systemChange": "Toggle App", + "layout.header.standingChange": "Toggle Standing", + "layout.header.profile": "Profile", + "layout.header.feedback": "Feedback", + "layout.header.about": "About", + "layout.header.statement": "Statement", + "layout.header.commonMenus": "Common Menus", + "layout.header.tooltipErrorLog": "Error log", + "layout.header.tooltipLock": "Lock screen", + "layout.header.tooltipNotify": "Notification", + "layout.header.tooltipChat": "Chat", + "layout.header.tooltipEntryFull": "Full Screen", + "layout.header.tooltipExitFull": "Exit Full Screen", + "layout.header.setting": "Setting", + "layout.header.lockScreenPassword": "Lock screen password", + "layout.header.lockScreen": "Lock screen", + "layout.header.lockScreenBtn": "Locking", + "layout.header.home": "Home", + "layout.multipleTab.setCommon": "Set Common", + "layout.multipleTab.reload": "Refresh current", + "layout.multipleTab.close": "Close current", + "layout.multipleTab.closeLeft": "Close Left", + "layout.multipleTab.closeRight": "Close Right", + "layout.multipleTab.closeOther": "Close Other", + "layout.multipleTab.closeAll": "Close All", + "layout.setting.contentModeFull": "Full", + "layout.setting.contentModeFixed": "Fixed width", + "layout.setting.topMenuAlignLeft": "Left", + "layout.setting.topMenuAlignRight": "Center", + "layout.setting.topMenuAlignCenter": "Right", + "layout.setting.menuTriggerNone": "Not Show", + "layout.setting.menuTriggerBottom": "Bottom", + "layout.setting.menuTriggerTop": "Top", + "layout.setting.menuTypeSidebar": "Left menu mode", + "layout.setting.menuTypeMixSidebar": "Left mixed mode", + "layout.setting.menuTypeMix": "Top Mix mode", + "layout.setting.menuTypeTopMenu": "Top menu mode", + "layout.setting.defaultBg": "Default", + "layout.setting.blueBg": "Blue", + "layout.setting.purpleBg": "Purple", + "layout.setting.greenBg": "Green", + "layout.setting.on": "On", + "layout.setting.off": "Off", + "layout.setting.minute": "Minute", + "layout.setting.operatingTitle": "Successful!", + "layout.setting.operatingContent": "The copy is successful, please go to src/settings/projectSetting.ts to modify the configuration!", + "layout.setting.resetSuccess": "Successfully reset!", + "layout.setting.copyBtn": "Copy", + "layout.setting.clearBtn": "Clear cache and to the login page", + "layout.setting.drawerTitle": "Configuration", + "layout.setting.darkMode": "Dark mode", + "layout.setting.navMode": "Navigation mode", + "layout.setting.systemBackground": "System background", + "layout.setting.interfaceFunction": "Interface function", + "layout.setting.interfaceDisplay": "Interface display", + "layout.setting.animation": "Animation", + "layout.setting.splitMenu": "Split menu", + "layout.setting.closeMixSidebarOnChange": "Switch page to close menu", + "layout.setting.sysTheme": "System theme", + "layout.setting.headerTheme": "Header theme", + "layout.setting.sidebarTheme": "Menu theme", + "layout.setting.menuDrag": "Drag Sidebar", + "layout.setting.menuSearch": "Menu search", + "layout.setting.toggleLocale": "Locale Toggle", + "layout.setting.menuAccordion": "Sidebar accordion", + "layout.setting.menuCollapse": "Collapse menu", + "layout.setting.collapseMenuDisplayName": "Collapse menu display name", + "layout.setting.topMenuLayout": "Top menu layout", + "layout.setting.menuCollapseButton": "Menu collapse button", + "layout.setting.contentMode": "Content area width", + "layout.setting.expandedMenuWidth": "Expanded menu width", + "layout.setting.breadcrumb": "Breadcrumbs", + "layout.setting.breadcrumbIcon": "Breadcrumbs Icon", + "layout.setting.tabs": "Tabs", + "layout.setting.tabsIcon": "Tabs Icon", + "layout.setting.tabDetail": "Tab Detail", + "layout.setting.tabsQuickBtn": "Tabs quick button", + "layout.setting.tabsRedoBtn": "Tabs redo button", + "layout.setting.tabsFoldBtn": "Tabs flod button", + "layout.setting.sidebar": "Sidebar", + "layout.setting.header": "Header", + "layout.setting.footer": "Footer", + "layout.setting.fullContent": "Full content", + "layout.setting.grayMode": "Gray mode", + "layout.setting.colorWeak": "Color Weak Mode", + "layout.setting.cachePage": "Cache Page", + "layout.setting.progress": "Progress", + "layout.setting.switchLoading": "Switch Loading", + "layout.setting.switchAnimation": "Switch animation", + "layout.setting.animationType": "Animation type", + "layout.setting.autoScreenLock": "Auto screen lock", + "layout.setting.notAutoScreenLock": "Not auto lock", + "layout.setting.fixedHeader": "Fixed header", + "layout.setting.fixedSideBar": "Fixed Sidebar", + "layout.setting.mixSidebarTrigger": "Mixed menu Trigger", + "layout.setting.triggerHover": "Hover", + "layout.setting.triggerClick": "Click", + "layout.setting.mixSidebarFixed": "Fixed expanded menu", + "routes.basic.login": "Login", + "routes.basic.errorLogList": "Error Log", + "routes.basic.home": "Home", + "routes.basic.externalLink": "ExternalLink", + "routes.basic.workFlowDetail": "WorkFlow Detail", + "routes.basic.emailDetail": "Email Detail", + "routes.basic.previewModel": "Model Preview", + "routes.mainSystem": "MainSystem", + "routes.workSystem": "WorkSystem", + "routes.onlineDev": "OnlineDev", + "routes.onlineDev-webDesign": "FormDesign", + "routes.onlineDev-appDesign": "APPDesign", + "routes.onlineDev-dataReport": "DataReport", + "routes.onlineDev-dataScreen": "DataScreen", + "routes.onlineDev-visualPortal": "VisualPortal", + "routes.onlineDev-integration": "Integration", + "routes.onlineDev-printDev": "PrintDesign", + "routes.generator": "Generator", + "routes.generator-webForm": "WebForm", + "routes.generator-appForm": "AppForm", + "routes.generator-flowForm": "FlowForm", + "routes.system": "System", + "routes.system-sysConfig": "SysConfig", + "routes.system-notice": "Notice", + "routes.system-task": "Task", + "routes.system-cache": "CacheManage", + "routes.system-log": "Log", + "routes.system-monitor": "Monitor", + "routes.system-icons": "Icons", + "routes.system-language": "Language", + "routes.system-menu": "Menu", + "routes.system-area": "Area", + "routes.system-billRule": "BillRule", + "routes.system-systemTemplate": "SystemTemplate", + "routes.system-smsTemplate": "SmsTemplate", + "routes.system-messageTemplate": "MessageTemplate", + "routes.system-signature": "Signature", + "routes.system-kit": "Kit", + "routes.systemData": "SystemData", + "routes.systemData-dataSource": "DataSource", + "routes.systemData-dataModel": "DataModel", + "routes.systemData-dataSync": "DataSync", + "routes.systemData-dataBackup": "DataBackup", + "routes.systemData-dataInterface": "DataInterface", + "routes.systemData-interfaceAuth": "InterfaceAuth", + "routes.systemData-dictionary": "Dictionary", + "routes.systemData-map": "Map", + "routes.commonWords": "CommonWords", + "routes.weChat": "WeChat", + "routes.weChat-mpConfig": "MPConfig", + "routes.weChat-mpMenu": "MPMenu", + "routes.weChat-mpUser": "MPUser", + "routes.weChat-mpMessage": "MPMessage", + "routes.weChat-mpMaterial": "MPMaterial", + "routes.weChat-qyhConfig": "QYHConfig", + "routes.weChat-qyDepartment": "QYDepartment", + "routes.weChat-qyUser": "QYUser", + "routes.weChat-qyMessage": "QYMessage", + "routes.permission": "Permission", + "routes.permission-grade": "Grade", + "routes.permission-organize": "Organize", + "routes.permission-department": "Department", + "routes.permission-position": "Position", + "routes.permission-user": "User", + "routes.permission-role": "Role", + "routes.permission-group": "Group", + "routes.permission-authorize": "AuthGroup", + "routes.permission-auth": "Authorize", + "routes.permission-userOnline": "UserOnline", + "routes.flowEngine": "FlowEngine", + "routes.formDesign": "SystemForm", + "routes.workFlow": "WorkFlow", + "routes.workFlow-form": "Form", + "routes.workFlow-flowEngine": "FlowDesign", + "routes.workFlow-addFlow": "AddFlow", + "routes.workFlow-flowLaunch": "FlowLaunch", + "routes.workFlow-flowToSign": "FlowToSign", + "routes.workFlow-flowTodo": "FlowTodo", + "routes.workFlow-flowDoing": "FlowDoing", + "routes.workFlow-flowDone": "FlowDone", + "routes.workFlow-flowCirculate": "FlowCirculate", + "routes.workFlow-entrust": "Entrust", + "routes.workFlow-flowMonitor": "FlowMonitor", + "routes.workFlow-schedule": "Schedule", + "routes.workFlow-printTemplate": "PrintTemplate", + "routes.workFlow-document": "Document", + "routes.msgCenter": "MsgCenter", + "routes.msgCenter-accountConfig": "AccountConfig", + "routes.msgCenter-accountConfig-mail": "Mail", + "routes.msgCenter-accountConfig-shortMsg": "ShortMsg", + "routes.msgCenter-accountConfig-weCom": "WeCom", + "routes.msgCenter-accountConfig-ding": "DingTalk", + "routes.msgCenter-accountConfig-webhook": "Webhook", + "routes.msgCenter-accountConfig-mp": "MP", + "routes.msgCenter-msgTemplate": "MsgTemplate", + "routes.msgCenter-sendConfig": "SendConfig", + "routes.msgCenter-msgMonitor": "MsgMonitor", + "routes.extend-graphDemo": "Graph Demo", + "routes.extend-graphDemo-echartsBar": "E-Bar", + "routes.extend-graphDemo-echartsPie": "E-Pie", + "routes.extend-graphDemo-echartsBarAcross": "E-BarAcross", + "routes.extend-graphDemo-echartsGauge": "E-Gauge", + "routes.extend-graphDemo-echartsLineArea": "E-LineArea", + "routes.extend-graphDemo-echartsScatter": "E-Scatter", + "routes.extend-graphDemo-echartsCandlestick": "E-Candlestick", + "routes.extend-graphDemo-echartsLineBar": "E-LineBar", + "routes.extend-graphDemo-echartsTree": "E-Tree", + "routes.extend-graphDemo-echartsFunnel": "E-Funnel", + "routes.extend-graphDemo-highchartsScatter": "H-Scatter", + "routes.extend-graphDemo-highchartsWordcloud": "H-Wordcloud", + "routes.extend-graphDemo-highchartsLine": "H-Line", + "routes.extend-graphDemo-highchartsArea": "H-Area", + "routes.extend-graphDemo-highchartsGauge": "H-Gauge", + "routes.extend-graphDemo-highchartsBellcurve": "H-Bellcurve", + "routes.extend-graphDemo-highchartsFunnel": "H-Funnel", + "routes.extend-graphDemo-highchartsBullet": "H-Bullet", + "routes.extend-graphDemo-highchartsColumn": "H-Column", + "routes.extend-graphDemo-highchartsPie": "H-Pie", + "routes.extend-tableDemo": "Table Demo", + "routes.extend-tableDemo-commonTable": "CommonTable", + "routes.extend-tableDemo-statisticsTable": "StatisticsTable", + "routes.extend-tableDemo-lockTable": "LockTable", + "routes.extend-tableDemo-groupingTable": "GroupingTable", + "routes.extend-tableDemo-redactTable": "RedactTable", + "routes.extend-tableDemo-complexHeader": "ComplexHeader", + "routes.extend-tableDemo-mergeTable": "MergeTable", + "routes.extend-tableDemo-printTable": "PrintTable", + "routes.extend-tableDemo-extension": "Extension", + "routes.extend-tableDemo-treeTable": "TreeTable", + "routes.extend-tableDemo-postilTable": "PostilTable", + "routes.extend-tableDemo-tableTree": "TableTree", + "routes.extend-tableDemo-signTable": "SignTable", + "routes.extend-formDemo": "Form Demo", + "routes.extend-formDemo-verifyForm": "VerifyForm", + "routes.extend-formDemo-verifyForm1": "VerifyForm1", + "routes.extend-formDemo-fieldForm1": "FieldForm1", + "routes.extend-formDemo-fieldForm2": "FieldForm2", + "routes.extend-formDemo-fieldForm3": "FieldForm3", + "routes.extend-formDemo-fieldForm4": "FieldForm4", + "routes.extend-formDemo-fieldForm5": "FieldForm5", + "routes.extend-formDemo-fieldForm6": "FieldForm6", + "routes.extend": "Examples", + "routes.extend-functionDemo": "Function Demo", + "routes.extend-portalDemo": "Portal Demo", + "routes.extend-orderDemo": "Order Demo", + "routes.extend-bigData": "BigData", + "routes.extend-importAndExport": "ImportAndExport", + "routes.extend-signet": "Signet", + "routes.extend-signature": "Signature", + "routes.extend-schedule": "Schedule", + "routes.extend-email": "Email", + "routes.extend-documentPreview": "Document Demo", + "routes.extend-barCode": "BarCode", + "routes.extend-printData": "PrintData", + "routes.extend-map": "Map", + "routes.extend-order": "Order", + "routes.extend-projectGantt": "ProjectGantt", + "routes.moreMenu": "More...", + "routes.dataReport": "DataReport Demo", + "routes.reportBI": "ReportBI Demo", + "sys.api.operationFailed": "Operation failed", + "sys.api.errorTip": "Error Tip", + "sys.api.errorMessage": "The operation failed, the system is abnormal!", + "sys.api.timeoutMessage": "Login timed out, please log in again!", + "sys.api.apiTimeoutMessage": "The interface request timed out, please refresh the page and try again!", + "sys.api.apiRequestFailed": "The interface request failed, please try again later!", + "sys.api.networkException": "network anomaly", + "sys.api.networkExceptionMsg": "Please check if your network connection is normal! The network is abnormal", + "sys.api.errMsg401": "The user does not have permission (token, user name, password error)!", + "sys.api.errMsg403": "The user is authorized, but access is forbidden!", + "sys.api.errMsg404": "Network request error, the resource was not found!", + "sys.api.errMsg405": "Network request error, request method not allowed!", + "sys.api.errMsg408": "Network request timed out!", + "sys.api.errMsg500": "Server error, please contact the administrator!", + "sys.api.errMsg501": "The network is not implemented!", + "sys.api.errMsg502": "Network Error!", + "sys.api.errMsg503": "The service is unavailable, the server is temporarily overloaded or maintained!", + "sys.api.errMsg504": "Network timeout!", + "sys.api.errMsg505": "The http version does not support the request!", + "sys.app.logoutTip": "Reminder", + "sys.app.logoutMessage": "Confirm to exit the system?", + "sys.app.menuLoading": "Menu loading...", + "sys.validate.textRequiredSuffix": " cannot be empty", + "sys.validate.arrayRequiredPrefix": "Please select at least one ", + "sys.validate.number": "Please enter the correct number", + "sys.validate.money": "Please enter the correct amount", + "sys.validate.telephone": "Please enter the correct telephone number", + "sys.validate.mobilePhone": "Please enter the correct mobile phone number", + "sys.validate.phone": "Please enter the correct phone number", + "sys.validate.email": "Please enter the correct email address", + "sys.validate.url": "Please enter the correct website address", + "sys.validate.date": "Please enter the correct date", + "sys.validate.idCard": "Please enter the correct ID number", + "sys.errorLog.tableTitle": "Error log list", + "sys.errorLog.tableColumnType": "Type", + "sys.errorLog.tableColumnDate": "Time", + "sys.errorLog.tableColumnFile": "File", + "sys.errorLog.tableColumnMsg": "Error message", + "sys.errorLog.tableColumnStackMsg": "Stack info", + "sys.errorLog.tableActionDesc": "Details", + "sys.errorLog.modalTitle": "Error details", + "sys.errorLog.fireVueError": "Fire vue error", + "sys.errorLog.fireResourceError": "Fire resource error", + "sys.errorLog.fireAjaxError": "Fire ajax error", + "sys.errorLog.enableMessage": "Only effective when useErrorHandle=true in `/src/settings/projectSetting.ts`.", + "sys.exception.backLogin": "Back Login", + "sys.exception.backHome": "Back Home", + "sys.exception.subTitle403": "Sorry, you don't have access to this page.", + "sys.exception.subTitle404": "Sorry, the page you visited does not exist.", + "sys.exception.subTitle500": "Sorry, the server is reporting an error.", + "sys.exception.noDataTitle": "No data on the current page.", + "sys.exception.networkErrorTitle": "Network Error", + "sys.exception.networkErrorSubTitle": "Sorry,Your network connection has been disconnected, please check your network!", + "sys.lock.unlock": "Click to unlock", + "sys.lock.alert": "Lock screen password error", + "sys.lock.backToLogin": "Back to login", + "sys.lock.entry": "Enter the system", + "sys.lock.placeholder": "Please enter the user password", + "sys.login.welcome": "Welcome", + "sys.login.subTitle": "Login with account password", + "sys.login.subTitle1": "Login with mobile verify code, or switch to ", + "sys.login.subTitle2": "Login with account, or switch to ", + "sys.login.subTitle3": "Login with scan code, or switch to ", + "sys.login.otherLogin": "Other login", + "sys.login.backSignIn": "Back sign in", + "sys.login.signInFormTitle": "Account Login", + "sys.login.mobileSignInFormTitle": "Verify Code Login", + "sys.login.qrSignInFormTitle": "APP Scan Login", + "sys.login.signUpFormTitle": "Sign up", + "sys.login.forgetFormTitle": "Reset password", + "sys.login.qrCodeTip": "Please use the app to scan the code to login. The code will expire after 180 seconds.", + "sys.login.signInTitle": "Backstage management system", + "sys.login.signInDesc": "Enter your personal details and get started!", + "sys.login.policy": "I agree to the xxx Privacy Policy", + "sys.login.scanSign": "scanning the code to complete the login", + "sys.login.loginButton": "Login", + "sys.login.registerButton": "Sign up", + "sys.login.rememberMe": "Remember me", + "sys.login.forgetPassword": "Forget Password?", + "sys.login.otherSignIn": "Sign in with", + "sys.login.lastLoginInfo": "Last login information", + "sys.login.accountPlaceholder": "Please input username", + "sys.login.passwordPlaceholder": "Please input password", + "sys.login.smsPlaceholder": "Please input sms code", + "sys.login.mobilePlaceholder": "Please input mobile", + "sys.login.policyPlaceholder": "Register after checking", + "sys.login.diffPwd": "The two passwords are inconsistent", + "sys.login.confirmPassword": "Confirm Password", + "sys.login.email": "Email", + "sys.login.title": "Account Login", + "sys.login.scanTitle": "APP Scan Login", + "sys.login.codeTitle": "Verify Code Login", + "sys.login.logIn": "Login", + "sys.login.username": "Username", + "sys.login.password": "Password", + "sys.login.version": "V", + "sys.login.upper": "Caps locked", + "sys.login.scanTip": "APP Scan code login", + "sys.login.accountTip": "Please enter the account number", + "sys.login.passwordTip": "Please enter your password", + "sys.login.codeTip": "Please enter your verification code", + "sys.login.changeCode": "Click to switch verification code", + "sys.login.mobile": "Please enter mobile number", + "sys.login.rightMobile": "Please enter the correct mobile number", + "sys.login.smsCode": "Please enter the verification code", + "sys.login.getCode": "Get code", + "sys.login.reSend": "Resend", + "sys.login.company": "Please enter company name", + "sys.login.contacts": "Please enter contact", + "sys.login.rule": "Sub Account: mobile{'@'}account example:18577778888{'@'}101001", + "sys.login.scanSuccessful": "Scanned", + "sys.login.confirmLogin": "Confirm login on phone", + "sys.login.refreshCode": "Refresh", + "sys.login.recoverCode": "Cancel", + "sys.login.expired": "Qrcode has expired", + "formGenerator.component.input": "Input", + "formGenerator.component.textarea": "Textarea", + "formGenerator.component.inputNumber": "InputNumber", + "formGenerator.component.switch": "Switch", + "formGenerator.component.radio": "Radio", + "formGenerator.component.checkbox": "Checkbox", + "formGenerator.component.select": "Select", + "formGenerator.component.cascader": "Cascader", + "formGenerator.component.datePicker": "DatePicker", + "formGenerator.component.timePicker": "TimePicker", + "formGenerator.component.uploadFile": "UploadFile", + "formGenerator.component.uploadImg": "UploadImage", + "formGenerator.component.colorPicker": "ColorPicker", + "formGenerator.component.rate": "Rate", + "formGenerator.component.slider": "Slider", + "formGenerator.component.editor": "Editor", + "formGenerator.component.link": "Link", + "formGenerator.component.button": "Button", + "formGenerator.component.text": "Text", + "formGenerator.component.alert": "Alert", + "formGenerator.component.iframe": "Iframe", + "formGenerator.component.qrcode": "Qrcode", + "formGenerator.component.barcode": "Barcode", + "formGenerator.component.organizeSelect": "OrganizeSelect", + "formGenerator.component.posSelect": "PositionSelect", + "formGenerator.component.userSelect": "UserSelect", + "formGenerator.component.roleSelect": "RoleSelect", + "formGenerator.component.groupSelect": "GroupSelect", + "formGenerator.component.usersSelect": "UsersSelect", + "formGenerator.component.table": "Table", + "formGenerator.component.treeSelect": "TreeSelect", + "formGenerator.component.popupTableSelect": "PopupTableSelect", + "formGenerator.component.autoComplete": "AutoComplete", + "formGenerator.component.areaSelect": "AreaSelect", + "formGenerator.component.billRule": "BillRule", + "formGenerator.component.relationForm": "RelationForm", + "formGenerator.component.popupSelect": "PopupSelect", + "formGenerator.component.relationFormAttr": "RelationFormAttr", + "formGenerator.component.popupAttr": "PopupAttr", + "formGenerator.component.sign": "Sign", + "formGenerator.component.location": "Location", + "formGenerator.component.calculate": "Calculate", + "formGenerator.component.createUser": "CreateUser", + "formGenerator.component.createTime": "CreateTime", + "formGenerator.component.modifyUser": "ModifyUser", + "formGenerator.component.modifyTime": "ModifyTime", + "formGenerator.component.currOrganize": "CurrentOrganize", + "formGenerator.component.currPosition": "CurrentPosition", + "formGenerator.component.groupTitle": "GroupTitle", + "formGenerator.component.divider": "Divider", + "formGenerator.component.collapse": "Collapse", + "formGenerator.component.tab": "Tab", + "formGenerator.component.row": "Row", + "formGenerator.component.card": "Card", + "formGenerator.component.tableGrid": "TableGrid", + "formGenerator.delComponentTip": "Delete this component?", + "formGenerator.cleanComponentTip": "Clear all components?", + "formGenerator.copyComponentTip": "Copy this component?", + "views.http404.tips": "Sorry, the page you visited does not exist or you do not have permission to access it!", + "views.http404.subTips": "Please check if the URL you entered is correct, or click the button to return to the homepage.", + "views.http404.goBackBtn": "Go homepage", + "views.dynamicModel.passwordPlaceholder": "Please enter your password", + "views.dynamicModel.scanAndShare": "Scan & Share", + "views.dynamicModel.showMore": "Show more", + "views.dynamicModel.hideSome": "Hide some", + "app.tabBar.home": "Home", + "app.tabBar.dashboard": "Dashboard", + "app.tabBar.message": "Message", + "app.tabBar.my": "My", + "app.tabBar.menu": "Menu", + "app.tabBar.workFlow": "Flow", + "app.my.settings.language": "Language", + "app.my.settings.userAgreement": "User Agreement", + "app.my.settings.privacyPolicy": "Privacy Policy", + "app.my.settings.contact": "Contact", + "app.my.settings.about": "About", + "app.my.organization": "Organization", + "app.my.changeSystem": "Change System", + "app.my.mySystem": "My System", + "app.my.position": "Position", + "app.my.entrustedAgency": "Entrust & Agency", + "app.my.myEntrust": "My Entrust", + "app.my.entrustMe": "Entrust Me", + "app.my.myAgency": "My Agency", + "app.my.agencyMe": "Agency Me", + "app.my.switchIdentity": "Switch Identity", + "app.my.scanCode": "Scan Code", + "app.my.accountSecurity": "Account Security", + "app.my.setting": "Setting", + "app.my.personalSetting": "Personal Setting", + "app.my.logout": "Logout", + "app.my.allFlow": "All Flow", + "app.my.flowSelect": "Flow Select", + "app.my.stop": "Stop", + "app.my.accountSecurity.changePassword": "Change Password", + "app.my.accountSecurity.mobilePhone": "Mobile Phone", + "app.my.accountSecurity.email": "Email", + "app.my.myIdentity": "My Identity", + "app.my.chat": "Chat", + "app.my.contacts": "Contacts", + "app.apply.location.relocation": "Relocation", + "app.apply.location.location": "Location", + "app.apply.location.modalTitle": "Select position", + "app.apply.sort": "Sort", + "app.apply.screen": "Filter", + "app.apply.expandData": "Expand Data", + "app.apply.noMoreData": "No More Data", + "app.apply.pleaseKeyword": "Please enter keywords to search", + "app.apply.ascendingOrder": "Ascending Order", + "app.apply.descendingOrder": "Descending Order" +} \ No newline at end of file diff --git a/locale/index.js b/locale/index.js new file mode 100644 index 0000000..1cf0094 --- /dev/null +++ b/locale/index.js @@ -0,0 +1,9 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' + +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant, +} \ No newline at end of file diff --git a/locale/setupI18n.js b/locale/setupI18n.js new file mode 100644 index 0000000..489c60c --- /dev/null +++ b/locale/setupI18n.js @@ -0,0 +1,24 @@ +import { + createI18n +} from 'vue-i18n' +import messages from './index' + +export let i18n; + +function createI18nOptions() { + const locale = uni.getLocale(); + return { + locale, + messages, + sync: true, + silentTranslationWarn: true, + missingWarn: true, + silentFallbackWarn: true, + }; +} + +export function setupI18n(app) { + const options = createI18nOptions(); + i18n = createI18n(options); + app.use(i18n); +} \ No newline at end of file diff --git a/locale/useLocale.js b/locale/useLocale.js new file mode 100644 index 0000000..f0611c9 --- /dev/null +++ b/locale/useLocale.js @@ -0,0 +1,47 @@ +import { + getLangJson +} from '@/api/common'; +import { + i18n +} from './setupI18n'; +import messages from './index' + + +export function useLocale() { + function getBackLocale(locale) { + const backLocale = locale || uni.getLocale() + if (backLocale === 'zh-Hans') return 'zh-CN' + if (backLocale === 'zh-Hant') return 'zh-TW' + if (backLocale === 'en') return 'en-US' + return backLocale + } + async function changeLocale(locale) { + const defaultMessage = messages[locale] || {} + const res = await getLangJson(getBackLocale(locale)); + if (!res || !res.data) return setLocale(locale, defaultMessage); + const message = JSON.parse(res.data); + setLocale(locale, { + ...defaultMessage, + ...message + }) + return locale; + } + async function initLocale() { + const locale = uni.getLocale() + changeLocale(locale) + } + + function setLocale(locale, message) { + const globalI18n = i18n.global; + globalI18n.setLocaleMessage(locale, message); + globalI18n.locale = locale + uni.setLocale(locale) + } + + return { + changeLocale, + initLocale, + setLocale, + getBackLocale, + }; +} \ No newline at end of file diff --git a/locale/zh-Hans.json b/locale/zh-Hans.json new file mode 100644 index 0000000..b6547e5 --- /dev/null +++ b/locale/zh-Hans.json @@ -0,0 +1,697 @@ +{ + "common.okText": "确定", + "common.continueText": "确定并继续", + "common.continueAndAddText": "确定并新增", + "common.closeText": "关闭", + "common.cancelText": "取消", + "common.loadingText": "加载中...", + "common.saveText": "保存", + "common.delText": "删除", + "common.resetText": "重置", + "common.searchText": "搜索", + "common.queryText": "查询", + "common.addText": "新建", + "common.add1Text": "添加", + "common.add2Text": "新增", + "common.editText": "编辑", + "common.detailText": "详情", + "common.moreText": "更多", + "common.exportText": "导出", + "common.importText": "导入", + "common.copyText": "复制", + "common.printText": "打印", + "common.batchPrintText": "批量打印", + "common.batchDelText": "批量删除", + "common.previewText": "预览", + "common.submitText": "提交", + "common.syncText": "第三方同步", + "common.cleanText": "清空", + "common.closeList": "关闭列表", + "common.inputText": "请输入", + "common.chooseText": "请选择", + "common.inputTextPrefix": "请输入", + "common.chooseTextPrefix": "请选择", + "common.redo": "刷新", + "common.back": "返回", + "common.expandAll": "展开", + "common.collapseAll": "折叠", + "common.superQuery": "高级查询", + "common.light": "亮色主题", + "common.dark": "黑暗主题", + "common.tipTitle": "提示", + "common.delTip": "此操作将永久删除该数据, 是否继续?", + "common.batchDelTip": "您确定要删除这些数据吗, 是否继续?", + "common.selectDataTip": "请选择一条数据", + "common.prev": "上一步", + "common.next": "下一步", + "common.prevRecord": "上一条", + "common.nextRecord": "下一条", + "common.keyword": "关键词", + "common.enterKeyword": "请输入关键词", + "common.leftTreeSearchText": "请输入关键词", + "common.drawerSearchText": "请输入关键词", + "common.inputPlaceholder": "请输入", + "common.selectPlaceholder": "请选择", + "common.selectI18nCode": "选择翻译标记", + "common.undoText": "撤销", + "common.redoText": "重做", + "common.noData": "暂无数据", + "component.app.searchNotData": "暂无搜索结果", + "component.app.toSearch": "确认", + "component.app.toNavigate": "切换", + "component.countdown.normalText": "获取验证码", + "component.countdown.sendText": "{0}秒后重新获取", + "component.cropper.selectImage": "选择图片", + "component.cropper.uploadSuccess": "上传成功", + "component.cropper.modalTitle": "头像上传", + "component.cropper.okText": "确认并上传", + "component.cropper.btn_reset": "重置", + "component.cropper.btn_rotate_left": "逆时针旋转", + "component.cropper.btn_rotate_right": "顺时针旋转", + "component.cropper.btn_scale_x": "水平翻转", + "component.cropper.btn_scale_y": "垂直翻转", + "component.cropper.btn_zoom_in": "放大", + "component.cropper.btn_zoom_out": "缩小", + "component.cropper.preview": "预览", + "component.drawer.loadingText": "加载中...", + "component.drawer.cancelText": "关闭", + "component.drawer.okText": "确认", + "component.excel.exportModalTitle": "导出数据", + "component.excel.fileType": "文件类型", + "component.excel.fileName": "文件名", + "component.form.fold": "收起", + "component.form.unfold": "展开", + "component.form.maxTip": "字符数应小于{0}位", + "component.form.apiSelectNotFound": "请等待数据加载完成...", + "component.icon.placeholder": "点击选择图标", + "component.icon.search": "搜索图标", + "component.icon.copy": "复制图标成功!", + "component.menu.search": "菜单搜索", + "component.modal.cancelText": "关闭", + "component.modal.okText": "确认", + "component.modal.close": "关闭", + "component.modal.maximize": "最大化", + "component.modal.restore": "还原", + "component.table.settingDens": "密度", + "component.table.settingDensDefault": "默认", + "component.table.settingDensMiddle": "中等", + "component.table.settingDensSmall": "紧凑", + "component.table.settingColumn": "列设置", + "component.table.settingColumnShow": "列展示", + "component.table.settingIndexColumnShow": "序号列", + "component.table.settingSelectColumnShow": "勾选列", + "component.table.settingFixedLeft": "固定到左侧", + "component.table.settingFixedRight": "固定到右侧", + "component.table.settingFullScreen": "全屏", + "component.table.index": "序号", + "component.table.status": "状态", + "component.table.action": "操作", + "component.table.summary": "合计", + "component.table.total": "共 {total} 条数据", + "component.time.before": "前", + "component.time.after": "后", + "component.time.just": "刚刚", + "component.time.seconds": "秒", + "component.time.minutes": "分钟", + "component.time.hours": "小时", + "component.time.days": "天", + "component.tree.reload": "刷新数据", + "component.tree.selectAll": "选择全部", + "component.tree.unSelectAll": "取消选择", + "component.tree.expandAll": "展开全部", + "component.tree.unExpandAll": "折叠全部", + "component.tree.checkStrictly": "层级关联", + "component.tree.checkUnStrictly": "层级独立", + "component.upload.save": "保存", + "component.upload.upload": "上传", + "component.upload.buttonText": "点击上传", + "component.upload.imgUpload": "图片上传", + "component.upload.uploaded": "已上传", + "component.upload.operating": "操作", + "component.upload.del": "删除", + "component.upload.download": "下载", + "component.upload.downloadAll": "全部下载", + "component.upload.saveWarn": "请等待文件上传后,保存!", + "component.upload.saveError": "没有上传成功的文件,无法保存!", + "component.upload.preview": "预览", + "component.upload.choose": "选择文件", + "component.upload.accept": "支持{0}格式", + "component.upload.acceptUpload": "只能上传{0}格式文件", + "component.upload.maxSize": "单个文件不超过{0}MB", + "component.upload.maxSizeMultiple": "只能上传不超过{0}MB的文件!", + "component.upload.maxNumber": "最多只能上传{0}个文件", + "component.upload.legend": "略缩图", + "component.upload.fileName": "文件名", + "component.upload.fileSize": "文件大小", + "component.upload.fileStatue": "状态", + "component.upload.startUpload": "开始上传", + "component.upload.uploadSuccess": "上传成功", + "component.upload.uploadError": "上传失败", + "component.upload.uploading": "上传中", + "component.upload.paused": "暂停中", + "component.upload.waiting": "等待中", + "component.upload.checking": "文件校验中", + "component.upload.uploadWait": "请等待文件上传结束后操作", + "component.upload.reUploadFailed": "重新上传失败文件", + "component.upload.uploadImg": "请上传图片", + "component.upload.viewImage": "查看图片", + "component.upload.view": "查看", + "component.upload.imageMaxNumber": "最多可以上传{0}张图片", + "component.upload.imageMaxSize": "图片大小超过{size}{unit}", + "component.upload.fileMaxNumber": "最多可以上传{0}个文件", + "component.upload.fileMaxSize": "文件大小超过{size}{unit}", + "component.upload.fileTypeCheck": "请选择{0}类型的文件", + "component.upload.fileReadError": "文件{0}读取出错,请检查该文件", + "component.upload.videoNoPreview": "音视频文件不能预览", + "component.upload.zipNoPreview": "压缩包不能预览", + "component.upload.image": "图片", + "component.upload.video": "视频", + "component.upload.audio": "音频", + "component.verify.error": "验证失败!", + "component.verify.time": "验证校验成功,耗时{time}秒!", + "component.verify.redoTip": "点击图片可刷新", + "component.verify.dragText": "请按住滑块拖动", + "component.verify.successText": "验证通过", + "component.jnpf.common.allData": "全部数据", + "component.jnpf.common.selected": "已选择", + "component.jnpf.common.clearAll": "清空选项", + "component.jnpf.common.autoGenerate": "系统自动生成", + "component.jnpf.areaSelect.modalTitle": "省市区", + "component.jnpf.calculate.storage": "用于展示计算结果,且数据同时会保存入库", + "component.jnpf.calculate.unStorage": "用于展示计算结果,且数据不会保存", + "component.jnpf.dateRange.startPlaceholder": "开始日期", + "component.jnpf.dateRange.endPlaceholder": "结束日期", + "component.jnpf.timeRange.startPlaceholder": "开始时间", + "component.jnpf.timeRange.endPlaceholder": "结束时间", + "component.jnpf.iconPicker.select": "选择", + "component.jnpf.iconPicker.modalTitle": "图标选择", + "component.jnpf.iconPicker.searchPlaceholder": "请输入关键词", + "component.jnpf.iconPicker.ymIcon": "ymIcon图标", + "component.jnpf.iconPicker.ymCustom": "ymCustom图标", + "component.jnpf.location.modalTitle": "选择位置", + "component.jnpf.location.searchPlaceholder": "搜索或直接在地图上点选", + "component.jnpf.location.relocation": "重新定位", + "component.jnpf.location.location": "添加定位", + "component.jnpf.numberRange.min": "最小值", + "component.jnpf.numberRange.max": "最大值", + "component.jnpf.organizeSelect.modalTitle": "选择组织", + "component.jnpf.posSelect.modalTitle": "选择岗位", + "component.jnpf.roleSelect.modalTitle": "选择角色", + "component.jnpf.groupSelect.modalTitle": "选择分组", + "component.jnpf.userSelect.modalTitle": "选择用户", + "component.jnpf.popupAttr.storage": "用于展示关联弹窗的属性,且数据同时会保存入库", + "component.jnpf.popupAttr.unStorage": "用于展示关联弹窗的属性,且数据不会保存", + "component.jnpf.popupSelect.modalTitle": "选择数据", + "component.jnpf.relationFormAttr.storage": "用于展示关联表单的属性,且数据同时会保存入库", + "component.jnpf.relationFormAttr.unStorage": "用于展示关联表单的属性,且数据不会保存", + "component.jnpf.sign.signTip": "手写签名", + "component.jnpf.sign.signPlaceholder": "请签名", + "component.jnpf.sign.operateTip": "请在此区域使用鼠标手写签名", + "layout.footer.onlinePreview": "在线预览", + "layout.footer.onlineDocument": "在线文档", + "layout.header.dropdownItemDoc": "文档", + "layout.header.dropdownItemLoginOut": "退出系统", + "layout.header.systemChange": "应用切换", + "layout.header.standingChange": "切换身份", + "layout.header.profile": "个人信息", + "layout.header.feedback": "反馈问题", + "layout.header.about": "关于平台", + "layout.header.statement": "官方声明", + "layout.header.commonMenus": "常用菜单", + "layout.header.tooltipErrorLog": "错误日志", + "layout.header.tooltipLock": "锁定屏幕", + "layout.header.tooltipNotify": "消息", + "layout.header.tooltipChat": "聊天", + "layout.header.tooltipEntryFull": "全屏", + "layout.header.tooltipExitFull": "退出全屏", + "layout.header.setting": "设置", + "layout.header.lockScreenPassword": "锁屏密码", + "layout.header.lockScreen": "锁定屏幕", + "layout.header.lockScreenBtn": "锁定", + "layout.header.home": "首页", + "layout.multipleTab.setCommon": "设为常用", + "layout.multipleTab.reload": "重新加载", + "layout.multipleTab.close": "关闭标签页", + "layout.multipleTab.closeLeft": "关闭左侧标签页", + "layout.multipleTab.closeRight": "关闭右侧标签页", + "layout.multipleTab.closeOther": "关闭其它标签页", + "layout.multipleTab.closeAll": "关闭全部标签页", + "layout.setting.contentModeFull": "流式", + "layout.setting.contentModeFixed": "定宽", + "layout.setting.topMenuAlignLeft": "居左", + "layout.setting.topMenuAlignRight": "居中", + "layout.setting.topMenuAlignCenter": "居右", + "layout.setting.menuTriggerNone": "不显示", + "layout.setting.menuTriggerBottom": "底部", + "layout.setting.menuTriggerTop": "顶部", + "layout.setting.menuTypeSidebar": "左侧菜单模式", + "layout.setting.menuTypeMixSidebar": "左侧混合模式", + "layout.setting.menuTypeMix": "顶部混合模式", + "layout.setting.menuTypeTopMenu": "顶部菜单模式", + "layout.setting.defaultBg": "经典主题", + "layout.setting.blueBg": "蔚蓝星辰", + "layout.setting.purpleBg": "紫藤萝兰", + "layout.setting.greenBg": "碧绿翠风", + "layout.setting.on": "开", + "layout.setting.off": "关", + "layout.setting.minute": "分钟", + "layout.setting.operatingTitle": "操作成功", + "layout.setting.operatingContent": "复制成功,请到 src/settings/projectSetting.ts 中修改配置!", + "layout.setting.resetSuccess": "重置成功!", + "layout.setting.copyBtn": "拷贝", + "layout.setting.clearBtn": "清空缓存并返回登录页", + "layout.setting.drawerTitle": "配置", + "layout.setting.darkMode": "主题", + "layout.setting.navMode": "导航栏模式", + "layout.setting.systemBackground": "系统背景", + "layout.setting.interfaceFunction": "界面功能", + "layout.setting.interfaceDisplay": "界面显示", + "layout.setting.animation": "动画", + "layout.setting.splitMenu": "分割菜单", + "layout.setting.closeMixSidebarOnChange": "切换页面关闭菜单", + "layout.setting.sysTheme": "系统主题", + "layout.setting.headerTheme": "顶栏主题", + "layout.setting.sidebarTheme": "菜单主题", + "layout.setting.menuDrag": "侧边菜单拖拽", + "layout.setting.menuSearch": "菜单搜索", + "layout.setting.toggleLocale": "语言切换", + "layout.setting.menuAccordion": "侧边菜单手风琴模式", + "layout.setting.menuCollapse": "折叠菜单", + "layout.setting.collapseMenuDisplayName": "折叠菜单显示名称", + "layout.setting.topMenuLayout": "顶部菜单布局", + "layout.setting.menuCollapseButton": "菜单折叠按钮", + "layout.setting.contentMode": "内容区域宽度", + "layout.setting.expandedMenuWidth": "菜单展开宽度", + "layout.setting.breadcrumb": "面包屑", + "layout.setting.breadcrumbIcon": "面包屑图标", + "layout.setting.tabs": "标签页", + "layout.setting.tabsIcon": "标签图标", + "layout.setting.tabDetail": "标签详情页", + "layout.setting.tabsQuickBtn": "标签页快捷按钮", + "layout.setting.tabsRedoBtn": "标签页刷新按钮", + "layout.setting.tabsFoldBtn": "标签页折叠按钮", + "layout.setting.sidebar": "左侧菜单", + "layout.setting.header": "顶栏", + "layout.setting.footer": "页脚", + "layout.setting.fullContent": "全屏内容", + "layout.setting.grayMode": "灰色模式", + "layout.setting.colorWeak": "色弱模式", + "layout.setting.cachePage": "缓存页面", + "layout.setting.progress": "顶部进度条", + "layout.setting.switchLoading": "切换loading", + "layout.setting.switchAnimation": "切换动画", + "layout.setting.animationType": "动画类型", + "layout.setting.autoScreenLock": "自动锁屏", + "layout.setting.notAutoScreenLock": "不自动锁屏", + "layout.setting.fixedHeader": "固定header", + "layout.setting.fixedSideBar": "固定Sidebar", + "layout.setting.mixSidebarTrigger": "混合菜单触发方式", + "layout.setting.triggerHover": "悬停", + "layout.setting.triggerClick": "点击", + "layout.setting.mixSidebarFixed": "固定展开菜单", + "routes.basic.login": "登录", + "routes.basic.errorLogList": "错误日志列表", + "routes.basic.home": "首页", + "routes.basic.externalLink": "链接", + "routes.basic.workFlowDetail": "流程详情", + "routes.basic.emailDetail": "查看邮件", + "routes.basic.previewModel": "功能预览", + "routes.mainSystem": "开发平台", + "routes.workSystem": "业务平台", + "routes.onlineDev": "在线开发", + "routes.onlineDev-webDesign": "表单设计", + "routes.onlineDev-appDesign": "移动设计", + "routes.onlineDev-dataReport": "报表设计", + "routes.onlineDev-dataScreen": "大屏设计", + "routes.onlineDev-visualPortal": "门户设计", + "routes.onlineDev-integration": "集成助手", + "routes.onlineDev-printDev": "打印设计", + "routes.generator": "代码生成", + "routes.generator-webForm": "功能表单", + "routes.generator-appForm": "移动表单", + "routes.generator-flowForm": "发起表单", + "routes.system": "系统管理", + "routes.system-sysConfig": "系统配置", + "routes.system-notice": "系统公告", + "routes.system-task": "系统调度", + "routes.system-cache": "系统缓存", + "routes.system-log": "系统日志", + "routes.system-monitor": "系统监控", + "routes.system-icons": "系统图标", + "routes.system-language": "翻译管理", + "routes.system-menu": "应用菜单", + "routes.system-area": "行政区划", + "routes.system-billRule": "单据模板", + "routes.system-systemTemplate": "系统模板", + "routes.system-smsTemplate": "短信模板", + "routes.system-messageTemplate": "消息模板", + "routes.system-signature": "签章管理", + "routes.system-kit": "表单套件", + "routes.systemData": "数据应用", + "routes.systemData-dataSource": "数据连接", + "routes.systemData-dataModel": "数据建模", + "routes.systemData-dataSync": "数据同步", + "routes.systemData-dataBackup": "数据备份", + "routes.systemData-dataInterface": "数据接口", + "routes.systemData-interfaceAuth": "接口认证", + "routes.systemData-dictionary": "数据字典", + "routes.systemData-map": "数据地图", + "routes.commonWords": "审批常用语", + "routes.weChat": "微信配置", + "routes.weChat-mpConfig": "公众号配置", + "routes.weChat-mpMenu": "公众号菜单", + "routes.weChat-mpUser": "公众号用户", + "routes.weChat-mpMessage": "公众号消息", + "routes.weChat-mpMaterial": "公众号素材", + "routes.weChat-qyhConfig": "企业号配置", + "routes.weChat-qyDepartment": "企业号组织", + "routes.weChat-qyUser": "企业号用户", + "routes.weChat-qyMessage": "企业号消息", + "routes.permission": "组织权限", + "routes.permission-grade": "管理员", + "routes.permission-organize": "组织管理", + "routes.permission-department": "部门管理", + "routes.permission-position": "岗位管理", + "routes.permission-user": "用户管理", + "routes.permission-role": "角色管理", + "routes.permission-group": "分组管理", + "routes.permission-authorize": "权限组", + "routes.permission-auth": "权限管理", + "routes.permission-userOnline": "在线用户", + "routes.flowEngine": "流程引擎", + "routes.formDesign": "系统表单", + "routes.workFlow": "协同办公", + "routes.workFlow-form": "表单设计", + "routes.workFlow-flowEngine": "流程设计", + "routes.workFlow-addFlow": "发起流程", + "routes.workFlow-flowLaunch": "我发起的", + "routes.workFlow-flowToSign": "我的待签", + "routes.workFlow-flowTodo": "我的待办", + "routes.workFlow-flowDoing": "我的在办", + "routes.workFlow-flowDone": "我的已办", + "routes.workFlow-flowCirculate": "抄送我的", + "routes.workFlow-entrust": "流程委托", + "routes.workFlow-flowMonitor": "流程监控", + "routes.workFlow-schedule": "日程安排", + "routes.workFlow-printTemplate": "打印模板", + "routes.workFlow-document": "文档中心", + "routes.msgCenter": "消息中心", + "routes.msgCenter-accountConfig": "账号配置", + "routes.msgCenter-accountConfig-mail": "邮箱配置", + "routes.msgCenter-accountConfig-shortMsg": "短信配置", + "routes.msgCenter-accountConfig-weCom": "企业微信配置", + "routes.msgCenter-accountConfig-ding": "钉钉配置", + "routes.msgCenter-accountConfig-webhook": "webhook配置", + "routes.msgCenter-accountConfig-mp": "微信公众号配置", + "routes.msgCenter-msgTemplate": "消息模板", + "routes.msgCenter-sendConfig": "发送配置", + "routes.msgCenter-msgMonitor": "消息监控", + "routes.extend-graphDemo": "图表示例", + "routes.extend-graphDemo-echartsBar": "E-柱状图", + "routes.extend-graphDemo-echartsPie": "E-饼状图", + "routes.extend-graphDemo-echartsBarAcross": "E-横状条形图", + "routes.extend-graphDemo-echartsGauge": "E-仪表图", + "routes.extend-graphDemo-echartsLineArea": "E-线形图", + "routes.extend-graphDemo-echartsScatter": "E-散点图", + "routes.extend-graphDemo-echartsCandlestick": "E-K线图", + "routes.extend-graphDemo-echartsLineBar": "E-折柱混合图", + "routes.extend-graphDemo-echartsTree": "E-树形图", + "routes.extend-graphDemo-echartsFunnel": "E-漏斗图", + "routes.extend-graphDemo-highchartsScatter": "H-散点图", + "routes.extend-graphDemo-highchartsWordcloud": "H-词云图", + "routes.extend-graphDemo-highchartsLine": "H-线性图", + "routes.extend-graphDemo-highchartsArea": "H-面积图", + "routes.extend-graphDemo-highchartsGauge": "H-仪表图", + "routes.extend-graphDemo-highchartsBellcurve": "H-贝尔曲线", + "routes.extend-graphDemo-highchartsFunnel": "H-漏斗图", + "routes.extend-graphDemo-highchartsBullet": "H-子弹图", + "routes.extend-graphDemo-highchartsColumn": "H-柱状图", + "routes.extend-graphDemo-highchartsPie": "H-饼状图", + "routes.extend-tableDemo": "表格示例", + "routes.extend-tableDemo-commonTable": "普通表格", + "routes.extend-tableDemo-statisticsTable": "表格统计", + "routes.extend-tableDemo-lockTable": "表格锁定", + "routes.extend-tableDemo-groupingTable": "表格分组", + "routes.extend-tableDemo-redactTable": "表格编辑", + "routes.extend-tableDemo-complexHeader": "复杂表头", + "routes.extend-tableDemo-mergeTable": "表格合并", + "routes.extend-tableDemo-printTable": "表格打印", + "routes.extend-tableDemo-extension": "延伸扩展", + "routes.extend-tableDemo-treeTable": "树形表格", + "routes.extend-tableDemo-postilTable": "表格批注", + "routes.extend-tableDemo-tableTree": "表格树形", + "routes.extend-tableDemo-signTable": "表格标记", + "routes.extend-formDemo": "表单示例", + "routes.extend-formDemo-verifyForm": "表单验证", + "routes.extend-formDemo-verifyForm1": "表单验证1", + "routes.extend-formDemo-fieldForm1": "表单字段1", + "routes.extend-formDemo-fieldForm2": "表单字段2", + "routes.extend-formDemo-fieldForm3": "表单字段3", + "routes.extend-formDemo-fieldForm4": "表单字段4", + "routes.extend-formDemo-fieldForm5": "表单字段5", + "routes.extend-formDemo-fieldForm6": "表单字段6", + "routes.extend": "开发示例", + "routes.extend-bigData": "百万数据", + "routes.extend-functionDemo": "功能示例", + "routes.extend-portalDemo": "门户示例", + "routes.extend-orderDemo": "订单示例", + "routes.extend-importAndExport": "导入导出", + "routes.extend-signet": "电子签章", + "routes.extend-signature": "电子签名", + "routes.extend-schedule": "日程安排", + "routes.extend-email": "邮件收发", + "routes.extend-documentPreview": "文档示例", + "routes.extend-barCode": "条码示例", + "routes.extend-printData": "打印示例", + "routes.extend-map": "地图示例", + "routes.extend-order": "订单管理", + "routes.extend-projectGantt": "项目管理", + "routes.moreMenu": "更多...", + "routes.dataReport": "报表示例", + "routes.reportBI": "大屏示例", + "sys.api.operationFailed": "操作失败", + "sys.api.errorTip": "错误提示", + "sys.api.errorMessage": "操作失败,系统异常!", + "sys.api.timeoutMessage": "登录超时,请重新登录!", + "sys.api.apiTimeoutMessage": "接口请求超时,请刷新页面重试!", + "sys.api.apiRequestFailed": "请求出错,请稍候重试", + "sys.api.networkException": "网络异常", + "sys.api.networkExceptionMsg": "网络异常,请检查您的网络连接是否正常!", + "sys.api.errMsg401": "用户没有权限(令牌、用户名、密码错误)!", + "sys.api.errMsg403": "用户得到授权,但是访问是被禁止的。!", + "sys.api.errMsg404": "网络请求错误,未找到该资源!", + "sys.api.errMsg405": "网络请求错误,请求方法未允许!", + "sys.api.errMsg408": "网络请求超时!", + "sys.api.errMsg500": "服务器错误,请联系管理员!", + "sys.api.errMsg501": "网络未实现!", + "sys.api.errMsg502": "网络错误!", + "sys.api.errMsg503": "服务不可用,服务器暂时过载或维护!", + "sys.api.errMsg504": "网络超时!", + "sys.api.errMsg505": "http版本不支持该请求!", + "sys.app.logoutTip": "温馨提醒", + "sys.app.logoutMessage": "是否确认退出系统?", + "sys.app.menuLoading": "菜单加载中...", + "sys.validate.textRequiredSuffix": "不能为空", + "sys.validate.arrayRequiredPrefix": "请至少选择一个", + "sys.validate.number": "请输入正确的数字", + "sys.validate.money": "请输入正确的金额", + "sys.validate.telephone": "请输入正确的电话号码", + "sys.validate.mobilePhone": "请输入正确的手机号码", + "sys.validate.phone": "请输入正确的联系方式", + "sys.validate.email": "请输入正确的邮箱", + "sys.validate.url": "请输入正确的网址", + "sys.validate.date": "请输入正确的日期", + "sys.validate.idCard": "请输入正确的身份证号码", + "sys.errorLog.tableTitle": "错误日志列表", + "sys.errorLog.tableColumnType": "类型", + "sys.errorLog.tableColumnDate": "时间", + "sys.errorLog.tableColumnFile": "文件", + "sys.errorLog.tableColumnMsg": "错误信息", + "sys.errorLog.tableColumnStackMsg": "stack信息", + "sys.errorLog.tableActionDesc": "详情", + "sys.errorLog.modalTitle": "错误详情", + "sys.errorLog.fireVueError": "点击触发vue错误", + "sys.errorLog.fireResourceError": "点击触发资源加载错误", + "sys.errorLog.fireAjaxError": "点击触发ajax错误", + "sys.errorLog.enableMessage": "只在`/src/settings/projectSetting.ts` 内的useErrorHandle=true时生效.", + "sys.exception.backLogin": "返回登录", + "sys.exception.backHome": "返回首页", + "sys.exception.subTitle403": "抱歉,您无权访问此页面。", + "sys.exception.subTitle404": "抱歉,您访问的页面不存在。", + "sys.exception.subTitle500": "抱歉,服务器报告错误。", + "sys.exception.noDataTitle": "当前页无数据", + "sys.exception.networkErrorTitle": "网络错误", + "sys.exception.networkErrorSubTitle": "抱歉,您的网络连接已断开,请检查您的网络!", + "sys.lock.unlock": "点击解锁", + "sys.lock.alert": "锁屏密码错误", + "sys.lock.backToLogin": "返回登录", + "sys.lock.entry": "进入系统", + "sys.lock.placeholder": "请输入登录密码", + "sys.login.welcome": "欢迎使用", + "sys.login.subTitle": "通过账号密码登录", + "sys.login.subTitle1": "通过手机验证码登录,或者切换为", + "sys.login.subTitle2": "通过账号密码登录,或者切换为", + "sys.login.subTitle3": "通过扫码登录,或者切换为", + "sys.login.otherLogin": "其他登录方式", + "sys.login.backSignIn": "返回", + "sys.login.signInFormTitle": "账号密码登录", + "sys.login.mobileSignInFormTitle": "手机验证码登录", + "sys.login.qrSignInFormTitle": "扫码登录", + "sys.login.signUpFormTitle": "注册", + "sys.login.forgetFormTitle": "重置密码", + "sys.login.qrCodeTip": "请使用APP扫描二维码登录,180秒后二维码失效", + "sys.login.signInTitle": "开箱即用的中后台管理系统", + "sys.login.signInDesc": "输入您的个人详细信息开始使用!", + "sys.login.policy": "我同意xxx隐私政策", + "sys.login.scanSign": "扫码后点击\"确认\",即可完成登录", + "sys.login.loginButton": "登录", + "sys.login.registerButton": "注册", + "sys.login.rememberMe": "记住我", + "sys.login.forgetPassword": "忘记密码?", + "sys.login.otherSignIn": "其他登录方式", + "sys.login.lastLoginInfo": "上次登录信息", + "sys.login.accountPlaceholder": "请输入账号", + "sys.login.passwordPlaceholder": "请输入密码", + "sys.login.smsPlaceholder": "请输入验证码", + "sys.login.mobilePlaceholder": "请输入手机号码", + "sys.login.policyPlaceholder": "勾选后才能注册", + "sys.login.diffPwd": "两次输入密码不一致", + "sys.login.confirmPassword": "确认密码", + "sys.login.email": "邮箱", + "sys.login.title": "账户密码登录", + "sys.login.scanTitle": "扫码登录", + "sys.login.codeTitle": "手机验证登录", + "sys.login.logIn": "登录", + "sys.login.username": "请输入账号", + "sys.login.password": "请输入密码", + "sys.login.version": "版本", + "sys.login.upper": "大写已锁定", + "sys.login.scanTip": "扫码登录", + "sys.login.accountTip": "请输入账号", + "sys.login.passwordTip": "请输入密码", + "sys.login.codeTip": "请输入验证码", + "sys.login.changeCode": "点击切换验证码", + "sys.login.mobile": "请输入手机号", + "sys.login.rightMobile": "请输入正确的手机号", + "sys.login.smsCode": "请输入验证码", + "sys.login.getCode": "获取验证码", + "sys.login.reSend": "重新发送", + "sys.login.company": "请输入公司名", + "sys.login.contacts": "请输入联系人", + "sys.login.rule": "租户子账户规则:租户号{'@'}账户 例:18577778888{'@'}101001", + "sys.login.scanSuccessful": "扫码成功", + "sys.login.confirmLogin": "请在手机端确认登录", + "sys.login.refreshCode": "点击刷新", + "sys.login.recoverCode": "取消登录", + "sys.login.expired": "二维码已失效", + "formGenerator.component.input": "单行输入", + "formGenerator.component.textarea": "多行输入", + "formGenerator.component.inputNumber": "数字输入", + "formGenerator.component.switch": "开关", + "formGenerator.component.radio": "单选框组", + "formGenerator.component.checkbox": "多选框组", + "formGenerator.component.select": "下拉选择", + "formGenerator.component.cascader": "级联选择", + "formGenerator.component.datePicker": "日期选择", + "formGenerator.component.timePicker": "时间选择", + "formGenerator.component.uploadFile": "文件上传", + "formGenerator.component.uploadImg": "图片上传", + "formGenerator.component.colorPicker": "颜色选择", + "formGenerator.component.rate": "评分", + "formGenerator.component.slider": "滑块", + "formGenerator.component.editor": "富文本", + "formGenerator.component.link": "链接", + "formGenerator.component.button": "按钮", + "formGenerator.component.text": "文本", + "formGenerator.component.alert": "提示", + "formGenerator.component.iframe": "Iframe", + "formGenerator.component.qrcode": "二维码", + "formGenerator.component.barcode": "条形码", + "formGenerator.component.organizeSelect": "组织选择", + "formGenerator.component.posSelect": "岗位选择", + "formGenerator.component.userSelect": "用户选择", + "formGenerator.component.roleSelect": "角色选择", + "formGenerator.component.groupSelect": "分组选择", + "formGenerator.component.usersSelect": "用户组件", + "formGenerator.component.table": "设计子表", + "formGenerator.component.treeSelect": "下拉树形", + "formGenerator.component.popupTableSelect": "下拉表格", + "formGenerator.component.autoComplete": "下拉补全", + "formGenerator.component.areaSelect": "省市区域", + "formGenerator.component.billRule": "单据组件", + "formGenerator.component.relationForm": "关联表单", + "formGenerator.component.popupSelect": "弹窗选择", + "formGenerator.component.relationFormAttr": "关联表单属性", + "formGenerator.component.popupAttr": "弹窗选择属性", + "formGenerator.component.sign": "手写签名", + "formGenerator.component.location": "定位", + "formGenerator.component.calculate": "计算公式", + "formGenerator.component.createUser": "创建人员", + "formGenerator.component.createTime": "创建时间", + "formGenerator.component.modifyUser": "修改人员", + "formGenerator.component.modifyTime": "修改时间", + "formGenerator.component.currOrganize": "所属组织", + "formGenerator.component.currPosition": "所属岗位", + "formGenerator.component.groupTitle": "分组标题", + "formGenerator.component.divider": "分割线", + "formGenerator.component.collapse": "折叠面板", + "formGenerator.component.tab": "标签面板", + "formGenerator.component.row": "栅格容器", + "formGenerator.component.card": "卡片容器", + "formGenerator.component.tableGrid": "表格容器", + "formGenerator.delComponentTip": "确定删除该组件?", + "formGenerator.cleanComponentTip": "确定要清空所有组件吗?", + "formGenerator.copyComponentTip": "确定复制该组件?", + "views.http404.tips": "抱歉,你访问的页面不存在或无权访问!", + "views.http404.subTips": "请检查您输入的URL是否正确,或单击按钮返回首页。", + "views.http404.goBackBtn": "返回首页", + "views.dynamicModel.passwordPlaceholder": "请输入密码", + "views.dynamicModel.scanAndShare": "扫描二维码,分享此链接", + "views.dynamicModel.showMore": "加载更多", + "views.dynamicModel.hideSome": "隐藏部分", + "app.tabBar.home": "工作台", + "app.tabBar.dashboard": "仪表盘", + "app.tabBar.message": "消息", + "app.tabBar.my": "我的", + "app.tabBar.menu": "应用功能", + "app.tabBar.workFlow": "发起审批", + "app.my.settings.language": "多语言", + "app.my.settings.userAgreement": "用户协议", + "app.my.settings.privacyPolicy": "隐私政策", + "app.my.settings.contact": "联系我们", + "app.my.settings.about": "关于平台", + "app.my.organization": "我的组织", + "app.my.changeSystem": "切换应用", + "app.my.mySystem": "我的应用", + "app.my.position": "我的岗位", + "app.my.entrustedAgency": "委托代理", + "app.my.myEntrust": "我的委托", + "app.my.entrustMe": "委托给我", + "app.my.myAgency": "我的代理", + "app.my.agencyMe": "代理给我", + "app.my.switchIdentity": "切换身份", + "app.my.scanCode": "扫一扫", + "app.my.accountSecurity": "账号安全", + "app.my.setting": "设置", + "app.my.personalSetting": "个人设置", + "app.my.logout": "退出登录", + "app.my.allFlow": "全部流程", + "app.my.flowSelect": "流程选择", + "app.my.stop": "终止", + "app.my.accountSecurity.changePassword": "修改密码", + "app.my.accountSecurity.mobilePhone": "手机号码", + "app.my.accountSecurity.email": "邮箱地址", + "app.my.myIdentity": "我的身份", + "app.my.chat": "聊天", + "app.my.contacts": "通讯录", + "app.apply.location.relocation": "重新定位", + "app.apply.location.location": "添加定位", + "app.apply.location.modalTitle": "选择位置", + "app.apply.sort": "排序", + "app.apply.screen": "筛选", + "app.apply.expandData": "展开数据", + "app.apply.noMoreData": "没有更多数据", + "app.apply.pleaseKeyword": "请输入关键词搜索", + "app.apply.ascendingOrder": "升序", + "app.apply.descendingOrder": "降序" +} \ No newline at end of file diff --git a/locale/zh-Hant.json b/locale/zh-Hant.json new file mode 100644 index 0000000..fc16597 --- /dev/null +++ b/locale/zh-Hant.json @@ -0,0 +1,698 @@ +{ + "common.okText": "確定", + "common.continueText": "確定並繼續", + "common.continueAndAddText": "確定並新增", + "common.closeText": "關閉", + "common.cancelText": "取消", + "common.loadingText": "加載中...", + "common.saveText": "保存", + "common.delText": "刪除", + "common.resetText": "重置", + "common.searchText": "搜索", + "common.queryText": "查詢", + "common.addText": "新建", + "common.add1Text": "添加", + "common.add2Text": "新增", + "common.editText": "編輯", + "common.detailText": "詳情", + "common.moreText": "更多", + "common.exportText": "導出", + "common.importText": "導入", + "common.copyText": "復製", + "common.printText": "打印", + "common.batchPrintText": "批量打印", + "common.batchDelText": "批量刪除", + "common.previewText": "預覽", + "common.submitText": "提交", + "common.syncText": "第三方同步", + "common.cleanText": "清空", + "common.closeList": "關閉列表", + "common.inputText": "請輸入", + "common.chooseText": "請選擇", + "common.inputTextPrefix": "請輸入", + "common.chooseTextPrefix": "請選擇", + "common.redo": "刷新", + "common.back": "返回", + "common.expandAll": "展開", + "common.collapseAll": "折疊", + "common.superQuery": "高級查詢", + "common.light": "亮色主題", + "common.dark": "黑暗主題", + "common.tipTitle": "提示", + "common.delTip": "此操作將永久刪除該數據, 是否繼續?", + "common.batchDelTip": "您確定要刪除這些數據嗎, 是否繼續?", + "common.selectDataTip": "請選擇一條數據", + "common.prev": "上一步", + "common.next": "下一步", + "common.prevRecord": "上一條", + "common.nextRecord": "下一條", + "common.keyword": "關鍵詞", + "common.enterKeyword": "請輸入關鍵詞", + "common.leftTreeSearchText": "請輸入關鍵詞", + "common.drawerSearchText": "請輸入關鍵詞", + "common.inputPlaceholder": "請輸入", + "common.selectPlaceholder": "請選擇", + "common.selectI18nCode": "選擇翻譯標記", + "common.undoText": "撤銷", + "common.redoText": "重做", + "common.noData": "暫無數據", + "component.app.searchNotData": "暫無搜索結果", + "component.app.toSearch": "確認", + "component.app.toNavigate": "切換", + "component.countdown.normalText": "獲取驗證碼", + "component.countdown.sendText": "{0}秒後重新獲取", + "component.cropper.selectImage": "選擇圖片", + "component.cropper.uploadSuccess": "上傳成功", + "component.cropper.modalTitle": "頭像上傳", + "component.cropper.okText": "確認並上傳", + "component.cropper.btn_reset": "重置", + "component.cropper.btn_rotate_left": "逆時針旋轉", + "component.cropper.btn_rotate_right": "順時針旋轉", + "component.cropper.btn_scale_x": "水平翻轉", + "component.cropper.btn_scale_y": "垂直翻轉", + "component.cropper.btn_zoom_in": "放大", + "component.cropper.btn_zoom_out": "縮小", + "component.cropper.preview": "預覽", + "component.drawer.loadingText": "加載中...", + "component.drawer.cancelText": "關閉", + "component.drawer.okText": "確認", + "component.excel.exportModalTitle": "導出數據", + "component.excel.fileType": "文件類型", + "component.excel.fileName": "文件名", + "component.form.fold": "收起", + "component.form.unfold": "展開", + "component.form.maxTip": "字符數應小於{0}位", + "component.form.apiSelectNotFound": "請等待數據加載完成...", + "component.icon.placeholder": "點擊選擇圖標", + "component.icon.search": "搜索圖標", + "component.icon.copy": "復製圖標成功!", + "component.menu.search": "菜單搜索", + "component.modal.cancelText": "關閉", + "component.modal.okText": "確認", + "component.modal.close": "關閉", + "component.modal.maximize": "最大化", + "component.modal.restore": "還原", + "component.table.settingDens": "密度", + "component.table.settingDensDefault": "默認", + "component.table.settingDensMiddle": "中等", + "component.table.settingDensSmall": "緊湊", + "component.table.settingColumn": "列設置", + "component.table.settingColumnShow": "列展示", + "component.table.settingIndexColumnShow": "序號列", + "component.table.settingSelectColumnShow": "勾選列", + "component.table.settingFixedLeft": "固定到左側", + "component.table.settingFixedRight": "固定到右側", + "component.table.settingFullScreen": "全屏", + "component.table.index": "序號", + "component.table.status": "狀態", + "component.table.action": "操作", + "component.table.summary": "合計", + "component.table.total": "共 {total} 條數據", + "component.time.before": "前", + "component.time.after": "後", + "component.time.just": "剛剛", + "component.time.seconds": "秒", + "component.time.minutes": "分鐘", + "component.time.hours": "小時", + "component.time.days": "天", + "component.tree.reload": "刷新數據", + "component.tree.selectAll": "選擇全部", + "component.tree.unSelectAll": "取消選擇", + "component.tree.expandAll": "展開全部", + "component.tree.unExpandAll": "折疊全部", + "component.tree.checkStrictly": "層級關聯", + "component.tree.checkUnStrictly": "層級獨立", + "component.upload.save": "保存", + "component.upload.upload": "上傳", + "component.upload.buttonText": "點擊上傳", + "component.upload.imgUpload": "圖片上傳", + "component.upload.uploaded": "已上傳", + "component.upload.operating": "操作", + "component.upload.del": "刪除", + "component.upload.download": "下載", + "component.upload.downloadAll": "全部下載", + "component.upload.saveWarn": "請等待文件上傳後,保存!", + "component.upload.saveError": "沒有上傳成功的文件,無法保存!", + "component.upload.preview": "預覽", + "component.upload.choose": "選擇文件", + "component.upload.accept": "支持{0}格式", + "component.upload.acceptUpload": "只能上傳{0}格式文件", + "component.upload.maxSize": "單個文件不超過{0}MB", + "component.upload.maxSizeMultiple": "只能上傳不超過{0}MB的文件!", + "component.upload.maxNumber": "最多只能上傳{0}個文件", + "component.upload.legend": "略縮圖", + "component.upload.fileName": "文件名", + "component.upload.fileSize": "文件大小", + "component.upload.fileStatue": "狀態", + "component.upload.startUpload": "開始上傳", + "component.upload.uploadSuccess": "上傳成功", + "component.upload.uploadError": "上傳失敗", + "component.upload.uploading": "上傳中", + "component.upload.paused": "暫停中", + "component.upload.waiting": "等待中", + "component.upload.checking": "文件校驗中", + "component.upload.uploadWait": "請等待文件上傳結束後操作", + "component.upload.reUploadFailed": "重新上傳失敗文件", + "component.upload.uploadImg": "請上傳圖片", + "component.upload.viewImage": "查看圖片", + "component.upload.view": "查看", + "component.upload.imageMaxNumber": "最多可以上傳{0}張圖片", + "component.upload.imageMaxSize": "圖片大小超過{size}{unit}", + "component.upload.fileMaxNumber": "最多可以上傳{0}個文件", + "component.upload.fileMaxSize": "文件大小超過{size}{unit}", + "component.upload.fileTypeCheck": "請選擇{0}類型的文件", + "component.upload.fileReadError": "文件{0}讀取出錯,請檢查該文件", + "component.upload.videoNoPreview": "音視頻文件不能預覽", + "component.upload.zipNoPreview": "壓縮包不能預覽", + "component.upload.image": "圖片", + "component.upload.video": "視頻", + "component.upload.audio": "音頻", + "component.verify.error": "驗證失敗!", + "component.verify.time": "驗證校驗成功,耗時{time}秒!", + "component.verify.redoTip": "點擊圖片可刷新", + "component.verify.dragText": "請按住滑塊拖動", + "component.verify.successText": "驗證通過", + "component.jnpf.common.allData": "全部數據", + "component.jnpf.common.selected": "已選擇", + "component.jnpf.common.clearAll": "清空选项", + "component.jnpf.common.autoGenerate": "系統自動生成", + "component.jnpf.areaSelect.modalTitle": "省市區", + "component.jnpf.calculate.storage": "用於展示計算結果,且數據同時會保存入庫", + "component.jnpf.calculate.unStorage": "用於展示計算結果,且數據不會保存", + "component.jnpf.dateRange.startPlaceholder": "開始日期", + "component.jnpf.dateRange.endPlaceholder": "結束日期", + "component.jnpf.timeRange.startPlaceholder": "開始時間", + "component.jnpf.timeRange.endPlaceholder": "結束時間", + "component.jnpf.iconPicker.select": "選擇", + "component.jnpf.iconPicker.modalTitle": "圖標選擇", + "component.jnpf.iconPicker.searchPlaceholder": "請輸入關鍵詞", + "component.jnpf.iconPicker.ymIcon": "ymIcon圖標", + "component.jnpf.iconPicker.ymCustom": "ymCustom圖標", + "component.jnpf.location.modalTitle": "選擇位置", + "component.jnpf.location.searchPlaceholder": "搜索或直接在地圖上點選", + "component.jnpf.location.relocation": "重新定位", + "component.jnpf.location.location": "添加定位", + "component.jnpf.numberRange.min": "最小值", + "component.jnpf.numberRange.max": "最大值", + "component.jnpf.organizeSelect.modalTitle": "選擇組織", + "component.jnpf.posSelect.modalTitle": "選擇崗位", + "component.jnpf.roleSelect.modalTitle": "選擇角色", + "component.jnpf.groupSelect.modalTitle": "選擇分組", + "component.jnpf.userSelect.modalTitle": "選擇用戶", + "component.jnpf.popupAttr.storage": "用於展示關聯彈窗的屬性,且數據同時會保存入庫", + "component.jnpf.popupAttr.unStorage": "用於展示關聯彈窗的屬性,且數據不會保存", + "component.jnpf.popupSelect.modalTitle": "選擇數據", + "component.jnpf.relationFormAttr.storage": "用於展示關聯表單的屬性,且數據同時會保存入庫", + "component.jnpf.relationFormAttr.unStorage": "用於展示關聯表單的屬性,且數據不會保存", + "component.jnpf.sign.signTip": "手寫簽名", + "component.jnpf.sign.signPlaceholder": "請簽名", + "component.jnpf.sign.operateTip": "請在此區域使用鼠標手寫簽名", + "layout.footer.onlinePreview": "在線預覽", + "layout.footer.onlineDocument": "在線文檔", + "layout.header.dropdownItemDoc": "文檔", + "layout.header.dropdownItemLoginOut": "退出系統", + "layout.header.systemChange": "應用切換", + "layout.header.standingChange": "切換身份", + "layout.header.profile": "個人信息", + "layout.header.feedback": "反饋問題", + "layout.header.about": "關於平臺", + "layout.header.statement": "官方聲明", + "layout.header.commonMenus": "常用菜單", + "layout.header.tooltipErrorLog": "錯誤日誌", + "layout.header.tooltipLock": "鎖定屏幕", + "layout.header.tooltipNotify": "消息", + "layout.header.tooltipChat": "聊天", + "layout.header.tooltipEntryFull": "全屏", + "layout.header.tooltipExitFull": "退出全屏", + "layout.header.setting": "設置", + "layout.header.lockScreenPassword": "鎖屏密碼", + "layout.header.lockScreen": "鎖定屏幕", + "layout.header.lockScreenBtn": "鎖定", + "layout.header.home": "首頁", + "layout.multipleTab.setCommon": "設為常用", + "layout.multipleTab.reload": "重新加載", + "layout.multipleTab.close": "關閉標簽頁", + "layout.multipleTab.closeLeft": "關閉左側標簽頁", + "layout.multipleTab.closeRight": "關閉右側標簽頁", + "layout.multipleTab.closeOther": "關閉其它標簽頁", + "layout.multipleTab.closeAll": "關閉全部標簽頁", + "layout.setting.contentModeFull": "流式", + "layout.setting.contentModeFixed": "定寬", + "layout.setting.topMenuAlignLeft": "居左", + "layout.setting.topMenuAlignRight": "居中", + "layout.setting.topMenuAlignCenter": "居右", + "layout.setting.menuTriggerNone": "不顯示", + "layout.setting.menuTriggerBottom": "底部", + "layout.setting.menuTriggerTop": "頂部", + "layout.setting.menuTypeSidebar": "左側菜單模式", + "layout.setting.menuTypeMixSidebar": "左側混合模式", + "layout.setting.menuTypeMix": "頂部混合模式", + "layout.setting.menuTypeTopMenu": "頂部菜單模式", + "layout.setting.defaultBg": "經典主題", + "layout.setting.blueBg": "蔚藍星辰", + "layout.setting.purpleBg": "紫藤蘿蘭", + "layout.setting.greenBg": "碧綠翠風", + "layout.setting.on": "開", + "layout.setting.off": "關", + "layout.setting.minute": "分鐘", + "layout.setting.operatingTitle": "操作成功", + "layout.setting.operatingContent": "復製成功,請到 src/settings/projectSetting.ts 中修改配置!", + "layout.setting.resetSuccess": "重置成功!", + "layout.setting.copyBtn": "拷貝", + "layout.setting.clearBtn": "清空緩存並返回登錄頁", + "layout.setting.drawerTitle": "配置", + "layout.setting.darkMode": "主題", + "layout.setting.navMode": "導航欄模式", + "layout.setting.systemBackground": "系統背景", + "layout.setting.interfaceFunction": "界面功能", + "layout.setting.interfaceDisplay": "界面顯示", + "layout.setting.animation": "動畫", + "layout.setting.splitMenu": "分割菜單", + "layout.setting.closeMixSidebarOnChange": "切換頁面關閉菜單", + "layout.setting.sysTheme": "系統主題", + "layout.setting.headerTheme": "頂欄主題", + "layout.setting.sidebarTheme": "菜單主題", + "layout.setting.menuDrag": "側邊菜單拖拽", + "layout.setting.menuSearch": "菜單搜索", + "layout.setting.toggleLocale": "語言切換", + "layout.setting.menuAccordion": "側邊菜單手風琴模式", + "layout.setting.menuCollapse": "折疊菜單", + "layout.setting.collapseMenuDisplayName": "折疊菜單顯示名稱", + "layout.setting.topMenuLayout": "頂部菜單布局", + "layout.setting.menuCollapseButton": "菜單折疊按鈕", + "layout.setting.contentMode": "內容區域寬度", + "layout.setting.expandedMenuWidth": "菜單展開寬度", + "layout.setting.breadcrumb": "面包屑", + "layout.setting.breadcrumbIcon": "面包屑圖標", + "layout.setting.tabs": "標簽頁", + "layout.setting.tabsIcon": "標簽圖標", + "layout.setting.tabDetail": "標簽詳情頁", + "layout.setting.tabsQuickBtn": "標簽頁快捷按鈕", + "layout.setting.tabsRedoBtn": "標簽頁刷新按鈕", + "layout.setting.tabsFoldBtn": "標簽頁折疊按鈕", + "layout.setting.sidebar": "左側菜單", + "layout.setting.header": "頂欄", + "layout.setting.footer": "頁腳", + "layout.setting.fullContent": "全屏內容", + "layout.setting.grayMode": "灰色模式", + "layout.setting.colorWeak": "色弱模式", + "layout.setting.cachePage": "緩存頁面", + "layout.setting.progress": "頂部進度條", + "layout.setting.switchLoading": "切換loading", + "layout.setting.switchAnimation": "切換動畫", + "layout.setting.animationType": "動畫類型", + "layout.setting.autoScreenLock": "自動鎖屏", + "layout.setting.notAutoScreenLock": "不自動鎖屏", + "layout.setting.fixedHeader": "固定header", + "layout.setting.fixedSideBar": "固定Sidebar", + "layout.setting.mixSidebarTrigger": "混合菜單觸發方式", + "layout.setting.triggerHover": "懸停", + "layout.setting.triggerClick": "點擊", + "layout.setting.mixSidebarFixed": "固定展開菜單", + "routes.basic.login": "登錄", + "routes.basic.errorLogList": "錯誤日誌列表", + "routes.basic.home": "首頁", + "routes.basic.externalLink": "鏈接", + "routes.basic.workFlowDetail": "流程詳情", + "routes.basic.emailDetail": "查看郵件", + "routes.basic.previewModel": "功能預覽", + "routes.mainSystem": "開發平臺", + "routes.workSystem": "業務平臺", + "routes.onlineDev": "在線開發", + "routes.onlineDev-webDesign": "表單設計", + "routes.onlineDev-appDesign": "移動設計", + "routes.onlineDev-dataReport": "報表設計", + "routes.onlineDev-dataScreen": "大屏設計", + "routes.onlineDev-visualPortal": "門戶設計", + "routes.onlineDev-integration": "集成助手", + "routes.onlineDev-printDev": "打印設計", + "routes.generator": "代碼生成", + "routes.generator-webForm": "功能表單", + "routes.generator-appForm": "移動表單", + "routes.generator-flowForm": "發起表單", + "routes.system": "系統管理", + "routes.system-sysConfig": "系統配置", + "routes.system-notice": "系統公告", + "routes.system-task": "系統調度", + "routes.system-cache": "系統緩存", + "routes.system-log": "系統日誌", + "routes.system-monitor": "系統監控", + "routes.system-icons": "系統圖標", + "routes.system-language": "翻譯管理", + "routes.system-menu": "應用菜單", + "routes.system-area": "行政區劃", + "routes.system-billRule": "單據模板", + "routes.system-systemTemplate": "系統模板", + "routes.system-smsTemplate": "短信模板", + "routes.system-messageTemplate": "消息模板", + "routes.system-signature": "簽章管理", + "routes.system-kit": "表單套件", + "routes.systemData": "數據應用", + "routes.systemData-dataSource": "數據連接", + "routes.systemData-dataModel": "數據建模", + "routes.systemData-dataSync": "數據同步", + "routes.systemData-dataBackup": "數據備份", + "routes.systemData-dataInterface": "數據接口", + "routes.systemData-interfaceAuth": "接口認證", + "routes.systemData-dictionary": "數據字典", + "routes.systemData-map": "數據地圖", + "routes.commonWords": "審批常用語", + "routes.weChat": "微信配置", + "routes.weChat-mpConfig": "公眾號配置", + "routes.weChat-mpMenu": "公眾號菜單", + "routes.weChat-mpUser": "公眾號用戶", + "routes.weChat-mpMessage": "公眾號消息", + "routes.weChat-mpMaterial": "公眾號素材", + "routes.weChat-qyhConfig": "企業號配置", + "routes.weChat-qyDepartment": "企業號組織", + "routes.weChat-qyUser": "企業號用戶", + "routes.weChat-qyMessage": "企業號消息", + "routes.permission": "組織權限", + "routes.permission-grade": "管理員", + "routes.permission-organize": "組織管理", + "routes.permission-department": "部門管理", + "routes.permission-position": "崗位管理", + "routes.permission-user": "用戶管理", + "routes.permission-role": "角色管理", + "routes.permission-group": "分組管理", + "routes.permission-authorize": "權限組", + "routes.permission-auth": "權限管理", + "routes.permission-userOnline": "在線用戶", + "routes.flowEngine": "流程引擎", + "routes.formDesign": "系統表單", + "routes.workFlow": "協同辦公", + "routes.workFlow-form": "表單設計", + "routes.workFlow-flowEngine": "流程設計", + "routes.workFlow-addFlow": "發起流程", + "routes.workFlow-flowLaunch": "我發起的", + "routes.workFlow-flowToSign": "我的待簽", + "routes.workFlow-flowTodo": "我的待辦", + "routes.workFlow-flowDoing": "我的在辦", + "routes.workFlow-flowDone": "我的已辦", + "routes.workFlow-flowCirculate": "抄送我的", + "routes.workFlow-entrust": "流程委托", + "routes.workFlow-flowMonitor": "流程監控", + "routes.workFlow-schedule": "日程安排", + "routes.workFlow-printTemplate": "打印模板", + "routes.workFlow-document": "文檔中心", + "routes.msgCenter": "消息中心", + "routes.msgCenter-accountConfig": "賬號配置", + "routes.msgCenter-accountConfig-mail": "郵箱配置", + "routes.msgCenter-accountConfig-shortMsg": "短信配置", + "routes.msgCenter-accountConfig-weCom": "企業微信配置", + "routes.msgCenter-accountConfig-ding": "釘釘配置", + "routes.msgCenter-accountConfig-webhook": "webhook配置", + "routes.msgCenter-accountConfig-mp": "微信公眾號配置", + "routes.msgCenter-msgTemplate": "消息模板", + "routes.msgCenter-sendConfig": "發送配置", + "routes.msgCenter-msgMonitor": "消息監控", + "routes.extend-graphDemo": "圖表示例", + "routes.extend-graphDemo-echartsBar": "E-柱狀圖", + "routes.extend-graphDemo-echartsPie": "E-餅狀圖", + "routes.extend-graphDemo-echartsBarAcross": "E-橫狀條形圖", + "routes.extend-graphDemo-echartsGauge": "E-儀表圖", + "routes.extend-graphDemo-echartsLineArea": "E-線形圖", + "routes.extend-graphDemo-echartsScatter": "E-散點圖", + "routes.extend-graphDemo-echartsCandlestick": "E-K線圖", + "routes.extend-graphDemo-echartsLineBar": "E-折柱混合圖", + "routes.extend-graphDemo-echartsTree": "E-樹形圖", + "routes.extend-graphDemo-echartsFunnel": "E-漏鬥圖", + "routes.extend-graphDemo-highchartsScatter": "H-散點圖", + "routes.extend-graphDemo-highchartsWordcloud": "H-詞雲圖", + "routes.extend-graphDemo-highchartsLine": "H-線性圖", + "routes.extend-graphDemo-highchartsArea": "H-面積圖", + "routes.extend-graphDemo-highchartsGauge": "H-儀表圖", + "routes.extend-graphDemo-highchartsBellcurve": "H-貝爾曲線", + "routes.extend-graphDemo-highchartsFunnel": "H-漏鬥圖", + "routes.extend-graphDemo-highchartsBullet": "H-子彈圖", + "routes.extend-graphDemo-highchartsColumn": "H-柱狀圖", + "routes.extend-graphDemo-highchartsPie": "H-餅狀圖", + "routes.extend-tableDemo": "表格示例", + "routes.extend-tableDemo-commonTable": "普通表格", + "routes.extend-tableDemo-statisticsTable": "表格統計", + "routes.extend-tableDemo-lockTable": "表格鎖定", + "routes.extend-tableDemo-groupingTable": "表格分組", + "routes.extend-tableDemo-redactTable": "表格編輯", + "routes.extend-tableDemo-complexHeader": "復雜表頭", + "routes.extend-tableDemo-mergeTable": "表格合並", + "routes.extend-tableDemo-printTable": "表格打印", + "routes.extend-tableDemo-extension": "延伸擴展", + "routes.extend-tableDemo-treeTable": "樹形表格", + "routes.extend-tableDemo-postilTable": "表格批註", + "routes.extend-tableDemo-tableTree": "表格樹形", + "routes.extend-tableDemo-signTable": "表格標記", + "routes.extend-formDemo": "表單示例", + "routes.extend-formDemo-verifyForm": "表單驗證", + "routes.extend-formDemo-verifyForm1": "表單驗證1", + "routes.extend-formDemo-fieldForm1": "表單字段1", + "routes.extend-formDemo-fieldForm2": "表單字段2", + "routes.extend-formDemo-fieldForm3": "表單字段3", + "routes.extend-formDemo-fieldForm4": "表單字段4", + "routes.extend-formDemo-fieldForm5": "表單字段5", + "routes.extend-formDemo-fieldForm6": "表單字段6", + "routes.extend": "開發示例", + "routes.extend-bigData": "百萬數據", + "routes.extend-functionDemo": "功能示例", + "routes.extend-portalDemo": "門戶示例", + "routes.extend-orderDemo": "訂單示例", + "routes.extend-importAndExport": "導入導出", + "routes.extend-signet": "電子簽章", + "routes.extend-signature": "電子簽名", + "routes.extend-schedule": "日程安排", + "routes.extend-email": "郵件收發", + "routes.extend-documentPreview": "文檔示例", + "routes.extend-barCode": "條碼示例", + "routes.extend-printData": "打印示例", + "routes.extend-map": "地圖示例", + "routes.extend-order": "訂單管理", + "routes.extend-projectGantt": "項目管理", + "routes.moreMenu": "更多...", + "routes.dataReport": "報表示例", + "routes.reportBI": "大屏示例", + "sys.api.operationFailed": "操作失敗", + "sys.api.errorTip": "錯誤提示", + "sys.api.errorMessage": "操作失敗,系統異常!", + "sys.api.timeoutMessage": "登錄超時,請重新登錄!", + "sys.api.apiTimeoutMessage": "接口請求超時,請刷新頁面重試!", + "sys.api.apiRequestFailed": "請求出錯,請稍候重試", + "sys.api.networkException": "網絡異常", + "sys.api.networkExceptionMsg": "網絡異常,請檢查您的網絡連接是否正常!", + "sys.api.errMsg401": "用戶沒有權限(令牌、用戶名、密碼錯誤)!", + "sys.api.errMsg403": "用戶得到授權,但是訪問是被禁止的。!", + "sys.api.errMsg404": "網絡請求錯誤,未找到該資源!", + "sys.api.errMsg405": "網絡請求錯誤,請求方法未允許!", + "sys.api.errMsg408": "網絡請求超時!", + "sys.api.errMsg500": "服務器錯誤,請聯系管理員!", + "sys.api.errMsg501": "網絡未實現!", + "sys.api.errMsg502": "網絡錯誤!", + "sys.api.errMsg503": "服務不可用,服務器暫時過載或維護!", + "sys.api.errMsg504": "網絡超時!", + "sys.api.errMsg505": "http版本不支持該請求!", + "sys.app.logoutTip": "溫馨提醒", + "sys.app.logoutMessage": "是否確認退出系統?", + "sys.app.menuLoading": "菜單加載中...", + "sys.validate.textRequiredSuffix": "不能為空", + "sys.validate.arrayRequiredPrefix": "請至少選擇一個", + "sys.validate.number": "請輸入正確的數字", + "sys.validate.money": "請輸入正確的金額", + "sys.validate.telephone": "請輸入正確的電話號碼", + "sys.validate.mobilePhone": "請輸入正確的手機號碼", + "sys.validate.phone": "請輸入正確的聯系方式", + "sys.validate.email": "請輸入正確的郵箱", + "sys.validate.url": "請輸入正確的網址", + "sys.validate.date": "請輸入正確的日期", + "sys.validate.idCard": "請輸入正確的身份證號碼", + "sys.errorLog.tableTitle": "錯誤日誌列表", + "sys.errorLog.tableColumnType": "類型", + "sys.errorLog.tableColumnDate": "時間", + "sys.errorLog.tableColumnFile": "文件", + "sys.errorLog.tableColumnMsg": "錯誤信息", + "sys.errorLog.tableColumnStackMsg": "stack信息", + "sys.errorLog.tableActionDesc": "詳情", + "sys.errorLog.modalTitle": "錯誤詳情", + "sys.errorLog.fireVueError": "點擊觸發vue錯誤", + "sys.errorLog.fireResourceError": "點擊觸發資源加載錯誤", + "sys.errorLog.fireAjaxError": "點擊觸發ajax錯誤", + "sys.errorLog.enableMessage": "只在`/src/settings/projectSetting.ts` 內的useErrorHandle=true時生效.", + "sys.exception.backLogin": "返回登錄", + "sys.exception.backHome": "返回首頁", + "sys.exception.subTitle403": "抱歉,您無權訪問此頁面。", + "sys.exception.subTitle404": "抱歉,您訪問的頁面不存在。", + "sys.exception.subTitle500": "抱歉,服務器報告錯誤。", + "sys.exception.noDataTitle": "當前頁無數據", + "sys.exception.networkErrorTitle": "網絡錯誤", + "sys.exception.networkErrorSubTitle": "抱歉,您的網絡連接已斷開,請檢查您的網絡!", + "sys.lock.unlock": "點擊解鎖", + "sys.lock.alert": "鎖屏密碼錯誤", + "sys.lock.backToLogin": "返回登錄", + "sys.lock.entry": "進入系統", + "sys.lock.placeholder": "請輸入登錄密碼", + "sys.login.welcome": "歡迎使用", + "sys.login.subTitle": "通過帳號密碼登錄", + "sys.login.subTitle1": "通過手機驗證碼登錄,或者切換為", + "sys.login.subTitle2": "通過帳號密碼登錄,或者切換為", + "sys.login.subTitle3": "通過掃碼登錄,或者切換為", + "sys.login.otherLogin": "其他登錄方式", + "sys.login.backSignIn": "返回", + "sys.login.signInFormTitle": "賬號密碼登錄", + "sys.login.mobileSignInFormTitle": "手機驗證碼登錄", + "sys.login.qrSignInFormTitle": "掃碼登錄", + "sys.login.signUpFormTitle": "註冊", + "sys.login.forgetFormTitle": "重置密碼", + "sys.login.qrCodeTip": "請使用APP掃描二維碼登錄,180秒後二維碼失效", + "sys.login.signInTitle": "開箱即用的中後臺管理系統", + "sys.login.signInDesc": "輸入您的個人詳細信息開始使用!", + "sys.login.policy": "我同意xxx隱私政策", + "sys.login.scanSign": "掃碼後點擊\"確認\",即可完成登錄", + "sys.login.loginButton": "登錄", + "sys.login.registerButton": "註冊", + "sys.login.rememberMe": "記住我", + "sys.login.forgetPassword": "忘記密碼?", + "sys.login.otherSignIn": "其他登錄方式", + "sys.login.lastLoginInfo": "上次登錄信息", + "sys.login.accountPlaceholder": "請輸入賬號", + "sys.login.passwordPlaceholder": "請輸入密碼", + "sys.login.smsPlaceholder": "請輸入驗證碼", + "sys.login.mobilePlaceholder": "請輸入手機號碼", + "sys.login.policyPlaceholder": "勾選後才能註冊", + "sys.login.diffPwd": "兩次輸入密碼不一致", + "sys.login.confirmPassword": "確認密碼", + "sys.login.email": "郵箱", + "sys.login.title": "賬戶密碼登錄", + "sys.login.scanTitle": "掃碼登錄", + "sys.login.codeTitle": "手機驗證登錄", + "sys.login.logIn": "登錄", + "sys.login.username": "請輸入賬號", + "sys.login.password": "請輸入密碼", + "sys.login.version": "版本", + "sys.login.upper": "大寫已鎖定", + "sys.login.scanTip": "掃碼登錄", + "sys.login.accountTip": "請輸入賬號", + "sys.login.passwordTip": "請輸入密碼", + "sys.login.codeTip": "請輸入驗證碼", + "sys.login.changeCode": "點擊切換驗證碼", + "sys.login.mobile": "請輸入手機號", + "sys.login.rightMobile": "請輸入正確的手機號", + "sys.login.smsCode": "請輸入驗證碼", + "sys.login.getCode": "獲取驗證碼", + "sys.login.reSend": "重新發送", + "sys.login.company": "請輸入公司名", + "sys.login.contacts": "請輸入聯系人", + "sys.login.rule": "租戶子賬戶規則:租戶號{'@'}賬戶 例:18577778888{'@'}101001", + "sys.login.scanSuccessful": "掃碼成功", + "sys.login.confirmLogin": "請在手機端確認登錄", + "sys.login.refreshCode": "點擊刷新", + "sys.login.recoverCode": "取消登錄", + "sys.login.expired": "二維碼已失效", + "formGenerator.component.input": "單行輸入", + "formGenerator.component.textarea": "多行輸入", + "formGenerator.component.inputNumber": "數字輸入", + "formGenerator.component.switch": "開關", + "formGenerator.component.radio": "單選框組", + "formGenerator.component.checkbox": "多選框組", + "formGenerator.component.select": "下拉選擇", + "formGenerator.component.cascader": "級聯選擇", + "formGenerator.component.datePicker": "日期選擇", + "formGenerator.component.timePicker": "時間選擇", + "formGenerator.component.uploadFile": "文件上傳", + "formGenerator.component.uploadImg": "圖片上傳", + "formGenerator.component.colorPicker": "顏色選擇", + "formGenerator.component.rate": "評分", + "formGenerator.component.slider": "滑塊", + "formGenerator.component.editor": "富文本", + "formGenerator.component.link": "鏈接", + "formGenerator.component.button": "按鈕", + "formGenerator.component.text": "文本", + "formGenerator.component.alert": "提示", + "formGenerator.component.iframe": "Iframe", + "formGenerator.component.qrcode": "二維碼", + "formGenerator.component.barcode": "條形碼", + "formGenerator.component.organizeSelect": "組織選擇", + "formGenerator.component.posSelect": "崗位選擇", + "formGenerator.component.userSelect": "用戶選擇", + "formGenerator.component.roleSelect": "角色選擇", + "formGenerator.component.groupSelect": "分組選擇", + "formGenerator.component.usersSelect": "用戶組件", + "formGenerator.component.table": "設計子表", + "formGenerator.component.treeSelect": "下拉樹形", + "formGenerator.component.popupTableSelect": "下拉表格", + "formGenerator.component.autoComplete": "下拉補全", + "formGenerator.component.areaSelect": "省市區域", + "formGenerator.component.billRule": "單據組件", + "formGenerator.component.relationForm": "關聯表單", + "formGenerator.component.popupSelect": "彈窗選擇", + "formGenerator.component.relationFormAttr": "關聯表單屬性", + "formGenerator.component.popupAttr": "彈窗選擇屬性", + "formGenerator.component.sign": "手寫簽名", + "formGenerator.component.location": "定位", + "formGenerator.component.calculate": "計算公式", + "formGenerator.component.createUser": "創建人員", + "formGenerator.component.createTime": "創建時間", + "formGenerator.component.modifyUser": "修改人員", + "formGenerator.component.modifyTime": "修改時間", + "formGenerator.component.currOrganize": "所屬組織", + "formGenerator.component.currPosition": "所屬崗位", + "formGenerator.component.groupTitle": "分組標題", + "formGenerator.component.divider": "分割線", + "formGenerator.component.collapse": "折疊面板", + "formGenerator.component.tab": "標簽面板", + "formGenerator.component.row": "柵格容器", + "formGenerator.component.card": "卡片容器", + "formGenerator.component.tableGrid": "表格容器", + "formGenerator.delComponentTip": "確定刪除該組件?", + "formGenerator.cleanComponentTip": "確定要清空所有組件嗎?", + "formGenerator.copyComponentTip": "確定復製該組件?", + "views.http404.tips": "抱歉,你訪問的頁面不存在或無權訪問!", + "views.http404.subTips": "請檢查您輸入的URL是否正確,或單擊按鈕返回首頁。", + "views.http404.goBackBtn": "返回首頁", + "views.dynamicModel.passwordPlaceholder": "請輸入密碼", + "views.dynamicModel.scanAndShare": "掃描二維碼,分享此鏈接", + "views.dynamicModel.showMore": "加載更多", + "views.dynamicModel.hideSome": "隱藏部分", + "app.tabBar.home": "工作台", + "app.tabBar.dashboard": "仪表盘", + "app.tabBar.message": "消息", + "app.tabBar.my": "我的", + "app.tabBar.menu": "應用功能", + "app.tabBar.workFlow": "發起審批", + "app.my.settings.language": "多語言", + "app.my.settings.userAgreement": "用戶協議", + "app.my.settings.privacyPolicy": "隱私政策", + "app.my.settings.changePassword": "修改密碼", + "app.my.settings.contact": "聯繫我們", + "app.my.settings.about": "關於平臺", + "app.my.organization": "我的組織", + "app.my.changeSystem": "切換應用", + "app.my.mySystem": "我的應用", + "app.my.position": "我的崗位", + "app.my.entrustedAgency": "委託代理", + "app.my.myEntrust": "我的委托", + "app.my.entrustMe": "委托給我", + "app.my.myAgency": "我的代理", + "app.my.agencyMe": "代理給我", + "app.my.switchIdentity": "切換身份", + "app.my.scanCode": "掃一掃", + "app.my.accountSecurity": "帳號安全", + "app.my.setting": "設定", + "app.my.personalSetting": "個人設定", + "app.my.logout": "登出", + "app.my.allFlow": "全部流程", + "app.my.flowSelect": "流程選擇", + "app.my.stop": "終止", + "app.my.accountSecurity.changePassword": "修改密碼", + "app.my.accountSecurity.mobilePhone": "手機號碼", + "app.my.accountSecurity.email": "郵箱地址", + "app.my.myIdentity": "我的身份", + "app.my.chat": "聊天", + "app.my.contacts": "通讯录", + "app.apply.location.relocation": "重新定位", + "app.apply.location.location": "添加定位", + "app.apply.location.modalTitle": "選擇位置", + "app.apply.sort": "排序", + "app.apply.screen": "篩選", + "app.apply.expandData": "展開數據", + "app.apply.noMoreData": "沒有更多數據", + "app.apply.pleaseKeyword": "請輸入關鍵詞搜索", + "app.apply.ascendingOrder": "升序", + "app.apply.descendingOrder": "降序" +} \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..4141222 --- /dev/null +++ b/main.js @@ -0,0 +1,57 @@ +import App from './App' +import store from './store' +import uView from './uni_modules/vk-uview-ui'; +import share from '@/utils/share' +import permission from '@/libs/permission' +import define from '@/utils/define' +import request from '@/utils/request' +import jnpf from '@/utils/jnpf' +import { + setupI18n +} from '@/locale/setupI18n'; + +// #ifndef VUE3 +import Vue from 'vue' +import './uni.promisify.adaptor' +Vue.config.productionTip = false +App.mpType = 'app' +// 添加实例属性 +Object.assign(Vue.prototype, { + define, + request, + jnpf, + $permission: permission, + $store: store +}) + +Vue.use(uView) +Vue.mixin(share) + +const app = new Vue({ + ...App +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { + createSSRApp +} from 'vue' +export function createApp() { + const app = createSSRApp(App) + + app.use(store) + app.use(uView) + app.mixin(share) + setupI18n(app); + + app.config.globalProperties.$permission = permission + app.config.globalProperties.define = define + app.config.globalProperties.request = request + app.config.globalProperties.jnpf = jnpf + + return { + app + } +} +// #endif \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..bf49d5e --- /dev/null +++ b/manifest.json @@ -0,0 +1,237 @@ +{ + "name": "jnpf java vue3版", + "appid": "__UNI__663111E", + "description": "专注信息化平台、软件开发、app开发", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + /* 5+App特有相关 */ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": false, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + /* 模块配置 */ + "modules": { + "Barcode": {}, + "Camera": {}, + "Maps": {}, + "OAuth": {}, + "Push": {}, + "Record": {}, + "VideoPlayer": {} + }, + /* 应用发布信息 */ + "distribute": { + /* android打包配置 */ + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "schemes": "jnpf", + "minSdkVersion": 22, + "targetSdkVersion": 26, + "abiFilters": ["armeabi-v7a", "arm64-v8a"] + }, + /* ios打包配置 */ + "ios": { + "privacyDescription": { + "NSPhotoLibraryUsageDescription": "以便于修改头像等功能图片上传", + "NSPhotoLibraryAddUsageDescription": "以便于修改头像等功能图片上传", + "NSCameraUsageDescription": "以便于修改头像等功能图片上传", + "NSMicrophoneUsageDescription": "以便于使用语音、录制音频等功能", + "NSLocationWhenInUseUsageDescription": "以便于定位当前位置等功能", + "NSLocationAlwaysUsageDescription": "以便于定位当前位置等功能", + "NSLocationAlwaysAndWhenInUseUsageDescription": "以便于定位当前位置等功能", + "NSCalendarsUsageDescription": "以便于更好的办公", + "NSContactsUsageDescription": "以便于更好的沟通", + "NSAppleMusicUsageDescription": "以便于修改头像等功能媒体资料上传", + "NSFaceIDUsageDescription": "以便于使用快捷登录等功能" + }, + "urltypes": "jnpf", + "capabilities": { + "entitlements": { + "com.apple.developer.associated-domains": ["applinks:unlink.java.jnpfsoft.com"] + } + }, + "idfa": false + }, + /* SDK配置 */ + "sdkConfigs": { + "maps": { + "amap": { + "name": "amapOdpt2hGy", + "appkey_ios": "", + "appkey_android": "" + } + }, + "oauth": { + "weixin": { + "appid": "wx8f5cb90d8ff960a3", + "UniversalLinks": "" + } + }, + "push": { + "unipush": { + "version": "2", + "offline": false + } + } + }, + "splashscreen": { + "androidStyle": "default", + "android": { + "hdpi": "unpackage/res/startup/480x762.png", + "xhdpi": "unpackage/res/startup/720x1242.png", + "xxhdpi": "unpackage/res/startup/1080x1882.png" + }, + "iosStyle": "default", + "ios": { + "iphone": { + "portrait-896h@3x": "unpackage/res/startup/1242x2688.png", + "landscape-896h@3x": "unpackage/res/startup/1242x2688.png", + "portrait-896h@2x": "unpackage/res/startup/1242x2688.png", + "landscape-896h@2x": "unpackage/res/startup/1242x2688.png", + "iphonex": "unpackage/res/startup/startup.png", + "iphonexl": "unpackage/res/startup/1242x2688.png", + "retina55": "unpackage/res/startup/1242x2688.png", + "retina55l": "unpackage/res/startup/1242x2688.png", + "retina47": "unpackage/res/startup/1242x2688.png", + "retina47l": "unpackage/res/startup/1242x2688.png", + "retina40": "unpackage/res/startup/1242x2688.png", + "retina40l": "unpackage/res/startup/1242x2688.png", + "retina35": "unpackage/res/startup/1242x2688.png" + }, + "ipad": { + "portrait-1366h@2x": "", + "landscape-1366h@2x": "" + } + } + }, + "icons": { + "android": { + "hdpi": "unpackage/res/icons/72x72.png", + "xhdpi": "unpackage/res/icons/96x96.png", + "xxhdpi": "unpackage/res/icons/144x144.png", + "xxxhdpi": "unpackage/res/icons/192x192.png" + }, + "ios": { + "appstore": "unpackage/res/icons/1024x1024.png", + "ipad": { + "app": "unpackage/res/icons/76x76.png", + "app@2x": "unpackage/res/icons/152x152.png", + "notification": "unpackage/res/icons/20x20.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "proapp@2x": "unpackage/res/icons/167x167.png", + "settings": "unpackage/res/icons/29x29.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "spotlight": "unpackage/res/icons/40x40.png", + "spotlight@2x": "unpackage/res/icons/80x80.png" + }, + "iphone": { + "app@2x": "unpackage/res/icons/120x120.png", + "app@3x": "unpackage/res/icons/180x180.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "notification@3x": "unpackage/res/icons/60x60.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "settings@3x": "unpackage/res/icons/87x87.png", + "spotlight@2x": "unpackage/res/icons/80x80.png", + "spotlight@3x": "unpackage/res/icons/120x120.png" + } + } + } + } + }, + /* 快应用特有相关 */ + "quickapp": {}, + /* 小程序特有相关 */ + "mp-weixin": { + "appid": "wx8f5cb90d8ff960a3", + "setting": { + "urlCheck": true, + "es6": true, + "postcss": true, + "minified": true + }, + "usingComponents": true, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + }, + "requiredPrivateInfos": ["getLocation", "chooseLocation"] + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "uniStatistics": { + "enable": false + }, + "vueVersion": "3", + "h5": { + "devServer": { + "port": 3800 + }, + "title": "jnpf java vue3版", + "router": { + "mode": "history" + }, + "optimization": { + "treeShaking": { + "enable": true + } + }, + "sdkConfigs": { + "maps": { + "amap": { + "key": "", + "securityJsCode": "", + "serviceHost": "" + } + } + } + }, + "locale": "zh-Hans", + "fallbackLocale": "zh-Hans", + "app-harmony": { + "distribute": { + "bundleName": "com.jnpf.java", + "modules": { + "uni-push": {} + } + } + } +} +/* 5+App特有相关 */ \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/CONTRIBUTING.md b/node_modules/_crypto-js@4.1.1@crypto-js/CONTRIBUTING.md new file mode 100644 index 0000000..09bf774 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/CONTRIBUTING.md @@ -0,0 +1,28 @@ +# Contribution + +# Git Flow + +The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches. +Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch. + +# Pull request + +Target your pull request on `develop` branch. Other pull request won't be accepted. + +# How to build + +1. Clone + +2. Run + + ```sh + npm install + ``` + +3. Run + + ```sh + npm run build + ``` + +4. Check `build` folder \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/LICENSE b/node_modules/_crypto-js@4.1.1@crypto-js/LICENSE new file mode 100644 index 0000000..b0828e5 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/LICENSE @@ -0,0 +1,24 @@ +# License + +[The MIT License (MIT)](http://opensource.org/licenses/MIT) + +Copyright (c) 2009-2013 Jeff Mott +Copyright (c) 2013-2016 Evan Vosberg + +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. diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/README.md b/node_modules/_crypto-js@4.1.1@crypto-js/README.md new file mode 100644 index 0000000..23795aa --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/README.md @@ -0,0 +1,261 @@ +# crypto-js [![Build Status](https://travis-ci.org/brix/crypto-js.svg?branch=develop)](https://travis-ci.org/brix/crypto-js) + +JavaScript library of crypto standards. + +## Node.js (Install) + +Requirements: + +- Node.js +- npm (Node.js package manager) + +```bash +npm install crypto-js +``` + +### Usage + +ES6 import for typical API call signing use case: + +```javascript +import sha256 from 'crypto-js/sha256'; +import hmacSHA512 from 'crypto-js/hmac-sha512'; +import Base64 from 'crypto-js/enc-base64'; + +const message, nonce, path, privateKey; // ... +const hashDigest = sha256(nonce + message); +const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey)); +``` + +Modular include: + +```javascript +var AES = require("crypto-js/aes"); +var SHA256 = require("crypto-js/sha256"); +... +console.log(SHA256("Message")); +``` + +Including all libraries, for access to extra methods: + +```javascript +var CryptoJS = require("crypto-js"); +console.log(CryptoJS.HmacSHA1("Message", "Key")); +``` + +## Client (browser) + +Requirements: + +- Node.js +- Bower (package manager for frontend) + +```bash +bower install crypto-js +``` + +### Usage + +Modular include: + +```javascript +require.config({ + packages: [ + { + name: 'crypto-js', + location: 'path-to/bower_components/crypto-js', + main: 'index' + } + ] +}); + +require(["crypto-js/aes", "crypto-js/sha256"], function (AES, SHA256) { + console.log(SHA256("Message")); +}); +``` + +Including all libraries, for access to extra methods: + +```javascript +// Above-mentioned will work or use this simple form +require.config({ + paths: { + 'crypto-js': 'path-to/bower_components/crypto-js/crypto-js' + } +}); + +require(["crypto-js"], function (CryptoJS) { + console.log(CryptoJS.HmacSHA1("Message", "Key")); +}); +``` + +### Usage without RequireJS + +```html + + +``` + +## API + +See: https://cryptojs.gitbook.io/docs/ + +### AES Encryption + +#### Plain text encryption + +```javascript +var CryptoJS = require("crypto-js"); + +// Encrypt +var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString(); + +// Decrypt +var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); +var originalText = bytes.toString(CryptoJS.enc.Utf8); + +console.log(originalText); // 'my message' +``` + +#### Object encryption + +```javascript +var CryptoJS = require("crypto-js"); + +var data = [{id: 1}, {id: 2}] + +// Encrypt +var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString(); + +// Decrypt +var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); +var decryptedData = JSON.parse(bytes.toString(CryptoJS.enc.Utf8)); + +console.log(decryptedData); // [{id: 1}, {id: 2}] +``` + +### List of modules + + +- ```crypto-js/core``` +- ```crypto-js/x64-core``` +- ```crypto-js/lib-typedarrays``` + +--- + +- ```crypto-js/md5``` +- ```crypto-js/sha1``` +- ```crypto-js/sha256``` +- ```crypto-js/sha224``` +- ```crypto-js/sha512``` +- ```crypto-js/sha384``` +- ```crypto-js/sha3``` +- ```crypto-js/ripemd160``` + +--- + +- ```crypto-js/hmac-md5``` +- ```crypto-js/hmac-sha1``` +- ```crypto-js/hmac-sha256``` +- ```crypto-js/hmac-sha224``` +- ```crypto-js/hmac-sha512``` +- ```crypto-js/hmac-sha384``` +- ```crypto-js/hmac-sha3``` +- ```crypto-js/hmac-ripemd160``` + +--- + +- ```crypto-js/pbkdf2``` + +--- + +- ```crypto-js/aes``` +- ```crypto-js/tripledes``` +- ```crypto-js/rc4``` +- ```crypto-js/rabbit``` +- ```crypto-js/rabbit-legacy``` +- ```crypto-js/evpkdf``` + +--- + +- ```crypto-js/format-openssl``` +- ```crypto-js/format-hex``` + +--- + +- ```crypto-js/enc-latin1``` +- ```crypto-js/enc-utf8``` +- ```crypto-js/enc-hex``` +- ```crypto-js/enc-utf16``` +- ```crypto-js/enc-base64``` + +--- + +- ```crypto-js/mode-cfb``` +- ```crypto-js/mode-ctr``` +- ```crypto-js/mode-ctr-gladman``` +- ```crypto-js/mode-ofb``` +- ```crypto-js/mode-ecb``` + +--- + +- ```crypto-js/pad-pkcs7``` +- ```crypto-js/pad-ansix923``` +- ```crypto-js/pad-iso10126``` +- ```crypto-js/pad-iso97971``` +- ```crypto-js/pad-zeropadding``` +- ```crypto-js/pad-nopadding``` + + +## Release notes + +### 4.1.1 + +Fix module order in bundled release. + +Include the browser field in the released package.json. + +### 4.1.0 + +Added url safe variant of base64 encoding. [357](https://github.com/brix/crypto-js/pull/357) + +Avoid webpack to add crypto-browser package. [364](https://github.com/brix/crypto-js/pull/364) + +### 4.0.0 + +This is an update including breaking changes for some environments. + +In this version `Math.random()` has been replaced by the random methods of the native crypto module. + +For this reason CryptoJS might not run in some JavaScript environments without native crypto module. Such as IE 10 or before or React Native. + +### 3.3.0 + +Rollback, `3.3.0` is the same as `3.1.9-1`. + +The move of using native secure crypto module will be shifted to a new `4.x.x` version. As it is a breaking change the impact is too big for a minor release. + +### 3.2.1 + +The usage of the native crypto module has been fixed. The import and access of the native crypto module has been improved. + +### 3.2.0 + +In this version `Math.random()` has been replaced by the random methods of the native crypto module. + +For this reason CryptoJS might does not run in some JavaScript environments without native crypto module. Such as IE 10 or before. + +If it's absolute required to run CryptoJS in such an environment, stay with `3.1.x` version. Encrypting and decrypting stays compatible. But keep in mind `3.1.x` versions still use `Math.random()` which is cryptographically not secure, as it's not random enough. + +This version came along with `CRITICAL` `BUG`. + +DO NOT USE THIS VERSION! Please, go for a newer version! + +### 3.1.x + +The `3.1.x` are based on the original CryptoJS, wrapped in CommonJS modules. + + diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/aes.js b/node_modules/_crypto-js@4.1.1@crypto-js/aes.js new file mode 100644 index 0000000..166e3ea --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/aes.js @@ -0,0 +1,234 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Lookup tables + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; + + // Compute lookup tables + (function () { + // Compute double table + var d = []; + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = (i << 1) ^ 0x11b; + } + } + + // Walk GF(2^8) + var x = 0; + var xi = 0; + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; + + // Compute multiplication + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; + + // Compute sub bytes, mix columns tables + var t = (d[sx] * 0x101) ^ (sx * 0x1010100); + SUB_MIX_0[x] = (t << 24) | (t >>> 8); + SUB_MIX_1[x] = (t << 16) | (t >>> 16); + SUB_MIX_2[x] = (t << 8) | (t >>> 24); + SUB_MIX_3[x] = t; + + // Compute inv sub bytes, inv mix columns tables + var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); + INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); + INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); + INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); + INV_SUB_MIX_3[sx] = t; + + // Compute next counter + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + }()); + + // Precomputed Rcon lookup + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + + /** + * AES block cipher algorithm. + */ + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function () { + var t; + + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } + + // Shortcuts + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; + + // Compute number of rounds + var nRounds = this._nRounds = keySize + 6; + + // Compute number of key schedule rows + var ksRows = (nRounds + 1) * 4; + + // Compute key schedule + var keySchedule = this._keySchedule = []; + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = (t << 8) | (t >>> 24); + + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + + // Mix Rcon + t ^= RCON[(ksRow / keySize) | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } + + // Compute inv key schedule + var invKeySchedule = this._invKeySchedule = []; + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ + INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + + decryptBlock: function (M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); + + // Inv swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + + _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; + + // Get input, add round key + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; + + // Key schedule row counter + var ksRow = 4; + + // Rounds + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; + + // Update state + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } + + // Shift rows, sub bytes, add round key + var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; + + // Set output + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + + keySize: 256/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); + */ + C.AES = BlockCipher._createHelper(AES); + }()); + + + return CryptoJS.AES; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/bower.json b/node_modules/_crypto-js@4.1.1@crypto-js/bower.json new file mode 100644 index 0000000..1e12fdc --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/bower.json @@ -0,0 +1,39 @@ +{ + "name": "crypto-js", + "version": "4.1.1", + "description": "JavaScript library of crypto standards.", + "license": "MIT", + "homepage": "http://github.com/brix/crypto-js", + "repository": { + "type": "git", + "url": "http://github.com/brix/crypto-js.git" + }, + "keywords": [ + "security", + "crypto", + "Hash", + "MD5", + "SHA1", + "SHA-1", + "SHA256", + "SHA-256", + "RC4", + "Rabbit", + "AES", + "DES", + "PBKDF2", + "HMAC", + "OFB", + "CFB", + "CTR", + "CBC", + "Base64", + "Base64url" + ], + "main": "index.js", + "dependencies": {}, + "browser": { + "crypto": false + }, + "ignore": [] +} diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/cipher-core.js b/node_modules/_crypto-js@4.1.1@crypto-js/cipher-core.js new file mode 100644 index 0000000..c560c9e --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/cipher-core.js @@ -0,0 +1,890 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./evpkdf")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./evpkdf"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function (key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function (key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); + }, + + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function (xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Store transform mode and key + this._xformMode = xformMode; + this._key = key; + + // Set initial values + this.reset(); + }, + + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-cipher logic + this._doReset(); + }, + + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function (dataUpdate) { + // Append + this._append(dataUpdate); + + // Process available blocks + return this._process(); + }, + + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function (dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } + + // Perform concrete-cipher logic + var finalProcessedData = this._doFinalize(); + + return finalProcessedData; + }, + + keySize: 128/32, + + ivSize: 128/32, + + _ENC_XFORM_MODE: 1, + + _DEC_XFORM_MODE: 2, + + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: (function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } + + return function (cipher) { + return { + encrypt: function (message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + + decrypt: function (ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }()) + }); + + /** + * Abstract base stream cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) + */ + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function () { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); + + return finalProcessedBlocks; + }, + + blockSize: 1 + }); + + /** + * Mode namespace. + */ + var C_mode = C.mode = {}; + + /** + * Abstract base block cipher mode template. + */ + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function (cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, + + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function (cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, + + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function (cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + + /** + * Cipher Block Chaining mode. + */ + var CBC = C_mode.CBC = (function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + + /** + * CBC encryptor. + */ + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // XOR and encrypt + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + /** + * CBC decryptor. + */ + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + // Decrypt and XOR + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + var block; + + // Shortcut + var iv = this._iv; + + // Choose mixing block + if (iv) { + block = iv; + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + block = this._prevBlock; + } + + // XOR blocks + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }()); + + /** + * Padding namespace. + */ + var C_pad = C.pad = {}; + + /** + * PKCS #5/7 padding strategy. + */ + var Pkcs7 = C_pad.Pkcs7 = { + /** + * Pads data using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); + */ + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Create padding word + var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; + + // Create padding + var paddingWords = []; + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + var padding = WordArray.create(paddingWords, nPaddingBytes); + + // Add padding + data.concat(padding); + }, + + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + + reset: function () { + var modeCreator; + + // Reset cipher + Cipher.reset.call(this); + + // Shortcuts + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; + + // Reset block mode + if (this._xformMode == this._ENC_XFORM_MODE) { + modeCreator = mode.createEncryptor; + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + modeCreator = mode.createDecryptor; + // Keep at least one block in the buffer for unpadding + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + + _doProcessBlock: function (words, offset) { + this._mode.processBlock(words, offset); + }, + + _doFinalize: function () { + var finalProcessedBlocks; + + // Shortcut + var padding = this.cfg.padding; + + // Finalize + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); + + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + + // Unpad data + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + + blockSize: 128/32 + }); + + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function (cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function (formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + + /** + * Format namespace. + */ + var C_format = C.format = {}; + + /** + * OpenSSL formatting strategy. + */ + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function (cipherParams) { + var wordArray; + + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; + + // Format + if (salt) { + wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function (openSSLStr) { + var salt; + + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); + + // Shortcut + var ciphertextWords = ciphertext.words; + + // Test for salt + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + salt = WordArray.create(ciphertextWords.slice(2, 4)); + + // Remove salt from ciphertext + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ ciphertext: ciphertext, salt: salt }); + } + }; + + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Encrypt + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); + + // Shortcut + var cipherCfg = encryptor.cfg; + + // Create and return serializable cipher params + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Decrypt + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function (ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + + /** + * Key derivation function namespace. + */ + var C_kdf = C.kdf = {}; + + /** + * OpenSSL key derivation function. + */ + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function (password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64/8); + } + + // Derive key and IV + var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); + + // Separate key and IV + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; + + // Return params + return CipherParams.create({ key: key, iv: iv, salt: salt }); + } + }; + + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Encrypt + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); + + // Mix in derived params + ciphertext.mixIn(derivedParams); + + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Decrypt + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + + return plaintext; + } + }); + }()); + + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/core.js b/node_modules/_crypto-js@4.1.1@crypto-js/core.js new file mode 100644 index 0000000..e3a498b --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/core.js @@ -0,0 +1,807 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(); + } + else if (typeof define === "function" && define.amd) { + // AMD + define([], factory); + } + else { + // Global (browser) + root.CryptoJS = factory(); + } +}(this, function () { + + /*globals window, global, require*/ + + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || (function (Math, undefined) { + + var crypto; + + // Native crypto from window (Browser) + if (typeof window !== 'undefined' && window.crypto) { + crypto = window.crypto; + } + + // Native crypto in web worker (Browser) + if (typeof self !== 'undefined' && self.crypto) { + crypto = self.crypto; + } + + // Native crypto from worker + if (typeof globalThis !== 'undefined' && globalThis.crypto) { + crypto = globalThis.crypto; + } + + // Native (experimental IE 11) crypto from window (Browser) + if (!crypto && typeof window !== 'undefined' && window.msCrypto) { + crypto = window.msCrypto; + } + + // Native crypto from global (NodeJS) + if (!crypto && typeof global !== 'undefined' && global.crypto) { + crypto = global.crypto; + } + + // Native crypto import via require (NodeJS) + if (!crypto && typeof require === 'function') { + try { + crypto = require('crypto'); + } catch (err) {} + } + + /* + * Cryptographically secure pseudorandom number generator + * + * As Math.random() is cryptographically not safe to use + */ + var cryptoSecureRandomInt = function () { + if (crypto) { + // Use getRandomValues method (Browser) + if (typeof crypto.getRandomValues === 'function') { + try { + return crypto.getRandomValues(new Uint32Array(1))[0]; + } catch (err) {} + } + + // Use randomBytes method (NodeJS) + if (typeof crypto.randomBytes === 'function') { + try { + return crypto.randomBytes(4).readInt32LE(); + } catch (err) {} + } + } + + throw new Error('Native crypto module could not be used to get secure random number.'); + }; + + /* + * Local polyfill of Object.create + + */ + var create = Object.create || (function () { + function F() {} + + return function (obj) { + var subtype; + + F.prototype = obj; + + subtype = new F(); + + F.prototype = null; + + return subtype; + }; + }()); + + /** + * CryptoJS namespace. + */ + var C = {}; + + /** + * Library namespace. + */ + var C_lib = C.lib = {}; + + /** + * Base object for prototypal inheritance. + */ + var Base = C_lib.Base = (function () { + + + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function (overrides) { + // Spawn + var subtype = create(this); + + // Augment + if (overrides) { + subtype.mixIn(overrides); + } + + // Create default initializer + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } + + // Initializer's prototype is the subtype object + subtype.init.prototype = subtype; + + // Reference supertype + subtype.$super = this; + + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function () { + var instance = this.extend(); + instance.init.apply(instance, arguments); + + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function () { + }, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function (properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } + + // IE won't copy toString using the loop above + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function () { + return this.init.prototype.extend(this); + } + }; + }()); + + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function (encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function (wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; + + // Clamp excess bits + this.clamp(); + + // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); + } + } else { + // Copy one word at a time + for (var j = 0; j < thatSigBytes; j += 4) { + thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2]; + } + } + this.sigBytes += thatSigBytes; + + // Chainable + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function () { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; + + // Clamp + words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function (nBytes) { + var words = []; + + for (var i = 0; i < nBytes; i += 4) { + words.push(cryptoSecureRandomInt()); + } + + return new WordArray.init(words, nBytes); + } + }); + + /** + * Encoder namespace. + */ + var C_enc = C.enc = {}; + + /** + * Hex encoding strategy. + */ + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var hexChars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function (hexStr) { + // Shortcut + var hexStrLength = hexStr.length; + + // Convert + var words = []; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + + /** + * Latin1 encoding strategy. + */ + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var latin1Chars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function (latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; + + // Convert + var words = []; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); + } + + return new WordArray.init(words, latin1StrLength); + } + }; + + /** + * UTF-8 encoding strategy. + */ + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function (wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function (utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function () { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function (data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } + + // Append + this._data.concat(data); + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function (doFlush) { + var processedWords; + + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; + + // Count blocks ready + var nBlocksReady = dataSigBytes / blockSizeBytes; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } + + // Count words ready + var nWordsReady = nBlocksReady * blockSize; + + // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); + + // Process blocks + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } + + // Remove processed words + processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } + + // Return processed words + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + + return clone; + }, + + _minBufferSize: 0 + }); + + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function (cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Set initial values + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-hasher logic + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function (messageUpdate) { + // Append + this._append(messageUpdate); + + // Update the hash + this._process(); + + // Chainable + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } + + // Perform concrete-hasher logic + var hash = this._doFinalize(); + + return hash; + }, + + blockSize: 512/32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function (hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function (hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + + return C; + }(Math)); + + + return CryptoJS; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/crypto-js.js b/node_modules/_crypto-js@4.1.1@crypto-js/crypto-js.js new file mode 100644 index 0000000..27f0a62 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/crypto-js.js @@ -0,0 +1,6191 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(); + } + else if (typeof define === "function" && define.amd) { + // AMD + define([], factory); + } + else { + // Global (browser) + root.CryptoJS = factory(); + } +}(this, function () { + + /*globals window, global, require*/ + + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || (function (Math, undefined) { + + var crypto; + + // Native crypto from window (Browser) + if (typeof window !== 'undefined' && window.crypto) { + crypto = window.crypto; + } + + // Native crypto in web worker (Browser) + if (typeof self !== 'undefined' && self.crypto) { + crypto = self.crypto; + } + + // Native crypto from worker + if (typeof globalThis !== 'undefined' && globalThis.crypto) { + crypto = globalThis.crypto; + } + + // Native (experimental IE 11) crypto from window (Browser) + if (!crypto && typeof window !== 'undefined' && window.msCrypto) { + crypto = window.msCrypto; + } + + // Native crypto from global (NodeJS) + if (!crypto && typeof global !== 'undefined' && global.crypto) { + crypto = global.crypto; + } + + // Native crypto import via require (NodeJS) + if (!crypto && typeof require === 'function') { + try { + crypto = require('crypto'); + } catch (err) {} + } + + /* + * Cryptographically secure pseudorandom number generator + * + * As Math.random() is cryptographically not safe to use + */ + var cryptoSecureRandomInt = function () { + if (crypto) { + // Use getRandomValues method (Browser) + if (typeof crypto.getRandomValues === 'function') { + try { + return crypto.getRandomValues(new Uint32Array(1))[0]; + } catch (err) {} + } + + // Use randomBytes method (NodeJS) + if (typeof crypto.randomBytes === 'function') { + try { + return crypto.randomBytes(4).readInt32LE(); + } catch (err) {} + } + } + + throw new Error('Native crypto module could not be used to get secure random number.'); + }; + + /* + * Local polyfill of Object.create + + */ + var create = Object.create || (function () { + function F() {} + + return function (obj) { + var subtype; + + F.prototype = obj; + + subtype = new F(); + + F.prototype = null; + + return subtype; + }; + }()); + + /** + * CryptoJS namespace. + */ + var C = {}; + + /** + * Library namespace. + */ + var C_lib = C.lib = {}; + + /** + * Base object for prototypal inheritance. + */ + var Base = C_lib.Base = (function () { + + + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function (overrides) { + // Spawn + var subtype = create(this); + + // Augment + if (overrides) { + subtype.mixIn(overrides); + } + + // Create default initializer + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } + + // Initializer's prototype is the subtype object + subtype.init.prototype = subtype; + + // Reference supertype + subtype.$super = this; + + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function () { + var instance = this.extend(); + instance.init.apply(instance, arguments); + + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function () { + }, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function (properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } + + // IE won't copy toString using the loop above + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function () { + return this.init.prototype.extend(this); + } + }; + }()); + + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function (encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function (wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; + + // Clamp excess bits + this.clamp(); + + // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); + } + } else { + // Copy one word at a time + for (var j = 0; j < thatSigBytes; j += 4) { + thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2]; + } + } + this.sigBytes += thatSigBytes; + + // Chainable + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function () { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; + + // Clamp + words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function (nBytes) { + var words = []; + + for (var i = 0; i < nBytes; i += 4) { + words.push(cryptoSecureRandomInt()); + } + + return new WordArray.init(words, nBytes); + } + }); + + /** + * Encoder namespace. + */ + var C_enc = C.enc = {}; + + /** + * Hex encoding strategy. + */ + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var hexChars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function (hexStr) { + // Shortcut + var hexStrLength = hexStr.length; + + // Convert + var words = []; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + + /** + * Latin1 encoding strategy. + */ + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var latin1Chars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function (latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; + + // Convert + var words = []; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); + } + + return new WordArray.init(words, latin1StrLength); + } + }; + + /** + * UTF-8 encoding strategy. + */ + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function (wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function (utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function () { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function (data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } + + // Append + this._data.concat(data); + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function (doFlush) { + var processedWords; + + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; + + // Count blocks ready + var nBlocksReady = dataSigBytes / blockSizeBytes; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } + + // Count words ready + var nWordsReady = nBlocksReady * blockSize; + + // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); + + // Process blocks + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } + + // Remove processed words + processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } + + // Return processed words + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + + return clone; + }, + + _minBufferSize: 0 + }); + + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function (cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Set initial values + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-hasher logic + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function (messageUpdate) { + // Append + this._append(messageUpdate); + + // Update the hash + this._process(); + + // Chainable + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } + + // Perform concrete-hasher logic + var hash = this._doFinalize(); + + return hash; + }, + + blockSize: 512/32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function (hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function (hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + + return C; + }(Math)); + + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var X32WordArray = C_lib.WordArray; + + /** + * x64 namespace. + */ + var C_x64 = C.x64 = {}; + + /** + * A 64-bit word. + */ + var X64Word = C_x64.Word = Base.extend({ + /** + * Initializes a newly created 64-bit word. + * + * @param {number} high The high 32 bits. + * @param {number} low The low 32 bits. + * + * @example + * + * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); + */ + init: function (high, low) { + this.high = high; + this.low = low; + } + + /** + * Bitwise NOTs this word. + * + * @return {X64Word} A new x64-Word object after negating. + * + * @example + * + * var negated = x64Word.not(); + */ + // not: function () { + // var high = ~this.high; + // var low = ~this.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ANDs this word with the passed word. + * + * @param {X64Word} word The x64-Word to AND with this word. + * + * @return {X64Word} A new x64-Word object after ANDing. + * + * @example + * + * var anded = x64Word.and(anotherX64Word); + */ + // and: function (word) { + // var high = this.high & word.high; + // var low = this.low & word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to OR with this word. + * + * @return {X64Word} A new x64-Word object after ORing. + * + * @example + * + * var ored = x64Word.or(anotherX64Word); + */ + // or: function (word) { + // var high = this.high | word.high; + // var low = this.low | word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise XORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to XOR with this word. + * + * @return {X64Word} A new x64-Word object after XORing. + * + * @example + * + * var xored = x64Word.xor(anotherX64Word); + */ + // xor: function (word) { + // var high = this.high ^ word.high; + // var low = this.low ^ word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the left. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftL(25); + */ + // shiftL: function (n) { + // if (n < 32) { + // var high = (this.high << n) | (this.low >>> (32 - n)); + // var low = this.low << n; + // } else { + // var high = this.low << (n - 32); + // var low = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the right. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftR(7); + */ + // shiftR: function (n) { + // if (n < 32) { + // var low = (this.low >>> n) | (this.high << (32 - n)); + // var high = this.high >>> n; + // } else { + // var low = this.high >>> (n - 32); + // var high = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Rotates this word n bits to the left. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotL(25); + */ + // rotL: function (n) { + // return this.shiftL(n).or(this.shiftR(64 - n)); + // }, + + /** + * Rotates this word n bits to the right. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotR(7); + */ + // rotR: function (n) { + // return this.shiftR(n).or(this.shiftL(64 - n)); + // }, + + /** + * Adds this word with the passed word. + * + * @param {X64Word} word The x64-Word to add with this word. + * + * @return {X64Word} A new x64-Word object after adding. + * + * @example + * + * var added = x64Word.add(anotherX64Word); + */ + // add: function (word) { + // var low = (this.low + word.low) | 0; + // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; + // var high = (this.high + word.high + carry) | 0; + + // return X64Word.create(high, low); + // } + }); + + /** + * An array of 64-bit words. + * + * @property {Array} words The array of CryptoJS.x64.Word objects. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var X64WordArray = C_x64.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.x64.WordArray.create(); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ]); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ], 10); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 8; + } + }, + + /** + * Converts this 64-bit word array to a 32-bit word array. + * + * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. + * + * @example + * + * var x32WordArray = x64WordArray.toX32(); + */ + toX32: function () { + // Shortcuts + var x64Words = this.words; + var x64WordsLength = x64Words.length; + + // Convert + var x32Words = []; + for (var i = 0; i < x64WordsLength; i++) { + var x64Word = x64Words[i]; + x32Words.push(x64Word.high); + x32Words.push(x64Word.low); + } + + return X32WordArray.create(x32Words, this.sigBytes); + }, + + /** + * Creates a copy of this word array. + * + * @return {X64WordArray} The clone. + * + * @example + * + * var clone = x64WordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + + // Clone "words" array + var words = clone.words = this.words.slice(0); + + // Clone each X64Word object + var wordsLength = words.length; + for (var i = 0; i < wordsLength; i++) { + words[i] = words[i].clone(); + } + + return clone; + } + }); + }()); + + + (function () { + // Check if typed arrays are supported + if (typeof ArrayBuffer != 'function') { + return; + } + + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + + // Reference original init + var superInit = WordArray.init; + + // Augment WordArray.init to handle typed arrays + var subInit = WordArray.init = function (typedArray) { + // Convert buffers to uint8 + if (typedArray instanceof ArrayBuffer) { + typedArray = new Uint8Array(typedArray); + } + + // Convert other array views to uint8 + if ( + typedArray instanceof Int8Array || + (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || + typedArray instanceof Int16Array || + typedArray instanceof Uint16Array || + typedArray instanceof Int32Array || + typedArray instanceof Uint32Array || + typedArray instanceof Float32Array || + typedArray instanceof Float64Array + ) { + typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); + } + + // Handle Uint8Array + if (typedArray instanceof Uint8Array) { + // Shortcut + var typedArrayByteLength = typedArray.byteLength; + + // Extract bytes + var words = []; + for (var i = 0; i < typedArrayByteLength; i++) { + words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); + } + + // Initialize this word array + superInit.call(this, words, typedArrayByteLength); + } else { + // Else call normal init + superInit.apply(this, arguments); + } + }; + + subInit.prototype = WordArray; + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * UTF-16 BE encoding strategy. + */ + var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { + /** + * Converts a word array to a UTF-16 BE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 BE string. + * + * @static + * + * @example + * + * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 BE string to a word array. + * + * @param {string} utf16Str The UTF-16 BE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + /** + * UTF-16 LE encoding strategy. + */ + C_enc.Utf16LE = { + /** + * Converts a word array to a UTF-16 LE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 LE string. + * + * @static + * + * @example + * + * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 LE string to a word array. + * + * @param {string} utf16Str The UTF-16 LE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + function swapEndian(word) { + return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); + } + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64 encoding strategy. + */ + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function (base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64url encoding strategy. + */ + var Base64url = C_enc.Base64url = { + /** + * Converts a word array to a Base64url string. + * + * @param {WordArray} wordArray The word array. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {string} The Base64url string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64url.stringify(wordArray); + */ + stringify: function (wordArray, urlSafe=true) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = urlSafe ? this._safe_map : this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64url string to a word array. + * + * @param {string} base64Str The Base64url string. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64url.parse(base64String); + */ + parse: function (base64Str, urlSafe=true) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = urlSafe ? this._safe_map : this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', + _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var T = []; + + // Compute constants + (function () { + for (var i = 0; i < 64; i++) { + T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; + } + }()); + + /** + * MD5 hash algorithm. + */ + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + + // Shortcuts + var H = this._hash.words; + + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; + + // Working varialbes + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + + // Computation + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( + (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | + (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) + ); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | + (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) + ); + + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + ((b & c) | (~b & d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + ((b & d) | (c & ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + C.MD5 = Hasher._createHelper(MD5); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + C.HmacMD5 = Hasher._createHmacHelper(MD5); + }(Math)); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Reusable object + var W = []; + + /** + * SHA-1 hash algorithm. + */ + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476, + 0xc3d2e1f0 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + + // Computation + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = (n << 1) | (n >>> 31); + } + + var t = ((a << 5) | (a >>> 27)) + e + W[i]; + if (i < 20) { + t += ((b & c) | (~b & d)) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; + } else /* if (i < 80) */ { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = (b << 30) | (b >>> 2); + b = a; + a = t; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + C.SHA1 = Hasher._createHelper(SHA1); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + }()); + + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Initialization and round constants tables + var H = []; + var K = []; + + // Compute constants + (function () { + function isPrime(n) { + var sqrtN = Math.sqrt(n); + for (var factor = 2; factor <= sqrtN; factor++) { + if (!(n % factor)) { + return false; + } + } + + return true; + } + + function getFractionalBits(n) { + return ((n - (n | 0)) * 0x100000000) | 0; + } + + var n = 2; + var nPrime = 0; + while (nPrime < 64) { + if (isPrime(n)) { + if (nPrime < 8) { + H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); + } + K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); + + nPrime++; + } + + n++; + } + }()); + + // Reusable object + var W = []; + + /** + * SHA-256 hash algorithm. + */ + var SHA256 = C_algo.SHA256 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init(H.slice(0)); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + var f = H[5]; + var g = H[6]; + var h = H[7]; + + // Computation + for (var i = 0; i < 64; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var gamma0x = W[i - 15]; + var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ + ((gamma0x << 14) | (gamma0x >>> 18)) ^ + (gamma0x >>> 3); + + var gamma1x = W[i - 2]; + var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ + ((gamma1x << 13) | (gamma1x >>> 19)) ^ + (gamma1x >>> 10); + + W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; + } + + var ch = (e & f) ^ (~e & g); + var maj = (a & b) ^ (a & c) ^ (b & c); + + var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); + var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); + + var t1 = h + sigma1 + ch + K[i] + W[i]; + var t2 = sigma0 + maj; + + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + H[5] = (H[5] + f) | 0; + H[6] = (H[6] + g) | 0; + H[7] = (H[7] + h) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA256('message'); + * var hash = CryptoJS.SHA256(wordArray); + */ + C.SHA256 = Hasher._createHelper(SHA256); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA256(message, key); + */ + C.HmacSHA256 = Hasher._createHmacHelper(SHA256); + }(Math)); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA256 = C_algo.SHA256; + + /** + * SHA-224 hash algorithm. + */ + var SHA224 = C_algo.SHA224 = SHA256.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 + ]); + }, + + _doFinalize: function () { + var hash = SHA256._doFinalize.call(this); + + hash.sigBytes -= 4; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA224('message'); + * var hash = CryptoJS.SHA224(wordArray); + */ + C.SHA224 = SHA256._createHelper(SHA224); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA224(message, key); + */ + C.HmacSHA224 = SHA256._createHmacHelper(SHA224); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + + function X64Word_create() { + return X64Word.create.apply(X64Word, arguments); + } + + // Constants + var K = [ + X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), + X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), + X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), + X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), + X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), + X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), + X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), + X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), + X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), + X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), + X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), + X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), + X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), + X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), + X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), + X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), + X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), + X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), + X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), + X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), + X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), + X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), + X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), + X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), + X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), + X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), + X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), + X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), + X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), + X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), + X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), + X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), + X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), + X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), + X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), + X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), + X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), + X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), + X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), + X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) + ]; + + // Reusable objects + var W = []; + (function () { + for (var i = 0; i < 80; i++) { + W[i] = X64Word_create(); + } + }()); + + /** + * SHA-512 hash algorithm. + */ + var SHA512 = C_algo.SHA512 = Hasher.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), + new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), + new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), + new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var H = this._hash.words; + + var H0 = H[0]; + var H1 = H[1]; + var H2 = H[2]; + var H3 = H[3]; + var H4 = H[4]; + var H5 = H[5]; + var H6 = H[6]; + var H7 = H[7]; + + var H0h = H0.high; + var H0l = H0.low; + var H1h = H1.high; + var H1l = H1.low; + var H2h = H2.high; + var H2l = H2.low; + var H3h = H3.high; + var H3l = H3.low; + var H4h = H4.high; + var H4l = H4.low; + var H5h = H5.high; + var H5l = H5.low; + var H6h = H6.high; + var H6l = H6.low; + var H7h = H7.high; + var H7l = H7.low; + + // Working variables + var ah = H0h; + var al = H0l; + var bh = H1h; + var bl = H1l; + var ch = H2h; + var cl = H2l; + var dh = H3h; + var dl = H3l; + var eh = H4h; + var el = H4l; + var fh = H5h; + var fl = H5l; + var gh = H6h; + var gl = H6l; + var hh = H7h; + var hl = H7l; + + // Rounds + for (var i = 0; i < 80; i++) { + var Wil; + var Wih; + + // Shortcut + var Wi = W[i]; + + // Extend message + if (i < 16) { + Wih = Wi.high = M[offset + i * 2] | 0; + Wil = Wi.low = M[offset + i * 2 + 1] | 0; + } else { + // Gamma0 + var gamma0x = W[i - 15]; + var gamma0xh = gamma0x.high; + var gamma0xl = gamma0x.low; + var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); + var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); + + // Gamma1 + var gamma1x = W[i - 2]; + var gamma1xh = gamma1x.high; + var gamma1xl = gamma1x.low; + var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); + var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); + + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7 = W[i - 7]; + var Wi7h = Wi7.high; + var Wi7l = Wi7.low; + + var Wi16 = W[i - 16]; + var Wi16h = Wi16.high; + var Wi16l = Wi16.low; + + Wil = gamma0l + Wi7l; + Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); + Wil = Wil + gamma1l; + Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); + Wil = Wil + Wi16l; + Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); + + Wi.high = Wih; + Wi.low = Wil; + } + + var chh = (eh & fh) ^ (~eh & gh); + var chl = (el & fl) ^ (~el & gl); + var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); + var majl = (al & bl) ^ (al & cl) ^ (bl & cl); + + var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); + var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); + var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); + var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); + + // t1 = h + sigma1 + ch + K[i] + W[i] + var Ki = K[i]; + var Kih = Ki.high; + var Kil = Ki.low; + + var t1l = hl + sigma1l; + var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); + var t1l = t1l + chl; + var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); + var t1l = t1l + Kil; + var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); + var t1l = t1l + Wil; + var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); + + // t2 = sigma0 + maj + var t2l = sigma0l + majl; + var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); + + // Update working variables + hh = gh; + hl = gl; + gh = fh; + gl = fl; + fh = eh; + fl = el; + el = (dl + t1l) | 0; + eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; + dh = ch; + dl = cl; + ch = bh; + cl = bl; + bh = ah; + bl = al; + al = (t1l + t2l) | 0; + ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; + } + + // Intermediate hash value + H0l = H0.low = (H0l + al); + H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); + H1l = H1.low = (H1l + bl); + H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); + H2l = H2.low = (H2l + cl); + H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); + H3l = H3.low = (H3l + dl); + H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); + H4l = H4.low = (H4l + el); + H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); + H5l = H5.low = (H5l + fl); + H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); + H6l = H6.low = (H6l + gl); + H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); + H7l = H7.low = (H7l + hl); + H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Convert hash to 32-bit word array before returning + var hash = this._hash.toX32(); + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + }, + + blockSize: 1024/32 + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA512('message'); + * var hash = CryptoJS.SHA512(wordArray); + */ + C.SHA512 = Hasher._createHelper(SHA512); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA512(message, key); + */ + C.HmacSHA512 = Hasher._createHmacHelper(SHA512); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + var SHA512 = C_algo.SHA512; + + /** + * SHA-384 hash algorithm. + */ + var SHA384 = C_algo.SHA384 = SHA512.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), + new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), + new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), + new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) + ]); + }, + + _doFinalize: function () { + var hash = SHA512._doFinalize.call(this); + + hash.sigBytes -= 16; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA384('message'); + * var hash = CryptoJS.SHA384(wordArray); + */ + C.SHA384 = SHA512._createHelper(SHA384); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA384(message, key); + */ + C.HmacSHA384 = SHA512._createHmacHelper(SHA384); + }()); + + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var C_algo = C.algo; + + // Constants tables + var RHO_OFFSETS = []; + var PI_INDEXES = []; + var ROUND_CONSTANTS = []; + + // Compute Constants + (function () { + // Compute rho offset constants + var x = 1, y = 0; + for (var t = 0; t < 24; t++) { + RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; + + var newX = y % 5; + var newY = (2 * x + 3 * y) % 5; + x = newX; + y = newY; + } + + // Compute pi index constants + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; + } + } + + // Compute round constants + var LFSR = 0x01; + for (var i = 0; i < 24; i++) { + var roundConstantMsw = 0; + var roundConstantLsw = 0; + + for (var j = 0; j < 7; j++) { + if (LFSR & 0x01) { + var bitPosition = (1 << j) - 1; + if (bitPosition < 32) { + roundConstantLsw ^= 1 << bitPosition; + } else /* if (bitPosition >= 32) */ { + roundConstantMsw ^= 1 << (bitPosition - 32); + } + } + + // Compute next LFSR + if (LFSR & 0x80) { + // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 + LFSR = (LFSR << 1) ^ 0x71; + } else { + LFSR <<= 1; + } + } + + ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); + } + }()); + + // Reusable objects for temporary values + var T = []; + (function () { + for (var i = 0; i < 25; i++) { + T[i] = X64Word.create(); + } + }()); + + /** + * SHA-3 hash algorithm. + */ + var SHA3 = C_algo.SHA3 = Hasher.extend({ + /** + * Configuration options. + * + * @property {number} outputLength + * The desired number of bits in the output hash. + * Only values permitted are: 224, 256, 384, 512. + * Default: 512 + */ + cfg: Hasher.cfg.extend({ + outputLength: 512 + }), + + _doReset: function () { + var state = this._state = [] + for (var i = 0; i < 25; i++) { + state[i] = new X64Word.init(); + } + + this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var state = this._state; + var nBlockSizeLanes = this.blockSize / 2; + + // Absorb + for (var i = 0; i < nBlockSizeLanes; i++) { + // Shortcuts + var M2i = M[offset + 2 * i]; + var M2i1 = M[offset + 2 * i + 1]; + + // Swap endian + M2i = ( + (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | + (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) + ); + M2i1 = ( + (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | + (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) + ); + + // Absorb message into state + var lane = state[i]; + lane.high ^= M2i1; + lane.low ^= M2i; + } + + // Rounds + for (var round = 0; round < 24; round++) { + // Theta + for (var x = 0; x < 5; x++) { + // Mix column lanes + var tMsw = 0, tLsw = 0; + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + tMsw ^= lane.high; + tLsw ^= lane.low; + } + + // Temporary values + var Tx = T[x]; + Tx.high = tMsw; + Tx.low = tLsw; + } + for (var x = 0; x < 5; x++) { + // Shortcuts + var Tx4 = T[(x + 4) % 5]; + var Tx1 = T[(x + 1) % 5]; + var Tx1Msw = Tx1.high; + var Tx1Lsw = Tx1.low; + + // Mix surrounding columns + var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); + var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + lane.high ^= tMsw; + lane.low ^= tLsw; + } + } + + // Rho Pi + for (var laneIndex = 1; laneIndex < 25; laneIndex++) { + var tMsw; + var tLsw; + + // Shortcuts + var lane = state[laneIndex]; + var laneMsw = lane.high; + var laneLsw = lane.low; + var rhoOffset = RHO_OFFSETS[laneIndex]; + + // Rotate lanes + if (rhoOffset < 32) { + tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); + tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); + } else /* if (rhoOffset >= 32) */ { + tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); + tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); + } + + // Transpose lanes + var TPiLane = T[PI_INDEXES[laneIndex]]; + TPiLane.high = tMsw; + TPiLane.low = tLsw; + } + + // Rho pi at x = y = 0 + var T0 = T[0]; + var state0 = state[0]; + T0.high = state0.high; + T0.low = state0.low; + + // Chi + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + // Shortcuts + var laneIndex = x + 5 * y; + var lane = state[laneIndex]; + var TLane = T[laneIndex]; + var Tx1Lane = T[((x + 1) % 5) + 5 * y]; + var Tx2Lane = T[((x + 2) % 5) + 5 * y]; + + // Mix rows + lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); + lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); + } + } + + // Iota + var lane = state[0]; + var roundConstant = ROUND_CONSTANTS[round]; + lane.high ^= roundConstant.high; + lane.low ^= roundConstant.low; + } + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + var blockSizeBits = this.blockSize * 32; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); + dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var state = this._state; + var outputLengthBytes = this.cfg.outputLength / 8; + var outputLengthLanes = outputLengthBytes / 8; + + // Squeeze + var hashWords = []; + for (var i = 0; i < outputLengthLanes; i++) { + // Shortcuts + var lane = state[i]; + var laneMsw = lane.high; + var laneLsw = lane.low; + + // Swap endian + laneMsw = ( + (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | + (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) + ); + laneLsw = ( + (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | + (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) + ); + + // Squeeze state to retrieve hash + hashWords.push(laneLsw); + hashWords.push(laneMsw); + } + + // Return final computed hash + return new WordArray.init(hashWords, outputLengthBytes); + }, + + clone: function () { + var clone = Hasher.clone.call(this); + + var state = clone._state = this._state.slice(0); + for (var i = 0; i < 25; i++) { + state[i] = state[i].clone(); + } + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA3('message'); + * var hash = CryptoJS.SHA3(wordArray); + */ + C.SHA3 = Hasher._createHelper(SHA3); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA3(message, key); + */ + C.HmacSHA3 = Hasher._createHmacHelper(SHA3); + }(Math)); + + + /** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. + */ + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var _zl = WordArray.create([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); + var _zr = WordArray.create([ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); + var _sl = WordArray.create([ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); + var _sr = WordArray.create([ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); + + var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); + var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); + + /** + * RIPEMD160 hash algorithm. + */ + var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ + _doReset: function () { + this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); + }, + + _doProcessBlock: function (M, offset) { + + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + // Swap + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + // Shortcut + var H = this._hash.words; + var hl = _hl.words; + var hr = _hr.words; + var zl = _zl.words; + var zr = _zr.words; + var sl = _sl.words; + var sr = _sr.words; + + // Working variables + var al, bl, cl, dl, el; + var ar, br, cr, dr, er; + + ar = al = H[0]; + br = bl = H[1]; + cr = cl = H[2]; + dr = dl = H[3]; + er = el = H[4]; + // Computation + var t; + for (var i = 0; i < 80; i += 1) { + t = (al + M[offset+zl[i]])|0; + if (i<16){ + t += f1(bl,cl,dl) + hl[0]; + } else if (i<32) { + t += f2(bl,cl,dl) + hl[1]; + } else if (i<48) { + t += f3(bl,cl,dl) + hl[2]; + } else if (i<64) { + t += f4(bl,cl,dl) + hl[3]; + } else {// if (i<80) { + t += f5(bl,cl,dl) + hl[4]; + } + t = t|0; + t = rotl(t,sl[i]); + t = (t+el)|0; + al = el; + el = dl; + dl = rotl(cl, 10); + cl = bl; + bl = t; + + t = (ar + M[offset+zr[i]])|0; + if (i<16){ + t += f5(br,cr,dr) + hr[0]; + } else if (i<32) { + t += f4(br,cr,dr) + hr[1]; + } else if (i<48) { + t += f3(br,cr,dr) + hr[2]; + } else if (i<64) { + t += f2(br,cr,dr) + hr[3]; + } else {// if (i<80) { + t += f1(br,cr,dr) + hr[4]; + } + t = t|0; + t = rotl(t,sr[i]) ; + t = (t+er)|0; + ar = er; + er = dr; + dr = rotl(cr, 10); + cr = br; + br = t; + } + // Intermediate hash value + t = (H[1] + cl + dr)|0; + H[1] = (H[2] + dl + er)|0; + H[2] = (H[3] + el + ar)|0; + H[3] = (H[4] + al + br)|0; + H[4] = (H[0] + bl + cr)|0; + H[0] = t; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | + (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) + ); + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 5; i++) { + // Shortcut + var H_i = H[i]; + + // Swap + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + + function f1(x, y, z) { + return ((x) ^ (y) ^ (z)); + + } + + function f2(x, y, z) { + return (((x)&(y)) | ((~x)&(z))); + } + + function f3(x, y, z) { + return (((x) | (~(y))) ^ (z)); + } + + function f4(x, y, z) { + return (((x) & (z)) | ((y)&(~(z)))); + } + + function f5(x, y, z) { + return ((x) ^ ((y) |(~(z)))); + + } + + function rotl(x,n) { + return (x<>>(32-n)); + } + + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.RIPEMD160('message'); + * var hash = CryptoJS.RIPEMD160(wordArray); + */ + C.RIPEMD160 = Hasher._createHelper(RIPEMD160); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacRIPEMD160(message, key); + */ + C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); + }(Math)); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + + /** + * HMAC algorithm. + */ + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function (hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); + + // Convert string to WordArray, else assume WordArray already + if (typeof key == 'string') { + key = Utf8.parse(key); + } + + // Shortcuts + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; + + // Allow arbitrary length keys + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } + + // Clamp excess bits + key.clamp(); + + // Clone key for inner and outer pads + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); + + // Shortcuts + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; + + // XOR keys with pad constants + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; + + // Set initial values + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function () { + // Shortcut + var hasher = this._hasher; + + // Reset + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function (messageUpdate) { + this._hasher.update(messageUpdate); + + // Chainable + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Shortcut + var hasher = this._hasher; + + // Compute HMAC + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + + return hmac; + } + }); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA1 = C_algo.SHA1; + var HMAC = C_algo.HMAC; + + /** + * Password-Based Key Derivation Function 2 algorithm. + */ + var PBKDF2 = C_algo.PBKDF2 = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hasher to use. Default: SHA1 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: SHA1, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.PBKDF2.create(); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + // Shortcut + var cfg = this.cfg; + + // Init HMAC + var hmac = HMAC.create(cfg.hasher, password); + + // Initial values + var derivedKey = WordArray.create(); + var blockIndex = WordArray.create([0x00000001]); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var blockIndexWords = blockIndex.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + var block = hmac.update(salt).finalize(blockIndex); + hmac.reset(); + + // Shortcuts + var blockWords = block.words; + var blockWordsLength = blockWords.length; + + // Iterations + var intermediate = block; + for (var i = 1; i < iterations; i++) { + intermediate = hmac.finalize(intermediate); + hmac.reset(); + + // Shortcut + var intermediateWords = intermediate.words; + + // XOR intermediate with block + for (var j = 0; j < blockWordsLength; j++) { + blockWords[j] ^= intermediateWords[j]; + } + } + + derivedKey.concat(block); + blockIndexWords[0]++; + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.PBKDF2(password, salt); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.PBKDF2 = function (password, salt, cfg) { + return PBKDF2.create(cfg).compute(password, salt); + }; + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + var block; + + // Shortcut + var cfg = this.cfg; + + // Init hasher + var hasher = cfg.hasher.create(); + + // Initial values + var derivedKey = WordArray.create(); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + block = hasher.update(password).finalize(salt); + hasher.reset(); + + // Iterations + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + }()); + + + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function (key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function (key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); + }, + + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function (xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Store transform mode and key + this._xformMode = xformMode; + this._key = key; + + // Set initial values + this.reset(); + }, + + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-cipher logic + this._doReset(); + }, + + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function (dataUpdate) { + // Append + this._append(dataUpdate); + + // Process available blocks + return this._process(); + }, + + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function (dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } + + // Perform concrete-cipher logic + var finalProcessedData = this._doFinalize(); + + return finalProcessedData; + }, + + keySize: 128/32, + + ivSize: 128/32, + + _ENC_XFORM_MODE: 1, + + _DEC_XFORM_MODE: 2, + + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: (function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } + + return function (cipher) { + return { + encrypt: function (message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + + decrypt: function (ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }()) + }); + + /** + * Abstract base stream cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) + */ + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function () { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); + + return finalProcessedBlocks; + }, + + blockSize: 1 + }); + + /** + * Mode namespace. + */ + var C_mode = C.mode = {}; + + /** + * Abstract base block cipher mode template. + */ + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function (cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, + + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function (cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, + + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function (cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + + /** + * Cipher Block Chaining mode. + */ + var CBC = C_mode.CBC = (function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + + /** + * CBC encryptor. + */ + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // XOR and encrypt + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + /** + * CBC decryptor. + */ + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + // Decrypt and XOR + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + var block; + + // Shortcut + var iv = this._iv; + + // Choose mixing block + if (iv) { + block = iv; + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + block = this._prevBlock; + } + + // XOR blocks + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }()); + + /** + * Padding namespace. + */ + var C_pad = C.pad = {}; + + /** + * PKCS #5/7 padding strategy. + */ + var Pkcs7 = C_pad.Pkcs7 = { + /** + * Pads data using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); + */ + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Create padding word + var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; + + // Create padding + var paddingWords = []; + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + var padding = WordArray.create(paddingWords, nPaddingBytes); + + // Add padding + data.concat(padding); + }, + + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + + reset: function () { + var modeCreator; + + // Reset cipher + Cipher.reset.call(this); + + // Shortcuts + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; + + // Reset block mode + if (this._xformMode == this._ENC_XFORM_MODE) { + modeCreator = mode.createEncryptor; + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + modeCreator = mode.createDecryptor; + // Keep at least one block in the buffer for unpadding + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + + _doProcessBlock: function (words, offset) { + this._mode.processBlock(words, offset); + }, + + _doFinalize: function () { + var finalProcessedBlocks; + + // Shortcut + var padding = this.cfg.padding; + + // Finalize + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); + + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + + // Unpad data + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + + blockSize: 128/32 + }); + + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function (cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function (formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + + /** + * Format namespace. + */ + var C_format = C.format = {}; + + /** + * OpenSSL formatting strategy. + */ + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function (cipherParams) { + var wordArray; + + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; + + // Format + if (salt) { + wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function (openSSLStr) { + var salt; + + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); + + // Shortcut + var ciphertextWords = ciphertext.words; + + // Test for salt + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + salt = WordArray.create(ciphertextWords.slice(2, 4)); + + // Remove salt from ciphertext + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ ciphertext: ciphertext, salt: salt }); + } + }; + + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Encrypt + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); + + // Shortcut + var cipherCfg = encryptor.cfg; + + // Create and return serializable cipher params + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Decrypt + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function (ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + + /** + * Key derivation function namespace. + */ + var C_kdf = C.kdf = {}; + + /** + * OpenSSL key derivation function. + */ + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function (password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64/8); + } + + // Derive key and IV + var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); + + // Separate key and IV + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; + + // Return params + return CipherParams.create({ key: key, iv: iv, salt: salt }); + } + }; + + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Encrypt + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); + + // Mix in derived params + ciphertext.mixIn(derivedParams); + + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Decrypt + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + + return plaintext; + } + }); + }()); + + + /** + * Cipher Feedback block mode. + */ + CryptoJS.mode.CFB = (function () { + var CFB = CryptoJS.lib.BlockCipherMode.extend(); + + CFB.Encryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + CFB.Decryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { + var keystream; + + // Shortcut + var iv = this._iv; + + // Generate keystream + if (iv) { + keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + keystream = this._prevBlock; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + + return CFB; + }()); + + + /** + * Counter block mode. + */ + CryptoJS.mode.CTR = (function () { + var CTR = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = CTR.Encryptor = CTR.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Increment counter + counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTR.Decryptor = Encryptor; + + return CTR; + }()); + + + /** @preserve + * Counter block mode compatible with Dr Brian Gladman fileenc.c + * derived from CryptoJS.mode.CTR + * Jan Hruby jhruby.web@gmail.com + */ + CryptoJS.mode.CTRGladman = (function () { + var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); + + function incWord(word) + { + if (((word >> 24) & 0xff) === 0xff) { //overflow + var b1 = (word >> 16)&0xff; + var b2 = (word >> 8)&0xff; + var b3 = word & 0xff; + + if (b1 === 0xff) // overflow b1 + { + b1 = 0; + if (b2 === 0xff) + { + b2 = 0; + if (b3 === 0xff) + { + b3 = 0; + } + else + { + ++b3; + } + } + else + { + ++b2; + } + } + else + { + ++b1; + } + + word = 0; + word += (b1 << 16); + word += (b2 << 8); + word += b3; + } + else + { + word += (0x01 << 24); + } + return word; + } + + function incCounter(counter) + { + if ((counter[0] = incWord(counter[0])) === 0) + { + // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 + counter[1] = incWord(counter[1]); + } + return counter; + } + + var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + + incCounter(counter); + + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTRGladman.Decryptor = Encryptor; + + return CTRGladman; + }()); + + + + + /** + * Output Feedback block mode. + */ + CryptoJS.mode.OFB = (function () { + var OFB = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = OFB.Encryptor = OFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var keystream = this._keystream; + + // Generate keystream + if (iv) { + keystream = this._keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + OFB.Decryptor = Encryptor; + + return OFB; + }()); + + + /** + * Electronic Codebook block mode. + */ + CryptoJS.mode.ECB = (function () { + var ECB = CryptoJS.lib.BlockCipherMode.extend(); + + ECB.Encryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.encryptBlock(words, offset); + } + }); + + ECB.Decryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.decryptBlock(words, offset); + } + }); + + return ECB; + }()); + + + /** + * ANSI X.923 padding strategy. + */ + CryptoJS.pad.AnsiX923 = { + pad: function (data, blockSize) { + // Shortcuts + var dataSigBytes = data.sigBytes; + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; + + // Compute last byte position + var lastBytePos = dataSigBytes + nPaddingBytes - 1; + + // Pad + data.clamp(); + data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); + data.sigBytes += nPaddingBytes; + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + /** + * ISO 10126 padding strategy. + */ + CryptoJS.pad.Iso10126 = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Pad + data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). + concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + /** + * ISO/IEC 9797-1 Padding Method 2. + */ + CryptoJS.pad.Iso97971 = { + pad: function (data, blockSize) { + // Add 0x80 byte + data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); + + // Zero pad the rest + CryptoJS.pad.ZeroPadding.pad(data, blockSize); + }, + + unpad: function (data) { + // Remove zero padding + CryptoJS.pad.ZeroPadding.unpad(data); + + // Remove one more byte -- the 0x80 byte + data.sigBytes--; + } + }; + + + /** + * Zero padding strategy. + */ + CryptoJS.pad.ZeroPadding = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Pad + data.clamp(); + data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); + }, + + unpad: function (data) { + // Shortcut + var dataWords = data.words; + + // Unpad + var i = data.sigBytes - 1; + for (var i = data.sigBytes - 1; i >= 0; i--) { + if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { + data.sigBytes = i + 1; + break; + } + } + } + }; + + + /** + * A noop padding strategy. + */ + CryptoJS.pad.NoPadding = { + pad: function () { + }, + + unpad: function () { + } + }; + + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var CipherParams = C_lib.CipherParams; + var C_enc = C.enc; + var Hex = C_enc.Hex; + var C_format = C.format; + + var HexFormatter = C_format.Hex = { + /** + * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The hexadecimally encoded string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.format.Hex.stringify(cipherParams); + */ + stringify: function (cipherParams) { + return cipherParams.ciphertext.toString(Hex); + }, + + /** + * Converts a hexadecimally encoded ciphertext string to a cipher params object. + * + * @param {string} input The hexadecimally encoded string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.Hex.parse(hexString); + */ + parse: function (input) { + var ciphertext = Hex.parse(input); + return CipherParams.create({ ciphertext: ciphertext }); + } + }; + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Lookup tables + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; + + // Compute lookup tables + (function () { + // Compute double table + var d = []; + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = (i << 1) ^ 0x11b; + } + } + + // Walk GF(2^8) + var x = 0; + var xi = 0; + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; + + // Compute multiplication + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; + + // Compute sub bytes, mix columns tables + var t = (d[sx] * 0x101) ^ (sx * 0x1010100); + SUB_MIX_0[x] = (t << 24) | (t >>> 8); + SUB_MIX_1[x] = (t << 16) | (t >>> 16); + SUB_MIX_2[x] = (t << 8) | (t >>> 24); + SUB_MIX_3[x] = t; + + // Compute inv sub bytes, inv mix columns tables + var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); + INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); + INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); + INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); + INV_SUB_MIX_3[sx] = t; + + // Compute next counter + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + }()); + + // Precomputed Rcon lookup + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + + /** + * AES block cipher algorithm. + */ + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function () { + var t; + + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } + + // Shortcuts + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; + + // Compute number of rounds + var nRounds = this._nRounds = keySize + 6; + + // Compute number of key schedule rows + var ksRows = (nRounds + 1) * 4; + + // Compute key schedule + var keySchedule = this._keySchedule = []; + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = (t << 8) | (t >>> 24); + + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + + // Mix Rcon + t ^= RCON[(ksRow / keySize) | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } + + // Compute inv key schedule + var invKeySchedule = this._invKeySchedule = []; + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ + INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + + decryptBlock: function (M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); + + // Inv swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + + _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; + + // Get input, add round key + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; + + // Key schedule row counter + var ksRow = 4; + + // Rounds + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; + + // Update state + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } + + // Shift rows, sub bytes, add round key + var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; + + // Set output + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + + keySize: 256/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); + */ + C.AES = BlockCipher._createHelper(AES); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Permuted Choice 1 constants + var PC1 = [ + 57, 49, 41, 33, 25, 17, 9, 1, + 58, 50, 42, 34, 26, 18, 10, 2, + 59, 51, 43, 35, 27, 19, 11, 3, + 60, 52, 44, 36, 63, 55, 47, 39, + 31, 23, 15, 7, 62, 54, 46, 38, + 30, 22, 14, 6, 61, 53, 45, 37, + 29, 21, 13, 5, 28, 20, 12, 4 + ]; + + // Permuted Choice 2 constants + var PC2 = [ + 14, 17, 11, 24, 1, 5, + 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, + 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, + 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, + 46, 42, 50, 36, 29, 32 + ]; + + // Cumulative bit shift constants + var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; + + // SBOXes and round permutation constants + var SBOX_P = [ + { + 0x0: 0x808200, + 0x10000000: 0x8000, + 0x20000000: 0x808002, + 0x30000000: 0x2, + 0x40000000: 0x200, + 0x50000000: 0x808202, + 0x60000000: 0x800202, + 0x70000000: 0x800000, + 0x80000000: 0x202, + 0x90000000: 0x800200, + 0xa0000000: 0x8200, + 0xb0000000: 0x808000, + 0xc0000000: 0x8002, + 0xd0000000: 0x800002, + 0xe0000000: 0x0, + 0xf0000000: 0x8202, + 0x8000000: 0x0, + 0x18000000: 0x808202, + 0x28000000: 0x8202, + 0x38000000: 0x8000, + 0x48000000: 0x808200, + 0x58000000: 0x200, + 0x68000000: 0x808002, + 0x78000000: 0x2, + 0x88000000: 0x800200, + 0x98000000: 0x8200, + 0xa8000000: 0x808000, + 0xb8000000: 0x800202, + 0xc8000000: 0x800002, + 0xd8000000: 0x8002, + 0xe8000000: 0x202, + 0xf8000000: 0x800000, + 0x1: 0x8000, + 0x10000001: 0x2, + 0x20000001: 0x808200, + 0x30000001: 0x800000, + 0x40000001: 0x808002, + 0x50000001: 0x8200, + 0x60000001: 0x200, + 0x70000001: 0x800202, + 0x80000001: 0x808202, + 0x90000001: 0x808000, + 0xa0000001: 0x800002, + 0xb0000001: 0x8202, + 0xc0000001: 0x202, + 0xd0000001: 0x800200, + 0xe0000001: 0x8002, + 0xf0000001: 0x0, + 0x8000001: 0x808202, + 0x18000001: 0x808000, + 0x28000001: 0x800000, + 0x38000001: 0x200, + 0x48000001: 0x8000, + 0x58000001: 0x800002, + 0x68000001: 0x2, + 0x78000001: 0x8202, + 0x88000001: 0x8002, + 0x98000001: 0x800202, + 0xa8000001: 0x202, + 0xb8000001: 0x808200, + 0xc8000001: 0x800200, + 0xd8000001: 0x0, + 0xe8000001: 0x8200, + 0xf8000001: 0x808002 + }, + { + 0x0: 0x40084010, + 0x1000000: 0x4000, + 0x2000000: 0x80000, + 0x3000000: 0x40080010, + 0x4000000: 0x40000010, + 0x5000000: 0x40084000, + 0x6000000: 0x40004000, + 0x7000000: 0x10, + 0x8000000: 0x84000, + 0x9000000: 0x40004010, + 0xa000000: 0x40000000, + 0xb000000: 0x84010, + 0xc000000: 0x80010, + 0xd000000: 0x0, + 0xe000000: 0x4010, + 0xf000000: 0x40080000, + 0x800000: 0x40004000, + 0x1800000: 0x84010, + 0x2800000: 0x10, + 0x3800000: 0x40004010, + 0x4800000: 0x40084010, + 0x5800000: 0x40000000, + 0x6800000: 0x80000, + 0x7800000: 0x40080010, + 0x8800000: 0x80010, + 0x9800000: 0x0, + 0xa800000: 0x4000, + 0xb800000: 0x40080000, + 0xc800000: 0x40000010, + 0xd800000: 0x84000, + 0xe800000: 0x40084000, + 0xf800000: 0x4010, + 0x10000000: 0x0, + 0x11000000: 0x40080010, + 0x12000000: 0x40004010, + 0x13000000: 0x40084000, + 0x14000000: 0x40080000, + 0x15000000: 0x10, + 0x16000000: 0x84010, + 0x17000000: 0x4000, + 0x18000000: 0x4010, + 0x19000000: 0x80000, + 0x1a000000: 0x80010, + 0x1b000000: 0x40000010, + 0x1c000000: 0x84000, + 0x1d000000: 0x40004000, + 0x1e000000: 0x40000000, + 0x1f000000: 0x40084010, + 0x10800000: 0x84010, + 0x11800000: 0x80000, + 0x12800000: 0x40080000, + 0x13800000: 0x4000, + 0x14800000: 0x40004000, + 0x15800000: 0x40084010, + 0x16800000: 0x10, + 0x17800000: 0x40000000, + 0x18800000: 0x40084000, + 0x19800000: 0x40000010, + 0x1a800000: 0x40004010, + 0x1b800000: 0x80010, + 0x1c800000: 0x0, + 0x1d800000: 0x4010, + 0x1e800000: 0x40080010, + 0x1f800000: 0x84000 + }, + { + 0x0: 0x104, + 0x100000: 0x0, + 0x200000: 0x4000100, + 0x300000: 0x10104, + 0x400000: 0x10004, + 0x500000: 0x4000004, + 0x600000: 0x4010104, + 0x700000: 0x4010000, + 0x800000: 0x4000000, + 0x900000: 0x4010100, + 0xa00000: 0x10100, + 0xb00000: 0x4010004, + 0xc00000: 0x4000104, + 0xd00000: 0x10000, + 0xe00000: 0x4, + 0xf00000: 0x100, + 0x80000: 0x4010100, + 0x180000: 0x4010004, + 0x280000: 0x0, + 0x380000: 0x4000100, + 0x480000: 0x4000004, + 0x580000: 0x10000, + 0x680000: 0x10004, + 0x780000: 0x104, + 0x880000: 0x4, + 0x980000: 0x100, + 0xa80000: 0x4010000, + 0xb80000: 0x10104, + 0xc80000: 0x10100, + 0xd80000: 0x4000104, + 0xe80000: 0x4010104, + 0xf80000: 0x4000000, + 0x1000000: 0x4010100, + 0x1100000: 0x10004, + 0x1200000: 0x10000, + 0x1300000: 0x4000100, + 0x1400000: 0x100, + 0x1500000: 0x4010104, + 0x1600000: 0x4000004, + 0x1700000: 0x0, + 0x1800000: 0x4000104, + 0x1900000: 0x4000000, + 0x1a00000: 0x4, + 0x1b00000: 0x10100, + 0x1c00000: 0x4010000, + 0x1d00000: 0x104, + 0x1e00000: 0x10104, + 0x1f00000: 0x4010004, + 0x1080000: 0x4000000, + 0x1180000: 0x104, + 0x1280000: 0x4010100, + 0x1380000: 0x0, + 0x1480000: 0x10004, + 0x1580000: 0x4000100, + 0x1680000: 0x100, + 0x1780000: 0x4010004, + 0x1880000: 0x10000, + 0x1980000: 0x4010104, + 0x1a80000: 0x10104, + 0x1b80000: 0x4000004, + 0x1c80000: 0x4000104, + 0x1d80000: 0x4010000, + 0x1e80000: 0x4, + 0x1f80000: 0x10100 + }, + { + 0x0: 0x80401000, + 0x10000: 0x80001040, + 0x20000: 0x401040, + 0x30000: 0x80400000, + 0x40000: 0x0, + 0x50000: 0x401000, + 0x60000: 0x80000040, + 0x70000: 0x400040, + 0x80000: 0x80000000, + 0x90000: 0x400000, + 0xa0000: 0x40, + 0xb0000: 0x80001000, + 0xc0000: 0x80400040, + 0xd0000: 0x1040, + 0xe0000: 0x1000, + 0xf0000: 0x80401040, + 0x8000: 0x80001040, + 0x18000: 0x40, + 0x28000: 0x80400040, + 0x38000: 0x80001000, + 0x48000: 0x401000, + 0x58000: 0x80401040, + 0x68000: 0x0, + 0x78000: 0x80400000, + 0x88000: 0x1000, + 0x98000: 0x80401000, + 0xa8000: 0x400000, + 0xb8000: 0x1040, + 0xc8000: 0x80000000, + 0xd8000: 0x400040, + 0xe8000: 0x401040, + 0xf8000: 0x80000040, + 0x100000: 0x400040, + 0x110000: 0x401000, + 0x120000: 0x80000040, + 0x130000: 0x0, + 0x140000: 0x1040, + 0x150000: 0x80400040, + 0x160000: 0x80401000, + 0x170000: 0x80001040, + 0x180000: 0x80401040, + 0x190000: 0x80000000, + 0x1a0000: 0x80400000, + 0x1b0000: 0x401040, + 0x1c0000: 0x80001000, + 0x1d0000: 0x400000, + 0x1e0000: 0x40, + 0x1f0000: 0x1000, + 0x108000: 0x80400000, + 0x118000: 0x80401040, + 0x128000: 0x0, + 0x138000: 0x401000, + 0x148000: 0x400040, + 0x158000: 0x80000000, + 0x168000: 0x80001040, + 0x178000: 0x40, + 0x188000: 0x80000040, + 0x198000: 0x1000, + 0x1a8000: 0x80001000, + 0x1b8000: 0x80400040, + 0x1c8000: 0x1040, + 0x1d8000: 0x80401000, + 0x1e8000: 0x400000, + 0x1f8000: 0x401040 + }, + { + 0x0: 0x80, + 0x1000: 0x1040000, + 0x2000: 0x40000, + 0x3000: 0x20000000, + 0x4000: 0x20040080, + 0x5000: 0x1000080, + 0x6000: 0x21000080, + 0x7000: 0x40080, + 0x8000: 0x1000000, + 0x9000: 0x20040000, + 0xa000: 0x20000080, + 0xb000: 0x21040080, + 0xc000: 0x21040000, + 0xd000: 0x0, + 0xe000: 0x1040080, + 0xf000: 0x21000000, + 0x800: 0x1040080, + 0x1800: 0x21000080, + 0x2800: 0x80, + 0x3800: 0x1040000, + 0x4800: 0x40000, + 0x5800: 0x20040080, + 0x6800: 0x21040000, + 0x7800: 0x20000000, + 0x8800: 0x20040000, + 0x9800: 0x0, + 0xa800: 0x21040080, + 0xb800: 0x1000080, + 0xc800: 0x20000080, + 0xd800: 0x21000000, + 0xe800: 0x1000000, + 0xf800: 0x40080, + 0x10000: 0x40000, + 0x11000: 0x80, + 0x12000: 0x20000000, + 0x13000: 0x21000080, + 0x14000: 0x1000080, + 0x15000: 0x21040000, + 0x16000: 0x20040080, + 0x17000: 0x1000000, + 0x18000: 0x21040080, + 0x19000: 0x21000000, + 0x1a000: 0x1040000, + 0x1b000: 0x20040000, + 0x1c000: 0x40080, + 0x1d000: 0x20000080, + 0x1e000: 0x0, + 0x1f000: 0x1040080, + 0x10800: 0x21000080, + 0x11800: 0x1000000, + 0x12800: 0x1040000, + 0x13800: 0x20040080, + 0x14800: 0x20000000, + 0x15800: 0x1040080, + 0x16800: 0x80, + 0x17800: 0x21040000, + 0x18800: 0x40080, + 0x19800: 0x21040080, + 0x1a800: 0x0, + 0x1b800: 0x21000000, + 0x1c800: 0x1000080, + 0x1d800: 0x40000, + 0x1e800: 0x20040000, + 0x1f800: 0x20000080 + }, + { + 0x0: 0x10000008, + 0x100: 0x2000, + 0x200: 0x10200000, + 0x300: 0x10202008, + 0x400: 0x10002000, + 0x500: 0x200000, + 0x600: 0x200008, + 0x700: 0x10000000, + 0x800: 0x0, + 0x900: 0x10002008, + 0xa00: 0x202000, + 0xb00: 0x8, + 0xc00: 0x10200008, + 0xd00: 0x202008, + 0xe00: 0x2008, + 0xf00: 0x10202000, + 0x80: 0x10200000, + 0x180: 0x10202008, + 0x280: 0x8, + 0x380: 0x200000, + 0x480: 0x202008, + 0x580: 0x10000008, + 0x680: 0x10002000, + 0x780: 0x2008, + 0x880: 0x200008, + 0x980: 0x2000, + 0xa80: 0x10002008, + 0xb80: 0x10200008, + 0xc80: 0x0, + 0xd80: 0x10202000, + 0xe80: 0x202000, + 0xf80: 0x10000000, + 0x1000: 0x10002000, + 0x1100: 0x10200008, + 0x1200: 0x10202008, + 0x1300: 0x2008, + 0x1400: 0x200000, + 0x1500: 0x10000000, + 0x1600: 0x10000008, + 0x1700: 0x202000, + 0x1800: 0x202008, + 0x1900: 0x0, + 0x1a00: 0x8, + 0x1b00: 0x10200000, + 0x1c00: 0x2000, + 0x1d00: 0x10002008, + 0x1e00: 0x10202000, + 0x1f00: 0x200008, + 0x1080: 0x8, + 0x1180: 0x202000, + 0x1280: 0x200000, + 0x1380: 0x10000008, + 0x1480: 0x10002000, + 0x1580: 0x2008, + 0x1680: 0x10202008, + 0x1780: 0x10200000, + 0x1880: 0x10202000, + 0x1980: 0x10200008, + 0x1a80: 0x2000, + 0x1b80: 0x202008, + 0x1c80: 0x200008, + 0x1d80: 0x0, + 0x1e80: 0x10000000, + 0x1f80: 0x10002008 + }, + { + 0x0: 0x100000, + 0x10: 0x2000401, + 0x20: 0x400, + 0x30: 0x100401, + 0x40: 0x2100401, + 0x50: 0x0, + 0x60: 0x1, + 0x70: 0x2100001, + 0x80: 0x2000400, + 0x90: 0x100001, + 0xa0: 0x2000001, + 0xb0: 0x2100400, + 0xc0: 0x2100000, + 0xd0: 0x401, + 0xe0: 0x100400, + 0xf0: 0x2000000, + 0x8: 0x2100001, + 0x18: 0x0, + 0x28: 0x2000401, + 0x38: 0x2100400, + 0x48: 0x100000, + 0x58: 0x2000001, + 0x68: 0x2000000, + 0x78: 0x401, + 0x88: 0x100401, + 0x98: 0x2000400, + 0xa8: 0x2100000, + 0xb8: 0x100001, + 0xc8: 0x400, + 0xd8: 0x2100401, + 0xe8: 0x1, + 0xf8: 0x100400, + 0x100: 0x2000000, + 0x110: 0x100000, + 0x120: 0x2000401, + 0x130: 0x2100001, + 0x140: 0x100001, + 0x150: 0x2000400, + 0x160: 0x2100400, + 0x170: 0x100401, + 0x180: 0x401, + 0x190: 0x2100401, + 0x1a0: 0x100400, + 0x1b0: 0x1, + 0x1c0: 0x0, + 0x1d0: 0x2100000, + 0x1e0: 0x2000001, + 0x1f0: 0x400, + 0x108: 0x100400, + 0x118: 0x2000401, + 0x128: 0x2100001, + 0x138: 0x1, + 0x148: 0x2000000, + 0x158: 0x100000, + 0x168: 0x401, + 0x178: 0x2100400, + 0x188: 0x2000001, + 0x198: 0x2100000, + 0x1a8: 0x0, + 0x1b8: 0x2100401, + 0x1c8: 0x100401, + 0x1d8: 0x400, + 0x1e8: 0x2000400, + 0x1f8: 0x100001 + }, + { + 0x0: 0x8000820, + 0x1: 0x20000, + 0x2: 0x8000000, + 0x3: 0x20, + 0x4: 0x20020, + 0x5: 0x8020820, + 0x6: 0x8020800, + 0x7: 0x800, + 0x8: 0x8020000, + 0x9: 0x8000800, + 0xa: 0x20800, + 0xb: 0x8020020, + 0xc: 0x820, + 0xd: 0x0, + 0xe: 0x8000020, + 0xf: 0x20820, + 0x80000000: 0x800, + 0x80000001: 0x8020820, + 0x80000002: 0x8000820, + 0x80000003: 0x8000000, + 0x80000004: 0x8020000, + 0x80000005: 0x20800, + 0x80000006: 0x20820, + 0x80000007: 0x20, + 0x80000008: 0x8000020, + 0x80000009: 0x820, + 0x8000000a: 0x20020, + 0x8000000b: 0x8020800, + 0x8000000c: 0x0, + 0x8000000d: 0x8020020, + 0x8000000e: 0x8000800, + 0x8000000f: 0x20000, + 0x10: 0x20820, + 0x11: 0x8020800, + 0x12: 0x20, + 0x13: 0x800, + 0x14: 0x8000800, + 0x15: 0x8000020, + 0x16: 0x8020020, + 0x17: 0x20000, + 0x18: 0x0, + 0x19: 0x20020, + 0x1a: 0x8020000, + 0x1b: 0x8000820, + 0x1c: 0x8020820, + 0x1d: 0x20800, + 0x1e: 0x820, + 0x1f: 0x8000000, + 0x80000010: 0x20000, + 0x80000011: 0x800, + 0x80000012: 0x8020020, + 0x80000013: 0x20820, + 0x80000014: 0x20, + 0x80000015: 0x8020000, + 0x80000016: 0x8000000, + 0x80000017: 0x8000820, + 0x80000018: 0x8020820, + 0x80000019: 0x8000020, + 0x8000001a: 0x8000800, + 0x8000001b: 0x0, + 0x8000001c: 0x20800, + 0x8000001d: 0x820, + 0x8000001e: 0x20020, + 0x8000001f: 0x8020800 + } + ]; + + // Masks that select the SBOX input + var SBOX_MASK = [ + 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, + 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f + ]; + + /** + * DES block cipher algorithm. + */ + var DES = C_algo.DES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + + // Select 56 bits according to PC1 + var keyBits = []; + for (var i = 0; i < 56; i++) { + var keyBitPos = PC1[i] - 1; + keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; + } + + // Assemble 16 subkeys + var subKeys = this._subKeys = []; + for (var nSubKey = 0; nSubKey < 16; nSubKey++) { + // Create subkey + var subKey = subKeys[nSubKey] = []; + + // Shortcut + var bitShift = BIT_SHIFTS[nSubKey]; + + // Select 48 bits according to PC2 + for (var i = 0; i < 24; i++) { + // Select from the left 28 key bits + subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); + + // Select from the right 28 key bits + subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); + } + + // Since each subkey is applied to an expanded 32-bit input, + // the subkey can be broken into 8 values scaled to 32-bits, + // which allows the key to be used without expansion + subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); + for (var i = 1; i < 7; i++) { + subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); + } + subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); + } + + // Compute inverse subkeys + var invSubKeys = this._invSubKeys = []; + for (var i = 0; i < 16; i++) { + invSubKeys[i] = subKeys[15 - i]; + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._subKeys); + }, + + decryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._invSubKeys); + }, + + _doCryptBlock: function (M, offset, subKeys) { + // Get input + this._lBlock = M[offset]; + this._rBlock = M[offset + 1]; + + // Initial permutation + exchangeLR.call(this, 4, 0x0f0f0f0f); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeRL.call(this, 2, 0x33333333); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeLR.call(this, 1, 0x55555555); + + // Rounds + for (var round = 0; round < 16; round++) { + // Shortcuts + var subKey = subKeys[round]; + var lBlock = this._lBlock; + var rBlock = this._rBlock; + + // Feistel function + var f = 0; + for (var i = 0; i < 8; i++) { + f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; + } + this._lBlock = rBlock; + this._rBlock = lBlock ^ f; + } + + // Undo swap from last round + var t = this._lBlock; + this._lBlock = this._rBlock; + this._rBlock = t; + + // Final permutation + exchangeLR.call(this, 1, 0x55555555); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeRL.call(this, 2, 0x33333333); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeLR.call(this, 4, 0x0f0f0f0f); + + // Set output + M[offset] = this._lBlock; + M[offset + 1] = this._rBlock; + }, + + keySize: 64/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + // Swap bits across the left and right words + function exchangeLR(offset, mask) { + var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; + this._rBlock ^= t; + this._lBlock ^= t << offset; + } + + function exchangeRL(offset, mask) { + var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; + this._lBlock ^= t; + this._rBlock ^= t << offset; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); + */ + C.DES = BlockCipher._createHelper(DES); + + /** + * Triple-DES block cipher algorithm. + */ + var TripleDES = C_algo.TripleDES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + // Make sure the key length is valid (64, 128 or >= 192 bit) + if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) { + throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.'); + } + + // Extend the key according to the keying options defined in 3DES standard + var key1 = keyWords.slice(0, 2); + var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4); + var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6); + + // Create DES instances + this._des1 = DES.createEncryptor(WordArray.create(key1)); + this._des2 = DES.createEncryptor(WordArray.create(key2)); + this._des3 = DES.createEncryptor(WordArray.create(key3)); + }, + + encryptBlock: function (M, offset) { + this._des1.encryptBlock(M, offset); + this._des2.decryptBlock(M, offset); + this._des3.encryptBlock(M, offset); + }, + + decryptBlock: function (M, offset) { + this._des3.decryptBlock(M, offset); + this._des2.encryptBlock(M, offset); + this._des1.decryptBlock(M, offset); + }, + + keySize: 192/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); + */ + C.TripleDES = BlockCipher._createHelper(TripleDES); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + /** + * RC4 stream cipher algorithm. + */ + var RC4 = C_algo.RC4 = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + var keySigBytes = key.sigBytes; + + // Init sbox + var S = this._S = []; + for (var i = 0; i < 256; i++) { + S[i] = i; + } + + // Key setup + for (var i = 0, j = 0; i < 256; i++) { + var keyByteIndex = i % keySigBytes; + var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; + + j = (j + S[i] + keyByte) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + } + + // Counters + this._i = this._j = 0; + }, + + _doProcessBlock: function (M, offset) { + M[offset] ^= generateKeystreamWord.call(this); + }, + + keySize: 256/32, + + ivSize: 0 + }); + + function generateKeystreamWord() { + // Shortcuts + var S = this._S; + var i = this._i; + var j = this._j; + + // Generate keystream word + var keystreamWord = 0; + for (var n = 0; n < 4; n++) { + i = (i + 1) % 256; + j = (j + S[i]) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + + keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); + } + + // Update counters + this._i = i; + this._j = j; + + return keystreamWord; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); + */ + C.RC4 = StreamCipher._createHelper(RC4); + + /** + * Modified RC4 stream cipher algorithm. + */ + var RC4Drop = C_algo.RC4Drop = RC4.extend({ + /** + * Configuration options. + * + * @property {number} drop The number of keystream words to drop. Default 192 + */ + cfg: RC4.cfg.extend({ + drop: 192 + }), + + _doReset: function () { + RC4._doReset.call(this); + + // Drop + for (var i = this.cfg.drop; i > 0; i--) { + generateKeystreamWord.call(this); + } + } + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); + */ + C.RC4Drop = StreamCipher._createHelper(RC4Drop); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm + */ + var Rabbit = C_algo.Rabbit = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Swap endian + for (var i = 0; i < 4; i++) { + K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | + (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); + } + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); + * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); + */ + C.Rabbit = StreamCipher._createHelper(Rabbit); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm. + * + * This is a legacy version that neglected to convert the key to little-endian. + * This error doesn't affect the cipher's security, + * but it does affect its compatibility with other implementations. + */ + var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); + */ + C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); + }()); + + + return CryptoJS; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/docs/QuickStartGuide.wiki b/node_modules/_crypto-js@4.1.1@crypto-js/docs/QuickStartGuide.wiki new file mode 100644 index 0000000..2bee35d --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/docs/QuickStartGuide.wiki @@ -0,0 +1,470 @@ + + +---- + += Quick-start Guide = + +== Hashers == + +=== The Hasher Algorithms === + +==== MD5 ==== + +MD5 is a widely used hash function. It's been used in a variety of security applications and is also commonly used to check the integrity of files. Though, MD5 is not collision resistant, and it isn't suitable for applications like SSL certificates or digital signatures that rely on this property. + +{{{ + + +}}} + +==== SHA-1 ==== + +The SHA hash functions were designed by the National Security Agency (NSA). SHA-1 is the most established of the existing SHA hash functions, and it's used in a variety of security applications and protocols. Though, SHA-1's collision resistance has been weakening as new attacks are discovered or improved. + +{{{ + + +}}} + +==== SHA-2 ==== + +SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it appears to provide much better security. + +{{{ + + +}}} + +SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32. + +{{{ + + +}}} + +CryptoJS also supports SHA-224 and SHA-384, which are largely identical but truncated versions of SHA-256 and SHA-512 respectively. + +==== SHA-3 ==== + +SHA-3 is the winner of a five-year competition to select a new cryptographic hash algorithm where 64 competing designs were evaluated. + +{{{ + + +}}} + +SHA-3 can be configured to output hash lengths of one of 224, 256, 384, or 512 bits. The default is 512 bits. + +{{{ + + +}}} + +==== RIPEMD-160 ==== + +{{{ + + +}}} + +=== The Hasher Input === + +The hash algorithms accept either strings or instances of CryptoJS.lib.WordArray. A WordArray object represents an array of 32-bit words. When you pass a string, it's automatically converted to a WordArray encoded as UTF-8. + +=== The Hasher Output === + +The hash you get back isn't a string yet. It's a WordArray object. When you use a WordArray object in a string context, it's automatically converted to a hex string. + +{{{ + + +}}} + +You can convert a WordArray object to other formats by explicitly calling the toString method and passing an encoder. + +{{{ + + + +}}} + +=== Progressive Hashing === + +{{{ + + +}}} + +== HMAC == + +Keyed-hash message authentication codes (HMAC) is a mechanism for message authentication using cryptographic hash functions. + +HMAC can be used in combination with any iterated cryptographic hash function. + +{{{ + + + + + +}}} + +=== Progressive HMAC Hashing === + +{{{ + + +}}} + +== PBKDF2 == + +PBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required. + +A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack. + +{{{ + + +}}} + +== Ciphers == + +=== The Cipher Algorithms === + +==== AES ==== + +The Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated. + +{{{ + + +}}} + +CryptoJS supports AES-128, AES-192, and AES-256. It will pick the variant by the size of the key you pass in. If you use a passphrase, then it will generate a 256-bit key. + +==== DES, Triple DES ==== + +DES is a previously dominant algorithm for encryption, and was published as an official Federal Information Processing Standard (FIPS). DES is now considered to be insecure due to the small key size. + +{{{ + + +}}} + +Triple DES applies DES three times to each block to increase the key size. The algorithm is believed to be secure in this form. + +{{{ + + +}}} + +==== Rabbit ==== + +Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2-year process where 22 designs were evaluated. + +{{{ + + +}}} + +==== RC4, RC4Drop ==== + +RC4 is a widely-used stream cipher. It's used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security. + +{{{ + + +}}} + +It was discovered that the first few bytes of keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop. + +By default, 192 words (768 bytes) are dropped, but you can configure the algorithm to drop any number of words. + +{{{ + + +}}} + +=== Custom Key and IV === + +{{{ + + +}}} + +=== Block Modes and Padding === + +{{{ + + + + +}}} + +CryptoJS supports the following modes: + + * CBC (the default) + * CFB + * CTR + * OFB + * ECB + +And CryptoJS supports the following padding schemes: + + * Pkcs7 (the default) + * Iso97971 + * AnsiX923 + * Iso10126 + * ZeroPadding + * NoPadding + +=== The Cipher Input === + +For the plaintext message, the cipher algorithms accept either strings or instances of CryptoJS.lib.WordArray. + +For the key, when you pass a string, it's treated as a passphrase and used to derive an actual key and IV. Or you can pass a WordArray that represents the actual key. If you pass the actual key, you must also pass the actual IV. + +For the ciphertext, the cipher algorithms accept either strings or instances of CryptoJS.lib.CipherParams. A CipherParams object represents a collection of parameters such as the IV, a salt, and the raw ciphertext itself. When you pass a string, it's automatically converted to a CipherParams object according to a configurable format strategy. + +=== The Cipher Output === + +The plaintext you get back after decryption is a WordArray object. See Hashers' Output for more detail. + +The ciphertext you get back after encryption isn't a string yet. It's a CipherParams object. A CipherParams object gives you access to all the parameters used during encryption. When you use a CipherParams object in a string context, it's automatically converted to a string according to a format strategy. The default is an OpenSSL-compatible format. + +{{{ + + +}}} + +You can define your own formats in order to be compatible with other crypto implementations. A format is an object with two methods—stringify and parse—that converts between CipherParams objects and ciphertext strings. + +Here's how you might write a JSON formatter: + +{{{ + + +}}} + +=== Progressive Ciphering === + +{{{ + + +}}} + +=== Interoperability === + +==== With OpenSSL ==== + +Encrypt with OpenSSL: + +{{{ +openssl enc -aes-256-cbc -in infile -out outfile -pass pass:"Secret Passphrase" -e -base64 +}}} + +Decrypt with CryptoJS: + +{{{ + + +}}} + +== Encoders == + +CryptoJS can convert from encoding formats such as Base64, Latin1 or Hex to WordArray objects and vica versa. + +{{{ + + + + +}}} \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/enc-base64.js b/node_modules/_crypto-js@4.1.1@crypto-js/enc-base64.js new file mode 100644 index 0000000..0ffcd53 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/enc-base64.js @@ -0,0 +1,136 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64 encoding strategy. + */ + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function (base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + + return CryptoJS.enc.Base64; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/enc-base64url.js b/node_modules/_crypto-js@4.1.1@crypto-js/enc-base64url.js new file mode 100644 index 0000000..2468912 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/enc-base64url.js @@ -0,0 +1,140 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64url encoding strategy. + */ + var Base64url = C_enc.Base64url = { + /** + * Converts a word array to a Base64url string. + * + * @param {WordArray} wordArray The word array. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {string} The Base64url string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64url.stringify(wordArray); + */ + stringify: function (wordArray, urlSafe=true) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = urlSafe ? this._safe_map : this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64url string to a word array. + * + * @param {string} base64Str The Base64url string. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64url.parse(base64String); + */ + parse: function (base64Str, urlSafe=true) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = urlSafe ? this._safe_map : this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', + _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + return CryptoJS.enc.Base64url; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/enc-hex.js b/node_modules/_crypto-js@4.1.1@crypto-js/enc-hex.js new file mode 100644 index 0000000..88161ff --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/enc-hex.js @@ -0,0 +1,18 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.enc.Hex; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/enc-latin1.js b/node_modules/_crypto-js@4.1.1@crypto-js/enc-latin1.js new file mode 100644 index 0000000..ade56dc --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/enc-latin1.js @@ -0,0 +1,18 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.enc.Latin1; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/enc-utf16.js b/node_modules/_crypto-js@4.1.1@crypto-js/enc-utf16.js new file mode 100644 index 0000000..7de6245 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/enc-utf16.js @@ -0,0 +1,149 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * UTF-16 BE encoding strategy. + */ + var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { + /** + * Converts a word array to a UTF-16 BE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 BE string. + * + * @static + * + * @example + * + * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 BE string to a word array. + * + * @param {string} utf16Str The UTF-16 BE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + /** + * UTF-16 LE encoding strategy. + */ + C_enc.Utf16LE = { + /** + * Converts a word array to a UTF-16 LE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 LE string. + * + * @static + * + * @example + * + * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 LE string to a word array. + * + * @param {string} utf16Str The UTF-16 LE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + function swapEndian(word) { + return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); + } + }()); + + + return CryptoJS.enc.Utf16; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/enc-utf8.js b/node_modules/_crypto-js@4.1.1@crypto-js/enc-utf8.js new file mode 100644 index 0000000..e7a251d --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/enc-utf8.js @@ -0,0 +1,18 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.enc.Utf8; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/evpkdf.js b/node_modules/_crypto-js@4.1.1@crypto-js/evpkdf.js new file mode 100644 index 0000000..578974a --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/evpkdf.js @@ -0,0 +1,134 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha1", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + var block; + + // Shortcut + var cfg = this.cfg; + + // Init hasher + var hasher = cfg.hasher.create(); + + // Initial values + var derivedKey = WordArray.create(); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + block = hasher.update(password).finalize(salt); + hasher.reset(); + + // Iterations + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + }()); + + + return CryptoJS.EvpKDF; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/format-hex.js b/node_modules/_crypto-js@4.1.1@crypto-js/format-hex.js new file mode 100644 index 0000000..2e9a861 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/format-hex.js @@ -0,0 +1,66 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var CipherParams = C_lib.CipherParams; + var C_enc = C.enc; + var Hex = C_enc.Hex; + var C_format = C.format; + + var HexFormatter = C_format.Hex = { + /** + * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The hexadecimally encoded string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.format.Hex.stringify(cipherParams); + */ + stringify: function (cipherParams) { + return cipherParams.ciphertext.toString(Hex); + }, + + /** + * Converts a hexadecimally encoded ciphertext string to a cipher params object. + * + * @param {string} input The hexadecimally encoded string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.Hex.parse(hexString); + */ + parse: function (input) { + var ciphertext = Hex.parse(input); + return CipherParams.create({ ciphertext: ciphertext }); + } + }; + }()); + + + return CryptoJS.format.Hex; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/format-openssl.js b/node_modules/_crypto-js@4.1.1@crypto-js/format-openssl.js new file mode 100644 index 0000000..3373edc --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/format-openssl.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.format.OpenSSL; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-md5.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-md5.js new file mode 100644 index 0000000..ad7a90a --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-md5.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./md5"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./md5", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacMD5; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-ripemd160.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-ripemd160.js new file mode 100644 index 0000000..73d55a7 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-ripemd160.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./ripemd160"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./ripemd160", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacRIPEMD160; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha1.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha1.js new file mode 100644 index 0000000..0b570cb --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha1.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha1", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA1; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha224.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha224.js new file mode 100644 index 0000000..3778863 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha224.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha256"), require("./sha224"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha256", "./sha224", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA224; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha256.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha256.js new file mode 100644 index 0000000..33b0c9f --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha256.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha256", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA256; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha3.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha3.js new file mode 100644 index 0000000..1248804 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha3.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha3"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha3", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA3; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha384.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha384.js new file mode 100644 index 0000000..0036e2b --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha384.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./sha384"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha512", "./sha384", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA384; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha512.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha512.js new file mode 100644 index 0000000..c1005b6 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac-sha512.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha512", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA512; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/hmac.js b/node_modules/_crypto-js@4.1.1@crypto-js/hmac.js new file mode 100644 index 0000000..8c09851 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/hmac.js @@ -0,0 +1,143 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + + /** + * HMAC algorithm. + */ + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function (hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); + + // Convert string to WordArray, else assume WordArray already + if (typeof key == 'string') { + key = Utf8.parse(key); + } + + // Shortcuts + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; + + // Allow arbitrary length keys + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } + + // Clamp excess bits + key.clamp(); + + // Clone key for inner and outer pads + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); + + // Shortcuts + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; + + // XOR keys with pad constants + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; + + // Set initial values + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function () { + // Shortcut + var hasher = this._hasher; + + // Reset + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function (messageUpdate) { + this._hasher.update(messageUpdate); + + // Chainable + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Shortcut + var hasher = this._hasher; + + // Compute HMAC + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + + return hmac; + } + }); + }()); + + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/index.js b/node_modules/_crypto-js@4.1.1@crypto-js/index.js new file mode 100644 index 0000000..7235391 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/index.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./enc-base64url"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./enc-base64url", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); + } + else { + // Global (browser) + root.CryptoJS = factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/lib-typedarrays.js b/node_modules/_crypto-js@4.1.1@crypto-js/lib-typedarrays.js new file mode 100644 index 0000000..264b210 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/lib-typedarrays.js @@ -0,0 +1,76 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Check if typed arrays are supported + if (typeof ArrayBuffer != 'function') { + return; + } + + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + + // Reference original init + var superInit = WordArray.init; + + // Augment WordArray.init to handle typed arrays + var subInit = WordArray.init = function (typedArray) { + // Convert buffers to uint8 + if (typedArray instanceof ArrayBuffer) { + typedArray = new Uint8Array(typedArray); + } + + // Convert other array views to uint8 + if ( + typedArray instanceof Int8Array || + (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || + typedArray instanceof Int16Array || + typedArray instanceof Uint16Array || + typedArray instanceof Int32Array || + typedArray instanceof Uint32Array || + typedArray instanceof Float32Array || + typedArray instanceof Float64Array + ) { + typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); + } + + // Handle Uint8Array + if (typedArray instanceof Uint8Array) { + // Shortcut + var typedArrayByteLength = typedArray.byteLength; + + // Extract bytes + var words = []; + for (var i = 0; i < typedArrayByteLength; i++) { + words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); + } + + // Initialize this word array + superInit.call(this, words, typedArrayByteLength); + } else { + // Else call normal init + superInit.apply(this, arguments); + } + }; + + subInit.prototype = WordArray; + }()); + + + return CryptoJS.lib.WordArray; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/md5.js b/node_modules/_crypto-js@4.1.1@crypto-js/md5.js new file mode 100644 index 0000000..12b0fdd --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/md5.js @@ -0,0 +1,268 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var T = []; + + // Compute constants + (function () { + for (var i = 0; i < 64; i++) { + T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; + } + }()); + + /** + * MD5 hash algorithm. + */ + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + + // Shortcuts + var H = this._hash.words; + + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; + + // Working varialbes + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + + // Computation + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( + (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | + (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) + ); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | + (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) + ); + + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + ((b & c) | (~b & d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + ((b & d) | (c & ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + C.MD5 = Hasher._createHelper(MD5); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + C.HmacMD5 = Hasher._createHmacHelper(MD5); + }(Math)); + + + return CryptoJS.MD5; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/mode-cfb.js b/node_modules/_crypto-js@4.1.1@crypto-js/mode-cfb.js new file mode 100644 index 0000000..444c9cb --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/mode-cfb.js @@ -0,0 +1,80 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Cipher Feedback block mode. + */ + CryptoJS.mode.CFB = (function () { + var CFB = CryptoJS.lib.BlockCipherMode.extend(); + + CFB.Encryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + CFB.Decryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { + var keystream; + + // Shortcut + var iv = this._iv; + + // Generate keystream + if (iv) { + keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + keystream = this._prevBlock; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + + return CFB; + }()); + + + return CryptoJS.mode.CFB; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/mode-ctr-gladman.js b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ctr-gladman.js new file mode 100644 index 0000000..bbc5687 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ctr-gladman.js @@ -0,0 +1,116 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** @preserve + * Counter block mode compatible with Dr Brian Gladman fileenc.c + * derived from CryptoJS.mode.CTR + * Jan Hruby jhruby.web@gmail.com + */ + CryptoJS.mode.CTRGladman = (function () { + var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); + + function incWord(word) + { + if (((word >> 24) & 0xff) === 0xff) { //overflow + var b1 = (word >> 16)&0xff; + var b2 = (word >> 8)&0xff; + var b3 = word & 0xff; + + if (b1 === 0xff) // overflow b1 + { + b1 = 0; + if (b2 === 0xff) + { + b2 = 0; + if (b3 === 0xff) + { + b3 = 0; + } + else + { + ++b3; + } + } + else + { + ++b2; + } + } + else + { + ++b1; + } + + word = 0; + word += (b1 << 16); + word += (b2 << 8); + word += b3; + } + else + { + word += (0x01 << 24); + } + return word; + } + + function incCounter(counter) + { + if ((counter[0] = incWord(counter[0])) === 0) + { + // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 + counter[1] = incWord(counter[1]); + } + return counter; + } + + var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + + incCounter(counter); + + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTRGladman.Decryptor = Encryptor; + + return CTRGladman; + }()); + + + + + return CryptoJS.mode.CTRGladman; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/mode-ctr.js b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ctr.js new file mode 100644 index 0000000..c3d470a --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ctr.js @@ -0,0 +1,58 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Counter block mode. + */ + CryptoJS.mode.CTR = (function () { + var CTR = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = CTR.Encryptor = CTR.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Increment counter + counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTR.Decryptor = Encryptor; + + return CTR; + }()); + + + return CryptoJS.mode.CTR; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/mode-ecb.js b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ecb.js new file mode 100644 index 0000000..ff06921 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ecb.js @@ -0,0 +1,40 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Electronic Codebook block mode. + */ + CryptoJS.mode.ECB = (function () { + var ECB = CryptoJS.lib.BlockCipherMode.extend(); + + ECB.Encryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.encryptBlock(words, offset); + } + }); + + ECB.Decryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.decryptBlock(words, offset); + } + }); + + return ECB; + }()); + + + return CryptoJS.mode.ECB; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/mode-ofb.js b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ofb.js new file mode 100644 index 0000000..c01314c --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/mode-ofb.js @@ -0,0 +1,54 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Output Feedback block mode. + */ + CryptoJS.mode.OFB = (function () { + var OFB = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = OFB.Encryptor = OFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var keystream = this._keystream; + + // Generate keystream + if (iv) { + keystream = this._keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + OFB.Decryptor = Encryptor; + + return OFB; + }()); + + + return CryptoJS.mode.OFB; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/package.json b/node_modules/_crypto-js@4.1.1@crypto-js/package.json new file mode 100644 index 0000000..fe75ee2 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/package.json @@ -0,0 +1,45 @@ +{ + "name": "crypto-js", + "version": "4.1.1", + "description": "JavaScript library of crypto standards.", + "license": "MIT", + "author": { + "name": "Evan Vosberg", + "url": "http://github.com/evanvosberg" + }, + "homepage": "http://github.com/brix/crypto-js", + "repository": { + "type": "git", + "url": "http://github.com/brix/crypto-js.git" + }, + "keywords": [ + "security", + "crypto", + "Hash", + "MD5", + "SHA1", + "SHA-1", + "SHA256", + "SHA-256", + "RC4", + "Rabbit", + "AES", + "DES", + "PBKDF2", + "HMAC", + "OFB", + "CFB", + "CTR", + "CBC", + "Base64", + "Base64url" + ], + "main": "index.js", + "dependencies": {}, + "browser": { + "crypto": false + }, + "__npminstall_done": true, + "_from": "crypto-js@4.1.1", + "_resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz" +} \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/pad-ansix923.js b/node_modules/_crypto-js@4.1.1@crypto-js/pad-ansix923.js new file mode 100644 index 0000000..f01f21e --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/pad-ansix923.js @@ -0,0 +1,49 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * ANSI X.923 padding strategy. + */ + CryptoJS.pad.AnsiX923 = { + pad: function (data, blockSize) { + // Shortcuts + var dataSigBytes = data.sigBytes; + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; + + // Compute last byte position + var lastBytePos = dataSigBytes + nPaddingBytes - 1; + + // Pad + data.clamp(); + data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); + data.sigBytes += nPaddingBytes; + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + return CryptoJS.pad.Ansix923; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/pad-iso10126.js b/node_modules/_crypto-js@4.1.1@crypto-js/pad-iso10126.js new file mode 100644 index 0000000..6e2aefd --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/pad-iso10126.js @@ -0,0 +1,44 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * ISO 10126 padding strategy. + */ + CryptoJS.pad.Iso10126 = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Pad + data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). + concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + return CryptoJS.pad.Iso10126; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/pad-iso97971.js b/node_modules/_crypto-js@4.1.1@crypto-js/pad-iso97971.js new file mode 100644 index 0000000..41049b4 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/pad-iso97971.js @@ -0,0 +1,40 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * ISO/IEC 9797-1 Padding Method 2. + */ + CryptoJS.pad.Iso97971 = { + pad: function (data, blockSize) { + // Add 0x80 byte + data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); + + // Zero pad the rest + CryptoJS.pad.ZeroPadding.pad(data, blockSize); + }, + + unpad: function (data) { + // Remove zero padding + CryptoJS.pad.ZeroPadding.unpad(data); + + // Remove one more byte -- the 0x80 byte + data.sigBytes--; + } + }; + + + return CryptoJS.pad.Iso97971; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/pad-nopadding.js b/node_modules/_crypto-js@4.1.1@crypto-js/pad-nopadding.js new file mode 100644 index 0000000..c7787c9 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/pad-nopadding.js @@ -0,0 +1,30 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * A noop padding strategy. + */ + CryptoJS.pad.NoPadding = { + pad: function () { + }, + + unpad: function () { + } + }; + + + return CryptoJS.pad.NoPadding; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/pad-pkcs7.js b/node_modules/_crypto-js@4.1.1@crypto-js/pad-pkcs7.js new file mode 100644 index 0000000..3555168 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/pad-pkcs7.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.pad.Pkcs7; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/pad-zeropadding.js b/node_modules/_crypto-js@4.1.1@crypto-js/pad-zeropadding.js new file mode 100644 index 0000000..a1a459e --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/pad-zeropadding.js @@ -0,0 +1,47 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Zero padding strategy. + */ + CryptoJS.pad.ZeroPadding = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Pad + data.clamp(); + data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); + }, + + unpad: function (data) { + // Shortcut + var dataWords = data.words; + + // Unpad + var i = data.sigBytes - 1; + for (var i = data.sigBytes - 1; i >= 0; i--) { + if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { + data.sigBytes = i + 1; + break; + } + } + } + }; + + + return CryptoJS.pad.ZeroPadding; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/pbkdf2.js b/node_modules/_crypto-js@4.1.1@crypto-js/pbkdf2.js new file mode 100644 index 0000000..1258251 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/pbkdf2.js @@ -0,0 +1,145 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha1", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA1 = C_algo.SHA1; + var HMAC = C_algo.HMAC; + + /** + * Password-Based Key Derivation Function 2 algorithm. + */ + var PBKDF2 = C_algo.PBKDF2 = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hasher to use. Default: SHA1 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: SHA1, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.PBKDF2.create(); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + // Shortcut + var cfg = this.cfg; + + // Init HMAC + var hmac = HMAC.create(cfg.hasher, password); + + // Initial values + var derivedKey = WordArray.create(); + var blockIndex = WordArray.create([0x00000001]); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var blockIndexWords = blockIndex.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + var block = hmac.update(salt).finalize(blockIndex); + hmac.reset(); + + // Shortcuts + var blockWords = block.words; + var blockWordsLength = blockWords.length; + + // Iterations + var intermediate = block; + for (var i = 1; i < iterations; i++) { + intermediate = hmac.finalize(intermediate); + hmac.reset(); + + // Shortcut + var intermediateWords = intermediate.words; + + // XOR intermediate with block + for (var j = 0; j < blockWordsLength; j++) { + blockWords[j] ^= intermediateWords[j]; + } + } + + derivedKey.concat(block); + blockIndexWords[0]++; + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.PBKDF2(password, salt); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.PBKDF2 = function (password, salt, cfg) { + return PBKDF2.create(cfg).compute(password, salt); + }; + }()); + + + return CryptoJS.PBKDF2; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/rabbit-legacy.js b/node_modules/_crypto-js@4.1.1@crypto-js/rabbit-legacy.js new file mode 100644 index 0000000..e118b6b --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/rabbit-legacy.js @@ -0,0 +1,190 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm. + * + * This is a legacy version that neglected to convert the key to little-endian. + * This error doesn't affect the cipher's security, + * but it does affect its compatibility with other implementations. + */ + var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); + */ + C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); + }()); + + + return CryptoJS.RabbitLegacy; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/rabbit.js b/node_modules/_crypto-js@4.1.1@crypto-js/rabbit.js new file mode 100644 index 0000000..1b06833 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/rabbit.js @@ -0,0 +1,192 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm + */ + var Rabbit = C_algo.Rabbit = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Swap endian + for (var i = 0; i < 4; i++) { + K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | + (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); + } + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); + * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); + */ + C.Rabbit = StreamCipher._createHelper(Rabbit); + }()); + + + return CryptoJS.Rabbit; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/rc4.js b/node_modules/_crypto-js@4.1.1@crypto-js/rc4.js new file mode 100644 index 0000000..0e4bdff --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/rc4.js @@ -0,0 +1,139 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + /** + * RC4 stream cipher algorithm. + */ + var RC4 = C_algo.RC4 = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + var keySigBytes = key.sigBytes; + + // Init sbox + var S = this._S = []; + for (var i = 0; i < 256; i++) { + S[i] = i; + } + + // Key setup + for (var i = 0, j = 0; i < 256; i++) { + var keyByteIndex = i % keySigBytes; + var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; + + j = (j + S[i] + keyByte) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + } + + // Counters + this._i = this._j = 0; + }, + + _doProcessBlock: function (M, offset) { + M[offset] ^= generateKeystreamWord.call(this); + }, + + keySize: 256/32, + + ivSize: 0 + }); + + function generateKeystreamWord() { + // Shortcuts + var S = this._S; + var i = this._i; + var j = this._j; + + // Generate keystream word + var keystreamWord = 0; + for (var n = 0; n < 4; n++) { + i = (i + 1) % 256; + j = (j + S[i]) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + + keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); + } + + // Update counters + this._i = i; + this._j = j; + + return keystreamWord; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); + */ + C.RC4 = StreamCipher._createHelper(RC4); + + /** + * Modified RC4 stream cipher algorithm. + */ + var RC4Drop = C_algo.RC4Drop = RC4.extend({ + /** + * Configuration options. + * + * @property {number} drop The number of keystream words to drop. Default 192 + */ + cfg: RC4.cfg.extend({ + drop: 192 + }), + + _doReset: function () { + RC4._doReset.call(this); + + // Drop + for (var i = this.cfg.drop; i > 0; i--) { + generateKeystreamWord.call(this); + } + } + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); + */ + C.RC4Drop = StreamCipher._createHelper(RC4Drop); + }()); + + + return CryptoJS.RC4; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/ripemd160.js b/node_modules/_crypto-js@4.1.1@crypto-js/ripemd160.js new file mode 100644 index 0000000..24feb47 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/ripemd160.js @@ -0,0 +1,267 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. + */ + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var _zl = WordArray.create([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); + var _zr = WordArray.create([ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); + var _sl = WordArray.create([ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); + var _sr = WordArray.create([ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); + + var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); + var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); + + /** + * RIPEMD160 hash algorithm. + */ + var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ + _doReset: function () { + this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); + }, + + _doProcessBlock: function (M, offset) { + + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + // Swap + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + // Shortcut + var H = this._hash.words; + var hl = _hl.words; + var hr = _hr.words; + var zl = _zl.words; + var zr = _zr.words; + var sl = _sl.words; + var sr = _sr.words; + + // Working variables + var al, bl, cl, dl, el; + var ar, br, cr, dr, er; + + ar = al = H[0]; + br = bl = H[1]; + cr = cl = H[2]; + dr = dl = H[3]; + er = el = H[4]; + // Computation + var t; + for (var i = 0; i < 80; i += 1) { + t = (al + M[offset+zl[i]])|0; + if (i<16){ + t += f1(bl,cl,dl) + hl[0]; + } else if (i<32) { + t += f2(bl,cl,dl) + hl[1]; + } else if (i<48) { + t += f3(bl,cl,dl) + hl[2]; + } else if (i<64) { + t += f4(bl,cl,dl) + hl[3]; + } else {// if (i<80) { + t += f5(bl,cl,dl) + hl[4]; + } + t = t|0; + t = rotl(t,sl[i]); + t = (t+el)|0; + al = el; + el = dl; + dl = rotl(cl, 10); + cl = bl; + bl = t; + + t = (ar + M[offset+zr[i]])|0; + if (i<16){ + t += f5(br,cr,dr) + hr[0]; + } else if (i<32) { + t += f4(br,cr,dr) + hr[1]; + } else if (i<48) { + t += f3(br,cr,dr) + hr[2]; + } else if (i<64) { + t += f2(br,cr,dr) + hr[3]; + } else {// if (i<80) { + t += f1(br,cr,dr) + hr[4]; + } + t = t|0; + t = rotl(t,sr[i]) ; + t = (t+er)|0; + ar = er; + er = dr; + dr = rotl(cr, 10); + cr = br; + br = t; + } + // Intermediate hash value + t = (H[1] + cl + dr)|0; + H[1] = (H[2] + dl + er)|0; + H[2] = (H[3] + el + ar)|0; + H[3] = (H[4] + al + br)|0; + H[4] = (H[0] + bl + cr)|0; + H[0] = t; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | + (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) + ); + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 5; i++) { + // Shortcut + var H_i = H[i]; + + // Swap + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + + function f1(x, y, z) { + return ((x) ^ (y) ^ (z)); + + } + + function f2(x, y, z) { + return (((x)&(y)) | ((~x)&(z))); + } + + function f3(x, y, z) { + return (((x) | (~(y))) ^ (z)); + } + + function f4(x, y, z) { + return (((x) & (z)) | ((y)&(~(z)))); + } + + function f5(x, y, z) { + return ((x) ^ ((y) |(~(z)))); + + } + + function rotl(x,n) { + return (x<>>(32-n)); + } + + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.RIPEMD160('message'); + * var hash = CryptoJS.RIPEMD160(wordArray); + */ + C.RIPEMD160 = Hasher._createHelper(RIPEMD160); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacRIPEMD160(message, key); + */ + C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); + }(Math)); + + + return CryptoJS.RIPEMD160; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/sha1.js b/node_modules/_crypto-js@4.1.1@crypto-js/sha1.js new file mode 100644 index 0000000..6691149 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/sha1.js @@ -0,0 +1,150 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Reusable object + var W = []; + + /** + * SHA-1 hash algorithm. + */ + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476, + 0xc3d2e1f0 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + + // Computation + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = (n << 1) | (n >>> 31); + } + + var t = ((a << 5) | (a >>> 27)) + e + W[i]; + if (i < 20) { + t += ((b & c) | (~b & d)) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; + } else /* if (i < 80) */ { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = (b << 30) | (b >>> 2); + b = a; + a = t; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + C.SHA1 = Hasher._createHelper(SHA1); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + }()); + + + return CryptoJS.SHA1; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/sha224.js b/node_modules/_crypto-js@4.1.1@crypto-js/sha224.js new file mode 100644 index 0000000..d8ce988 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/sha224.js @@ -0,0 +1,80 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha256")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha256"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA256 = C_algo.SHA256; + + /** + * SHA-224 hash algorithm. + */ + var SHA224 = C_algo.SHA224 = SHA256.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 + ]); + }, + + _doFinalize: function () { + var hash = SHA256._doFinalize.call(this); + + hash.sigBytes -= 4; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA224('message'); + * var hash = CryptoJS.SHA224(wordArray); + */ + C.SHA224 = SHA256._createHelper(SHA224); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA224(message, key); + */ + C.HmacSHA224 = SHA256._createHmacHelper(SHA224); + }()); + + + return CryptoJS.SHA224; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/sha256.js b/node_modules/_crypto-js@4.1.1@crypto-js/sha256.js new file mode 100644 index 0000000..de2d7fc --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/sha256.js @@ -0,0 +1,199 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Initialization and round constants tables + var H = []; + var K = []; + + // Compute constants + (function () { + function isPrime(n) { + var sqrtN = Math.sqrt(n); + for (var factor = 2; factor <= sqrtN; factor++) { + if (!(n % factor)) { + return false; + } + } + + return true; + } + + function getFractionalBits(n) { + return ((n - (n | 0)) * 0x100000000) | 0; + } + + var n = 2; + var nPrime = 0; + while (nPrime < 64) { + if (isPrime(n)) { + if (nPrime < 8) { + H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); + } + K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); + + nPrime++; + } + + n++; + } + }()); + + // Reusable object + var W = []; + + /** + * SHA-256 hash algorithm. + */ + var SHA256 = C_algo.SHA256 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init(H.slice(0)); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + var f = H[5]; + var g = H[6]; + var h = H[7]; + + // Computation + for (var i = 0; i < 64; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var gamma0x = W[i - 15]; + var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ + ((gamma0x << 14) | (gamma0x >>> 18)) ^ + (gamma0x >>> 3); + + var gamma1x = W[i - 2]; + var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ + ((gamma1x << 13) | (gamma1x >>> 19)) ^ + (gamma1x >>> 10); + + W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; + } + + var ch = (e & f) ^ (~e & g); + var maj = (a & b) ^ (a & c) ^ (b & c); + + var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); + var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); + + var t1 = h + sigma1 + ch + K[i] + W[i]; + var t2 = sigma0 + maj; + + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + H[5] = (H[5] + f) | 0; + H[6] = (H[6] + g) | 0; + H[7] = (H[7] + h) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA256('message'); + * var hash = CryptoJS.SHA256(wordArray); + */ + C.SHA256 = Hasher._createHelper(SHA256); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA256(message, key); + */ + C.HmacSHA256 = Hasher._createHmacHelper(SHA256); + }(Math)); + + + return CryptoJS.SHA256; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/sha3.js b/node_modules/_crypto-js@4.1.1@crypto-js/sha3.js new file mode 100644 index 0000000..34ad86c --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/sha3.js @@ -0,0 +1,326 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var C_algo = C.algo; + + // Constants tables + var RHO_OFFSETS = []; + var PI_INDEXES = []; + var ROUND_CONSTANTS = []; + + // Compute Constants + (function () { + // Compute rho offset constants + var x = 1, y = 0; + for (var t = 0; t < 24; t++) { + RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; + + var newX = y % 5; + var newY = (2 * x + 3 * y) % 5; + x = newX; + y = newY; + } + + // Compute pi index constants + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; + } + } + + // Compute round constants + var LFSR = 0x01; + for (var i = 0; i < 24; i++) { + var roundConstantMsw = 0; + var roundConstantLsw = 0; + + for (var j = 0; j < 7; j++) { + if (LFSR & 0x01) { + var bitPosition = (1 << j) - 1; + if (bitPosition < 32) { + roundConstantLsw ^= 1 << bitPosition; + } else /* if (bitPosition >= 32) */ { + roundConstantMsw ^= 1 << (bitPosition - 32); + } + } + + // Compute next LFSR + if (LFSR & 0x80) { + // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 + LFSR = (LFSR << 1) ^ 0x71; + } else { + LFSR <<= 1; + } + } + + ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); + } + }()); + + // Reusable objects for temporary values + var T = []; + (function () { + for (var i = 0; i < 25; i++) { + T[i] = X64Word.create(); + } + }()); + + /** + * SHA-3 hash algorithm. + */ + var SHA3 = C_algo.SHA3 = Hasher.extend({ + /** + * Configuration options. + * + * @property {number} outputLength + * The desired number of bits in the output hash. + * Only values permitted are: 224, 256, 384, 512. + * Default: 512 + */ + cfg: Hasher.cfg.extend({ + outputLength: 512 + }), + + _doReset: function () { + var state = this._state = [] + for (var i = 0; i < 25; i++) { + state[i] = new X64Word.init(); + } + + this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var state = this._state; + var nBlockSizeLanes = this.blockSize / 2; + + // Absorb + for (var i = 0; i < nBlockSizeLanes; i++) { + // Shortcuts + var M2i = M[offset + 2 * i]; + var M2i1 = M[offset + 2 * i + 1]; + + // Swap endian + M2i = ( + (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | + (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) + ); + M2i1 = ( + (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | + (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) + ); + + // Absorb message into state + var lane = state[i]; + lane.high ^= M2i1; + lane.low ^= M2i; + } + + // Rounds + for (var round = 0; round < 24; round++) { + // Theta + for (var x = 0; x < 5; x++) { + // Mix column lanes + var tMsw = 0, tLsw = 0; + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + tMsw ^= lane.high; + tLsw ^= lane.low; + } + + // Temporary values + var Tx = T[x]; + Tx.high = tMsw; + Tx.low = tLsw; + } + for (var x = 0; x < 5; x++) { + // Shortcuts + var Tx4 = T[(x + 4) % 5]; + var Tx1 = T[(x + 1) % 5]; + var Tx1Msw = Tx1.high; + var Tx1Lsw = Tx1.low; + + // Mix surrounding columns + var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); + var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + lane.high ^= tMsw; + lane.low ^= tLsw; + } + } + + // Rho Pi + for (var laneIndex = 1; laneIndex < 25; laneIndex++) { + var tMsw; + var tLsw; + + // Shortcuts + var lane = state[laneIndex]; + var laneMsw = lane.high; + var laneLsw = lane.low; + var rhoOffset = RHO_OFFSETS[laneIndex]; + + // Rotate lanes + if (rhoOffset < 32) { + tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); + tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); + } else /* if (rhoOffset >= 32) */ { + tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); + tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); + } + + // Transpose lanes + var TPiLane = T[PI_INDEXES[laneIndex]]; + TPiLane.high = tMsw; + TPiLane.low = tLsw; + } + + // Rho pi at x = y = 0 + var T0 = T[0]; + var state0 = state[0]; + T0.high = state0.high; + T0.low = state0.low; + + // Chi + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + // Shortcuts + var laneIndex = x + 5 * y; + var lane = state[laneIndex]; + var TLane = T[laneIndex]; + var Tx1Lane = T[((x + 1) % 5) + 5 * y]; + var Tx2Lane = T[((x + 2) % 5) + 5 * y]; + + // Mix rows + lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); + lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); + } + } + + // Iota + var lane = state[0]; + var roundConstant = ROUND_CONSTANTS[round]; + lane.high ^= roundConstant.high; + lane.low ^= roundConstant.low; + } + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + var blockSizeBits = this.blockSize * 32; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); + dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var state = this._state; + var outputLengthBytes = this.cfg.outputLength / 8; + var outputLengthLanes = outputLengthBytes / 8; + + // Squeeze + var hashWords = []; + for (var i = 0; i < outputLengthLanes; i++) { + // Shortcuts + var lane = state[i]; + var laneMsw = lane.high; + var laneLsw = lane.low; + + // Swap endian + laneMsw = ( + (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | + (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) + ); + laneLsw = ( + (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | + (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) + ); + + // Squeeze state to retrieve hash + hashWords.push(laneLsw); + hashWords.push(laneMsw); + } + + // Return final computed hash + return new WordArray.init(hashWords, outputLengthBytes); + }, + + clone: function () { + var clone = Hasher.clone.call(this); + + var state = clone._state = this._state.slice(0); + for (var i = 0; i < 25; i++) { + state[i] = state[i].clone(); + } + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA3('message'); + * var hash = CryptoJS.SHA3(wordArray); + */ + C.SHA3 = Hasher._createHelper(SHA3); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA3(message, key); + */ + C.HmacSHA3 = Hasher._createHmacHelper(SHA3); + }(Math)); + + + return CryptoJS.SHA3; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/sha384.js b/node_modules/_crypto-js@4.1.1@crypto-js/sha384.js new file mode 100644 index 0000000..a0b95bf --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/sha384.js @@ -0,0 +1,83 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha512"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + var SHA512 = C_algo.SHA512; + + /** + * SHA-384 hash algorithm. + */ + var SHA384 = C_algo.SHA384 = SHA512.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), + new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), + new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), + new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) + ]); + }, + + _doFinalize: function () { + var hash = SHA512._doFinalize.call(this); + + hash.sigBytes -= 16; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA384('message'); + * var hash = CryptoJS.SHA384(wordArray); + */ + C.SHA384 = SHA512._createHelper(SHA384); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA384(message, key); + */ + C.HmacSHA384 = SHA512._createHmacHelper(SHA384); + }()); + + + return CryptoJS.SHA384; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/sha512.js b/node_modules/_crypto-js@4.1.1@crypto-js/sha512.js new file mode 100644 index 0000000..d274ab0 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/sha512.js @@ -0,0 +1,326 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + + function X64Word_create() { + return X64Word.create.apply(X64Word, arguments); + } + + // Constants + var K = [ + X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), + X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), + X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), + X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), + X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), + X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), + X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), + X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), + X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), + X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), + X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), + X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), + X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), + X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), + X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), + X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), + X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), + X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), + X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), + X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), + X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), + X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), + X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), + X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), + X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), + X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), + X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), + X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), + X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), + X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), + X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), + X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), + X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), + X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), + X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), + X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), + X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), + X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), + X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), + X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) + ]; + + // Reusable objects + var W = []; + (function () { + for (var i = 0; i < 80; i++) { + W[i] = X64Word_create(); + } + }()); + + /** + * SHA-512 hash algorithm. + */ + var SHA512 = C_algo.SHA512 = Hasher.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), + new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), + new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), + new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var H = this._hash.words; + + var H0 = H[0]; + var H1 = H[1]; + var H2 = H[2]; + var H3 = H[3]; + var H4 = H[4]; + var H5 = H[5]; + var H6 = H[6]; + var H7 = H[7]; + + var H0h = H0.high; + var H0l = H0.low; + var H1h = H1.high; + var H1l = H1.low; + var H2h = H2.high; + var H2l = H2.low; + var H3h = H3.high; + var H3l = H3.low; + var H4h = H4.high; + var H4l = H4.low; + var H5h = H5.high; + var H5l = H5.low; + var H6h = H6.high; + var H6l = H6.low; + var H7h = H7.high; + var H7l = H7.low; + + // Working variables + var ah = H0h; + var al = H0l; + var bh = H1h; + var bl = H1l; + var ch = H2h; + var cl = H2l; + var dh = H3h; + var dl = H3l; + var eh = H4h; + var el = H4l; + var fh = H5h; + var fl = H5l; + var gh = H6h; + var gl = H6l; + var hh = H7h; + var hl = H7l; + + // Rounds + for (var i = 0; i < 80; i++) { + var Wil; + var Wih; + + // Shortcut + var Wi = W[i]; + + // Extend message + if (i < 16) { + Wih = Wi.high = M[offset + i * 2] | 0; + Wil = Wi.low = M[offset + i * 2 + 1] | 0; + } else { + // Gamma0 + var gamma0x = W[i - 15]; + var gamma0xh = gamma0x.high; + var gamma0xl = gamma0x.low; + var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); + var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); + + // Gamma1 + var gamma1x = W[i - 2]; + var gamma1xh = gamma1x.high; + var gamma1xl = gamma1x.low; + var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); + var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); + + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7 = W[i - 7]; + var Wi7h = Wi7.high; + var Wi7l = Wi7.low; + + var Wi16 = W[i - 16]; + var Wi16h = Wi16.high; + var Wi16l = Wi16.low; + + Wil = gamma0l + Wi7l; + Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); + Wil = Wil + gamma1l; + Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); + Wil = Wil + Wi16l; + Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); + + Wi.high = Wih; + Wi.low = Wil; + } + + var chh = (eh & fh) ^ (~eh & gh); + var chl = (el & fl) ^ (~el & gl); + var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); + var majl = (al & bl) ^ (al & cl) ^ (bl & cl); + + var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); + var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); + var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); + var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); + + // t1 = h + sigma1 + ch + K[i] + W[i] + var Ki = K[i]; + var Kih = Ki.high; + var Kil = Ki.low; + + var t1l = hl + sigma1l; + var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); + var t1l = t1l + chl; + var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); + var t1l = t1l + Kil; + var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); + var t1l = t1l + Wil; + var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); + + // t2 = sigma0 + maj + var t2l = sigma0l + majl; + var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); + + // Update working variables + hh = gh; + hl = gl; + gh = fh; + gl = fl; + fh = eh; + fl = el; + el = (dl + t1l) | 0; + eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; + dh = ch; + dl = cl; + ch = bh; + cl = bl; + bh = ah; + bl = al; + al = (t1l + t2l) | 0; + ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; + } + + // Intermediate hash value + H0l = H0.low = (H0l + al); + H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); + H1l = H1.low = (H1l + bl); + H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); + H2l = H2.low = (H2l + cl); + H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); + H3l = H3.low = (H3l + dl); + H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); + H4l = H4.low = (H4l + el); + H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); + H5l = H5.low = (H5l + fl); + H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); + H6l = H6.low = (H6l + gl); + H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); + H7l = H7.low = (H7l + hl); + H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Convert hash to 32-bit word array before returning + var hash = this._hash.toX32(); + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + }, + + blockSize: 1024/32 + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA512('message'); + * var hash = CryptoJS.SHA512(wordArray); + */ + C.SHA512 = Hasher._createHelper(SHA512); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA512(message, key); + */ + C.HmacSHA512 = Hasher._createHmacHelper(SHA512); + }()); + + + return CryptoJS.SHA512; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/tripledes.js b/node_modules/_crypto-js@4.1.1@crypto-js/tripledes.js new file mode 100644 index 0000000..1a92477 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/tripledes.js @@ -0,0 +1,779 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Permuted Choice 1 constants + var PC1 = [ + 57, 49, 41, 33, 25, 17, 9, 1, + 58, 50, 42, 34, 26, 18, 10, 2, + 59, 51, 43, 35, 27, 19, 11, 3, + 60, 52, 44, 36, 63, 55, 47, 39, + 31, 23, 15, 7, 62, 54, 46, 38, + 30, 22, 14, 6, 61, 53, 45, 37, + 29, 21, 13, 5, 28, 20, 12, 4 + ]; + + // Permuted Choice 2 constants + var PC2 = [ + 14, 17, 11, 24, 1, 5, + 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, + 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, + 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, + 46, 42, 50, 36, 29, 32 + ]; + + // Cumulative bit shift constants + var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; + + // SBOXes and round permutation constants + var SBOX_P = [ + { + 0x0: 0x808200, + 0x10000000: 0x8000, + 0x20000000: 0x808002, + 0x30000000: 0x2, + 0x40000000: 0x200, + 0x50000000: 0x808202, + 0x60000000: 0x800202, + 0x70000000: 0x800000, + 0x80000000: 0x202, + 0x90000000: 0x800200, + 0xa0000000: 0x8200, + 0xb0000000: 0x808000, + 0xc0000000: 0x8002, + 0xd0000000: 0x800002, + 0xe0000000: 0x0, + 0xf0000000: 0x8202, + 0x8000000: 0x0, + 0x18000000: 0x808202, + 0x28000000: 0x8202, + 0x38000000: 0x8000, + 0x48000000: 0x808200, + 0x58000000: 0x200, + 0x68000000: 0x808002, + 0x78000000: 0x2, + 0x88000000: 0x800200, + 0x98000000: 0x8200, + 0xa8000000: 0x808000, + 0xb8000000: 0x800202, + 0xc8000000: 0x800002, + 0xd8000000: 0x8002, + 0xe8000000: 0x202, + 0xf8000000: 0x800000, + 0x1: 0x8000, + 0x10000001: 0x2, + 0x20000001: 0x808200, + 0x30000001: 0x800000, + 0x40000001: 0x808002, + 0x50000001: 0x8200, + 0x60000001: 0x200, + 0x70000001: 0x800202, + 0x80000001: 0x808202, + 0x90000001: 0x808000, + 0xa0000001: 0x800002, + 0xb0000001: 0x8202, + 0xc0000001: 0x202, + 0xd0000001: 0x800200, + 0xe0000001: 0x8002, + 0xf0000001: 0x0, + 0x8000001: 0x808202, + 0x18000001: 0x808000, + 0x28000001: 0x800000, + 0x38000001: 0x200, + 0x48000001: 0x8000, + 0x58000001: 0x800002, + 0x68000001: 0x2, + 0x78000001: 0x8202, + 0x88000001: 0x8002, + 0x98000001: 0x800202, + 0xa8000001: 0x202, + 0xb8000001: 0x808200, + 0xc8000001: 0x800200, + 0xd8000001: 0x0, + 0xe8000001: 0x8200, + 0xf8000001: 0x808002 + }, + { + 0x0: 0x40084010, + 0x1000000: 0x4000, + 0x2000000: 0x80000, + 0x3000000: 0x40080010, + 0x4000000: 0x40000010, + 0x5000000: 0x40084000, + 0x6000000: 0x40004000, + 0x7000000: 0x10, + 0x8000000: 0x84000, + 0x9000000: 0x40004010, + 0xa000000: 0x40000000, + 0xb000000: 0x84010, + 0xc000000: 0x80010, + 0xd000000: 0x0, + 0xe000000: 0x4010, + 0xf000000: 0x40080000, + 0x800000: 0x40004000, + 0x1800000: 0x84010, + 0x2800000: 0x10, + 0x3800000: 0x40004010, + 0x4800000: 0x40084010, + 0x5800000: 0x40000000, + 0x6800000: 0x80000, + 0x7800000: 0x40080010, + 0x8800000: 0x80010, + 0x9800000: 0x0, + 0xa800000: 0x4000, + 0xb800000: 0x40080000, + 0xc800000: 0x40000010, + 0xd800000: 0x84000, + 0xe800000: 0x40084000, + 0xf800000: 0x4010, + 0x10000000: 0x0, + 0x11000000: 0x40080010, + 0x12000000: 0x40004010, + 0x13000000: 0x40084000, + 0x14000000: 0x40080000, + 0x15000000: 0x10, + 0x16000000: 0x84010, + 0x17000000: 0x4000, + 0x18000000: 0x4010, + 0x19000000: 0x80000, + 0x1a000000: 0x80010, + 0x1b000000: 0x40000010, + 0x1c000000: 0x84000, + 0x1d000000: 0x40004000, + 0x1e000000: 0x40000000, + 0x1f000000: 0x40084010, + 0x10800000: 0x84010, + 0x11800000: 0x80000, + 0x12800000: 0x40080000, + 0x13800000: 0x4000, + 0x14800000: 0x40004000, + 0x15800000: 0x40084010, + 0x16800000: 0x10, + 0x17800000: 0x40000000, + 0x18800000: 0x40084000, + 0x19800000: 0x40000010, + 0x1a800000: 0x40004010, + 0x1b800000: 0x80010, + 0x1c800000: 0x0, + 0x1d800000: 0x4010, + 0x1e800000: 0x40080010, + 0x1f800000: 0x84000 + }, + { + 0x0: 0x104, + 0x100000: 0x0, + 0x200000: 0x4000100, + 0x300000: 0x10104, + 0x400000: 0x10004, + 0x500000: 0x4000004, + 0x600000: 0x4010104, + 0x700000: 0x4010000, + 0x800000: 0x4000000, + 0x900000: 0x4010100, + 0xa00000: 0x10100, + 0xb00000: 0x4010004, + 0xc00000: 0x4000104, + 0xd00000: 0x10000, + 0xe00000: 0x4, + 0xf00000: 0x100, + 0x80000: 0x4010100, + 0x180000: 0x4010004, + 0x280000: 0x0, + 0x380000: 0x4000100, + 0x480000: 0x4000004, + 0x580000: 0x10000, + 0x680000: 0x10004, + 0x780000: 0x104, + 0x880000: 0x4, + 0x980000: 0x100, + 0xa80000: 0x4010000, + 0xb80000: 0x10104, + 0xc80000: 0x10100, + 0xd80000: 0x4000104, + 0xe80000: 0x4010104, + 0xf80000: 0x4000000, + 0x1000000: 0x4010100, + 0x1100000: 0x10004, + 0x1200000: 0x10000, + 0x1300000: 0x4000100, + 0x1400000: 0x100, + 0x1500000: 0x4010104, + 0x1600000: 0x4000004, + 0x1700000: 0x0, + 0x1800000: 0x4000104, + 0x1900000: 0x4000000, + 0x1a00000: 0x4, + 0x1b00000: 0x10100, + 0x1c00000: 0x4010000, + 0x1d00000: 0x104, + 0x1e00000: 0x10104, + 0x1f00000: 0x4010004, + 0x1080000: 0x4000000, + 0x1180000: 0x104, + 0x1280000: 0x4010100, + 0x1380000: 0x0, + 0x1480000: 0x10004, + 0x1580000: 0x4000100, + 0x1680000: 0x100, + 0x1780000: 0x4010004, + 0x1880000: 0x10000, + 0x1980000: 0x4010104, + 0x1a80000: 0x10104, + 0x1b80000: 0x4000004, + 0x1c80000: 0x4000104, + 0x1d80000: 0x4010000, + 0x1e80000: 0x4, + 0x1f80000: 0x10100 + }, + { + 0x0: 0x80401000, + 0x10000: 0x80001040, + 0x20000: 0x401040, + 0x30000: 0x80400000, + 0x40000: 0x0, + 0x50000: 0x401000, + 0x60000: 0x80000040, + 0x70000: 0x400040, + 0x80000: 0x80000000, + 0x90000: 0x400000, + 0xa0000: 0x40, + 0xb0000: 0x80001000, + 0xc0000: 0x80400040, + 0xd0000: 0x1040, + 0xe0000: 0x1000, + 0xf0000: 0x80401040, + 0x8000: 0x80001040, + 0x18000: 0x40, + 0x28000: 0x80400040, + 0x38000: 0x80001000, + 0x48000: 0x401000, + 0x58000: 0x80401040, + 0x68000: 0x0, + 0x78000: 0x80400000, + 0x88000: 0x1000, + 0x98000: 0x80401000, + 0xa8000: 0x400000, + 0xb8000: 0x1040, + 0xc8000: 0x80000000, + 0xd8000: 0x400040, + 0xe8000: 0x401040, + 0xf8000: 0x80000040, + 0x100000: 0x400040, + 0x110000: 0x401000, + 0x120000: 0x80000040, + 0x130000: 0x0, + 0x140000: 0x1040, + 0x150000: 0x80400040, + 0x160000: 0x80401000, + 0x170000: 0x80001040, + 0x180000: 0x80401040, + 0x190000: 0x80000000, + 0x1a0000: 0x80400000, + 0x1b0000: 0x401040, + 0x1c0000: 0x80001000, + 0x1d0000: 0x400000, + 0x1e0000: 0x40, + 0x1f0000: 0x1000, + 0x108000: 0x80400000, + 0x118000: 0x80401040, + 0x128000: 0x0, + 0x138000: 0x401000, + 0x148000: 0x400040, + 0x158000: 0x80000000, + 0x168000: 0x80001040, + 0x178000: 0x40, + 0x188000: 0x80000040, + 0x198000: 0x1000, + 0x1a8000: 0x80001000, + 0x1b8000: 0x80400040, + 0x1c8000: 0x1040, + 0x1d8000: 0x80401000, + 0x1e8000: 0x400000, + 0x1f8000: 0x401040 + }, + { + 0x0: 0x80, + 0x1000: 0x1040000, + 0x2000: 0x40000, + 0x3000: 0x20000000, + 0x4000: 0x20040080, + 0x5000: 0x1000080, + 0x6000: 0x21000080, + 0x7000: 0x40080, + 0x8000: 0x1000000, + 0x9000: 0x20040000, + 0xa000: 0x20000080, + 0xb000: 0x21040080, + 0xc000: 0x21040000, + 0xd000: 0x0, + 0xe000: 0x1040080, + 0xf000: 0x21000000, + 0x800: 0x1040080, + 0x1800: 0x21000080, + 0x2800: 0x80, + 0x3800: 0x1040000, + 0x4800: 0x40000, + 0x5800: 0x20040080, + 0x6800: 0x21040000, + 0x7800: 0x20000000, + 0x8800: 0x20040000, + 0x9800: 0x0, + 0xa800: 0x21040080, + 0xb800: 0x1000080, + 0xc800: 0x20000080, + 0xd800: 0x21000000, + 0xe800: 0x1000000, + 0xf800: 0x40080, + 0x10000: 0x40000, + 0x11000: 0x80, + 0x12000: 0x20000000, + 0x13000: 0x21000080, + 0x14000: 0x1000080, + 0x15000: 0x21040000, + 0x16000: 0x20040080, + 0x17000: 0x1000000, + 0x18000: 0x21040080, + 0x19000: 0x21000000, + 0x1a000: 0x1040000, + 0x1b000: 0x20040000, + 0x1c000: 0x40080, + 0x1d000: 0x20000080, + 0x1e000: 0x0, + 0x1f000: 0x1040080, + 0x10800: 0x21000080, + 0x11800: 0x1000000, + 0x12800: 0x1040000, + 0x13800: 0x20040080, + 0x14800: 0x20000000, + 0x15800: 0x1040080, + 0x16800: 0x80, + 0x17800: 0x21040000, + 0x18800: 0x40080, + 0x19800: 0x21040080, + 0x1a800: 0x0, + 0x1b800: 0x21000000, + 0x1c800: 0x1000080, + 0x1d800: 0x40000, + 0x1e800: 0x20040000, + 0x1f800: 0x20000080 + }, + { + 0x0: 0x10000008, + 0x100: 0x2000, + 0x200: 0x10200000, + 0x300: 0x10202008, + 0x400: 0x10002000, + 0x500: 0x200000, + 0x600: 0x200008, + 0x700: 0x10000000, + 0x800: 0x0, + 0x900: 0x10002008, + 0xa00: 0x202000, + 0xb00: 0x8, + 0xc00: 0x10200008, + 0xd00: 0x202008, + 0xe00: 0x2008, + 0xf00: 0x10202000, + 0x80: 0x10200000, + 0x180: 0x10202008, + 0x280: 0x8, + 0x380: 0x200000, + 0x480: 0x202008, + 0x580: 0x10000008, + 0x680: 0x10002000, + 0x780: 0x2008, + 0x880: 0x200008, + 0x980: 0x2000, + 0xa80: 0x10002008, + 0xb80: 0x10200008, + 0xc80: 0x0, + 0xd80: 0x10202000, + 0xe80: 0x202000, + 0xf80: 0x10000000, + 0x1000: 0x10002000, + 0x1100: 0x10200008, + 0x1200: 0x10202008, + 0x1300: 0x2008, + 0x1400: 0x200000, + 0x1500: 0x10000000, + 0x1600: 0x10000008, + 0x1700: 0x202000, + 0x1800: 0x202008, + 0x1900: 0x0, + 0x1a00: 0x8, + 0x1b00: 0x10200000, + 0x1c00: 0x2000, + 0x1d00: 0x10002008, + 0x1e00: 0x10202000, + 0x1f00: 0x200008, + 0x1080: 0x8, + 0x1180: 0x202000, + 0x1280: 0x200000, + 0x1380: 0x10000008, + 0x1480: 0x10002000, + 0x1580: 0x2008, + 0x1680: 0x10202008, + 0x1780: 0x10200000, + 0x1880: 0x10202000, + 0x1980: 0x10200008, + 0x1a80: 0x2000, + 0x1b80: 0x202008, + 0x1c80: 0x200008, + 0x1d80: 0x0, + 0x1e80: 0x10000000, + 0x1f80: 0x10002008 + }, + { + 0x0: 0x100000, + 0x10: 0x2000401, + 0x20: 0x400, + 0x30: 0x100401, + 0x40: 0x2100401, + 0x50: 0x0, + 0x60: 0x1, + 0x70: 0x2100001, + 0x80: 0x2000400, + 0x90: 0x100001, + 0xa0: 0x2000001, + 0xb0: 0x2100400, + 0xc0: 0x2100000, + 0xd0: 0x401, + 0xe0: 0x100400, + 0xf0: 0x2000000, + 0x8: 0x2100001, + 0x18: 0x0, + 0x28: 0x2000401, + 0x38: 0x2100400, + 0x48: 0x100000, + 0x58: 0x2000001, + 0x68: 0x2000000, + 0x78: 0x401, + 0x88: 0x100401, + 0x98: 0x2000400, + 0xa8: 0x2100000, + 0xb8: 0x100001, + 0xc8: 0x400, + 0xd8: 0x2100401, + 0xe8: 0x1, + 0xf8: 0x100400, + 0x100: 0x2000000, + 0x110: 0x100000, + 0x120: 0x2000401, + 0x130: 0x2100001, + 0x140: 0x100001, + 0x150: 0x2000400, + 0x160: 0x2100400, + 0x170: 0x100401, + 0x180: 0x401, + 0x190: 0x2100401, + 0x1a0: 0x100400, + 0x1b0: 0x1, + 0x1c0: 0x0, + 0x1d0: 0x2100000, + 0x1e0: 0x2000001, + 0x1f0: 0x400, + 0x108: 0x100400, + 0x118: 0x2000401, + 0x128: 0x2100001, + 0x138: 0x1, + 0x148: 0x2000000, + 0x158: 0x100000, + 0x168: 0x401, + 0x178: 0x2100400, + 0x188: 0x2000001, + 0x198: 0x2100000, + 0x1a8: 0x0, + 0x1b8: 0x2100401, + 0x1c8: 0x100401, + 0x1d8: 0x400, + 0x1e8: 0x2000400, + 0x1f8: 0x100001 + }, + { + 0x0: 0x8000820, + 0x1: 0x20000, + 0x2: 0x8000000, + 0x3: 0x20, + 0x4: 0x20020, + 0x5: 0x8020820, + 0x6: 0x8020800, + 0x7: 0x800, + 0x8: 0x8020000, + 0x9: 0x8000800, + 0xa: 0x20800, + 0xb: 0x8020020, + 0xc: 0x820, + 0xd: 0x0, + 0xe: 0x8000020, + 0xf: 0x20820, + 0x80000000: 0x800, + 0x80000001: 0x8020820, + 0x80000002: 0x8000820, + 0x80000003: 0x8000000, + 0x80000004: 0x8020000, + 0x80000005: 0x20800, + 0x80000006: 0x20820, + 0x80000007: 0x20, + 0x80000008: 0x8000020, + 0x80000009: 0x820, + 0x8000000a: 0x20020, + 0x8000000b: 0x8020800, + 0x8000000c: 0x0, + 0x8000000d: 0x8020020, + 0x8000000e: 0x8000800, + 0x8000000f: 0x20000, + 0x10: 0x20820, + 0x11: 0x8020800, + 0x12: 0x20, + 0x13: 0x800, + 0x14: 0x8000800, + 0x15: 0x8000020, + 0x16: 0x8020020, + 0x17: 0x20000, + 0x18: 0x0, + 0x19: 0x20020, + 0x1a: 0x8020000, + 0x1b: 0x8000820, + 0x1c: 0x8020820, + 0x1d: 0x20800, + 0x1e: 0x820, + 0x1f: 0x8000000, + 0x80000010: 0x20000, + 0x80000011: 0x800, + 0x80000012: 0x8020020, + 0x80000013: 0x20820, + 0x80000014: 0x20, + 0x80000015: 0x8020000, + 0x80000016: 0x8000000, + 0x80000017: 0x8000820, + 0x80000018: 0x8020820, + 0x80000019: 0x8000020, + 0x8000001a: 0x8000800, + 0x8000001b: 0x0, + 0x8000001c: 0x20800, + 0x8000001d: 0x820, + 0x8000001e: 0x20020, + 0x8000001f: 0x8020800 + } + ]; + + // Masks that select the SBOX input + var SBOX_MASK = [ + 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, + 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f + ]; + + /** + * DES block cipher algorithm. + */ + var DES = C_algo.DES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + + // Select 56 bits according to PC1 + var keyBits = []; + for (var i = 0; i < 56; i++) { + var keyBitPos = PC1[i] - 1; + keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; + } + + // Assemble 16 subkeys + var subKeys = this._subKeys = []; + for (var nSubKey = 0; nSubKey < 16; nSubKey++) { + // Create subkey + var subKey = subKeys[nSubKey] = []; + + // Shortcut + var bitShift = BIT_SHIFTS[nSubKey]; + + // Select 48 bits according to PC2 + for (var i = 0; i < 24; i++) { + // Select from the left 28 key bits + subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); + + // Select from the right 28 key bits + subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); + } + + // Since each subkey is applied to an expanded 32-bit input, + // the subkey can be broken into 8 values scaled to 32-bits, + // which allows the key to be used without expansion + subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); + for (var i = 1; i < 7; i++) { + subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); + } + subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); + } + + // Compute inverse subkeys + var invSubKeys = this._invSubKeys = []; + for (var i = 0; i < 16; i++) { + invSubKeys[i] = subKeys[15 - i]; + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._subKeys); + }, + + decryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._invSubKeys); + }, + + _doCryptBlock: function (M, offset, subKeys) { + // Get input + this._lBlock = M[offset]; + this._rBlock = M[offset + 1]; + + // Initial permutation + exchangeLR.call(this, 4, 0x0f0f0f0f); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeRL.call(this, 2, 0x33333333); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeLR.call(this, 1, 0x55555555); + + // Rounds + for (var round = 0; round < 16; round++) { + // Shortcuts + var subKey = subKeys[round]; + var lBlock = this._lBlock; + var rBlock = this._rBlock; + + // Feistel function + var f = 0; + for (var i = 0; i < 8; i++) { + f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; + } + this._lBlock = rBlock; + this._rBlock = lBlock ^ f; + } + + // Undo swap from last round + var t = this._lBlock; + this._lBlock = this._rBlock; + this._rBlock = t; + + // Final permutation + exchangeLR.call(this, 1, 0x55555555); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeRL.call(this, 2, 0x33333333); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeLR.call(this, 4, 0x0f0f0f0f); + + // Set output + M[offset] = this._lBlock; + M[offset + 1] = this._rBlock; + }, + + keySize: 64/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + // Swap bits across the left and right words + function exchangeLR(offset, mask) { + var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; + this._rBlock ^= t; + this._lBlock ^= t << offset; + } + + function exchangeRL(offset, mask) { + var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; + this._lBlock ^= t; + this._rBlock ^= t << offset; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); + */ + C.DES = BlockCipher._createHelper(DES); + + /** + * Triple-DES block cipher algorithm. + */ + var TripleDES = C_algo.TripleDES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + // Make sure the key length is valid (64, 128 or >= 192 bit) + if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) { + throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.'); + } + + // Extend the key according to the keying options defined in 3DES standard + var key1 = keyWords.slice(0, 2); + var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4); + var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6); + + // Create DES instances + this._des1 = DES.createEncryptor(WordArray.create(key1)); + this._des2 = DES.createEncryptor(WordArray.create(key2)); + this._des3 = DES.createEncryptor(WordArray.create(key3)); + }, + + encryptBlock: function (M, offset) { + this._des1.encryptBlock(M, offset); + this._des2.decryptBlock(M, offset); + this._des3.encryptBlock(M, offset); + }, + + decryptBlock: function (M, offset) { + this._des3.decryptBlock(M, offset); + this._des2.encryptBlock(M, offset); + this._des1.decryptBlock(M, offset); + }, + + keySize: 192/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); + */ + C.TripleDES = BlockCipher._createHelper(TripleDES); + }()); + + + return CryptoJS.TripleDES; + +})); \ No newline at end of file diff --git a/node_modules/_crypto-js@4.1.1@crypto-js/x64-core.js b/node_modules/_crypto-js@4.1.1@crypto-js/x64-core.js new file mode 100644 index 0000000..57dcc14 --- /dev/null +++ b/node_modules/_crypto-js@4.1.1@crypto-js/x64-core.js @@ -0,0 +1,304 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var X32WordArray = C_lib.WordArray; + + /** + * x64 namespace. + */ + var C_x64 = C.x64 = {}; + + /** + * A 64-bit word. + */ + var X64Word = C_x64.Word = Base.extend({ + /** + * Initializes a newly created 64-bit word. + * + * @param {number} high The high 32 bits. + * @param {number} low The low 32 bits. + * + * @example + * + * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); + */ + init: function (high, low) { + this.high = high; + this.low = low; + } + + /** + * Bitwise NOTs this word. + * + * @return {X64Word} A new x64-Word object after negating. + * + * @example + * + * var negated = x64Word.not(); + */ + // not: function () { + // var high = ~this.high; + // var low = ~this.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ANDs this word with the passed word. + * + * @param {X64Word} word The x64-Word to AND with this word. + * + * @return {X64Word} A new x64-Word object after ANDing. + * + * @example + * + * var anded = x64Word.and(anotherX64Word); + */ + // and: function (word) { + // var high = this.high & word.high; + // var low = this.low & word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to OR with this word. + * + * @return {X64Word} A new x64-Word object after ORing. + * + * @example + * + * var ored = x64Word.or(anotherX64Word); + */ + // or: function (word) { + // var high = this.high | word.high; + // var low = this.low | word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise XORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to XOR with this word. + * + * @return {X64Word} A new x64-Word object after XORing. + * + * @example + * + * var xored = x64Word.xor(anotherX64Word); + */ + // xor: function (word) { + // var high = this.high ^ word.high; + // var low = this.low ^ word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the left. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftL(25); + */ + // shiftL: function (n) { + // if (n < 32) { + // var high = (this.high << n) | (this.low >>> (32 - n)); + // var low = this.low << n; + // } else { + // var high = this.low << (n - 32); + // var low = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the right. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftR(7); + */ + // shiftR: function (n) { + // if (n < 32) { + // var low = (this.low >>> n) | (this.high << (32 - n)); + // var high = this.high >>> n; + // } else { + // var low = this.high >>> (n - 32); + // var high = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Rotates this word n bits to the left. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotL(25); + */ + // rotL: function (n) { + // return this.shiftL(n).or(this.shiftR(64 - n)); + // }, + + /** + * Rotates this word n bits to the right. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotR(7); + */ + // rotR: function (n) { + // return this.shiftR(n).or(this.shiftL(64 - n)); + // }, + + /** + * Adds this word with the passed word. + * + * @param {X64Word} word The x64-Word to add with this word. + * + * @return {X64Word} A new x64-Word object after adding. + * + * @example + * + * var added = x64Word.add(anotherX64Word); + */ + // add: function (word) { + // var low = (this.low + word.low) | 0; + // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; + // var high = (this.high + word.high + carry) | 0; + + // return X64Word.create(high, low); + // } + }); + + /** + * An array of 64-bit words. + * + * @property {Array} words The array of CryptoJS.x64.Word objects. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var X64WordArray = C_x64.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.x64.WordArray.create(); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ]); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ], 10); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 8; + } + }, + + /** + * Converts this 64-bit word array to a 32-bit word array. + * + * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. + * + * @example + * + * var x32WordArray = x64WordArray.toX32(); + */ + toX32: function () { + // Shortcuts + var x64Words = this.words; + var x64WordsLength = x64Words.length; + + // Convert + var x32Words = []; + for (var i = 0; i < x64WordsLength; i++) { + var x64Word = x64Words[i]; + x32Words.push(x64Word.high); + x32Words.push(x64Word.low); + } + + return X32WordArray.create(x32Words, this.sigBytes); + }, + + /** + * Creates a copy of this word array. + * + * @return {X64WordArray} The clone. + * + * @example + * + * var clone = x64WordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + + // Clone "words" array + var words = clone.words = this.words.slice(0); + + // Clone each X64Word object + var wordsLength = words.length; + for (var i = 0; i < wordsLength; i++) { + words[i] = words[i].clone(); + } + + return clone; + } + }); + }()); + + + return CryptoJS; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/CONTRIBUTING.md b/node_modules/crypto-js/CONTRIBUTING.md new file mode 100644 index 0000000..09bf774 --- /dev/null +++ b/node_modules/crypto-js/CONTRIBUTING.md @@ -0,0 +1,28 @@ +# Contribution + +# Git Flow + +The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches. +Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch. + +# Pull request + +Target your pull request on `develop` branch. Other pull request won't be accepted. + +# How to build + +1. Clone + +2. Run + + ```sh + npm install + ``` + +3. Run + + ```sh + npm run build + ``` + +4. Check `build` folder \ No newline at end of file diff --git a/node_modules/crypto-js/LICENSE b/node_modules/crypto-js/LICENSE new file mode 100644 index 0000000..b0828e5 --- /dev/null +++ b/node_modules/crypto-js/LICENSE @@ -0,0 +1,24 @@ +# License + +[The MIT License (MIT)](http://opensource.org/licenses/MIT) + +Copyright (c) 2009-2013 Jeff Mott +Copyright (c) 2013-2016 Evan Vosberg + +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. diff --git a/node_modules/crypto-js/README.md b/node_modules/crypto-js/README.md new file mode 100644 index 0000000..23795aa --- /dev/null +++ b/node_modules/crypto-js/README.md @@ -0,0 +1,261 @@ +# crypto-js [![Build Status](https://travis-ci.org/brix/crypto-js.svg?branch=develop)](https://travis-ci.org/brix/crypto-js) + +JavaScript library of crypto standards. + +## Node.js (Install) + +Requirements: + +- Node.js +- npm (Node.js package manager) + +```bash +npm install crypto-js +``` + +### Usage + +ES6 import for typical API call signing use case: + +```javascript +import sha256 from 'crypto-js/sha256'; +import hmacSHA512 from 'crypto-js/hmac-sha512'; +import Base64 from 'crypto-js/enc-base64'; + +const message, nonce, path, privateKey; // ... +const hashDigest = sha256(nonce + message); +const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey)); +``` + +Modular include: + +```javascript +var AES = require("crypto-js/aes"); +var SHA256 = require("crypto-js/sha256"); +... +console.log(SHA256("Message")); +``` + +Including all libraries, for access to extra methods: + +```javascript +var CryptoJS = require("crypto-js"); +console.log(CryptoJS.HmacSHA1("Message", "Key")); +``` + +## Client (browser) + +Requirements: + +- Node.js +- Bower (package manager for frontend) + +```bash +bower install crypto-js +``` + +### Usage + +Modular include: + +```javascript +require.config({ + packages: [ + { + name: 'crypto-js', + location: 'path-to/bower_components/crypto-js', + main: 'index' + } + ] +}); + +require(["crypto-js/aes", "crypto-js/sha256"], function (AES, SHA256) { + console.log(SHA256("Message")); +}); +``` + +Including all libraries, for access to extra methods: + +```javascript +// Above-mentioned will work or use this simple form +require.config({ + paths: { + 'crypto-js': 'path-to/bower_components/crypto-js/crypto-js' + } +}); + +require(["crypto-js"], function (CryptoJS) { + console.log(CryptoJS.HmacSHA1("Message", "Key")); +}); +``` + +### Usage without RequireJS + +```html + + +``` + +## API + +See: https://cryptojs.gitbook.io/docs/ + +### AES Encryption + +#### Plain text encryption + +```javascript +var CryptoJS = require("crypto-js"); + +// Encrypt +var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString(); + +// Decrypt +var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); +var originalText = bytes.toString(CryptoJS.enc.Utf8); + +console.log(originalText); // 'my message' +``` + +#### Object encryption + +```javascript +var CryptoJS = require("crypto-js"); + +var data = [{id: 1}, {id: 2}] + +// Encrypt +var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString(); + +// Decrypt +var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123'); +var decryptedData = JSON.parse(bytes.toString(CryptoJS.enc.Utf8)); + +console.log(decryptedData); // [{id: 1}, {id: 2}] +``` + +### List of modules + + +- ```crypto-js/core``` +- ```crypto-js/x64-core``` +- ```crypto-js/lib-typedarrays``` + +--- + +- ```crypto-js/md5``` +- ```crypto-js/sha1``` +- ```crypto-js/sha256``` +- ```crypto-js/sha224``` +- ```crypto-js/sha512``` +- ```crypto-js/sha384``` +- ```crypto-js/sha3``` +- ```crypto-js/ripemd160``` + +--- + +- ```crypto-js/hmac-md5``` +- ```crypto-js/hmac-sha1``` +- ```crypto-js/hmac-sha256``` +- ```crypto-js/hmac-sha224``` +- ```crypto-js/hmac-sha512``` +- ```crypto-js/hmac-sha384``` +- ```crypto-js/hmac-sha3``` +- ```crypto-js/hmac-ripemd160``` + +--- + +- ```crypto-js/pbkdf2``` + +--- + +- ```crypto-js/aes``` +- ```crypto-js/tripledes``` +- ```crypto-js/rc4``` +- ```crypto-js/rabbit``` +- ```crypto-js/rabbit-legacy``` +- ```crypto-js/evpkdf``` + +--- + +- ```crypto-js/format-openssl``` +- ```crypto-js/format-hex``` + +--- + +- ```crypto-js/enc-latin1``` +- ```crypto-js/enc-utf8``` +- ```crypto-js/enc-hex``` +- ```crypto-js/enc-utf16``` +- ```crypto-js/enc-base64``` + +--- + +- ```crypto-js/mode-cfb``` +- ```crypto-js/mode-ctr``` +- ```crypto-js/mode-ctr-gladman``` +- ```crypto-js/mode-ofb``` +- ```crypto-js/mode-ecb``` + +--- + +- ```crypto-js/pad-pkcs7``` +- ```crypto-js/pad-ansix923``` +- ```crypto-js/pad-iso10126``` +- ```crypto-js/pad-iso97971``` +- ```crypto-js/pad-zeropadding``` +- ```crypto-js/pad-nopadding``` + + +## Release notes + +### 4.1.1 + +Fix module order in bundled release. + +Include the browser field in the released package.json. + +### 4.1.0 + +Added url safe variant of base64 encoding. [357](https://github.com/brix/crypto-js/pull/357) + +Avoid webpack to add crypto-browser package. [364](https://github.com/brix/crypto-js/pull/364) + +### 4.0.0 + +This is an update including breaking changes for some environments. + +In this version `Math.random()` has been replaced by the random methods of the native crypto module. + +For this reason CryptoJS might not run in some JavaScript environments without native crypto module. Such as IE 10 or before or React Native. + +### 3.3.0 + +Rollback, `3.3.0` is the same as `3.1.9-1`. + +The move of using native secure crypto module will be shifted to a new `4.x.x` version. As it is a breaking change the impact is too big for a minor release. + +### 3.2.1 + +The usage of the native crypto module has been fixed. The import and access of the native crypto module has been improved. + +### 3.2.0 + +In this version `Math.random()` has been replaced by the random methods of the native crypto module. + +For this reason CryptoJS might does not run in some JavaScript environments without native crypto module. Such as IE 10 or before. + +If it's absolute required to run CryptoJS in such an environment, stay with `3.1.x` version. Encrypting and decrypting stays compatible. But keep in mind `3.1.x` versions still use `Math.random()` which is cryptographically not secure, as it's not random enough. + +This version came along with `CRITICAL` `BUG`. + +DO NOT USE THIS VERSION! Please, go for a newer version! + +### 3.1.x + +The `3.1.x` are based on the original CryptoJS, wrapped in CommonJS modules. + + diff --git a/node_modules/crypto-js/aes.js b/node_modules/crypto-js/aes.js new file mode 100644 index 0000000..166e3ea --- /dev/null +++ b/node_modules/crypto-js/aes.js @@ -0,0 +1,234 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Lookup tables + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; + + // Compute lookup tables + (function () { + // Compute double table + var d = []; + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = (i << 1) ^ 0x11b; + } + } + + // Walk GF(2^8) + var x = 0; + var xi = 0; + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; + + // Compute multiplication + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; + + // Compute sub bytes, mix columns tables + var t = (d[sx] * 0x101) ^ (sx * 0x1010100); + SUB_MIX_0[x] = (t << 24) | (t >>> 8); + SUB_MIX_1[x] = (t << 16) | (t >>> 16); + SUB_MIX_2[x] = (t << 8) | (t >>> 24); + SUB_MIX_3[x] = t; + + // Compute inv sub bytes, inv mix columns tables + var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); + INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); + INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); + INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); + INV_SUB_MIX_3[sx] = t; + + // Compute next counter + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + }()); + + // Precomputed Rcon lookup + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + + /** + * AES block cipher algorithm. + */ + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function () { + var t; + + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } + + // Shortcuts + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; + + // Compute number of rounds + var nRounds = this._nRounds = keySize + 6; + + // Compute number of key schedule rows + var ksRows = (nRounds + 1) * 4; + + // Compute key schedule + var keySchedule = this._keySchedule = []; + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = (t << 8) | (t >>> 24); + + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + + // Mix Rcon + t ^= RCON[(ksRow / keySize) | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } + + // Compute inv key schedule + var invKeySchedule = this._invKeySchedule = []; + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ + INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + + decryptBlock: function (M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); + + // Inv swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + + _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; + + // Get input, add round key + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; + + // Key schedule row counter + var ksRow = 4; + + // Rounds + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; + + // Update state + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } + + // Shift rows, sub bytes, add round key + var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; + + // Set output + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + + keySize: 256/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); + */ + C.AES = BlockCipher._createHelper(AES); + }()); + + + return CryptoJS.AES; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/bower.json b/node_modules/crypto-js/bower.json new file mode 100644 index 0000000..1e12fdc --- /dev/null +++ b/node_modules/crypto-js/bower.json @@ -0,0 +1,39 @@ +{ + "name": "crypto-js", + "version": "4.1.1", + "description": "JavaScript library of crypto standards.", + "license": "MIT", + "homepage": "http://github.com/brix/crypto-js", + "repository": { + "type": "git", + "url": "http://github.com/brix/crypto-js.git" + }, + "keywords": [ + "security", + "crypto", + "Hash", + "MD5", + "SHA1", + "SHA-1", + "SHA256", + "SHA-256", + "RC4", + "Rabbit", + "AES", + "DES", + "PBKDF2", + "HMAC", + "OFB", + "CFB", + "CTR", + "CBC", + "Base64", + "Base64url" + ], + "main": "index.js", + "dependencies": {}, + "browser": { + "crypto": false + }, + "ignore": [] +} diff --git a/node_modules/crypto-js/cipher-core.js b/node_modules/crypto-js/cipher-core.js new file mode 100644 index 0000000..c560c9e --- /dev/null +++ b/node_modules/crypto-js/cipher-core.js @@ -0,0 +1,890 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./evpkdf")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./evpkdf"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function (key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function (key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); + }, + + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function (xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Store transform mode and key + this._xformMode = xformMode; + this._key = key; + + // Set initial values + this.reset(); + }, + + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-cipher logic + this._doReset(); + }, + + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function (dataUpdate) { + // Append + this._append(dataUpdate); + + // Process available blocks + return this._process(); + }, + + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function (dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } + + // Perform concrete-cipher logic + var finalProcessedData = this._doFinalize(); + + return finalProcessedData; + }, + + keySize: 128/32, + + ivSize: 128/32, + + _ENC_XFORM_MODE: 1, + + _DEC_XFORM_MODE: 2, + + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: (function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } + + return function (cipher) { + return { + encrypt: function (message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + + decrypt: function (ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }()) + }); + + /** + * Abstract base stream cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) + */ + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function () { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); + + return finalProcessedBlocks; + }, + + blockSize: 1 + }); + + /** + * Mode namespace. + */ + var C_mode = C.mode = {}; + + /** + * Abstract base block cipher mode template. + */ + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function (cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, + + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function (cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, + + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function (cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + + /** + * Cipher Block Chaining mode. + */ + var CBC = C_mode.CBC = (function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + + /** + * CBC encryptor. + */ + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // XOR and encrypt + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + /** + * CBC decryptor. + */ + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + // Decrypt and XOR + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + var block; + + // Shortcut + var iv = this._iv; + + // Choose mixing block + if (iv) { + block = iv; + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + block = this._prevBlock; + } + + // XOR blocks + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }()); + + /** + * Padding namespace. + */ + var C_pad = C.pad = {}; + + /** + * PKCS #5/7 padding strategy. + */ + var Pkcs7 = C_pad.Pkcs7 = { + /** + * Pads data using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); + */ + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Create padding word + var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; + + // Create padding + var paddingWords = []; + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + var padding = WordArray.create(paddingWords, nPaddingBytes); + + // Add padding + data.concat(padding); + }, + + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + + reset: function () { + var modeCreator; + + // Reset cipher + Cipher.reset.call(this); + + // Shortcuts + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; + + // Reset block mode + if (this._xformMode == this._ENC_XFORM_MODE) { + modeCreator = mode.createEncryptor; + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + modeCreator = mode.createDecryptor; + // Keep at least one block in the buffer for unpadding + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + + _doProcessBlock: function (words, offset) { + this._mode.processBlock(words, offset); + }, + + _doFinalize: function () { + var finalProcessedBlocks; + + // Shortcut + var padding = this.cfg.padding; + + // Finalize + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); + + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + + // Unpad data + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + + blockSize: 128/32 + }); + + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function (cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function (formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + + /** + * Format namespace. + */ + var C_format = C.format = {}; + + /** + * OpenSSL formatting strategy. + */ + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function (cipherParams) { + var wordArray; + + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; + + // Format + if (salt) { + wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function (openSSLStr) { + var salt; + + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); + + // Shortcut + var ciphertextWords = ciphertext.words; + + // Test for salt + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + salt = WordArray.create(ciphertextWords.slice(2, 4)); + + // Remove salt from ciphertext + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ ciphertext: ciphertext, salt: salt }); + } + }; + + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Encrypt + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); + + // Shortcut + var cipherCfg = encryptor.cfg; + + // Create and return serializable cipher params + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Decrypt + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function (ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + + /** + * Key derivation function namespace. + */ + var C_kdf = C.kdf = {}; + + /** + * OpenSSL key derivation function. + */ + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function (password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64/8); + } + + // Derive key and IV + var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); + + // Separate key and IV + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; + + // Return params + return CipherParams.create({ key: key, iv: iv, salt: salt }); + } + }; + + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Encrypt + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); + + // Mix in derived params + ciphertext.mixIn(derivedParams); + + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Decrypt + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + + return plaintext; + } + }); + }()); + + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/core.js b/node_modules/crypto-js/core.js new file mode 100644 index 0000000..e3a498b --- /dev/null +++ b/node_modules/crypto-js/core.js @@ -0,0 +1,807 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(); + } + else if (typeof define === "function" && define.amd) { + // AMD + define([], factory); + } + else { + // Global (browser) + root.CryptoJS = factory(); + } +}(this, function () { + + /*globals window, global, require*/ + + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || (function (Math, undefined) { + + var crypto; + + // Native crypto from window (Browser) + if (typeof window !== 'undefined' && window.crypto) { + crypto = window.crypto; + } + + // Native crypto in web worker (Browser) + if (typeof self !== 'undefined' && self.crypto) { + crypto = self.crypto; + } + + // Native crypto from worker + if (typeof globalThis !== 'undefined' && globalThis.crypto) { + crypto = globalThis.crypto; + } + + // Native (experimental IE 11) crypto from window (Browser) + if (!crypto && typeof window !== 'undefined' && window.msCrypto) { + crypto = window.msCrypto; + } + + // Native crypto from global (NodeJS) + if (!crypto && typeof global !== 'undefined' && global.crypto) { + crypto = global.crypto; + } + + // Native crypto import via require (NodeJS) + if (!crypto && typeof require === 'function') { + try { + crypto = require('crypto'); + } catch (err) {} + } + + /* + * Cryptographically secure pseudorandom number generator + * + * As Math.random() is cryptographically not safe to use + */ + var cryptoSecureRandomInt = function () { + if (crypto) { + // Use getRandomValues method (Browser) + if (typeof crypto.getRandomValues === 'function') { + try { + return crypto.getRandomValues(new Uint32Array(1))[0]; + } catch (err) {} + } + + // Use randomBytes method (NodeJS) + if (typeof crypto.randomBytes === 'function') { + try { + return crypto.randomBytes(4).readInt32LE(); + } catch (err) {} + } + } + + throw new Error('Native crypto module could not be used to get secure random number.'); + }; + + /* + * Local polyfill of Object.create + + */ + var create = Object.create || (function () { + function F() {} + + return function (obj) { + var subtype; + + F.prototype = obj; + + subtype = new F(); + + F.prototype = null; + + return subtype; + }; + }()); + + /** + * CryptoJS namespace. + */ + var C = {}; + + /** + * Library namespace. + */ + var C_lib = C.lib = {}; + + /** + * Base object for prototypal inheritance. + */ + var Base = C_lib.Base = (function () { + + + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function (overrides) { + // Spawn + var subtype = create(this); + + // Augment + if (overrides) { + subtype.mixIn(overrides); + } + + // Create default initializer + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } + + // Initializer's prototype is the subtype object + subtype.init.prototype = subtype; + + // Reference supertype + subtype.$super = this; + + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function () { + var instance = this.extend(); + instance.init.apply(instance, arguments); + + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function () { + }, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function (properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } + + // IE won't copy toString using the loop above + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function () { + return this.init.prototype.extend(this); + } + }; + }()); + + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function (encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function (wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; + + // Clamp excess bits + this.clamp(); + + // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); + } + } else { + // Copy one word at a time + for (var j = 0; j < thatSigBytes; j += 4) { + thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2]; + } + } + this.sigBytes += thatSigBytes; + + // Chainable + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function () { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; + + // Clamp + words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function (nBytes) { + var words = []; + + for (var i = 0; i < nBytes; i += 4) { + words.push(cryptoSecureRandomInt()); + } + + return new WordArray.init(words, nBytes); + } + }); + + /** + * Encoder namespace. + */ + var C_enc = C.enc = {}; + + /** + * Hex encoding strategy. + */ + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var hexChars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function (hexStr) { + // Shortcut + var hexStrLength = hexStr.length; + + // Convert + var words = []; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + + /** + * Latin1 encoding strategy. + */ + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var latin1Chars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function (latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; + + // Convert + var words = []; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); + } + + return new WordArray.init(words, latin1StrLength); + } + }; + + /** + * UTF-8 encoding strategy. + */ + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function (wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function (utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function () { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function (data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } + + // Append + this._data.concat(data); + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function (doFlush) { + var processedWords; + + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; + + // Count blocks ready + var nBlocksReady = dataSigBytes / blockSizeBytes; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } + + // Count words ready + var nWordsReady = nBlocksReady * blockSize; + + // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); + + // Process blocks + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } + + // Remove processed words + processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } + + // Return processed words + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + + return clone; + }, + + _minBufferSize: 0 + }); + + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function (cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Set initial values + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-hasher logic + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function (messageUpdate) { + // Append + this._append(messageUpdate); + + // Update the hash + this._process(); + + // Chainable + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } + + // Perform concrete-hasher logic + var hash = this._doFinalize(); + + return hash; + }, + + blockSize: 512/32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function (hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function (hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + + return C; + }(Math)); + + + return CryptoJS; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/crypto-js.js b/node_modules/crypto-js/crypto-js.js new file mode 100644 index 0000000..27f0a62 --- /dev/null +++ b/node_modules/crypto-js/crypto-js.js @@ -0,0 +1,6191 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(); + } + else if (typeof define === "function" && define.amd) { + // AMD + define([], factory); + } + else { + // Global (browser) + root.CryptoJS = factory(); + } +}(this, function () { + + /*globals window, global, require*/ + + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || (function (Math, undefined) { + + var crypto; + + // Native crypto from window (Browser) + if (typeof window !== 'undefined' && window.crypto) { + crypto = window.crypto; + } + + // Native crypto in web worker (Browser) + if (typeof self !== 'undefined' && self.crypto) { + crypto = self.crypto; + } + + // Native crypto from worker + if (typeof globalThis !== 'undefined' && globalThis.crypto) { + crypto = globalThis.crypto; + } + + // Native (experimental IE 11) crypto from window (Browser) + if (!crypto && typeof window !== 'undefined' && window.msCrypto) { + crypto = window.msCrypto; + } + + // Native crypto from global (NodeJS) + if (!crypto && typeof global !== 'undefined' && global.crypto) { + crypto = global.crypto; + } + + // Native crypto import via require (NodeJS) + if (!crypto && typeof require === 'function') { + try { + crypto = require('crypto'); + } catch (err) {} + } + + /* + * Cryptographically secure pseudorandom number generator + * + * As Math.random() is cryptographically not safe to use + */ + var cryptoSecureRandomInt = function () { + if (crypto) { + // Use getRandomValues method (Browser) + if (typeof crypto.getRandomValues === 'function') { + try { + return crypto.getRandomValues(new Uint32Array(1))[0]; + } catch (err) {} + } + + // Use randomBytes method (NodeJS) + if (typeof crypto.randomBytes === 'function') { + try { + return crypto.randomBytes(4).readInt32LE(); + } catch (err) {} + } + } + + throw new Error('Native crypto module could not be used to get secure random number.'); + }; + + /* + * Local polyfill of Object.create + + */ + var create = Object.create || (function () { + function F() {} + + return function (obj) { + var subtype; + + F.prototype = obj; + + subtype = new F(); + + F.prototype = null; + + return subtype; + }; + }()); + + /** + * CryptoJS namespace. + */ + var C = {}; + + /** + * Library namespace. + */ + var C_lib = C.lib = {}; + + /** + * Base object for prototypal inheritance. + */ + var Base = C_lib.Base = (function () { + + + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function (overrides) { + // Spawn + var subtype = create(this); + + // Augment + if (overrides) { + subtype.mixIn(overrides); + } + + // Create default initializer + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } + + // Initializer's prototype is the subtype object + subtype.init.prototype = subtype; + + // Reference supertype + subtype.$super = this; + + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function () { + var instance = this.extend(); + instance.init.apply(instance, arguments); + + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function () { + }, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function (properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } + + // IE won't copy toString using the loop above + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function () { + return this.init.prototype.extend(this); + } + }; + }()); + + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function (encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function (wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; + + // Clamp excess bits + this.clamp(); + + // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); + } + } else { + // Copy one word at a time + for (var j = 0; j < thatSigBytes; j += 4) { + thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2]; + } + } + this.sigBytes += thatSigBytes; + + // Chainable + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function () { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; + + // Clamp + words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function (nBytes) { + var words = []; + + for (var i = 0; i < nBytes; i += 4) { + words.push(cryptoSecureRandomInt()); + } + + return new WordArray.init(words, nBytes); + } + }); + + /** + * Encoder namespace. + */ + var C_enc = C.enc = {}; + + /** + * Hex encoding strategy. + */ + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var hexChars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function (hexStr) { + // Shortcut + var hexStrLength = hexStr.length; + + // Convert + var words = []; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + + /** + * Latin1 encoding strategy. + */ + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var latin1Chars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function (latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; + + // Convert + var words = []; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); + } + + return new WordArray.init(words, latin1StrLength); + } + }; + + /** + * UTF-8 encoding strategy. + */ + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function (wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function (utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function () { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function (data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } + + // Append + this._data.concat(data); + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function (doFlush) { + var processedWords; + + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; + + // Count blocks ready + var nBlocksReady = dataSigBytes / blockSizeBytes; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } + + // Count words ready + var nWordsReady = nBlocksReady * blockSize; + + // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); + + // Process blocks + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } + + // Remove processed words + processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } + + // Return processed words + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + + return clone; + }, + + _minBufferSize: 0 + }); + + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function (cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Set initial values + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-hasher logic + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function (messageUpdate) { + // Append + this._append(messageUpdate); + + // Update the hash + this._process(); + + // Chainable + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } + + // Perform concrete-hasher logic + var hash = this._doFinalize(); + + return hash; + }, + + blockSize: 512/32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function (hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function (hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + + return C; + }(Math)); + + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var X32WordArray = C_lib.WordArray; + + /** + * x64 namespace. + */ + var C_x64 = C.x64 = {}; + + /** + * A 64-bit word. + */ + var X64Word = C_x64.Word = Base.extend({ + /** + * Initializes a newly created 64-bit word. + * + * @param {number} high The high 32 bits. + * @param {number} low The low 32 bits. + * + * @example + * + * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); + */ + init: function (high, low) { + this.high = high; + this.low = low; + } + + /** + * Bitwise NOTs this word. + * + * @return {X64Word} A new x64-Word object after negating. + * + * @example + * + * var negated = x64Word.not(); + */ + // not: function () { + // var high = ~this.high; + // var low = ~this.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ANDs this word with the passed word. + * + * @param {X64Word} word The x64-Word to AND with this word. + * + * @return {X64Word} A new x64-Word object after ANDing. + * + * @example + * + * var anded = x64Word.and(anotherX64Word); + */ + // and: function (word) { + // var high = this.high & word.high; + // var low = this.low & word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to OR with this word. + * + * @return {X64Word} A new x64-Word object after ORing. + * + * @example + * + * var ored = x64Word.or(anotherX64Word); + */ + // or: function (word) { + // var high = this.high | word.high; + // var low = this.low | word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise XORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to XOR with this word. + * + * @return {X64Word} A new x64-Word object after XORing. + * + * @example + * + * var xored = x64Word.xor(anotherX64Word); + */ + // xor: function (word) { + // var high = this.high ^ word.high; + // var low = this.low ^ word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the left. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftL(25); + */ + // shiftL: function (n) { + // if (n < 32) { + // var high = (this.high << n) | (this.low >>> (32 - n)); + // var low = this.low << n; + // } else { + // var high = this.low << (n - 32); + // var low = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the right. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftR(7); + */ + // shiftR: function (n) { + // if (n < 32) { + // var low = (this.low >>> n) | (this.high << (32 - n)); + // var high = this.high >>> n; + // } else { + // var low = this.high >>> (n - 32); + // var high = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Rotates this word n bits to the left. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotL(25); + */ + // rotL: function (n) { + // return this.shiftL(n).or(this.shiftR(64 - n)); + // }, + + /** + * Rotates this word n bits to the right. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotR(7); + */ + // rotR: function (n) { + // return this.shiftR(n).or(this.shiftL(64 - n)); + // }, + + /** + * Adds this word with the passed word. + * + * @param {X64Word} word The x64-Word to add with this word. + * + * @return {X64Word} A new x64-Word object after adding. + * + * @example + * + * var added = x64Word.add(anotherX64Word); + */ + // add: function (word) { + // var low = (this.low + word.low) | 0; + // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; + // var high = (this.high + word.high + carry) | 0; + + // return X64Word.create(high, low); + // } + }); + + /** + * An array of 64-bit words. + * + * @property {Array} words The array of CryptoJS.x64.Word objects. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var X64WordArray = C_x64.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.x64.WordArray.create(); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ]); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ], 10); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 8; + } + }, + + /** + * Converts this 64-bit word array to a 32-bit word array. + * + * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. + * + * @example + * + * var x32WordArray = x64WordArray.toX32(); + */ + toX32: function () { + // Shortcuts + var x64Words = this.words; + var x64WordsLength = x64Words.length; + + // Convert + var x32Words = []; + for (var i = 0; i < x64WordsLength; i++) { + var x64Word = x64Words[i]; + x32Words.push(x64Word.high); + x32Words.push(x64Word.low); + } + + return X32WordArray.create(x32Words, this.sigBytes); + }, + + /** + * Creates a copy of this word array. + * + * @return {X64WordArray} The clone. + * + * @example + * + * var clone = x64WordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + + // Clone "words" array + var words = clone.words = this.words.slice(0); + + // Clone each X64Word object + var wordsLength = words.length; + for (var i = 0; i < wordsLength; i++) { + words[i] = words[i].clone(); + } + + return clone; + } + }); + }()); + + + (function () { + // Check if typed arrays are supported + if (typeof ArrayBuffer != 'function') { + return; + } + + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + + // Reference original init + var superInit = WordArray.init; + + // Augment WordArray.init to handle typed arrays + var subInit = WordArray.init = function (typedArray) { + // Convert buffers to uint8 + if (typedArray instanceof ArrayBuffer) { + typedArray = new Uint8Array(typedArray); + } + + // Convert other array views to uint8 + if ( + typedArray instanceof Int8Array || + (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || + typedArray instanceof Int16Array || + typedArray instanceof Uint16Array || + typedArray instanceof Int32Array || + typedArray instanceof Uint32Array || + typedArray instanceof Float32Array || + typedArray instanceof Float64Array + ) { + typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); + } + + // Handle Uint8Array + if (typedArray instanceof Uint8Array) { + // Shortcut + var typedArrayByteLength = typedArray.byteLength; + + // Extract bytes + var words = []; + for (var i = 0; i < typedArrayByteLength; i++) { + words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); + } + + // Initialize this word array + superInit.call(this, words, typedArrayByteLength); + } else { + // Else call normal init + superInit.apply(this, arguments); + } + }; + + subInit.prototype = WordArray; + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * UTF-16 BE encoding strategy. + */ + var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { + /** + * Converts a word array to a UTF-16 BE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 BE string. + * + * @static + * + * @example + * + * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 BE string to a word array. + * + * @param {string} utf16Str The UTF-16 BE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + /** + * UTF-16 LE encoding strategy. + */ + C_enc.Utf16LE = { + /** + * Converts a word array to a UTF-16 LE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 LE string. + * + * @static + * + * @example + * + * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 LE string to a word array. + * + * @param {string} utf16Str The UTF-16 LE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + function swapEndian(word) { + return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); + } + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64 encoding strategy. + */ + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function (base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64url encoding strategy. + */ + var Base64url = C_enc.Base64url = { + /** + * Converts a word array to a Base64url string. + * + * @param {WordArray} wordArray The word array. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {string} The Base64url string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64url.stringify(wordArray); + */ + stringify: function (wordArray, urlSafe=true) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = urlSafe ? this._safe_map : this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64url string to a word array. + * + * @param {string} base64Str The Base64url string. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64url.parse(base64String); + */ + parse: function (base64Str, urlSafe=true) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = urlSafe ? this._safe_map : this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', + _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var T = []; + + // Compute constants + (function () { + for (var i = 0; i < 64; i++) { + T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; + } + }()); + + /** + * MD5 hash algorithm. + */ + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + + // Shortcuts + var H = this._hash.words; + + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; + + // Working varialbes + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + + // Computation + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( + (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | + (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) + ); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | + (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) + ); + + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + ((b & c) | (~b & d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + ((b & d) | (c & ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + C.MD5 = Hasher._createHelper(MD5); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + C.HmacMD5 = Hasher._createHmacHelper(MD5); + }(Math)); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Reusable object + var W = []; + + /** + * SHA-1 hash algorithm. + */ + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476, + 0xc3d2e1f0 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + + // Computation + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = (n << 1) | (n >>> 31); + } + + var t = ((a << 5) | (a >>> 27)) + e + W[i]; + if (i < 20) { + t += ((b & c) | (~b & d)) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; + } else /* if (i < 80) */ { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = (b << 30) | (b >>> 2); + b = a; + a = t; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + C.SHA1 = Hasher._createHelper(SHA1); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + }()); + + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Initialization and round constants tables + var H = []; + var K = []; + + // Compute constants + (function () { + function isPrime(n) { + var sqrtN = Math.sqrt(n); + for (var factor = 2; factor <= sqrtN; factor++) { + if (!(n % factor)) { + return false; + } + } + + return true; + } + + function getFractionalBits(n) { + return ((n - (n | 0)) * 0x100000000) | 0; + } + + var n = 2; + var nPrime = 0; + while (nPrime < 64) { + if (isPrime(n)) { + if (nPrime < 8) { + H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); + } + K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); + + nPrime++; + } + + n++; + } + }()); + + // Reusable object + var W = []; + + /** + * SHA-256 hash algorithm. + */ + var SHA256 = C_algo.SHA256 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init(H.slice(0)); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + var f = H[5]; + var g = H[6]; + var h = H[7]; + + // Computation + for (var i = 0; i < 64; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var gamma0x = W[i - 15]; + var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ + ((gamma0x << 14) | (gamma0x >>> 18)) ^ + (gamma0x >>> 3); + + var gamma1x = W[i - 2]; + var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ + ((gamma1x << 13) | (gamma1x >>> 19)) ^ + (gamma1x >>> 10); + + W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; + } + + var ch = (e & f) ^ (~e & g); + var maj = (a & b) ^ (a & c) ^ (b & c); + + var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); + var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); + + var t1 = h + sigma1 + ch + K[i] + W[i]; + var t2 = sigma0 + maj; + + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + H[5] = (H[5] + f) | 0; + H[6] = (H[6] + g) | 0; + H[7] = (H[7] + h) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA256('message'); + * var hash = CryptoJS.SHA256(wordArray); + */ + C.SHA256 = Hasher._createHelper(SHA256); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA256(message, key); + */ + C.HmacSHA256 = Hasher._createHmacHelper(SHA256); + }(Math)); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA256 = C_algo.SHA256; + + /** + * SHA-224 hash algorithm. + */ + var SHA224 = C_algo.SHA224 = SHA256.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 + ]); + }, + + _doFinalize: function () { + var hash = SHA256._doFinalize.call(this); + + hash.sigBytes -= 4; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA224('message'); + * var hash = CryptoJS.SHA224(wordArray); + */ + C.SHA224 = SHA256._createHelper(SHA224); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA224(message, key); + */ + C.HmacSHA224 = SHA256._createHmacHelper(SHA224); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + + function X64Word_create() { + return X64Word.create.apply(X64Word, arguments); + } + + // Constants + var K = [ + X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), + X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), + X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), + X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), + X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), + X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), + X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), + X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), + X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), + X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), + X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), + X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), + X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), + X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), + X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), + X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), + X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), + X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), + X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), + X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), + X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), + X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), + X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), + X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), + X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), + X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), + X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), + X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), + X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), + X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), + X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), + X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), + X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), + X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), + X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), + X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), + X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), + X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), + X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), + X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) + ]; + + // Reusable objects + var W = []; + (function () { + for (var i = 0; i < 80; i++) { + W[i] = X64Word_create(); + } + }()); + + /** + * SHA-512 hash algorithm. + */ + var SHA512 = C_algo.SHA512 = Hasher.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), + new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), + new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), + new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var H = this._hash.words; + + var H0 = H[0]; + var H1 = H[1]; + var H2 = H[2]; + var H3 = H[3]; + var H4 = H[4]; + var H5 = H[5]; + var H6 = H[6]; + var H7 = H[7]; + + var H0h = H0.high; + var H0l = H0.low; + var H1h = H1.high; + var H1l = H1.low; + var H2h = H2.high; + var H2l = H2.low; + var H3h = H3.high; + var H3l = H3.low; + var H4h = H4.high; + var H4l = H4.low; + var H5h = H5.high; + var H5l = H5.low; + var H6h = H6.high; + var H6l = H6.low; + var H7h = H7.high; + var H7l = H7.low; + + // Working variables + var ah = H0h; + var al = H0l; + var bh = H1h; + var bl = H1l; + var ch = H2h; + var cl = H2l; + var dh = H3h; + var dl = H3l; + var eh = H4h; + var el = H4l; + var fh = H5h; + var fl = H5l; + var gh = H6h; + var gl = H6l; + var hh = H7h; + var hl = H7l; + + // Rounds + for (var i = 0; i < 80; i++) { + var Wil; + var Wih; + + // Shortcut + var Wi = W[i]; + + // Extend message + if (i < 16) { + Wih = Wi.high = M[offset + i * 2] | 0; + Wil = Wi.low = M[offset + i * 2 + 1] | 0; + } else { + // Gamma0 + var gamma0x = W[i - 15]; + var gamma0xh = gamma0x.high; + var gamma0xl = gamma0x.low; + var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); + var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); + + // Gamma1 + var gamma1x = W[i - 2]; + var gamma1xh = gamma1x.high; + var gamma1xl = gamma1x.low; + var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); + var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); + + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7 = W[i - 7]; + var Wi7h = Wi7.high; + var Wi7l = Wi7.low; + + var Wi16 = W[i - 16]; + var Wi16h = Wi16.high; + var Wi16l = Wi16.low; + + Wil = gamma0l + Wi7l; + Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); + Wil = Wil + gamma1l; + Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); + Wil = Wil + Wi16l; + Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); + + Wi.high = Wih; + Wi.low = Wil; + } + + var chh = (eh & fh) ^ (~eh & gh); + var chl = (el & fl) ^ (~el & gl); + var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); + var majl = (al & bl) ^ (al & cl) ^ (bl & cl); + + var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); + var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); + var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); + var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); + + // t1 = h + sigma1 + ch + K[i] + W[i] + var Ki = K[i]; + var Kih = Ki.high; + var Kil = Ki.low; + + var t1l = hl + sigma1l; + var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); + var t1l = t1l + chl; + var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); + var t1l = t1l + Kil; + var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); + var t1l = t1l + Wil; + var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); + + // t2 = sigma0 + maj + var t2l = sigma0l + majl; + var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); + + // Update working variables + hh = gh; + hl = gl; + gh = fh; + gl = fl; + fh = eh; + fl = el; + el = (dl + t1l) | 0; + eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; + dh = ch; + dl = cl; + ch = bh; + cl = bl; + bh = ah; + bl = al; + al = (t1l + t2l) | 0; + ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; + } + + // Intermediate hash value + H0l = H0.low = (H0l + al); + H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); + H1l = H1.low = (H1l + bl); + H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); + H2l = H2.low = (H2l + cl); + H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); + H3l = H3.low = (H3l + dl); + H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); + H4l = H4.low = (H4l + el); + H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); + H5l = H5.low = (H5l + fl); + H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); + H6l = H6.low = (H6l + gl); + H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); + H7l = H7.low = (H7l + hl); + H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Convert hash to 32-bit word array before returning + var hash = this._hash.toX32(); + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + }, + + blockSize: 1024/32 + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA512('message'); + * var hash = CryptoJS.SHA512(wordArray); + */ + C.SHA512 = Hasher._createHelper(SHA512); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA512(message, key); + */ + C.HmacSHA512 = Hasher._createHmacHelper(SHA512); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + var SHA512 = C_algo.SHA512; + + /** + * SHA-384 hash algorithm. + */ + var SHA384 = C_algo.SHA384 = SHA512.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), + new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), + new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), + new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) + ]); + }, + + _doFinalize: function () { + var hash = SHA512._doFinalize.call(this); + + hash.sigBytes -= 16; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA384('message'); + * var hash = CryptoJS.SHA384(wordArray); + */ + C.SHA384 = SHA512._createHelper(SHA384); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA384(message, key); + */ + C.HmacSHA384 = SHA512._createHmacHelper(SHA384); + }()); + + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var C_algo = C.algo; + + // Constants tables + var RHO_OFFSETS = []; + var PI_INDEXES = []; + var ROUND_CONSTANTS = []; + + // Compute Constants + (function () { + // Compute rho offset constants + var x = 1, y = 0; + for (var t = 0; t < 24; t++) { + RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; + + var newX = y % 5; + var newY = (2 * x + 3 * y) % 5; + x = newX; + y = newY; + } + + // Compute pi index constants + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; + } + } + + // Compute round constants + var LFSR = 0x01; + for (var i = 0; i < 24; i++) { + var roundConstantMsw = 0; + var roundConstantLsw = 0; + + for (var j = 0; j < 7; j++) { + if (LFSR & 0x01) { + var bitPosition = (1 << j) - 1; + if (bitPosition < 32) { + roundConstantLsw ^= 1 << bitPosition; + } else /* if (bitPosition >= 32) */ { + roundConstantMsw ^= 1 << (bitPosition - 32); + } + } + + // Compute next LFSR + if (LFSR & 0x80) { + // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 + LFSR = (LFSR << 1) ^ 0x71; + } else { + LFSR <<= 1; + } + } + + ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); + } + }()); + + // Reusable objects for temporary values + var T = []; + (function () { + for (var i = 0; i < 25; i++) { + T[i] = X64Word.create(); + } + }()); + + /** + * SHA-3 hash algorithm. + */ + var SHA3 = C_algo.SHA3 = Hasher.extend({ + /** + * Configuration options. + * + * @property {number} outputLength + * The desired number of bits in the output hash. + * Only values permitted are: 224, 256, 384, 512. + * Default: 512 + */ + cfg: Hasher.cfg.extend({ + outputLength: 512 + }), + + _doReset: function () { + var state = this._state = [] + for (var i = 0; i < 25; i++) { + state[i] = new X64Word.init(); + } + + this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var state = this._state; + var nBlockSizeLanes = this.blockSize / 2; + + // Absorb + for (var i = 0; i < nBlockSizeLanes; i++) { + // Shortcuts + var M2i = M[offset + 2 * i]; + var M2i1 = M[offset + 2 * i + 1]; + + // Swap endian + M2i = ( + (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | + (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) + ); + M2i1 = ( + (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | + (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) + ); + + // Absorb message into state + var lane = state[i]; + lane.high ^= M2i1; + lane.low ^= M2i; + } + + // Rounds + for (var round = 0; round < 24; round++) { + // Theta + for (var x = 0; x < 5; x++) { + // Mix column lanes + var tMsw = 0, tLsw = 0; + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + tMsw ^= lane.high; + tLsw ^= lane.low; + } + + // Temporary values + var Tx = T[x]; + Tx.high = tMsw; + Tx.low = tLsw; + } + for (var x = 0; x < 5; x++) { + // Shortcuts + var Tx4 = T[(x + 4) % 5]; + var Tx1 = T[(x + 1) % 5]; + var Tx1Msw = Tx1.high; + var Tx1Lsw = Tx1.low; + + // Mix surrounding columns + var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); + var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + lane.high ^= tMsw; + lane.low ^= tLsw; + } + } + + // Rho Pi + for (var laneIndex = 1; laneIndex < 25; laneIndex++) { + var tMsw; + var tLsw; + + // Shortcuts + var lane = state[laneIndex]; + var laneMsw = lane.high; + var laneLsw = lane.low; + var rhoOffset = RHO_OFFSETS[laneIndex]; + + // Rotate lanes + if (rhoOffset < 32) { + tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); + tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); + } else /* if (rhoOffset >= 32) */ { + tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); + tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); + } + + // Transpose lanes + var TPiLane = T[PI_INDEXES[laneIndex]]; + TPiLane.high = tMsw; + TPiLane.low = tLsw; + } + + // Rho pi at x = y = 0 + var T0 = T[0]; + var state0 = state[0]; + T0.high = state0.high; + T0.low = state0.low; + + // Chi + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + // Shortcuts + var laneIndex = x + 5 * y; + var lane = state[laneIndex]; + var TLane = T[laneIndex]; + var Tx1Lane = T[((x + 1) % 5) + 5 * y]; + var Tx2Lane = T[((x + 2) % 5) + 5 * y]; + + // Mix rows + lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); + lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); + } + } + + // Iota + var lane = state[0]; + var roundConstant = ROUND_CONSTANTS[round]; + lane.high ^= roundConstant.high; + lane.low ^= roundConstant.low; + } + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + var blockSizeBits = this.blockSize * 32; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); + dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var state = this._state; + var outputLengthBytes = this.cfg.outputLength / 8; + var outputLengthLanes = outputLengthBytes / 8; + + // Squeeze + var hashWords = []; + for (var i = 0; i < outputLengthLanes; i++) { + // Shortcuts + var lane = state[i]; + var laneMsw = lane.high; + var laneLsw = lane.low; + + // Swap endian + laneMsw = ( + (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | + (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) + ); + laneLsw = ( + (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | + (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) + ); + + // Squeeze state to retrieve hash + hashWords.push(laneLsw); + hashWords.push(laneMsw); + } + + // Return final computed hash + return new WordArray.init(hashWords, outputLengthBytes); + }, + + clone: function () { + var clone = Hasher.clone.call(this); + + var state = clone._state = this._state.slice(0); + for (var i = 0; i < 25; i++) { + state[i] = state[i].clone(); + } + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA3('message'); + * var hash = CryptoJS.SHA3(wordArray); + */ + C.SHA3 = Hasher._createHelper(SHA3); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA3(message, key); + */ + C.HmacSHA3 = Hasher._createHmacHelper(SHA3); + }(Math)); + + + /** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. + */ + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var _zl = WordArray.create([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); + var _zr = WordArray.create([ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); + var _sl = WordArray.create([ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); + var _sr = WordArray.create([ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); + + var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); + var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); + + /** + * RIPEMD160 hash algorithm. + */ + var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ + _doReset: function () { + this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); + }, + + _doProcessBlock: function (M, offset) { + + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + // Swap + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + // Shortcut + var H = this._hash.words; + var hl = _hl.words; + var hr = _hr.words; + var zl = _zl.words; + var zr = _zr.words; + var sl = _sl.words; + var sr = _sr.words; + + // Working variables + var al, bl, cl, dl, el; + var ar, br, cr, dr, er; + + ar = al = H[0]; + br = bl = H[1]; + cr = cl = H[2]; + dr = dl = H[3]; + er = el = H[4]; + // Computation + var t; + for (var i = 0; i < 80; i += 1) { + t = (al + M[offset+zl[i]])|0; + if (i<16){ + t += f1(bl,cl,dl) + hl[0]; + } else if (i<32) { + t += f2(bl,cl,dl) + hl[1]; + } else if (i<48) { + t += f3(bl,cl,dl) + hl[2]; + } else if (i<64) { + t += f4(bl,cl,dl) + hl[3]; + } else {// if (i<80) { + t += f5(bl,cl,dl) + hl[4]; + } + t = t|0; + t = rotl(t,sl[i]); + t = (t+el)|0; + al = el; + el = dl; + dl = rotl(cl, 10); + cl = bl; + bl = t; + + t = (ar + M[offset+zr[i]])|0; + if (i<16){ + t += f5(br,cr,dr) + hr[0]; + } else if (i<32) { + t += f4(br,cr,dr) + hr[1]; + } else if (i<48) { + t += f3(br,cr,dr) + hr[2]; + } else if (i<64) { + t += f2(br,cr,dr) + hr[3]; + } else {// if (i<80) { + t += f1(br,cr,dr) + hr[4]; + } + t = t|0; + t = rotl(t,sr[i]) ; + t = (t+er)|0; + ar = er; + er = dr; + dr = rotl(cr, 10); + cr = br; + br = t; + } + // Intermediate hash value + t = (H[1] + cl + dr)|0; + H[1] = (H[2] + dl + er)|0; + H[2] = (H[3] + el + ar)|0; + H[3] = (H[4] + al + br)|0; + H[4] = (H[0] + bl + cr)|0; + H[0] = t; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | + (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) + ); + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 5; i++) { + // Shortcut + var H_i = H[i]; + + // Swap + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + + function f1(x, y, z) { + return ((x) ^ (y) ^ (z)); + + } + + function f2(x, y, z) { + return (((x)&(y)) | ((~x)&(z))); + } + + function f3(x, y, z) { + return (((x) | (~(y))) ^ (z)); + } + + function f4(x, y, z) { + return (((x) & (z)) | ((y)&(~(z)))); + } + + function f5(x, y, z) { + return ((x) ^ ((y) |(~(z)))); + + } + + function rotl(x,n) { + return (x<>>(32-n)); + } + + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.RIPEMD160('message'); + * var hash = CryptoJS.RIPEMD160(wordArray); + */ + C.RIPEMD160 = Hasher._createHelper(RIPEMD160); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacRIPEMD160(message, key); + */ + C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); + }(Math)); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + + /** + * HMAC algorithm. + */ + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function (hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); + + // Convert string to WordArray, else assume WordArray already + if (typeof key == 'string') { + key = Utf8.parse(key); + } + + // Shortcuts + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; + + // Allow arbitrary length keys + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } + + // Clamp excess bits + key.clamp(); + + // Clone key for inner and outer pads + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); + + // Shortcuts + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; + + // XOR keys with pad constants + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; + + // Set initial values + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function () { + // Shortcut + var hasher = this._hasher; + + // Reset + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function (messageUpdate) { + this._hasher.update(messageUpdate); + + // Chainable + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Shortcut + var hasher = this._hasher; + + // Compute HMAC + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + + return hmac; + } + }); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA1 = C_algo.SHA1; + var HMAC = C_algo.HMAC; + + /** + * Password-Based Key Derivation Function 2 algorithm. + */ + var PBKDF2 = C_algo.PBKDF2 = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hasher to use. Default: SHA1 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: SHA1, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.PBKDF2.create(); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + // Shortcut + var cfg = this.cfg; + + // Init HMAC + var hmac = HMAC.create(cfg.hasher, password); + + // Initial values + var derivedKey = WordArray.create(); + var blockIndex = WordArray.create([0x00000001]); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var blockIndexWords = blockIndex.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + var block = hmac.update(salt).finalize(blockIndex); + hmac.reset(); + + // Shortcuts + var blockWords = block.words; + var blockWordsLength = blockWords.length; + + // Iterations + var intermediate = block; + for (var i = 1; i < iterations; i++) { + intermediate = hmac.finalize(intermediate); + hmac.reset(); + + // Shortcut + var intermediateWords = intermediate.words; + + // XOR intermediate with block + for (var j = 0; j < blockWordsLength; j++) { + blockWords[j] ^= intermediateWords[j]; + } + } + + derivedKey.concat(block); + blockIndexWords[0]++; + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.PBKDF2(password, salt); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.PBKDF2 = function (password, salt, cfg) { + return PBKDF2.create(cfg).compute(password, salt); + }; + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + var block; + + // Shortcut + var cfg = this.cfg; + + // Init hasher + var hasher = cfg.hasher.create(); + + // Initial values + var derivedKey = WordArray.create(); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + block = hasher.update(password).finalize(salt); + hasher.reset(); + + // Iterations + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + }()); + + + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function (key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function (key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); + }, + + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function (xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Store transform mode and key + this._xformMode = xformMode; + this._key = key; + + // Set initial values + this.reset(); + }, + + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-cipher logic + this._doReset(); + }, + + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function (dataUpdate) { + // Append + this._append(dataUpdate); + + // Process available blocks + return this._process(); + }, + + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function (dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } + + // Perform concrete-cipher logic + var finalProcessedData = this._doFinalize(); + + return finalProcessedData; + }, + + keySize: 128/32, + + ivSize: 128/32, + + _ENC_XFORM_MODE: 1, + + _DEC_XFORM_MODE: 2, + + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: (function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } + + return function (cipher) { + return { + encrypt: function (message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + + decrypt: function (ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }()) + }); + + /** + * Abstract base stream cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) + */ + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function () { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); + + return finalProcessedBlocks; + }, + + blockSize: 1 + }); + + /** + * Mode namespace. + */ + var C_mode = C.mode = {}; + + /** + * Abstract base block cipher mode template. + */ + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function (cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, + + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function (cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, + + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function (cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + + /** + * Cipher Block Chaining mode. + */ + var CBC = C_mode.CBC = (function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + + /** + * CBC encryptor. + */ + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // XOR and encrypt + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + /** + * CBC decryptor. + */ + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + // Decrypt and XOR + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + var block; + + // Shortcut + var iv = this._iv; + + // Choose mixing block + if (iv) { + block = iv; + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + block = this._prevBlock; + } + + // XOR blocks + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }()); + + /** + * Padding namespace. + */ + var C_pad = C.pad = {}; + + /** + * PKCS #5/7 padding strategy. + */ + var Pkcs7 = C_pad.Pkcs7 = { + /** + * Pads data using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); + */ + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Create padding word + var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; + + // Create padding + var paddingWords = []; + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + var padding = WordArray.create(paddingWords, nPaddingBytes); + + // Add padding + data.concat(padding); + }, + + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + + reset: function () { + var modeCreator; + + // Reset cipher + Cipher.reset.call(this); + + // Shortcuts + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; + + // Reset block mode + if (this._xformMode == this._ENC_XFORM_MODE) { + modeCreator = mode.createEncryptor; + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + modeCreator = mode.createDecryptor; + // Keep at least one block in the buffer for unpadding + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + + _doProcessBlock: function (words, offset) { + this._mode.processBlock(words, offset); + }, + + _doFinalize: function () { + var finalProcessedBlocks; + + // Shortcut + var padding = this.cfg.padding; + + // Finalize + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); + + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + // Process final blocks + finalProcessedBlocks = this._process(!!'flush'); + + // Unpad data + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + + blockSize: 128/32 + }); + + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function (cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function (formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + + /** + * Format namespace. + */ + var C_format = C.format = {}; + + /** + * OpenSSL formatting strategy. + */ + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function (cipherParams) { + var wordArray; + + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; + + // Format + if (salt) { + wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function (openSSLStr) { + var salt; + + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); + + // Shortcut + var ciphertextWords = ciphertext.words; + + // Test for salt + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + salt = WordArray.create(ciphertextWords.slice(2, 4)); + + // Remove salt from ciphertext + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ ciphertext: ciphertext, salt: salt }); + } + }; + + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Encrypt + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); + + // Shortcut + var cipherCfg = encryptor.cfg; + + // Create and return serializable cipher params + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Decrypt + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function (ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + + /** + * Key derivation function namespace. + */ + var C_kdf = C.kdf = {}; + + /** + * OpenSSL key derivation function. + */ + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function (password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64/8); + } + + // Derive key and IV + var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); + + // Separate key and IV + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; + + // Return params + return CipherParams.create({ key: key, iv: iv, salt: salt }); + } + }; + + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Encrypt + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); + + // Mix in derived params + ciphertext.mixIn(derivedParams); + + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Decrypt + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + + return plaintext; + } + }); + }()); + + + /** + * Cipher Feedback block mode. + */ + CryptoJS.mode.CFB = (function () { + var CFB = CryptoJS.lib.BlockCipherMode.extend(); + + CFB.Encryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + CFB.Decryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { + var keystream; + + // Shortcut + var iv = this._iv; + + // Generate keystream + if (iv) { + keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + keystream = this._prevBlock; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + + return CFB; + }()); + + + /** + * Counter block mode. + */ + CryptoJS.mode.CTR = (function () { + var CTR = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = CTR.Encryptor = CTR.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Increment counter + counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTR.Decryptor = Encryptor; + + return CTR; + }()); + + + /** @preserve + * Counter block mode compatible with Dr Brian Gladman fileenc.c + * derived from CryptoJS.mode.CTR + * Jan Hruby jhruby.web@gmail.com + */ + CryptoJS.mode.CTRGladman = (function () { + var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); + + function incWord(word) + { + if (((word >> 24) & 0xff) === 0xff) { //overflow + var b1 = (word >> 16)&0xff; + var b2 = (word >> 8)&0xff; + var b3 = word & 0xff; + + if (b1 === 0xff) // overflow b1 + { + b1 = 0; + if (b2 === 0xff) + { + b2 = 0; + if (b3 === 0xff) + { + b3 = 0; + } + else + { + ++b3; + } + } + else + { + ++b2; + } + } + else + { + ++b1; + } + + word = 0; + word += (b1 << 16); + word += (b2 << 8); + word += b3; + } + else + { + word += (0x01 << 24); + } + return word; + } + + function incCounter(counter) + { + if ((counter[0] = incWord(counter[0])) === 0) + { + // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 + counter[1] = incWord(counter[1]); + } + return counter; + } + + var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + + incCounter(counter); + + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTRGladman.Decryptor = Encryptor; + + return CTRGladman; + }()); + + + + + /** + * Output Feedback block mode. + */ + CryptoJS.mode.OFB = (function () { + var OFB = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = OFB.Encryptor = OFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var keystream = this._keystream; + + // Generate keystream + if (iv) { + keystream = this._keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + OFB.Decryptor = Encryptor; + + return OFB; + }()); + + + /** + * Electronic Codebook block mode. + */ + CryptoJS.mode.ECB = (function () { + var ECB = CryptoJS.lib.BlockCipherMode.extend(); + + ECB.Encryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.encryptBlock(words, offset); + } + }); + + ECB.Decryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.decryptBlock(words, offset); + } + }); + + return ECB; + }()); + + + /** + * ANSI X.923 padding strategy. + */ + CryptoJS.pad.AnsiX923 = { + pad: function (data, blockSize) { + // Shortcuts + var dataSigBytes = data.sigBytes; + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; + + // Compute last byte position + var lastBytePos = dataSigBytes + nPaddingBytes - 1; + + // Pad + data.clamp(); + data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); + data.sigBytes += nPaddingBytes; + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + /** + * ISO 10126 padding strategy. + */ + CryptoJS.pad.Iso10126 = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Pad + data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). + concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + /** + * ISO/IEC 9797-1 Padding Method 2. + */ + CryptoJS.pad.Iso97971 = { + pad: function (data, blockSize) { + // Add 0x80 byte + data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); + + // Zero pad the rest + CryptoJS.pad.ZeroPadding.pad(data, blockSize); + }, + + unpad: function (data) { + // Remove zero padding + CryptoJS.pad.ZeroPadding.unpad(data); + + // Remove one more byte -- the 0x80 byte + data.sigBytes--; + } + }; + + + /** + * Zero padding strategy. + */ + CryptoJS.pad.ZeroPadding = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Pad + data.clamp(); + data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); + }, + + unpad: function (data) { + // Shortcut + var dataWords = data.words; + + // Unpad + var i = data.sigBytes - 1; + for (var i = data.sigBytes - 1; i >= 0; i--) { + if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { + data.sigBytes = i + 1; + break; + } + } + } + }; + + + /** + * A noop padding strategy. + */ + CryptoJS.pad.NoPadding = { + pad: function () { + }, + + unpad: function () { + } + }; + + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var CipherParams = C_lib.CipherParams; + var C_enc = C.enc; + var Hex = C_enc.Hex; + var C_format = C.format; + + var HexFormatter = C_format.Hex = { + /** + * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The hexadecimally encoded string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.format.Hex.stringify(cipherParams); + */ + stringify: function (cipherParams) { + return cipherParams.ciphertext.toString(Hex); + }, + + /** + * Converts a hexadecimally encoded ciphertext string to a cipher params object. + * + * @param {string} input The hexadecimally encoded string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.Hex.parse(hexString); + */ + parse: function (input) { + var ciphertext = Hex.parse(input); + return CipherParams.create({ ciphertext: ciphertext }); + } + }; + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Lookup tables + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; + + // Compute lookup tables + (function () { + // Compute double table + var d = []; + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = (i << 1) ^ 0x11b; + } + } + + // Walk GF(2^8) + var x = 0; + var xi = 0; + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; + + // Compute multiplication + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; + + // Compute sub bytes, mix columns tables + var t = (d[sx] * 0x101) ^ (sx * 0x1010100); + SUB_MIX_0[x] = (t << 24) | (t >>> 8); + SUB_MIX_1[x] = (t << 16) | (t >>> 16); + SUB_MIX_2[x] = (t << 8) | (t >>> 24); + SUB_MIX_3[x] = t; + + // Compute inv sub bytes, inv mix columns tables + var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); + INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); + INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); + INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); + INV_SUB_MIX_3[sx] = t; + + // Compute next counter + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + }()); + + // Precomputed Rcon lookup + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + + /** + * AES block cipher algorithm. + */ + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function () { + var t; + + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } + + // Shortcuts + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; + + // Compute number of rounds + var nRounds = this._nRounds = keySize + 6; + + // Compute number of key schedule rows + var ksRows = (nRounds + 1) * 4; + + // Compute key schedule + var keySchedule = this._keySchedule = []; + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = (t << 8) | (t >>> 24); + + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + + // Mix Rcon + t ^= RCON[(ksRow / keySize) | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } + + // Compute inv key schedule + var invKeySchedule = this._invKeySchedule = []; + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ + INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + + decryptBlock: function (M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); + + // Inv swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + + _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; + + // Get input, add round key + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; + + // Key schedule row counter + var ksRow = 4; + + // Rounds + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; + + // Update state + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } + + // Shift rows, sub bytes, add round key + var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; + + // Set output + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + + keySize: 256/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); + */ + C.AES = BlockCipher._createHelper(AES); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Permuted Choice 1 constants + var PC1 = [ + 57, 49, 41, 33, 25, 17, 9, 1, + 58, 50, 42, 34, 26, 18, 10, 2, + 59, 51, 43, 35, 27, 19, 11, 3, + 60, 52, 44, 36, 63, 55, 47, 39, + 31, 23, 15, 7, 62, 54, 46, 38, + 30, 22, 14, 6, 61, 53, 45, 37, + 29, 21, 13, 5, 28, 20, 12, 4 + ]; + + // Permuted Choice 2 constants + var PC2 = [ + 14, 17, 11, 24, 1, 5, + 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, + 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, + 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, + 46, 42, 50, 36, 29, 32 + ]; + + // Cumulative bit shift constants + var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; + + // SBOXes and round permutation constants + var SBOX_P = [ + { + 0x0: 0x808200, + 0x10000000: 0x8000, + 0x20000000: 0x808002, + 0x30000000: 0x2, + 0x40000000: 0x200, + 0x50000000: 0x808202, + 0x60000000: 0x800202, + 0x70000000: 0x800000, + 0x80000000: 0x202, + 0x90000000: 0x800200, + 0xa0000000: 0x8200, + 0xb0000000: 0x808000, + 0xc0000000: 0x8002, + 0xd0000000: 0x800002, + 0xe0000000: 0x0, + 0xf0000000: 0x8202, + 0x8000000: 0x0, + 0x18000000: 0x808202, + 0x28000000: 0x8202, + 0x38000000: 0x8000, + 0x48000000: 0x808200, + 0x58000000: 0x200, + 0x68000000: 0x808002, + 0x78000000: 0x2, + 0x88000000: 0x800200, + 0x98000000: 0x8200, + 0xa8000000: 0x808000, + 0xb8000000: 0x800202, + 0xc8000000: 0x800002, + 0xd8000000: 0x8002, + 0xe8000000: 0x202, + 0xf8000000: 0x800000, + 0x1: 0x8000, + 0x10000001: 0x2, + 0x20000001: 0x808200, + 0x30000001: 0x800000, + 0x40000001: 0x808002, + 0x50000001: 0x8200, + 0x60000001: 0x200, + 0x70000001: 0x800202, + 0x80000001: 0x808202, + 0x90000001: 0x808000, + 0xa0000001: 0x800002, + 0xb0000001: 0x8202, + 0xc0000001: 0x202, + 0xd0000001: 0x800200, + 0xe0000001: 0x8002, + 0xf0000001: 0x0, + 0x8000001: 0x808202, + 0x18000001: 0x808000, + 0x28000001: 0x800000, + 0x38000001: 0x200, + 0x48000001: 0x8000, + 0x58000001: 0x800002, + 0x68000001: 0x2, + 0x78000001: 0x8202, + 0x88000001: 0x8002, + 0x98000001: 0x800202, + 0xa8000001: 0x202, + 0xb8000001: 0x808200, + 0xc8000001: 0x800200, + 0xd8000001: 0x0, + 0xe8000001: 0x8200, + 0xf8000001: 0x808002 + }, + { + 0x0: 0x40084010, + 0x1000000: 0x4000, + 0x2000000: 0x80000, + 0x3000000: 0x40080010, + 0x4000000: 0x40000010, + 0x5000000: 0x40084000, + 0x6000000: 0x40004000, + 0x7000000: 0x10, + 0x8000000: 0x84000, + 0x9000000: 0x40004010, + 0xa000000: 0x40000000, + 0xb000000: 0x84010, + 0xc000000: 0x80010, + 0xd000000: 0x0, + 0xe000000: 0x4010, + 0xf000000: 0x40080000, + 0x800000: 0x40004000, + 0x1800000: 0x84010, + 0x2800000: 0x10, + 0x3800000: 0x40004010, + 0x4800000: 0x40084010, + 0x5800000: 0x40000000, + 0x6800000: 0x80000, + 0x7800000: 0x40080010, + 0x8800000: 0x80010, + 0x9800000: 0x0, + 0xa800000: 0x4000, + 0xb800000: 0x40080000, + 0xc800000: 0x40000010, + 0xd800000: 0x84000, + 0xe800000: 0x40084000, + 0xf800000: 0x4010, + 0x10000000: 0x0, + 0x11000000: 0x40080010, + 0x12000000: 0x40004010, + 0x13000000: 0x40084000, + 0x14000000: 0x40080000, + 0x15000000: 0x10, + 0x16000000: 0x84010, + 0x17000000: 0x4000, + 0x18000000: 0x4010, + 0x19000000: 0x80000, + 0x1a000000: 0x80010, + 0x1b000000: 0x40000010, + 0x1c000000: 0x84000, + 0x1d000000: 0x40004000, + 0x1e000000: 0x40000000, + 0x1f000000: 0x40084010, + 0x10800000: 0x84010, + 0x11800000: 0x80000, + 0x12800000: 0x40080000, + 0x13800000: 0x4000, + 0x14800000: 0x40004000, + 0x15800000: 0x40084010, + 0x16800000: 0x10, + 0x17800000: 0x40000000, + 0x18800000: 0x40084000, + 0x19800000: 0x40000010, + 0x1a800000: 0x40004010, + 0x1b800000: 0x80010, + 0x1c800000: 0x0, + 0x1d800000: 0x4010, + 0x1e800000: 0x40080010, + 0x1f800000: 0x84000 + }, + { + 0x0: 0x104, + 0x100000: 0x0, + 0x200000: 0x4000100, + 0x300000: 0x10104, + 0x400000: 0x10004, + 0x500000: 0x4000004, + 0x600000: 0x4010104, + 0x700000: 0x4010000, + 0x800000: 0x4000000, + 0x900000: 0x4010100, + 0xa00000: 0x10100, + 0xb00000: 0x4010004, + 0xc00000: 0x4000104, + 0xd00000: 0x10000, + 0xe00000: 0x4, + 0xf00000: 0x100, + 0x80000: 0x4010100, + 0x180000: 0x4010004, + 0x280000: 0x0, + 0x380000: 0x4000100, + 0x480000: 0x4000004, + 0x580000: 0x10000, + 0x680000: 0x10004, + 0x780000: 0x104, + 0x880000: 0x4, + 0x980000: 0x100, + 0xa80000: 0x4010000, + 0xb80000: 0x10104, + 0xc80000: 0x10100, + 0xd80000: 0x4000104, + 0xe80000: 0x4010104, + 0xf80000: 0x4000000, + 0x1000000: 0x4010100, + 0x1100000: 0x10004, + 0x1200000: 0x10000, + 0x1300000: 0x4000100, + 0x1400000: 0x100, + 0x1500000: 0x4010104, + 0x1600000: 0x4000004, + 0x1700000: 0x0, + 0x1800000: 0x4000104, + 0x1900000: 0x4000000, + 0x1a00000: 0x4, + 0x1b00000: 0x10100, + 0x1c00000: 0x4010000, + 0x1d00000: 0x104, + 0x1e00000: 0x10104, + 0x1f00000: 0x4010004, + 0x1080000: 0x4000000, + 0x1180000: 0x104, + 0x1280000: 0x4010100, + 0x1380000: 0x0, + 0x1480000: 0x10004, + 0x1580000: 0x4000100, + 0x1680000: 0x100, + 0x1780000: 0x4010004, + 0x1880000: 0x10000, + 0x1980000: 0x4010104, + 0x1a80000: 0x10104, + 0x1b80000: 0x4000004, + 0x1c80000: 0x4000104, + 0x1d80000: 0x4010000, + 0x1e80000: 0x4, + 0x1f80000: 0x10100 + }, + { + 0x0: 0x80401000, + 0x10000: 0x80001040, + 0x20000: 0x401040, + 0x30000: 0x80400000, + 0x40000: 0x0, + 0x50000: 0x401000, + 0x60000: 0x80000040, + 0x70000: 0x400040, + 0x80000: 0x80000000, + 0x90000: 0x400000, + 0xa0000: 0x40, + 0xb0000: 0x80001000, + 0xc0000: 0x80400040, + 0xd0000: 0x1040, + 0xe0000: 0x1000, + 0xf0000: 0x80401040, + 0x8000: 0x80001040, + 0x18000: 0x40, + 0x28000: 0x80400040, + 0x38000: 0x80001000, + 0x48000: 0x401000, + 0x58000: 0x80401040, + 0x68000: 0x0, + 0x78000: 0x80400000, + 0x88000: 0x1000, + 0x98000: 0x80401000, + 0xa8000: 0x400000, + 0xb8000: 0x1040, + 0xc8000: 0x80000000, + 0xd8000: 0x400040, + 0xe8000: 0x401040, + 0xf8000: 0x80000040, + 0x100000: 0x400040, + 0x110000: 0x401000, + 0x120000: 0x80000040, + 0x130000: 0x0, + 0x140000: 0x1040, + 0x150000: 0x80400040, + 0x160000: 0x80401000, + 0x170000: 0x80001040, + 0x180000: 0x80401040, + 0x190000: 0x80000000, + 0x1a0000: 0x80400000, + 0x1b0000: 0x401040, + 0x1c0000: 0x80001000, + 0x1d0000: 0x400000, + 0x1e0000: 0x40, + 0x1f0000: 0x1000, + 0x108000: 0x80400000, + 0x118000: 0x80401040, + 0x128000: 0x0, + 0x138000: 0x401000, + 0x148000: 0x400040, + 0x158000: 0x80000000, + 0x168000: 0x80001040, + 0x178000: 0x40, + 0x188000: 0x80000040, + 0x198000: 0x1000, + 0x1a8000: 0x80001000, + 0x1b8000: 0x80400040, + 0x1c8000: 0x1040, + 0x1d8000: 0x80401000, + 0x1e8000: 0x400000, + 0x1f8000: 0x401040 + }, + { + 0x0: 0x80, + 0x1000: 0x1040000, + 0x2000: 0x40000, + 0x3000: 0x20000000, + 0x4000: 0x20040080, + 0x5000: 0x1000080, + 0x6000: 0x21000080, + 0x7000: 0x40080, + 0x8000: 0x1000000, + 0x9000: 0x20040000, + 0xa000: 0x20000080, + 0xb000: 0x21040080, + 0xc000: 0x21040000, + 0xd000: 0x0, + 0xe000: 0x1040080, + 0xf000: 0x21000000, + 0x800: 0x1040080, + 0x1800: 0x21000080, + 0x2800: 0x80, + 0x3800: 0x1040000, + 0x4800: 0x40000, + 0x5800: 0x20040080, + 0x6800: 0x21040000, + 0x7800: 0x20000000, + 0x8800: 0x20040000, + 0x9800: 0x0, + 0xa800: 0x21040080, + 0xb800: 0x1000080, + 0xc800: 0x20000080, + 0xd800: 0x21000000, + 0xe800: 0x1000000, + 0xf800: 0x40080, + 0x10000: 0x40000, + 0x11000: 0x80, + 0x12000: 0x20000000, + 0x13000: 0x21000080, + 0x14000: 0x1000080, + 0x15000: 0x21040000, + 0x16000: 0x20040080, + 0x17000: 0x1000000, + 0x18000: 0x21040080, + 0x19000: 0x21000000, + 0x1a000: 0x1040000, + 0x1b000: 0x20040000, + 0x1c000: 0x40080, + 0x1d000: 0x20000080, + 0x1e000: 0x0, + 0x1f000: 0x1040080, + 0x10800: 0x21000080, + 0x11800: 0x1000000, + 0x12800: 0x1040000, + 0x13800: 0x20040080, + 0x14800: 0x20000000, + 0x15800: 0x1040080, + 0x16800: 0x80, + 0x17800: 0x21040000, + 0x18800: 0x40080, + 0x19800: 0x21040080, + 0x1a800: 0x0, + 0x1b800: 0x21000000, + 0x1c800: 0x1000080, + 0x1d800: 0x40000, + 0x1e800: 0x20040000, + 0x1f800: 0x20000080 + }, + { + 0x0: 0x10000008, + 0x100: 0x2000, + 0x200: 0x10200000, + 0x300: 0x10202008, + 0x400: 0x10002000, + 0x500: 0x200000, + 0x600: 0x200008, + 0x700: 0x10000000, + 0x800: 0x0, + 0x900: 0x10002008, + 0xa00: 0x202000, + 0xb00: 0x8, + 0xc00: 0x10200008, + 0xd00: 0x202008, + 0xe00: 0x2008, + 0xf00: 0x10202000, + 0x80: 0x10200000, + 0x180: 0x10202008, + 0x280: 0x8, + 0x380: 0x200000, + 0x480: 0x202008, + 0x580: 0x10000008, + 0x680: 0x10002000, + 0x780: 0x2008, + 0x880: 0x200008, + 0x980: 0x2000, + 0xa80: 0x10002008, + 0xb80: 0x10200008, + 0xc80: 0x0, + 0xd80: 0x10202000, + 0xe80: 0x202000, + 0xf80: 0x10000000, + 0x1000: 0x10002000, + 0x1100: 0x10200008, + 0x1200: 0x10202008, + 0x1300: 0x2008, + 0x1400: 0x200000, + 0x1500: 0x10000000, + 0x1600: 0x10000008, + 0x1700: 0x202000, + 0x1800: 0x202008, + 0x1900: 0x0, + 0x1a00: 0x8, + 0x1b00: 0x10200000, + 0x1c00: 0x2000, + 0x1d00: 0x10002008, + 0x1e00: 0x10202000, + 0x1f00: 0x200008, + 0x1080: 0x8, + 0x1180: 0x202000, + 0x1280: 0x200000, + 0x1380: 0x10000008, + 0x1480: 0x10002000, + 0x1580: 0x2008, + 0x1680: 0x10202008, + 0x1780: 0x10200000, + 0x1880: 0x10202000, + 0x1980: 0x10200008, + 0x1a80: 0x2000, + 0x1b80: 0x202008, + 0x1c80: 0x200008, + 0x1d80: 0x0, + 0x1e80: 0x10000000, + 0x1f80: 0x10002008 + }, + { + 0x0: 0x100000, + 0x10: 0x2000401, + 0x20: 0x400, + 0x30: 0x100401, + 0x40: 0x2100401, + 0x50: 0x0, + 0x60: 0x1, + 0x70: 0x2100001, + 0x80: 0x2000400, + 0x90: 0x100001, + 0xa0: 0x2000001, + 0xb0: 0x2100400, + 0xc0: 0x2100000, + 0xd0: 0x401, + 0xe0: 0x100400, + 0xf0: 0x2000000, + 0x8: 0x2100001, + 0x18: 0x0, + 0x28: 0x2000401, + 0x38: 0x2100400, + 0x48: 0x100000, + 0x58: 0x2000001, + 0x68: 0x2000000, + 0x78: 0x401, + 0x88: 0x100401, + 0x98: 0x2000400, + 0xa8: 0x2100000, + 0xb8: 0x100001, + 0xc8: 0x400, + 0xd8: 0x2100401, + 0xe8: 0x1, + 0xf8: 0x100400, + 0x100: 0x2000000, + 0x110: 0x100000, + 0x120: 0x2000401, + 0x130: 0x2100001, + 0x140: 0x100001, + 0x150: 0x2000400, + 0x160: 0x2100400, + 0x170: 0x100401, + 0x180: 0x401, + 0x190: 0x2100401, + 0x1a0: 0x100400, + 0x1b0: 0x1, + 0x1c0: 0x0, + 0x1d0: 0x2100000, + 0x1e0: 0x2000001, + 0x1f0: 0x400, + 0x108: 0x100400, + 0x118: 0x2000401, + 0x128: 0x2100001, + 0x138: 0x1, + 0x148: 0x2000000, + 0x158: 0x100000, + 0x168: 0x401, + 0x178: 0x2100400, + 0x188: 0x2000001, + 0x198: 0x2100000, + 0x1a8: 0x0, + 0x1b8: 0x2100401, + 0x1c8: 0x100401, + 0x1d8: 0x400, + 0x1e8: 0x2000400, + 0x1f8: 0x100001 + }, + { + 0x0: 0x8000820, + 0x1: 0x20000, + 0x2: 0x8000000, + 0x3: 0x20, + 0x4: 0x20020, + 0x5: 0x8020820, + 0x6: 0x8020800, + 0x7: 0x800, + 0x8: 0x8020000, + 0x9: 0x8000800, + 0xa: 0x20800, + 0xb: 0x8020020, + 0xc: 0x820, + 0xd: 0x0, + 0xe: 0x8000020, + 0xf: 0x20820, + 0x80000000: 0x800, + 0x80000001: 0x8020820, + 0x80000002: 0x8000820, + 0x80000003: 0x8000000, + 0x80000004: 0x8020000, + 0x80000005: 0x20800, + 0x80000006: 0x20820, + 0x80000007: 0x20, + 0x80000008: 0x8000020, + 0x80000009: 0x820, + 0x8000000a: 0x20020, + 0x8000000b: 0x8020800, + 0x8000000c: 0x0, + 0x8000000d: 0x8020020, + 0x8000000e: 0x8000800, + 0x8000000f: 0x20000, + 0x10: 0x20820, + 0x11: 0x8020800, + 0x12: 0x20, + 0x13: 0x800, + 0x14: 0x8000800, + 0x15: 0x8000020, + 0x16: 0x8020020, + 0x17: 0x20000, + 0x18: 0x0, + 0x19: 0x20020, + 0x1a: 0x8020000, + 0x1b: 0x8000820, + 0x1c: 0x8020820, + 0x1d: 0x20800, + 0x1e: 0x820, + 0x1f: 0x8000000, + 0x80000010: 0x20000, + 0x80000011: 0x800, + 0x80000012: 0x8020020, + 0x80000013: 0x20820, + 0x80000014: 0x20, + 0x80000015: 0x8020000, + 0x80000016: 0x8000000, + 0x80000017: 0x8000820, + 0x80000018: 0x8020820, + 0x80000019: 0x8000020, + 0x8000001a: 0x8000800, + 0x8000001b: 0x0, + 0x8000001c: 0x20800, + 0x8000001d: 0x820, + 0x8000001e: 0x20020, + 0x8000001f: 0x8020800 + } + ]; + + // Masks that select the SBOX input + var SBOX_MASK = [ + 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, + 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f + ]; + + /** + * DES block cipher algorithm. + */ + var DES = C_algo.DES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + + // Select 56 bits according to PC1 + var keyBits = []; + for (var i = 0; i < 56; i++) { + var keyBitPos = PC1[i] - 1; + keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; + } + + // Assemble 16 subkeys + var subKeys = this._subKeys = []; + for (var nSubKey = 0; nSubKey < 16; nSubKey++) { + // Create subkey + var subKey = subKeys[nSubKey] = []; + + // Shortcut + var bitShift = BIT_SHIFTS[nSubKey]; + + // Select 48 bits according to PC2 + for (var i = 0; i < 24; i++) { + // Select from the left 28 key bits + subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); + + // Select from the right 28 key bits + subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); + } + + // Since each subkey is applied to an expanded 32-bit input, + // the subkey can be broken into 8 values scaled to 32-bits, + // which allows the key to be used without expansion + subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); + for (var i = 1; i < 7; i++) { + subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); + } + subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); + } + + // Compute inverse subkeys + var invSubKeys = this._invSubKeys = []; + for (var i = 0; i < 16; i++) { + invSubKeys[i] = subKeys[15 - i]; + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._subKeys); + }, + + decryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._invSubKeys); + }, + + _doCryptBlock: function (M, offset, subKeys) { + // Get input + this._lBlock = M[offset]; + this._rBlock = M[offset + 1]; + + // Initial permutation + exchangeLR.call(this, 4, 0x0f0f0f0f); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeRL.call(this, 2, 0x33333333); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeLR.call(this, 1, 0x55555555); + + // Rounds + for (var round = 0; round < 16; round++) { + // Shortcuts + var subKey = subKeys[round]; + var lBlock = this._lBlock; + var rBlock = this._rBlock; + + // Feistel function + var f = 0; + for (var i = 0; i < 8; i++) { + f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; + } + this._lBlock = rBlock; + this._rBlock = lBlock ^ f; + } + + // Undo swap from last round + var t = this._lBlock; + this._lBlock = this._rBlock; + this._rBlock = t; + + // Final permutation + exchangeLR.call(this, 1, 0x55555555); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeRL.call(this, 2, 0x33333333); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeLR.call(this, 4, 0x0f0f0f0f); + + // Set output + M[offset] = this._lBlock; + M[offset + 1] = this._rBlock; + }, + + keySize: 64/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + // Swap bits across the left and right words + function exchangeLR(offset, mask) { + var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; + this._rBlock ^= t; + this._lBlock ^= t << offset; + } + + function exchangeRL(offset, mask) { + var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; + this._lBlock ^= t; + this._rBlock ^= t << offset; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); + */ + C.DES = BlockCipher._createHelper(DES); + + /** + * Triple-DES block cipher algorithm. + */ + var TripleDES = C_algo.TripleDES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + // Make sure the key length is valid (64, 128 or >= 192 bit) + if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) { + throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.'); + } + + // Extend the key according to the keying options defined in 3DES standard + var key1 = keyWords.slice(0, 2); + var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4); + var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6); + + // Create DES instances + this._des1 = DES.createEncryptor(WordArray.create(key1)); + this._des2 = DES.createEncryptor(WordArray.create(key2)); + this._des3 = DES.createEncryptor(WordArray.create(key3)); + }, + + encryptBlock: function (M, offset) { + this._des1.encryptBlock(M, offset); + this._des2.decryptBlock(M, offset); + this._des3.encryptBlock(M, offset); + }, + + decryptBlock: function (M, offset) { + this._des3.decryptBlock(M, offset); + this._des2.encryptBlock(M, offset); + this._des1.decryptBlock(M, offset); + }, + + keySize: 192/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); + */ + C.TripleDES = BlockCipher._createHelper(TripleDES); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + /** + * RC4 stream cipher algorithm. + */ + var RC4 = C_algo.RC4 = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + var keySigBytes = key.sigBytes; + + // Init sbox + var S = this._S = []; + for (var i = 0; i < 256; i++) { + S[i] = i; + } + + // Key setup + for (var i = 0, j = 0; i < 256; i++) { + var keyByteIndex = i % keySigBytes; + var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; + + j = (j + S[i] + keyByte) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + } + + // Counters + this._i = this._j = 0; + }, + + _doProcessBlock: function (M, offset) { + M[offset] ^= generateKeystreamWord.call(this); + }, + + keySize: 256/32, + + ivSize: 0 + }); + + function generateKeystreamWord() { + // Shortcuts + var S = this._S; + var i = this._i; + var j = this._j; + + // Generate keystream word + var keystreamWord = 0; + for (var n = 0; n < 4; n++) { + i = (i + 1) % 256; + j = (j + S[i]) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + + keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); + } + + // Update counters + this._i = i; + this._j = j; + + return keystreamWord; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); + */ + C.RC4 = StreamCipher._createHelper(RC4); + + /** + * Modified RC4 stream cipher algorithm. + */ + var RC4Drop = C_algo.RC4Drop = RC4.extend({ + /** + * Configuration options. + * + * @property {number} drop The number of keystream words to drop. Default 192 + */ + cfg: RC4.cfg.extend({ + drop: 192 + }), + + _doReset: function () { + RC4._doReset.call(this); + + // Drop + for (var i = this.cfg.drop; i > 0; i--) { + generateKeystreamWord.call(this); + } + } + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); + */ + C.RC4Drop = StreamCipher._createHelper(RC4Drop); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm + */ + var Rabbit = C_algo.Rabbit = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Swap endian + for (var i = 0; i < 4; i++) { + K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | + (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); + } + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); + * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); + */ + C.Rabbit = StreamCipher._createHelper(Rabbit); + }()); + + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm. + * + * This is a legacy version that neglected to convert the key to little-endian. + * This error doesn't affect the cipher's security, + * but it does affect its compatibility with other implementations. + */ + var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); + */ + C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); + }()); + + + return CryptoJS; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/docs/QuickStartGuide.wiki b/node_modules/crypto-js/docs/QuickStartGuide.wiki new file mode 100644 index 0000000..2bee35d --- /dev/null +++ b/node_modules/crypto-js/docs/QuickStartGuide.wiki @@ -0,0 +1,470 @@ + + +---- + += Quick-start Guide = + +== Hashers == + +=== The Hasher Algorithms === + +==== MD5 ==== + +MD5 is a widely used hash function. It's been used in a variety of security applications and is also commonly used to check the integrity of files. Though, MD5 is not collision resistant, and it isn't suitable for applications like SSL certificates or digital signatures that rely on this property. + +{{{ + + +}}} + +==== SHA-1 ==== + +The SHA hash functions were designed by the National Security Agency (NSA). SHA-1 is the most established of the existing SHA hash functions, and it's used in a variety of security applications and protocols. Though, SHA-1's collision resistance has been weakening as new attacks are discovered or improved. + +{{{ + + +}}} + +==== SHA-2 ==== + +SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it appears to provide much better security. + +{{{ + + +}}} + +SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32. + +{{{ + + +}}} + +CryptoJS also supports SHA-224 and SHA-384, which are largely identical but truncated versions of SHA-256 and SHA-512 respectively. + +==== SHA-3 ==== + +SHA-3 is the winner of a five-year competition to select a new cryptographic hash algorithm where 64 competing designs were evaluated. + +{{{ + + +}}} + +SHA-3 can be configured to output hash lengths of one of 224, 256, 384, or 512 bits. The default is 512 bits. + +{{{ + + +}}} + +==== RIPEMD-160 ==== + +{{{ + + +}}} + +=== The Hasher Input === + +The hash algorithms accept either strings or instances of CryptoJS.lib.WordArray. A WordArray object represents an array of 32-bit words. When you pass a string, it's automatically converted to a WordArray encoded as UTF-8. + +=== The Hasher Output === + +The hash you get back isn't a string yet. It's a WordArray object. When you use a WordArray object in a string context, it's automatically converted to a hex string. + +{{{ + + +}}} + +You can convert a WordArray object to other formats by explicitly calling the toString method and passing an encoder. + +{{{ + + + +}}} + +=== Progressive Hashing === + +{{{ + + +}}} + +== HMAC == + +Keyed-hash message authentication codes (HMAC) is a mechanism for message authentication using cryptographic hash functions. + +HMAC can be used in combination with any iterated cryptographic hash function. + +{{{ + + + + + +}}} + +=== Progressive HMAC Hashing === + +{{{ + + +}}} + +== PBKDF2 == + +PBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required. + +A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack. + +{{{ + + +}}} + +== Ciphers == + +=== The Cipher Algorithms === + +==== AES ==== + +The Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated. + +{{{ + + +}}} + +CryptoJS supports AES-128, AES-192, and AES-256. It will pick the variant by the size of the key you pass in. If you use a passphrase, then it will generate a 256-bit key. + +==== DES, Triple DES ==== + +DES is a previously dominant algorithm for encryption, and was published as an official Federal Information Processing Standard (FIPS). DES is now considered to be insecure due to the small key size. + +{{{ + + +}}} + +Triple DES applies DES three times to each block to increase the key size. The algorithm is believed to be secure in this form. + +{{{ + + +}}} + +==== Rabbit ==== + +Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2-year process where 22 designs were evaluated. + +{{{ + + +}}} + +==== RC4, RC4Drop ==== + +RC4 is a widely-used stream cipher. It's used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security. + +{{{ + + +}}} + +It was discovered that the first few bytes of keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop. + +By default, 192 words (768 bytes) are dropped, but you can configure the algorithm to drop any number of words. + +{{{ + + +}}} + +=== Custom Key and IV === + +{{{ + + +}}} + +=== Block Modes and Padding === + +{{{ + + + + +}}} + +CryptoJS supports the following modes: + + * CBC (the default) + * CFB + * CTR + * OFB + * ECB + +And CryptoJS supports the following padding schemes: + + * Pkcs7 (the default) + * Iso97971 + * AnsiX923 + * Iso10126 + * ZeroPadding + * NoPadding + +=== The Cipher Input === + +For the plaintext message, the cipher algorithms accept either strings or instances of CryptoJS.lib.WordArray. + +For the key, when you pass a string, it's treated as a passphrase and used to derive an actual key and IV. Or you can pass a WordArray that represents the actual key. If you pass the actual key, you must also pass the actual IV. + +For the ciphertext, the cipher algorithms accept either strings or instances of CryptoJS.lib.CipherParams. A CipherParams object represents a collection of parameters such as the IV, a salt, and the raw ciphertext itself. When you pass a string, it's automatically converted to a CipherParams object according to a configurable format strategy. + +=== The Cipher Output === + +The plaintext you get back after decryption is a WordArray object. See Hashers' Output for more detail. + +The ciphertext you get back after encryption isn't a string yet. It's a CipherParams object. A CipherParams object gives you access to all the parameters used during encryption. When you use a CipherParams object in a string context, it's automatically converted to a string according to a format strategy. The default is an OpenSSL-compatible format. + +{{{ + + +}}} + +You can define your own formats in order to be compatible with other crypto implementations. A format is an object with two methods—stringify and parse—that converts between CipherParams objects and ciphertext strings. + +Here's how you might write a JSON formatter: + +{{{ + + +}}} + +=== Progressive Ciphering === + +{{{ + + +}}} + +=== Interoperability === + +==== With OpenSSL ==== + +Encrypt with OpenSSL: + +{{{ +openssl enc -aes-256-cbc -in infile -out outfile -pass pass:"Secret Passphrase" -e -base64 +}}} + +Decrypt with CryptoJS: + +{{{ + + +}}} + +== Encoders == + +CryptoJS can convert from encoding formats such as Base64, Latin1 or Hex to WordArray objects and vica versa. + +{{{ + + + + +}}} \ No newline at end of file diff --git a/node_modules/crypto-js/enc-base64.js b/node_modules/crypto-js/enc-base64.js new file mode 100644 index 0000000..0ffcd53 --- /dev/null +++ b/node_modules/crypto-js/enc-base64.js @@ -0,0 +1,136 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64 encoding strategy. + */ + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function (base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + + return CryptoJS.enc.Base64; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/enc-base64url.js b/node_modules/crypto-js/enc-base64url.js new file mode 100644 index 0000000..2468912 --- /dev/null +++ b/node_modules/crypto-js/enc-base64url.js @@ -0,0 +1,140 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64url encoding strategy. + */ + var Base64url = C_enc.Base64url = { + /** + * Converts a word array to a Base64url string. + * + * @param {WordArray} wordArray The word array. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {string} The Base64url string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64url.stringify(wordArray); + */ + stringify: function (wordArray, urlSafe=true) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = urlSafe ? this._safe_map : this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64url string to a word array. + * + * @param {string} base64Str The Base64url string. + * + * @param {boolean} urlSafe Whether to use url safe + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64url.parse(base64String); + */ + parse: function (base64Str, urlSafe=true) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = urlSafe ? this._safe_map : this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', + _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + return CryptoJS.enc.Base64url; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/enc-hex.js b/node_modules/crypto-js/enc-hex.js new file mode 100644 index 0000000..88161ff --- /dev/null +++ b/node_modules/crypto-js/enc-hex.js @@ -0,0 +1,18 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.enc.Hex; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/enc-latin1.js b/node_modules/crypto-js/enc-latin1.js new file mode 100644 index 0000000..ade56dc --- /dev/null +++ b/node_modules/crypto-js/enc-latin1.js @@ -0,0 +1,18 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.enc.Latin1; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/enc-utf16.js b/node_modules/crypto-js/enc-utf16.js new file mode 100644 index 0000000..7de6245 --- /dev/null +++ b/node_modules/crypto-js/enc-utf16.js @@ -0,0 +1,149 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * UTF-16 BE encoding strategy. + */ + var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { + /** + * Converts a word array to a UTF-16 BE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 BE string. + * + * @static + * + * @example + * + * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 BE string to a word array. + * + * @param {string} utf16Str The UTF-16 BE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + /** + * UTF-16 LE encoding strategy. + */ + C_enc.Utf16LE = { + /** + * Converts a word array to a UTF-16 LE string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-16 LE string. + * + * @static + * + * @example + * + * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var utf16Chars = []; + for (var i = 0; i < sigBytes; i += 2) { + var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); + utf16Chars.push(String.fromCharCode(codePoint)); + } + + return utf16Chars.join(''); + }, + + /** + * Converts a UTF-16 LE string to a word array. + * + * @param {string} utf16Str The UTF-16 LE string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); + */ + parse: function (utf16Str) { + // Shortcut + var utf16StrLength = utf16Str.length; + + // Convert + var words = []; + for (var i = 0; i < utf16StrLength; i++) { + words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); + } + + return WordArray.create(words, utf16StrLength * 2); + } + }; + + function swapEndian(word) { + return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); + } + }()); + + + return CryptoJS.enc.Utf16; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/enc-utf8.js b/node_modules/crypto-js/enc-utf8.js new file mode 100644 index 0000000..e7a251d --- /dev/null +++ b/node_modules/crypto-js/enc-utf8.js @@ -0,0 +1,18 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.enc.Utf8; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/evpkdf.js b/node_modules/crypto-js/evpkdf.js new file mode 100644 index 0000000..578974a --- /dev/null +++ b/node_modules/crypto-js/evpkdf.js @@ -0,0 +1,134 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha1", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + var block; + + // Shortcut + var cfg = this.cfg; + + // Init hasher + var hasher = cfg.hasher.create(); + + // Initial values + var derivedKey = WordArray.create(); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + block = hasher.update(password).finalize(salt); + hasher.reset(); + + // Iterations + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + }()); + + + return CryptoJS.EvpKDF; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/format-hex.js b/node_modules/crypto-js/format-hex.js new file mode 100644 index 0000000..2e9a861 --- /dev/null +++ b/node_modules/crypto-js/format-hex.js @@ -0,0 +1,66 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var CipherParams = C_lib.CipherParams; + var C_enc = C.enc; + var Hex = C_enc.Hex; + var C_format = C.format; + + var HexFormatter = C_format.Hex = { + /** + * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The hexadecimally encoded string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.format.Hex.stringify(cipherParams); + */ + stringify: function (cipherParams) { + return cipherParams.ciphertext.toString(Hex); + }, + + /** + * Converts a hexadecimally encoded ciphertext string to a cipher params object. + * + * @param {string} input The hexadecimally encoded string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.Hex.parse(hexString); + */ + parse: function (input) { + var ciphertext = Hex.parse(input); + return CipherParams.create({ ciphertext: ciphertext }); + } + }; + }()); + + + return CryptoJS.format.Hex; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/format-openssl.js b/node_modules/crypto-js/format-openssl.js new file mode 100644 index 0000000..3373edc --- /dev/null +++ b/node_modules/crypto-js/format-openssl.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.format.OpenSSL; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-md5.js b/node_modules/crypto-js/hmac-md5.js new file mode 100644 index 0000000..ad7a90a --- /dev/null +++ b/node_modules/crypto-js/hmac-md5.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./md5"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./md5", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacMD5; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-ripemd160.js b/node_modules/crypto-js/hmac-ripemd160.js new file mode 100644 index 0000000..73d55a7 --- /dev/null +++ b/node_modules/crypto-js/hmac-ripemd160.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./ripemd160"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./ripemd160", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacRIPEMD160; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-sha1.js b/node_modules/crypto-js/hmac-sha1.js new file mode 100644 index 0000000..0b570cb --- /dev/null +++ b/node_modules/crypto-js/hmac-sha1.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha1", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA1; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-sha224.js b/node_modules/crypto-js/hmac-sha224.js new file mode 100644 index 0000000..3778863 --- /dev/null +++ b/node_modules/crypto-js/hmac-sha224.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha256"), require("./sha224"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha256", "./sha224", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA224; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-sha256.js b/node_modules/crypto-js/hmac-sha256.js new file mode 100644 index 0000000..33b0c9f --- /dev/null +++ b/node_modules/crypto-js/hmac-sha256.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha256", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA256; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-sha3.js b/node_modules/crypto-js/hmac-sha3.js new file mode 100644 index 0000000..1248804 --- /dev/null +++ b/node_modules/crypto-js/hmac-sha3.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha3"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha3", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA3; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-sha384.js b/node_modules/crypto-js/hmac-sha384.js new file mode 100644 index 0000000..0036e2b --- /dev/null +++ b/node_modules/crypto-js/hmac-sha384.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./sha384"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha512", "./sha384", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA384; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac-sha512.js b/node_modules/crypto-js/hmac-sha512.js new file mode 100644 index 0000000..c1005b6 --- /dev/null +++ b/node_modules/crypto-js/hmac-sha512.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha512", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.HmacSHA512; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/hmac.js b/node_modules/crypto-js/hmac.js new file mode 100644 index 0000000..8c09851 --- /dev/null +++ b/node_modules/crypto-js/hmac.js @@ -0,0 +1,143 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + + /** + * HMAC algorithm. + */ + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function (hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); + + // Convert string to WordArray, else assume WordArray already + if (typeof key == 'string') { + key = Utf8.parse(key); + } + + // Shortcuts + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; + + // Allow arbitrary length keys + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } + + // Clamp excess bits + key.clamp(); + + // Clone key for inner and outer pads + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); + + // Shortcuts + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; + + // XOR keys with pad constants + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; + + // Set initial values + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function () { + // Shortcut + var hasher = this._hasher; + + // Reset + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function (messageUpdate) { + this._hasher.update(messageUpdate); + + // Chainable + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Shortcut + var hasher = this._hasher; + + // Compute HMAC + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + + return hmac; + } + }); + }()); + + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/index.js b/node_modules/crypto-js/index.js new file mode 100644 index 0000000..7235391 --- /dev/null +++ b/node_modules/crypto-js/index.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./enc-base64url"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./enc-base64url", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); + } + else { + // Global (browser) + root.CryptoJS = factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/lib-typedarrays.js b/node_modules/crypto-js/lib-typedarrays.js new file mode 100644 index 0000000..264b210 --- /dev/null +++ b/node_modules/crypto-js/lib-typedarrays.js @@ -0,0 +1,76 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Check if typed arrays are supported + if (typeof ArrayBuffer != 'function') { + return; + } + + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + + // Reference original init + var superInit = WordArray.init; + + // Augment WordArray.init to handle typed arrays + var subInit = WordArray.init = function (typedArray) { + // Convert buffers to uint8 + if (typedArray instanceof ArrayBuffer) { + typedArray = new Uint8Array(typedArray); + } + + // Convert other array views to uint8 + if ( + typedArray instanceof Int8Array || + (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || + typedArray instanceof Int16Array || + typedArray instanceof Uint16Array || + typedArray instanceof Int32Array || + typedArray instanceof Uint32Array || + typedArray instanceof Float32Array || + typedArray instanceof Float64Array + ) { + typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); + } + + // Handle Uint8Array + if (typedArray instanceof Uint8Array) { + // Shortcut + var typedArrayByteLength = typedArray.byteLength; + + // Extract bytes + var words = []; + for (var i = 0; i < typedArrayByteLength; i++) { + words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); + } + + // Initialize this word array + superInit.call(this, words, typedArrayByteLength); + } else { + // Else call normal init + superInit.apply(this, arguments); + } + }; + + subInit.prototype = WordArray; + }()); + + + return CryptoJS.lib.WordArray; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/md5.js b/node_modules/crypto-js/md5.js new file mode 100644 index 0000000..12b0fdd --- /dev/null +++ b/node_modules/crypto-js/md5.js @@ -0,0 +1,268 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var T = []; + + // Compute constants + (function () { + for (var i = 0; i < 64; i++) { + T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; + } + }()); + + /** + * MD5 hash algorithm. + */ + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + + // Shortcuts + var H = this._hash.words; + + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; + + // Working varialbes + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + + // Computation + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( + (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | + (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) + ); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | + (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) + ); + + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + ((b & c) | (~b & d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + ((b & d) | (c & ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + C.MD5 = Hasher._createHelper(MD5); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + C.HmacMD5 = Hasher._createHmacHelper(MD5); + }(Math)); + + + return CryptoJS.MD5; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/mode-cfb.js b/node_modules/crypto-js/mode-cfb.js new file mode 100644 index 0000000..444c9cb --- /dev/null +++ b/node_modules/crypto-js/mode-cfb.js @@ -0,0 +1,80 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Cipher Feedback block mode. + */ + CryptoJS.mode.CFB = (function () { + var CFB = CryptoJS.lib.BlockCipherMode.extend(); + + CFB.Encryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + CFB.Decryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { + var keystream; + + // Shortcut + var iv = this._iv; + + // Generate keystream + if (iv) { + keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + keystream = this._prevBlock; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + + return CFB; + }()); + + + return CryptoJS.mode.CFB; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/mode-ctr-gladman.js b/node_modules/crypto-js/mode-ctr-gladman.js new file mode 100644 index 0000000..bbc5687 --- /dev/null +++ b/node_modules/crypto-js/mode-ctr-gladman.js @@ -0,0 +1,116 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** @preserve + * Counter block mode compatible with Dr Brian Gladman fileenc.c + * derived from CryptoJS.mode.CTR + * Jan Hruby jhruby.web@gmail.com + */ + CryptoJS.mode.CTRGladman = (function () { + var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); + + function incWord(word) + { + if (((word >> 24) & 0xff) === 0xff) { //overflow + var b1 = (word >> 16)&0xff; + var b2 = (word >> 8)&0xff; + var b3 = word & 0xff; + + if (b1 === 0xff) // overflow b1 + { + b1 = 0; + if (b2 === 0xff) + { + b2 = 0; + if (b3 === 0xff) + { + b3 = 0; + } + else + { + ++b3; + } + } + else + { + ++b2; + } + } + else + { + ++b1; + } + + word = 0; + word += (b1 << 16); + word += (b2 << 8); + word += b3; + } + else + { + word += (0x01 << 24); + } + return word; + } + + function incCounter(counter) + { + if ((counter[0] = incWord(counter[0])) === 0) + { + // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 + counter[1] = incWord(counter[1]); + } + return counter; + } + + var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + + incCounter(counter); + + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTRGladman.Decryptor = Encryptor; + + return CTRGladman; + }()); + + + + + return CryptoJS.mode.CTRGladman; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/mode-ctr.js b/node_modules/crypto-js/mode-ctr.js new file mode 100644 index 0000000..c3d470a --- /dev/null +++ b/node_modules/crypto-js/mode-ctr.js @@ -0,0 +1,58 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Counter block mode. + */ + CryptoJS.mode.CTR = (function () { + var CTR = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = CTR.Encryptor = CTR.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var counter = this._counter; + + // Generate keystream + if (iv) { + counter = this._counter = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + var keystream = counter.slice(0); + cipher.encryptBlock(keystream, 0); + + // Increment counter + counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + CTR.Decryptor = Encryptor; + + return CTR; + }()); + + + return CryptoJS.mode.CTR; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/mode-ecb.js b/node_modules/crypto-js/mode-ecb.js new file mode 100644 index 0000000..ff06921 --- /dev/null +++ b/node_modules/crypto-js/mode-ecb.js @@ -0,0 +1,40 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Electronic Codebook block mode. + */ + CryptoJS.mode.ECB = (function () { + var ECB = CryptoJS.lib.BlockCipherMode.extend(); + + ECB.Encryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.encryptBlock(words, offset); + } + }); + + ECB.Decryptor = ECB.extend({ + processBlock: function (words, offset) { + this._cipher.decryptBlock(words, offset); + } + }); + + return ECB; + }()); + + + return CryptoJS.mode.ECB; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/mode-ofb.js b/node_modules/crypto-js/mode-ofb.js new file mode 100644 index 0000000..c01314c --- /dev/null +++ b/node_modules/crypto-js/mode-ofb.js @@ -0,0 +1,54 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Output Feedback block mode. + */ + CryptoJS.mode.OFB = (function () { + var OFB = CryptoJS.lib.BlockCipherMode.extend(); + + var Encryptor = OFB.Encryptor = OFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher + var blockSize = cipher.blockSize; + var iv = this._iv; + var keystream = this._keystream; + + // Generate keystream + if (iv) { + keystream = this._keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + }); + + OFB.Decryptor = Encryptor; + + return OFB; + }()); + + + return CryptoJS.mode.OFB; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/package.json b/node_modules/crypto-js/package.json new file mode 100644 index 0000000..fe75ee2 --- /dev/null +++ b/node_modules/crypto-js/package.json @@ -0,0 +1,45 @@ +{ + "name": "crypto-js", + "version": "4.1.1", + "description": "JavaScript library of crypto standards.", + "license": "MIT", + "author": { + "name": "Evan Vosberg", + "url": "http://github.com/evanvosberg" + }, + "homepage": "http://github.com/brix/crypto-js", + "repository": { + "type": "git", + "url": "http://github.com/brix/crypto-js.git" + }, + "keywords": [ + "security", + "crypto", + "Hash", + "MD5", + "SHA1", + "SHA-1", + "SHA256", + "SHA-256", + "RC4", + "Rabbit", + "AES", + "DES", + "PBKDF2", + "HMAC", + "OFB", + "CFB", + "CTR", + "CBC", + "Base64", + "Base64url" + ], + "main": "index.js", + "dependencies": {}, + "browser": { + "crypto": false + }, + "__npminstall_done": true, + "_from": "crypto-js@4.1.1", + "_resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz" +} \ No newline at end of file diff --git a/node_modules/crypto-js/pad-ansix923.js b/node_modules/crypto-js/pad-ansix923.js new file mode 100644 index 0000000..f01f21e --- /dev/null +++ b/node_modules/crypto-js/pad-ansix923.js @@ -0,0 +1,49 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * ANSI X.923 padding strategy. + */ + CryptoJS.pad.AnsiX923 = { + pad: function (data, blockSize) { + // Shortcuts + var dataSigBytes = data.sigBytes; + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; + + // Compute last byte position + var lastBytePos = dataSigBytes + nPaddingBytes - 1; + + // Pad + data.clamp(); + data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); + data.sigBytes += nPaddingBytes; + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + return CryptoJS.pad.Ansix923; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/pad-iso10126.js b/node_modules/crypto-js/pad-iso10126.js new file mode 100644 index 0000000..6e2aefd --- /dev/null +++ b/node_modules/crypto-js/pad-iso10126.js @@ -0,0 +1,44 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * ISO 10126 padding strategy. + */ + CryptoJS.pad.Iso10126 = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Pad + data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). + concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); + }, + + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + + return CryptoJS.pad.Iso10126; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/pad-iso97971.js b/node_modules/crypto-js/pad-iso97971.js new file mode 100644 index 0000000..41049b4 --- /dev/null +++ b/node_modules/crypto-js/pad-iso97971.js @@ -0,0 +1,40 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * ISO/IEC 9797-1 Padding Method 2. + */ + CryptoJS.pad.Iso97971 = { + pad: function (data, blockSize) { + // Add 0x80 byte + data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); + + // Zero pad the rest + CryptoJS.pad.ZeroPadding.pad(data, blockSize); + }, + + unpad: function (data) { + // Remove zero padding + CryptoJS.pad.ZeroPadding.unpad(data); + + // Remove one more byte -- the 0x80 byte + data.sigBytes--; + } + }; + + + return CryptoJS.pad.Iso97971; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/pad-nopadding.js b/node_modules/crypto-js/pad-nopadding.js new file mode 100644 index 0000000..c7787c9 --- /dev/null +++ b/node_modules/crypto-js/pad-nopadding.js @@ -0,0 +1,30 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * A noop padding strategy. + */ + CryptoJS.pad.NoPadding = { + pad: function () { + }, + + unpad: function () { + } + }; + + + return CryptoJS.pad.NoPadding; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/pad-pkcs7.js b/node_modules/crypto-js/pad-pkcs7.js new file mode 100644 index 0000000..3555168 --- /dev/null +++ b/node_modules/crypto-js/pad-pkcs7.js @@ -0,0 +1,18 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + return CryptoJS.pad.Pkcs7; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/pad-zeropadding.js b/node_modules/crypto-js/pad-zeropadding.js new file mode 100644 index 0000000..a1a459e --- /dev/null +++ b/node_modules/crypto-js/pad-zeropadding.js @@ -0,0 +1,47 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** + * Zero padding strategy. + */ + CryptoJS.pad.ZeroPadding = { + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Pad + data.clamp(); + data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); + }, + + unpad: function (data) { + // Shortcut + var dataWords = data.words; + + // Unpad + var i = data.sigBytes - 1; + for (var i = data.sigBytes - 1; i >= 0; i--) { + if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { + data.sigBytes = i + 1; + break; + } + } + } + }; + + + return CryptoJS.pad.ZeroPadding; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/pbkdf2.js b/node_modules/crypto-js/pbkdf2.js new file mode 100644 index 0000000..1258251 --- /dev/null +++ b/node_modules/crypto-js/pbkdf2.js @@ -0,0 +1,145 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha1", "./hmac"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA1 = C_algo.SHA1; + var HMAC = C_algo.HMAC; + + /** + * Password-Based Key Derivation Function 2 algorithm. + */ + var PBKDF2 = C_algo.PBKDF2 = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hasher to use. Default: SHA1 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: SHA1, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.PBKDF2.create(); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + // Shortcut + var cfg = this.cfg; + + // Init HMAC + var hmac = HMAC.create(cfg.hasher, password); + + // Initial values + var derivedKey = WordArray.create(); + var blockIndex = WordArray.create([0x00000001]); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var blockIndexWords = blockIndex.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + var block = hmac.update(salt).finalize(blockIndex); + hmac.reset(); + + // Shortcuts + var blockWords = block.words; + var blockWordsLength = blockWords.length; + + // Iterations + var intermediate = block; + for (var i = 1; i < iterations; i++) { + intermediate = hmac.finalize(intermediate); + hmac.reset(); + + // Shortcut + var intermediateWords = intermediate.words; + + // XOR intermediate with block + for (var j = 0; j < blockWordsLength; j++) { + blockWords[j] ^= intermediateWords[j]; + } + } + + derivedKey.concat(block); + blockIndexWords[0]++; + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Computes the Password-Based Key Derivation Function 2. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.PBKDF2(password, salt); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); + * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.PBKDF2 = function (password, salt, cfg) { + return PBKDF2.create(cfg).compute(password, salt); + }; + }()); + + + return CryptoJS.PBKDF2; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/rabbit-legacy.js b/node_modules/crypto-js/rabbit-legacy.js new file mode 100644 index 0000000..e118b6b --- /dev/null +++ b/node_modules/crypto-js/rabbit-legacy.js @@ -0,0 +1,190 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm. + * + * This is a legacy version that neglected to convert the key to little-endian. + * This error doesn't affect the cipher's security, + * but it does affect its compatibility with other implementations. + */ + var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); + */ + C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); + }()); + + + return CryptoJS.RabbitLegacy; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/rabbit.js b/node_modules/crypto-js/rabbit.js new file mode 100644 index 0000000..1b06833 --- /dev/null +++ b/node_modules/crypto-js/rabbit.js @@ -0,0 +1,192 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm + */ + var Rabbit = C_algo.Rabbit = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Swap endian + for (var i = 0; i < 4; i++) { + K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | + (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); + } + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); + * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); + */ + C.Rabbit = StreamCipher._createHelper(Rabbit); + }()); + + + return CryptoJS.Rabbit; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/rc4.js b/node_modules/crypto-js/rc4.js new file mode 100644 index 0000000..0e4bdff --- /dev/null +++ b/node_modules/crypto-js/rc4.js @@ -0,0 +1,139 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + /** + * RC4 stream cipher algorithm. + */ + var RC4 = C_algo.RC4 = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + var keySigBytes = key.sigBytes; + + // Init sbox + var S = this._S = []; + for (var i = 0; i < 256; i++) { + S[i] = i; + } + + // Key setup + for (var i = 0, j = 0; i < 256; i++) { + var keyByteIndex = i % keySigBytes; + var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; + + j = (j + S[i] + keyByte) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + } + + // Counters + this._i = this._j = 0; + }, + + _doProcessBlock: function (M, offset) { + M[offset] ^= generateKeystreamWord.call(this); + }, + + keySize: 256/32, + + ivSize: 0 + }); + + function generateKeystreamWord() { + // Shortcuts + var S = this._S; + var i = this._i; + var j = this._j; + + // Generate keystream word + var keystreamWord = 0; + for (var n = 0; n < 4; n++) { + i = (i + 1) % 256; + j = (j + S[i]) % 256; + + // Swap + var t = S[i]; + S[i] = S[j]; + S[j] = t; + + keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); + } + + // Update counters + this._i = i; + this._j = j; + + return keystreamWord; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); + */ + C.RC4 = StreamCipher._createHelper(RC4); + + /** + * Modified RC4 stream cipher algorithm. + */ + var RC4Drop = C_algo.RC4Drop = RC4.extend({ + /** + * Configuration options. + * + * @property {number} drop The number of keystream words to drop. Default 192 + */ + cfg: RC4.cfg.extend({ + drop: 192 + }), + + _doReset: function () { + RC4._doReset.call(this); + + // Drop + for (var i = this.cfg.drop; i > 0; i--) { + generateKeystreamWord.call(this); + } + } + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); + * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); + */ + C.RC4Drop = StreamCipher._createHelper(RC4Drop); + }()); + + + return CryptoJS.RC4; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/ripemd160.js b/node_modules/crypto-js/ripemd160.js new file mode 100644 index 0000000..24feb47 --- /dev/null +++ b/node_modules/crypto-js/ripemd160.js @@ -0,0 +1,267 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + /** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. + */ + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var _zl = WordArray.create([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); + var _zr = WordArray.create([ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); + var _sl = WordArray.create([ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); + var _sr = WordArray.create([ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); + + var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); + var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); + + /** + * RIPEMD160 hash algorithm. + */ + var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ + _doReset: function () { + this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); + }, + + _doProcessBlock: function (M, offset) { + + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + // Swap + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + // Shortcut + var H = this._hash.words; + var hl = _hl.words; + var hr = _hr.words; + var zl = _zl.words; + var zr = _zr.words; + var sl = _sl.words; + var sr = _sr.words; + + // Working variables + var al, bl, cl, dl, el; + var ar, br, cr, dr, er; + + ar = al = H[0]; + br = bl = H[1]; + cr = cl = H[2]; + dr = dl = H[3]; + er = el = H[4]; + // Computation + var t; + for (var i = 0; i < 80; i += 1) { + t = (al + M[offset+zl[i]])|0; + if (i<16){ + t += f1(bl,cl,dl) + hl[0]; + } else if (i<32) { + t += f2(bl,cl,dl) + hl[1]; + } else if (i<48) { + t += f3(bl,cl,dl) + hl[2]; + } else if (i<64) { + t += f4(bl,cl,dl) + hl[3]; + } else {// if (i<80) { + t += f5(bl,cl,dl) + hl[4]; + } + t = t|0; + t = rotl(t,sl[i]); + t = (t+el)|0; + al = el; + el = dl; + dl = rotl(cl, 10); + cl = bl; + bl = t; + + t = (ar + M[offset+zr[i]])|0; + if (i<16){ + t += f5(br,cr,dr) + hr[0]; + } else if (i<32) { + t += f4(br,cr,dr) + hr[1]; + } else if (i<48) { + t += f3(br,cr,dr) + hr[2]; + } else if (i<64) { + t += f2(br,cr,dr) + hr[3]; + } else {// if (i<80) { + t += f1(br,cr,dr) + hr[4]; + } + t = t|0; + t = rotl(t,sr[i]) ; + t = (t+er)|0; + ar = er; + er = dr; + dr = rotl(cr, 10); + cr = br; + br = t; + } + // Intermediate hash value + t = (H[1] + cl + dr)|0; + H[1] = (H[2] + dl + er)|0; + H[2] = (H[3] + el + ar)|0; + H[3] = (H[4] + al + br)|0; + H[4] = (H[0] + bl + cr)|0; + H[0] = t; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | + (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) + ); + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 5; i++) { + // Shortcut + var H_i = H[i]; + + // Swap + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + + function f1(x, y, z) { + return ((x) ^ (y) ^ (z)); + + } + + function f2(x, y, z) { + return (((x)&(y)) | ((~x)&(z))); + } + + function f3(x, y, z) { + return (((x) | (~(y))) ^ (z)); + } + + function f4(x, y, z) { + return (((x) & (z)) | ((y)&(~(z)))); + } + + function f5(x, y, z) { + return ((x) ^ ((y) |(~(z)))); + + } + + function rotl(x,n) { + return (x<>>(32-n)); + } + + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.RIPEMD160('message'); + * var hash = CryptoJS.RIPEMD160(wordArray); + */ + C.RIPEMD160 = Hasher._createHelper(RIPEMD160); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacRIPEMD160(message, key); + */ + C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); + }(Math)); + + + return CryptoJS.RIPEMD160; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/sha1.js b/node_modules/crypto-js/sha1.js new file mode 100644 index 0000000..6691149 --- /dev/null +++ b/node_modules/crypto-js/sha1.js @@ -0,0 +1,150 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Reusable object + var W = []; + + /** + * SHA-1 hash algorithm. + */ + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476, + 0xc3d2e1f0 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + + // Computation + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = (n << 1) | (n >>> 31); + } + + var t = ((a << 5) | (a >>> 27)) + e + W[i]; + if (i < 20) { + t += ((b & c) | (~b & d)) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; + } else /* if (i < 80) */ { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = (b << 30) | (b >>> 2); + b = a; + a = t; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + C.SHA1 = Hasher._createHelper(SHA1); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + }()); + + + return CryptoJS.SHA1; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/sha224.js b/node_modules/crypto-js/sha224.js new file mode 100644 index 0000000..d8ce988 --- /dev/null +++ b/node_modules/crypto-js/sha224.js @@ -0,0 +1,80 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./sha256")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./sha256"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA256 = C_algo.SHA256; + + /** + * SHA-224 hash algorithm. + */ + var SHA224 = C_algo.SHA224 = SHA256.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 + ]); + }, + + _doFinalize: function () { + var hash = SHA256._doFinalize.call(this); + + hash.sigBytes -= 4; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA224('message'); + * var hash = CryptoJS.SHA224(wordArray); + */ + C.SHA224 = SHA256._createHelper(SHA224); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA224(message, key); + */ + C.HmacSHA224 = SHA256._createHmacHelper(SHA224); + }()); + + + return CryptoJS.SHA224; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/sha256.js b/node_modules/crypto-js/sha256.js new file mode 100644 index 0000000..de2d7fc --- /dev/null +++ b/node_modules/crypto-js/sha256.js @@ -0,0 +1,199 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Initialization and round constants tables + var H = []; + var K = []; + + // Compute constants + (function () { + function isPrime(n) { + var sqrtN = Math.sqrt(n); + for (var factor = 2; factor <= sqrtN; factor++) { + if (!(n % factor)) { + return false; + } + } + + return true; + } + + function getFractionalBits(n) { + return ((n - (n | 0)) * 0x100000000) | 0; + } + + var n = 2; + var nPrime = 0; + while (nPrime < 64) { + if (isPrime(n)) { + if (nPrime < 8) { + H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); + } + K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); + + nPrime++; + } + + n++; + } + }()); + + // Reusable object + var W = []; + + /** + * SHA-256 hash algorithm. + */ + var SHA256 = C_algo.SHA256 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init(H.slice(0)); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + var f = H[5]; + var g = H[6]; + var h = H[7]; + + // Computation + for (var i = 0; i < 64; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var gamma0x = W[i - 15]; + var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ + ((gamma0x << 14) | (gamma0x >>> 18)) ^ + (gamma0x >>> 3); + + var gamma1x = W[i - 2]; + var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ + ((gamma1x << 13) | (gamma1x >>> 19)) ^ + (gamma1x >>> 10); + + W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; + } + + var ch = (e & f) ^ (~e & g); + var maj = (a & b) ^ (a & c) ^ (b & c); + + var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); + var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); + + var t1 = h + sigma1 + ch + K[i] + W[i]; + var t2 = sigma0 + maj; + + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + H[5] = (H[5] + f) | 0; + H[6] = (H[6] + g) | 0; + H[7] = (H[7] + h) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA256('message'); + * var hash = CryptoJS.SHA256(wordArray); + */ + C.SHA256 = Hasher._createHelper(SHA256); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA256(message, key); + */ + C.HmacSHA256 = Hasher._createHmacHelper(SHA256); + }(Math)); + + + return CryptoJS.SHA256; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/sha3.js b/node_modules/crypto-js/sha3.js new file mode 100644 index 0000000..34ad86c --- /dev/null +++ b/node_modules/crypto-js/sha3.js @@ -0,0 +1,326 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var C_algo = C.algo; + + // Constants tables + var RHO_OFFSETS = []; + var PI_INDEXES = []; + var ROUND_CONSTANTS = []; + + // Compute Constants + (function () { + // Compute rho offset constants + var x = 1, y = 0; + for (var t = 0; t < 24; t++) { + RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; + + var newX = y % 5; + var newY = (2 * x + 3 * y) % 5; + x = newX; + y = newY; + } + + // Compute pi index constants + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; + } + } + + // Compute round constants + var LFSR = 0x01; + for (var i = 0; i < 24; i++) { + var roundConstantMsw = 0; + var roundConstantLsw = 0; + + for (var j = 0; j < 7; j++) { + if (LFSR & 0x01) { + var bitPosition = (1 << j) - 1; + if (bitPosition < 32) { + roundConstantLsw ^= 1 << bitPosition; + } else /* if (bitPosition >= 32) */ { + roundConstantMsw ^= 1 << (bitPosition - 32); + } + } + + // Compute next LFSR + if (LFSR & 0x80) { + // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 + LFSR = (LFSR << 1) ^ 0x71; + } else { + LFSR <<= 1; + } + } + + ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); + } + }()); + + // Reusable objects for temporary values + var T = []; + (function () { + for (var i = 0; i < 25; i++) { + T[i] = X64Word.create(); + } + }()); + + /** + * SHA-3 hash algorithm. + */ + var SHA3 = C_algo.SHA3 = Hasher.extend({ + /** + * Configuration options. + * + * @property {number} outputLength + * The desired number of bits in the output hash. + * Only values permitted are: 224, 256, 384, 512. + * Default: 512 + */ + cfg: Hasher.cfg.extend({ + outputLength: 512 + }), + + _doReset: function () { + var state = this._state = [] + for (var i = 0; i < 25; i++) { + state[i] = new X64Word.init(); + } + + this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var state = this._state; + var nBlockSizeLanes = this.blockSize / 2; + + // Absorb + for (var i = 0; i < nBlockSizeLanes; i++) { + // Shortcuts + var M2i = M[offset + 2 * i]; + var M2i1 = M[offset + 2 * i + 1]; + + // Swap endian + M2i = ( + (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | + (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) + ); + M2i1 = ( + (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | + (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) + ); + + // Absorb message into state + var lane = state[i]; + lane.high ^= M2i1; + lane.low ^= M2i; + } + + // Rounds + for (var round = 0; round < 24; round++) { + // Theta + for (var x = 0; x < 5; x++) { + // Mix column lanes + var tMsw = 0, tLsw = 0; + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + tMsw ^= lane.high; + tLsw ^= lane.low; + } + + // Temporary values + var Tx = T[x]; + Tx.high = tMsw; + Tx.low = tLsw; + } + for (var x = 0; x < 5; x++) { + // Shortcuts + var Tx4 = T[(x + 4) % 5]; + var Tx1 = T[(x + 1) % 5]; + var Tx1Msw = Tx1.high; + var Tx1Lsw = Tx1.low; + + // Mix surrounding columns + var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); + var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); + for (var y = 0; y < 5; y++) { + var lane = state[x + 5 * y]; + lane.high ^= tMsw; + lane.low ^= tLsw; + } + } + + // Rho Pi + for (var laneIndex = 1; laneIndex < 25; laneIndex++) { + var tMsw; + var tLsw; + + // Shortcuts + var lane = state[laneIndex]; + var laneMsw = lane.high; + var laneLsw = lane.low; + var rhoOffset = RHO_OFFSETS[laneIndex]; + + // Rotate lanes + if (rhoOffset < 32) { + tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); + tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); + } else /* if (rhoOffset >= 32) */ { + tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); + tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); + } + + // Transpose lanes + var TPiLane = T[PI_INDEXES[laneIndex]]; + TPiLane.high = tMsw; + TPiLane.low = tLsw; + } + + // Rho pi at x = y = 0 + var T0 = T[0]; + var state0 = state[0]; + T0.high = state0.high; + T0.low = state0.low; + + // Chi + for (var x = 0; x < 5; x++) { + for (var y = 0; y < 5; y++) { + // Shortcuts + var laneIndex = x + 5 * y; + var lane = state[laneIndex]; + var TLane = T[laneIndex]; + var Tx1Lane = T[((x + 1) % 5) + 5 * y]; + var Tx2Lane = T[((x + 2) % 5) + 5 * y]; + + // Mix rows + lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); + lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); + } + } + + // Iota + var lane = state[0]; + var roundConstant = ROUND_CONSTANTS[round]; + lane.high ^= roundConstant.high; + lane.low ^= roundConstant.low; + } + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + var blockSizeBits = this.blockSize * 32; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); + dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var state = this._state; + var outputLengthBytes = this.cfg.outputLength / 8; + var outputLengthLanes = outputLengthBytes / 8; + + // Squeeze + var hashWords = []; + for (var i = 0; i < outputLengthLanes; i++) { + // Shortcuts + var lane = state[i]; + var laneMsw = lane.high; + var laneLsw = lane.low; + + // Swap endian + laneMsw = ( + (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | + (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) + ); + laneLsw = ( + (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | + (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) + ); + + // Squeeze state to retrieve hash + hashWords.push(laneLsw); + hashWords.push(laneMsw); + } + + // Return final computed hash + return new WordArray.init(hashWords, outputLengthBytes); + }, + + clone: function () { + var clone = Hasher.clone.call(this); + + var state = clone._state = this._state.slice(0); + for (var i = 0; i < 25; i++) { + state[i] = state[i].clone(); + } + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA3('message'); + * var hash = CryptoJS.SHA3(wordArray); + */ + C.SHA3 = Hasher._createHelper(SHA3); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA3(message, key); + */ + C.HmacSHA3 = Hasher._createHmacHelper(SHA3); + }(Math)); + + + return CryptoJS.SHA3; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/sha384.js b/node_modules/crypto-js/sha384.js new file mode 100644 index 0000000..a0b95bf --- /dev/null +++ b/node_modules/crypto-js/sha384.js @@ -0,0 +1,83 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core", "./sha512"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + var SHA512 = C_algo.SHA512; + + /** + * SHA-384 hash algorithm. + */ + var SHA384 = C_algo.SHA384 = SHA512.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), + new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), + new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), + new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) + ]); + }, + + _doFinalize: function () { + var hash = SHA512._doFinalize.call(this); + + hash.sigBytes -= 16; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA384('message'); + * var hash = CryptoJS.SHA384(wordArray); + */ + C.SHA384 = SHA512._createHelper(SHA384); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA384(message, key); + */ + C.HmacSHA384 = SHA512._createHmacHelper(SHA384); + }()); + + + return CryptoJS.SHA384; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/sha512.js b/node_modules/crypto-js/sha512.js new file mode 100644 index 0000000..d274ab0 --- /dev/null +++ b/node_modules/crypto-js/sha512.js @@ -0,0 +1,326 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./x64-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./x64-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Hasher = C_lib.Hasher; + var C_x64 = C.x64; + var X64Word = C_x64.Word; + var X64WordArray = C_x64.WordArray; + var C_algo = C.algo; + + function X64Word_create() { + return X64Word.create.apply(X64Word, arguments); + } + + // Constants + var K = [ + X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), + X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), + X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), + X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), + X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), + X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), + X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), + X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), + X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), + X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), + X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), + X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), + X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), + X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), + X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), + X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), + X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), + X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), + X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), + X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), + X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), + X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), + X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), + X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), + X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), + X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), + X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), + X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), + X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), + X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), + X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), + X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), + X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), + X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), + X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), + X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), + X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), + X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), + X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), + X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) + ]; + + // Reusable objects + var W = []; + (function () { + for (var i = 0; i < 80; i++) { + W[i] = X64Word_create(); + } + }()); + + /** + * SHA-512 hash algorithm. + */ + var SHA512 = C_algo.SHA512 = Hasher.extend({ + _doReset: function () { + this._hash = new X64WordArray.init([ + new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), + new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), + new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), + new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcuts + var H = this._hash.words; + + var H0 = H[0]; + var H1 = H[1]; + var H2 = H[2]; + var H3 = H[3]; + var H4 = H[4]; + var H5 = H[5]; + var H6 = H[6]; + var H7 = H[7]; + + var H0h = H0.high; + var H0l = H0.low; + var H1h = H1.high; + var H1l = H1.low; + var H2h = H2.high; + var H2l = H2.low; + var H3h = H3.high; + var H3l = H3.low; + var H4h = H4.high; + var H4l = H4.low; + var H5h = H5.high; + var H5l = H5.low; + var H6h = H6.high; + var H6l = H6.low; + var H7h = H7.high; + var H7l = H7.low; + + // Working variables + var ah = H0h; + var al = H0l; + var bh = H1h; + var bl = H1l; + var ch = H2h; + var cl = H2l; + var dh = H3h; + var dl = H3l; + var eh = H4h; + var el = H4l; + var fh = H5h; + var fl = H5l; + var gh = H6h; + var gl = H6l; + var hh = H7h; + var hl = H7l; + + // Rounds + for (var i = 0; i < 80; i++) { + var Wil; + var Wih; + + // Shortcut + var Wi = W[i]; + + // Extend message + if (i < 16) { + Wih = Wi.high = M[offset + i * 2] | 0; + Wil = Wi.low = M[offset + i * 2 + 1] | 0; + } else { + // Gamma0 + var gamma0x = W[i - 15]; + var gamma0xh = gamma0x.high; + var gamma0xl = gamma0x.low; + var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); + var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); + + // Gamma1 + var gamma1x = W[i - 2]; + var gamma1xh = gamma1x.high; + var gamma1xl = gamma1x.low; + var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); + var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); + + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7 = W[i - 7]; + var Wi7h = Wi7.high; + var Wi7l = Wi7.low; + + var Wi16 = W[i - 16]; + var Wi16h = Wi16.high; + var Wi16l = Wi16.low; + + Wil = gamma0l + Wi7l; + Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); + Wil = Wil + gamma1l; + Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); + Wil = Wil + Wi16l; + Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); + + Wi.high = Wih; + Wi.low = Wil; + } + + var chh = (eh & fh) ^ (~eh & gh); + var chl = (el & fl) ^ (~el & gl); + var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); + var majl = (al & bl) ^ (al & cl) ^ (bl & cl); + + var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); + var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); + var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); + var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); + + // t1 = h + sigma1 + ch + K[i] + W[i] + var Ki = K[i]; + var Kih = Ki.high; + var Kil = Ki.low; + + var t1l = hl + sigma1l; + var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); + var t1l = t1l + chl; + var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); + var t1l = t1l + Kil; + var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); + var t1l = t1l + Wil; + var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); + + // t2 = sigma0 + maj + var t2l = sigma0l + majl; + var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); + + // Update working variables + hh = gh; + hl = gl; + gh = fh; + gl = fl; + fh = eh; + fl = el; + el = (dl + t1l) | 0; + eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; + dh = ch; + dl = cl; + ch = bh; + cl = bl; + bh = ah; + bl = al; + al = (t1l + t2l) | 0; + ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; + } + + // Intermediate hash value + H0l = H0.low = (H0l + al); + H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); + H1l = H1.low = (H1l + bl); + H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); + H2l = H2.low = (H2l + cl); + H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); + H3l = H3.low = (H3l + dl); + H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); + H4l = H4.low = (H4l + el); + H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); + H5l = H5.low = (H5l + fl); + H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); + H6l = H6.low = (H6l + gl); + H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); + H7l = H7.low = (H7l + hl); + H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Convert hash to 32-bit word array before returning + var hash = this._hash.toX32(); + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + }, + + blockSize: 1024/32 + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA512('message'); + * var hash = CryptoJS.SHA512(wordArray); + */ + C.SHA512 = Hasher._createHelper(SHA512); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA512(message, key); + */ + C.HmacSHA512 = Hasher._createHmacHelper(SHA512); + }()); + + + return CryptoJS.SHA512; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/tripledes.js b/node_modules/crypto-js/tripledes.js new file mode 100644 index 0000000..1a92477 --- /dev/null +++ b/node_modules/crypto-js/tripledes.js @@ -0,0 +1,779 @@ +;(function (root, factory, undef) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Permuted Choice 1 constants + var PC1 = [ + 57, 49, 41, 33, 25, 17, 9, 1, + 58, 50, 42, 34, 26, 18, 10, 2, + 59, 51, 43, 35, 27, 19, 11, 3, + 60, 52, 44, 36, 63, 55, 47, 39, + 31, 23, 15, 7, 62, 54, 46, 38, + 30, 22, 14, 6, 61, 53, 45, 37, + 29, 21, 13, 5, 28, 20, 12, 4 + ]; + + // Permuted Choice 2 constants + var PC2 = [ + 14, 17, 11, 24, 1, 5, + 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, + 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, + 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, + 46, 42, 50, 36, 29, 32 + ]; + + // Cumulative bit shift constants + var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; + + // SBOXes and round permutation constants + var SBOX_P = [ + { + 0x0: 0x808200, + 0x10000000: 0x8000, + 0x20000000: 0x808002, + 0x30000000: 0x2, + 0x40000000: 0x200, + 0x50000000: 0x808202, + 0x60000000: 0x800202, + 0x70000000: 0x800000, + 0x80000000: 0x202, + 0x90000000: 0x800200, + 0xa0000000: 0x8200, + 0xb0000000: 0x808000, + 0xc0000000: 0x8002, + 0xd0000000: 0x800002, + 0xe0000000: 0x0, + 0xf0000000: 0x8202, + 0x8000000: 0x0, + 0x18000000: 0x808202, + 0x28000000: 0x8202, + 0x38000000: 0x8000, + 0x48000000: 0x808200, + 0x58000000: 0x200, + 0x68000000: 0x808002, + 0x78000000: 0x2, + 0x88000000: 0x800200, + 0x98000000: 0x8200, + 0xa8000000: 0x808000, + 0xb8000000: 0x800202, + 0xc8000000: 0x800002, + 0xd8000000: 0x8002, + 0xe8000000: 0x202, + 0xf8000000: 0x800000, + 0x1: 0x8000, + 0x10000001: 0x2, + 0x20000001: 0x808200, + 0x30000001: 0x800000, + 0x40000001: 0x808002, + 0x50000001: 0x8200, + 0x60000001: 0x200, + 0x70000001: 0x800202, + 0x80000001: 0x808202, + 0x90000001: 0x808000, + 0xa0000001: 0x800002, + 0xb0000001: 0x8202, + 0xc0000001: 0x202, + 0xd0000001: 0x800200, + 0xe0000001: 0x8002, + 0xf0000001: 0x0, + 0x8000001: 0x808202, + 0x18000001: 0x808000, + 0x28000001: 0x800000, + 0x38000001: 0x200, + 0x48000001: 0x8000, + 0x58000001: 0x800002, + 0x68000001: 0x2, + 0x78000001: 0x8202, + 0x88000001: 0x8002, + 0x98000001: 0x800202, + 0xa8000001: 0x202, + 0xb8000001: 0x808200, + 0xc8000001: 0x800200, + 0xd8000001: 0x0, + 0xe8000001: 0x8200, + 0xf8000001: 0x808002 + }, + { + 0x0: 0x40084010, + 0x1000000: 0x4000, + 0x2000000: 0x80000, + 0x3000000: 0x40080010, + 0x4000000: 0x40000010, + 0x5000000: 0x40084000, + 0x6000000: 0x40004000, + 0x7000000: 0x10, + 0x8000000: 0x84000, + 0x9000000: 0x40004010, + 0xa000000: 0x40000000, + 0xb000000: 0x84010, + 0xc000000: 0x80010, + 0xd000000: 0x0, + 0xe000000: 0x4010, + 0xf000000: 0x40080000, + 0x800000: 0x40004000, + 0x1800000: 0x84010, + 0x2800000: 0x10, + 0x3800000: 0x40004010, + 0x4800000: 0x40084010, + 0x5800000: 0x40000000, + 0x6800000: 0x80000, + 0x7800000: 0x40080010, + 0x8800000: 0x80010, + 0x9800000: 0x0, + 0xa800000: 0x4000, + 0xb800000: 0x40080000, + 0xc800000: 0x40000010, + 0xd800000: 0x84000, + 0xe800000: 0x40084000, + 0xf800000: 0x4010, + 0x10000000: 0x0, + 0x11000000: 0x40080010, + 0x12000000: 0x40004010, + 0x13000000: 0x40084000, + 0x14000000: 0x40080000, + 0x15000000: 0x10, + 0x16000000: 0x84010, + 0x17000000: 0x4000, + 0x18000000: 0x4010, + 0x19000000: 0x80000, + 0x1a000000: 0x80010, + 0x1b000000: 0x40000010, + 0x1c000000: 0x84000, + 0x1d000000: 0x40004000, + 0x1e000000: 0x40000000, + 0x1f000000: 0x40084010, + 0x10800000: 0x84010, + 0x11800000: 0x80000, + 0x12800000: 0x40080000, + 0x13800000: 0x4000, + 0x14800000: 0x40004000, + 0x15800000: 0x40084010, + 0x16800000: 0x10, + 0x17800000: 0x40000000, + 0x18800000: 0x40084000, + 0x19800000: 0x40000010, + 0x1a800000: 0x40004010, + 0x1b800000: 0x80010, + 0x1c800000: 0x0, + 0x1d800000: 0x4010, + 0x1e800000: 0x40080010, + 0x1f800000: 0x84000 + }, + { + 0x0: 0x104, + 0x100000: 0x0, + 0x200000: 0x4000100, + 0x300000: 0x10104, + 0x400000: 0x10004, + 0x500000: 0x4000004, + 0x600000: 0x4010104, + 0x700000: 0x4010000, + 0x800000: 0x4000000, + 0x900000: 0x4010100, + 0xa00000: 0x10100, + 0xb00000: 0x4010004, + 0xc00000: 0x4000104, + 0xd00000: 0x10000, + 0xe00000: 0x4, + 0xf00000: 0x100, + 0x80000: 0x4010100, + 0x180000: 0x4010004, + 0x280000: 0x0, + 0x380000: 0x4000100, + 0x480000: 0x4000004, + 0x580000: 0x10000, + 0x680000: 0x10004, + 0x780000: 0x104, + 0x880000: 0x4, + 0x980000: 0x100, + 0xa80000: 0x4010000, + 0xb80000: 0x10104, + 0xc80000: 0x10100, + 0xd80000: 0x4000104, + 0xe80000: 0x4010104, + 0xf80000: 0x4000000, + 0x1000000: 0x4010100, + 0x1100000: 0x10004, + 0x1200000: 0x10000, + 0x1300000: 0x4000100, + 0x1400000: 0x100, + 0x1500000: 0x4010104, + 0x1600000: 0x4000004, + 0x1700000: 0x0, + 0x1800000: 0x4000104, + 0x1900000: 0x4000000, + 0x1a00000: 0x4, + 0x1b00000: 0x10100, + 0x1c00000: 0x4010000, + 0x1d00000: 0x104, + 0x1e00000: 0x10104, + 0x1f00000: 0x4010004, + 0x1080000: 0x4000000, + 0x1180000: 0x104, + 0x1280000: 0x4010100, + 0x1380000: 0x0, + 0x1480000: 0x10004, + 0x1580000: 0x4000100, + 0x1680000: 0x100, + 0x1780000: 0x4010004, + 0x1880000: 0x10000, + 0x1980000: 0x4010104, + 0x1a80000: 0x10104, + 0x1b80000: 0x4000004, + 0x1c80000: 0x4000104, + 0x1d80000: 0x4010000, + 0x1e80000: 0x4, + 0x1f80000: 0x10100 + }, + { + 0x0: 0x80401000, + 0x10000: 0x80001040, + 0x20000: 0x401040, + 0x30000: 0x80400000, + 0x40000: 0x0, + 0x50000: 0x401000, + 0x60000: 0x80000040, + 0x70000: 0x400040, + 0x80000: 0x80000000, + 0x90000: 0x400000, + 0xa0000: 0x40, + 0xb0000: 0x80001000, + 0xc0000: 0x80400040, + 0xd0000: 0x1040, + 0xe0000: 0x1000, + 0xf0000: 0x80401040, + 0x8000: 0x80001040, + 0x18000: 0x40, + 0x28000: 0x80400040, + 0x38000: 0x80001000, + 0x48000: 0x401000, + 0x58000: 0x80401040, + 0x68000: 0x0, + 0x78000: 0x80400000, + 0x88000: 0x1000, + 0x98000: 0x80401000, + 0xa8000: 0x400000, + 0xb8000: 0x1040, + 0xc8000: 0x80000000, + 0xd8000: 0x400040, + 0xe8000: 0x401040, + 0xf8000: 0x80000040, + 0x100000: 0x400040, + 0x110000: 0x401000, + 0x120000: 0x80000040, + 0x130000: 0x0, + 0x140000: 0x1040, + 0x150000: 0x80400040, + 0x160000: 0x80401000, + 0x170000: 0x80001040, + 0x180000: 0x80401040, + 0x190000: 0x80000000, + 0x1a0000: 0x80400000, + 0x1b0000: 0x401040, + 0x1c0000: 0x80001000, + 0x1d0000: 0x400000, + 0x1e0000: 0x40, + 0x1f0000: 0x1000, + 0x108000: 0x80400000, + 0x118000: 0x80401040, + 0x128000: 0x0, + 0x138000: 0x401000, + 0x148000: 0x400040, + 0x158000: 0x80000000, + 0x168000: 0x80001040, + 0x178000: 0x40, + 0x188000: 0x80000040, + 0x198000: 0x1000, + 0x1a8000: 0x80001000, + 0x1b8000: 0x80400040, + 0x1c8000: 0x1040, + 0x1d8000: 0x80401000, + 0x1e8000: 0x400000, + 0x1f8000: 0x401040 + }, + { + 0x0: 0x80, + 0x1000: 0x1040000, + 0x2000: 0x40000, + 0x3000: 0x20000000, + 0x4000: 0x20040080, + 0x5000: 0x1000080, + 0x6000: 0x21000080, + 0x7000: 0x40080, + 0x8000: 0x1000000, + 0x9000: 0x20040000, + 0xa000: 0x20000080, + 0xb000: 0x21040080, + 0xc000: 0x21040000, + 0xd000: 0x0, + 0xe000: 0x1040080, + 0xf000: 0x21000000, + 0x800: 0x1040080, + 0x1800: 0x21000080, + 0x2800: 0x80, + 0x3800: 0x1040000, + 0x4800: 0x40000, + 0x5800: 0x20040080, + 0x6800: 0x21040000, + 0x7800: 0x20000000, + 0x8800: 0x20040000, + 0x9800: 0x0, + 0xa800: 0x21040080, + 0xb800: 0x1000080, + 0xc800: 0x20000080, + 0xd800: 0x21000000, + 0xe800: 0x1000000, + 0xf800: 0x40080, + 0x10000: 0x40000, + 0x11000: 0x80, + 0x12000: 0x20000000, + 0x13000: 0x21000080, + 0x14000: 0x1000080, + 0x15000: 0x21040000, + 0x16000: 0x20040080, + 0x17000: 0x1000000, + 0x18000: 0x21040080, + 0x19000: 0x21000000, + 0x1a000: 0x1040000, + 0x1b000: 0x20040000, + 0x1c000: 0x40080, + 0x1d000: 0x20000080, + 0x1e000: 0x0, + 0x1f000: 0x1040080, + 0x10800: 0x21000080, + 0x11800: 0x1000000, + 0x12800: 0x1040000, + 0x13800: 0x20040080, + 0x14800: 0x20000000, + 0x15800: 0x1040080, + 0x16800: 0x80, + 0x17800: 0x21040000, + 0x18800: 0x40080, + 0x19800: 0x21040080, + 0x1a800: 0x0, + 0x1b800: 0x21000000, + 0x1c800: 0x1000080, + 0x1d800: 0x40000, + 0x1e800: 0x20040000, + 0x1f800: 0x20000080 + }, + { + 0x0: 0x10000008, + 0x100: 0x2000, + 0x200: 0x10200000, + 0x300: 0x10202008, + 0x400: 0x10002000, + 0x500: 0x200000, + 0x600: 0x200008, + 0x700: 0x10000000, + 0x800: 0x0, + 0x900: 0x10002008, + 0xa00: 0x202000, + 0xb00: 0x8, + 0xc00: 0x10200008, + 0xd00: 0x202008, + 0xe00: 0x2008, + 0xf00: 0x10202000, + 0x80: 0x10200000, + 0x180: 0x10202008, + 0x280: 0x8, + 0x380: 0x200000, + 0x480: 0x202008, + 0x580: 0x10000008, + 0x680: 0x10002000, + 0x780: 0x2008, + 0x880: 0x200008, + 0x980: 0x2000, + 0xa80: 0x10002008, + 0xb80: 0x10200008, + 0xc80: 0x0, + 0xd80: 0x10202000, + 0xe80: 0x202000, + 0xf80: 0x10000000, + 0x1000: 0x10002000, + 0x1100: 0x10200008, + 0x1200: 0x10202008, + 0x1300: 0x2008, + 0x1400: 0x200000, + 0x1500: 0x10000000, + 0x1600: 0x10000008, + 0x1700: 0x202000, + 0x1800: 0x202008, + 0x1900: 0x0, + 0x1a00: 0x8, + 0x1b00: 0x10200000, + 0x1c00: 0x2000, + 0x1d00: 0x10002008, + 0x1e00: 0x10202000, + 0x1f00: 0x200008, + 0x1080: 0x8, + 0x1180: 0x202000, + 0x1280: 0x200000, + 0x1380: 0x10000008, + 0x1480: 0x10002000, + 0x1580: 0x2008, + 0x1680: 0x10202008, + 0x1780: 0x10200000, + 0x1880: 0x10202000, + 0x1980: 0x10200008, + 0x1a80: 0x2000, + 0x1b80: 0x202008, + 0x1c80: 0x200008, + 0x1d80: 0x0, + 0x1e80: 0x10000000, + 0x1f80: 0x10002008 + }, + { + 0x0: 0x100000, + 0x10: 0x2000401, + 0x20: 0x400, + 0x30: 0x100401, + 0x40: 0x2100401, + 0x50: 0x0, + 0x60: 0x1, + 0x70: 0x2100001, + 0x80: 0x2000400, + 0x90: 0x100001, + 0xa0: 0x2000001, + 0xb0: 0x2100400, + 0xc0: 0x2100000, + 0xd0: 0x401, + 0xe0: 0x100400, + 0xf0: 0x2000000, + 0x8: 0x2100001, + 0x18: 0x0, + 0x28: 0x2000401, + 0x38: 0x2100400, + 0x48: 0x100000, + 0x58: 0x2000001, + 0x68: 0x2000000, + 0x78: 0x401, + 0x88: 0x100401, + 0x98: 0x2000400, + 0xa8: 0x2100000, + 0xb8: 0x100001, + 0xc8: 0x400, + 0xd8: 0x2100401, + 0xe8: 0x1, + 0xf8: 0x100400, + 0x100: 0x2000000, + 0x110: 0x100000, + 0x120: 0x2000401, + 0x130: 0x2100001, + 0x140: 0x100001, + 0x150: 0x2000400, + 0x160: 0x2100400, + 0x170: 0x100401, + 0x180: 0x401, + 0x190: 0x2100401, + 0x1a0: 0x100400, + 0x1b0: 0x1, + 0x1c0: 0x0, + 0x1d0: 0x2100000, + 0x1e0: 0x2000001, + 0x1f0: 0x400, + 0x108: 0x100400, + 0x118: 0x2000401, + 0x128: 0x2100001, + 0x138: 0x1, + 0x148: 0x2000000, + 0x158: 0x100000, + 0x168: 0x401, + 0x178: 0x2100400, + 0x188: 0x2000001, + 0x198: 0x2100000, + 0x1a8: 0x0, + 0x1b8: 0x2100401, + 0x1c8: 0x100401, + 0x1d8: 0x400, + 0x1e8: 0x2000400, + 0x1f8: 0x100001 + }, + { + 0x0: 0x8000820, + 0x1: 0x20000, + 0x2: 0x8000000, + 0x3: 0x20, + 0x4: 0x20020, + 0x5: 0x8020820, + 0x6: 0x8020800, + 0x7: 0x800, + 0x8: 0x8020000, + 0x9: 0x8000800, + 0xa: 0x20800, + 0xb: 0x8020020, + 0xc: 0x820, + 0xd: 0x0, + 0xe: 0x8000020, + 0xf: 0x20820, + 0x80000000: 0x800, + 0x80000001: 0x8020820, + 0x80000002: 0x8000820, + 0x80000003: 0x8000000, + 0x80000004: 0x8020000, + 0x80000005: 0x20800, + 0x80000006: 0x20820, + 0x80000007: 0x20, + 0x80000008: 0x8000020, + 0x80000009: 0x820, + 0x8000000a: 0x20020, + 0x8000000b: 0x8020800, + 0x8000000c: 0x0, + 0x8000000d: 0x8020020, + 0x8000000e: 0x8000800, + 0x8000000f: 0x20000, + 0x10: 0x20820, + 0x11: 0x8020800, + 0x12: 0x20, + 0x13: 0x800, + 0x14: 0x8000800, + 0x15: 0x8000020, + 0x16: 0x8020020, + 0x17: 0x20000, + 0x18: 0x0, + 0x19: 0x20020, + 0x1a: 0x8020000, + 0x1b: 0x8000820, + 0x1c: 0x8020820, + 0x1d: 0x20800, + 0x1e: 0x820, + 0x1f: 0x8000000, + 0x80000010: 0x20000, + 0x80000011: 0x800, + 0x80000012: 0x8020020, + 0x80000013: 0x20820, + 0x80000014: 0x20, + 0x80000015: 0x8020000, + 0x80000016: 0x8000000, + 0x80000017: 0x8000820, + 0x80000018: 0x8020820, + 0x80000019: 0x8000020, + 0x8000001a: 0x8000800, + 0x8000001b: 0x0, + 0x8000001c: 0x20800, + 0x8000001d: 0x820, + 0x8000001e: 0x20020, + 0x8000001f: 0x8020800 + } + ]; + + // Masks that select the SBOX input + var SBOX_MASK = [ + 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, + 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f + ]; + + /** + * DES block cipher algorithm. + */ + var DES = C_algo.DES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + + // Select 56 bits according to PC1 + var keyBits = []; + for (var i = 0; i < 56; i++) { + var keyBitPos = PC1[i] - 1; + keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; + } + + // Assemble 16 subkeys + var subKeys = this._subKeys = []; + for (var nSubKey = 0; nSubKey < 16; nSubKey++) { + // Create subkey + var subKey = subKeys[nSubKey] = []; + + // Shortcut + var bitShift = BIT_SHIFTS[nSubKey]; + + // Select 48 bits according to PC2 + for (var i = 0; i < 24; i++) { + // Select from the left 28 key bits + subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); + + // Select from the right 28 key bits + subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); + } + + // Since each subkey is applied to an expanded 32-bit input, + // the subkey can be broken into 8 values scaled to 32-bits, + // which allows the key to be used without expansion + subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); + for (var i = 1; i < 7; i++) { + subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); + } + subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); + } + + // Compute inverse subkeys + var invSubKeys = this._invSubKeys = []; + for (var i = 0; i < 16; i++) { + invSubKeys[i] = subKeys[15 - i]; + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._subKeys); + }, + + decryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._invSubKeys); + }, + + _doCryptBlock: function (M, offset, subKeys) { + // Get input + this._lBlock = M[offset]; + this._rBlock = M[offset + 1]; + + // Initial permutation + exchangeLR.call(this, 4, 0x0f0f0f0f); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeRL.call(this, 2, 0x33333333); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeLR.call(this, 1, 0x55555555); + + // Rounds + for (var round = 0; round < 16; round++) { + // Shortcuts + var subKey = subKeys[round]; + var lBlock = this._lBlock; + var rBlock = this._rBlock; + + // Feistel function + var f = 0; + for (var i = 0; i < 8; i++) { + f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; + } + this._lBlock = rBlock; + this._rBlock = lBlock ^ f; + } + + // Undo swap from last round + var t = this._lBlock; + this._lBlock = this._rBlock; + this._rBlock = t; + + // Final permutation + exchangeLR.call(this, 1, 0x55555555); + exchangeRL.call(this, 8, 0x00ff00ff); + exchangeRL.call(this, 2, 0x33333333); + exchangeLR.call(this, 16, 0x0000ffff); + exchangeLR.call(this, 4, 0x0f0f0f0f); + + // Set output + M[offset] = this._lBlock; + M[offset + 1] = this._rBlock; + }, + + keySize: 64/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + // Swap bits across the left and right words + function exchangeLR(offset, mask) { + var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; + this._rBlock ^= t; + this._lBlock ^= t << offset; + } + + function exchangeRL(offset, mask) { + var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; + this._lBlock ^= t; + this._rBlock ^= t << offset; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); + */ + C.DES = BlockCipher._createHelper(DES); + + /** + * Triple-DES block cipher algorithm. + */ + var TripleDES = C_algo.TripleDES = BlockCipher.extend({ + _doReset: function () { + // Shortcuts + var key = this._key; + var keyWords = key.words; + // Make sure the key length is valid (64, 128 or >= 192 bit) + if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) { + throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.'); + } + + // Extend the key according to the keying options defined in 3DES standard + var key1 = keyWords.slice(0, 2); + var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4); + var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6); + + // Create DES instances + this._des1 = DES.createEncryptor(WordArray.create(key1)); + this._des2 = DES.createEncryptor(WordArray.create(key2)); + this._des3 = DES.createEncryptor(WordArray.create(key3)); + }, + + encryptBlock: function (M, offset) { + this._des1.encryptBlock(M, offset); + this._des2.decryptBlock(M, offset); + this._des3.encryptBlock(M, offset); + }, + + decryptBlock: function (M, offset) { + this._des3.decryptBlock(M, offset); + this._des2.encryptBlock(M, offset); + this._des1.decryptBlock(M, offset); + }, + + keySize: 192/32, + + ivSize: 64/32, + + blockSize: 64/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); + */ + C.TripleDES = BlockCipher._createHelper(TripleDES); + }()); + + + return CryptoJS.TripleDES; + +})); \ No newline at end of file diff --git a/node_modules/crypto-js/x64-core.js b/node_modules/crypto-js/x64-core.js new file mode 100644 index 0000000..57dcc14 --- /dev/null +++ b/node_modules/crypto-js/x64-core.js @@ -0,0 +1,304 @@ +;(function (root, factory) { + if (typeof exports === "object") { + // CommonJS + module.exports = exports = factory(require("./core")); + } + else if (typeof define === "function" && define.amd) { + // AMD + define(["./core"], factory); + } + else { + // Global (browser) + factory(root.CryptoJS); + } +}(this, function (CryptoJS) { + + (function (undefined) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var X32WordArray = C_lib.WordArray; + + /** + * x64 namespace. + */ + var C_x64 = C.x64 = {}; + + /** + * A 64-bit word. + */ + var X64Word = C_x64.Word = Base.extend({ + /** + * Initializes a newly created 64-bit word. + * + * @param {number} high The high 32 bits. + * @param {number} low The low 32 bits. + * + * @example + * + * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); + */ + init: function (high, low) { + this.high = high; + this.low = low; + } + + /** + * Bitwise NOTs this word. + * + * @return {X64Word} A new x64-Word object after negating. + * + * @example + * + * var negated = x64Word.not(); + */ + // not: function () { + // var high = ~this.high; + // var low = ~this.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ANDs this word with the passed word. + * + * @param {X64Word} word The x64-Word to AND with this word. + * + * @return {X64Word} A new x64-Word object after ANDing. + * + * @example + * + * var anded = x64Word.and(anotherX64Word); + */ + // and: function (word) { + // var high = this.high & word.high; + // var low = this.low & word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise ORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to OR with this word. + * + * @return {X64Word} A new x64-Word object after ORing. + * + * @example + * + * var ored = x64Word.or(anotherX64Word); + */ + // or: function (word) { + // var high = this.high | word.high; + // var low = this.low | word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Bitwise XORs this word with the passed word. + * + * @param {X64Word} word The x64-Word to XOR with this word. + * + * @return {X64Word} A new x64-Word object after XORing. + * + * @example + * + * var xored = x64Word.xor(anotherX64Word); + */ + // xor: function (word) { + // var high = this.high ^ word.high; + // var low = this.low ^ word.low; + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the left. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftL(25); + */ + // shiftL: function (n) { + // if (n < 32) { + // var high = (this.high << n) | (this.low >>> (32 - n)); + // var low = this.low << n; + // } else { + // var high = this.low << (n - 32); + // var low = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Shifts this word n bits to the right. + * + * @param {number} n The number of bits to shift. + * + * @return {X64Word} A new x64-Word object after shifting. + * + * @example + * + * var shifted = x64Word.shiftR(7); + */ + // shiftR: function (n) { + // if (n < 32) { + // var low = (this.low >>> n) | (this.high << (32 - n)); + // var high = this.high >>> n; + // } else { + // var low = this.high >>> (n - 32); + // var high = 0; + // } + + // return X64Word.create(high, low); + // }, + + /** + * Rotates this word n bits to the left. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotL(25); + */ + // rotL: function (n) { + // return this.shiftL(n).or(this.shiftR(64 - n)); + // }, + + /** + * Rotates this word n bits to the right. + * + * @param {number} n The number of bits to rotate. + * + * @return {X64Word} A new x64-Word object after rotating. + * + * @example + * + * var rotated = x64Word.rotR(7); + */ + // rotR: function (n) { + // return this.shiftR(n).or(this.shiftL(64 - n)); + // }, + + /** + * Adds this word with the passed word. + * + * @param {X64Word} word The x64-Word to add with this word. + * + * @return {X64Word} A new x64-Word object after adding. + * + * @example + * + * var added = x64Word.add(anotherX64Word); + */ + // add: function (word) { + // var low = (this.low + word.low) | 0; + // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; + // var high = (this.high + word.high + carry) | 0; + + // return X64Word.create(high, low); + // } + }); + + /** + * An array of 64-bit words. + * + * @property {Array} words The array of CryptoJS.x64.Word objects. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var X64WordArray = C_x64.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.x64.WordArray.create(); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ]); + * + * var wordArray = CryptoJS.x64.WordArray.create([ + * CryptoJS.x64.Word.create(0x00010203, 0x04050607), + * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) + * ], 10); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 8; + } + }, + + /** + * Converts this 64-bit word array to a 32-bit word array. + * + * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. + * + * @example + * + * var x32WordArray = x64WordArray.toX32(); + */ + toX32: function () { + // Shortcuts + var x64Words = this.words; + var x64WordsLength = x64Words.length; + + // Convert + var x32Words = []; + for (var i = 0; i < x64WordsLength; i++) { + var x64Word = x64Words[i]; + x32Words.push(x64Word.high); + x32Words.push(x64Word.low); + } + + return X32WordArray.create(x32Words, this.sigBytes); + }, + + /** + * Creates a copy of this word array. + * + * @return {X64WordArray} The clone. + * + * @example + * + * var clone = x64WordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + + // Clone "words" array + var words = clone.words = this.words.slice(0); + + // Clone each X64Word object + var wordsLength = words.length; + for (var i = 0; i < wordsLength; i++) { + words[i] = words[i].clone(); + } + + return clone; + } + }); + }()); + + + return CryptoJS; + +})); \ No newline at end of file diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..595068d --- /dev/null +++ b/pages.json @@ -0,0 +1,605 @@ +{ + "easycom": { + "autoscan": true, + "custom": { + "^Jnpf(.*)": "@/components/Jnpf/$1/index.vue", + "^jnpf-(.*)": "@/components/Jnpf/$1/index.vue" + } + }, + "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + // #ifdef APP + { + "path": "pages/launch/index", + "style": { + "navigationStyle": "custom", + "navigationBarTextStyle": "black" // 状态栏字体为白色 + } + }, + { + "path": "pages/launch/policy", + "style": { + "navigationStyle": "custom", + "navigationBarTextStyle": "black" // 状态栏字体为白色 + } + }, + { + "path": "pages/launch/guide", + "style": { + "navigationStyle": "custom", + "navigationBarTextStyle": "black" // 状态栏字体为白色 + } + }, + // #endif + { + "path": "pages/login/index", + "style": { + "navigationStyle": "custom", + "navigationBarTextStyle": "black" // 状态栏字体为白色 + } + }, + { + "path": "pages/login/sso-redirect", + "style": { + "navigationStyle": "custom", // 隐藏系统导航栏 + "navigationBarTextStyle": "black" // 状态栏字体为白色 + } + }, + { + "path": "pages/login/scanLogin", + "style": { + "navigationBarTitleText": "扫码登录" + } + }, + { + "path": "pages/login/otherLogin", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/index/index", + "style": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "JNPF快速开发平台", + "app-plus": { + "bounce": "none" // 取消APP端iOS回弹,避免与下拉刷新冲突 (可统一配在 'globalStyle') + } + } + }, + { + "path": "pages/index/dashboard", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "%app.tabBar.dashboard%" + } + }, + { + "path": "pages/index/message", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "%app.tabBar.message%" + } + }, + // #ifndef MP + { + "path": "pages/formShortLink/index", + "style": { + "navigationBarTitleText": "表单外链", + "app-plus": { + "titleNView": false, + "bounce": "none" + } + } + }, + { + "path": "pages/formShortLink/detail", + "style": { + "navigationBarTitleText": "详情", + "app-plus": { + "titleNView": false, + "bounce": "none" + } + } + }, + // #endif + { + "path": "pages/index/my", + "style": { + "navigationBarTitleText": "%app.tabBar.my%", + "app-plus": { + "bounce": "none" + } + } + } + ], + "subPackages": [{ + "root": "pages/portal", + "pages": [ + // #ifndef MP + { + "path": "applyPortal/index", + "style": { + "navigationStyle": "custom", // 隐藏系统导航栏 + "navigationBarTextStyle": "black" // 状态栏字体为白色 + } + }, + // #endif + // #ifdef H5 + { + "path": "mpPortal/index", + "style": { + "navigationStyle": "custom", // 隐藏系统导航栏 + "navigationBarTextStyle": "black" // 状态栏字体为白色 + } + }, + // #endif + { + "path": "scanPortal/index", + "style": { + "navigationBarTitleText": "" + } + } + ] + }, + { + "root": "pages/message", + "pages": [{ + "path": "messageDetail/index", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "im/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "chat/index", + "style": { + "navigationBarTitleText": "%app.my.chat%" + } + } + ] + }, + { + "root": "pages/workFlow", + "pages": [{ + "path": "flowBefore/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "workFlow/index", + "style": { + "navigationBarTitleText": "发起审批" + } + }, + { + "path": "flowBefore/revokeForm", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "flowBefore/logError", + "style": { + "navigationBarTitleText": "异常详情" + } + }, + { + "path": "document/index", + "style": { + "navigationBarTitleText": "文档中心" + } + }, + { + "path": "document/detail", + "style": { + "navigationBarTitleText": "文档中心" + } + }, + { + "path": "schedule/index", + "style": { + "navigationBarTitleText": "日程" + } + }, + { + "path": "schedule/form", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "schedule/detail", + "style": { + "navigationStyle": "custom", // 隐藏系统导航栏 + "navigationBarTitleText": "详情", + "app-plus": { + "titleNView": false, + "bounce": "none" + } + } + }, + { + "path": "entrustAgent/index", + "style": { + "navigationBarTitleText": "%app.my.entrustedAgency%" + } + }, + { + "path": "entrustAgent/form", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "entrustAgent/detail", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "webView/index", + "style": { + "navigationBarTitleText": "", + "app-plus": { + "titleNView": false, + "bounce": "none" + } + } + }, + { + "path": "flowTodo/index", + "style": { + "navigationBarTitleText": "审批中心" + } + }, + // #ifdef MP + { + "path": "filePreview/index", + "style": { + "navigationBarTitleText": "" + } + }, + // #endif + { + "path": "operate/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "operate/revoke", + "style": { + "navigationBarTitleText": "流程撤销" + } + }, + { + "path": "scanForm/index", + "style": { + "navigationBarTitleText": "预览页面" + } + }, + { + "path": "comment/index", + "style": { + "navigationBarTitleText": "填写评论" + } + }, + { + "path": "candiDateUserSelect/index", + "style": { + "navigationBarTitleText": "审批候选人", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "assistantMsg/viewData", + "style": { + "navigationBarTitleText": "查看数据" + } + }, + { + "path": "allAppWorkFlow/index", + "style": { + "navigationBarTitleText": "收藏流程" + } + } + ] + }, + { + "root": "pages/commonPage", + "pages": [{ + "path": "morePage/index", + "style": { + "navigationBarTitleText": "常用菜单" + } + }] + }, + { + "root": "pages/apply", + "pages": [{ + "path": "menu/index", + "style": { + "navigationBarTitleText": "应用功能" + } + }, + { + "path": "reportLog/index", + "style": { + "navigationBarTitleText": "汇报日志" + } + }, + { + "path": "reportLog/form", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "catalog/index", + "style": { + "navigationStyle": "custom" // 隐藏系统导航栏 + } + }, + { + "path": "interPage/signInvokeList", + "style": { + "navigationBarTitleText": "个人签名" + } + }, + { + "path": "order/index", + "style": { + "navigationBarTitleText": "订单示例" + } + }, + { + "path": "popSelect/index", + "style": { + "navigationBarTitleText": "选择数据", + "enablePullDownRefresh": false + } + }, + { + "path": "dynamicModel/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "dynamicModel/form", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "dynamicModel/detail", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "dynamicModel/scanForm", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "tableLinkage/index", + "style": { + "navigationBarTitleText": "选择数据", + "enablePullDownRefresh": false + } + }, + { + "path": "location/index", + "style": { + "navigationBarTitleText": "%app.apply.location.modalTitle%", + "enablePullDownRefresh": false + } + }, + { + "path": "customBtn/index", + "style": { + "navigationBarTitleText": "自定义操作" + } + }, + { + "path": "externalLink/index", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "allAppApply/index", + "style": { + "navigationBarTitleText": "收藏菜单" + } + } + ] + }, + { + "root": "pages/my", + "pages": [{ + "path": "contacts/index", + "style": { + "navigationBarTitleText": "%app.my.contacts%" + } + }, + { + "path": "userDetail/index", + "style": { + "navigationBarTitleText": "", + "navigationBarTextStyle": "black", + "navigationBarBackgroundColor": "#f0f2f6" + } + }, + { + "path": "contacts/userList", + "style": { + "navigationBarTitleText": "用户列表" + } + }, { + "path": "settings/index", + "style": { + "navigationBarTitleText": "%app.my.setting%", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "scanResult/index", + "style": { + "navigationBarTitleText": "扫描结果", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "modifyPsd/index", + "style": { + "navigationBarTitleText": "修改密码", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "contactUs/index", + "style": { + "navigationBarTitleText": "联系我们", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "abouts/index", + "style": { + "navigationBarTitleText": "关于平台" + } + }, + { + "path": "accountSecurity/index", + "style": { + "navigationBarTitleText": "账号安全", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "cancellation/index", + "style": { + "navigationBarTitleText": "注销账号", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "personalData/index", + "style": { + "navigationBarTitleText": "%layout.header.profile%", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "organization/index", + "style": { + "navigationBarTitleText": "企业组织", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "identity/index", + "style": { + "navigationBarTitleText": "我的身份", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "changeSystem/index", + "style": { + "navigationBarTitleText": "%app.my.mySystem%" + } + }, + { + "path": "personalSetting/index", + "style": { + "navigationBarTitleText": "%app.my.personalSetting%" + } + } + ] + } + ], + "preloadRule": { + "pages/index/message": { + "network": "all", + "packages": [ + "pages/message" + ] + }, + "pages/index/my": { + "network": "all", + "packages": [ + "pages/my" + ] + } + }, + "tabBar": { + "color": "#303133", + "selectedColor": "#2979FF", + "backgroundColor": "#ffffff", + "list": [{ + "pagePath": "pages/index/index", + "text": "%app.tabBar.home%", + "iconPath": "static/image/tabbar/home.png", + "selectedIconPath": "static/image/tabbar/homeHL.png" + }, + { + "pagePath": "pages/index/dashboard", + "text": "%app.tabBar.dashboard%", + "iconPath": "static/image/tabbar/workFlow.png", + "selectedIconPath": "static/image/tabbar/workFlowHL.png" + }, + { + "pagePath": "pages/index/message", + "text": "%app.tabBar.message%", + "iconPath": "static/image/tabbar/message.png", + "selectedIconPath": "static/image/tabbar/messageHL.png" + }, + { + "pagePath": "pages/index/my", + "text": "%app.tabBar.my%", + "iconPath": "static/image/tabbar/my.png", + "selectedIconPath": "static/image/tabbar/myHL.png" + } + ] + }, + "globalStyle": { + "navigationBarTitleText": "", + "navigationBarTextStyle": "black", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f0f2f6", + "usingComponents": { + "ly-tree-node": "/components/ly-tree/ly-tree-node" + } + } +} \ No newline at end of file diff --git a/pages/apply/allAppApply/index.vue b/pages/apply/allAppApply/index.vue new file mode 100644 index 0000000..a0720a5 --- /dev/null +++ b/pages/apply/allAppApply/index.vue @@ -0,0 +1,242 @@ + + + + \ No newline at end of file diff --git a/pages/apply/catalog/index.vue b/pages/apply/catalog/index.vue new file mode 100644 index 0000000..be03a04 --- /dev/null +++ b/pages/apply/catalog/index.vue @@ -0,0 +1,305 @@ + + + + \ No newline at end of file diff --git a/pages/apply/customBtn/index.vue b/pages/apply/customBtn/index.vue new file mode 100644 index 0000000..5f25cf1 --- /dev/null +++ b/pages/apply/customBtn/index.vue @@ -0,0 +1,228 @@ + + + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/bulkOperationMixin.js b/pages/apply/dynamicModel/bulkOperationMixin.js new file mode 100644 index 0000000..ad35d25 --- /dev/null +++ b/pages/apply/dynamicModel/bulkOperationMixin.js @@ -0,0 +1,75 @@ +import { + deteleModel +} from '@/api/apply/visualDev' +export default { + data() { + return { + slide: '', + slide2: '', + checkedAll: false, + ids: [], + showTop: false, + } + }, + methods: { + /* 批量删除 */ + batchDelete() { + if (!this.selectItems.length) { + return this.$u.toast('请选择一条数据') + } + uni.showModal({ + title: '提示', + content: '删除后数据无法恢复', + success: (res) => { + if (res.confirm) { + const uniqueIds = new Set(); + this.selectItems.forEach(item => { + uniqueIds.add(item.id); + }); + const ids = [...uniqueIds]; + let data = { + flowId: this.config.flowId, + ids + }; + deteleModel(data, this.modelId).then(res => { + this.selectItems = []; + this.$u.toast(res.msg) + this.mescroll.resetUpScroll() + }) + } + } + }) + }, + openBatchOperate() { + this.showTop = !this.showTop + if (this.showTop) { + this.slide = 'slide-up' + this.slide2 = 'slide-up2' + } + }, + checkAll() { + this.checkedAll = !this.checkedAll + this.list = this.list.map(o => ({ + ...o, + checked: false + })) + if (this.checkedAll) { + this.list = this.list.map(o => ({ + ...o, + checked: true + })) + } + }, + cancel() { + this.list = this.list.map(o => ({ + ...o, + checked: false + })) + this.showTop = false + this.checkedAll = false + this.$nextTick(() => { + this.$refs.list.handleCheckAll() + }) + } + } +} \ No newline at end of file diff --git a/pages/apply/dynamicModel/components/detail/Item.vue b/pages/apply/dynamicModel/components/detail/Item.vue new file mode 100644 index 0000000..23f9ed8 --- /dev/null +++ b/pages/apply/dynamicModel/components/detail/Item.vue @@ -0,0 +1,596 @@ + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/components/detail/Parser.vue b/pages/apply/dynamicModel/components/detail/Parser.vue new file mode 100644 index 0000000..b791aa3 --- /dev/null +++ b/pages/apply/dynamicModel/components/detail/Parser.vue @@ -0,0 +1,68 @@ + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/components/form/index.vue b/pages/apply/dynamicModel/components/form/index.vue new file mode 100644 index 0000000..3a50f84 --- /dev/null +++ b/pages/apply/dynamicModel/components/form/index.vue @@ -0,0 +1,179 @@ + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/components/list/index.vue b/pages/apply/dynamicModel/components/list/index.vue new file mode 100644 index 0000000..3f9746c --- /dev/null +++ b/pages/apply/dynamicModel/components/list/index.vue @@ -0,0 +1,937 @@ + + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/components/list/list.vue b/pages/apply/dynamicModel/components/list/list.vue new file mode 100644 index 0000000..25bf92a --- /dev/null +++ b/pages/apply/dynamicModel/components/list/list.vue @@ -0,0 +1,219 @@ + + + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/components/parser/index.vue b/pages/apply/dynamicModel/components/parser/index.vue new file mode 100644 index 0000000..36e5ca2 --- /dev/null +++ b/pages/apply/dynamicModel/components/parser/index.vue @@ -0,0 +1,164 @@ + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/components/tableCell.vue b/pages/apply/dynamicModel/components/tableCell.vue new file mode 100644 index 0000000..7fc9a17 --- /dev/null +++ b/pages/apply/dynamicModel/components/tableCell.vue @@ -0,0 +1,125 @@ + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/detail.vue b/pages/apply/dynamicModel/detail.vue new file mode 100644 index 0000000..4d54d49 --- /dev/null +++ b/pages/apply/dynamicModel/detail.vue @@ -0,0 +1,449 @@ + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/form.vue b/pages/apply/dynamicModel/form.vue new file mode 100644 index 0000000..2a28186 --- /dev/null +++ b/pages/apply/dynamicModel/form.vue @@ -0,0 +1,295 @@ + + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/index.vue b/pages/apply/dynamicModel/index.vue new file mode 100644 index 0000000..0b77319 --- /dev/null +++ b/pages/apply/dynamicModel/index.vue @@ -0,0 +1,120 @@ + + + + \ No newline at end of file diff --git a/pages/apply/dynamicModel/scanForm.vue b/pages/apply/dynamicModel/scanForm.vue new file mode 100644 index 0000000..773af74 --- /dev/null +++ b/pages/apply/dynamicModel/scanForm.vue @@ -0,0 +1,180 @@ + + + + + \ No newline at end of file diff --git a/pages/apply/externalLink/index.vue b/pages/apply/externalLink/index.vue new file mode 100644 index 0000000..1f44ea3 --- /dev/null +++ b/pages/apply/externalLink/index.vue @@ -0,0 +1,23 @@ + + + \ No newline at end of file diff --git a/pages/apply/interPage/signInvokeList.vue b/pages/apply/interPage/signInvokeList.vue new file mode 100644 index 0000000..33dcfdf --- /dev/null +++ b/pages/apply/interPage/signInvokeList.vue @@ -0,0 +1,181 @@ + + + + \ No newline at end of file diff --git a/pages/apply/location/index.vue b/pages/apply/location/index.vue new file mode 100644 index 0000000..b0b2f99 --- /dev/null +++ b/pages/apply/location/index.vue @@ -0,0 +1,558 @@ + + + + + \ No newline at end of file diff --git a/pages/apply/menu/index.vue b/pages/apply/menu/index.vue new file mode 100644 index 0000000..ede954d --- /dev/null +++ b/pages/apply/menu/index.vue @@ -0,0 +1,341 @@ + + + + \ No newline at end of file diff --git a/pages/apply/order/index.vue b/pages/apply/order/index.vue new file mode 100644 index 0000000..83361c7 --- /dev/null +++ b/pages/apply/order/index.vue @@ -0,0 +1,358 @@ + + + + \ No newline at end of file diff --git a/pages/apply/popSelect/index.vue b/pages/apply/popSelect/index.vue new file mode 100644 index 0000000..2d3eba0 --- /dev/null +++ b/pages/apply/popSelect/index.vue @@ -0,0 +1,285 @@ + + + + \ No newline at end of file diff --git a/pages/apply/reportLog/form.vue b/pages/apply/reportLog/form.vue new file mode 100644 index 0000000..94a1290 --- /dev/null +++ b/pages/apply/reportLog/form.vue @@ -0,0 +1,133 @@ + + + + \ No newline at end of file diff --git a/pages/apply/reportLog/index.vue b/pages/apply/reportLog/index.vue new file mode 100644 index 0000000..01cac17 --- /dev/null +++ b/pages/apply/reportLog/index.vue @@ -0,0 +1,177 @@ + + + + + \ No newline at end of file diff --git a/pages/apply/tableLinkage/index.vue b/pages/apply/tableLinkage/index.vue new file mode 100644 index 0000000..bfc2a22 --- /dev/null +++ b/pages/apply/tableLinkage/index.vue @@ -0,0 +1,262 @@ + + + + + \ No newline at end of file diff --git a/pages/commonPage/morePage/allCommonFlow.vue b/pages/commonPage/morePage/allCommonFlow.vue new file mode 100644 index 0000000..1f28ecb --- /dev/null +++ b/pages/commonPage/morePage/allCommonFlow.vue @@ -0,0 +1,134 @@ + + + + \ No newline at end of file diff --git a/pages/commonPage/morePage/allCommonMenus.vue b/pages/commonPage/morePage/allCommonMenus.vue new file mode 100644 index 0000000..f307c2d --- /dev/null +++ b/pages/commonPage/morePage/allCommonMenus.vue @@ -0,0 +1,286 @@ + + + + \ No newline at end of file diff --git a/pages/commonPage/morePage/index.vue b/pages/commonPage/morePage/index.vue new file mode 100644 index 0000000..33f9ba9 --- /dev/null +++ b/pages/commonPage/morePage/index.vue @@ -0,0 +1,35 @@ + + + + + \ No newline at end of file diff --git a/pages/formShortLink/detail.vue b/pages/formShortLink/detail.vue new file mode 100644 index 0000000..9a9169f --- /dev/null +++ b/pages/formShortLink/detail.vue @@ -0,0 +1,296 @@ + + + + + \ No newline at end of file diff --git a/pages/formShortLink/index.vue b/pages/formShortLink/index.vue new file mode 100644 index 0000000..dbf76f1 --- /dev/null +++ b/pages/formShortLink/index.vue @@ -0,0 +1,326 @@ + + + + \ No newline at end of file diff --git a/pages/formShortLink/list.vue b/pages/formShortLink/list.vue new file mode 100644 index 0000000..197b09a --- /dev/null +++ b/pages/formShortLink/list.vue @@ -0,0 +1,333 @@ + + + + + \ No newline at end of file diff --git a/pages/index/components/PasswordPopup/index.vue b/pages/index/components/PasswordPopup/index.vue new file mode 100644 index 0000000..d17632f --- /dev/null +++ b/pages/index/components/PasswordPopup/index.vue @@ -0,0 +1,182 @@ + + + + + \ No newline at end of file diff --git a/pages/index/dashboard.vue b/pages/index/dashboard.vue new file mode 100644 index 0000000..741f0a7 --- /dev/null +++ b/pages/index/dashboard.vue @@ -0,0 +1,577 @@ + + + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000..ec36832 --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,362 @@ + + + + \ No newline at end of file diff --git a/pages/index/message.vue b/pages/index/message.vue new file mode 100644 index 0000000..eb76c33 --- /dev/null +++ b/pages/index/message.vue @@ -0,0 +1,464 @@ + + + + + \ No newline at end of file diff --git a/pages/index/mixin.js b/pages/index/mixin.js new file mode 100644 index 0000000..03d64da --- /dev/null +++ b/pages/index/mixin.js @@ -0,0 +1,24 @@ +import { + useChatStore +} from '@/store/modules/chat' +export default { + onShow() { + this.setTabBarBadge() + }, + methods: { + setTabBarBadge() { + const chatStore = useChatStore() + const badgeNum = chatStore.getBadgeNum || 0 + if (badgeNum) { + uni.setTabBarBadge({ + index: 2, + text: badgeNum > 99 ? '99+' : badgeNum.toString() + }); + } else { + uni.removeTabBarBadge({ + index: 2 + }); + } + } + } +} \ No newline at end of file diff --git a/pages/index/my.vue b/pages/index/my.vue new file mode 100644 index 0000000..ad1a6cb --- /dev/null +++ b/pages/index/my.vue @@ -0,0 +1,376 @@ + + + + \ No newline at end of file diff --git a/pages/launch/guide.vue b/pages/launch/guide.vue new file mode 100644 index 0000000..1e597fc --- /dev/null +++ b/pages/launch/guide.vue @@ -0,0 +1,192 @@ + + + + \ No newline at end of file diff --git a/pages/launch/index.vue b/pages/launch/index.vue new file mode 100644 index 0000000..c1ee0e8 --- /dev/null +++ b/pages/launch/index.vue @@ -0,0 +1,103 @@ + + + + + \ No newline at end of file diff --git a/pages/launch/policy.vue b/pages/launch/policy.vue new file mode 100644 index 0000000..22af395 --- /dev/null +++ b/pages/launch/policy.vue @@ -0,0 +1,102 @@ + + + + + \ No newline at end of file diff --git a/pages/login/index.vue b/pages/login/index.vue new file mode 100644 index 0000000..97be348 --- /dev/null +++ b/pages/login/index.vue @@ -0,0 +1,790 @@ + + + + \ No newline at end of file diff --git a/pages/login/otherLogin.vue b/pages/login/otherLogin.vue new file mode 100644 index 0000000..5e38e89 --- /dev/null +++ b/pages/login/otherLogin.vue @@ -0,0 +1,114 @@ +@@ -0,0 +1,70 @@ + + + \ No newline at end of file diff --git a/pages/login/scanLogin.vue b/pages/login/scanLogin.vue new file mode 100644 index 0000000..49fb41c --- /dev/null +++ b/pages/login/scanLogin.vue @@ -0,0 +1,148 @@ + + + + + \ No newline at end of file diff --git a/pages/login/sso-redirect.vue b/pages/login/sso-redirect.vue new file mode 100644 index 0000000..b0f1738 --- /dev/null +++ b/pages/login/sso-redirect.vue @@ -0,0 +1,35 @@ + + + + + \ No newline at end of file diff --git a/pages/message/chat/index.vue b/pages/message/chat/index.vue new file mode 100644 index 0000000..85b4727 --- /dev/null +++ b/pages/message/chat/index.vue @@ -0,0 +1,292 @@ + + + + \ No newline at end of file diff --git a/pages/message/im/emoji.js b/pages/message/im/emoji.js new file mode 100644 index 0000000..75a6e70 --- /dev/null +++ b/pages/message/im/emoji.js @@ -0,0 +1,988 @@ +const emojiTree = [ + [{ + "url": "100.gif", + "alt": "[微笑]" + }, + { + "url": "101.gif", + "alt": "[伤心]" + }, + { + "url": "102.gif", + "alt": "[美女]" + }, + { + "url": "103.gif", + "alt": "[发呆]" + }, + { + "url": "104.gif", + "alt": "[墨镜]" + }, + { + "url": "105.gif", + "alt": "[哭]" + }, + { + "url": "106.gif", + "alt": "[羞]" + }, + { + "url": "107.gif", + "alt": "[哑]" + }, + { + "url": "108.gif", + "alt": "[睡]" + }, + { + "url": "109.gif", + "alt": "[大哭]" + }, + { + "url": "110.gif", + "alt": "[囧]" + }, + { + "url": "111.gif", + "alt": "[怒]" + }, + { + "url": "112.gif", + "alt": "[调皮]" + }, + { + "url": "113.gif", + "alt": "[呲牙]" + }, + { + "url": "114.gif", + "alt": "[惊讶]" + }, + { + "url": "115.gif", + "alt": "[难过]" + }, + { + "url": "116.gif", + "alt": "[酷]" + }, + { + "url": "117.gif", + "alt": "[汗]" + }, + { + "url": "118.gif", + "alt": "[抓狂]" + }, + { + "url": "119.gif", + "alt": "[吐]" + }, + { + "url": "120.gif", + "alt": "[笑]" + }, + { + "url": "121.gif", + "alt": "[快乐]" + }, + { + "url": "122.gif", + "alt": "[疑惑]" + }, + { + "url": "123.gif", + "alt": "[傲]" + } + ], + [{ + "url": "124.gif", + "alt": "[饿]" + }, + { + "url": "125.gif", + "alt": "[累]" + }, + { + "url": "126.gif", + "alt": "[惊恐]" + }, + { + "url": "127.gif", + "alt": "[汗1]" + }, + { + "url": "128.gif", + "alt": "[高兴]" + }, + { + "url": "129.gif", + "alt": "[闲]" + }, + { + "url": "130.gif", + "alt": "[努力]" + }, + { + "url": "131.gif", + "alt": "[骂]" + }, + { + "url": "132.gif", + "alt": "[疑问]" + }, + { + "url": "133.gif", + "alt": "[秘密]" + }, + { + "url": "134.gif", + "alt": "[乱]" + }, + { + "url": "135.gif", + "alt": "[疯]" + }, + { + "url": "136.gif", + "alt": "[哀]" + }, + { + "url": "137.gif", + "alt": "[鬼]" + }, + { + "url": "138.gif", + "alt": "[打击]" + }, + { + "url": "139.gif", + "alt": "[bye]" + }, + { + "url": "140.gif", + "alt": "[擦汗]" + }, + { + "url": "141.gif", + "alt": "[抠]" + }, + { + "url": "142.gif", + "alt": "[鼓掌]" + }, + { + "url": "143.gif", + "alt": "[糟糕]" + }, + { + "url": "144.gif", + "alt": "[恶搞]" + }, + { + "url": "145.gif", + "alt": "[左哼哼]" + }, + { + "url": "146.gif", + "alt": "[右哼哼]" + }, + { + "url": "147.gif", + "alt": "[哈欠]" + } + ], + [{ + "url": "148.gif", + "alt": "[看]" + }, + { + "url": "149.gif", + "alt": "[委屈]" + }, + { + "url": "150.gif", + "alt": "[难过1]" + }, + { + "url": "151.gif", + "alt": "[坏]" + }, + { + "url": "152.gif", + "alt": "[亲]" + }, + { + "url": "153.gif", + "alt": "[吓]" + }, + { + "url": "154.gif", + "alt": "[可怜]" + }, + { + "url": "155.gif", + "alt": "[刀]" + }, + { + "url": "156.gif", + "alt": "[水果]" + }, + { + "url": "157.gif", + "alt": "[酒]" + }, + { + "url": "158.gif", + "alt": "[篮球]" + }, + { + "url": "159.gif", + "alt": "[乒乓]" + }, + { + "url": "160.gif", + "alt": "[咖啡]" + }, + { + "url": "161.gif", + "alt": "[美食]" + }, + { + "url": "162.gif", + "alt": "[动物]" + }, + { + "url": "163.gif", + "alt": "[鲜花]" + }, + { + "url": "164.gif", + "alt": "[枯]" + }, + { + "url": "165.gif", + "alt": "[唇]" + }, + { + "url": "166.gif", + "alt": "[爱]" + }, + { + "url": "167.gif", + "alt": "[分手]" + }, + { + "url": "168.gif", + "alt": "[生日]" + }, + { + "url": "169.gif", + "alt": "[电]" + }, + { + "url": "170.gif", + "alt": "[炸弹]" + }, + { + "url": "171.gif", + "alt": "[刀子]" + } + ], + [{ + "url": "172.gif", + "alt": "[足球]" + }, + { + "url": "173.gif", + "alt": "[瓢虫]" + }, + { + "url": "174.gif", + "alt": "[翔]" + }, + { + "url": "175.gif", + "alt": "[月亮]" + }, + { + "url": "176.gif", + "alt": "[太阳]" + }, + { + "url": "177.gif", + "alt": "[礼物]" + }, + { + "url": "178.gif", + "alt": "[抱抱]" + }, + { + "url": "179.gif", + "alt": "[拇指]" + }, + { + "url": "180.gif", + "alt": "[贬低]" + }, + { + "url": "181.gif", + "alt": "[握手]" + }, + { + "url": "182.gif", + "alt": "[剪刀手]" + }, + { + "url": "183.gif", + "alt": "[抱拳]" + }, + { + "url": "184.gif", + "alt": "[勾引]" + }, + { + "url": "185.gif", + "alt": "[拳头]" + }, + { + "url": "186.gif", + "alt": "[小拇指]" + }, + { + "url": "187.gif", + "alt": "[拇指八]" + }, + { + "url": "188.gif", + "alt": "[食指]" + }, + { + "url": "189.gif", + "alt": "[ok]" + }, + { + "url": "190.gif", + "alt": "[情侣]" + }, + { + "url": "191.gif", + "alt": "[爱心]" + }, + { + "url": "192.gif", + "alt": "[蹦哒]" + }, + { + "url": "193.gif", + "alt": "[颤抖]" + }, + { + "url": "194.gif", + "alt": "[怄气]" + }, + { + "url": "195.gif", + "alt": "[跳舞]" + } + ], + [{ + "url": "196.gif", + "alt": "[拜]" + }, + { + "url": "197.gif", + "alt": "[背着]" + }, + { + "url": "198.gif", + "alt": "[伸手]" + }, + { + "url": "199.gif", + "alt": "[耍帅]" + }, + { + "url": "200.png", + "alt": "[微笑1]" + }, + { + "url": "201.png", + "alt": "[生病]" + }, + { + "url": "202.png", + "alt": "[哭泣]" + }, + { + "url": "203.png", + "alt": "[吐舌]" + }, + { + "url": "204.png", + "alt": "[迷糊]" + }, + { + "url": "205.png", + "alt": "[瞪眼]" + }, + { + "url": "206.png", + "alt": "[恐怖]" + }, + { + "url": "207.png", + "alt": "[忧愁]" + }, + { + "url": "208.png", + "alt": "[眨眉]" + }, + { + "url": "209.png", + "alt": "[闭眼]" + }, + { + "url": "210.png", + "alt": "[鄙视]" + }, + { + "url": "211.png", + "alt": "[阴暗]" + }, + { + "url": "212.png", + "alt": "[小鬼]" + }, + { + "url": "213.png", + "alt": "[爱心1]" + }, + { + "url": "214.png", + "alt": "[拜佛]" + }, + { + "url": "215.png", + "alt": "[力量]" + }, + { + "url": "216.png", + "alt": "[金钱]" + }, + { + "url": "217.png", + "alt": "[蛋糕]" + }, + { + "url": "218.png", + "alt": "[彩带]" + }, + { + "url": "219.png", + "alt": "[礼物1]" + } + ] +] +const emojiList = [{ + "url": "100.gif", + "alt": "[微笑]" + }, + { + "url": "101.gif", + "alt": "[伤心]" + }, + { + "url": "102.gif", + "alt": "[美女]" + }, + { + "url": "103.gif", + "alt": "[发呆]" + }, + { + "url": "104.gif", + "alt": "[墨镜]" + }, + { + "url": "105.gif", + "alt": "[哭]" + }, + { + "url": "106.gif", + "alt": "[羞]" + }, + { + "url": "107.gif", + "alt": "[哑]" + }, + { + "url": "108.gif", + "alt": "[睡]" + }, + { + "url": "109.gif", + "alt": "[大哭]" + }, + { + "url": "110.gif", + "alt": "[囧]" + }, + { + "url": "111.gif", + "alt": "[怒]" + }, + { + "url": "112.gif", + "alt": "[调皮]" + }, + { + "url": "113.gif", + "alt": "[呲牙]" + }, + { + "url": "114.gif", + "alt": "[惊讶]" + }, + { + "url": "115.gif", + "alt": "[难过]" + }, + { + "url": "116.gif", + "alt": "[酷]" + }, + { + "url": "117.gif", + "alt": "[汗]" + }, + { + "url": "118.gif", + "alt": "[抓狂]" + }, + { + "url": "119.gif", + "alt": "[吐]" + }, + { + "url": "120.gif", + "alt": "[笑]" + }, + { + "url": "121.gif", + "alt": "[快乐]" + }, + { + "url": "122.gif", + "alt": "[疑惑]" + }, + { + "url": "123.gif", + "alt": "[傲]" + }, + { + "url": "124.gif", + "alt": "[饿]" + }, + { + "url": "125.gif", + "alt": "[累]" + }, + { + "url": "126.gif", + "alt": "[惊恐]" + }, + { + "url": "127.gif", + "alt": "[汗1]" + }, + { + "url": "128.gif", + "alt": "[高兴]" + }, + { + "url": "129.gif", + "alt": "[闲]" + }, + { + "url": "130.gif", + "alt": "[努力]" + }, + { + "url": "131.gif", + "alt": "[骂]" + }, + { + "url": "132.gif", + "alt": "[疑问]" + }, + { + "url": "133.gif", + "alt": "[秘密]" + }, + { + "url": "134.gif", + "alt": "[乱]" + }, + { + "url": "135.gif", + "alt": "[疯]" + }, + { + "url": "136.gif", + "alt": "[哀]" + }, + { + "url": "137.gif", + "alt": "[鬼]" + }, + { + "url": "138.gif", + "alt": "[打击]" + }, + { + "url": "139.gif", + "alt": "[bye]" + }, + { + "url": "140.gif", + "alt": "[擦汗]" + }, + { + "url": "141.gif", + "alt": "[抠]" + }, + { + "url": "142.gif", + "alt": "[鼓掌]" + }, + { + "url": "143.gif", + "alt": "[糟糕]" + }, + { + "url": "144.gif", + "alt": "[恶搞]" + }, + { + "url": "145.gif", + "alt": "[左哼哼]" + }, + { + "url": "146.gif", + "alt": "[右哼哼]" + }, + { + "url": "147.gif", + "alt": "[哈欠]" + }, + { + "url": "148.gif", + "alt": "[看]" + }, + { + "url": "149.gif", + "alt": "[委屈]" + }, + { + "url": "150.gif", + "alt": "[难过1]" + }, + { + "url": "151.gif", + "alt": "[坏]" + }, + { + "url": "152.gif", + "alt": "[亲]" + }, + { + "url": "153.gif", + "alt": "[吓]" + }, + { + "url": "154.gif", + "alt": "[可怜]" + }, + { + "url": "155.gif", + "alt": "[刀]" + }, + { + "url": "156.gif", + "alt": "[水果]" + }, + { + "url": "157.gif", + "alt": "[酒]" + }, + { + "url": "158.gif", + "alt": "[篮球]" + }, + { + "url": "159.gif", + "alt": "[乒乓]" + }, + { + "url": "160.gif", + "alt": "[咖啡]" + }, + { + "url": "161.gif", + "alt": "[美食]" + }, + { + "url": "162.gif", + "alt": "[动物]" + }, + { + "url": "163.gif", + "alt": "[鲜花]" + }, + { + "url": "164.gif", + "alt": "[枯]" + }, + { + "url": "165.gif", + "alt": "[唇]" + }, + { + "url": "166.gif", + "alt": "[爱]" + }, + { + "url": "167.gif", + "alt": "[分手]" + }, + { + "url": "168.gif", + "alt": "[生日]" + }, + { + "url": "169.gif", + "alt": "[电]" + }, + { + "url": "170.gif", + "alt": "[炸弹]" + }, + { + "url": "171.gif", + "alt": "[刀子]" + }, + { + "url": "172.gif", + "alt": "[足球]" + }, + { + "url": "173.gif", + "alt": "[瓢虫]" + }, + { + "url": "174.gif", + "alt": "[翔]" + }, + { + "url": "175.gif", + "alt": "[月亮]" + }, + { + "url": "176.gif", + "alt": "[太阳]" + }, + { + "url": "177.gif", + "alt": "[礼物]" + }, + { + "url": "178.gif", + "alt": "[抱抱]" + }, + { + "url": "179.gif", + "alt": "[拇指]" + }, + { + "url": "180.gif", + "alt": "[贬低]" + }, + { + "url": "181.gif", + "alt": "[握手]" + }, + { + "url": "182.gif", + "alt": "[剪刀手]" + }, + { + "url": "183.gif", + "alt": "[抱拳]" + }, + { + "url": "184.gif", + "alt": "[勾引]" + }, + { + "url": "185.gif", + "alt": "[拳头]" + }, + { + "url": "186.gif", + "alt": "[小拇指]" + }, + { + "url": "187.gif", + "alt": "[拇指八]" + }, + { + "url": "188.gif", + "alt": "[食指]" + }, + { + "url": "189.gif", + "alt": "[ok]" + }, + { + "url": "190.gif", + "alt": "[情侣]" + }, + { + "url": "191.gif", + "alt": "[爱心]" + }, + { + "url": "192.gif", + "alt": "[蹦哒]" + }, + { + "url": "193.gif", + "alt": "[颤抖]" + }, + { + "url": "194.gif", + "alt": "[怄气]" + }, + { + "url": "195.gif", + "alt": "[跳舞]" + }, + { + "url": "196.gif", + "alt": "[拜]" + }, + { + "url": "197.gif", + "alt": "[背着]" + }, + { + "url": "198.gif", + "alt": "[伸手]" + }, + { + "url": "199.gif", + "alt": "[耍帅]" + }, + { + "url": "200.png", + "alt": "[微笑1]" + }, + { + "url": "201.png", + "alt": "[生病]" + }, + { + "url": "202.png", + "alt": "[哭泣]" + }, + { + "url": "203.png", + "alt": "[吐舌]" + }, + { + "url": "204.png", + "alt": "[迷糊]" + }, + { + "url": "205.png", + "alt": "[瞪眼]" + }, + { + "url": "206.png", + "alt": "[恐怖]" + }, + { + "url": "207.png", + "alt": "[忧愁]" + }, + { + "url": "208.png", + "alt": "[眨眉]" + }, + { + "url": "209.png", + "alt": "[闭眼]" + }, + { + "url": "210.png", + "alt": "[鄙视]" + }, + { + "url": "211.png", + "alt": "[阴暗]" + }, + { + "url": "212.png", + "alt": "[小鬼]" + }, + { + "url": "213.png", + "alt": "[爱心1]" + }, + { + "url": "214.png", + "alt": "[拜佛]" + }, + { + "url": "215.png", + "alt": "[力量]" + }, + { + "url": "216.png", + "alt": "[金钱]" + }, + { + "url": "217.png", + "alt": "[蛋糕]" + }, + { + "url": "218.png", + "alt": "[彩带]" + }, + { + "url": "219.png", + "alt": "[礼物1]" + } +] + +const req = import.meta.glob('../static/emoji/*.*', { + eager: true +}) + +const imagesMap = {} + +// 循环所有图片,将图片名设置成键,值为导入该图片的地址 +for (const key in req) { + // let name = key.split('/').slice(-1)[0].split('.')[0] + let name = key.split('/').slice(-1)[0].replace('.', '') + // 抛出图片大对象后,文件页面直接引入后将图片的具体名称作为属性就能导入该图片 + imagesMap[name] = req[key].default +} + +export { + emojiList, + emojiTree, + imagesMap +} \ No newline at end of file diff --git a/pages/message/im/index.scss b/pages/message/im/index.scss new file mode 100644 index 0000000..fd7e6c6 --- /dev/null +++ b/pages/message/im/index.scss @@ -0,0 +1,606 @@ +@font-face { + font-family: "HMfont-home"; + src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAn8AAsAAAAAE1wAAAmvAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCFDAqWYJI9ATYCJANACyIABCAFhFUHgV8bThBRlFFWNdkXBXbDsSFQq221McNWrxUbYqGhiTju98MTeXqNh/9fo90388cEMe0bwSOJRIjavZIgESqnE5J5JqQVDZH/XdNfoHSAjqKqRsA+Tf/Ruya33E/bkdHsJtycY2XWAGbM5oenzf173A3lHrEilsmMbu74Y5VmYtxpgza9DMxkWL0gfjGbGRE54AL2f2ut3h2u8Q7RaZRCjDPLIv8cfAUR30MtEUWbSReVJkk0RB4lWWkNg7WVA1sBKmIUdr0uzibQOmxA4vrWwQXkJUweKHPfdwXkA+FSik2o1aVizyTegEKdvWINwGv59bEGY9GeTJFjW95pswIrzz3LYi//0O4JEaDrY3DZjxwXgUR8V3IfIeXARaloVRXT3mK/tsi3LubcJfese8l96Xbd1l1ve2z7eJp5lv3zB7URSdJNYd3Dfm7UUxxkGu0sLFcbVEa5pP3D6/QmokQw3OGzfJp/2kBkLJYQDYuziJbFJUSweIkoWXQRNYuEGFi0BLzFOhAjS4+InKUPRGI5I2a+kg7VSWUGoXoos2BNmGIWexwFroD8IUD6C1A9lYp8F3ClwsFgcgPdNpN08v1czkEOJ4aeieaC3QyVfb9PX2kbn9/0CwTeNAm79H1Kc2x3i9C7LcEZtMSLfE6T4aM+YWOm06dZ5cm9I+xoYw+rqGlScKKlHytu9h6Dw0E5nXK7nbTZknT1jFldR9cuzNMz9Srf7FydqpYW5mRr6Dq1OC9HqzYzoiw1cjohV2tX1Ji1K9bSdVkEbaxS1xQwpmpVpUFheyyzPyGdbXKHexkByib+vtgeK1X75xKqWl+grUNIbRZDXT31tBMiPZAyF0KmniCQhSgACkh5+gIxtvTS/si+VjbAuY6SMdCzbqInzwkjk5ENzMCkNv+ghQQ0qSSAUGmAMQoBozoAIrUe6qpzM+tma1T1jDgvVzdBWcIcLT170njGQU3cCpnUTSdkHH3ltwPHpKotTIP6HH12Lvd4czCWgbJYhY1U5ddlTCICSs1is0in8tXExk7VVRuMQhIQGgOtFcolPmMkIqDVduTGEOn1jI4gFERmSUsv3rGmoKUEQLITLUyzqpFukq8T6U+omVQsT8XHxsnipPEyBAlKNmkNMlMJgOT5Tpsoo2RGP3lOTQyk5GRBgJKw2WQsarWzSa1aLF/+UBk2PkA3wEkBM/RwOLJ0ORWiVCR3YYAAFyIlAdaNqEnmh0sTqOsAq97R85Jt+HGHrNKWgDHmxOPxumKmRGzudayPtogu9D2Zx688C3D6XJSgpgF6MJbomdtyOYBgcXOGSgMAPXqy+F11pMYHlFLCkkKM0S1T+U5SN0Ynh39SxcxmTPNHrTFIuieyxYgZXSDUAPpLLT2ZciVvihOh05k+JIAjoL7HtNsVFc5Rl+1hgAAIlNqGX3GEK0llMm0nZUdmhQzymg3Q9j6yO4FQsmqtQbXmZ+z+sOynUrt3nmbeXu3MYW9f8y38128LpWAVeyLMz4cTORbEDPYKHU19Oyx0OF12GIhfEx+/RRIm2RzPeIPE2yYRM7HBWBx+GvANWXAlMYcmWriz1/Tt2bk+jq7CdOzMu5zsn3zZXwg2Gu14YCBuh3NggN0DI8BbJpCXZb2I4xh+kdAmbU0IA6HYquya81nqYSk87Xgi35ur4HnxZWEvnoLrzbOEjHmJiY2JjV6I8c4ynSEsJTKcHxuWYPRFFleV2Sbi0Dsk4XmDSToXTMnUnW/PW9J9W4UCgP+h0rTi9tiJd6qQgk2lPI/KKeybAPx+c7vZHdimbruzyCP9iZvd0VuBuIniuXirHQ8oG2IThFIUI8QOhjfNMg86GH4Bv4ixLlr4BDi2wDDwXTYYTgfnBJur1nAw2yGngw96JhQo+48cMWVE8kWwcA55ZuzwkSP/mpp9D6wFm2e1Bc8cPVraL2Ng7y6KfSNHqQfTYByYMmbT73WNmwZs6m8sBR54XCndTHwvu6v+8N+Jze9/jeGd8bpoHePtMv0/9U6e78bTtf+aly55P40cNtJ3PH3U6xQ9DkRNos+Chp2TpNwX4lZOwkTa4nOLPxpMLc8Sm0srSwD6Y1KW7ftPZ68x3DWS8d4cJbAKE6QJEfRrhAafMLV0RoCRLhKdBaJzNtzPD7dxLIgZ7Al4006exyHEYXMewjqApFokPRIu9FvLiPf96uWlpuZmRZKiH1i0OCNj1ar7zSDqYiRbCQsMrKUXZswxBkQEbCmv2RJgKK82+UcGbpk+0woVSxekQrYCzp4Hk30E3oHhAh+4fLcOPCfzOVu3cvKkHAWzNAVyjAyOQsrJix47n0OZpbTUDKdJp8CZs+BkAKfMnDkF+kJmmrcN4OSZs8CRuwZ+N76gampCxtj83XWO5X1GYc7hIypq+N32eTe6Wr/GfXW5GukBLnvJ1gEPhlmsuUHzg3Osp/vJCZ4flGsFf27fjV18spjdTfQUuVANcgldRA3hKhSUutCGgGhDaMo0tXMHwiUq3gG5entO2xmnECa3H53AjRpKFFYIK7qrHjMJ75sEC91BPlGc0TlZY9qlsdcuZaXy0D3hfz4cmLd2WzbK3Xhhdw7c2VLCxtxsFCMEo8bArEww9ruOrc5joK9g1xp85MghQ4wyuPV71+/tMVxAMmzA1lSt+WmbjFkwL/lV6az7APzZ5qvVmmy7b1bJGrTDhmRfMBYbWMZmNOu3bJdPlLL/5WOR2XZCTJpmU4mx8lv9Fg76T8NagO4vUacJ+n/Sr0b/LYb8+1z5QCb935a0m6WWYXzwh4DO2Sa9g2jEnJ6tYwTU5jp7N2RmaHkn/gjEb/fXpmpXbkpAGaAv7pnKAfdc6bg4GZx1L3QuQ8lVC3BvXbC8f2eHQEqkBuc9aO6h9849M3oPucrgAyQY/HEv7PYJJQy23Ft3/R+xczqmsHWDgrDCyzfcl1o5ehKxnUOr5Bm6NhTGR4u1rtDEvlZ8dGgklLeNCk3ZbeKaO0bkcMfoKt+6ng/DUPPI6AAlDXlE0dzwsKPadkjqKjDXGEgg4b2CK7vx65M0xSlPmNsOA58/g1xWSDDKeq/KV5AR89+zc6OGjKSKtxUqR4NtF47VuMZemcTBDQxGqzqqrXIMCnm2xkXq1QJIIkO8EpmROcOkIyevYmhUqurWBmgCe4U5WJFHiiLKqKKOJtrooo8hxphihl6g5bGv3MAXkfBvPaFbVq6ga4Uq+wWdEfo6NVTmr1oVkYoye2NvfCWLmYQx0sjozFSxszhZ4Ctjb7QtavLQDNa0L5HRZQYJYxrNLbJR4QhZvOV46Fm/lqB428nsrJSx/OwbEgYA') format('woff2'); +} + +.icon { + font-family: "HMfont-home" !important; + font-size: 56rpx; + font-style: normal; + color: #333; + + &.biaoqing:before { + content: "\e797"; + } + + &.jianpan:before { + content: "\e7b2"; + } + + &.yuyin:before { + content: "\e805"; + } + + &.tupian:before { + content: "\e639"; + } + + &.chehui:before { + content: "\e904"; + } + + &.luyin:before { + content: "\e905"; + } + + &.luyin2:before { + content: "\e677"; + } + + &.other-voice:before { + content: "\e667"; + } + + &.my-voice:before { + content: "\e906"; + } + + &.hongbao:before { + content: "\e626"; + } + + &.tupian2:before { + content: "\e674"; + } + + &.paizhao:before { + content: "\e63e"; + } + + &.add:before { + content: "\e655"; + } + + &.close:before { + content: "\e607"; + } + + &.to:before { + content: "\e675"; + } +} + +page { + background-color: #f0f2f6; +} + +.im-v { + .notData-box { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + padding-top: 400rpx; + + .notData-inner { + width: 280rpx; + height: 308rpx; + align-items: center; + + + .iconImg { + width: 100%; + height: 100%; + } + + .notData-inner-text { + padding: 30rpx 0; + color: #909399; + } + } + } + .msg-end { + padding: 40rpx 0; + font-size: 28rpx; + text-align: center; + color: #999; + } + + .hidden { + display: none !important; + } + + .popup-layer { + &.showLayer { + transform: translate3d(0, -42vw, 0); + } + + transition: all .15s linear; + width: 100%; + height: 42vw; + padding: 20rpx 2%; + background-color: #f2f2f2; + position: fixed; + z-index: 20; + top: 100%; + + .emoji-swiper { + height: 40vw; + + swiper-item { + display: flex; + align-content: flex-start; + flex-wrap: wrap; + + .emoji-item { + width: 12vw; + height: 12vw; + display: flex; + justify-content: center; + align-items: center; + + .emoji-item-img { + width: 8.4vw; + height: 8.4vw; + } + } + } + } + + .more-layer { + width: 100%; + height: 42vw; + + .list { + width: 100%; + display: flex; + flex-wrap: wrap; + + .box { + width: 18vw; + height: 18vw; + border-radius: 20rpx; + background-color: #fff; + display: flex; + justify-content: center; + align-items: center; + margin: 0 3vw 2vw 3vw; + + .icon { + font-size: 70rpx; + } + } + } + } + } + + .input-box { + width: 100%; + box-sizing: border-box; + min-height: 80rpx; + padding: 24rpx 32rpx; + background-color: #f2f2f2; + display: flex; + align-items: flex-end; + position: fixed; + z-index: 20; + bottom: 0; + + &.showLayer { + transform: translate3d(0, -42vw, 0); + } + + transition: all .15s linear; + + .input-box-icon { + flex-shrink: 0; + height: 56rpx; + width: 56rpx; + margin-bottom: 6rpx; + margin-right: 16rpx; + + &.add { + margin-right: 0; + } + } + + .send-btn { + flex-shrink: 0; + width: 90rpx; + margin-bottom: 6rpx; + height: 56rpx; + line-height: 56rpx; + background: #339AFF; + color: #fff; + border-radius: 6rpx; + font-size: 24rpx; + text-align: center; + margin-left: 16rpx; + } + + .voice-mode { + flex: 1; + height: 68rpx; + border-radius: 16rpx; + display: flex; + justify-content: center; + align-items: center; + font-size: 28rpx; + background-color: #fff; + color: #555; + margin-right: 16rpx; + + &.recording { + background-color: #e5e5e5; + } + } + + .text-mode { + flex: 1; + min-height: 68rpx; + display: flex; + background-color: #fff; + border-radius: 16rpx; + margin-right: 16rpx; + + .input-area { + width: 100%; + padding: 16rpx; + display: flex; + align-items: center; + max-height: 100rpx; + overflow-y: scroll; + + textarea { + width: 100%; + font-size: 28rpx; + } + } + } + } + + .record { + width: 40vw; + height: 40vw; + position: fixed; + top: 55%; + left: 30%; + background-color: rgba(0, 0, 0, .6); + border-radius: 20rpx; + + .ing { + width: 100%; + height: 30vw; + display: flex; + justify-content: center; + align-items: center; + + // 模拟录音音效动画 + @keyframes volatility { + 0% { + background-position: 0% 130%; + } + + 20% { + background-position: 0% 150%; + } + + 30% { + background-position: 0% 155%; + } + + 40% { + background-position: 0% 150%; + } + + 50% { + background-position: 0% 145%; + } + + 70% { + background-position: 0% 150%; + } + + 80% { + background-position: 0% 155%; + } + + 90% { + background-position: 0% 140%; + } + + 100% { + background-position: 0% 135%; + } + } + + .icon { + background-image: linear-gradient(to bottom, #f09b37, #fff 50%); + background-size: 100% 200%; + animation: volatility 1.5s ease-in-out -1.5s infinite alternate; + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + font-size: 150rpx; + color: #f09b37; + } + } + + .cancel { + width: 100%; + height: 30vw; + display: flex; + justify-content: center; + align-items: center; + + .icon { + color: #fff; + font-size: 150rpx; + } + } + + .tis { + width: 100%; + height: 10vw; + display: flex; + justify-content: center; + font-size: 28rpx; + color: #fff; + + &.change { + color: #f09b37; + } + } + } + + .msg-list { + + padding: 0 24rpx; + .msg-list-item { + display: flex; + align-items: flex-start; + padding: 20rpx 0; + &.msg-list-item-l { + flex-direction: row; + + .avatar { + flex-shrink: 0; + width: 80rpx; + height: 80rpx; + margin-right: 20rpx; + } + } + &.msg-list-item-r { + flex-direction: row-reverse; + + .avatar { + flex-shrink: 0; + width: 80rpx; + height: 80rpx; + margin-left: 20rpx; + } + } + .msg-text { + max-width: 70%; + min-height: 50rpx; + border-radius: 4rpx 30rpx 30rpx 30rpx; + padding: 16rpx 32rpx; + display: flex; + align-items: center; + font-size: 32rpx; + word-break: break-word; + flex-wrap: wrap; + background-color: #fff; + color: #303133; + .msg-text-txt { + font-size: 32rpx; + line-height: 48rpx; + } + .msg-text-emoji { + vertical-align: top; + width: 48rpx; + height: 48rpx; + display: inline-block; + } + } + .msg-img { + background-color: transparent; + padding: 0; + overflow: hidden; + image { + max-width: 350rpx; + max-height: 350rpx; + border-radius: 16rpx; + } + } + .msg-voice { + .icon { + font-size: 40rpx; + display: flex; + align-items: center; + } + .icon:after { + content: " "; + width: 53rpx; + height: 53rpx; + border-radius: 100%; + position: absolute; + box-sizing: border-box; + } + .length { + font-size: 28rpx; + } + &.play { + @keyframes my-play { + 0% { + transform: translateX(80%); + } + + 100% { + transform: translateX(0%); + } + } + + .icon:after { + border-left: solid 10rpx rgba(186, 230, 253, .8); + animation: my-play 1s linear infinite; + } + } + } + } + // .msg-list-item { + // padding: 20rpx 0; + + // .content { + // width: 100%; + // display: flex; + + // .msg-text { + // max-width: 70%; + // min-height: 50rpx; + // border-radius: 4rpx 30rpx 30rpx 30rpx; + // padding: 16rpx 32rpx; + // display: flex; + // align-items: center; + // font-size: 32rpx; + // word-break: break-word; + // flex-wrap: wrap; + // background-color: #fff; + // color: #3A3A3A; + // .msg-text-txt{ + // font-size: 32rpx; + // line-height: 48rpx; + // } + // .msg-text-emoji{ + // vertical-align: top; + // width: 48rpx; + // height: 48rpx; + // display: inline-block; + // } + // } + + // .msg-img { + // background-color: transparent; + // padding: 0; + // overflow: hidden; + + // image { + // max-width: 350rpx; + // max-height: 350rpx; + // border-radius: 16rpx; + // } + // } + + // .msg-voice { + + // .icon { + // font-size: 40rpx; + // display: flex; + // align-items: center; + // } + + // .icon:after { + // content: " "; + // width: 53rpx; + // height: 53rpx; + // border-radius: 100%; + // position: absolute; + // box-sizing: border-box; + // } + + // .length { + // font-size: 28rpx; + // } + // } + // } + + // .avatar { + // // flex-shrink: 0; + // // width: 80rpx; + // // height: 80rpx; + // } + + // .my { + // display: flex; + // justify-content: flex-end; + + // .content { + // min-height: 80rpx; + // align-items: center; + // justify-content: flex-end; + + // .msg-text { + // background-color: #BAE6FD; + // border-radius: 30rpx 4rpx 30rpx 30rpx; + // } + + // .msg-voice { + // .length { + // margin-right: 20rpx; + // } + + // &.play { + // @keyframes my-play { + // 0% { + // transform: translateX(80%); + // } + + // 100% { + // transform: translateX(0%); + // } + // } + + // .icon:after { + // border-left: solid 10rpx rgba(186, 230, 253, .8); + // animation: my-play 1s linear infinite; + // } + // } + // } + // } + + // .avatar { + // margin-left: 16rpx; + // } + // } + + // .other { + // display: flex; + + // .avatar { + // margin-right: 16rpx; + // } + + // .content { + // flex-wrap: wrap; + + // .msg-voice { + // .icon { + // color: #333; + // } + + // .length { + // margin-left: 20rpx; + // } + + // &.play { + // @keyframes other-play { + // 0% { + // transform: translateX(-80%); + // } + + // 100% { + // transform: translateX(0%); + // } + // } + + // .icon:after { + // border-right: solid 10rpx rgba(255, 255, 255, .8); + + // animation: other-play 1s linear infinite; + // } + // } + // } + // } + // } + // } + } +} \ No newline at end of file diff --git a/pages/message/im/index.vue b/pages/message/im/index.vue new file mode 100644 index 0000000..97b088e --- /dev/null +++ b/pages/message/im/index.vue @@ -0,0 +1,588 @@ + + + + \ No newline at end of file diff --git a/pages/my/personalSetting/components/signList.vue b/pages/my/personalSetting/components/signList.vue new file mode 100644 index 0000000..bd0bfe1 --- /dev/null +++ b/pages/my/personalSetting/components/signList.vue @@ -0,0 +1,256 @@ + + + + \ No newline at end of file diff --git a/pages/my/personalSetting/index.vue b/pages/my/personalSetting/index.vue new file mode 100644 index 0000000..f5ca2e2 --- /dev/null +++ b/pages/my/personalSetting/index.vue @@ -0,0 +1,72 @@ + + + + + \ No newline at end of file diff --git a/pages/my/scanResult/index.vue b/pages/my/scanResult/index.vue new file mode 100644 index 0000000..ccdc8ee --- /dev/null +++ b/pages/my/scanResult/index.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/pages/my/settings/index.vue b/pages/my/settings/index.vue new file mode 100644 index 0000000..5123e94 --- /dev/null +++ b/pages/my/settings/index.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/pages/my/static/image/about-head.png b/pages/my/static/image/about-head.png new file mode 100644 index 0000000..ca83e68 Binary files /dev/null and b/pages/my/static/image/about-head.png differ diff --git a/pages/my/userDetail/index.vue b/pages/my/userDetail/index.vue new file mode 100644 index 0000000..9d8d074 --- /dev/null +++ b/pages/my/userDetail/index.vue @@ -0,0 +1,128 @@ + + + + + \ No newline at end of file diff --git a/pages/portal/applyPortal/index.vue b/pages/portal/applyPortal/index.vue new file mode 100644 index 0000000..79fde1e --- /dev/null +++ b/pages/portal/applyPortal/index.vue @@ -0,0 +1,107 @@ + + + + \ No newline at end of file diff --git a/pages/portal/components/HCard/index.vue b/pages/portal/components/HCard/index.vue new file mode 100644 index 0000000..80db2a3 --- /dev/null +++ b/pages/portal/components/HCard/index.vue @@ -0,0 +1,145 @@ + + + + + + \ No newline at end of file diff --git a/pages/portal/components/HCarousel/index.vue b/pages/portal/components/HCarousel/index.vue new file mode 100644 index 0000000..8eb611f --- /dev/null +++ b/pages/portal/components/HCarousel/index.vue @@ -0,0 +1,120 @@ + + + + \ No newline at end of file diff --git a/pages/portal/components/HCharts/charts.vue b/pages/portal/components/HCharts/charts.vue new file mode 100644 index 0000000..04c3723 --- /dev/null +++ b/pages/portal/components/HCharts/charts.vue @@ -0,0 +1,164 @@ + + + + + \ No newline at end of file diff --git a/pages/portal/components/HCharts/index.vue b/pages/portal/components/HCharts/index.vue new file mode 100644 index 0000000..41a480b --- /dev/null +++ b/pages/portal/components/HCharts/index.vue @@ -0,0 +1,37 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HCommonFunc/index.vue b/pages/portal/components/HCommonFunc/index.vue new file mode 100644 index 0000000..31b8475 --- /dev/null +++ b/pages/portal/components/HCommonFunc/index.vue @@ -0,0 +1,134 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HCustomeCharts/charts.vue b/pages/portal/components/HCustomeCharts/charts.vue new file mode 100644 index 0000000..8bef8b1 --- /dev/null +++ b/pages/portal/components/HCustomeCharts/charts.vue @@ -0,0 +1,120 @@ + + + + + \ No newline at end of file diff --git a/pages/portal/components/HCustomeCharts/index.vue b/pages/portal/components/HCustomeCharts/index.vue new file mode 100644 index 0000000..1e206ab --- /dev/null +++ b/pages/portal/components/HCustomeCharts/index.vue @@ -0,0 +1,66 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HDataBoard/index.vue b/pages/portal/components/HDataBoard/index.vue new file mode 100644 index 0000000..3f09714 --- /dev/null +++ b/pages/portal/components/HDataBoard/index.vue @@ -0,0 +1,172 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HEmail/index.vue b/pages/portal/components/HEmail/index.vue new file mode 100644 index 0000000..fca48b9 --- /dev/null +++ b/pages/portal/components/HEmail/index.vue @@ -0,0 +1,97 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HImage/index.vue b/pages/portal/components/HImage/index.vue new file mode 100644 index 0000000..c18b8ef --- /dev/null +++ b/pages/portal/components/HImage/index.vue @@ -0,0 +1,130 @@ + + + + + + \ No newline at end of file diff --git a/pages/portal/components/HNotice/index.vue b/pages/portal/components/HNotice/index.vue new file mode 100644 index 0000000..39402ba --- /dev/null +++ b/pages/portal/components/HNotice/index.vue @@ -0,0 +1,227 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HRankList/index.vue b/pages/portal/components/HRankList/index.vue new file mode 100644 index 0000000..8eae27c --- /dev/null +++ b/pages/portal/components/HRankList/index.vue @@ -0,0 +1,204 @@ + + + + + \ No newline at end of file diff --git a/pages/portal/components/HRankList/platform.vue b/pages/portal/components/HRankList/platform.vue new file mode 100644 index 0000000..654eb7a --- /dev/null +++ b/pages/portal/components/HRankList/platform.vue @@ -0,0 +1,233 @@ + + + + + \ No newline at end of file diff --git a/pages/portal/components/HTable/index.vue b/pages/portal/components/HTable/index.vue new file mode 100644 index 0000000..8d59e35 --- /dev/null +++ b/pages/portal/components/HTable/index.vue @@ -0,0 +1,127 @@ + + + + + + \ No newline at end of file diff --git a/pages/portal/components/HText/index.vue b/pages/portal/components/HText/index.vue new file mode 100644 index 0000000..3a36f55 --- /dev/null +++ b/pages/portal/components/HText/index.vue @@ -0,0 +1,150 @@ + + + + + + \ No newline at end of file diff --git a/pages/portal/components/HTimeAxis/index.vue b/pages/portal/components/HTimeAxis/index.vue new file mode 100644 index 0000000..8f50468 --- /dev/null +++ b/pages/portal/components/HTimeAxis/index.vue @@ -0,0 +1,188 @@ + + + + + + \ No newline at end of file diff --git a/pages/portal/components/HTimeAxis/timeLine-row.vue b/pages/portal/components/HTimeAxis/timeLine-row.vue new file mode 100644 index 0000000..c57d713 --- /dev/null +++ b/pages/portal/components/HTimeAxis/timeLine-row.vue @@ -0,0 +1,165 @@ + + + + + \ No newline at end of file diff --git a/pages/portal/components/HTodo/index.vue b/pages/portal/components/HTodo/index.vue new file mode 100644 index 0000000..dceb670 --- /dev/null +++ b/pages/portal/components/HTodo/index.vue @@ -0,0 +1,203 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HTodoList/index.vue b/pages/portal/components/HTodoList/index.vue new file mode 100644 index 0000000..ebb5e63 --- /dev/null +++ b/pages/portal/components/HTodoList/index.vue @@ -0,0 +1,137 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/HVideo/index.vue b/pages/portal/components/HVideo/index.vue new file mode 100644 index 0000000..a80c991 --- /dev/null +++ b/pages/portal/components/HVideo/index.vue @@ -0,0 +1,118 @@ + + + \ No newline at end of file diff --git a/pages/portal/components/chartsJs.js b/pages/portal/components/chartsJs.js new file mode 100644 index 0000000..65ab013 --- /dev/null +++ b/pages/portal/components/chartsJs.js @@ -0,0 +1,604 @@ +import jnpf from '@/utils/jnpf' +import { + geojson, + getAtlas +} from '@/api/portal/portal.js' +import { + getDataInterfaceRes +} from '@/api/common' +let timer; +export default { + data() { + return { + show: false, + mapData: [], + mapList: [], + mapType: '', + markPoints: [], + pointLoading: false, + opts: { + update: true, + fontSize: 10, + padding: [40, 15, 30, 15], + extra: { + map: { + mercator: true, + }, + }, + }, + regionStep: [], + stepMapList: [], + option: {} + } + }, + created() { + this.init() + if (this.config.dataType === 'dynamic') { + uni.$off('proRefresh') + uni.$on('proRefresh', () => { + this.handelChart() + }) + } + }, + methods: { + init() { + if (timer) clearInterval(timer) + this.handelChart() + if (!this.config.allRefresh.autoRefresh && this.config?.refresh?.autoRefresh) { + timer = setInterval(this.handelChart, this.config.refresh.autoRefreshTime * 60000) + } + }, + async handelChart() { + if (this.config.dataType === 'dynamic') { + if (!this.config.propsApi) return + const query = { + paramList: this.config.templateJson + }; + getDataInterfaceRes(this.config.propsApi, query).then(res => { + this.config.option.defaultValue = this.handleMappingConfig(res.data, this.config) + this.handleAttrs() + }) + } else { + this.handleAttrs() + } + }, + // 处理字段映射 + handleMappingConfig(resultData, config) { + let defaultValue = undefined + if (['rankList', 'barChart', 'pieChart', 'tableList'].includes(this.config.jnpfKey)) { + defaultValue = this.config.option.defaultValue || [] + } + let mappingConfig = config.mappingConfig + let result = [] + + resultData.length && resultData.forEach(data => { + let temp = {} + for (let item of mappingConfig) { + if (item.field === '系列') { + temp['type'] = item.value ? data[item.value] : data['type'] + } + if (item.field === '维度') { + temp['name'] = item.value ? data[item.value] : data['name'] + } + if (item.field === '数值') { + temp['value'] = item.value ? data[item.value] : data['value'] + } + if (item.field === '最大值') { + temp['max'] = item.value ? data[item.value] : data['max'] + } + if (item.field === '时间戳') { + temp['timestamp'] = item.value ? data[item.value] : data['timestamp'] + } + if (item.field === '经度') { + temp['long'] = item.value ? data[item.value] : data['long'] + } + if (item.field === '纬度') { + temp['lat'] = item.value ? data[item.value] : data['lat'] + } + } + result.push(temp) + }) + return result + }, + handleParam(e) { + let jnpfKey = this.config.jnpfKey + let item = {} + let choose = e.opts.series && e.opts.series[0] + let chooseIndex = e.currentIndex['index'] + let name = '' + let type = '' + let value = '' + if (jnpfKey === "barChart") { + name = e.opts.categories[chooseIndex] + value = choose.data[chooseIndex] + type = choose.name + } + if (jnpfKey === "pieChart") { + name = choose.name + value = choose.data + let series = this.option.chartData.series && this.option.chartData.series[0] + type = series.name + } + if (jnpfKey === "lineChart") { + name = e.opts.categories[chooseIndex] + value = choose.data[chooseIndex] + type = choose.name + } + if (jnpfKey === "radarChart") { + chooseIndex = e.currentIndex + name = e.opts.categories[chooseIndex] + value = choose.data[chooseIndex] + type = choose.name + } + if (jnpfKey === "mapChart" && choose.properties.childrenNum == 0) { + name = choose.properties.name + item.long = choose.properties.center[0] + item.lat = choose.properties.center[1] + } + if (chooseIndex < 0 && jnpfKey !== "mapChart") return + if (jnpfKey === "mapChart" && choose.properties.childrenNum != 0) return + item.name = name + item.value = value + item.type = type + item.urlAddress = this.config.option.urlAddress + this.jnpf.solveAddressParam(item, this.config) + this.jnpf.jumpLink(item.urlAddress) + }, + handleAttrs() { + let chartTitle = { + titleText: this.config.option.titleText, //主标题 + titleTextStyleColor: this.config.option.titleTextStyleColor, //主标题字体颜色 + titleTextStyleFontSize: this.config.option.titleTextStyleFontSize * 2 + 'rpx', //主标题字体大小[12-25px] + titleTextStyleFontWeight: this.config.option.titleTextStyleFontWeight ? 700 : 0, //主标题是否加粗 + titleLeft: this.config.option.titleLeft === 'left' ? 'flex-start' : this.config.option + .titleLeft === 'right' ? 'flex-end' : 'center', //主子标题位置[left,center,right] + titleBgColor: this.config.option.titleBgColor, //主子标题背景色[rgba(),#303133] + // 图表副标题设置 + titleSubtext: this.config.option.titleSubtext, //子标题 + titleSubtextStyleColor: this.config.option.titleSubtextStyleColor, //子标题字体颜色 + titleSubtextStyleFontSize: this.config.option.titleSubtextStyleFontSize * 2 + + 'rpx', //子标题字体大小[12-25px] + titleSubtextStyleFontWeight: this.config.option.titleSubtextStyleFontWeight ? 700 : 0, //子标题是否加粗 + } + let defVal = this.config.option.defaultValue + let chartVal = JSON.parse(JSON.stringify(defVal)) || [] + let typeArr = Array.from(new Set(chartVal.map((item) => item.type))) + let axisData = Array.from(new Set(chartVal.map((item) => item.name))) + let seriesData = [] + let colorList = []; + let chartsType = ""; + let Ymin = []; //y轴最小 + let Ymax = []; //y轴最大 + let type = ""; + let yAxis = {}; + let xAxis = {}; + if (!['mapChart', 'customEcharts'].includes(this.config.jnpfKey)) { + typeArr.forEach((title, index) => { + const type = this.getType(title, this.config) + let obj = { + name: title, + type: type + } + if (this.config.option.seriesLabelShow) { + obj.textSize = (this.config.option.seriesLabelFontSize / 2) < 12 ? 12 : this.config + .option + .seriesLabelFontSize / 2 + obj.textColor = this.config.option.seriesLabelColor + } + let chartArr = chartVal.filter((item) => title === item.type) + if (this.config.jnpfKey === 'barChart' || this.config.jnpfKey === 'lineChart' || this + .config + .jnpfKey == + 'radarChart') { + obj['data'] = chartArr.map((item) => item.value) + } else { + obj['data'] = chartArr.map((item) => { + return { + value: item.value, + name: item.name, + } + }) + if (this.config.option.showZero) obj['data'] = obj['data'].filter((item) => item + .value != 0) + this.key = +new Date + } + Ymin.push(Math.min(...obj['data'])) + Ymax.push(Math.max(...obj['data'])) + seriesData.push(obj); + }) + xAxis = { + disabled: !this.config.option.xAxisShow, //不绘制X轴 + axisLine: this.config.option.xAxisShow, //绘制坐标轴轴线 + axisLineColor: !this.config.option.xAxisShow ? '#fff' : this.config.option + .xAxisAxisLineLineStyleColor, //坐标轴轴线颜色,默认#CCCCCC + title: "", //X轴标题 + titleFontSize: this.config.option.xAxisNameTextStyleFontSize, //标题字体大小 + titleFontColor: this.config.option.xAxisNameTextStyleColor, //X轴名称字体颜色 + titleOffsetY: -20, //标题纵向偏移距离,负数为向上偏移,正数向下偏移 + titleOffsetX: -300, //标题横向偏移距离,负数为向左偏移,正数向右偏移 + fontSize: (this.config.option.xAxisAxisLabelTextStyleFontSize / 2) < 14 ? 14 : this.config + .option + .xAxisAxisLabelTextStyleFontSize / 2, //X轴标签字体大小 + fontColor: this.config.option.xAxisAxisLabelTextStyleColor, //X轴标签字体颜色 + rotateAngle: this.config.option.xAxisAxisLabelRotate, ////X轴标签角度 + rotateLabel: this.config.option.xAxisAxisLabelRotate > 0 ? true : false, //【旋转】数据点(刻度点)文字 + gridColor: this.config.option.xAxisSplitLineLineStyleColor, //纵向网格颜色,默认#CCCCCC + splitNumber: 4, //X轴网格数量,纵向网格数量(竖着的) + disableGrid: !this.config.option.xAxisShow ? !this.config.option.xAxisShow : !this.config + .option.xAxisSplitLineShow, //不绘制纵向网格(即默认绘制网格) + scrollShow: axisData.length > 5 ? true : false, //是否显示滚动条,配合拖拽滚动使用(即仅在启用 enableScroll 时有效 + scrollAlign: "left", //滚动条初始位置 + scrollColor: "#A6A6A6", //滚动条颜色,默认#A6A6A6 + scrollBackgroundColor: "#EFEBEF", //滚动条底部背景颜色,默认#EFEBEF + itemCount: axisData.length > 5 ? 6 : 5, //单屏数据密度即图表可视区域内显示的X轴数据点数量,仅在启用enableScroll时有效 + }; + yAxis = { + data: [{ + position: "left", + title: "", + min: this.config.option.styleType == 6 ? -jnpf.toRound(Math.abs(Math.min(... + Ymin) + .toString().length > 2 ? Math.min(...Ymin) - 200 : Math + .min( + ...Ymin) - 50)) : 0, + max: jnpf.toRound(Math.max(...Ymax)), + axisLine: true, //坐标轴轴线是否显示(数据还能显示) + axisLineColor: this.config.option + .yAxisAxisLineLineStyleColor, //坐标轴轴线颜色,默认#CCCCCC + disabled: !this.config.option.yAxisShow, //不绘制Y轴(刻度和轴线都不绘制) + fontColor: this.config.option + .yAxisAxisLabelTextStyleColor, //数据点(刻度点)字体颜色,默认#666666 + fontSize: (this.config.option.yAxisAxisLabelTextStyleFontSize / 2) < 12 ? 12 : this + .config + .option.yAxisAxisLabelTextStyleFontSize / 2, //数据点(刻度点)字体颜色,默认#666666 + }], + padding: 10, //多个Y轴间的间距 + gridSet: "number", //横向向网格数量类型设置,可选值,'auto','array' + disableGrid: !this.config.option.yAxisSplitLineShow, //不绘制横向向网格(即默认绘制网格) + splitNumber: 4, //【指定数量】的横向向网格数量,此数量与Y轴数据点是否为小数有关,如果指定了max,请指定为能被max-min整除的数值 + gridType: "solid", //横向向网格线型 + gridColor: this.config.option.yAxisSplitLineLineStyleColor, //横向网格颜色,默认#CCCCCC + }; + this.config.option.colorList.forEach((o, i) => { + if (o.color1) colorList.push(o.color1) + }) + } + let opts = { + color: colorList, //主题颜色,16进制颜色格式,Array格式 + padding: [15, 15, 0, 15], //画布填充边距[上,右,下,左],Array格式 + enableScroll: axisData.length > 5 ? true : + false, //开启图表可拖拽滚动,开启后ontouch需要赋值为true,X轴配置里需要配置itemCount单屏幕数据点数量 + dataLabel: this.config.option.seriesLabelShow, //是否显示图表区域内数据点上方的数据文案 + legend: { + fontColor: this.config.jnpfKey === 'pieChart' ? "#666666" : "", + show: this.config.option.legendShow, //是否显示图例标识 + position: 'top', + float: 'right', + fontSize: (this.config.option.legendTextStyleFontSize / 2) < 14 ? 14 : this.config.option + .legendTextStyleFontSize / 2 + }, + extra: { + tooltip: { + showBox: this.config.option.tooltipShow, //提示语显示 + fontSize: (this.config.option.tooltipTextStyleFontSize / 2) < 14 ? 14 : this.config + .option + .tooltipTextStyleFontSize / 2, //提示语字体大小 + fontColor: this.config.option.tooltipTextStyleColor, //提示语字体颜色 + bgColor: this.config.option.tooltipBgColor || '#000000' //提示窗口的背景颜色 + }, + mix: { + column: {} + }, + column: { + type: 'group', + width: this.config.option.seriesBarWidth, //柱体宽度 + activeBgColor: "#000000", + activeBgOpacity: 0.08, + linearType: "none", + barBorderRadius: [this.config.option.seriesItemStyleBarBorderRadius, this.config.option + .seriesItemStyleBarBorderRadius, this.config.option + .seriesItemStyleBarBorderRadius, + this.config.option.seriesItemStyleBarBorderRadius + ], //自定义4个圆角半径[左上,右上,右下,左下] + seriesGap: 5, //多series每个柱子之间的间距 + customColor: colorList, //扩展渐变色 + barBorderCircle: false + } + } + } + if (this.config.jnpfKey === 'barChart') { + if (this.config.option.styleType == 5 || this.config.option.styleType == 1 || + this.config.option.styleType == 4 || this.config.option.styleType == 6) { + type = 'group' + if (this.config.option.styleType == 6) { + opts.extra.column.barBorderRadius = [] + + // opts.extra.column.width = 50 + // yAxis.splitNumber = (yAxis.data[0].max / 500) + (Math.abs(yAxis.data[0].min) / 500) + } + } else { + type = 'stack' + opts.extra.mix.column = { + width: this.config.option.seriesBarWidth, //柱体宽度 + barBorderCircle: false, //启用分组柱状图半圆边框 + barBorderRadius: [this.config.option.seriesItemStyleBarBorderRadius, this.config.option + .seriesItemStyleBarBorderRadius, this.config.option + .seriesItemStyleBarBorderRadius, + this.config.option.seriesItemStyleBarBorderRadius + ], //自定义4个圆角半径[左上,右上,右下,左下] + } + } + chartsType = this.config.option.styleType == 7 ? 'mix' : 'column' + opts.xAxis = { + ...xAxis + } + opts.yAxis = { + ...yAxis + } + opts.extra.column.type = type + } else if (this.config.jnpfKey === "pieChart") { + chartsType = 'pie' + opts.fontColor = this.config.option.seriesLabelColor + opts.fontSize = (this.config.option.seriesLabelFontSize / 2) < 14 ? 14 : this.config.option + .seriesLabelFontSize / 2 + let pieChartObj = { + borderColor: "#FFFFFF", + borderWidth: 3, + activeOpacity: 0.5, + offsetAngle: -90, + labelWidth: 15, + border: false, + } + let pieChartObj2 = { + offsetX: 0, + offsetY: 0, + name: "", + } + if (this.config.option.styleType == 1) { + if (this.config.option.roseType) chartsType = 'rose' + opts.extra[chartsType] = { + ...pieChartObj + } + } else { + chartsType = 'ring'; + opts.title = { + fontSize: 15, + color: "#666666", + ...pieChartObj2 + }; + opts.subtitle = { + fontSize: 25, + color: "#7cb5ec", + ...pieChartObj2 + } + opts.extra[chartsType] = { + ringWidth: 60, + activeRadius: 10, + ...pieChartObj + } + } + } else if (this.config.jnpfKey === "lineChart") { + chartsType = this.config.option.areaStyle ? 'area' : 'line' + type = this.config.option.styleType == 2 ? 'curve' : this.config.option.styleType == 3 ? 'step' : + 'straight' + let lineChartObj = { + type: type, + width: this.config.option.seriesLineStyleWidth + } + opts.extra[chartsType] = { + ...lineChartObj + } + opts.xAxis = { + ...xAxis + } + opts.yAxis = { + ...yAxis + } + } else if (this.config.jnpfKey === "radarChart") { + chartsType = "radar"; + type = this.config.option.styleType == 1 ? chartsType : 'circle' + opts.fontSize = (this.config.option.radarAxisNameFontSize / 2) < 14 ? 14 : this.config.option + .radarAxisNameFontSize / 2 + opts.fontColor = this.config.option.seriesLabelColor + opts.extra[chartsType] = { + gridType: type, + gridColor: "#CCCCCC", + gridCount: 5, + opacity: 0.2, + max: 200, + labelShow: true, + border: true, + max: 100, + labelColor: this.config.option.radarAxisNameColor + } + } else { + this.getAtlas() + chartsType = "map"; + this.config.option.markPoints = [] + opts = { + update: true, + fontSize: this.config.option.geoLabelFontSize, + padding: [15, 15, 30, 15], + dataLabel: this.config.option.geoLabelShow, + fontColor: this.config.option.geoLabelColor, + extra: { + tooltip: { + showBox: this.config.option.tooltipShow, + fontColor: this.config.option.tooltipTextStyleColor || '#000', + //fontSize: this.config.option.tooltipTextStyleFontSize, + bgColor: this.config.option.tooltipBgColor || '#fff', + bgOpacity: 1 + }, + map: { + mercator: false, + border: true, + borderWidth: this.config.option.geoBorderWidth / 2, + borderColor: this.config.option.geoBorderColor, + activeBorderColor: "#F04864", + activeFillColor: "#FACC14", + activeFillOpacity: 1, + active: true, + activeTextColor: "#FFFFFF", + fillOpacity: 1 + }, + }, + } + this.config.option.defaultValue.forEach(o => { + this.config.option.markPoints.push({ + latitude: o.lat, + longitude: o.long, + name: o.name, + value: o.value + }) + }) + } + let chartData = { + categories: axisData, + series: seriesData, + opts, + type: chartsType + } + if (chartsType != 'map') { + if (chartTitle.titleText && chartTitle.titleSubtext) { + chartData.opts.legend.padding = 50 + } else if (chartTitle.titleText && !chartTitle.titleSubtext) { + chartData.opts.legend.padding = 30 + } else { + chartData.opts.legend.padding = 5 + } + } + this.config.option.chartData = chartData + this.config.option.chartTitle = chartTitle + this.option = this.config.option + this.$nextTick(() => { + this.show = true + this.key = +new Date() + }) + }, + /* 获取地图树 */ + getAtlas() { + getAtlas().then(res => { + this.mapList = jnpf.treeToArray(res.data); + this.regionStep = [] + this.drawChina() + }) + }, + /* 获取地图数据 */ + drawChina(type) { + if (Array.isArray(this.option.mapType) && !type) this.mapType = this.option.mapType[this.option.mapType + .length - 1] + geojson(this.mapType).then(res => { + let series = JSON.parse(JSON.stringify(res.data.features)) || []; + for (var i = 0; i < series.length; i++) { + if (series[i].geometry.type === 'Polygon' && !type) { + if (this.mapType == 150000) { + series[i].geometry.coordinates = series[i].geometry.coordinates + } else { + series[i].geometry.coordinates = [series[i].geometry.coordinates] + } + } + series[i].value = Math.floor(Math.random() * 1000) + series[i].color = this.option.geoAreaColor + } + this.mapData = series + this.stepMapList.push(this.mapData) + this.option.chartData.series = series + this.key = +new Date() + }) + }, + /* 地图点击路径 */ + regionStepClick(e, index) { + if (index == 0) { + this.stepMapList = [] + this.regionStep = [] + for (let i = 0; i < this.mapList.length; i++) { + if (this.mapList[i].enCode == this.option.mapType[this.option.mapType.length - 1]) { + this.regionStep.push({ + name: this.mapList[i].fullName, + adcode: this.mapList[i].enCode + }) + } + } + this.drawChina() + return + } + this.mapType = e.adcode + this.stepMapList.splice(index + 1, this.regionStep.length - index - 1) + this.regionStep.splice(index + 1, this.regionStep.length - index - 1) + this.drawChina(1) + }, + /* 地图点击 */ + getIndex(e) { + // 处理跳转参数 + this.handleParam(e) + let current = this.mapList.filter(o => o.enCode == this.option.mapType[this.option.mapType.length - 1]) + if (!this.config.option.drillDown) return + let mapData = this.mapData[e.currentIndex] ? this.mapData[e.currentIndex] : [] + this.mapType = mapData.properties.adcode + let acroutes = mapData.properties.acroutes + let selectName = mapData.properties.name + let adcode = mapData.properties.adcode + this.regionStep.unshift({ + name: current[0].fullName, + adcode: current[0].enCode + }) + this.regionStep.push({ + name: selectName, + adcode: adcode + }) + //对象数组去重 + this.regionStep = this.regionStep.filter((a, b, c) => { + return c.findIndex(x => x.name === a.name) === b + }) + this.pointLoading = false + this.drawChina(1) + }, + getType(title) { + if (this.config.jnpfKey == 'barChart') { + if (this.config.option.styleType == 7) { + const arr = this.config.option.barType.find(ele => title == ele.title) + if (arr && arr.type) { + if (arr.type == 'bar') return 'column' + return arr.type + } + } + return 'column' + } else if (this.config.jnpfKey == 'lineChart') { + return 'line' + } else if (this.config.jnpfKey == 'pieChart') { + return 'pie' + } else { + return 'radar' + } + }, + /* 设置地图点 */ + setPoints(e) { + const mapData = e.opts.chartData.mapData; + this.option.markPoints = this.option.markPoints.slice(0, this.option.appShowNumber) + for (var i = 0; i < this.option.markPoints.length; i++) { + const points = this.coordinateToPoint(this.option.markPoints[i].longitude, this.option.markPoints[i] + .latitude, mapData + .bounds, + mapData.scale, mapData.xoffset, mapData.yoffset, mapData.mercator) + this.option.markPoints[i].x = points.x; + this.option.markPoints[i].y = points.y; + } + this.pointLoading = true + this.$refs.charts.key = +new Date(); + }, + /* 经纬度转画布坐标 */ + coordinateToPoint(longitude, latitude, bounds, scale, xoffset, yoffset, mercator) { + var x = longitude; + var y = latitude; + if (mercator == true) { + x = longitude * 20037508.34 / 130; + y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180); + y = y * 20037508.34 / 180; + } + return { + x: (x - bounds.xMin) * scale + xoffset, + y: (bounds.yMax - y) * scale + yoffset + }; + } + } +} \ No newline at end of file diff --git a/pages/portal/components/defaultPortal.vue b/pages/portal/components/defaultPortal.vue new file mode 100644 index 0000000..0cb2ef6 --- /dev/null +++ b/pages/portal/components/defaultPortal.vue @@ -0,0 +1,506 @@ + + + + \ No newline at end of file diff --git a/pages/portal/components/index.vue b/pages/portal/components/index.vue new file mode 100644 index 0000000..371dc3e --- /dev/null +++ b/pages/portal/components/index.vue @@ -0,0 +1,327 @@ + + + + \ No newline at end of file diff --git a/pages/portal/mpPortal/index.vue b/pages/portal/mpPortal/index.vue new file mode 100644 index 0000000..8c8ff1e --- /dev/null +++ b/pages/portal/mpPortal/index.vue @@ -0,0 +1,381 @@ + + + + \ No newline at end of file diff --git a/pages/portal/scanPortal/index.vue b/pages/portal/scanPortal/index.vue new file mode 100644 index 0000000..35affc4 --- /dev/null +++ b/pages/portal/scanPortal/index.vue @@ -0,0 +1,145 @@ + + + + \ No newline at end of file diff --git a/pages/portal/static/image/1.png b/pages/portal/static/image/1.png new file mode 100644 index 0000000..7e3a797 Binary files /dev/null and b/pages/portal/static/image/1.png differ diff --git a/pages/portal/static/image/2.png b/pages/portal/static/image/2.png new file mode 100644 index 0000000..13ae2a8 Binary files /dev/null and b/pages/portal/static/image/2.png differ diff --git a/pages/portal/static/image/3.png b/pages/portal/static/image/3.png new file mode 100644 index 0000000..0f0250e Binary files /dev/null and b/pages/portal/static/image/3.png differ diff --git a/pages/portal/static/image/5.png b/pages/portal/static/image/5.png new file mode 100644 index 0000000..bc2b298 Binary files /dev/null and b/pages/portal/static/image/5.png differ diff --git a/pages/portal/static/image/champion.png b/pages/portal/static/image/champion.png new file mode 100644 index 0000000..740ae87 Binary files /dev/null and b/pages/portal/static/image/champion.png differ diff --git a/pages/portal/static/image/champion2.png b/pages/portal/static/image/champion2.png new file mode 100644 index 0000000..ffc00bb Binary files /dev/null and b/pages/portal/static/image/champion2.png differ diff --git a/pages/portal/static/image/gg.png b/pages/portal/static/image/gg.png new file mode 100644 index 0000000..b0ca739 Binary files /dev/null and b/pages/portal/static/image/gg.png differ diff --git a/pages/portal/static/image/medal0.png b/pages/portal/static/image/medal0.png new file mode 100644 index 0000000..abd1905 Binary files /dev/null and b/pages/portal/static/image/medal0.png differ diff --git a/pages/portal/static/image/medal1.png b/pages/portal/static/image/medal1.png new file mode 100644 index 0000000..8b4b78c Binary files /dev/null and b/pages/portal/static/image/medal1.png differ diff --git a/pages/portal/static/image/medal2.png b/pages/portal/static/image/medal2.png new file mode 100644 index 0000000..879734b Binary files /dev/null and b/pages/portal/static/image/medal2.png differ diff --git a/pages/portal/static/image/ordinary0.png b/pages/portal/static/image/ordinary0.png new file mode 100644 index 0000000..ed971c5 Binary files /dev/null and b/pages/portal/static/image/ordinary0.png differ diff --git a/pages/portal/static/image/ordinary1.png b/pages/portal/static/image/ordinary1.png new file mode 100644 index 0000000..a9bc110 Binary files /dev/null and b/pages/portal/static/image/ordinary1.png differ diff --git a/pages/portal/static/image/ordinary2.png b/pages/portal/static/image/ordinary2.png new file mode 100644 index 0000000..1c1a708 Binary files /dev/null and b/pages/portal/static/image/ordinary2.png differ diff --git a/pages/portal/static/image/portal-nodata.png b/pages/portal/static/image/portal-nodata.png new file mode 100644 index 0000000..aa31321 Binary files /dev/null and b/pages/portal/static/image/portal-nodata.png differ diff --git a/pages/portal/static/image/runnerUp.png b/pages/portal/static/image/runnerUp.png new file mode 100644 index 0000000..11388d2 Binary files /dev/null and b/pages/portal/static/image/runnerUp.png differ diff --git a/pages/portal/static/image/runnerUp2.png b/pages/portal/static/image/runnerUp2.png new file mode 100644 index 0000000..e9b4b82 Binary files /dev/null and b/pages/portal/static/image/runnerUp2.png differ diff --git a/pages/portal/static/image/thirdPlace.png b/pages/portal/static/image/thirdPlace.png new file mode 100644 index 0000000..9ed1e4a Binary files /dev/null and b/pages/portal/static/image/thirdPlace.png differ diff --git a/pages/portal/static/image/thirdPlace3.png b/pages/portal/static/image/thirdPlace3.png new file mode 100644 index 0000000..44e7edc Binary files /dev/null and b/pages/portal/static/image/thirdPlace3.png differ diff --git a/pages/portal/static/image/tz.png b/pages/portal/static/image/tz.png new file mode 100644 index 0000000..8011c62 Binary files /dev/null and b/pages/portal/static/image/tz.png differ diff --git a/pages/portal/static/quill-1.3.7.min.js b/pages/portal/static/quill-1.3.7.min.js new file mode 100644 index 0000000..8596d6a --- /dev/null +++ b/pages/portal/static/quill-1.3.7.min.js @@ -0,0 +1,7 @@ +/*! + * Quill Editor v1.3.7 + * https://quilljs.com/ + * Copyright (c) 2014, Jason Chen + * Copyright (c) 2013, salesforce.com + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Quill=e():t.Quill=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=45)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),o=n(18),i=n(19),l=n(48),a=n(49),s=n(50),u=n(51),c=n(52),f=n(11),h=n(29),p=n(30),d=n(28),y=n(1),v={Scope:y.Scope,create:y.create,find:y.find,query:y.query,register:y.register,Container:r.default,Format:o.default,Leaf:i.default,Embed:u.default,Scroll:l.default,Block:s.default,Inline:a.default,Text:c.default,Attributor:{Attribute:f.default,Class:h.default,Style:p.default,Store:d.default}};e.default=v},function(t,e,n){"use strict";function r(t,e){var n=i(t);if(null==n)throw new s("Unable to create "+t+" blot");var r=n;return new r(t instanceof Node||t.nodeType===Node.TEXT_NODE?t:r.create(e),e)}function o(t,n){return void 0===n&&(n=!1),null==t?null:null!=t[e.DATA_KEY]?t[e.DATA_KEY].blot:n?o(t.parentNode,n):null}function i(t,e){void 0===e&&(e=p.ANY);var n;if("string"==typeof t)n=h[t]||u[t];else if(t instanceof Text||t.nodeType===Node.TEXT_NODE)n=h.text;else if("number"==typeof t)t&p.LEVEL&p.BLOCK?n=h.block:t&p.LEVEL&p.INLINE&&(n=h.inline);else if(t instanceof HTMLElement){var r=(t.getAttribute("class")||"").split(/\s+/);for(var o in r)if(n=c[r[o]])break;n=n||f[t.tagName]}return null==n?null:e&p.LEVEL&n.scope&&e&p.TYPE&n.scope?n:null}function l(){for(var t=[],e=0;e1)return t.map(function(t){return l(t)});var n=t[0];if("string"!=typeof n.blotName&&"string"!=typeof n.attrName)throw new s("Invalid definition");if("abstract"===n.blotName)throw new s("Cannot register abstract class");if(h[n.blotName||n.attrName]=n,"string"==typeof n.keyName)u[n.keyName]=n;else if(null!=n.className&&(c[n.className]=n),null!=n.tagName){Array.isArray(n.tagName)?n.tagName=n.tagName.map(function(t){return t.toUpperCase()}):n.tagName=n.tagName.toUpperCase();var r=Array.isArray(n.tagName)?n.tagName:[n.tagName];r.forEach(function(t){null!=f[t]&&null!=n.className||(f[t]=n)})}return n}var a=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(e){var n=this;return e="[Parchment] "+e,n=t.call(this,e)||this,n.message=e,n.name=n.constructor.name,n}return a(e,t),e}(Error);e.ParchmentError=s;var u={},c={},f={},h={};e.DATA_KEY="__blot";var p;!function(t){t[t.TYPE=3]="TYPE",t[t.LEVEL=12]="LEVEL",t[t.ATTRIBUTE=13]="ATTRIBUTE",t[t.BLOT=14]="BLOT",t[t.INLINE=7]="INLINE",t[t.BLOCK=11]="BLOCK",t[t.BLOCK_BLOT=10]="BLOCK_BLOT",t[t.INLINE_BLOT=6]="INLINE_BLOT",t[t.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",t[t.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",t[t.ANY=15]="ANY"}(p=e.Scope||(e.Scope={})),e.create=r,e.find=o,e.query=i,e.register=l},function(t,e){"use strict";var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===r.call(t)},a=function(t){if(!t||"[object Object]"!==r.call(t))return!1;var e=n.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&n.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!e&&!o)return!1;var i;for(i in t);return void 0===i||n.call(t,i)},s=function(t,e){o&&"__proto__"===e.name?o(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},u=function(t,e){if("__proto__"===e){if(!n.call(t,e))return;if(i)return i(t,e).value}return t[e]};t.exports=function t(){var e,n,r,o,i,c,f=arguments[0],h=1,p=arguments.length,d=!1;for("boolean"==typeof f&&(d=f,f=arguments[1]||{},h=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});h1&&void 0!==arguments[1]?arguments[1]:{};return null==t?e:("function"==typeof t.formats&&(e=(0,f.default)(e,t.formats())),null==t.parent||"scroll"==t.parent.blotName||t.parent.statics.scope!==t.statics.scope?e:a(t.parent,e))}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BlockEmbed=e.bubbleFormats=void 0;var s=function(){function t(t,e){for(var n=0;n0&&(t1&&void 0!==arguments[1]&&arguments[1];if(n&&(0===t||t>=this.length()-1)){var r=this.clone();return 0===t?(this.parent.insertBefore(r,this),this):(this.parent.insertBefore(r,this.next),r)}var o=u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"split",this).call(this,t,n);return this.cache={},o}}]),e}(y.default.Block);x.blotName="block",x.tagName="P",x.defaultChild="break",x.allowedChildren=[m.default,y.default.Embed,O.default],e.bubbleFormats=a,e.BlockEmbed=w,e.default=x},function(t,e,n){var r=n(54),o=n(12),i=n(2),l=n(20),a=String.fromCharCode(0),s=function(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]};s.prototype.insert=function(t,e){var n={};return 0===t.length?this:(n.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))},s.prototype.delete=function(t){return t<=0?this:this.push({delete:t})},s.prototype.retain=function(t,e){if(t<=0)return this;var n={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)},s.prototype.push=function(t){var e=this.ops.length,n=this.ops[e-1];if(t=i(!0,{},t),"object"==typeof n){if("number"==typeof t.delete&&"number"==typeof n.delete)return this.ops[e-1]={delete:n.delete+t.delete},this;if("number"==typeof n.delete&&null!=t.insert&&(e-=1,"object"!=typeof(n=this.ops[e-1])))return this.ops.unshift(t),this;if(o(t.attributes,n.attributes)){if("string"==typeof t.insert&&"string"==typeof n.insert)return this.ops[e-1]={insert:n.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof n.retain)return this.ops[e-1]={retain:n.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this},s.prototype.chop=function(){var t=this.ops[this.ops.length-1];return t&&t.retain&&!t.attributes&&this.ops.pop(),this},s.prototype.filter=function(t){return this.ops.filter(t)},s.prototype.forEach=function(t){this.ops.forEach(t)},s.prototype.map=function(t){return this.ops.map(t)},s.prototype.partition=function(t){var e=[],n=[];return this.forEach(function(r){(t(r)?e:n).push(r)}),[e,n]},s.prototype.reduce=function(t,e){return this.ops.reduce(t,e)},s.prototype.changeLength=function(){return this.reduce(function(t,e){return e.insert?t+l.length(e):e.delete?t-e.delete:t},0)},s.prototype.length=function(){return this.reduce(function(t,e){return t+l.length(e)},0)},s.prototype.slice=function(t,e){t=t||0,"number"!=typeof e&&(e=1/0);for(var n=[],r=l.iterator(this.ops),o=0;o0&&n.next(i.retain-a)}for(var u=new s(r);e.hasNext()||n.hasNext();)if("insert"===n.peekType())u.push(n.next());else if("delete"===e.peekType())u.push(e.next());else{var c=Math.min(e.peekLength(),n.peekLength()),f=e.next(c),h=n.next(c);if("number"==typeof h.retain){var p={};"number"==typeof f.retain?p.retain=c:p.insert=f.insert;var d=l.attributes.compose(f.attributes,h.attributes,"number"==typeof f.retain);if(d&&(p.attributes=d),u.push(p),!n.hasNext()&&o(u.ops[u.ops.length-1],p)){var y=new s(e.rest());return u.concat(y).chop()}}else"number"==typeof h.delete&&"number"==typeof f.retain&&u.push(h)}return u.chop()},s.prototype.concat=function(t){var e=new s(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e},s.prototype.diff=function(t,e){if(this.ops===t.ops)return new s;var n=[this,t].map(function(e){return e.map(function(n){if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;var r=e===t?"on":"with";throw new Error("diff() called "+r+" non-document")}).join("")}),i=new s,u=r(n[0],n[1],e),c=l.iterator(this.ops),f=l.iterator(t.ops);return u.forEach(function(t){for(var e=t[1].length;e>0;){var n=0;switch(t[0]){case r.INSERT:n=Math.min(f.peekLength(),e),i.push(f.next(n));break;case r.DELETE:n=Math.min(e,c.peekLength()),c.next(n),i.delete(n);break;case r.EQUAL:n=Math.min(c.peekLength(),f.peekLength(),e);var a=c.next(n),s=f.next(n);o(a.insert,s.insert)?i.retain(n,l.attributes.diff(a.attributes,s.attributes)):i.push(s).delete(n)}e-=n}}),i.chop()},s.prototype.eachLine=function(t,e){e=e||"\n";for(var n=l.iterator(this.ops),r=new s,o=0;n.hasNext();){if("insert"!==n.peekType())return;var i=n.peek(),a=l.length(i)-n.peekLength(),u="string"==typeof i.insert?i.insert.indexOf(e,a)-a:-1;if(u<0)r.push(n.next());else if(u>0)r.push(n.next(u));else{if(!1===t(r,n.next(1).attributes||{},o))return;o+=1,r=new s}}r.length()>0&&t(r,{},o)},s.prototype.transform=function(t,e){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);for(var n=l.iterator(this.ops),r=l.iterator(t.ops),o=new s;n.hasNext()||r.hasNext();)if("insert"!==n.peekType()||!e&&"insert"===r.peekType())if("insert"===r.peekType())o.push(r.next());else{var i=Math.min(n.peekLength(),r.peekLength()),a=n.next(i),u=r.next(i);if(a.delete)continue;u.delete?o.push(u):o.retain(i,l.attributes.transform(a.attributes,u.attributes,e))}else o.retain(l.length(n.next()));return o.chop()},s.prototype.transformPosition=function(t,e){e=!!e;for(var n=l.iterator(this.ops),r=0;n.hasNext()&&r<=t;){var o=n.peekLength(),i=n.peekType();n.next(),"delete"!==i?("insert"===i&&(r0){var n=this.parent.isolate(this.offset(),this.length());this.moveChildren(n),n.wrap(this)}}}],[{key:"compare",value:function(t,n){var r=e.order.indexOf(t),o=e.order.indexOf(n);return r>=0||o>=0?r-o:t===n?0:t0){var a,s=[g.default.events.TEXT_CHANGE,l,i,e];if((a=this.emitter).emit.apply(a,[g.default.events.EDITOR_CHANGE].concat(s)),e!==g.default.sources.SILENT){var c;(c=this.emitter).emit.apply(c,s)}}return l}function s(t,e,n,r,o){var i={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(o=r,r=n,n=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(o=r,r=n,n=e,e=0),"object"===(void 0===n?"undefined":c(n))?(i=n,o=r):"string"==typeof n&&(null!=r?i[n]=r:o=n),o=o||g.default.sources.API,[t,e,i,o]}function u(t,e,n,r){if(null==t)return null;var o=void 0,i=void 0;if(e instanceof d.default){var l=[t.index,t.index+t.length].map(function(t){return e.transformPosition(t,r!==g.default.sources.USER)}),a=f(l,2);o=a[0],i=a[1]}else{var s=[t.index,t.index+t.length].map(function(t){return t=0?t+n:Math.max(e,t+n)}),u=f(s,2);o=u[0],i=u[1]}return new x.Range(o,i-o)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.overload=e.expandConfig=void 0;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(i(this,t),this.options=l(e,r),this.container=this.options.container,null==this.container)return P.error("Invalid Quill container",e);this.options.debug&&t.debug(this.options.debug);var o=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new g.default,this.scroll=w.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new v.default(this.scroll),this.selection=new k.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(g.default.events.EDITOR_CHANGE,function(t){t===g.default.events.TEXT_CHANGE&&n.root.classList.toggle("ql-blank",n.editor.isBlank())}),this.emitter.on(g.default.events.SCROLL_UPDATE,function(t,e){var r=n.selection.lastRange,o=r&&0===r.length?r.index:void 0;a.call(n,function(){return n.editor.update(null,e,o)},t)});var s=this.clipboard.convert("
"+o+"


");this.setContents(s),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return h(t,null,[{key:"debug",value:function(t){!0===t&&(t="log"),A.default.level(t)}},{key:"find",value:function(t){return t.__quill||w.default.find(t)}},{key:"import",value:function(t){return null==this.imports[t]&&P.error("Cannot import "+t+". Are you sure it was registered?"),this.imports[t]}},{key:"register",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof t){var o=t.attrName||t.blotName;"string"==typeof o?this.register("formats/"+o,t,e):Object.keys(t).forEach(function(r){n.register(r,t[r],e)})}else null==this.imports[t]||r||P.warn("Overwriting "+t+" with",e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&"abstract"!==e.blotName?w.default.register(e):t.startsWith("modules")&&"function"==typeof e.register&&e.register()}}]),h(t,[{key:"addContainer",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){var n=t;t=document.createElement("div"),t.classList.add(n)}return this.container.insertBefore(t,e),t}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(t,e,n){var r=this,o=s(t,e,n),i=f(o,4);return t=i[0],e=i[1],n=i[3],a.call(this,function(){return r.editor.deleteText(t,e)},n,t,-1*e)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}},{key:"focus",value:function(){var t=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=t,this.scrollIntoView()}},{key:"format",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.default.sources.API;return a.call(this,function(){var r=n.getSelection(!0),i=new d.default;if(null==r)return i;if(w.default.query(t,w.default.Scope.BLOCK))i=n.editor.formatLine(r.index,r.length,o({},t,e));else{if(0===r.length)return n.selection.format(t,e),i;i=n.editor.formatText(r.index,r.length,o({},t,e))}return n.setSelection(r,g.default.sources.SILENT),i},r)}},{key:"formatLine",value:function(t,e,n,r,o){var i=this,l=void 0,u=s(t,e,n,r,o),c=f(u,4);return t=c[0],e=c[1],l=c[2],o=c[3],a.call(this,function(){return i.editor.formatLine(t,e,l)},o,t,0)}},{key:"formatText",value:function(t,e,n,r,o){var i=this,l=void 0,u=s(t,e,n,r,o),c=f(u,4);return t=c[0],e=c[1],l=c[2],o=c[3],a.call(this,function(){return i.editor.formatText(t,e,l)},o,t,0)}},{key:"getBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=void 0;n="number"==typeof t?this.selection.getBounds(t,e):this.selection.getBounds(t.index,t.length);var r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}},{key:"getContents",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,n=s(t,e),r=f(n,2);return t=r[0],e=r[1],this.editor.getContents(t,e)}},{key:"getFormat",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof t?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}},{key:"getIndex",value:function(t){return t.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(t){return this.scroll.leaf(t)}},{key:"getLine",value:function(t){return this.scroll.line(t)}},{key:"getLines",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}},{key:"getModule",value:function(t){return this.theme.modules[t]}},{key:"getSelection",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,n=s(t,e),r=f(n,2);return t=r[0],e=r[1],this.editor.getText(t,e)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(e,n,r){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.sources.API;return a.call(this,function(){return o.editor.insertEmbed(e,n,r)},i,e)}},{key:"insertText",value:function(t,e,n,r,o){var i=this,l=void 0,u=s(t,0,n,r,o),c=f(u,4);return t=c[0],l=c[2],o=c[3],a.call(this,function(){return i.editor.insertText(t,e,l)},o,t,e.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(t,e,n){this.clipboard.dangerouslyPasteHTML(t,e,n)}},{key:"removeFormat",value:function(t,e,n){var r=this,o=s(t,e,n),i=f(o,4);return t=i[0],e=i[1],n=i[3],a.call(this,function(){return r.editor.removeFormat(t,e)},n,t)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.default.sources.API;return a.call(this,function(){t=new d.default(t);var n=e.getLength(),r=e.editor.deleteText(0,n),o=e.editor.applyDelta(t),i=o.ops[o.ops.length-1];return null!=i&&"string"==typeof i.insert&&"\n"===i.insert[i.insert.length-1]&&(e.editor.deleteText(e.getLength()-1,1),o.delete(1)),r.compose(o)},n)}},{key:"setSelection",value:function(e,n,r){if(null==e)this.selection.setRange(null,n||t.sources.API);else{var o=s(e,n,r),i=f(o,4);e=i[0],n=i[1],r=i[3],this.selection.setRange(new x.Range(e,n),r),r!==g.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.default.sources.API,n=(new d.default).insert(t);return this.setContents(n,e)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g.default.sources.USER,e=this.scroll.update(t);return this.selection.update(t),e}},{key:"updateContents",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.default.sources.API;return a.call(this,function(){return t=new d.default(t),e.editor.applyDelta(t,n)},n,!0)}}]),t}();S.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},S.events=g.default.events,S.sources=g.default.sources,S.version="1.3.7",S.imports={delta:d.default,parchment:w.default,"core/module":_.default,"core/theme":T.default},e.expandConfig=l,e.overload=s,e.default=S},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,t),this.quill=e,this.options=n};o.DEFAULTS={},e.default=o},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(0),a=function(t){return t&&t.__esModule?t:{default:t}}(l),s=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.default.Text);e.default=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n1?e-1:0),r=1;r1?n-1:0),o=1;o-1:this.whitelist.indexOf(e)>-1))},t.prototype.remove=function(t){t.removeAttribute(this.keyName)},t.prototype.value=function(t){var e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""},t}();e.default=o},function(t,e,n){function r(t){return null===t||void 0===t}function o(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&!(t.length>0&&"number"!=typeof t[0]))}function i(t,e,n){var i,c;if(r(t)||r(e))return!1;if(t.prototype!==e.prototype)return!1;if(s(t))return!!s(e)&&(t=l.call(t),e=l.call(e),u(t,e,n));if(o(t)){if(!o(e))return!1;if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(f[i]!=h[i])return!1;for(i=f.length-1;i>=0;i--)if(c=f[i],!u(t[c],e[c],n))return!1;return typeof t==typeof e}var l=Array.prototype.slice,a=n(55),s=n(56),u=t.exports=function(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:i(t,e,n))}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Code=void 0;var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function t(t,e){for(var n=0;n=t+n)){var l=this.newlineIndex(t,!0)+1,a=i-l+1,s=this.isolate(l,a),u=s.next;s.format(r,o),u instanceof e&&u.formatAt(0,t-l+n-a,r,o)}}}},{key:"insertAt",value:function(t,e,n){if(null==n){var r=this.descendant(m.default,t),o=a(r,2),i=o[0],l=o[1];i.insertAt(l,e)}}},{key:"length",value:function(){var t=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?t:t+1}},{key:"newlineIndex",value:function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return this.domNode.textContent.slice(0,t).lastIndexOf("\n");var e=this.domNode.textContent.slice(t).indexOf("\n");return e>-1?t+e:-1}},{key:"optimize",value:function(t){this.domNode.textContent.endsWith("\n")||this.appendChild(p.default.create("text","\n")),u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===n.statics.formats(n.domNode)&&(n.optimize(t),n.moveChildren(this),n.remove())}},{key:"replace",value:function(t){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(t){var e=p.default.find(t);null==e?t.parentNode.removeChild(t):e instanceof p.default.Embed?e.remove():e.unwrap()})}}],[{key:"create",value:function(t){var n=u(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return n.setAttribute("spellcheck",!1),n}},{key:"formats",value:function(){return!0}}]),e}(y.default);O.blotName="code-block",O.tagName="PRE",O.TAB=" ",e.Code=_,e.default=O},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n-1}Object.defineProperty(e,"__esModule",{value:!0}),e.sanitize=e.default=void 0;var a=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=this.container.querySelector(".ql-selected");if(t!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(t.parentNode.children,t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if("object"===("undefined"==typeof Event?"undefined":l(Event))){var r=document.createEvent("Event");r.initEvent("change",!0,!0),this.select.dispatchEvent(r)}this.close()}}},{key:"update",value:function(){var t=void 0;if(this.select.selectedIndex>-1){var e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);var n=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",n)}}]),t}();e.default=p},function(t,e,n){"use strict";function r(t){var e=a.find(t);if(null==e)try{e=a.create(t)}catch(n){e=a.create(a.Scope.INLINE),[].slice.call(t.childNodes).forEach(function(t){e.domNode.appendChild(t)}),t.parentNode&&t.parentNode.replaceChild(e.domNode,t),e.attach()}return e}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(47),l=n(27),a=n(1),s=function(t){function e(e){var n=t.call(this,e)||this;return n.build(),n}return o(e,t),e.prototype.appendChild=function(t){this.insertBefore(t)},e.prototype.attach=function(){t.prototype.attach.call(this),this.children.forEach(function(t){t.attach()})},e.prototype.build=function(){var t=this;this.children=new i.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(e){try{var n=r(e);t.insertBefore(n,t.children.head||void 0)}catch(t){if(t instanceof a.ParchmentError)return;throw t}})},e.prototype.deleteAt=function(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,function(t,e,n){t.deleteAt(e,n)})},e.prototype.descendant=function(t,n){var r=this.children.find(n),o=r[0],i=r[1];return null==t.blotName&&t(o)||null!=t.blotName&&o instanceof t?[o,i]:o instanceof e?o.descendant(t,i):[null,-1]},e.prototype.descendants=function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=Number.MAX_VALUE);var o=[],i=r;return this.children.forEachAt(n,r,function(n,r,l){(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&o.push(n),n instanceof e&&(o=o.concat(n.descendants(t,r,i))),i-=l}),o},e.prototype.detach=function(){this.children.forEach(function(t){t.detach()}),t.prototype.detach.call(this)},e.prototype.formatAt=function(t,e,n,r){this.children.forEachAt(t,e,function(t,e,o){t.formatAt(e,o,n,r)})},e.prototype.insertAt=function(t,e,n){var r=this.children.find(t),o=r[0],i=r[1];if(o)o.insertAt(i,e,n);else{var l=null==n?a.create("text",e):a.create(e,n);this.appendChild(l)}},e.prototype.insertBefore=function(t,e){if(null!=this.statics.allowedChildren&&!this.statics.allowedChildren.some(function(e){return t instanceof e}))throw new a.ParchmentError("Cannot insert "+t.statics.blotName+" into "+this.statics.blotName);t.insertInto(this,e)},e.prototype.length=function(){return this.children.reduce(function(t,e){return t+e.length()},0)},e.prototype.moveChildren=function(t,e){this.children.forEach(function(n){t.insertBefore(n,e)})},e.prototype.optimize=function(e){if(t.prototype.optimize.call(this,e),0===this.children.length)if(null!=this.statics.defaultChild){var n=a.create(this.statics.defaultChild);this.appendChild(n),n.optimize(e)}else this.remove()},e.prototype.path=function(t,n){void 0===n&&(n=!1);var r=this.children.find(t,n),o=r[0],i=r[1],l=[[this,t]];return o instanceof e?l.concat(o.path(i,n)):(null!=o&&l.push([o,i]),l)},e.prototype.removeChild=function(t){this.children.remove(t)},e.prototype.replace=function(n){n instanceof e&&n.moveChildren(this),t.prototype.replace.call(this,n)},e.prototype.split=function(t,e){if(void 0===e&&(e=!1),!e){if(0===t)return this;if(t===this.length())return this.next}var n=this.clone();return this.parent.insertBefore(n,this.next),this.children.forEachAt(t,this.length(),function(t,r,o){t=t.split(r,e),n.appendChild(t)}),n},e.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},e.prototype.update=function(t,e){var n=this,o=[],i=[];t.forEach(function(t){t.target===n.domNode&&"childList"===t.type&&(o.push.apply(o,t.addedNodes),i.push.apply(i,t.removedNodes))}),i.forEach(function(t){if(!(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var e=a.find(t);null!=e&&(null!=e.domNode.parentNode&&e.domNode.parentNode!==n.domNode||e.detach())}}),o.filter(function(t){return t.parentNode==n.domNode}).sort(function(t,e){return t===e?0:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(t){var e=null;null!=t.nextSibling&&(e=a.find(t.nextSibling));var o=r(t);o.next==e&&null!=o.next||(null!=o.parent&&o.parent.removeChild(n),n.insertBefore(o,e||void 0))})},e}(l.default);e.default=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(11),i=n(28),l=n(17),a=n(1),s=function(t){function e(e){var n=t.call(this,e)||this;return n.attributes=new i.default(n.domNode),n}return r(e,t),e.formats=function(t){return"string"==typeof this.tagName||(Array.isArray(this.tagName)?t.tagName.toLowerCase():void 0)},e.prototype.format=function(t,e){var n=a.query(t);n instanceof o.default?this.attributes.attribute(n,e):e&&(null==n||t===this.statics.blotName&&this.formats()[t]===e||this.replaceWith(t,e))},e.prototype.formats=function(){var t=this.attributes.values(),e=this.statics.formats(this.domNode);return null!=e&&(t[this.statics.blotName]=e),t},e.prototype.replaceWith=function(e,n){var r=t.prototype.replaceWith.call(this,e,n);return this.attributes.copy(r),r},e.prototype.update=function(e,n){var r=this;t.prototype.update.call(this,e,n),e.some(function(t){return t.target===r.domNode&&"attributes"===t.type})&&this.attributes.build()},e.prototype.wrap=function(n,r){var o=t.prototype.wrap.call(this,n,r);return o instanceof e&&o.statics.scope===this.statics.scope&&this.attributes.move(o),o},e}(l.default);e.default=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(27),i=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.value=function(t){return!0},e.prototype.index=function(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1},e.prototype.position=function(t,e){var n=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return t>0&&(n+=1),[this.parent.domNode,n]},e.prototype.value=function(){var t;return t={},t[this.statics.blotName]=this.statics.value(this.domNode)||!0,t},e.scope=i.Scope.INLINE_BLOT,e}(o.default);e.default=l},function(t,e,n){function r(t){this.ops=t,this.index=0,this.offset=0}var o=n(12),i=n(2),l={attributes:{compose:function(t,e,n){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var r=i(!0,{},e);n||(r=Object.keys(r).reduce(function(t,e){return null!=r[e]&&(t[e]=r[e]),t},{}));for(var o in t)void 0!==t[o]&&void 0===e[o]&&(r[o]=t[o]);return Object.keys(r).length>0?r:void 0},diff:function(t,e){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var n=Object.keys(t).concat(Object.keys(e)).reduce(function(n,r){return o(t[r],e[r])||(n[r]=void 0===e[r]?null:e[r]),n},{});return Object.keys(n).length>0?n:void 0},transform:function(t,e,n){if("object"!=typeof t)return e;if("object"==typeof e){if(!n)return e;var r=Object.keys(e).reduce(function(n,r){return void 0===t[r]&&(n[r]=e[r]),n},{});return Object.keys(r).length>0?r:void 0}}},iterator:function(t){return new r(t)},length:function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"string"==typeof t.insert?t.insert.length:1}};r.prototype.hasNext=function(){return this.peekLength()<1/0},r.prototype.next=function(t){t||(t=1/0);var e=this.ops[this.index];if(e){var n=this.offset,r=l.length(e);if(t>=r-n?(t=r-n,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof e.delete)return{delete:t};var o={};return e.attributes&&(o.attributes=e.attributes),"number"==typeof e.retain?o.retain=t:"string"==typeof e.insert?o.insert=e.insert.substr(n,t):o.insert=e.insert,o}return{retain:1/0}},r.prototype.peek=function(){return this.ops[this.index]},r.prototype.peekLength=function(){return this.ops[this.index]?l.length(this.ops[this.index])-this.offset:1/0},r.prototype.peekType=function(){return this.ops[this.index]?"number"==typeof this.ops[this.index].delete?"delete":"number"==typeof this.ops[this.index].retain?"retain":"insert":"retain"},r.prototype.rest=function(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);var t=this.offset,e=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=t,this.index=e,[n].concat(r)}return[]},t.exports=l},function(t,e){var n=function(){"use strict";function t(t,e){return null!=e&&t instanceof e}function e(n,r,o,i,c){function f(n,o){if(null===n)return null;if(0===o)return n;var y,v;if("object"!=typeof n)return n;if(t(n,a))y=new a;else if(t(n,s))y=new s;else if(t(n,u))y=new u(function(t,e){n.then(function(e){t(f(e,o-1))},function(t){e(f(t,o-1))})});else if(e.__isArray(n))y=[];else if(e.__isRegExp(n))y=new RegExp(n.source,l(n)),n.lastIndex&&(y.lastIndex=n.lastIndex);else if(e.__isDate(n))y=new Date(n.getTime());else{if(d&&Buffer.isBuffer(n))return y=Buffer.allocUnsafe?Buffer.allocUnsafe(n.length):new Buffer(n.length),n.copy(y),y;t(n,Error)?y=Object.create(n):void 0===i?(v=Object.getPrototypeOf(n),y=Object.create(v)):(y=Object.create(i),v=i)}if(r){var b=h.indexOf(n);if(-1!=b)return p[b];h.push(n),p.push(y)}t(n,a)&&n.forEach(function(t,e){var n=f(e,o-1),r=f(t,o-1);y.set(n,r)}),t(n,s)&&n.forEach(function(t){var e=f(t,o-1);y.add(e)});for(var g in n){var m;v&&(m=Object.getOwnPropertyDescriptor(v,g)),m&&null==m.set||(y[g]=f(n[g],o-1))}if(Object.getOwnPropertySymbols)for(var _=Object.getOwnPropertySymbols(n),g=0;g<_.length;g++){var O=_[g],w=Object.getOwnPropertyDescriptor(n,O);(!w||w.enumerable||c)&&(y[O]=f(n[O],o-1),w.enumerable||Object.defineProperty(y,O,{enumerable:!1}))}if(c)for(var x=Object.getOwnPropertyNames(n),g=0;g1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.index=e,this.length=n},O=function(){function t(e,n){var r=this;i(this,t),this.emitter=n,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=c.default.create("cursor",this),this.lastRange=this.savedRange=new _(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){r.mouseDown||setTimeout(r.update.bind(r,v.default.sources.USER),1)}),this.emitter.on(v.default.events.EDITOR_CHANGE,function(t,e){t===v.default.events.TEXT_CHANGE&&e.length()>0&&r.update(v.default.sources.SILENT)}),this.emitter.on(v.default.events.SCROLL_BEFORE_UPDATE,function(){if(r.hasFocus()){var t=r.getNativeRange();null!=t&&t.start.node!==r.cursor.textNode&&r.emitter.once(v.default.events.SCROLL_UPDATE,function(){try{r.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset)}catch(t){}})}}),this.emitter.on(v.default.events.SCROLL_OPTIMIZE,function(t,e){if(e.range){var n=e.range,o=n.startNode,i=n.startOffset,l=n.endNode,a=n.endOffset;r.setNativeRange(o,i,l,a)}}),this.update(v.default.sources.SILENT)}return s(t,[{key:"handleComposition",value:function(){var t=this;this.root.addEventListener("compositionstart",function(){t.composing=!0}),this.root.addEventListener("compositionend",function(){if(t.composing=!1,t.cursor.parent){var e=t.cursor.restore();if(!e)return;setTimeout(function(){t.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}},{key:"handleDragging",value:function(){var t=this;this.emitter.listenDOM("mousedown",document.body,function(){t.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){t.mouseDown=!1,t.update(v.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(t,e){if(null==this.scroll.whitelist||this.scroll.whitelist[t]){this.scroll.update();var n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!c.default.query(t,c.default.Scope.BLOCK)){if(n.start.node!==this.cursor.textNode){var r=c.default.find(n.start.node,!1);if(null==r)return;if(r instanceof c.default.Leaf){var o=r.split(n.start.offset);r.parent.insertBefore(this.cursor,o)}else r.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.scroll.length();t=Math.min(t,n-1),e=Math.min(t+e,n-1)-t;var r=void 0,o=this.scroll.leaf(t),i=a(o,2),l=i[0],s=i[1];if(null==l)return null;var u=l.position(s,!0),c=a(u,2);r=c[0],s=c[1];var f=document.createRange();if(e>0){f.setStart(r,s);var h=this.scroll.leaf(t+e),p=a(h,2);if(l=p[0],s=p[1],null==l)return null;var d=l.position(s,!0),y=a(d,2);return r=y[0],s=y[1],f.setEnd(r,s),f.getBoundingClientRect()}var v="left",b=void 0;return r instanceof Text?(s0&&(v="right")),{bottom:b.top+b.height,height:b.height,left:b[v],right:b[v],top:b.top,width:0}}},{key:"getNativeRange",value:function(){var t=document.getSelection();if(null==t||t.rangeCount<=0)return null;var e=t.getRangeAt(0);if(null==e)return null;var n=this.normalizeNative(e);return m.info("getNativeRange",n),n}},{key:"getRange",value:function(){var t=this.getNativeRange();return null==t?[null,null]:[this.normalizedToRange(t),t]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(t){var e=this,n=[[t.start.node,t.start.offset]];t.native.collapsed||n.push([t.end.node,t.end.offset]);var r=n.map(function(t){var n=a(t,2),r=n[0],o=n[1],i=c.default.find(r,!0),l=i.offset(e.scroll);return 0===o?l:i instanceof c.default.Container?l+i.length():l+i.index(r,o)}),i=Math.min(Math.max.apply(Math,o(r)),this.scroll.length()-1),l=Math.min.apply(Math,[i].concat(o(r)));return new _(l,i-l)}},{key:"normalizeNative",value:function(t){if(!l(this.root,t.startContainer)||!t.collapsed&&!l(this.root,t.endContainer))return null;var e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(function(t){for(var e=t.node,n=t.offset;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>n)e=e.childNodes[n],n=0;else{if(e.childNodes.length!==n)break;e=e.lastChild,n=e instanceof Text?e.data.length:e.childNodes.length+1}t.node=e,t.offset=n}),e}},{key:"rangeToNative",value:function(t){var e=this,n=t.collapsed?[t.index]:[t.index,t.index+t.length],r=[],o=this.scroll.length();return n.forEach(function(t,n){t=Math.min(o-1,t);var i=void 0,l=e.scroll.leaf(t),s=a(l,2),u=s[0],c=s[1],f=u.position(c,0!==n),h=a(f,2);i=h[0],c=h[1],r.push(i,c)}),r.length<2&&(r=r.concat(r)),r}},{key:"scrollIntoView",value:function(t){var e=this.lastRange;if(null!=e){var n=this.getBounds(e.index,e.length);if(null!=n){var r=this.scroll.length()-1,o=this.scroll.line(Math.min(e.index,r)),i=a(o,1),l=i[0],s=l;if(e.length>0){var u=this.scroll.line(Math.min(e.index+e.length,r));s=a(u,1)[0]}if(null!=l&&null!=s){var c=t.getBoundingClientRect();n.topc.bottom&&(t.scrollTop+=n.bottom-c.bottom)}}}}},{key:"setNativeRange",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(m.info("setNativeRange",t,e,n,r),null==t||null!=this.root.parentNode&&null!=t.parentNode&&null!=n.parentNode){var i=document.getSelection();if(null!=i)if(null!=t){this.hasFocus()||this.root.focus();var l=(this.getNativeRange()||{}).native;if(null==l||o||t!==l.startContainer||e!==l.startOffset||n!==l.endContainer||r!==l.endOffset){"BR"==t.tagName&&(e=[].indexOf.call(t.parentNode.childNodes,t),t=t.parentNode),"BR"==n.tagName&&(r=[].indexOf.call(n.parentNode.childNodes,n),n=n.parentNode);var a=document.createRange();a.setStart(t,e),a.setEnd(n,r),i.removeAllRanges(),i.addRange(a)}}else i.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v.default.sources.API;if("string"==typeof e&&(n=e,e=!1),m.info("setRange",t),null!=t){var r=this.rangeToNative(t);this.setNativeRange.apply(this,o(r).concat([e]))}else this.setNativeRange(null);this.update(n)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v.default.sources.USER,e=this.lastRange,n=this.getRange(),r=a(n,2),o=r[0],i=r[1];if(this.lastRange=o,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,d.default)(e,this.lastRange)){var l;!this.composing&&null!=i&&i.native.collapsed&&i.start.node!==this.cursor.textNode&&this.cursor.restore();var s=[v.default.events.SELECTION_CHANGE,(0,h.default)(this.lastRange),(0,h.default)(e),t];if((l=this.emitter).emit.apply(l,[v.default.events.EDITOR_CHANGE].concat(s)),t!==v.default.sources.SILENT){var u;(u=this.emitter).emit.apply(u,s)}}}}]),t}();e.Range=_,e.default=O},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),s=r(a),u=n(3),c=r(u),f=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),e}(s.default.Container);f.allowedChildren=[c.default,u.BlockEmbed,f],e.default=f},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.ColorStyle=e.ColorClass=e.ColorAttributor=void 0;var l=function(){function t(t,e){for(var n=0;n1){var u=o.formats(),c=this.quill.getFormat(t.index-1,1);i=A.default.attributes.diff(u,c)||{}}}var f=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;this.quill.deleteText(t.index-f,f,S.default.sources.USER),Object.keys(i).length>0&&this.quill.formatLine(t.index-f,f,i,S.default.sources.USER),this.quill.focus()}}function c(t,e){var n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(!(t.index>=this.quill.getLength()-n)){var r={},o=0,i=this.quill.getLine(t.index),l=b(i,1),a=l[0];if(e.offset>=a.length()-1){var s=this.quill.getLine(t.index+1),u=b(s,1),c=u[0];if(c){var f=a.formats(),h=this.quill.getFormat(t.index,1);r=A.default.attributes.diff(f,h)||{},o=c.length()}}this.quill.deleteText(t.index,n,S.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(t.index+o-1,n,r,S.default.sources.USER)}}function f(t){var e=this.quill.getLines(t),n={};if(e.length>1){var r=e[0].formats(),o=e[e.length-1].formats();n=A.default.attributes.diff(o,r)||{}}this.quill.deleteText(t,S.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(t.index,1,n,S.default.sources.USER),this.quill.setSelection(t.index,S.default.sources.SILENT),this.quill.focus()}function h(t,e){var n=this;t.length>0&&this.quill.scroll.deleteAt(t.index,t.length);var r=Object.keys(e.format).reduce(function(t,n){return T.default.query(n,T.default.Scope.BLOCK)&&!Array.isArray(e.format[n])&&(t[n]=e.format[n]),t},{});this.quill.insertText(t.index,"\n",r,S.default.sources.USER),this.quill.setSelection(t.index+1,S.default.sources.SILENT),this.quill.focus(),Object.keys(e.format).forEach(function(t){null==r[t]&&(Array.isArray(e.format[t])||"link"!==t&&n.quill.format(t,e.format[t],S.default.sources.USER))})}function p(t){return{key:D.keys.TAB,shiftKey:!t,format:{"code-block":!0},handler:function(e){var n=T.default.query("code-block"),r=e.index,o=e.length,i=this.quill.scroll.descendant(n,r),l=b(i,2),a=l[0],s=l[1];if(null!=a){var u=this.quill.getIndex(a),c=a.newlineIndex(s,!0)+1,f=a.newlineIndex(u+s+o),h=a.domNode.textContent.slice(c,f).split("\n");s=0,h.forEach(function(e,i){t?(a.insertAt(c+s,n.TAB),s+=n.TAB.length,0===i?r+=n.TAB.length:o+=n.TAB.length):e.startsWith(n.TAB)&&(a.deleteAt(c+s,n.TAB.length),s-=n.TAB.length,0===i?r-=n.TAB.length:o-=n.TAB.length),s+=e.length+1}),this.quill.update(S.default.sources.USER),this.quill.setSelection(r,o,S.default.sources.SILENT)}}}}function d(t){return{key:t[0].toUpperCase(),shortKey:!0,handler:function(e,n){this.quill.format(t,!n.format[t],S.default.sources.USER)}}}function y(t){if("string"==typeof t||"number"==typeof t)return y({key:t});if("object"===(void 0===t?"undefined":v(t))&&(t=(0,_.default)(t,!1)),"string"==typeof t.key)if(null!=D.keys[t.key.toUpperCase()])t.key=D.keys[t.key.toUpperCase()];else{if(1!==t.key.length)return null;t.key=t.key.toUpperCase().charCodeAt(0)}return t.shortKey&&(t[B]=t.shortKey,delete t.shortKey),t}Object.defineProperty(e,"__esModule",{value:!0}),e.SHORTKEY=e.default=void 0;var v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),g=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=y(t);if(null==r||null==r.key)return I.warn("Attempted to add invalid keyboard binding",r);"function"==typeof e&&(e={handler:e}),"function"==typeof n&&(n={handler:n}),r=(0,k.default)(r,e,n),this.bindings[r.key]=this.bindings[r.key]||[],this.bindings[r.key].push(r)}},{key:"listen",value:function(){var t=this;this.quill.root.addEventListener("keydown",function(n){if(!n.defaultPrevented){var r=n.which||n.keyCode,o=(t.bindings[r]||[]).filter(function(t){return e.match(n,t)});if(0!==o.length){var i=t.quill.getSelection();if(null!=i&&t.quill.hasFocus()){var l=t.quill.getLine(i.index),a=b(l,2),s=a[0],u=a[1],c=t.quill.getLeaf(i.index),f=b(c,2),h=f[0],p=f[1],d=0===i.length?[h,p]:t.quill.getLeaf(i.index+i.length),y=b(d,2),g=y[0],m=y[1],_=h instanceof T.default.Text?h.value().slice(0,p):"",O=g instanceof T.default.Text?g.value().slice(m):"",x={collapsed:0===i.length,empty:0===i.length&&s.length()<=1,format:t.quill.getFormat(i),offset:u,prefix:_,suffix:O};o.some(function(e){if(null!=e.collapsed&&e.collapsed!==x.collapsed)return!1;if(null!=e.empty&&e.empty!==x.empty)return!1;if(null!=e.offset&&e.offset!==x.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(function(t){return null==x.format[t]}))return!1}else if("object"===v(e.format)&&!Object.keys(e.format).every(function(t){return!0===e.format[t]?null!=x.format[t]:!1===e.format[t]?null==x.format[t]:(0,w.default)(e.format[t],x.format[t])}))return!1;return!(null!=e.prefix&&!e.prefix.test(x.prefix))&&(!(null!=e.suffix&&!e.suffix.test(x.suffix))&&!0!==e.handler.call(t,i,x))})&&n.preventDefault()}}}})}}]),e}(R.default);D.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},D.DEFAULTS={bindings:{bold:d("bold"),italic:d("italic"),underline:d("underline"),indent:{key:D.keys.TAB,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","+1",S.default.sources.USER)}},outdent:{key:D.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","-1",S.default.sources.USER)}},"outdent backspace":{key:D.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(t,e){null!=e.format.indent?this.quill.format("indent","-1",S.default.sources.USER):null!=e.format.list&&this.quill.format("list",!1,S.default.sources.USER)}},"indent code-block":p(!0),"outdent code-block":p(!1),"remove tab":{key:D.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(t){this.quill.deleteText(t.index-1,1,S.default.sources.USER)}},tab:{key:D.keys.TAB,handler:function(t){this.quill.history.cutoff();var e=(new N.default).retain(t.index).delete(t.length).insert("\t");this.quill.updateContents(e,S.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,S.default.sources.SILENT)}},"list empty enter":{key:D.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(t,e){this.quill.format("list",!1,S.default.sources.USER),e.format.indent&&this.quill.format("indent",!1,S.default.sources.USER)}},"checklist enter":{key:D.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(t){var e=this.quill.getLine(t.index),n=b(e,2),r=n[0],o=n[1],i=(0,k.default)({},r.formats(),{list:"checked"}),l=(new N.default).retain(t.index).insert("\n",i).retain(r.length()-o-1).retain(1,{list:"unchecked"});this.quill.updateContents(l,S.default.sources.USER),this.quill.setSelection(t.index+1,S.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:D.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(t,e){var n=this.quill.getLine(t.index),r=b(n,2),o=r[0],i=r[1],l=(new N.default).retain(t.index).insert("\n",e.format).retain(o.length()-i-1).retain(1,{header:null});this.quill.updateContents(l,S.default.sources.USER),this.quill.setSelection(t.index+1,S.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(t,e){var n=e.prefix.length,r=this.quill.getLine(t.index),o=b(r,2),i=o[0],l=o[1];if(l>n)return!0;var a=void 0;switch(e.prefix.trim()){case"[]":case"[ ]":a="unchecked";break;case"[x]":a="checked";break;case"-":case"*":a="bullet";break;default:a="ordered"}this.quill.insertText(t.index," ",S.default.sources.USER),this.quill.history.cutoff();var s=(new N.default).retain(t.index-l).delete(n+1).retain(i.length()-2-l).retain(1,{list:a});this.quill.updateContents(s,S.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-n,S.default.sources.SILENT)}},"code exit":{key:D.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(t){var e=this.quill.getLine(t.index),n=b(e,2),r=n[0],o=n[1],i=(new N.default).retain(t.index+r.length()-o-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(i,S.default.sources.USER)}},"embed left":s(D.keys.LEFT,!1),"embed left shift":s(D.keys.LEFT,!0),"embed right":s(D.keys.RIGHT,!1),"embed right shift":s(D.keys.RIGHT,!0)}},e.default=D,e.SHORTKEY=B},function(t,e,n){"use strict";t.exports={align:{"":n(75),center:n(76),right:n(77),justify:n(78)},background:n(79),blockquote:n(80),bold:n(81),clean:n(82),code:n(40),"code-block":n(40),color:n(83),direction:{"":n(84),rtl:n(85)},float:{center:n(86),full:n(87),left:n(88),right:n(89)},formula:n(90),header:{1:n(91),2:n(92)},italic:n(93),image:n(94),indent:{"+1":n(95),"-1":n(96)},link:n(97),list:{ordered:n(98),bullet:n(99),check:n(100)},script:{sub:n(101),super:n(102)},strike:n(103),underline:n(104),video:n(105)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=function(){function t(t){this.domNode=t,this.domNode[r.DATA_KEY]={blot:this}}return Object.defineProperty(t.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),t.create=function(t){if(null==this.tagName)throw new r.ParchmentError("Blot definition missing tagName");var e;return Array.isArray(this.tagName)?("string"==typeof t&&(t=t.toUpperCase(),parseInt(t).toString()===t&&(t=parseInt(t))),e="number"==typeof t?document.createElement(this.tagName[t-1]):this.tagName.indexOf(t)>-1?document.createElement(t):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e},t.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},t.prototype.clone=function(){var t=this.domNode.cloneNode(!1);return r.create(t)},t.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[r.DATA_KEY]},t.prototype.deleteAt=function(t,e){this.isolate(t,e).remove()},t.prototype.formatAt=function(t,e,n,o){var i=this.isolate(t,e);if(null!=r.query(n,r.Scope.BLOT)&&o)i.wrap(n,o);else if(null!=r.query(n,r.Scope.ATTRIBUTE)){var l=r.create(this.statics.scope);i.wrap(l),l.format(n,o)}},t.prototype.insertAt=function(t,e,n){var o=null==n?r.create("text",e):r.create(e,n),i=this.split(t);this.parent.insertBefore(o,i)},t.prototype.insertInto=function(t,e){void 0===e&&(e=null),null!=this.parent&&this.parent.children.remove(this);var n=null;t.children.insertBefore(this,e),null!=e&&(n=e.domNode),this.domNode.parentNode==t.domNode&&this.domNode.nextSibling==n||t.domNode.insertBefore(this.domNode,n),this.parent=t,this.attach()},t.prototype.isolate=function(t,e){var n=this.split(t);return n.split(e),n},t.prototype.length=function(){return 1},t.prototype.offset=function(t){return void 0===t&&(t=this.parent),null==this.parent||this==t?0:this.parent.children.offset(this)+this.parent.offset(t)},t.prototype.optimize=function(t){null!=this.domNode[r.DATA_KEY]&&delete this.domNode[r.DATA_KEY].mutations},t.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},t.prototype.replace=function(t){null!=t.parent&&(t.parent.insertBefore(this,t.next),t.remove())},t.prototype.replaceWith=function(t,e){var n="string"==typeof t?r.create(t,e):t;return n.replace(this),n},t.prototype.split=function(t,e){return 0===t?this:this.next},t.prototype.update=function(t,e){},t.prototype.wrap=function(t,e){var n="string"==typeof t?r.create(t,e):t;return null!=this.parent&&this.parent.insertBefore(n,this.next),n.appendChild(this),n},t.blotName="abstract",t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(11),o=n(29),i=n(30),l=n(1),a=function(){function t(t){this.attributes={},this.domNode=t,this.build()}return t.prototype.attribute=function(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])},t.prototype.build=function(){var t=this;this.attributes={};var e=r.default.keys(this.domNode),n=o.default.keys(this.domNode),a=i.default.keys(this.domNode);e.concat(n).concat(a).forEach(function(e){var n=l.query(e,l.Scope.ATTRIBUTE);n instanceof r.default&&(t.attributes[n.attrName]=n)})},t.prototype.copy=function(t){var e=this;Object.keys(this.attributes).forEach(function(n){var r=e.attributes[n].value(e.domNode);t.format(n,r)})},t.prototype.move=function(t){var e=this;this.copy(t),Object.keys(this.attributes).forEach(function(t){e.attributes[t].remove(e.domNode)}),this.attributes={}},t.prototype.values=function(){var t=this;return Object.keys(this.attributes).reduce(function(e,n){return e[n]=t.attributes[n].value(t.domNode),e},{})},t}();e.default=a},function(t,e,n){"use strict";function r(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter(function(t){return 0===t.indexOf(e+"-")})}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(11),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.keys=function(t){return(t.getAttribute("class")||"").split(/\s+/).map(function(t){return t.split("-").slice(0,-1).join("-")})},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(this.keyName+"-"+e),!0)},e.prototype.remove=function(t){r(t,this.keyName).forEach(function(e){t.classList.remove(e)}),0===t.classList.length&&t.removeAttribute("class")},e.prototype.value=function(t){var e=r(t,this.keyName)[0]||"",n=e.slice(this.keyName.length+1);return this.canAdd(t,n)?n:""},e}(i.default);e.default=l},function(t,e,n){"use strict";function r(t){var e=t.split("-"),n=e.slice(1).map(function(t){return t[0].toUpperCase()+t.slice(1)}).join("");return e[0]+n}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(11),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.keys=function(t){return(t.getAttribute("style")||"").split(";").map(function(t){return t.split(":")[0].trim()})},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(t.style[r(this.keyName)]=e,!0)},e.prototype.remove=function(t){t.style[r(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")},e.prototype.value=function(t){var e=t.style[r(this.keyName)];return this.canAdd(t,e)?e:""},e}(i.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=function(){function t(t,e){for(var n=0;n '},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;nr.right&&(i=r.right-o.right,this.root.style.left=e+i+"px"),o.leftr.bottom){var l=o.bottom-o.top,a=t.bottom-t.top+l;this.root.style.top=n-a+"px",this.root.classList.add("ql-flip")}return i}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),t}();e.default=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return e?(e[1]||"https")+"://www.youtube.com/embed/"+e[2]+"?showinfo=0":(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(e[1]||"https")+"://player.vimeo.com/video/"+e[2]+"/":t}function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach(function(e){var r=document.createElement("option");e===n?r.setAttribute("selected","selected"):r.setAttribute("value",e),t.appendChild(r)})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BaseTooltip=void 0;var u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"link",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=e?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+t)||""),this.root.setAttribute("data-mode",t)}},{key:"restoreFocus",value:function(){var t=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=t}},{key:"save",value:function(){var t=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var e=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,v.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,v.default.sources.USER)),this.quill.root.scrollTop=e;break;case"video":t=a(t);case"formula":if(!t)break;var n=this.quill.getSelection(!0);if(null!=n){var r=n.index+n.length;this.quill.insertEmbed(r,this.root.getAttribute("data-mode"),t,v.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(r+1," ",v.default.sources.USER),this.quill.setSelection(r+2,v.default.sources.USER)}}this.textbox.value="",this.hide()}}]),e}(A.default);e.BaseTooltip=M,e.default=L},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(46),i=r(o),l=n(34),a=n(36),s=n(62),u=n(63),c=r(u),f=n(64),h=r(f),p=n(65),d=r(p),y=n(35),v=n(24),b=n(37),g=n(38),m=n(39),_=r(m),O=n(66),w=r(O),x=n(15),k=r(x),E=n(67),N=r(E),j=n(68),A=r(j),q=n(69),T=r(q),P=n(70),S=r(P),C=n(71),L=r(C),M=n(13),R=r(M),I=n(72),B=r(I),D=n(73),U=r(D),F=n(74),H=r(F),K=n(26),z=r(K),V=n(16),Z=r(V),W=n(41),G=r(W),Y=n(42),X=r(Y),$=n(43),Q=r($),J=n(107),tt=r(J),et=n(108),nt=r(et);i.default.register({"attributors/attribute/direction":a.DirectionAttribute,"attributors/class/align":l.AlignClass,"attributors/class/background":y.BackgroundClass,"attributors/class/color":v.ColorClass,"attributors/class/direction":a.DirectionClass,"attributors/class/font":b.FontClass,"attributors/class/size":g.SizeClass,"attributors/style/align":l.AlignStyle,"attributors/style/background":y.BackgroundStyle,"attributors/style/color":v.ColorStyle,"attributors/style/direction":a.DirectionStyle,"attributors/style/font":b.FontStyle,"attributors/style/size":g.SizeStyle},!0),i.default.register({"formats/align":l.AlignClass,"formats/direction":a.DirectionClass,"formats/indent":s.IndentClass,"formats/background":y.BackgroundStyle,"formats/color":v.ColorStyle,"formats/font":b.FontClass,"formats/size":g.SizeClass,"formats/blockquote":c.default,"formats/code-block":R.default,"formats/header":h.default,"formats/list":d.default,"formats/bold":_.default,"formats/code":M.Code,"formats/italic":w.default,"formats/link":k.default,"formats/script":N.default,"formats/strike":A.default,"formats/underline":T.default,"formats/image":S.default,"formats/video":L.default,"formats/list/item":p.ListItem,"modules/formula":B.default,"modules/syntax":U.default,"modules/toolbar":H.default,"themes/bubble":tt.default,"themes/snow":nt.default,"ui/icons":z.default,"ui/picker":Z.default,"ui/icon-picker":X.default,"ui/color-picker":G.default,"ui/tooltip":Q.default},!0),e.default=i.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=r(o),l=n(6),a=r(l),s=n(3),u=r(s),c=n(14),f=r(c),h=n(23),p=r(h),d=n(31),y=r(d),v=n(33),b=r(v),g=n(5),m=r(g),_=n(59),O=r(_),w=n(8),x=r(w),k=n(60),E=r(k),N=n(61),j=r(N),A=n(25),q=r(A);a.default.register({"blots/block":u.default,"blots/block/embed":s.BlockEmbed,"blots/break":f.default,"blots/container":p.default,"blots/cursor":y.default,"blots/embed":b.default,"blots/inline":m.default,"blots/scroll":O.default,"blots/text":x.default,"modules/clipboard":E.default,"modules/history":j.default,"modules/keyboard":q.default}),i.default.register(u.default,f.default,y.default,m.default,O.default,x.default),e.default=a.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){this.head=this.tail=null,this.length=0}return t.prototype.append=function(){for(var t=[],e=0;e1&&this.append.apply(this,t.slice(1))},t.prototype.contains=function(t){for(var e,n=this.iterator();e=n();)if(e===t)return!0;return!1},t.prototype.insertBefore=function(t,e){t&&(t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)},t.prototype.offset=function(t){for(var e=0,n=this.head;null!=n;){if(n===t)return e;e+=n.length(),n=n.next}return-1},t.prototype.remove=function(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)},t.prototype.iterator=function(t){return void 0===t&&(t=this.head),function(){var e=t;return null!=t&&(t=t.next),e}},t.prototype.find=function(t,e){void 0===e&&(e=!1);for(var n,r=this.iterator();n=r();){var o=n.length();if(ta?n(r,t-a,Math.min(e,a+u-t)):n(r,0,Math.min(u,t+e-a)),a+=u}},t.prototype.map=function(t){return this.reduce(function(e,n){return e.push(t(n)),e},[])},t.prototype.reduce=function(t,e){for(var n,r=this.iterator();n=r();)e=t(e,n);return e},t}();e.default=r},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(17),i=n(1),l={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},a=function(t){function e(e){var n=t.call(this,e)||this;return n.scroll=n,n.observer=new MutationObserver(function(t){n.update(t)}),n.observer.observe(n.domNode,l),n.attach(),n}return r(e,t),e.prototype.detach=function(){t.prototype.detach.call(this),this.observer.disconnect()},e.prototype.deleteAt=function(e,n){this.update(),0===e&&n===this.length()?this.children.forEach(function(t){t.remove()}):t.prototype.deleteAt.call(this,e,n)},e.prototype.formatAt=function(e,n,r,o){this.update(),t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.insertAt=function(e,n,r){this.update(),t.prototype.insertAt.call(this,e,n,r)},e.prototype.optimize=function(e,n){var r=this;void 0===e&&(e=[]),void 0===n&&(n={}),t.prototype.optimize.call(this,n);for(var l=[].slice.call(this.observer.takeRecords());l.length>0;)e.push(l.pop());for(var a=function(t,e){void 0===e&&(e=!0),null!=t&&t!==r&&null!=t.domNode.parentNode&&(null==t.domNode[i.DATA_KEY].mutations&&(t.domNode[i.DATA_KEY].mutations=[]),e&&a(t.parent))},s=function(t){null!=t.domNode[i.DATA_KEY]&&null!=t.domNode[i.DATA_KEY].mutations&&(t instanceof o.default&&t.children.forEach(s),t.optimize(n))},u=e,c=0;u.length>0;c+=1){if(c>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(u.forEach(function(t){var e=i.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(a(i.find(t.previousSibling,!1)),[].forEach.call(t.addedNodes,function(t){var e=i.find(t,!1);a(e,!1),e instanceof o.default&&e.children.forEach(function(t){a(t,!1)})})):"attributes"===t.type&&a(e.prev)),a(e))}),this.children.forEach(s),u=[].slice.call(this.observer.takeRecords()),l=u.slice();l.length>0;)e.push(l.pop())}},e.prototype.update=function(e,n){var r=this;void 0===n&&(n={}),e=e||this.observer.takeRecords(),e.map(function(t){var e=i.find(t.target,!0);return null==e?null:null==e.domNode[i.DATA_KEY].mutations?(e.domNode[i.DATA_KEY].mutations=[t],e):(e.domNode[i.DATA_KEY].mutations.push(t),null)}).forEach(function(t){null!=t&&t!==r&&null!=t.domNode[i.DATA_KEY]&&t.update(t.domNode[i.DATA_KEY].mutations||[],n)}),null!=this.domNode[i.DATA_KEY].mutations&&t.prototype.update.call(this,this.domNode[i.DATA_KEY].mutations,n),this.optimize(e,n)},e.blotName="scroll",e.defaultChild="block",e.scope=i.Scope.BLOCK_BLOT,e.tagName="DIV",e}(o.default);e.default=a},function(t,e,n){"use strict";function r(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var n in t)if(t[n]!==e[n])return!1;return!0}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(18),l=n(1),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.formats=function(n){if(n.tagName!==e.tagName)return t.formats.call(this,n)},e.prototype.format=function(n,r){var o=this;n!==this.statics.blotName||r?t.prototype.format.call(this,n,r):(this.children.forEach(function(t){t instanceof i.default||(t=t.wrap(e.blotName,!0)),o.attributes.copy(t)}),this.unwrap())},e.prototype.formatAt=function(e,n,r,o){if(null!=this.formats()[r]||l.query(r,l.Scope.ATTRIBUTE)){this.isolate(e,n).format(r,o)}else t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.optimize=function(n){t.prototype.optimize.call(this,n);var o=this.formats();if(0===Object.keys(o).length)return this.unwrap();var i=this.next;i instanceof e&&i.prev===this&&r(o,i.formats())&&(i.moveChildren(this),i.remove())},e.blotName="inline",e.scope=l.Scope.INLINE_BLOT,e.tagName="SPAN",e}(i.default);e.default=a},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(18),i=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.formats=function(n){var r=i.query(e.blotName).tagName;if(n.tagName!==r)return t.formats.call(this,n)},e.prototype.format=function(n,r){null!=i.query(n,i.Scope.BLOCK)&&(n!==this.statics.blotName||r?t.prototype.format.call(this,n,r):this.replaceWith(e.blotName))},e.prototype.formatAt=function(e,n,r,o){null!=i.query(r,i.Scope.BLOCK)?this.format(r,o):t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.insertAt=function(e,n,r){if(null==r||null!=i.query(n,i.Scope.INLINE))t.prototype.insertAt.call(this,e,n,r);else{var o=this.split(e),l=i.create(n,r);o.parent.insertBefore(l,o)}},e.prototype.update=function(e,n){navigator.userAgent.match(/Trident/)?this.build():t.prototype.update.call(this,e,n)},e.blotName="block",e.scope=i.Scope.BLOCK_BLOT,e.tagName="P",e}(o.default);e.default=l},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(19),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.formats=function(t){},e.prototype.format=function(e,n){t.prototype.formatAt.call(this,0,this.length(),e,n)},e.prototype.formatAt=function(e,n,r,o){0===e&&n===this.length()?this.format(r,o):t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.formats=function(){return this.statics.formats(this.domNode)},e}(o.default);e.default=i},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(19),i=n(1),l=function(t){function e(e){var n=t.call(this,e)||this;return n.text=n.statics.value(n.domNode),n}return r(e,t),e.create=function(t){return document.createTextNode(t)},e.value=function(t){var e=t.data;return e.normalize&&(e=e.normalize()),e},e.prototype.deleteAt=function(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)},e.prototype.index=function(t,e){return this.domNode===t?e:-1},e.prototype.insertAt=function(e,n,r){null==r?(this.text=this.text.slice(0,e)+n+this.text.slice(e),this.domNode.data=this.text):t.prototype.insertAt.call(this,e,n,r)},e.prototype.length=function(){return this.text.length},e.prototype.optimize=function(n){t.prototype.optimize.call(this,n),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},e.prototype.position=function(t,e){return void 0===e&&(e=!1),[this.domNode,t]},e.prototype.split=function(t,e){if(void 0===e&&(e=!1),!e){if(0===t)return this;if(t===this.length())return this.next}var n=i.create(this.domNode.splitText(t));return this.parent.insertBefore(n,this.next),this.text=this.statics.value(this.domNode),n},e.prototype.update=function(t,e){var n=this;t.some(function(t){return"characterData"===t.type&&t.target===n.domNode})&&(this.text=this.statics.value(this.domNode))},e.prototype.value=function(){return this.text},e.blotName="text",e.scope=i.Scope.INLINE_BLOT,e}(o.default);e.default=l},function(t,e,n){"use strict";var r=document.createElement("div");if(r.classList.toggle("test-class",!1),r.classList.contains("test-class")){var o=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return arguments.length>1&&!this.contains(t)==!e?e:o.call(this,t)}}String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return e=e||0,this.substr(e,t.length)===t}),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var n=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>n.length)&&(e=n.length),e-=t.length;var r=n.indexOf(t,e);return-1!==r&&r===e}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,o=arguments[1],i=0;ie.length?t:e,l=t.length>e.length?e:t,a=i.indexOf(l);if(-1!=a)return r=[[y,i.substring(0,a)],[v,l],[y,i.substring(a+l.length)]],t.length>e.length&&(r[0][0]=r[2][0]=d),r;if(1==l.length)return[[d,t],[y,e]];var u=s(t,e);if(u){var c=u[0],f=u[1],h=u[2],p=u[3],b=u[4],g=n(c,h),m=n(f,p);return g.concat([[v,b]],m)}return o(t,e)}function o(t,e){for(var n=t.length,r=e.length,o=Math.ceil((n+r)/2),l=o,a=2*o,s=new Array(a),u=new Array(a),c=0;cn)v+=2;else if(x>r)p+=2;else if(h){var k=l+f-_;if(k>=0&&k=E)return i(t,e,O,x)}}}for(var N=-m+b;N<=m-g;N+=2){var E,k=l+N;E=N==-m||N!=m&&u[k-1]n)g+=2;else if(j>r)b+=2;else if(!h){var w=l+f-N;if(w>=0&&w=E)return i(t,e,O,x)}}}}return[[d,t],[y,e]]}function i(t,e,r,o){var i=t.substring(0,r),l=e.substring(0,o),a=t.substring(r),s=e.substring(o),u=n(i,l),c=n(a,s);return u.concat(c)}function l(t,e){if(!t||!e||t.charAt(0)!=e.charAt(0))return 0;for(var n=0,r=Math.min(t.length,e.length),o=r,i=0;n=t.length?[r,o,i,s,f]:null}var r=t.length>e.length?t:e,o=t.length>e.length?e:t;if(r.length<4||2*o.lengthu[4].length?s:u:s;var c,f,h,p;return t.length>e.length?(c=i[0],f=i[1],h=i[2],p=i[3]):(h=i[0],p=i[1],c=i[2],f=i[3]),[c,f,h,p,i[4]]}function u(t){t.push([v,""]);for(var e,n=0,r=0,o=0,i="",s="";n1?(0!==r&&0!==o&&(e=l(s,i),0!==e&&(n-r-o>0&&t[n-r-o-1][0]==v?t[n-r-o-1][1]+=s.substring(0,e):(t.splice(0,0,[v,s.substring(0,e)]),n++),s=s.substring(e),i=i.substring(e)),0!==(e=a(s,i))&&(t[n][1]=s.substring(s.length-e)+t[n][1],s=s.substring(0,s.length-e),i=i.substring(0,i.length-e))),0===r?t.splice(n-o,r+o,[y,s]):0===o?t.splice(n-r,r+o,[d,i]):t.splice(n-r-o,r+o,[d,i],[y,s]),n=n-r-o+(r?1:0)+(o?1:0)+1):0!==n&&t[n-1][0]==v?(t[n-1][1]+=t[n][1],t.splice(n,1)):n++,o=0,r=0,i="",s=""}""===t[t.length-1][1]&&t.pop();var c=!1;for(n=1;n0&&r.splice(o+2,0,[l[0],a]),p(r,o,3)}return t}function h(t){for(var e=!1,n=function(t){return t.charCodeAt(0)>=56320&&t.charCodeAt(0)<=57343},r=2;r=55296&&t.charCodeAt(t.length-1)<=56319}(t[r-2][1])&&t[r-1][0]===d&&n(t[r-1][1])&&t[r][0]===y&&n(t[r][1])&&(e=!0,t[r-1][1]=t[r-2][1].slice(-1)+t[r-1][1],t[r][1]=t[r-2][1].slice(-1)+t[r][1],t[r-2][1]=t[r-2][1].slice(0,-1));if(!e)return t;for(var o=[],r=0;r0&&o.push(t[r]);return o}function p(t,e,n){for(var r=e+n-1;r>=0&&r>=e-1;r--)if(r+1=r&&!a.endsWith("\n")&&(n=!0),e.scroll.insertAt(t,a);var c=e.scroll.line(t),f=u(c,2),h=f[0],p=f[1],y=(0,T.default)({},(0,O.bubbleFormats)(h));if(h instanceof w.default){var b=h.descendant(v.default.Leaf,p),g=u(b,1),m=g[0];y=(0,T.default)(y,(0,O.bubbleFormats)(m))}l=d.default.attributes.diff(y,l)||{}}else if("object"===s(o.insert)){var _=Object.keys(o.insert)[0];if(null==_)return t;e.scroll.insertAt(t,_,o.insert[_])}r+=i}return Object.keys(l).forEach(function(n){e.scroll.formatAt(t,i,n,l[n])}),t+i},0),t.reduce(function(t,n){return"number"==typeof n.delete?(e.scroll.deleteAt(t,n.delete),t):t+(n.retain||n.insert.length||1)},0),this.scroll.batchEnd(),this.update(t)}},{key:"deleteText",value:function(t,e){return this.scroll.deleteAt(t,e),this.update((new h.default).retain(t).delete(e))}},{key:"formatLine",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(r).forEach(function(o){if(null==n.scroll.whitelist||n.scroll.whitelist[o]){var i=n.scroll.lines(t,Math.max(e,1)),l=e;i.forEach(function(e){var i=e.length();if(e instanceof g.default){var a=t-e.offset(n.scroll),s=e.newlineIndex(a+l)-a+1;e.formatAt(a,s,o,r[o])}else e.format(o,r[o]);l-=i})}}),this.scroll.optimize(),this.update((new h.default).retain(t).retain(e,(0,N.default)(r)))}},{key:"formatText",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(r).forEach(function(o){n.scroll.formatAt(t,e,o,r[o])}),this.update((new h.default).retain(t).retain(e,(0,N.default)(r)))}},{key:"getContents",value:function(t,e){return this.delta.slice(t,t+e)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(t,e){return t.concat(e.delta())},new h.default)}},{key:"getFormat",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===e?this.scroll.path(t).forEach(function(t){var e=u(t,1),o=e[0];o instanceof w.default?n.push(o):o instanceof v.default.Leaf&&r.push(o)}):(n=this.scroll.lines(t,e),r=this.scroll.descendants(v.default.Leaf,t,e));var o=[n,r].map(function(t){if(0===t.length)return{};for(var e=(0,O.bubbleFormats)(t.shift());Object.keys(e).length>0;){var n=t.shift();if(null==n)return e;e=l((0,O.bubbleFormats)(n),e)}return e});return T.default.apply(T.default,o)}},{key:"getText",value:function(t,e){return this.getContents(t,e).filter(function(t){return"string"==typeof t.insert}).map(function(t){return t.insert}).join("")}},{key:"insertEmbed",value:function(t,e,n){return this.scroll.insertAt(t,e,n),this.update((new h.default).retain(t).insert(o({},e,n)))}},{key:"insertText",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(r).forEach(function(o){n.scroll.formatAt(t,e.length,o,r[o])}),this.update((new h.default).retain(t).insert(e,(0,N.default)(r)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var t=this.scroll.children.head;return t.statics.blotName===w.default.blotName&&(!(t.children.length>1)&&t.children.head instanceof k.default)}},{key:"removeFormat",value:function(t,e){var n=this.getText(t,e),r=this.scroll.line(t+e),o=u(r,2),i=o[0],l=o[1],a=0,s=new h.default;null!=i&&(a=i instanceof g.default?i.newlineIndex(l)-l+1:i.length()-l,s=i.delta().slice(l,l+a-1).insert("\n"));var c=this.getContents(t,e+a),f=c.diff((new h.default).insert(n).concat(s)),p=(new h.default).retain(t).concat(f);return this.applyDelta(p)}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(P)&&v.default.find(e[0].target)){var o=v.default.find(e[0].target),i=(0,O.bubbleFormats)(o),l=o.offset(this.scroll),a=e[0].oldValue.replace(_.default.CONTENTS,""),s=(new h.default).insert(a),u=(new h.default).insert(o.value());t=(new h.default).retain(l).concat(s.diff(u,n)).reduce(function(t,e){return e.insert?t.insert(e.insert,i):t.push(e)},new h.default),this.delta=r.compose(t)}else this.delta=this.getDelta(),t&&(0,A.default)(r.compose(t),this.delta)||(t=r.diff(this.delta,n));return t}}]),t}();e.default=S},function(t,e){"use strict";function n(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(){this._events=new n,this._eventsCount=0}var i=Object.prototype.hasOwnProperty,l="~";Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(l=!1)),o.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)i.call(t,e)&&n.push(l?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t,e){var n=l?l+t:t,r=this._events[n];if(e)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o0){if(i instanceof y.BlockEmbed||f instanceof y.BlockEmbed)return void this.optimize();if(i instanceof _.default){var h=i.newlineIndex(i.length(),!0);if(h>-1&&(i=i.split(h+1))===f)return void this.optimize()}else if(f instanceof _.default){var p=f.newlineIndex(0);p>-1&&f.split(p+1)}var d=f.children.head instanceof g.default?null:f.children.head;i.moveChildren(f,d),i.remove()}this.optimize()}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",t)}},{key:"formatAt",value:function(t,n,r,o){(null==this.whitelist||this.whitelist[r])&&(c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"formatAt",this).call(this,t,n,r,o),this.optimize())}},{key:"insertAt",value:function(t,n,r){if(null==r||null==this.whitelist||this.whitelist[n]){if(t>=this.length())if(null==r||null==h.default.query(n,h.default.Scope.BLOCK)){var o=h.default.create(this.statics.defaultChild);this.appendChild(o),null==r&&n.endsWith("\n")&&(n=n.slice(0,-1)),o.insertAt(0,n,r)}else{var i=h.default.create(n,r);this.appendChild(i)}else c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertAt",this).call(this,t,n,r);this.optimize()}}},{key:"insertBefore",value:function(t,n){if(t.statics.scope===h.default.Scope.INLINE_BLOT){var r=h.default.create(this.statics.defaultChild);r.appendChild(t),t=r}c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,n)}},{key:"leaf",value:function(t){return this.path(t).pop()||[null,-1]}},{key:"line",value:function(t){return t===this.length()?this.line(t-1):this.descendant(a,t)}},{key:"lines",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return function t(e,n,r){var o=[],i=r;return e.children.forEachAt(n,r,function(e,n,r){a(e)?o.push(e):e instanceof h.default.Container&&(o=o.concat(t(e,n,i))),i-=r}),o}(this,t,e)}},{key:"optimize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t,n),t.length>0&&this.emitter.emit(d.default.events.SCROLL_OPTIMIZE,t,n))}},{key:"path",value:function(t){return c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"path",this).call(this,t).slice(1)}},{key:"update",value:function(t){if(!0!==this.batch){var n=d.default.sources.USER;"string"==typeof t&&(n=t),Array.isArray(t)||(t=this.observer.takeRecords()),t.length>0&&this.emitter.emit(d.default.events.SCROLL_BEFORE_UPDATE,n,t),c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"update",this).call(this,t.concat([])),t.length>0&&this.emitter.emit(d.default.events.SCROLL_UPDATE,n,t)}}}]),e}(h.default.Scroll);x.blotName="scroll",x.className="ql-editor",x.tagName="DIV",x.defaultChild="block",x.allowedChildren=[v.default,y.BlockEmbed,w.default],e.default=x},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e,n){return"object"===(void 0===e?"undefined":x(e))?Object.keys(e).reduce(function(t,n){return s(t,n,e[n])},t):t.reduce(function(t,r){return r.attributes&&r.attributes[e]?t.push(r):t.insert(r.insert,(0,j.default)({},o({},e,n),r.attributes))},new q.default)}function u(t){if(t.nodeType!==Node.ELEMENT_NODE)return{};return t["__ql-computed-style"]||(t["__ql-computed-style"]=window.getComputedStyle(t))}function c(t,e){for(var n="",r=t.ops.length-1;r>=0&&n.length-1}function h(t,e,n){return t.nodeType===t.TEXT_NODE?n.reduce(function(e,n){return n(t,e)},new q.default):t.nodeType===t.ELEMENT_NODE?[].reduce.call(t.childNodes||[],function(r,o){var i=h(o,e,n);return o.nodeType===t.ELEMENT_NODE&&(i=e.reduce(function(t,e){return e(o,t)},i),i=(o[W]||[]).reduce(function(t,e){return e(o,t)},i)),r.concat(i)},new q.default):new q.default}function p(t,e,n){return s(n,t,!0)}function d(t,e){var n=P.default.Attributor.Attribute.keys(t),r=P.default.Attributor.Class.keys(t),o=P.default.Attributor.Style.keys(t),i={};return n.concat(r).concat(o).forEach(function(e){var n=P.default.query(e,P.default.Scope.ATTRIBUTE);null!=n&&(i[n.attrName]=n.value(t),i[n.attrName])||(n=Y[e],null==n||n.attrName!==e&&n.keyName!==e||(i[n.attrName]=n.value(t)||void 0),null==(n=X[e])||n.attrName!==e&&n.keyName!==e||(n=X[e],i[n.attrName]=n.value(t)||void 0))}),Object.keys(i).length>0&&(e=s(e,i)),e}function y(t,e){var n=P.default.query(t);if(null==n)return e;if(n.prototype instanceof P.default.Embed){var r={},o=n.value(t);null!=o&&(r[n.blotName]=o,e=(new q.default).insert(r,n.formats(t)))}else"function"==typeof n.formats&&(e=s(e,n.blotName,n.formats(t)));return e}function v(t,e){return c(e,"\n")||e.insert("\n"),e}function b(){return new q.default}function g(t,e){var n=P.default.query(t);if(null==n||"list-item"!==n.blotName||!c(e,"\n"))return e;for(var r=-1,o=t.parentNode;!o.classList.contains("ql-clipboard");)"list"===(P.default.query(o)||{}).blotName&&(r+=1),o=o.parentNode;return r<=0?e:e.compose((new q.default).retain(e.length()-1).retain(1,{indent:r}))}function m(t,e){return c(e,"\n")||(f(t)||e.length()>0&&t.nextSibling&&f(t.nextSibling))&&e.insert("\n"),e}function _(t,e){if(f(t)&&null!=t.nextElementSibling&&!c(e,"\n\n")){var n=t.offsetHeight+parseFloat(u(t).marginTop)+parseFloat(u(t).marginBottom);t.nextElementSibling.offsetTop>t.offsetTop+1.5*n&&e.insert("\n")}return e}function O(t,e){var n={},r=t.style||{};return r.fontStyle&&"italic"===u(t).fontStyle&&(n.italic=!0),r.fontWeight&&(u(t).fontWeight.startsWith("bold")||parseInt(u(t).fontWeight)>=700)&&(n.bold=!0),Object.keys(n).length>0&&(e=s(e,n)),parseFloat(r.textIndent||0)>0&&(e=(new q.default).insert("\t").concat(e)),e}function w(t,e){var n=t.data;if("O:P"===t.parentNode.tagName)return e.insert(n.trim());if(0===n.trim().length&&t.parentNode.classList.contains("ql-clipboard"))return e;if(!u(t.parentNode).whiteSpace.startsWith("pre")){var r=function(t,e){return e=e.replace(/[^\u00a0]/g,""),e.length<1&&t?" ":e};n=n.replace(/\r\n/g," ").replace(/\n/g," "),n=n.replace(/\s\s+/g,r.bind(r,!0)),(null==t.previousSibling&&f(t.parentNode)||null!=t.previousSibling&&f(t.previousSibling))&&(n=n.replace(/^\s+/,r.bind(r,!1))),(null==t.nextSibling&&f(t.parentNode)||null!=t.nextSibling&&f(t.nextSibling))&&(n=n.replace(/\s+$/,r.bind(r,!1)))}return e.insert(n)}Object.defineProperty(e,"__esModule",{value:!0}),e.matchText=e.matchSpacing=e.matchNewline=e.matchBlot=e.matchAttributor=e.default=void 0;var x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),E=function(){function t(t,e){for(var n=0;n\r?\n +\<"),this.convert();var e=this.quill.getFormat(this.quill.selection.savedRange.index);if(e[F.default.blotName]){var n=this.container.innerText;return this.container.innerHTML="",(new q.default).insert(n,o({},F.default.blotName,e[F.default.blotName]))}var r=this.prepareMatching(),i=k(r,2),l=i[0],a=i[1],s=h(this.container,l,a);return c(s,"\n")&&null==s.ops[s.ops.length-1].attributes&&(s=s.compose((new q.default).retain(s.length()-1).delete(1))),Z.log("convert",this.container.innerHTML,s),this.container.innerHTML="",s}},{key:"dangerouslyPasteHTML",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default.sources.API;if("string"==typeof t)this.quill.setContents(this.convert(t),e),this.quill.setSelection(0,C.default.sources.SILENT);else{var r=this.convert(e);this.quill.updateContents((new q.default).retain(t).concat(r),n),this.quill.setSelection(t+r.length(),C.default.sources.SILENT)}}},{key:"onPaste",value:function(t){var e=this;if(!t.defaultPrevented&&this.quill.isEnabled()){var n=this.quill.getSelection(),r=(new q.default).retain(n.index),o=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(C.default.sources.SILENT),setTimeout(function(){r=r.concat(e.convert()).delete(n.length),e.quill.updateContents(r,C.default.sources.USER),e.quill.setSelection(r.length()-n.length,C.default.sources.SILENT),e.quill.scrollingContainer.scrollTop=o,e.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var t=this,e=[],n=[];return this.matchers.forEach(function(r){var o=k(r,2),i=o[0],l=o[1];switch(i){case Node.TEXT_NODE:n.push(l);break;case Node.ELEMENT_NODE:e.push(l);break;default:[].forEach.call(t.container.querySelectorAll(i),function(t){t[W]=t[W]||[],t[W].push(l)})}}),[e,n]}}]),e}(I.default);$.DEFAULTS={matchers:[],matchVisual:!0},e.default=$,e.matchAttributor=d,e.matchBlot=y,e.matchNewline=m,e.matchSpacing=_,e.matchText=w},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=t.ops[t.ops.length-1];return null!=e&&(null!=e.insert?"string"==typeof e.insert&&e.insert.endsWith("\n"):null!=e.attributes&&Object.keys(e.attributes).some(function(t){return null!=f.default.query(t,f.default.Scope.BLOCK)}))}function s(t){var e=t.reduce(function(t,e){return t+=e.delete||0},0),n=t.length()-e;return a(t)&&(n-=1),n}Object.defineProperty(e,"__esModule",{value:!0}),e.getLastChangeIndex=e.default=void 0;var u=function(){function t(t,e){for(var n=0;nr&&this.stack.undo.length>0){var o=this.stack.undo.pop();n=n.compose(o.undo),t=o.redo.compose(t)}else this.lastRecorded=r;this.stack.undo.push({redo:t,undo:n}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(t){this.stack.undo.forEach(function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)}),this.stack.redo.forEach(function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),e}(y.default);v.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},e.default=v,e.getLastChangeIndex=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.IndentClass=void 0;var l=function(){function t(t,e){for(var n=0;n0&&this.children.tail.format(t,e)}},{key:"formats",value:function(){return o({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(t,n){if(t instanceof v)u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,n);else{var r=null==n?this.length():n.offset(this),o=this.split(r);o.parent.insertBefore(t,o)}}},{key:"optimize",value:function(t){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&n.domNode.tagName===this.domNode.tagName&&n.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(n.moveChildren(this),n.remove())}},{key:"replace",value:function(t){if(t.statics.blotName!==this.statics.blotName){var n=f.default.create(this.statics.defaultChild);t.moveChildren(n),this.appendChild(n)}u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t)}}]),e}(y.default);b.blotName="list",b.scope=f.default.Scope.BLOCK_BLOT,b.tagName=["OL","UL"],b.defaultChild="list-item",b.allowedChildren=[v],e.ListItem=v,e.default=b},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(39),a=function(t){return t&&t.__esModule?t:{default:t}}(l),s=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.default);s.blotName="italic",s.tagName=["EM","I"],e.default=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n-1?n?this.domNode.setAttribute(t,n):this.domNode.removeAttribute(t):a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n)}}],[{key:"create",value:function(t){var n=a(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return"string"==typeof t&&n.setAttribute("src",this.sanitize(t)),n}},{key:"formats",value:function(t){return f.reduce(function(e,n){return t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e},{})}},{key:"match",value:function(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}},{key:"sanitize",value:function(t){return(0,c.sanitize)(t,["http","https","data"])?t:"//:0"}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(u.default.Embed);h.blotName="image",h.tagName="IMG",e.default=h},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n-1?n?this.domNode.setAttribute(t,n):this.domNode.removeAttribute(t):a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n)}}],[{key:"create",value:function(t){var n=a(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",!0),n.setAttribute("src",this.sanitize(t)),n}},{key:"formats",value:function(t){return f.reduce(function(e,n){return t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e},{})}},{key:"sanitize",value:function(t){return c.default.sanitize(t)}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(s.BlockEmbed);h.blotName="video",h.className="ql-video",h.tagName="IFRAME",e.default=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.FormulaBlot=void 0;var a=function(){function t(t,e){for(var n=0;n0||null==this.cachedText)&&(this.domNode.innerHTML=t(e),this.domNode.normalize(),this.attach()),this.cachedText=e)}}]),e}(v.default);b.className="ql-syntax";var g=new c.default.Attributor.Class("token","hljs",{scope:c.default.Scope.INLINE}),m=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));if("function"!=typeof r.options.highlight)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var l=null;return r.quill.on(h.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(l),l=setTimeout(function(){r.highlight(),l=null},r.options.interval)}),r.highlight(),r}return l(e,t),a(e,null,[{key:"register",value:function(){h.default.register(g,!0),h.default.register(b,!0)}}]),a(e,[{key:"highlight",value:function(){var t=this;if(!this.quill.selection.composing){this.quill.update(h.default.sources.USER);var e=this.quill.getSelection();this.quill.scroll.descendants(b).forEach(function(e){e.highlight(t.options.highlight)}),this.quill.update(h.default.sources.SILENT),null!=e&&this.quill.setSelection(e,h.default.sources.SILENT)}}}]),e}(d.default);m.DEFAULTS={highlight:function(){return null==window.hljs?null:function(t){return window.hljs.highlightAuto(t).value}}(),interval:1e3},e.CodeBlock=b,e.CodeToken=g,e.default=m},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e,n){var r=document.createElement("button");r.setAttribute("type","button"),r.classList.add("ql-"+e),null!=n&&(r.value=n),t.appendChild(r)}function u(t,e){Array.isArray(e[0])||(e=[e]),e.forEach(function(e){var n=document.createElement("span");n.classList.add("ql-formats"),e.forEach(function(t){if("string"==typeof t)s(n,t);else{var e=Object.keys(t)[0],r=t[e];Array.isArray(r)?c(n,e,r):s(n,e,r)}}),t.appendChild(n)})}function c(t,e,n){var r=document.createElement("select");r.classList.add("ql-"+e),n.forEach(function(t){var e=document.createElement("option");!1!==t?e.setAttribute("value",t):e.setAttribute("selected","selected"),r.appendChild(e)}),t.appendChild(r)}Object.defineProperty(e,"__esModule",{value:!0}),e.addControls=e.default=void 0;var f=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function t(t,e){for(var n=0;n '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e){t.exports=' '},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BubbleTooltip=void 0;var a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=function(){function t(t,e){for(var n=0;n0&&o===h.default.sources.USER){r.show(),r.root.style.left="0px",r.root.style.width="",r.root.style.width=r.root.offsetWidth+"px";var i=r.quill.getLines(e.index,e.length);if(1===i.length)r.position(r.quill.getBounds(e));else{var l=i[i.length-1],a=r.quill.getIndex(l),s=Math.min(l.length()-1,e.index+e.length-a),u=r.quill.getBounds(new y.Range(a,s));r.position(u)}}else document.activeElement!==r.textbox&&r.quill.hasFocus()&&r.hide()}),r}return l(e,t),s(e,[{key:"listen",value:function(){var t=this;a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){t.root.classList.remove("ql-editing")}),this.quill.on(h.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!t.root.classList.contains("ql-hidden")){var e=t.quill.getSelection();null!=e&&t.position(t.quill.getBounds(e))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(t){var n=a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"position",this).call(this,t),r=this.root.querySelector(".ql-tooltip-arrow");if(r.style.marginLeft="",0===n)return n;r.style.marginLeft=-1*n-r.offsetWidth/2+"px"}}]),e}(p.BaseTooltip);_.TEMPLATE=['','
','','',"
"].join(""),e.BubbleTooltip=_,e.default=m},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=function(){function t(t,e){for(var n=0;n','','',''].join(""),e.default=w}]).default}); diff --git a/pages/workFlow/allAppWorkFlow/index.vue b/pages/workFlow/allAppWorkFlow/index.vue new file mode 100644 index 0000000..b375c33 --- /dev/null +++ b/pages/workFlow/allAppWorkFlow/index.vue @@ -0,0 +1,293 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/assistantMsg/viewData.vue b/pages/workFlow/assistantMsg/viewData.vue new file mode 100644 index 0000000..6517541 --- /dev/null +++ b/pages/workFlow/assistantMsg/viewData.vue @@ -0,0 +1,165 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/candiDateUserSelect/index.vue b/pages/workFlow/candiDateUserSelect/index.vue new file mode 100644 index 0000000..587538a --- /dev/null +++ b/pages/workFlow/candiDateUserSelect/index.vue @@ -0,0 +1,291 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/comment/comment-file/index.vue b/pages/workFlow/comment/comment-file/index.vue new file mode 100644 index 0000000..55b43d8 --- /dev/null +++ b/pages/workFlow/comment/comment-file/index.vue @@ -0,0 +1,400 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/comment/comment-file/lsj-upload/LsjFile.js b/pages/workFlow/comment/comment-file/lsj-upload/LsjFile.js new file mode 100644 index 0000000..e6b8a91 --- /dev/null +++ b/pages/workFlow/comment/comment-file/lsj-upload/LsjFile.js @@ -0,0 +1,432 @@ +export class LsjFile { + constructor(data) { + this.dom = null; + // files.type = waiting(等待上传)|| loading(上传中)|| success(成功) || fail(失败) + this.files = new Map(); + this.debug = data.debug || false; + this.id = data.id; + this.width = data.width; + this.height = data.height; + this.option = data.option; + this.instantly = data.instantly; + this.prohibited = data.prohibited; + this.onchange = data.onchange; + this.onprogress = data.onprogress; + this.uploadHandle = this._uploadHandle; + // #ifdef MP-WEIXIN + this.uploadHandle = this._uploadHandleWX; + // #endif + } + + + /** + * 创建File节点 + * @param {string}path webview地址 + */ + create(path) { + if (!this.dom) { + // #ifdef H5 + let dom = document.createElement('input'); + dom.type = 'file' + dom.value = '' + dom.style.height = this.height + dom.style.width = this.width + dom.style.position = 'absolute' + dom.style.top = 0 + dom.style.left = 0 + dom.style.right = 0 + dom.style.bottom = 0 + dom.style.opacity = 0 + dom.style.zIndex = 900 + dom.accept = this.prohibited.accept; + if (this.prohibited.multiple) { + dom.multiple = 'multiple'; + } + dom.onchange = event => { + for (let file of event.target.files) { + if (this.files.size >= this.prohibited.count) { + this.toast(`最多可以上传${this.prohibited.count}个文件`); + this.dom.value = ''; + break; + } + this.addFile(file); + } + + this._uploadAfter(); + + this.dom.value = ''; + }; + this.dom = dom; + // #endif + + // #ifdef APP-PLUS + let styles = { + top: '-200px', + left: 0, + width: '1px', + height: '200px', + background: 'transparent' + }; + let extras = { + debug: this.debug, + instantly: this.instantly, + prohibited: this.prohibited, + } + this.dom = plus.webview.create(path, this.id, styles, extras); + this.setData(this.option); + this._overrideUrlLoading(); + // #endif + return this.dom; + } + } + + + /** + * 设置上传参数 + * @param {object|string}name 上传参数,支持a.b 和 a[b] + */ + setData() { + let [name, value = ''] = arguments; + if (typeof name === 'object') { + Object.assign(this.option, name); + } else { + this._setValue(this.option, name, value); + } + + this.debug && console.log(JSON.stringify(this.option)); + + // #ifdef APP-PLUS + this.dom.evalJS(`vm.setData('${JSON.stringify(this.option)}')`); + // #endif + } + + /** + * 上传 + * @param {string}name 文件名称 + */ + async upload(name = '') { + if (!this.option.url) { + throw Error('未设置上传地址'); + } + + // #ifndef APP-PLUS + if (name && this.files.has(name)) { + await this.uploadHandle(this.files.get(name)); + } else { + for (let item of this.files.values()) { + if (item.type === 'waiting' || item.type === 'fail') { + await this.uploadHandle(item); + } + } + } + // #endif + + // #ifdef APP-PLUS + this.dom && this.dom.evalJS(`vm.upload('${name}')`); + // #endif + } + + // 选择文件change + addFile(file, isCallChange) { + + let name = file.name; + this.debug && console.log('文件名称', name, '大小', file.size); + + if (file) { + // 限制文件格式 + let path = ''; + let suffix = name.substring(name.lastIndexOf(".") + 1).toLowerCase(); + let formats = this.prohibited.formats.toLowerCase(); + + + // #ifndef MP-WEIXIN + path = URL.createObjectURL(file); + // #endif + // #ifdef MP-WEIXIN + path = file.path; + // #endif + if (formats && !formats.includes(suffix)) { + this.toast(`不支持上传${suffix.toUpperCase()}格式文件`); + return false; + } + // 限制文件大小 + if (file.size > 1024 * 1024 * Math.abs(this.prohibited.size)) { + this.toast(`文件大小超过${this.prohibited.size}MB`) + return false; + } + this.files.set(file.name, { + file, + path, + name: file.name, + size: file.size, + progress: 0, + type: 'waiting' + }); + return true; + } + } + + /** + * 移除文件 + * @param {string}name 不传name默认移除所有文件,传入name移除指定name的文件 + */ + clear(name = '') { + // #ifdef APP-PLUS + this.dom && this.dom.evalJS(`vm.clear('${name}')`); + // #endif + + if (!name) { + this.files.clear(); + } else { + this.files.delete(name); + } + return this.onchange(this.files); + } + + /** + * 提示框 + * @param {string}msg 轻提示内容 + */ + toast(msg) { + uni.showToast({ + title: msg, + icon: 'none' + }); + } + + /** + * 微信小程序选择文件 + * @param {number}count 可选择文件数量 + */ + chooseMessageFile(type, count) { + wx.chooseMessageFile({ + count: count, + type: type, + success: ({ + tempFiles + }) => { + for (let file of tempFiles) { + this.addFile(file); + } + this._uploadAfter(); + }, + fail: () => { + this.toast(`打开失败`); + } + }) + } + + _copyObject(obj) { + if (typeof obj !== "undefined") { + return JSON.parse(JSON.stringify(obj)); + } else { + return obj; + } + } + + /** + * 自动根据字符串路径设置对象中的值 支持.和[] + * @param {Object} dataObj 数据源 + * @param {String} name 支持a.b 和 a[b] + * @param {String} value 值 + * setValue(dataObj, name, value); + */ + _setValue(dataObj, name, value) { + // 通过正则表达式 查找路径数据 + let dataValue; + if (typeof value === "object") { + dataValue = this._copyObject(value); + } else { + dataValue = value; + } + let regExp = new RegExp("([\\w$]+)|\\[(:\\d)\\]", "g"); + const patten = name.match(regExp); + // 遍历路径 逐级查找 最后一级用于直接赋值 + for (let i = 0; i < patten.length - 1; i++) { + let keyName = patten[i]; + if (typeof dataObj[keyName] !== "object") dataObj[keyName] = {}; + dataObj = dataObj[keyName]; + } + // 最后一级 + dataObj[patten[patten.length - 1]] = dataValue; + this.debug && console.log('参数更新后', JSON.stringify(this.option)); + } + + _uploadAfter() { + this.onchange(this.files); + setTimeout(() => { + this.instantly && this.upload(); + }, 1000) + } + + _overrideUrlLoading() { + this.dom.overrideUrlLoading({ + mode: 'reject' + }, e => { + let { + retype, + item, + files, + end + } = this._getRequest( + e.url + ); + let _this = this; + switch (retype) { + case 'updateOption': + this.dom.evalJS(`vm.setData('${JSON.stringify(_this.option)}')`); + break + case 'change': + try { + _this.files = new Map([..._this.files, ...JSON.parse(unescape(files))]); + } catch (e) { + return console.error('出错了,请检查代码') + } + _this.onchange(_this.files); + break + case 'progress': + try { + item = JSON.parse(unescape(item)); + } catch (e) { + return console.error('出错了,请检查代码') + } + _this._changeFilesItem(item, end); + break + default: + break + } + }) + } + + _getRequest(url) { + let theRequest = new Object() + let index = url.indexOf('?') + if (index != -1) { + let str = url.substring(index + 1) + let strs = str.split('&') + for (let i = 0; i < strs.length; i++) { + theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1]) + } + } + return theRequest + } + + _changeFilesItem(item, end = false) { + this.debug && console.log('onprogress', JSON.stringify(item)); + this.onprogress(item, end); + this.files.set(item.name, item); + } + + _uploadHandle(item) { + item.type = 'loading'; + delete item.responseText; + return new Promise((resolve, reject) => { + this.debug && console.log('option', JSON.stringify(this.option)); + let { + url, + name, + method = 'POST', + header, + formData, + data + } = this.option; + let form = new FormData(); + for (let keys in formData) { + form.append(keys, formData[keys]) + } + for (let keys in data) { + form.append(keys, data[keys]) + } + form.append(name, item.file); + let xmlRequest = new XMLHttpRequest(); + xmlRequest.open(method, url, true); + for (let keys in header) { + xmlRequest.setRequestHeader(keys, header[keys]) + } + + xmlRequest.upload.addEventListener( + 'progress', + event => { + if (event.lengthComputable) { + let progress = Math.ceil((event.loaded * 100) / event.total) + if (progress <= 100) { + item.progress = progress; + this._changeFilesItem(item); + } + } + }, + false + ); + + xmlRequest.ontimeout = () => { + console.error('请求超时') + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + + xmlRequest.onreadystatechange = ev => { + if (xmlRequest.readyState == 4) { + if (xmlRequest.status == 200) { + this.debug && console.log('上传完成:' + xmlRequest.responseText) + item['responseText'] = xmlRequest.responseText; + item.type = 'success'; + this._changeFilesItem(item, true); + return resolve(true); + } else if (xmlRequest.status == 0) { + console.error( + 'status = 0 :请检查请求头Content-Type与服务端是否匹配,服务端已正确开启跨域,并且nginx未拦截阻止请求') + } + console.error('--ERROR--:status = ' + xmlRequest.status) + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + } + xmlRequest.send(form) + }); + } + + _uploadHandleWX(item) { + item.type = 'loading'; + delete item.responseText; + return new Promise((resolve, reject) => { + this.debug && console.log('option', JSON.stringify(this.option)); + let form = { + filePath: item.file.path, + ...this.option, + formData: this.option.data || {}, + }; + form['fail'] = ({ + errMsg = '' + }) => { + console.error('--ERROR--:' + errMsg) + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + form['success'] = res => { + if (res.statusCode == 200) { + this.debug && console.log('上传完成,微信端返回不一定是字符串,根据接口返回格式判断是否需要JSON.parse:' + res.data) + item['responseText'] = res.data; + item.type = 'success'; + this._changeFilesItem(item, true); + return resolve(true); + } + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + + let xmlRequest = uni.uploadFile(form); + xmlRequest.onProgressUpdate(({ + progress = 0 + }) => { + if (progress <= 100) { + item.progress = progress; + this._changeFilesItem(item); + } + }) + }); + } +} diff --git a/pages/workFlow/comment/comment-file/lsj-upload/lsj-upload.vue b/pages/workFlow/comment/comment-file/lsj-upload/lsj-upload.vue new file mode 100644 index 0000000..93d93c6 --- /dev/null +++ b/pages/workFlow/comment/comment-file/lsj-upload/lsj-upload.vue @@ -0,0 +1,399 @@ + + + + + diff --git a/pages/workFlow/comment/comment-user-select/index.vue b/pages/workFlow/comment/comment-user-select/index.vue new file mode 100644 index 0000000..a10a696 --- /dev/null +++ b/pages/workFlow/comment/comment-user-select/index.vue @@ -0,0 +1,340 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/comment/index.vue b/pages/workFlow/comment/index.vue new file mode 100644 index 0000000..679d228 --- /dev/null +++ b/pages/workFlow/comment/index.vue @@ -0,0 +1,680 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/components/CandidateForm.vue b/pages/workFlow/components/CandidateForm.vue new file mode 100644 index 0000000..2340adf --- /dev/null +++ b/pages/workFlow/components/CandidateForm.vue @@ -0,0 +1,196 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/components/ErrorForm.vue b/pages/workFlow/components/ErrorForm.vue new file mode 100644 index 0000000..df027e9 --- /dev/null +++ b/pages/workFlow/components/ErrorForm.vue @@ -0,0 +1,92 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/components/RecordTimeList/ProcessComments.vue b/pages/workFlow/components/RecordTimeList/ProcessComments.vue new file mode 100644 index 0000000..05f650f --- /dev/null +++ b/pages/workFlow/components/RecordTimeList/ProcessComments.vue @@ -0,0 +1,280 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/components/RecordTimeList/TaskLogModal.vue b/pages/workFlow/components/RecordTimeList/TaskLogModal.vue new file mode 100644 index 0000000..0499c34 --- /dev/null +++ b/pages/workFlow/components/RecordTimeList/TaskLogModal.vue @@ -0,0 +1,125 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/components/RecordTimeList/TimeLine.vue b/pages/workFlow/components/RecordTimeList/TimeLine.vue new file mode 100644 index 0000000..2dde0ed --- /dev/null +++ b/pages/workFlow/components/RecordTimeList/TimeLine.vue @@ -0,0 +1,300 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/components/RecordTimeList/TimeLinePopup.vue b/pages/workFlow/components/RecordTimeList/TimeLinePopup.vue new file mode 100644 index 0000000..6d29fc7 --- /dev/null +++ b/pages/workFlow/components/RecordTimeList/TimeLinePopup.vue @@ -0,0 +1,173 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/components/RecordTimeList/fileList.vue b/pages/workFlow/components/RecordTimeList/fileList.vue new file mode 100644 index 0000000..655c372 --- /dev/null +++ b/pages/workFlow/components/RecordTimeList/fileList.vue @@ -0,0 +1,125 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/components/RecordTimeList/index.vue b/pages/workFlow/components/RecordTimeList/index.vue new file mode 100644 index 0000000..921aff0 --- /dev/null +++ b/pages/workFlow/components/RecordTimeList/index.vue @@ -0,0 +1,228 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/components/fileList.vue b/pages/workFlow/components/fileList.vue new file mode 100644 index 0000000..3717dc6 --- /dev/null +++ b/pages/workFlow/components/fileList.vue @@ -0,0 +1,126 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/components/flowBtn.vue b/pages/workFlow/components/flowBtn.vue new file mode 100644 index 0000000..87dd8d8 --- /dev/null +++ b/pages/workFlow/components/flowBtn.vue @@ -0,0 +1,150 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/components/flowStep.vue b/pages/workFlow/components/flowStep.vue new file mode 100644 index 0000000..59d4a50 --- /dev/null +++ b/pages/workFlow/components/flowStep.vue @@ -0,0 +1,372 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/document/components/AddFilePopup.vue b/pages/workFlow/document/components/AddFilePopup.vue new file mode 100644 index 0000000..d16fe16 --- /dev/null +++ b/pages/workFlow/document/components/AddFilePopup.vue @@ -0,0 +1,203 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/document/components/DocHead.vue b/pages/workFlow/document/components/DocHead.vue new file mode 100644 index 0000000..b2af699 --- /dev/null +++ b/pages/workFlow/document/components/DocHead.vue @@ -0,0 +1,91 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/document/components/DocList.vue b/pages/workFlow/document/components/DocList.vue new file mode 100644 index 0000000..8594aa5 --- /dev/null +++ b/pages/workFlow/document/components/DocList.vue @@ -0,0 +1,183 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/document/components/navigation/NaviGation.scss b/pages/workFlow/document/components/navigation/NaviGation.scss new file mode 100644 index 0000000..c7bd612 --- /dev/null +++ b/pages/workFlow/document/components/navigation/NaviGation.scss @@ -0,0 +1,28 @@ +// 导航栏标题 +.title { + height: 90rpx; + padding: 0 32rpx; + line-height: 90rpx; + font-size: 30rpx; + background-color: #f5f5f5; + color: #606064; + // 导航栏图标样式 + .iconclass { + display: inline-block; + margin: 0 12rpx; + color: #D0D4DB; + font-size: 28rpx; + } +} +// 导航栏项样式 +.inline-item { + display: inline-block +} +// 导航栏项-启用状态 +.active { + color: #4297ED !important; +} +// 导航栏项-无状态 +.none { + color: #666666; +} diff --git a/pages/workFlow/document/components/navigation/NaviGation.vue b/pages/workFlow/document/components/navigation/NaviGation.vue new file mode 100644 index 0000000..af2b058 --- /dev/null +++ b/pages/workFlow/document/components/navigation/NaviGation.vue @@ -0,0 +1,168 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/document/components/navigation/icon.css b/pages/workFlow/document/components/navigation/icon.css new file mode 100644 index 0000000..83fda8f --- /dev/null +++ b/pages/workFlow/document/components/navigation/icon.css @@ -0,0 +1,342 @@ +@font-face { + font-family: "iconfont"; /* Project id 2009600 */ + src: url('https://at.alicdn.com/t/font_2009600_gpzp7pxtnw.woff2?t=1620633089023') format('woff2'), + url('https://at.alicdn.com/t/font_2009600_gpzp7pxtnw.woff?t=1620633089023') format('woff'), + url('https://at.alicdn.com/t/font_2009600_gpzp7pxtnw.ttf?t=1620633089023') format('truetype'); +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-banxuanzhongshousuo1-shi:before { + content: "\e682"; +} + +.icon-xuanzhong3:before { + content: "\e6bb"; +} + +.icon-weixuanzhong2:before { + content: "\e62e"; +} + +.icon-danxuanxuanzhong:before { + content: "\e631"; +} + +.icon-xuanzhong4:before { + content: "\e63e"; +} + +.icon-xuanzhong1:before { + content: "\e62d"; +} + +.icon-xuanzhong2:before { + content: "\e656"; +} + +.icon-selected:before { + content: "\e615"; +} + +.icon-weixuanzhong1:before { + content: "\e614"; +} + +.icon-xingzhuang6kaobei3-copy-copy:before { + content: "\e613"; +} + +.icon-radio-checked:before { + content: "\e63f"; +} + +.icon-huifu:before { + content: "\e619"; +} + +.icon-dizhi:before { + content: "\e64a"; +} + +.icon-kuaijiecaidan:before { + content: "\e60a"; +} + +.icon-z043:before { + content: "\e62f"; +} + +.icon-guanbi:before { + content: "\e607"; +} + +.icon-xuanze:before { + content: "\e623"; +} + +.icon-caidanzhaolinggan:before { + content: "\e616"; +} + +.icon-xitongshezhi:before { + content: "\e60c"; +} + +.icon-xitongshezhi1:before { + content: "\e633"; +} + +.icon-lunbo:before { + content: "\e692"; +} + +.icon-shuping:before { + content: "\e659"; +} + +.icon-tongzhi:before { + content: "\e641"; +} + +.icon-pinglunguanlishezhi:before { + content: "\e6ac"; +} + +.icon-icon:before { + content: "\e600"; +} + +.icon-liuyanguanli:before { + content: "\e61d"; +} + +.icon-xuanzhong:before { + content: "\e669"; +} + +.icon--:before { + content: "\e622"; +} + +.icon-tushu:before { + content: "\e604"; +} + +.icon-huishouzhan:before { + content: "\e61c"; +} + +.icon-yonghutouxiang:before { + content: "\e617"; +} + +.icon-liebiao:before { + content: "\e630"; +} + +.icon-fenlei:before { + content: "\e621"; +} + +.icon-tushu1:before { + content: "\e605"; +} + +.icon-tubiao-:before { + content: "\e620"; +} + +.icon-weixuanze:before { + content: "\e624"; +} + +.icon-tushujieyue:before { + content: "\e690"; +} + +.icon-lunbo1:before { + content: "\e6c5"; +} + +.icon-shanchu:before { + content: "\e67b"; +} + +.icon-lunbo2:before { + content: "\e61e"; +} + +.icon-huaban:before { + content: "\e663"; +} + +.icon-kehuan:before { + content: "\e608"; +} + +.icon-icon02:before { + content: "\e601"; +} + +.icon-huishouzhan1:before { + content: "\e612"; +} + +.icon-huishouzhan2:before { + content: "\e63d"; +} + +.icon-sousuo:before { + content: "\e62c"; +} + +.icon-xingzhuang:before { + content: "\e625"; +} + +.icon-lunbobankuai:before { + content: "\e61f"; +} + +.icon-shangchuan:before { + content: "\e602"; +} + +.icon-yonghu:before { + content: "\e761"; +} + +.icon-tongzhi1:before { + content: "\e603"; +} + +.icon-jingsong:before { + content: "\e65c"; +} + +.icon-fenlei1:before { + content: "\e6c6"; +} + +.icon-xieshupingicon:before { + content: "\e72d"; +} + +.icon-liuyan:before { + content: "\e626"; +} + +.icon-weixuanzhong:before { + content: "\e627"; +} + +.icon-youxiang:before { + content: "\e646"; +} + +.icon-lunboguanggao:before { + content: "\e6b3"; +} + +.icon-xuanze1:before { + content: "\e60d"; +} + +.icon-chushaixuanxiang:before { + content: "\e606"; +} + +.icon-liuyanguanli1:before { + content: "\e61a"; +} + +.icon-shanchu1:before { + content: "\e609"; +} + +.icon-huishouzhan3:before { + content: "\e642"; +} + +.icon-shangchuan1:before { + content: "\e823"; +} + +.icon-huishouzhan4:before { + content: "\e61b"; +} + +.icon-chuangzuo:before { + content: "\e8ad"; +} + +.icon-dianzan:before { + content: "\e8ae"; +} + +.icon-paihangbang:before { + content: "\e8b3"; +} + +.icon-shouye:before { + content: "\e8b9"; +} + +.icon-shoucang:before { + content: "\e8c6"; +} + +.icon-addApp:before { + content: "\e60b"; +} + +.icon-huishouzhan5:before { + content: "\e63a"; +} + +.icon-add1:before { + content: "\e60e"; +} + +.icon-shoucang1:before { + content: "\e60f"; +} + +.icon-canshutongji:before { + content: "\e618"; +} + +.icon-rizhiguanli:before { + content: "\e628"; +} + +.icon-shanchu2:before { + content: "\e629"; +} + +.icon-xinzeng:before { + content: "\e62a"; +} + +.icon-zhankailiebiao:before { + content: "\e62b"; +} + +.icon-xiala-copy:before { + content: "\e610"; +} + +.icon-shangla:before { + content: "\e64e"; +} + +.icon-xianxingshezhi:before { + content: "\e611"; +} diff --git a/pages/workFlow/document/detail.vue b/pages/workFlow/document/detail.vue new file mode 100644 index 0000000..011dc25 --- /dev/null +++ b/pages/workFlow/document/detail.vue @@ -0,0 +1,309 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/document/index.vue b/pages/workFlow/document/index.vue new file mode 100644 index 0000000..2d3ddc9 --- /dev/null +++ b/pages/workFlow/document/index.vue @@ -0,0 +1,298 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/document/mixin.js b/pages/workFlow/document/mixin.js new file mode 100644 index 0000000..1fb2ed7 --- /dev/null +++ b/pages/workFlow/document/mixin.js @@ -0,0 +1,541 @@ +import { + getDocumentList, + packDownload, + resetFileName, + batchDelete, + trash, + recovery, + trashDelete, + folderTree, + folderMove, + addFolder, + shareFolder, + shareFolderList, + shareTome, + shareUser, + shareAdjustment, + cancelShare, + fileDetail +} from "@/api/workFlow/document"; +import resources from "@/libs/resources.js"; +import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js"; +import jnpf from '@/utils/jnpf' +const wordTypeList = ['doc', 'docx']; +const excelTypeList = ['xls', 'xlsx']; +const pptTypeList = ['ppt', 'pptx']; +const pdfTypeList = ['pdf']; +const zipTypeList = ['rar', 'zip', 'arj', 'z', '7z']; +const txtTypeList = ['txt', 'log']; +const codeTypeList = ['html', 'cs', 'xml']; +const imgTypeList = ['png', 'jpg', 'jpeg', 'bmp', 'gif']; +const videoTypeList = ['avi', 'wmv', 'mpg', 'mpeg', 'mov', 'rm', 'ram', 'swf', 'flv', 'mp4', 'mp3', 'wma', 'avi', 'rm', + 'rmvb', 'flv', 'mpg', 'mkv' +]; +const previewTypeList = [...wordTypeList, ...excelTypeList, ...pptTypeList, ...pdfTypeList]; +export default { + mixins: [MescrollMixin], + data() { + return { + usersSelectValue: '', + isDetail: true, + showApply: false, + folderTreeList: [], + modalValue: '', + keyword: '', + current: 0, + show: false, + slide: '', + slide2: '', + changeStyle: true, + checkedAll: false, + parentId: 0, + wordImg: resources.document.wordImg, + excelImg: resources.document.excelImg, + pptImg: resources.document.pptImg, + pdfImg: resources.document.pdfImg, + rarImg: resources.document.rarImg, + txtImg: resources.document.txtImg, + codeImg: resources.document.codeImg, + imageImg: resources.document.imageImg, + audioImg: resources.document.audioImg, + blankImg: resources.document.blankImg, + folderImg: resources.document.folderImg, + downOption: { + use: true, + auto: true, + }, + upOption: { + page: { + num: 0, + size: 50, + time: null, + }, + empty: { + use: true, + icon: resources.message.nodata, + tip: this.$t('common.noData'), + fixed: false, + top: "560rpx", + }, + textNoMore: this.$t('app.apply.noMoreData'), + toTop: { + bottom: 200, + right: 80 + } + }, + selectFolder: {}, + moveId: '', + selectFiles: [], + modalType: 'restName', + showAddSelect: false, + selector: [{ + fullName: '新建文件夹', + id: 1, + icon: 'icon-ym icon-ym-add-folder' + }, + { + fullName: '上传文件', + id: 2, + icon: 'icon-ym icon-ym-generator-menu' + } + ], + isDetail: false + } + }, + computed: { + baseURL() { + return this.define.baseURL + }, + modalTitle() { + return this.modalType === 'restName' ? '重命名文件' : '新建文件夹' + } + }, + methods: { + onCallback(e) { + this.$u.toast(e.msg) + setTimeout(() => { + this.showAddSelect = false + this.resetList() + }, 1000) + }, + addSelect(item) { + if (item == 'add') { + this.showAddSelect = false + this.$refs.inputDialog.open('center') + this.modalType = 'addFolder' + } + }, + addFolder() { + this.modalValue = '' + this.showAddSelect = true + }, + shareSubmit(e) { + let method = this.current === 1 ? shareAdjustment : shareFolder; + let data = { + ids: this.selectFiles, + userIds: e + } + method(data).then(res => { + this.resetList() + }) + }, + upCallback(page) { + let method; + switch (this.current) { + case 1: + method = shareFolderList + break; + case 3: + method = trash + break; + case 2: + method = shareTome + break; + default: + method = getDocumentList + break; + } + let query = { + keyword: this.keyword, + parentId: this.parentId + }; + method(query).then(res => { + this.documentList = []; + this.selectFiles = [] + const timeMap = ['creatorTime', 'shareTime', 'shareTime', 'deleteTime']; + const useTime = timeMap[this.current] ?? 'creatorTime'; // 添加默认值 + const list = res.data.list.map(o => ({ + ...o, + time: o[useTime] + })); + this.documentList = this.documentList.concat(list); + this.mescroll.endSuccess(list.length); + }) + }, + downLoad(id) { + let data = { + ids: id ? id : this.selectFiles + } + packDownload(JSON.stringify(data)).then(res => { + // #ifdef H5 + const fileUrl = this.baseURL + res.data.url + '&name=' + encodeURI(res.data.name); + window.location.href = fileUrl; + // #endif + + // #ifdef MP-WEIXIN + this.previewFile(res.data) + // #endif + + // #ifndef H5 || MP + this.downloadFile(res.data); + // #endif + }) + }, + handelClick(item) { + this.moveId = item.id == '-1' ? 0 : item.id + }, + downloadFile(data) { + const { + url, + name + } = data; + const fileExt = name.split('.').pop().toLowerCase(); + const handleDownload = () => { + uni.downloadFile({ + url: `${this.baseURL}${url}&name=${name}`, + success: (res) => { + if (res.statusCode !== 200) return this.$u.toast('文件下载失败'); + + // #ifdef APP-HARMONY + openDocument(res.tempFilePath) + // #endif + + // #ifndef APP-HARMONY + if (plus.os.name == 'iOS') { + openDocument(res.tempFilePath) + return + } + + /* 安卓 */ + uni.saveFile({ + tempFilePath: res.tempFilePath, + success: red => { + uni.showToast({ + icon: 'none', + mask: true, + title: '文件已保存:' + red.savedFilePath, //保存路径 + duration: 3000, + }); + }, + fail(err) { + console.log(err, 547); + } + }); + // #endif + }, + fail: (err) => { + this.$u.toast('文件下载失败'); + } + }) + } + + const openDocument = (filePath) => { + uni.openDocument({ + filePath, + showMenu: true, + success: () => {}, + fail: (err) => { + console.error('打开文档失败:', err); + this.$u.toast('文件打开失败'); + } + }); + } + handleDownload(); + }, + previewFile(item) { + let fileTypes = ['doc', 'xls', 'ppt', 'pdf', 'docx', 'xlsx', 'pptx', 'txt'] + let fileType = item.name.split('.')[1] + if (fileTypes.includes(fileType)) { + uni.downloadFile({ + url: `${this.baseURL}${ item.url}&name=${item.name}`, + success: (res) => { + let filePath = res.tempFilePath; + uni.openDocument({ + filePath, + showMenu: true, + success: (res) => {} + }); + } + }); + } else { + this.$u.toast('该文件类型无法打开') + } + }, + checkboxChange(e) { + if (e.length) { + this.slide = 'slide-up' + this.slide2 = 'slide-up2' + const { + platform + } = uni.getSystemInfoSync() + if (platform === 'ios' && this.current == 2) return this.show = false + this.show = true + } else { + this.slide = 'slide-down' + this.slide2 = 'slide-down2' + } + this.selectOperation(e) + }, + change(e) { + this.current = e + this.parentId = 0 + this.resetList() + }, + bottomfun(type) { + if (type === 'down') this.downLoad() + if (type === 'restName') { + fileDetail(this.selectFiles[0]).then(res => { + this.modalValue = res?.data?.fullName || '' + this.modalType = 'restName' + this.$refs.inputDialog.open() + }) + } + if (type === 'checkAll') this.checkedAllFun() + if (type === 'revert') this.recoveryOrDelete(type) + if (type === 'delete') this.recoveryOrDelete(type) + if (type === 'share') { + if (this.current == 1) return this.shareUser() + this.usersSelectValue = '' + this.$nextTick(() => { + this.$refs.JnpfUsersSelect.openSelect() + }) + } + if (type === 'shareCancel') return this.cancelShare() + if (type === 'move') this.getFolderTree() + if (type === 'cancel') { + this.selectFiles = [] + this.selectOperation(this.selectFiles) + } + }, + cancelShare() { + uni.showModal({ + title: '提示', + content: '您确定要取消共享, 是否继续?', + success: (res) => { + if (res.confirm) { + cancelShare({ + ids: this.selectFiles + }).then(res => { + this.$u.toast(res.msg) + this.resetList() + }) + } + } + }); + }, + shareUser() { + shareUser(this.selectFiles[0]).then(res => { + let list = res.data.list || [] + const ids = list.map(item => item.shareUserId); + this.usersSelectValue = ids + this.$nextTick(() => { + this.$refs.JnpfUsersSelect.openSelect() + }) + }) + }, + folderMove() { + let data = { + ids: this.selectFiles, + id: this.moveId + } + folderMove(data).then(res => { + this.selectFiles = [] + this.close() + this.resetList() + }) + }, + iconClick() { + if (this.documentList.length) this.changeStyle = !this.changeStyle + }, + + close() { + this.showApply = false + }, + checkedAllFun() { + this.checkedAll = !this.checkedAll + this.selectFiles = []; + this.documentList.forEach(o => { + if (this.checkedAll) { + this.$set(o, 'checked', true) + this.selectFiles.push(o.id); + } else { + this.$set(o, 'checked', false) + this.selectFiles = []; + } + }) + }, + goDetail(e) { + if (e.type == 0 && this.current != 3) { + if (!this.isDetail) { + let item = { + current: this.current, + changeStyle: this.changeStyle, + ...e + } + this.selectFiles = [] + this.selectOperation() + uni.navigateTo({ + url: './detail?config=' + JSON.stringify(item), + }); + } else { + this.parentId = e.id + this.setTitle(e.fullName) + this.pushTreeStack(e); + this.resetList() + } + } else { + if (imgTypeList.includes(e.fileExtension)) { + const images = jnpf.getAuthImgUrl(e.uploaderUrl, false); + uni.previewImage({ + urls: [images], + success: (res) => {}, + fail: (err) => { + uni.showToast({ + title: '预览图片失败', + icon: 'none' + }); + } + }); + return + } + if (this.current !== 3) this.downLoad([e.id]) + } + }, + selectOperation(value) { + let items = this.documentList; + this.selectFiles = value || []; + for (let i = 0, lenI = items.length; i < lenI; ++i) { + const item = items[i] + if (this.selectFiles.includes(item.id)) { + this.$set(item, 'checked', true) + } else { + this.$set(item, 'checked', false) + } + } + }, + getRecordImg(ext) { + if (!ext) return this.folderImg; + if (ext) ext = ext.replace('.', ''); + if (wordTypeList.includes(ext)) return this.wordImg; + if (excelTypeList.includes(ext)) return this.excelImg; + if (pptTypeList.includes(ext)) return this.pptImg; + if (pdfTypeList.includes(ext)) return this.pdfImg; + if (zipTypeList.includes(ext)) return this.rarImg; + if (txtTypeList.includes(ext)) return this.txtImg; + if (codeTypeList.includes(ext)) return this.codeImg; + if (imgTypeList.includes(ext)) return this.imageImg; + if (videoTypeList.includes(ext)) return this.audioImg; + return this.blankImg; + }, + getFolderTree() { + let data = { + ids: this.selectFiles + } + folderTree(data).then(res => { + this.showApply = true + this.folderTreeList = JSON.parse(JSON.stringify(res.data.list)) || [] + const loop = (list, parent) => { + list.forEach(o => { + o.icon = 'icon-ym icon-ym-folder'; + if (o && o.children && Array.isArray(o.children)) { + loop(o.children, o) + } + }) + } + loop(this.folderTreeList) + }) + }, + recoveryOrDelete(type) { + let data = { + ids: this.selectFiles + } + let content = '确定要还原选中的文件吗' + let method = recovery + if (type !== 'revert') { + content = '删除后,放入回收站!' + method = batchDelete + if (type === 'delete' && this.current == 3) { + content = '删除后数据无法恢复' + method = trashDelete + } + } + uni.showModal({ + title: '提示', + content, + success: (res) => { + if (res.confirm) { + this.$nextTick(() => { + method(JSON.stringify(data)).then(res => { + this.$u.toast(res.msg) + setTimeout(() => { + this.$nextTick(() => { + this.documentList = []; + this.selectFiles = [] + this.mescroll.resetUpScroll(); + }) + }, 1000) + }) + }) + } + } + }); + }, + /* 新建文件 */ + handleAddFolder() { + let item = { + id: '', + parentId: this.parentId, + type: 0, + fullName: this.modalValue + } + addFolder(item).then(res => { + this.modalType = 'restName' + this.closeDialog() + this.resetList() + }) + }, + /* 重命名 */ + closeDialog() { + this.$refs.inputDialog.close() + }, + restName(e) { + let txt = this.modalType === 'addFolder' ? '文件夹名称不能为空' : '文件名不能为空' + if (!this.modalValue) return this.$u.toast(txt) + if (this.modalType === 'addFolder') return this.handleAddFolder() + if (this.modalType === 'restName') return this.handleRestName() + }, + handleRestName() { + let item = {} + this.documentList.forEach(o => { + if (o.id === this.selectFiles[0]) item = { + id: o.id, + parentId: this.parentId, + type: o.type, + fullName: this.modalValue + } + }) + resetFileName(item).then(res => { + this.selectFiles = [] + this.closeDialog() + this.resetList() + }) + }, + resetList() { + this.$nextTick(() => { + this.selectFiles = [] + this.documentList = []; + this.mescroll.resetUpScroll(); + }) + }, + } +} \ No newline at end of file diff --git a/pages/workFlow/document/static/audio.png b/pages/workFlow/document/static/audio.png new file mode 100644 index 0000000..1262602 Binary files /dev/null and b/pages/workFlow/document/static/audio.png differ diff --git a/pages/workFlow/document/static/blank.png b/pages/workFlow/document/static/blank.png new file mode 100644 index 0000000..b36caf0 Binary files /dev/null and b/pages/workFlow/document/static/blank.png differ diff --git a/pages/workFlow/document/static/code.png b/pages/workFlow/document/static/code.png new file mode 100644 index 0000000..2e2301b Binary files /dev/null and b/pages/workFlow/document/static/code.png differ diff --git a/pages/workFlow/document/static/excel.png b/pages/workFlow/document/static/excel.png new file mode 100644 index 0000000..c04510d Binary files /dev/null and b/pages/workFlow/document/static/excel.png differ diff --git a/pages/workFlow/document/static/folder.png b/pages/workFlow/document/static/folder.png new file mode 100644 index 0000000..9503008 Binary files /dev/null and b/pages/workFlow/document/static/folder.png differ diff --git a/pages/workFlow/document/static/image.png b/pages/workFlow/document/static/image.png new file mode 100644 index 0000000..8889ff7 Binary files /dev/null and b/pages/workFlow/document/static/image.png differ diff --git a/pages/workFlow/document/static/pdf.png b/pages/workFlow/document/static/pdf.png new file mode 100644 index 0000000..c1adbee Binary files /dev/null and b/pages/workFlow/document/static/pdf.png differ diff --git a/pages/workFlow/document/static/ppt.png b/pages/workFlow/document/static/ppt.png new file mode 100644 index 0000000..0b4766f Binary files /dev/null and b/pages/workFlow/document/static/ppt.png differ diff --git a/pages/workFlow/document/static/rar.png b/pages/workFlow/document/static/rar.png new file mode 100644 index 0000000..e5ff105 Binary files /dev/null and b/pages/workFlow/document/static/rar.png differ diff --git a/pages/workFlow/document/static/txt.png b/pages/workFlow/document/static/txt.png new file mode 100644 index 0000000..9b438b7 Binary files /dev/null and b/pages/workFlow/document/static/txt.png differ diff --git a/pages/workFlow/document/static/word.png b/pages/workFlow/document/static/word.png new file mode 100644 index 0000000..98e2d43 Binary files /dev/null and b/pages/workFlow/document/static/word.png differ diff --git a/pages/workFlow/entrustAgent/components/flowSelect/Select.vue b/pages/workFlow/entrustAgent/components/flowSelect/Select.vue new file mode 100644 index 0000000..1e0c14e --- /dev/null +++ b/pages/workFlow/entrustAgent/components/flowSelect/Select.vue @@ -0,0 +1,292 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/entrustAgent/components/flowSelect/index.vue b/pages/workFlow/entrustAgent/components/flowSelect/index.vue new file mode 100644 index 0000000..6f88740 --- /dev/null +++ b/pages/workFlow/entrustAgent/components/flowSelect/index.vue @@ -0,0 +1,111 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/entrustAgent/components/userSelect/SelectPopup.vue b/pages/workFlow/entrustAgent/components/userSelect/SelectPopup.vue new file mode 100644 index 0000000..8e2835e --- /dev/null +++ b/pages/workFlow/entrustAgent/components/userSelect/SelectPopup.vue @@ -0,0 +1,244 @@ + + \ No newline at end of file diff --git a/pages/workFlow/entrustAgent/components/userSelect/index.vue b/pages/workFlow/entrustAgent/components/userSelect/index.vue new file mode 100644 index 0000000..6f186ee --- /dev/null +++ b/pages/workFlow/entrustAgent/components/userSelect/index.vue @@ -0,0 +1,96 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/entrustAgent/detail.vue b/pages/workFlow/entrustAgent/detail.vue new file mode 100644 index 0000000..3994be8 --- /dev/null +++ b/pages/workFlow/entrustAgent/detail.vue @@ -0,0 +1,198 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/entrustAgent/form.vue b/pages/workFlow/entrustAgent/form.vue new file mode 100644 index 0000000..340ffd1 --- /dev/null +++ b/pages/workFlow/entrustAgent/form.vue @@ -0,0 +1,295 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/entrustAgent/index.vue b/pages/workFlow/entrustAgent/index.vue new file mode 100644 index 0000000..8a58a3f --- /dev/null +++ b/pages/workFlow/entrustAgent/index.vue @@ -0,0 +1,340 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/filePreview/index.vue b/pages/workFlow/filePreview/index.vue new file mode 100644 index 0000000..254afb3 --- /dev/null +++ b/pages/workFlow/filePreview/index.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/flowBefore/emoji.js b/pages/workFlow/flowBefore/emoji.js new file mode 100644 index 0000000..75a6e70 --- /dev/null +++ b/pages/workFlow/flowBefore/emoji.js @@ -0,0 +1,988 @@ +const emojiTree = [ + [{ + "url": "100.gif", + "alt": "[微笑]" + }, + { + "url": "101.gif", + "alt": "[伤心]" + }, + { + "url": "102.gif", + "alt": "[美女]" + }, + { + "url": "103.gif", + "alt": "[发呆]" + }, + { + "url": "104.gif", + "alt": "[墨镜]" + }, + { + "url": "105.gif", + "alt": "[哭]" + }, + { + "url": "106.gif", + "alt": "[羞]" + }, + { + "url": "107.gif", + "alt": "[哑]" + }, + { + "url": "108.gif", + "alt": "[睡]" + }, + { + "url": "109.gif", + "alt": "[大哭]" + }, + { + "url": "110.gif", + "alt": "[囧]" + }, + { + "url": "111.gif", + "alt": "[怒]" + }, + { + "url": "112.gif", + "alt": "[调皮]" + }, + { + "url": "113.gif", + "alt": "[呲牙]" + }, + { + "url": "114.gif", + "alt": "[惊讶]" + }, + { + "url": "115.gif", + "alt": "[难过]" + }, + { + "url": "116.gif", + "alt": "[酷]" + }, + { + "url": "117.gif", + "alt": "[汗]" + }, + { + "url": "118.gif", + "alt": "[抓狂]" + }, + { + "url": "119.gif", + "alt": "[吐]" + }, + { + "url": "120.gif", + "alt": "[笑]" + }, + { + "url": "121.gif", + "alt": "[快乐]" + }, + { + "url": "122.gif", + "alt": "[疑惑]" + }, + { + "url": "123.gif", + "alt": "[傲]" + } + ], + [{ + "url": "124.gif", + "alt": "[饿]" + }, + { + "url": "125.gif", + "alt": "[累]" + }, + { + "url": "126.gif", + "alt": "[惊恐]" + }, + { + "url": "127.gif", + "alt": "[汗1]" + }, + { + "url": "128.gif", + "alt": "[高兴]" + }, + { + "url": "129.gif", + "alt": "[闲]" + }, + { + "url": "130.gif", + "alt": "[努力]" + }, + { + "url": "131.gif", + "alt": "[骂]" + }, + { + "url": "132.gif", + "alt": "[疑问]" + }, + { + "url": "133.gif", + "alt": "[秘密]" + }, + { + "url": "134.gif", + "alt": "[乱]" + }, + { + "url": "135.gif", + "alt": "[疯]" + }, + { + "url": "136.gif", + "alt": "[哀]" + }, + { + "url": "137.gif", + "alt": "[鬼]" + }, + { + "url": "138.gif", + "alt": "[打击]" + }, + { + "url": "139.gif", + "alt": "[bye]" + }, + { + "url": "140.gif", + "alt": "[擦汗]" + }, + { + "url": "141.gif", + "alt": "[抠]" + }, + { + "url": "142.gif", + "alt": "[鼓掌]" + }, + { + "url": "143.gif", + "alt": "[糟糕]" + }, + { + "url": "144.gif", + "alt": "[恶搞]" + }, + { + "url": "145.gif", + "alt": "[左哼哼]" + }, + { + "url": "146.gif", + "alt": "[右哼哼]" + }, + { + "url": "147.gif", + "alt": "[哈欠]" + } + ], + [{ + "url": "148.gif", + "alt": "[看]" + }, + { + "url": "149.gif", + "alt": "[委屈]" + }, + { + "url": "150.gif", + "alt": "[难过1]" + }, + { + "url": "151.gif", + "alt": "[坏]" + }, + { + "url": "152.gif", + "alt": "[亲]" + }, + { + "url": "153.gif", + "alt": "[吓]" + }, + { + "url": "154.gif", + "alt": "[可怜]" + }, + { + "url": "155.gif", + "alt": "[刀]" + }, + { + "url": "156.gif", + "alt": "[水果]" + }, + { + "url": "157.gif", + "alt": "[酒]" + }, + { + "url": "158.gif", + "alt": "[篮球]" + }, + { + "url": "159.gif", + "alt": "[乒乓]" + }, + { + "url": "160.gif", + "alt": "[咖啡]" + }, + { + "url": "161.gif", + "alt": "[美食]" + }, + { + "url": "162.gif", + "alt": "[动物]" + }, + { + "url": "163.gif", + "alt": "[鲜花]" + }, + { + "url": "164.gif", + "alt": "[枯]" + }, + { + "url": "165.gif", + "alt": "[唇]" + }, + { + "url": "166.gif", + "alt": "[爱]" + }, + { + "url": "167.gif", + "alt": "[分手]" + }, + { + "url": "168.gif", + "alt": "[生日]" + }, + { + "url": "169.gif", + "alt": "[电]" + }, + { + "url": "170.gif", + "alt": "[炸弹]" + }, + { + "url": "171.gif", + "alt": "[刀子]" + } + ], + [{ + "url": "172.gif", + "alt": "[足球]" + }, + { + "url": "173.gif", + "alt": "[瓢虫]" + }, + { + "url": "174.gif", + "alt": "[翔]" + }, + { + "url": "175.gif", + "alt": "[月亮]" + }, + { + "url": "176.gif", + "alt": "[太阳]" + }, + { + "url": "177.gif", + "alt": "[礼物]" + }, + { + "url": "178.gif", + "alt": "[抱抱]" + }, + { + "url": "179.gif", + "alt": "[拇指]" + }, + { + "url": "180.gif", + "alt": "[贬低]" + }, + { + "url": "181.gif", + "alt": "[握手]" + }, + { + "url": "182.gif", + "alt": "[剪刀手]" + }, + { + "url": "183.gif", + "alt": "[抱拳]" + }, + { + "url": "184.gif", + "alt": "[勾引]" + }, + { + "url": "185.gif", + "alt": "[拳头]" + }, + { + "url": "186.gif", + "alt": "[小拇指]" + }, + { + "url": "187.gif", + "alt": "[拇指八]" + }, + { + "url": "188.gif", + "alt": "[食指]" + }, + { + "url": "189.gif", + "alt": "[ok]" + }, + { + "url": "190.gif", + "alt": "[情侣]" + }, + { + "url": "191.gif", + "alt": "[爱心]" + }, + { + "url": "192.gif", + "alt": "[蹦哒]" + }, + { + "url": "193.gif", + "alt": "[颤抖]" + }, + { + "url": "194.gif", + "alt": "[怄气]" + }, + { + "url": "195.gif", + "alt": "[跳舞]" + } + ], + [{ + "url": "196.gif", + "alt": "[拜]" + }, + { + "url": "197.gif", + "alt": "[背着]" + }, + { + "url": "198.gif", + "alt": "[伸手]" + }, + { + "url": "199.gif", + "alt": "[耍帅]" + }, + { + "url": "200.png", + "alt": "[微笑1]" + }, + { + "url": "201.png", + "alt": "[生病]" + }, + { + "url": "202.png", + "alt": "[哭泣]" + }, + { + "url": "203.png", + "alt": "[吐舌]" + }, + { + "url": "204.png", + "alt": "[迷糊]" + }, + { + "url": "205.png", + "alt": "[瞪眼]" + }, + { + "url": "206.png", + "alt": "[恐怖]" + }, + { + "url": "207.png", + "alt": "[忧愁]" + }, + { + "url": "208.png", + "alt": "[眨眉]" + }, + { + "url": "209.png", + "alt": "[闭眼]" + }, + { + "url": "210.png", + "alt": "[鄙视]" + }, + { + "url": "211.png", + "alt": "[阴暗]" + }, + { + "url": "212.png", + "alt": "[小鬼]" + }, + { + "url": "213.png", + "alt": "[爱心1]" + }, + { + "url": "214.png", + "alt": "[拜佛]" + }, + { + "url": "215.png", + "alt": "[力量]" + }, + { + "url": "216.png", + "alt": "[金钱]" + }, + { + "url": "217.png", + "alt": "[蛋糕]" + }, + { + "url": "218.png", + "alt": "[彩带]" + }, + { + "url": "219.png", + "alt": "[礼物1]" + } + ] +] +const emojiList = [{ + "url": "100.gif", + "alt": "[微笑]" + }, + { + "url": "101.gif", + "alt": "[伤心]" + }, + { + "url": "102.gif", + "alt": "[美女]" + }, + { + "url": "103.gif", + "alt": "[发呆]" + }, + { + "url": "104.gif", + "alt": "[墨镜]" + }, + { + "url": "105.gif", + "alt": "[哭]" + }, + { + "url": "106.gif", + "alt": "[羞]" + }, + { + "url": "107.gif", + "alt": "[哑]" + }, + { + "url": "108.gif", + "alt": "[睡]" + }, + { + "url": "109.gif", + "alt": "[大哭]" + }, + { + "url": "110.gif", + "alt": "[囧]" + }, + { + "url": "111.gif", + "alt": "[怒]" + }, + { + "url": "112.gif", + "alt": "[调皮]" + }, + { + "url": "113.gif", + "alt": "[呲牙]" + }, + { + "url": "114.gif", + "alt": "[惊讶]" + }, + { + "url": "115.gif", + "alt": "[难过]" + }, + { + "url": "116.gif", + "alt": "[酷]" + }, + { + "url": "117.gif", + "alt": "[汗]" + }, + { + "url": "118.gif", + "alt": "[抓狂]" + }, + { + "url": "119.gif", + "alt": "[吐]" + }, + { + "url": "120.gif", + "alt": "[笑]" + }, + { + "url": "121.gif", + "alt": "[快乐]" + }, + { + "url": "122.gif", + "alt": "[疑惑]" + }, + { + "url": "123.gif", + "alt": "[傲]" + }, + { + "url": "124.gif", + "alt": "[饿]" + }, + { + "url": "125.gif", + "alt": "[累]" + }, + { + "url": "126.gif", + "alt": "[惊恐]" + }, + { + "url": "127.gif", + "alt": "[汗1]" + }, + { + "url": "128.gif", + "alt": "[高兴]" + }, + { + "url": "129.gif", + "alt": "[闲]" + }, + { + "url": "130.gif", + "alt": "[努力]" + }, + { + "url": "131.gif", + "alt": "[骂]" + }, + { + "url": "132.gif", + "alt": "[疑问]" + }, + { + "url": "133.gif", + "alt": "[秘密]" + }, + { + "url": "134.gif", + "alt": "[乱]" + }, + { + "url": "135.gif", + "alt": "[疯]" + }, + { + "url": "136.gif", + "alt": "[哀]" + }, + { + "url": "137.gif", + "alt": "[鬼]" + }, + { + "url": "138.gif", + "alt": "[打击]" + }, + { + "url": "139.gif", + "alt": "[bye]" + }, + { + "url": "140.gif", + "alt": "[擦汗]" + }, + { + "url": "141.gif", + "alt": "[抠]" + }, + { + "url": "142.gif", + "alt": "[鼓掌]" + }, + { + "url": "143.gif", + "alt": "[糟糕]" + }, + { + "url": "144.gif", + "alt": "[恶搞]" + }, + { + "url": "145.gif", + "alt": "[左哼哼]" + }, + { + "url": "146.gif", + "alt": "[右哼哼]" + }, + { + "url": "147.gif", + "alt": "[哈欠]" + }, + { + "url": "148.gif", + "alt": "[看]" + }, + { + "url": "149.gif", + "alt": "[委屈]" + }, + { + "url": "150.gif", + "alt": "[难过1]" + }, + { + "url": "151.gif", + "alt": "[坏]" + }, + { + "url": "152.gif", + "alt": "[亲]" + }, + { + "url": "153.gif", + "alt": "[吓]" + }, + { + "url": "154.gif", + "alt": "[可怜]" + }, + { + "url": "155.gif", + "alt": "[刀]" + }, + { + "url": "156.gif", + "alt": "[水果]" + }, + { + "url": "157.gif", + "alt": "[酒]" + }, + { + "url": "158.gif", + "alt": "[篮球]" + }, + { + "url": "159.gif", + "alt": "[乒乓]" + }, + { + "url": "160.gif", + "alt": "[咖啡]" + }, + { + "url": "161.gif", + "alt": "[美食]" + }, + { + "url": "162.gif", + "alt": "[动物]" + }, + { + "url": "163.gif", + "alt": "[鲜花]" + }, + { + "url": "164.gif", + "alt": "[枯]" + }, + { + "url": "165.gif", + "alt": "[唇]" + }, + { + "url": "166.gif", + "alt": "[爱]" + }, + { + "url": "167.gif", + "alt": "[分手]" + }, + { + "url": "168.gif", + "alt": "[生日]" + }, + { + "url": "169.gif", + "alt": "[电]" + }, + { + "url": "170.gif", + "alt": "[炸弹]" + }, + { + "url": "171.gif", + "alt": "[刀子]" + }, + { + "url": "172.gif", + "alt": "[足球]" + }, + { + "url": "173.gif", + "alt": "[瓢虫]" + }, + { + "url": "174.gif", + "alt": "[翔]" + }, + { + "url": "175.gif", + "alt": "[月亮]" + }, + { + "url": "176.gif", + "alt": "[太阳]" + }, + { + "url": "177.gif", + "alt": "[礼物]" + }, + { + "url": "178.gif", + "alt": "[抱抱]" + }, + { + "url": "179.gif", + "alt": "[拇指]" + }, + { + "url": "180.gif", + "alt": "[贬低]" + }, + { + "url": "181.gif", + "alt": "[握手]" + }, + { + "url": "182.gif", + "alt": "[剪刀手]" + }, + { + "url": "183.gif", + "alt": "[抱拳]" + }, + { + "url": "184.gif", + "alt": "[勾引]" + }, + { + "url": "185.gif", + "alt": "[拳头]" + }, + { + "url": "186.gif", + "alt": "[小拇指]" + }, + { + "url": "187.gif", + "alt": "[拇指八]" + }, + { + "url": "188.gif", + "alt": "[食指]" + }, + { + "url": "189.gif", + "alt": "[ok]" + }, + { + "url": "190.gif", + "alt": "[情侣]" + }, + { + "url": "191.gif", + "alt": "[爱心]" + }, + { + "url": "192.gif", + "alt": "[蹦哒]" + }, + { + "url": "193.gif", + "alt": "[颤抖]" + }, + { + "url": "194.gif", + "alt": "[怄气]" + }, + { + "url": "195.gif", + "alt": "[跳舞]" + }, + { + "url": "196.gif", + "alt": "[拜]" + }, + { + "url": "197.gif", + "alt": "[背着]" + }, + { + "url": "198.gif", + "alt": "[伸手]" + }, + { + "url": "199.gif", + "alt": "[耍帅]" + }, + { + "url": "200.png", + "alt": "[微笑1]" + }, + { + "url": "201.png", + "alt": "[生病]" + }, + { + "url": "202.png", + "alt": "[哭泣]" + }, + { + "url": "203.png", + "alt": "[吐舌]" + }, + { + "url": "204.png", + "alt": "[迷糊]" + }, + { + "url": "205.png", + "alt": "[瞪眼]" + }, + { + "url": "206.png", + "alt": "[恐怖]" + }, + { + "url": "207.png", + "alt": "[忧愁]" + }, + { + "url": "208.png", + "alt": "[眨眉]" + }, + { + "url": "209.png", + "alt": "[闭眼]" + }, + { + "url": "210.png", + "alt": "[鄙视]" + }, + { + "url": "211.png", + "alt": "[阴暗]" + }, + { + "url": "212.png", + "alt": "[小鬼]" + }, + { + "url": "213.png", + "alt": "[爱心1]" + }, + { + "url": "214.png", + "alt": "[拜佛]" + }, + { + "url": "215.png", + "alt": "[力量]" + }, + { + "url": "216.png", + "alt": "[金钱]" + }, + { + "url": "217.png", + "alt": "[蛋糕]" + }, + { + "url": "218.png", + "alt": "[彩带]" + }, + { + "url": "219.png", + "alt": "[礼物1]" + } +] + +const req = import.meta.glob('../static/emoji/*.*', { + eager: true +}) + +const imagesMap = {} + +// 循环所有图片,将图片名设置成键,值为导入该图片的地址 +for (const key in req) { + // let name = key.split('/').slice(-1)[0].split('.')[0] + let name = key.split('/').slice(-1)[0].replace('.', '') + // 抛出图片大对象后,文件页面直接引入后将图片的具体名称作为属性就能导入该图片 + imagesMap[name] = req[key].default +} + +export { + emojiList, + emojiTree, + imagesMap +} \ No newline at end of file diff --git a/pages/workFlow/flowBefore/flowForm.vue b/pages/workFlow/flowBefore/flowForm.vue new file mode 100644 index 0000000..b19f1cf --- /dev/null +++ b/pages/workFlow/flowBefore/flowForm.vue @@ -0,0 +1,525 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/flowBefore/form.vue b/pages/workFlow/flowBefore/form.vue new file mode 100644 index 0000000..df0dfb0 --- /dev/null +++ b/pages/workFlow/flowBefore/form.vue @@ -0,0 +1,48 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/flowBefore/index.vue b/pages/workFlow/flowBefore/index.vue new file mode 100644 index 0000000..e25425c --- /dev/null +++ b/pages/workFlow/flowBefore/index.vue @@ -0,0 +1,1538 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/flowBefore/logError.vue b/pages/workFlow/flowBefore/logError.vue new file mode 100644 index 0000000..5405062 --- /dev/null +++ b/pages/workFlow/flowBefore/logError.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/flowBefore/revokeForm.vue b/pages/workFlow/flowBefore/revokeForm.vue new file mode 100644 index 0000000..1aab234 --- /dev/null +++ b/pages/workFlow/flowBefore/revokeForm.vue @@ -0,0 +1,519 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/flowTodo/FlowMixin.js b/pages/workFlow/flowTodo/FlowMixin.js new file mode 100644 index 0000000..8a213a0 --- /dev/null +++ b/pages/workFlow/flowTodo/FlowMixin.js @@ -0,0 +1,269 @@ +/** + * opType + * -1 - 我发起的新建/编辑 + * 0 - 我发起的详情 + * 1 - 待签事宜 + * 2 - 待办事宜 + * 3 - 在办事宜 + * 4 - 已办事宜 + * 5 - 抄送事宜 + * 6 - 流程监控 + */ +const statusMap = { + 1: [{ + name: '全部', + status: '' + }, + { + name: '协办', + status: '7' + }, + { + name: '退回', + status: '5' + }, + { + name: '超时', + status: '-2' + } + ], + 2: [{ + name: '全部', + status: '' + }, + { + name: '协办', + status: '7' + }, + { + name: '退回', + status: '5' + }, + { + name: '超时', + status: '-2' + } + ], + 3: [{ + name: '全部', + status: '' + }, + { + name: '待提交', + status: '0' + }, + { + name: '进行中', + status: '1' + }, + { + name: '已完成', + status: '2' + } + ], + 4: [{ + name: '全部', + status: '' + }, + { + name: '同意', + status: '1' + }, + { + name: '拒绝', + status: '2' + }, + { + name: '转审', + status: '3' + }, + { + name: '加签', + status: '4' + }, + { + name: '退回', + status: '5' + } + ], + 5: [{ + name: '全部', + status: '' + }, + { + name: '已读', + status: '1' + }, + { + name: '未读', + status: '0' + } + ] +}; + +import { + getOperatorList, + getFlowLaunchList +} from '@/api/workFlow/template' +export default { + data() { + return { + mescrollTop: 206, + statusList: [], + tabsList: [{ + fullName: '在办', + category: '2', + key: 2, + enCode: "workFlow.flowDoing" + }, { + fullName: '发起', + category: null, + key: 3, + enCode: "workFlow.flowLaunch" + }, { + fullName: '已办', + category: '3', + key: 4, + enCode: "workFlow.flowDone" + }, { + fullName: '抄送', + category: '4', + key: 5, + enCode: "workFlow.flowCirculate" + }], + current: 0, + subsectionIndex: 0, + status: '', + sysConfigInfo: {}, + menuList: [] + } + }, + watch: { + current: { + handler(val) { + if (this.sysConfigInfo.flowSign == 1 && val == 0) { + this.statusList = [] + this.mescrollTop = 206 / 2 + return + } + this.statusList = statusMap[this.tabsList[val].key] + this.mescrollTop = 322 / 2 + this.category = this.tabsList[this.current].category + }, + immediate: true, + deep: true + }, + }, + onLoad(e) { + this.config = e?.data && JSON.parse(decodeURIComponent(e?.data)) + this.sysConfigInfo = uni.getStorageSync('sysConfigInfo') || {} + this.addTabList() + /* 从门户来到工作流 */ + if (e?.data) this.fromPortal() + }, + methods: { + addTabList() { + const configToCheck = [{ + key: 'flowTodo', + tab: { + fullName: '待办', + category: '1', + key: 1, + enCode: "workFlow.flowTodo" + } + }, + { + key: 'flowSign', + tab: { + fullName: '待签', + category: '0', + key: 0, + enCode: "workFlow.flowToSign" + } + } + ]; + configToCheck.forEach(config => { + if (this.sysConfigInfo[config.key] === 1) return this.tabsList.unshift(config.tab); + }); + this.menuList = uni.getStorageSync("menuList"); + let workFlowList = this.menuList.filter(o => o.enCode === 'workFlow') + if (!workFlowList.length) return + let menuData = workFlowList[0]?.children + this.tabsList = this.tabsList.filter(tab => + menuData.some(menu => menu.enCode === tab.enCode) + ); + }, + fromPortal() { + let i = this.tabsList.findIndex(o => o.key === this.config.tabIndex) + let item = this.tabsList[i] + this.current = i; + this.category = item?.category || null + this.resetUpScroll() + }, + /* tab1 */ + change(index) { + let item = this.tabsList[index] + this.current = index; + this.status = '' + this.keyword = '' + this.subsectionIndex = 0 + this.category = item?.category || null + this.resetUpScroll() + }, + /* tab2 */ + subsection(e) { + let item = this.statusList[e] + this.status = item.status + this.subsectionIndex = e + this.resetUpScroll() + }, + resetUpScroll() { + this.$nextTick(() => { + this.list = []; + this.mescroll.resetUpScroll(); + }) + }, + /* 列表数据 */ + upCallback(page) { + let methods = this.category ? getOperatorList : getFlowLaunchList; + let query = { + currentPage: page.num, + pageSize: page.size, + keyword: this.keyword, + category: this.tabsList[this.current].category, + status: this.status + } + methods(query, { + load: page.num == 1 + }).then(res => { + this.mescroll.endSuccess(res.data.list.length); + if (page.num == 1) this.list = []; + let flowStatus; + const list = res.data.list.map(o => ({ + 'flowStatus': this.getFlowStatus(o.status), + 'opType': this.setOpType(o.status), + 'swipeAction': this.swipeAction(o.status), + ...o + })) + this.list = this.list.concat(list); + }).catch(() => { + this.mescroll.endErr(); + }) + }, + swipeAction(status) { + let swipeAction = true + if (this.tabsList[this.current].key === 3 && !this.category && (status == '0' || status == '9')) + swipeAction = false + return swipeAction + }, + /* 设置opType */ + setOpType(status) { + if (this.tabsList[this.current].key == 3) return status == '0' || status == '9' || status == '8' ? '-1' : 0 + if (this.tabsList[this.current].key == 0) return 1 + if (this.tabsList[this.current].key == 1) return 2 + if (this.tabsList[this.current].key == 2) return 3 + if (this.tabsList[this.current].key == 4) return 4 + if (this.tabsList[this.current].key == 5) return 5 + } + } +} \ No newline at end of file diff --git a/pages/workFlow/flowTodo/flowList.vue b/pages/workFlow/flowTodo/flowList.vue new file mode 100644 index 0000000..aca79a1 --- /dev/null +++ b/pages/workFlow/flowTodo/flowList.vue @@ -0,0 +1,180 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/flowTodo/index.vue b/pages/workFlow/flowTodo/index.vue new file mode 100644 index 0000000..89c7c6c --- /dev/null +++ b/pages/workFlow/flowTodo/index.vue @@ -0,0 +1,172 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/operate/components/CommonList.vue b/pages/workFlow/operate/components/CommonList.vue new file mode 100644 index 0000000..04b3459 --- /dev/null +++ b/pages/workFlow/operate/components/CommonList.vue @@ -0,0 +1,103 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/operate/components/HandleOpinion.vue b/pages/workFlow/operate/components/HandleOpinion.vue new file mode 100644 index 0000000..d5fa7bf --- /dev/null +++ b/pages/workFlow/operate/components/HandleOpinion.vue @@ -0,0 +1,130 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/operate/index.vue b/pages/workFlow/operate/index.vue new file mode 100644 index 0000000..436b5bd --- /dev/null +++ b/pages/workFlow/operate/index.vue @@ -0,0 +1,635 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/operate/revoke.vue b/pages/workFlow/operate/revoke.vue new file mode 100644 index 0000000..b6d6387 --- /dev/null +++ b/pages/workFlow/operate/revoke.vue @@ -0,0 +1,84 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/scanForm/index.vue b/pages/workFlow/scanForm/index.vue new file mode 100644 index 0000000..53f9536 --- /dev/null +++ b/pages/workFlow/scanForm/index.vue @@ -0,0 +1,76 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/calendar/calendar.js b/pages/workFlow/schedule/calendar/calendar.js new file mode 100644 index 0000000..b8d7d6f --- /dev/null +++ b/pages/workFlow/schedule/calendar/calendar.js @@ -0,0 +1,546 @@ +/** +* @1900-2100区间内的公历、农历互转 +* @charset UTF-8 +* @github https://github.com/jjonline/calendar.js +* @Author Jea杨(JJonline@JJonline.Cn) +* @Time 2014-7-21 +* @Time 2016-8-13 Fixed 2033hex、Attribution Annals +* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug +* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year +* @Version 1.0.3 +* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] +* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] +*/ +/* eslint-disable */ +var calendar = { + + /** + * 农历1900-2100的润大小信息表 + * @Array Of Property + * @return Hex + */ + lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909 + 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919 + 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929 + 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939 + 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949 + 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959 + 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969 + 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979 + 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989 + 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999 + 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009 + 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019 + 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029 + 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039 + 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049 + /** Add By JJonline@JJonline.Cn**/ + 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059 + 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069 + 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079 + 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089 + 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099 + 0x0d520], // 2100 + + /** + * 公历每个月份的天数普通表 + * @Array Of Property + * @return Number + */ + solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + + /** + * 天干地支之天干速查表 + * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] + * @return Cn string + */ + Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'], + + /** + * 天干地支之地支速查表 + * @Array Of Property + * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] + * @return Cn string + */ + Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'], + + /** + * 天干地支之地支速查表<=>生肖 + * @Array Of Property + * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] + * @return Cn string + */ + Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'], + + /** + * 24节气速查表 + * @Array Of Property + * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] + * @return Cn string + */ + solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'], + + /** + * 1900-2100各年的24节气日期速查表 + * @Array Of Property + * @return 0x string For splice + */ + sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', + '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', + 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', + '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', + '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', + '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', + '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', + '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', + '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', + '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', + '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', + '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', + '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', + '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', + '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', + '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', + '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', + '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', + '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', + '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', + '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', + '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', + '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', + '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', + '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', + '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', + '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', + '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', + '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', + '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', + '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', + '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', + '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', + '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], + + /** + * 数字转中文速查表 + * @Array Of Property + * @trans ['日','一','二','三','四','五','六','七','八','九','十'] + * @return Cn string + */ + nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'], + + /** + * 日期转农历称呼速查表 + * @Array Of Property + * @trans ['初','十','廿','卅'] + * @return Cn string + */ + nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], + + /** + * 月份转农历称呼速查表 + * @Array Of Property + * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] + * @return Cn string + */ + nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'], + + /** + * 返回农历y年一整年的总天数 + * @param lunar Year + * @return Number + * @eg:var count = calendar.lYearDays(1987) ;//count=387 + */ + lYearDays: function (y) { + var i; var sum = 348 + for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 } + return (sum + this.leapDays(y)) + }, + + /** + * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 + * @param lunar Year + * @return Number (0-12) + * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 + */ + leapMonth: function (y) { // 闰字编码 \u95f0 + return (this.lunarInfo[y - 1900] & 0xf) + }, + + /** + * 返回农历y年闰月的天数 若该年没有闰月则返回0 + * @param lunar Year + * @return Number (0、29、30) + * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 + */ + leapDays: function (y) { + if (this.leapMonth(y)) { + return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29) + } + return (0) + }, + + /** + * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 + * @param lunar Year + * @return Number (-1、29、30) + * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 + */ + monthDays: function (y, m) { + if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1 + return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29) + }, + + /** + * 返回公历(!)y年m月的天数 + * @param solar Year + * @return Number (-1、28、29、30、31) + * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 + */ + solarDays: function (y, m) { + if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 + var ms = m - 1 + if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29 + return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28) + } else { + return (this.solarMonth[ms]) + } + }, + + /** + * 农历年份转换为干支纪年 + * @param lYear 农历年的年份数 + * @return Cn string + */ + toGanZhiYear: function (lYear) { + var ganKey = (lYear - 3) % 10 + var zhiKey = (lYear - 3) % 12 + if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干 + if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支 + return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1] + }, + + /** + * 公历月、日判断所属星座 + * @param cMonth [description] + * @param cDay [description] + * @return Cn string + */ + toAstro: function (cMonth, cDay) { + var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf' + var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22] + return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座 + }, + + /** + * 传入offset偏移量返回干支 + * @param offset 相对甲子的偏移量 + * @return Cn string + */ + toGanZhi: function (offset) { + return this.Gan[offset % 10] + this.Zhi[offset % 12] + }, + + /** + * 传入公历(!)y年获得该年第n个节气的公历日期 + * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 + * @return day Number + * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 + */ + getTerm: function (y, n) { + if (y < 1900 || y > 2100) { return -1 } + if (n < 1 || n > 24) { return -1 } + var _table = this.sTermInfo[y - 1900] + var _info = [ + parseInt('0x' + _table.substr(0, 5)).toString(), + parseInt('0x' + _table.substr(5, 5)).toString(), + parseInt('0x' + _table.substr(10, 5)).toString(), + parseInt('0x' + _table.substr(15, 5)).toString(), + parseInt('0x' + _table.substr(20, 5)).toString(), + parseInt('0x' + _table.substr(25, 5)).toString() + ] + var _calday = [ + _info[0].substr(0, 1), + _info[0].substr(1, 2), + _info[0].substr(3, 1), + _info[0].substr(4, 2), + + _info[1].substr(0, 1), + _info[1].substr(1, 2), + _info[1].substr(3, 1), + _info[1].substr(4, 2), + + _info[2].substr(0, 1), + _info[2].substr(1, 2), + _info[2].substr(3, 1), + _info[2].substr(4, 2), + + _info[3].substr(0, 1), + _info[3].substr(1, 2), + _info[3].substr(3, 1), + _info[3].substr(4, 2), + + _info[4].substr(0, 1), + _info[4].substr(1, 2), + _info[4].substr(3, 1), + _info[4].substr(4, 2), + + _info[5].substr(0, 1), + _info[5].substr(1, 2), + _info[5].substr(3, 1), + _info[5].substr(4, 2) + ] + return parseInt(_calday[n - 1]) + }, + + /** + * 传入农历数字月份返回汉语通俗表示法 + * @param lunar month + * @return Cn string + * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' + */ + toChinaMonth: function (m) { // 月 => \u6708 + if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 + var s = this.nStr3[m - 1] + s += '\u6708'// 加上月字 + return s + }, + + /** + * 传入农历日期数字返回汉字表示法 + * @param lunar day + * @return Cn string + * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' + */ + toChinaDay: function (d) { // 日 => \u65e5 + var s + switch (d) { + case 10: + s = '\u521d\u5341'; break + case 20: + s = '\u4e8c\u5341'; break + break + case 30: + s = '\u4e09\u5341'; break + break + default : + s = this.nStr2[Math.floor(d / 10)] + s += this.nStr1[d % 10] + } + return (s) + }, + + /** + * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” + * @param y year + * @return Cn string + * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' + */ + getAnimal: function (y) { + return this.Animals[(y - 4) % 12] + }, + + /** + * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON + * @param y solar year + * @param m solar month + * @param d solar day + * @return JSON object + * @eg:console.log(calendar.solar2lunar(1987,11,01)); + */ + solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31 + // 年份限定、上限 + if (y < 1900 || y > 2100) { + return -1// undefined转换为数字变为NaN + } + // 公历传参最下限 + if (y == 1900 && m == 1 && d < 31) { + return -1 + } + // 未传参 获得当天 + if (!y) { + var objDate = new Date() + } else { + var objDate = new Date(y, parseInt(m) - 1, d) + } + var i; var leap = 0; var temp = 0 + // 修正ymd参数 + var y = objDate.getFullYear() + var m = objDate.getMonth() + 1 + var d = objDate.getDate() + var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000 + for (i = 1900; i < 2101 && offset > 0; i++) { + temp = this.lYearDays(i) + offset -= temp + } + if (offset < 0) { + offset += temp; i-- + } + + // 是否今天 + var isTodayObj = new Date() + var isToday = false + if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { + isToday = true + } + // 星期几 + var nWeek = objDate.getDay() + var cWeek = this.nStr1[nWeek] + // 数字表示周几顺应天朝周一开始的惯例 + if (nWeek == 0) { + nWeek = 7 + } + // 农历年 + var year = i + var leap = this.leapMonth(i) // 闰哪个月 + var isLeap = false + + // 效验闰月 + for (i = 1; i < 13 && offset > 0; i++) { + // 闰月 + if (leap > 0 && i == (leap + 1) && isLeap == false) { + --i + isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数 + } else { + temp = this.monthDays(year, i)// 计算农历普通月天数 + } + // 解除闰月 + if (isLeap == true && i == (leap + 1)) { isLeap = false } + offset -= temp + } + // 闰月导致数组下标重叠取反 + if (offset == 0 && leap > 0 && i == leap + 1) { + if (isLeap) { + isLeap = false + } else { + isLeap = true; --i + } + } + if (offset < 0) { + offset += temp; --i + } + // 农历月 + var month = i + // 农历日 + var day = offset + 1 + // 天干地支处理 + var sm = m - 1 + var gzY = this.toGanZhiYear(year) + + // 当月的两个节气 + // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` + var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始 + var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始 + + // 依据12节气修正干支月 + var gzM = this.toGanZhi((y - 1900) * 12 + m + 11) + if (d >= firstNode) { + gzM = this.toGanZhi((y - 1900) * 12 + m + 12) + } + + // 传入的日期的节气与否 + var isTerm = false + var Term = null + if (firstNode == d) { + isTerm = true + Term = this.solarTerm[m * 2 - 2] + } + if (secondNode == d) { + isTerm = true + Term = this.solarTerm[m * 2 - 1] + } + // 日柱 当月一日与 1900/1/1 相差天数 + var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10 + var gzD = this.toGanZhi(dayCyclical + d - 1) + // 该日期所属的星座 + var astro = this.toAstro(m, d) + + return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro } + }, + + /** + * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON + * @param y lunar year + * @param m lunar month + * @param d lunar day + * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] + * @return JSON object + * @eg:console.log(calendar.lunar2solar(1987,9,10)); + */ + lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1 + var isLeapMonth = !!isLeapMonth + var leapOffset = 0 + var leapMonth = this.leapMonth(y) + var leapDay = this.leapDays(y) + if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 + if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值 + var day = this.monthDays(y, m) + var _day = day + // bugFix 2016-9-25 + // if month is leap, _day use leapDays method + if (isLeapMonth) { + _day = this.leapDays(y, m) + } + if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验 + + // 计算农历的时间差 + var offset = 0 + for (var i = 1900; i < y; i++) { + offset += this.lYearDays(i) + } + var leap = 0; var isAdd = false + for (var i = 1; i < m; i++) { + leap = this.leapMonth(y) + if (!isAdd) { // 处理闰月 + if (leap <= i && leap > 0) { + offset += this.leapDays(y); isAdd = true + } + } + offset += this.monthDays(y, i) + } + // 转换闰月农历 需补充该年闰月的前一个月的时差 + if (isLeapMonth) { offset += day } + // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) + var stmap = Date.UTC(1900, 1, 30, 0, 0, 0) + var calObj = new Date((offset + d - 31) * 86400000 + stmap) + var cY = calObj.getUTCFullYear() + var cM = calObj.getUTCMonth() + 1 + var cD = calObj.getUTCDate() + + return this.solar2lunar(cY, cM, cD) + } +} + +export default calendar diff --git a/pages/workFlow/schedule/calendar/i18n/en.json b/pages/workFlow/schedule/calendar/i18n/en.json new file mode 100644 index 0000000..fcbd13c --- /dev/null +++ b/pages/workFlow/schedule/calendar/i18n/en.json @@ -0,0 +1,12 @@ +{ + "uni-calender.ok": "ok", + "uni-calender.cancel": "cancel", + "uni-calender.today": "today", + "uni-calender.MON": "MON", + "uni-calender.TUE": "TUE", + "uni-calender.WED": "WED", + "uni-calender.THU": "THU", + "uni-calender.FRI": "FRI", + "uni-calender.SAT": "SAT", + "uni-calender.SUN": "SUN" +} diff --git a/pages/workFlow/schedule/calendar/i18n/index.js b/pages/workFlow/schedule/calendar/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/pages/workFlow/schedule/calendar/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/pages/workFlow/schedule/calendar/i18n/zh-Hans.json b/pages/workFlow/schedule/calendar/i18n/zh-Hans.json new file mode 100644 index 0000000..1ca43de --- /dev/null +++ b/pages/workFlow/schedule/calendar/i18n/zh-Hans.json @@ -0,0 +1,12 @@ +{ + "uni-calender.ok": "确定", + "uni-calender.cancel": "取消", + "uni-calender.today": "今日", + "uni-calender.SUN": "日", + "uni-calender.MON": "一", + "uni-calender.TUE": "二", + "uni-calender.WED": "三", + "uni-calender.THU": "四", + "uni-calender.FRI": "五", + "uni-calender.SAT": "六" +} diff --git a/pages/workFlow/schedule/calendar/i18n/zh-Hant.json b/pages/workFlow/schedule/calendar/i18n/zh-Hant.json new file mode 100644 index 0000000..e0fe33b --- /dev/null +++ b/pages/workFlow/schedule/calendar/i18n/zh-Hant.json @@ -0,0 +1,12 @@ +{ + "uni-calender.ok": "確定", + "uni-calender.cancel": "取消", + "uni-calender.today": "今日", + "uni-calender.SUN": "日", + "uni-calender.MON": "一", + "uni-calender.TUE": "二", + "uni-calender.WED": "三", + "uni-calender.THU": "四", + "uni-calender.FRI": "五", + "uni-calender.SAT": "六" +} diff --git a/pages/workFlow/schedule/calendar/uni-calendar-item.vue b/pages/workFlow/schedule/calendar/uni-calendar-item.vue new file mode 100644 index 0000000..20845f8 --- /dev/null +++ b/pages/workFlow/schedule/calendar/uni-calendar-item.vue @@ -0,0 +1,194 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/calendar/uni-calendar.vue b/pages/workFlow/schedule/calendar/uni-calendar.vue new file mode 100644 index 0000000..c95983f --- /dev/null +++ b/pages/workFlow/schedule/calendar/uni-calendar.vue @@ -0,0 +1,579 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/calendar/util.js b/pages/workFlow/schedule/calendar/util.js new file mode 100644 index 0000000..f2bc05a --- /dev/null +++ b/pages/workFlow/schedule/calendar/util.js @@ -0,0 +1,386 @@ +import CALENDAR from './calendar.js' + +class Calendar { + constructor({ + date, + selected, + startDate, + endDate, + range + } = {}) { + // 当前日期 + this.date = this.getDate(new Date()) // 当前初入日期 + // 打点信息 + this.selected = selected || []; + // 范围开始 + this.startDate = startDate + // 范围结束 + this.endDate = endDate + this.range = range + // 多选状态 + this.cleanMultipleStatus() + // 每周日期 + this.weeks = {} + // this._getWeek(this.date.fullDate) + } + /** + * 设置日期 + * @param {Object} date + */ + setDate(date) { + this.selectDate = this.getDate(date) + this._getWeek(this.selectDate.fullDate) + } + + /** + * 清理多选状态 + */ + cleanMultipleStatus() { + this.multipleStatus = { + before: '', + after: '', + data: [] + } + } + + /** + * 重置开始日期 + */ + resetSatrtDate(startDate) { + // 范围开始 + this.startDate = startDate + + } + + /** + * 重置结束日期 + */ + resetEndDate(endDate) { + // 范围结束 + this.endDate = endDate + } + + /** + * 获取任意时间 + */ + getDate(date, AddDayCount = 0, str = 'day') { + if (!date) { + date = new Date() + } + if (typeof date !== 'object') { + date = date.replace(/-/g, '/') + } + const dd = new Date(date) + switch (str) { + case 'day': + dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期 + break + case 'month': + if (dd.getDate() === 31 && AddDayCount > 0) { + dd.setDate(dd.getDate() + AddDayCount) + } else { + const preMonth = dd.getMonth() + dd.setMonth(preMonth + AddDayCount) // 获取AddDayCount天后的日期 + const nextMonth = dd.getMonth() + // 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题 + if (AddDayCount < 0 && preMonth !== 0 && nextMonth - preMonth > AddDayCount) { + dd.setMonth(nextMonth + (nextMonth - preMonth + AddDayCount)) + } + // 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题 + if (AddDayCount > 0 && nextMonth - preMonth > AddDayCount) { + dd.setMonth(nextMonth - (nextMonth - preMonth - AddDayCount)) + } + } + break + case 'year': + dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期 + break + } + const y = dd.getFullYear() + const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0 + const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0 + return { + fullDate: y + '-' + m + '-' + d, + year: y, + month: m, + date: d, + day: dd.getDay() + } + } + + + /** + * 获取上月剩余天数 + */ + _getLastMonthDays(firstDay, full) { + let dateArr = [] + for (let i = firstDay; i > 0; i--) { + const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() + dateArr.push({ + date: beforeDate, + month: full.month - 1, + lunar: this.getlunar(full.year, full.month - 1, beforeDate), + disable: true + }) + } + // 获取打点信息 + for (let i = 0; i < dateArr.length; i++) { + let nowDate = full.year + '-' + (dateArr[i].month < 10 ? + '0' + dateArr[i].month : dateArr[i].month) + '-' + (dateArr[i].date < 10 ? + '0' + dateArr[i].date : dateArr[i].date) + let info = this.selected && this.selected.find((item) => { + if (this.dateEqual(nowDate, item.date)) { + return item + } + }) + if (info) dateArr[i].extraInfo = info + } + return dateArr + } + /** + * 获取本月天数 + */ + _currentMonthDys(dateData, full) { + let dateArr = [] + let fullDate = this.date.fullDate + for (let i = 1; i <= dateData; i++) { + let nowDate = full.year + '-' + (full.month < 10 ? + full.month : full.month) + '-' + (i < 10 ? + '0' + i : i) + // 是否今天 + let isDay = fullDate === nowDate + // 获取打点信息 + let info = this.selected && this.selected.find((item) => { + if (this.dateEqual(nowDate, item.date)) { + return item + } + }) + + // 日期禁用 + let disableBefore = true + let disableAfter = true + if (this.startDate) { + // let dateCompBefore = this.dateCompare(this.startDate, fullDate) + // disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate) + disableBefore = this.dateCompare(this.startDate, nowDate) + } + + if (this.endDate) { + // let dateCompAfter = this.dateCompare(fullDate, this.endDate) + // disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate) + disableAfter = this.dateCompare(nowDate, this.endDate) + } + let multiples = this.multipleStatus.data + let checked = false + let multiplesStatus = -1 + if (this.range) { + if (multiples) { + multiplesStatus = multiples.findIndex((item) => { + return this.dateEqual(item, nowDate) + }) + } + if (multiplesStatus !== -1) { + checked = true + } + } + let data = { + fullDate: nowDate, + year: full.year, + date: i, + multiple: this.range ? checked : false, + beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate), + afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate), + month: full.month, + lunar: this.getlunar(full.year, full.month, i), + disable: !(disableBefore && disableAfter), + isDay + } + if (info) { + data.extraInfo = info + } + + dateArr.push(data) + } + return dateArr + } + /** + * 获取下月天数 + */ + _getNextMonthDays(surplus, full) { + let dateArr = [] + for (let i = 1; i < surplus + 1; i++) { + dateArr.push({ + date: i, + month: Number(full.month) + 1, + lunar: this.getlunar(full.year, Number(full.month) + 1, i), + disable: true + }) + } + // 获取打点信息 + for (let i = 0; i < dateArr.length; i++) { + let nowDate = full.year + '-' + (dateArr[i].month < 10 ? + '0' + dateArr[i].month : dateArr[i].month) + '-' + (dateArr[i].date < 10 ? + '0' + dateArr[i].date : dateArr[i].date) + let info = this.selected && this.selected.find((item) => { + if (this.dateEqual(nowDate, item.date)) { + return item + } + }) + if (info) dateArr[i].extraInfo = info + } + return dateArr + } + + /** + * 获取当前日期详情 + * @param {Object} date + */ + getInfo(date) { + if (!date) { + date = new Date() + } + const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) + return dateInfo + } + + /** + * 比较时间大小 + */ + dateCompare(startDate, endDate) { + // 计算截止时间 + startDate = new Date(startDate.replace('-', '/').replace('-', '/')) + // 计算详细项的截止时间 + endDate = new Date(endDate.replace('-', '/').replace('-', '/')) + if (startDate <= endDate) { + return true + } else { + return false + } + } + + /** + * 比较时间是否相等 + */ + dateEqual(before, after) { + // 计算截止时间 + before = new Date(before.replace('-', '/').replace('-', '/')) + // 计算详细项的截止时间 + after = new Date(after.replace('-', '/').replace('-', '/')) + if (before.getTime() - after.getTime() === 0) { + return true + } else { + return false + } + } + + + /** + * 获取日期范围内所有日期 + * @param {Object} begin + * @param {Object} end + */ + geDateAll(begin, end) { + var arr = [] + var ab = begin.split('-') + var ae = end.split('-') + var db = new Date() + db.setFullYear(ab[0], ab[1] - 1, ab[2]) + var de = new Date() + de.setFullYear(ae[0], ae[1] - 1, ae[2]) + var unixDb = db.getTime() - 24 * 60 * 60 * 1000 + var unixDe = de.getTime() - 24 * 60 * 60 * 1000 + for (var k = unixDb; k <= unixDe;) { + k = k + 24 * 60 * 60 * 1000 + arr.push(this.getDate(new Date(parseInt(k))).fullDate) + } + return arr + } + /** + * 计算阴历日期显示 + */ + getlunar(year, month, date) { + return CALENDAR.solar2lunar(year, month, date) + } + /** + * 设置打点 + */ + setSelectInfo(data, value) { + this.selected = value + this._getWeek(data) + } + + /** + * 获取多选状态 + */ + setMultiple(fullDate) { + let { + before, + after + } = this.multipleStatus + + if (!this.range) return + if (before && after) { + this.multipleStatus.before = '' + this.multipleStatus.after = '' + this.multipleStatus.data = [] + } else { + if (!before) { + this.multipleStatus.before = fullDate + } else { + this.multipleStatus.after = fullDate + if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { + this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus + .after); + } else { + this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus + .before); + } + } + } + this._getWeek(fullDate) + } + + /** + * 获取每周数据 + * @param {Object} dateData + */ + _getWeek(dateData) { + const { + year, + month + } = this.getDate(dateData) + let firstDay = new Date(year, month - 1, 1).getDay() + let currentDay = new Date(year, month, 0).getDate() + let dates = { + lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天 + currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数 + nextMonthDays: [], // 下个月开始几天 + weeks: [] + } + let canlender = [] + const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) + dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) + canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) + let weeks = {} + // 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天 + for (let i = 0; i < canlender.length; i++) { + if (i % 7 === 0) { + weeks[parseInt(i / 7)] = new Array(7) + } + weeks[parseInt(i / 7)][i % 7] = canlender[i] + } + this.canlender = canlender + this.weeks = weeks + } + + //静态方法 + // static init(date) { + // if (!this.instance) { + // this.instance = new Calendar(date); + // } + // return this.instance; + // } +} + + +export default Calendar \ No newline at end of file diff --git a/pages/workFlow/schedule/detail.vue b/pages/workFlow/schedule/detail.vue new file mode 100644 index 0000000..6da545d --- /dev/null +++ b/pages/workFlow/schedule/detail.vue @@ -0,0 +1,281 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/form.vue b/pages/workFlow/schedule/form.vue new file mode 100644 index 0000000..c45cafd --- /dev/null +++ b/pages/workFlow/schedule/form.vue @@ -0,0 +1,610 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/index.vue b/pages/workFlow/schedule/index.vue new file mode 100644 index 0000000..0cc25ef --- /dev/null +++ b/pages/workFlow/schedule/index.vue @@ -0,0 +1,277 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/sendSelect/Select.vue b/pages/workFlow/schedule/sendSelect/Select.vue new file mode 100644 index 0000000..f1437fe --- /dev/null +++ b/pages/workFlow/schedule/sendSelect/Select.vue @@ -0,0 +1,218 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/sendSelect/index.vue b/pages/workFlow/schedule/sendSelect/index.vue new file mode 100644 index 0000000..180c74d --- /dev/null +++ b/pages/workFlow/schedule/sendSelect/index.vue @@ -0,0 +1,86 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/schedule/t-datetime.vue b/pages/workFlow/schedule/t-datetime.vue new file mode 100644 index 0000000..ccd1971 --- /dev/null +++ b/pages/workFlow/schedule/t-datetime.vue @@ -0,0 +1,375 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/static/emoji/100.gif b/pages/workFlow/static/emoji/100.gif new file mode 100644 index 0000000..2378eb4 Binary files /dev/null and b/pages/workFlow/static/emoji/100.gif differ diff --git a/pages/workFlow/static/emoji/101.gif b/pages/workFlow/static/emoji/101.gif new file mode 100644 index 0000000..574caa7 Binary files /dev/null and b/pages/workFlow/static/emoji/101.gif differ diff --git a/pages/workFlow/static/emoji/102.gif b/pages/workFlow/static/emoji/102.gif new file mode 100644 index 0000000..64b71c7 Binary files /dev/null and b/pages/workFlow/static/emoji/102.gif differ diff --git a/pages/workFlow/static/emoji/103.gif b/pages/workFlow/static/emoji/103.gif new file mode 100644 index 0000000..ddc55f6 Binary files /dev/null and b/pages/workFlow/static/emoji/103.gif differ diff --git a/pages/workFlow/static/emoji/104.gif b/pages/workFlow/static/emoji/104.gif new file mode 100644 index 0000000..aa9f755 Binary files /dev/null and b/pages/workFlow/static/emoji/104.gif differ diff --git a/pages/workFlow/static/emoji/105.gif b/pages/workFlow/static/emoji/105.gif new file mode 100644 index 0000000..a2069d9 Binary files /dev/null and b/pages/workFlow/static/emoji/105.gif differ diff --git a/pages/workFlow/static/emoji/106.gif b/pages/workFlow/static/emoji/106.gif new file mode 100644 index 0000000..364a2f2 Binary files /dev/null and b/pages/workFlow/static/emoji/106.gif differ diff --git a/pages/workFlow/static/emoji/107.gif b/pages/workFlow/static/emoji/107.gif new file mode 100644 index 0000000..eb82906 Binary files /dev/null and b/pages/workFlow/static/emoji/107.gif differ diff --git a/pages/workFlow/static/emoji/108.gif b/pages/workFlow/static/emoji/108.gif new file mode 100644 index 0000000..d6e17f7 Binary files /dev/null and b/pages/workFlow/static/emoji/108.gif differ diff --git a/pages/workFlow/static/emoji/109.gif b/pages/workFlow/static/emoji/109.gif new file mode 100644 index 0000000..e38ccd8 Binary files /dev/null and b/pages/workFlow/static/emoji/109.gif differ diff --git a/pages/workFlow/static/emoji/110.gif b/pages/workFlow/static/emoji/110.gif new file mode 100644 index 0000000..fb4daf1 Binary files /dev/null and b/pages/workFlow/static/emoji/110.gif differ diff --git a/pages/workFlow/static/emoji/111.gif b/pages/workFlow/static/emoji/111.gif new file mode 100644 index 0000000..156bd67 Binary files /dev/null and b/pages/workFlow/static/emoji/111.gif differ diff --git a/pages/workFlow/static/emoji/112.gif b/pages/workFlow/static/emoji/112.gif new file mode 100644 index 0000000..4ee3c71 Binary files /dev/null and b/pages/workFlow/static/emoji/112.gif differ diff --git a/pages/workFlow/static/emoji/113.gif b/pages/workFlow/static/emoji/113.gif new file mode 100644 index 0000000..bcdf0ff Binary files /dev/null and b/pages/workFlow/static/emoji/113.gif differ diff --git a/pages/workFlow/static/emoji/114.gif b/pages/workFlow/static/emoji/114.gif new file mode 100644 index 0000000..9778059 Binary files /dev/null and b/pages/workFlow/static/emoji/114.gif differ diff --git a/pages/workFlow/static/emoji/115.gif b/pages/workFlow/static/emoji/115.gif new file mode 100644 index 0000000..87a52f3 Binary files /dev/null and b/pages/workFlow/static/emoji/115.gif differ diff --git a/pages/workFlow/static/emoji/116.gif b/pages/workFlow/static/emoji/116.gif new file mode 100644 index 0000000..73af643 Binary files /dev/null and b/pages/workFlow/static/emoji/116.gif differ diff --git a/pages/workFlow/static/emoji/117.gif b/pages/workFlow/static/emoji/117.gif new file mode 100644 index 0000000..0468b91 Binary files /dev/null and b/pages/workFlow/static/emoji/117.gif differ diff --git a/pages/workFlow/static/emoji/118.gif b/pages/workFlow/static/emoji/118.gif new file mode 100644 index 0000000..a877841 Binary files /dev/null and b/pages/workFlow/static/emoji/118.gif differ diff --git a/pages/workFlow/static/emoji/119.gif b/pages/workFlow/static/emoji/119.gif new file mode 100644 index 0000000..421062d Binary files /dev/null and b/pages/workFlow/static/emoji/119.gif differ diff --git a/pages/workFlow/static/emoji/120.gif b/pages/workFlow/static/emoji/120.gif new file mode 100644 index 0000000..b1ef5c7 Binary files /dev/null and b/pages/workFlow/static/emoji/120.gif differ diff --git a/pages/workFlow/static/emoji/121.gif b/pages/workFlow/static/emoji/121.gif new file mode 100644 index 0000000..97495df Binary files /dev/null and b/pages/workFlow/static/emoji/121.gif differ diff --git a/pages/workFlow/static/emoji/122.gif b/pages/workFlow/static/emoji/122.gif new file mode 100644 index 0000000..8623717 Binary files /dev/null and b/pages/workFlow/static/emoji/122.gif differ diff --git a/pages/workFlow/static/emoji/123.gif b/pages/workFlow/static/emoji/123.gif new file mode 100644 index 0000000..72a5f3d Binary files /dev/null and b/pages/workFlow/static/emoji/123.gif differ diff --git a/pages/workFlow/static/emoji/124.gif b/pages/workFlow/static/emoji/124.gif new file mode 100644 index 0000000..9974dbe Binary files /dev/null and b/pages/workFlow/static/emoji/124.gif differ diff --git a/pages/workFlow/static/emoji/125.gif b/pages/workFlow/static/emoji/125.gif new file mode 100644 index 0000000..aaca1f7 Binary files /dev/null and b/pages/workFlow/static/emoji/125.gif differ diff --git a/pages/workFlow/static/emoji/126.gif b/pages/workFlow/static/emoji/126.gif new file mode 100644 index 0000000..2aa7522 Binary files /dev/null and b/pages/workFlow/static/emoji/126.gif differ diff --git a/pages/workFlow/static/emoji/127.gif b/pages/workFlow/static/emoji/127.gif new file mode 100644 index 0000000..b59f3c6 Binary files /dev/null and b/pages/workFlow/static/emoji/127.gif differ diff --git a/pages/workFlow/static/emoji/128.gif b/pages/workFlow/static/emoji/128.gif new file mode 100644 index 0000000..cbed60d Binary files /dev/null and b/pages/workFlow/static/emoji/128.gif differ diff --git a/pages/workFlow/static/emoji/129.gif b/pages/workFlow/static/emoji/129.gif new file mode 100644 index 0000000..05d9353 Binary files /dev/null and b/pages/workFlow/static/emoji/129.gif differ diff --git a/pages/workFlow/static/emoji/130.gif b/pages/workFlow/static/emoji/130.gif new file mode 100644 index 0000000..ae2036b Binary files /dev/null and b/pages/workFlow/static/emoji/130.gif differ diff --git a/pages/workFlow/static/emoji/131.gif b/pages/workFlow/static/emoji/131.gif new file mode 100644 index 0000000..dbba4ca Binary files /dev/null and b/pages/workFlow/static/emoji/131.gif differ diff --git a/pages/workFlow/static/emoji/132.gif b/pages/workFlow/static/emoji/132.gif new file mode 100644 index 0000000..652ec1c Binary files /dev/null and b/pages/workFlow/static/emoji/132.gif differ diff --git a/pages/workFlow/static/emoji/133.gif b/pages/workFlow/static/emoji/133.gif new file mode 100644 index 0000000..8e335c4 Binary files /dev/null and b/pages/workFlow/static/emoji/133.gif differ diff --git a/pages/workFlow/static/emoji/134.gif b/pages/workFlow/static/emoji/134.gif new file mode 100644 index 0000000..fcf91ea Binary files /dev/null and b/pages/workFlow/static/emoji/134.gif differ diff --git a/pages/workFlow/static/emoji/135.gif b/pages/workFlow/static/emoji/135.gif new file mode 100644 index 0000000..003124b Binary files /dev/null and b/pages/workFlow/static/emoji/135.gif differ diff --git a/pages/workFlow/static/emoji/136.gif b/pages/workFlow/static/emoji/136.gif new file mode 100644 index 0000000..b2080f2 Binary files /dev/null and b/pages/workFlow/static/emoji/136.gif differ diff --git a/pages/workFlow/static/emoji/137.gif b/pages/workFlow/static/emoji/137.gif new file mode 100644 index 0000000..de27554 Binary files /dev/null and b/pages/workFlow/static/emoji/137.gif differ diff --git a/pages/workFlow/static/emoji/138.gif b/pages/workFlow/static/emoji/138.gif new file mode 100644 index 0000000..293a32f Binary files /dev/null and b/pages/workFlow/static/emoji/138.gif differ diff --git a/pages/workFlow/static/emoji/139.gif b/pages/workFlow/static/emoji/139.gif new file mode 100644 index 0000000..55631ca Binary files /dev/null and b/pages/workFlow/static/emoji/139.gif differ diff --git a/pages/workFlow/static/emoji/140.gif b/pages/workFlow/static/emoji/140.gif new file mode 100644 index 0000000..a5d3c79 Binary files /dev/null and b/pages/workFlow/static/emoji/140.gif differ diff --git a/pages/workFlow/static/emoji/141.gif b/pages/workFlow/static/emoji/141.gif new file mode 100644 index 0000000..3c16c48 Binary files /dev/null and b/pages/workFlow/static/emoji/141.gif differ diff --git a/pages/workFlow/static/emoji/142.gif b/pages/workFlow/static/emoji/142.gif new file mode 100644 index 0000000..627c579 Binary files /dev/null and b/pages/workFlow/static/emoji/142.gif differ diff --git a/pages/workFlow/static/emoji/143.gif b/pages/workFlow/static/emoji/143.gif new file mode 100644 index 0000000..4023df7 Binary files /dev/null and b/pages/workFlow/static/emoji/143.gif differ diff --git a/pages/workFlow/static/emoji/144.gif b/pages/workFlow/static/emoji/144.gif new file mode 100644 index 0000000..a9b8c84 Binary files /dev/null and b/pages/workFlow/static/emoji/144.gif differ diff --git a/pages/workFlow/static/emoji/145.gif b/pages/workFlow/static/emoji/145.gif new file mode 100644 index 0000000..d6db48f Binary files /dev/null and b/pages/workFlow/static/emoji/145.gif differ diff --git a/pages/workFlow/static/emoji/146.gif b/pages/workFlow/static/emoji/146.gif new file mode 100644 index 0000000..0f03b7d Binary files /dev/null and b/pages/workFlow/static/emoji/146.gif differ diff --git a/pages/workFlow/static/emoji/147.gif b/pages/workFlow/static/emoji/147.gif new file mode 100644 index 0000000..6e2f1fd Binary files /dev/null and b/pages/workFlow/static/emoji/147.gif differ diff --git a/pages/workFlow/static/emoji/148.gif b/pages/workFlow/static/emoji/148.gif new file mode 100644 index 0000000..11e7ddc Binary files /dev/null and b/pages/workFlow/static/emoji/148.gif differ diff --git a/pages/workFlow/static/emoji/149.gif b/pages/workFlow/static/emoji/149.gif new file mode 100644 index 0000000..f85e1c0 Binary files /dev/null and b/pages/workFlow/static/emoji/149.gif differ diff --git a/pages/workFlow/static/emoji/150.gif b/pages/workFlow/static/emoji/150.gif new file mode 100644 index 0000000..444083f Binary files /dev/null and b/pages/workFlow/static/emoji/150.gif differ diff --git a/pages/workFlow/static/emoji/151.gif b/pages/workFlow/static/emoji/151.gif new file mode 100644 index 0000000..c875ea7 Binary files /dev/null and b/pages/workFlow/static/emoji/151.gif differ diff --git a/pages/workFlow/static/emoji/152.gif b/pages/workFlow/static/emoji/152.gif new file mode 100644 index 0000000..df63eac Binary files /dev/null and b/pages/workFlow/static/emoji/152.gif differ diff --git a/pages/workFlow/static/emoji/153.gif b/pages/workFlow/static/emoji/153.gif new file mode 100644 index 0000000..dc696d6 Binary files /dev/null and b/pages/workFlow/static/emoji/153.gif differ diff --git a/pages/workFlow/static/emoji/154.gif b/pages/workFlow/static/emoji/154.gif new file mode 100644 index 0000000..d28380b Binary files /dev/null and b/pages/workFlow/static/emoji/154.gif differ diff --git a/pages/workFlow/static/emoji/155.gif b/pages/workFlow/static/emoji/155.gif new file mode 100644 index 0000000..9042b9d Binary files /dev/null and b/pages/workFlow/static/emoji/155.gif differ diff --git a/pages/workFlow/static/emoji/156.gif b/pages/workFlow/static/emoji/156.gif new file mode 100644 index 0000000..edf96f0 Binary files /dev/null and b/pages/workFlow/static/emoji/156.gif differ diff --git a/pages/workFlow/static/emoji/157.gif b/pages/workFlow/static/emoji/157.gif new file mode 100644 index 0000000..da352f3 Binary files /dev/null and b/pages/workFlow/static/emoji/157.gif differ diff --git a/pages/workFlow/static/emoji/158.gif b/pages/workFlow/static/emoji/158.gif new file mode 100644 index 0000000..4faf41f Binary files /dev/null and b/pages/workFlow/static/emoji/158.gif differ diff --git a/pages/workFlow/static/emoji/159.gif b/pages/workFlow/static/emoji/159.gif new file mode 100644 index 0000000..918288b Binary files /dev/null and b/pages/workFlow/static/emoji/159.gif differ diff --git a/pages/workFlow/static/emoji/160.gif b/pages/workFlow/static/emoji/160.gif new file mode 100644 index 0000000..869559e Binary files /dev/null and b/pages/workFlow/static/emoji/160.gif differ diff --git a/pages/workFlow/static/emoji/161.gif b/pages/workFlow/static/emoji/161.gif new file mode 100644 index 0000000..d347251 Binary files /dev/null and b/pages/workFlow/static/emoji/161.gif differ diff --git a/pages/workFlow/static/emoji/162.gif b/pages/workFlow/static/emoji/162.gif new file mode 100644 index 0000000..be2b213 Binary files /dev/null and b/pages/workFlow/static/emoji/162.gif differ diff --git a/pages/workFlow/static/emoji/163.gif b/pages/workFlow/static/emoji/163.gif new file mode 100644 index 0000000..d58fcf6 Binary files /dev/null and b/pages/workFlow/static/emoji/163.gif differ diff --git a/pages/workFlow/static/emoji/164.gif b/pages/workFlow/static/emoji/164.gif new file mode 100644 index 0000000..c4e00bd Binary files /dev/null and b/pages/workFlow/static/emoji/164.gif differ diff --git a/pages/workFlow/static/emoji/165.gif b/pages/workFlow/static/emoji/165.gif new file mode 100644 index 0000000..3549c83 Binary files /dev/null and b/pages/workFlow/static/emoji/165.gif differ diff --git a/pages/workFlow/static/emoji/166.gif b/pages/workFlow/static/emoji/166.gif new file mode 100644 index 0000000..f99e583 Binary files /dev/null and b/pages/workFlow/static/emoji/166.gif differ diff --git a/pages/workFlow/static/emoji/167.gif b/pages/workFlow/static/emoji/167.gif new file mode 100644 index 0000000..441da4a Binary files /dev/null and b/pages/workFlow/static/emoji/167.gif differ diff --git a/pages/workFlow/static/emoji/168.gif b/pages/workFlow/static/emoji/168.gif new file mode 100644 index 0000000..b74d3cb Binary files /dev/null and b/pages/workFlow/static/emoji/168.gif differ diff --git a/pages/workFlow/static/emoji/169.gif b/pages/workFlow/static/emoji/169.gif new file mode 100644 index 0000000..2639428 Binary files /dev/null and b/pages/workFlow/static/emoji/169.gif differ diff --git a/pages/workFlow/static/emoji/170.gif b/pages/workFlow/static/emoji/170.gif new file mode 100644 index 0000000..5d96fa5 Binary files /dev/null and b/pages/workFlow/static/emoji/170.gif differ diff --git a/pages/workFlow/static/emoji/171.gif b/pages/workFlow/static/emoji/171.gif new file mode 100644 index 0000000..8053885 Binary files /dev/null and b/pages/workFlow/static/emoji/171.gif differ diff --git a/pages/workFlow/static/emoji/172.gif b/pages/workFlow/static/emoji/172.gif new file mode 100644 index 0000000..ae51343 Binary files /dev/null and b/pages/workFlow/static/emoji/172.gif differ diff --git a/pages/workFlow/static/emoji/173.gif b/pages/workFlow/static/emoji/173.gif new file mode 100644 index 0000000..c0293c3 Binary files /dev/null and b/pages/workFlow/static/emoji/173.gif differ diff --git a/pages/workFlow/static/emoji/174.gif b/pages/workFlow/static/emoji/174.gif new file mode 100644 index 0000000..31203c5 Binary files /dev/null and b/pages/workFlow/static/emoji/174.gif differ diff --git a/pages/workFlow/static/emoji/175.gif b/pages/workFlow/static/emoji/175.gif new file mode 100644 index 0000000..f71d4a1 Binary files /dev/null and b/pages/workFlow/static/emoji/175.gif differ diff --git a/pages/workFlow/static/emoji/176.gif b/pages/workFlow/static/emoji/176.gif new file mode 100644 index 0000000..41f821e Binary files /dev/null and b/pages/workFlow/static/emoji/176.gif differ diff --git a/pages/workFlow/static/emoji/177.gif b/pages/workFlow/static/emoji/177.gif new file mode 100644 index 0000000..8f882f5 Binary files /dev/null and b/pages/workFlow/static/emoji/177.gif differ diff --git a/pages/workFlow/static/emoji/178.gif b/pages/workFlow/static/emoji/178.gif new file mode 100644 index 0000000..557551d Binary files /dev/null and b/pages/workFlow/static/emoji/178.gif differ diff --git a/pages/workFlow/static/emoji/179.gif b/pages/workFlow/static/emoji/179.gif new file mode 100644 index 0000000..6bc874d Binary files /dev/null and b/pages/workFlow/static/emoji/179.gif differ diff --git a/pages/workFlow/static/emoji/180.gif b/pages/workFlow/static/emoji/180.gif new file mode 100644 index 0000000..9a77936 Binary files /dev/null and b/pages/workFlow/static/emoji/180.gif differ diff --git a/pages/workFlow/static/emoji/181.gif b/pages/workFlow/static/emoji/181.gif new file mode 100644 index 0000000..2329101 Binary files /dev/null and b/pages/workFlow/static/emoji/181.gif differ diff --git a/pages/workFlow/static/emoji/182.gif b/pages/workFlow/static/emoji/182.gif new file mode 100644 index 0000000..644748a Binary files /dev/null and b/pages/workFlow/static/emoji/182.gif differ diff --git a/pages/workFlow/static/emoji/183.gif b/pages/workFlow/static/emoji/183.gif new file mode 100644 index 0000000..fbf275b Binary files /dev/null and b/pages/workFlow/static/emoji/183.gif differ diff --git a/pages/workFlow/static/emoji/184.gif b/pages/workFlow/static/emoji/184.gif new file mode 100644 index 0000000..bfc39e4 Binary files /dev/null and b/pages/workFlow/static/emoji/184.gif differ diff --git a/pages/workFlow/static/emoji/185.gif b/pages/workFlow/static/emoji/185.gif new file mode 100644 index 0000000..f1f6aa3 Binary files /dev/null and b/pages/workFlow/static/emoji/185.gif differ diff --git a/pages/workFlow/static/emoji/186.gif b/pages/workFlow/static/emoji/186.gif new file mode 100644 index 0000000..860885d Binary files /dev/null and b/pages/workFlow/static/emoji/186.gif differ diff --git a/pages/workFlow/static/emoji/187.gif b/pages/workFlow/static/emoji/187.gif new file mode 100644 index 0000000..3b88548 Binary files /dev/null and b/pages/workFlow/static/emoji/187.gif differ diff --git a/pages/workFlow/static/emoji/188.gif b/pages/workFlow/static/emoji/188.gif new file mode 100644 index 0000000..947934f Binary files /dev/null and b/pages/workFlow/static/emoji/188.gif differ diff --git a/pages/workFlow/static/emoji/189.gif b/pages/workFlow/static/emoji/189.gif new file mode 100644 index 0000000..fdb9f32 Binary files /dev/null and b/pages/workFlow/static/emoji/189.gif differ diff --git a/pages/workFlow/static/emoji/190.gif b/pages/workFlow/static/emoji/190.gif new file mode 100644 index 0000000..ddd6178 Binary files /dev/null and b/pages/workFlow/static/emoji/190.gif differ diff --git a/pages/workFlow/static/emoji/191.gif b/pages/workFlow/static/emoji/191.gif new file mode 100644 index 0000000..35d794c Binary files /dev/null and b/pages/workFlow/static/emoji/191.gif differ diff --git a/pages/workFlow/static/emoji/192.gif b/pages/workFlow/static/emoji/192.gif new file mode 100644 index 0000000..61a10bc Binary files /dev/null and b/pages/workFlow/static/emoji/192.gif differ diff --git a/pages/workFlow/static/emoji/193.gif b/pages/workFlow/static/emoji/193.gif new file mode 100644 index 0000000..ee297f9 Binary files /dev/null and b/pages/workFlow/static/emoji/193.gif differ diff --git a/pages/workFlow/static/emoji/194.gif b/pages/workFlow/static/emoji/194.gif new file mode 100644 index 0000000..c8c1fc3 Binary files /dev/null and b/pages/workFlow/static/emoji/194.gif differ diff --git a/pages/workFlow/static/emoji/195.gif b/pages/workFlow/static/emoji/195.gif new file mode 100644 index 0000000..5ef6d38 Binary files /dev/null and b/pages/workFlow/static/emoji/195.gif differ diff --git a/pages/workFlow/static/emoji/196.gif b/pages/workFlow/static/emoji/196.gif new file mode 100644 index 0000000..a1aee93 Binary files /dev/null and b/pages/workFlow/static/emoji/196.gif differ diff --git a/pages/workFlow/static/emoji/197.gif b/pages/workFlow/static/emoji/197.gif new file mode 100644 index 0000000..08a1e56 Binary files /dev/null and b/pages/workFlow/static/emoji/197.gif differ diff --git a/pages/workFlow/static/emoji/198.gif b/pages/workFlow/static/emoji/198.gif new file mode 100644 index 0000000..d161bc4 Binary files /dev/null and b/pages/workFlow/static/emoji/198.gif differ diff --git a/pages/workFlow/static/emoji/199.gif b/pages/workFlow/static/emoji/199.gif new file mode 100644 index 0000000..58192b0 Binary files /dev/null and b/pages/workFlow/static/emoji/199.gif differ diff --git a/pages/workFlow/static/emoji/200.png b/pages/workFlow/static/emoji/200.png new file mode 100644 index 0000000..56df9d2 Binary files /dev/null and b/pages/workFlow/static/emoji/200.png differ diff --git a/pages/workFlow/static/emoji/201.png b/pages/workFlow/static/emoji/201.png new file mode 100644 index 0000000..b72e9f8 Binary files /dev/null and b/pages/workFlow/static/emoji/201.png differ diff --git a/pages/workFlow/static/emoji/202.png b/pages/workFlow/static/emoji/202.png new file mode 100644 index 0000000..f8f7f35 Binary files /dev/null and b/pages/workFlow/static/emoji/202.png differ diff --git a/pages/workFlow/static/emoji/203.png b/pages/workFlow/static/emoji/203.png new file mode 100644 index 0000000..ae7c82a Binary files /dev/null and b/pages/workFlow/static/emoji/203.png differ diff --git a/pages/workFlow/static/emoji/204.png b/pages/workFlow/static/emoji/204.png new file mode 100644 index 0000000..7303da1 Binary files /dev/null and b/pages/workFlow/static/emoji/204.png differ diff --git a/pages/workFlow/static/emoji/205.png b/pages/workFlow/static/emoji/205.png new file mode 100644 index 0000000..0643682 Binary files /dev/null and b/pages/workFlow/static/emoji/205.png differ diff --git a/pages/workFlow/static/emoji/206.png b/pages/workFlow/static/emoji/206.png new file mode 100644 index 0000000..4693154 Binary files /dev/null and b/pages/workFlow/static/emoji/206.png differ diff --git a/pages/workFlow/static/emoji/207.png b/pages/workFlow/static/emoji/207.png new file mode 100644 index 0000000..390cc86 Binary files /dev/null and b/pages/workFlow/static/emoji/207.png differ diff --git a/pages/workFlow/static/emoji/208.png b/pages/workFlow/static/emoji/208.png new file mode 100644 index 0000000..02ab03b Binary files /dev/null and b/pages/workFlow/static/emoji/208.png differ diff --git a/pages/workFlow/static/emoji/209.png b/pages/workFlow/static/emoji/209.png new file mode 100644 index 0000000..7b09611 Binary files /dev/null and b/pages/workFlow/static/emoji/209.png differ diff --git a/pages/workFlow/static/emoji/210.png b/pages/workFlow/static/emoji/210.png new file mode 100644 index 0000000..982ec91 Binary files /dev/null and b/pages/workFlow/static/emoji/210.png differ diff --git a/pages/workFlow/static/emoji/211.png b/pages/workFlow/static/emoji/211.png new file mode 100644 index 0000000..7d847cc Binary files /dev/null and b/pages/workFlow/static/emoji/211.png differ diff --git a/pages/workFlow/static/emoji/212.png b/pages/workFlow/static/emoji/212.png new file mode 100644 index 0000000..07db6f9 Binary files /dev/null and b/pages/workFlow/static/emoji/212.png differ diff --git a/pages/workFlow/static/emoji/213.png b/pages/workFlow/static/emoji/213.png new file mode 100644 index 0000000..90d08b0 Binary files /dev/null and b/pages/workFlow/static/emoji/213.png differ diff --git a/pages/workFlow/static/emoji/214.png b/pages/workFlow/static/emoji/214.png new file mode 100644 index 0000000..bbf7c9e Binary files /dev/null and b/pages/workFlow/static/emoji/214.png differ diff --git a/pages/workFlow/static/emoji/215.png b/pages/workFlow/static/emoji/215.png new file mode 100644 index 0000000..6e0b52f Binary files /dev/null and b/pages/workFlow/static/emoji/215.png differ diff --git a/pages/workFlow/static/emoji/216.png b/pages/workFlow/static/emoji/216.png new file mode 100644 index 0000000..d86bac8 Binary files /dev/null and b/pages/workFlow/static/emoji/216.png differ diff --git a/pages/workFlow/static/emoji/217.png b/pages/workFlow/static/emoji/217.png new file mode 100644 index 0000000..73346e3 Binary files /dev/null and b/pages/workFlow/static/emoji/217.png differ diff --git a/pages/workFlow/static/emoji/218.png b/pages/workFlow/static/emoji/218.png new file mode 100644 index 0000000..988414f Binary files /dev/null and b/pages/workFlow/static/emoji/218.png differ diff --git a/pages/workFlow/static/emoji/219.png b/pages/workFlow/static/emoji/219.png new file mode 100644 index 0000000..80f3cbc Binary files /dev/null and b/pages/workFlow/static/emoji/219.png differ diff --git a/pages/workFlow/webView/index.vue b/pages/workFlow/webView/index.vue new file mode 100644 index 0000000..d19bde1 --- /dev/null +++ b/pages/workFlow/webView/index.vue @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/workFlow/index.vue b/pages/workFlow/workFlow/index.vue new file mode 100644 index 0000000..5fb9f27 --- /dev/null +++ b/pages/workFlow/workFlow/index.vue @@ -0,0 +1,292 @@ + + + + \ No newline at end of file diff --git a/pages/workFlow/workFlowForm/crmOrder/index.vue b/pages/workFlow/workFlowForm/crmOrder/index.vue new file mode 100644 index 0000000..2d73d88 --- /dev/null +++ b/pages/workFlow/workFlowForm/crmOrder/index.vue @@ -0,0 +1,388 @@ + + \ No newline at end of file diff --git a/pages/workFlow/workFlowForm/dynamicForm/index.vue b/pages/workFlow/workFlowForm/dynamicForm/index.vue new file mode 100644 index 0000000..ce8483c --- /dev/null +++ b/pages/workFlow/workFlowForm/dynamicForm/index.vue @@ -0,0 +1,182 @@ + + + \ No newline at end of file diff --git a/pages/workFlow/workFlowForm/leaveApply/index.vue b/pages/workFlow/workFlowForm/leaveApply/index.vue new file mode 100644 index 0000000..62aca0c --- /dev/null +++ b/pages/workFlow/workFlowForm/leaveApply/index.vue @@ -0,0 +1,221 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/workFlowForm/mixin.js b/pages/workFlow/workFlowForm/mixin.js new file mode 100644 index 0000000..d40000d --- /dev/null +++ b/pages/workFlow/workFlowForm/mixin.js @@ -0,0 +1,226 @@ +import { + getBillNumber +} from '@/api/common' + +const includeList = ['crmOrder', 'salesOrder', 'leaveApply'] +export default { + props: { + config: { + type: Object, + default: () => {} + }, + }, + data() { + return { + flowUrgentOptions: [{ + id: 1, + fullName: '普通' + }, { + id: 2, + fullName: '重要' + }, { + id: 3, + fullName: '紧急' + }], + fileList: [], + setting: {}, + userInfo: {}, + eventType: '', + paymentMethodOptions: [], + requiredList: {}, + requiredObj: [] + } + }, + mounted() { + this.init(this.config) + this.$refs.dataForm.setRules(this.rules) + this.userInfo = uni.getStorageSync('userInfo') || {} + }, + methods: { + checkChildRule() { + let list = {} + this.requiredObj.forEach((data) => { + if (data.required) { + list[data.id] = data.name + '不能为空' + } + }) + let title = []; + for (let k in list) { + let num = k.split("-"); + let childKey = num[0]; + num.forEach((model, i) => { + if (i == 1) { + let childData = this.dataForm[childKey] + childData.forEach((child, i) => { + if (child[model] instanceof Array) { + if (child[model].length == 0) { + title.push(list[childKey + "-" + model]) + } + } else { + if (!child[model] && child[model] !== 0) { + title.push(list[childKey + "-" + model]) + } + } + }) + } + }) + } + let _regList = this.regList + for (let k in _regList) { + let childData = this.dataForm[k] + for (let n in _regList[k]) { + for (let i = 0; i < _regList[k][n].length; i++) { + const element = _regList[k][n][i] + if (element.pattern) { + element.pattern = element.pattern.toString() + let start = element.pattern.indexOf('/') + let stop = element.pattern.lastIndexOf('/') + let str = element.pattern.substring(start + 1, stop) + let reg = new RegExp(str) + element.pattern = reg + } + childData.forEach((item, index) => { + if (item[n] && !element.pattern.test(item[n])) { + title.push(element.message) + } + }) + } + } + } + if (title.length > 0) { + return title[0] + } + }, + /* 初始化处理 */ + init(data) { + this.dataForm.id = data.id || '' + this.dataForm.flowId = data.flowId + this.setting = data + if (data.formEnCode !== "revoke") this.updateDataRule() + this.$nextTick(() => { + this.$refs.dataForm.resetFields() + if (this.beforeInit) this.beforeInit() + if (data.id) { + let dataForm = JSON.parse(JSON.stringify(data.draftData)) || JSON.parse(JSON.stringify(data + .formData)) + if (this.selfGetInfo && typeof this.selfGetInfo === "function") { + this.selfGetInfo(dataForm) + } else { + this.dataForm = JSON.parse(JSON.stringify(dataForm)) + } + if (includeList.includes(data.formEnCode) && this.dataForm.fileJson) { + this.fileList = JSON.parse(this.dataForm.fileJson) + } + return + } else { + if (this.selfInit) this.selfInit(data) + if (!this.billEnCode) return + getBillNumber(this.billEnCode).then(res => { + if (data.formEnCode === 'crmOrder') { + this.dataForm.orderCode = res.data + } else { + this.dataForm.billNo = res.data + } + }) + } + }) + }, + /* 提交 */ + submit(eventType, flowUrgent) { + this.eventType = eventType + this.$refs.dataForm.setRules(this.rules) + this.$refs.dataForm.validate((valid) => { + if (valid) { + if (includeList.includes(this.setting.formEnCode)) { + this.dataForm.fileJson = !!this.fileList.length ? JSON.stringify(this.fileList) : '' + } + if (!!this.checkChildRule()) return this.$u.toast(`${this.checkChildRule()}`) + if (this.exist && !!this.exist()) return this.$u.toast(`${this.exist()}`) + let dataForm = {} + if (this.beforeSubmit && typeof this.beforeSubmit === "function") { + dataForm = this.beforeSubmit() + } else { + dataForm = this.dataForm + } + if (includeList.includes(this.setting.formEnCode)) { + dataForm.fileJson = JSON.stringify(this.fileList) + } + if (eventType === 'save' || eventType === 'submit') { + if (this.selfSubmit && typeof this.selfSubmit === "function") { + this.selfSubmit(this.dataForm, flowUrgent) + return + } + } + this.$emit('eventReceiver', { + formData: dataForm, + id: this.dataForm.id + }, eventType) + } + }) + }, + updateDataRule() { + let newRules = {} + for (let i = 0; i < this.setting.formOperates.length; i++) { + const item = this.setting.formOperates[i] + if (item.required) { + this.$set(this.requiredList, item.id, item.required) + if (item.jnpfKey != 'rate' && item.jnpfKey != 'slider') this.requiredObj.push(item) + } + const newRulesItem = { + required: item.required || false, + message: item.name + '不能为空', + trigger: item.trigger || ['blur', 'change'], + type: '' + } + const numList = ['inputNumber', 'datePicker', 'switch', 'rate', 'slider'] + if (item.dataType === 'array') newRulesItem.type = item.dataType + if (numList.includes(item.jnpfKey)) newRulesItem.type = 'number' + if (['relationForm', 'popupSelect'].includes(item.jnpfKey)) { + newRulesItem.type = 'any', + newRulesItem.validator = (rule, value, callback) => { + if (value || value === 0) { + callback(); + } else { + callback(new Error(item.name + '不能为空')); + } + } + } + if (!this.rules.hasOwnProperty(item.id)) { + if (item.required) this.$set(newRules, item.id, [newRulesItem]) + } else { + let withoutRequiredItem = true + for (let i = 0; i < this.rules[item.id].length; i++) { + if (this.rules[item.id][i].hasOwnProperty('required')) { + this.rules[item.id][i].required = item.required || false + withoutRequiredItem = false + } + } + if (withoutRequiredItem && item.required) this.rules[item.id].push(newRulesItem) + } + } + this.rules = { + ...this.rules, + ...newRules + } + this.$refs.dataForm.setRules(this.rules) + }, + /* 可见 */ + judgeShow(id) { + if (this.setting.opType == 4) return true + if (!this.setting.formOperates || !this.setting.formOperates.length) return true + let arr = this.setting.formOperates.filter(o => o.id === id) || [] + if (!arr.length) return true + let item = arr[0] + return item.read + }, + /* 可写 */ + judgeWrite(id) { + if (this.setting.readonly) return true + if (!this.setting.formOperates || !this.setting.formOperates.length) return false + let arr = this.setting.formOperates.filter(o => o.id === id) || [] + if (!arr.length) return true + let item = arr[0] + return !item.write + } + } +} \ No newline at end of file diff --git a/pages/workFlow/workFlowForm/revokeApply/index.vue b/pages/workFlow/workFlowForm/revokeApply/index.vue new file mode 100644 index 0000000..2f0b4f4 --- /dev/null +++ b/pages/workFlow/workFlowForm/revokeApply/index.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/pages/workFlow/workFlowForm/salesOrder/index.vue b/pages/workFlow/workFlowForm/salesOrder/index.vue new file mode 100644 index 0000000..a246ad7 --- /dev/null +++ b/pages/workFlow/workFlowForm/salesOrder/index.vue @@ -0,0 +1,265 @@ + + + + \ No newline at end of file diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..3c5868b Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/iconfont.ttf b/static/iconfont.ttf new file mode 100644 index 0000000..46641dd Binary files /dev/null and b/static/iconfont.ttf differ diff --git a/static/image-resize-3.0.1.min.js b/static/image-resize-3.0.1.min.js new file mode 100644 index 0000000..7c788a5 --- /dev/null +++ b/static/image-resize-3.0.1.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ImageResize=e():t.ImageResize=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=39)}([function(t,e){function n(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){var o=n(22),r="object"==typeof self&&self&&self.Object===Object&&self,i=o||r||Function("return this")();t.exports=i},function(t,e){function n(t){return null!=t&&"object"==typeof t}t.exports=n},function(t,e,n){function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=o}var o=9007199254740991;t.exports=n},function(t,e,n){var o=n(50),r=n(55),i=n(87),u=i&&i.isTypedArray,c=u?r(u):o;t.exports=c},function(t,e,n){function o(t){return u(t)?r(t,!0):i(t)}var r=n(44),i=n(51),u=n(12);t.exports=o},function(t,e,n){"use strict";e.a={modules:["DisplaySize","Toolbar","Resize"]}},function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}n.d(e,"a",function(){return c});var u=n(9),c=function(t){function e(){var t,n,i,u;o(this,e);for(var c=arguments.length,a=Array(c),s=0;s1&&void 0!==arguments[1]?arguments[1]:{};o(this,t),this.initializeModules=function(){n.removeModules(),n.modules=n.moduleClasses.map(function(t){return new(f[t]||t)(n)}),n.modules.forEach(function(t){t.onCreate()}),n.onUpdate()},this.onUpdate=function(){n.repositionElements(),n.modules.forEach(function(t){t.onUpdate()})},this.removeModules=function(){n.modules.forEach(function(t){t.onDestroy()}),n.modules=[]},this.handleClick=function(t){if(t.target&&t.target.tagName&&"IMG"===t.target.tagName.toUpperCase()){if(n.img===t.target)return;n.img&&n.hide(),n.show(t.target)}else n.img&&n.hide()},this.show=function(t){n.img=t,n.showOverlay(),n.initializeModules()},this.showOverlay=function(){n.overlay&&n.hideOverlay(),n.quill.setSelection(null),n.setUserSelect("none"),document.addEventListener("keyup",n.checkImage,!0),n.quill.root.addEventListener("input",n.checkImage,!0),n.overlay=document.createElement("div"),n.overlay.classList.add("ql-image-overlay"),n.quill.root.parentNode.appendChild(n.overlay),n.repositionElements()},this.hideOverlay=function(){n.overlay&&(n.quill.root.parentNode.removeChild(n.overlay),n.overlay=void 0,document.removeEventListener("keyup",n.checkImage),n.quill.root.removeEventListener("input",n.checkImage),n.setUserSelect(""))},this.repositionElements=function(){if(n.overlay&&n.img){var t=n.quill.root.parentNode,e=n.img.getBoundingClientRect(),o=t.getBoundingClientRect();Object.assign(n.overlay.style,{left:e.left-o.left-1+t.scrollLeft+"px",top:e.top-o.top+t.scrollTop+"px",width:e.width+"px",height:e.height+"px"})}},this.hide=function(){n.hideOverlay(),n.removeModules(),n.img=void 0},this.setUserSelect=function(t){["userSelect","mozUserSelect","webkitUserSelect","msUserSelect"].forEach(function(e){n.quill.root.style[e]=t,document.documentElement.style[e]=t})},this.checkImage=function(t){n.img&&(46!=t.keyCode&&8!=t.keyCode||window.Quill.find(n.img).deleteAt(0),n.hide())},this.quill=e;var c=!1;r.modules&&(c=r.modules.slice()),this.options=i()({},r,u.a),!1!==c&&(this.options.modules=c),document.execCommand("enableObjectResizing",!1,"false"),this.quill.root.addEventListener("click",this.handleClick,!1),this.quill.root.parentNode.style.position=this.quill.root.parentNode.style.position||"relative",this.moduleClasses=this.options.modules,this.modules=[]};e.default=p,window.Quill&&window.Quill.register("modules/imageResize",p)},function(t,e,n){function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e1?n[r-1]:void 0,c=r>2?n[2]:void 0;for(u=t.length>3&&"function"==typeof u?(r--,u):void 0,c&&i(n[0],n[1],c)&&(u=r<3?void 0:u,r=1),e=Object(e);++o-1}var r=n(4);t.exports=o},function(t,e,n){function o(t,e){var n=this.__data__,o=r(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}var r=n(4);t.exports=o},function(t,e,n){function o(){this.size=0,this.__data__={hash:new r,map:new(u||i),string:new r}}var r=n(40),i=n(3),u=n(15);t.exports=o},function(t,e,n){function o(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}var r=n(6);t.exports=o},function(t,e,n){function o(t){return r(this,t).get(t)}var r=n(6);t.exports=o},function(t,e,n){function o(t){return r(this,t).has(t)}var r=n(6);t.exports=o},function(t,e,n){function o(t,e){var n=r(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this}var r=n(6);t.exports=o},function(t,e){function n(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}t.exports=n},function(t,e,n){(function(t){var o=n(22),r="object"==typeof e&&e&&!e.nodeType&&e,i=r&&"object"==typeof t&&t&&!t.nodeType&&t,u=i&&i.exports===r,c=u&&o.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||c&&c.binding&&c.binding("util")}catch(t){}}();t.exports=a}).call(e,n(14)(t))},function(t,e){function n(t){return r.call(t)}var o=Object.prototype,r=o.toString;t.exports=n},function(t,e){function n(t,e){return function(n){return t(e(n))}}t.exports=n},function(t,e,n){function o(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,u=-1,c=i(o.length-e,0),a=Array(c);++u0){if(++e>=o)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var o=800,r=16,i=Date.now;t.exports=n},function(t,e,n){function o(){this.__data__=new r,this.size=0}var r=n(3);t.exports=o},function(t,e){function n(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}t.exports=n},function(t,e){function n(t){return this.__data__.get(t)}t.exports=n},function(t,e){function n(t){return this.__data__.has(t)}t.exports=n},function(t,e,n){function o(t,e){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.length ({ + dictionaryList: [], + groupList: [], + roleList: [], + relationData: {}, + }), + getters: { + getDictionaryList() { + return this.dictionaryList + }, + getRelationData() { + return this.relationData + }, + }, + actions: { + setDictionaryList(dictionaryList) { + this.dictionaryList = dictionaryList || [] + }, + setGroupList(groupList) { + this.groupList = groupList + }, + setRoleList(roleList) { + this.roleList = roleList + }, + updateRelationData(val) { + this.relationData = val + }, + getDictionaryDataAll() { + return new Promise((resolve, reject) => { + if (this.dictionaryList.length) { + resolve(this.dictionaryList) + } else { + getDictionaryDataAll().then(res => { + this.setDictionaryList(res.data.list) + resolve(res.data.list) + }).catch(error => { + reject(error) + }) + } + }) + }, + getDictionaryData(info) { + return new Promise(async resolve => { + let list = [], + data = [], + json = [] + if (!this.dictionaryList.length) { + list = await this.getDictionaryDataAll() + } else { + list = this.dictionaryList + } + if (info.sort) { + data = list.filter(o => o.enCode === info.sort)[0] + if (!info.id) { + json = data?.dictionaryList || [] + } else { + let rowData = []; + if (!data.isTree) { + rowData = data.dictionaryList.fliter(o => o.id == info.id) + } else { + const findData = list => { + for (let i = 0; i < list.length; i++) { + const e = list[i]; + if (e.id == info.id) { + rowData[0] = e + break + } + if (e.children && e.children.length) { + findData(e.children) + } + } + } + findData(data.dictionaryList) + } + if (rowData.length) { + json = rowData[0] + } else { + json = { + id: "", + fullName: "" + }; + } + } + } + resolve(json) + }) + }, + getDicDataSelector(value, key = 'id') { + return new Promise(async resolve => { + let list = [], + data = {}, + json = []; + if (!this.dictionaryList.length) { + list = await this.getDictionaryDataAll() + } else { + list = this.dictionaryList + } + if (!value) return resolve([]) + let arr = list.filter(o => o[key] === value); + if (!arr.length) return resolve([]) + data = arr[0]; + json = data.dictionaryList; + resolve(json) + }) + }, + getGroupList() { + return new Promise((resolve, reject) => { + if (!this.groupList.length) { + getGroupSelector().then(res => { + this.setGroupList(res.data) + resolve(res.data) + }).catch(error => { + reject(error) + }) + } else { + resolve(this.groupList) + } + }) + }, + getRoleList() { + return new Promise((resolve, reject) => { + if (!this.roleList.length) { + getRoleSelector().then(res => { + this.setRoleList(res.data.list) + resolve(res.data.list) + }).catch(error => { + reject(error) + }) + } else { + resolve(this.roleList) + } + }) + }, + }, +}); \ No newline at end of file diff --git a/store/modules/chat.js b/store/modules/chat.js new file mode 100644 index 0000000..35105a3 --- /dev/null +++ b/store/modules/chat.js @@ -0,0 +1,113 @@ +import { + defineStore +} from 'pinia'; +import store from '../index' + +export const useChatStore = defineStore({ + id: ' chat', + state: () => ({ + socket: null, + badgeNum: 0, + msgInfo: {}, + formUserId: '' + }), + getters: { + getSocket() { + return this.socket + }, + getBadgeNum() { + return this.badgeNum + }, + getMsgInfo() { + return this.msgInfo + } + }, + actions: { + setSocket(socket) { + this.socket = socket + }, + setBadgeNum(badgeNum) { + this.badgeNum = badgeNum + }, + addBadgeNum(num) { + this.badgeNum += num + }, + reduceBadgeNum(num) { + let badgeNum = this.badgeNum - num + if (badgeNum < 0) badgeNum = 0 + this.badgeNum = badgeNum + }, + setMsgInfo(msgInfo) { + this.msgInfo = msgInfo + }, + setMsgInfoNum(num) { + if (num || num === 0) { + this.msgInfo.messageCount = num + this.msgInfo.count = num + this.badgeNum = num + return + } + this.msgInfo.messageCount -= 1 + this.msgInfo.count = this.msgInfo.messageCount + let badgeNum = this.badgeNum - 1 + if (badgeNum < 0) badgeNum = 0 + this.badgeNum = badgeNum + }, + setFormUserId(formUserId) { + this.formUserId = formUserId + }, + sendMessage(data) { + const item = { + account: data.toAccount, + headIcon: data.toHeadIcon, + id: data.toUserId, + latestDate: data.latestDate, + latestMessage: data.toMessage, + messageType: data.messageType, + realName: data.toRealName, + unreadMessage: 0 + } + const addItem = { + sendUserId: data.UserId, + contentType: data.messageType, + content: data.toMessage, + sendTime: data.dateTime, + method: data.method + } + uni.$emit('addMsg', addItem) + uni.$emit('updateList', item) + }, + receiveMessage(data) { + if (this.formUserId === data.formUserId) { + data.unreadMessage = 0 + const item = { + sendUserId: data.formUserId, + contentType: data.messageType, + content: data.formMessage, + sendTime: data.dateTime, + method: data.method + } + uni.$emit('addMsg', item) + } else { + data.unreadMessage = 1 + this.addBadgeNum(1) + } + data.id = data.formUserId + data.latestMessage = data.formMessage + uni.$emit('updateList', data) + }, + getMessageList(data) { + uni.$emit('getMessageList', data) + }, + messagePush(data) { + this.msgInfo.messageText = data.title; + this.msgInfo.messageCount += data.unreadNoticeCount; + this.msgInfo.messageDate = data.messageDefaultTime + this.addBadgeNum(data.unreadNoticeCount || 1) + } + }, +}); + +export function useChatStoreWithOut() { + return useChatStore(store); +} \ No newline at end of file diff --git a/store/modules/test.js b/store/modules/test.js new file mode 100644 index 0000000..83722b4 --- /dev/null +++ b/store/modules/test.js @@ -0,0 +1,18 @@ +import { + defineStore +} from 'pinia'; + +export const useTestStore = defineStore({ + id: ' test', + state: () => ({ + count: 0, + }), + actions: { + increment() { + this.count++; + }, + decrement() { + this.count--; + }, + }, +}); \ No newline at end of file diff --git a/store/modules/user.js b/store/modules/user.js new file mode 100644 index 0000000..d324420 --- /dev/null +++ b/store/modules/user.js @@ -0,0 +1,88 @@ +import { + defineStore +} from 'pinia'; +import { + logout, + getCurrentUser +} from '@/api/common' +import store from '../index' +import permission from '@/libs/permission' + +export const useUserStore = defineStore({ + id: ' user', + state: () => ({ + token: "", + userInfo: {}, + menuList: [], + }), + getters: { + getToken() { + return this.token + }, + }, + actions: { + setToken(token) { + this.token = token + uni.setStorageSync('token', token) + }, + setCid(cid) { + this.cid = cid + uni.setStorageSync('cid', cid) + }, + setUserInfo(userInfo) { + this.userInfo = userInfo + uni.setStorageSync('userInfo', userInfo) + }, + setMenuList(menuList) { + this.menuList = menuList + uni.setStorageSync('menuList', menuList) + }, + getCurrentUser() { + return new Promise((resolve, reject) => { + getCurrentUser().then(res => { + const userInfo = res.data.userInfo || {} + const permissionList = res.data.permissionList || [] + const sysConfigInfo = res.data.sysConfigInfo || {} + const sysVersion = sysConfigInfo.sysVersion || '' + const copyright = sysConfigInfo.copyright || '' + uni.setStorageSync('sysVersion', sysVersion) + uni.setStorageSync('permissionList', permissionList) + permission && permission.updatePermissionList() + uni.setStorageSync('sysConfigInfo', sysConfigInfo) + uni.setStorageSync('copyright', copyright) + uni.setStorageSync('systemCode', userInfo.systemCode) + this.setUserInfo(userInfo) + this.setMenuList(res.data.menuList) + resolve(userInfo) + }).catch(error => { + reject(error) + }) + }) + }, + logout() { + return new Promise((resolve, reject) => { + logout().then(() => { + this.setToken('') + this.setCid('') + this.setUserInfo({}) + this.resetToken() + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + resetToken() { + uni.removeStorageSync('token') + uni.removeStorageSync('cid') + uni.removeStorageSync('userInfo') + uni.removeStorageSync('permissionList') + uni.removeStorageSync('sysVersion') + uni.removeStorageSync('dynamicModelExtra') + } + }, +}); + +export function useUserStoreWithOut() { + return useUserStore(store); +} \ No newline at end of file diff --git a/uni.promisify.adaptor.js b/uni.promisify.adaptor.js new file mode 100644 index 0000000..47fbce1 --- /dev/null +++ b/uni.promisify.adaptor.js @@ -0,0 +1,10 @@ +uni.addInterceptor({ + returnValue (res) { + if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { + return res; + } + return new Promise((resolve, reject) => { + res.then((res) => res[0] ? reject(res[0]) : resolve(res[1])); + }); + }, +}); \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..067688b --- /dev/null +++ b/uni.scss @@ -0,0 +1,79 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/*uview-ui*/ +@import "@/uni_modules/vk-uview-ui/theme.scss"; + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #FE5146; + +/* 文字基本颜色 */ +$uni-text-color:#333;//基本色 +$uni-text-color-inverse:#fff;//反色 +$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable:#c0c0c0; + +/* 背景颜色 */ +$uni-bg-color:#ffffff; +$uni-bg-color-grey:#f8f8f8; +$uni-bg-color-hover:#f1f1f1;//点击状态颜色 +$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 + +/* 边框颜色 */ +$uni-border-color:#c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm:12px; +$uni-font-size-base:14px; +$uni-font-size-lg:16; + +/* 图片尺寸 */ +$uni-img-size-sm:20px; +$uni-img-size-base:26px; +$uni-img-size-lg:40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 垂直间距 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2C405A; // 文章标题颜色 +$uni-font-size-title:20px; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle:26px; +$uni-color-paragraph: #3F536E; // 文章段落颜色 +$uni-font-size-paragraph:15px; diff --git a/uniCloud-aliyun/cloudfunctions/jnpfPush/index.js b/uniCloud-aliyun/cloudfunctions/jnpfPush/index.js new file mode 100644 index 0000000..64f77f4 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/jnpfPush/index.js @@ -0,0 +1,17 @@ +// 简单的使用示例 +'use strict'; +const uniPush = uniCloud.getPushManager({ + appId: "__UNI__663111E" +}) //注意这里需要传入你的应用appId +exports.main = async (event, context) => { + let data = { + ...event + } + return await uniPush.sendMessage({ + "push_clientid": data.push_clientid, //填写上一步在uni-app客户端获取到的客户端推送标识push_clientid + "force_notification": true, //填写true,客户端就会对在线消息自动创建“通知栏消息”。 + "title": data.title, + "content": data.content, + "payload": data.payload + }) +}; \ No newline at end of file diff --git a/uniCloud-aliyun/cloudfunctions/jnpfPush/package.json b/uniCloud-aliyun/cloudfunctions/jnpfPush/package.json new file mode 100644 index 0000000..0461684 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/jnpfPush/package.json @@ -0,0 +1,8 @@ +{ + "name": "jnpfPush", + "dependencies": {}, + "extensions": { + "uni-cloud-push": {}, + "uni-cloud-jql": {} + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/JQL查询.jql b/uniCloud-aliyun/database/JQL查询.jql new file mode 100644 index 0000000..35d21de --- /dev/null +++ b/uniCloud-aliyun/database/JQL查询.jql @@ -0,0 +1,12 @@ +// 本文件用于,使用JQL语法操作项目关联的uniCloud空间的数据库,方便开发调试和远程数据库管理 +// 编写clientDB的js API(也支持常规js语法,比如var),可以对云数据库进行增删改查操作。不支持uniCloud-db组件写法 +// 可以全部运行,也可以选中部分代码运行。点击工具栏上的运行按钮或者按下【F5】键运行代码 +// 如果文档中存在多条JQL语句,只有最后一条语句生效 +// 如果混写了普通js,最后一条语句需是数据库操作语句 +// 此处代码运行不受DB Schema的权限控制,移植代码到实际业务中注意在schema中配好permission +// 不支持clientDB的action +// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database.html#limit +// 详细JQL语法,请参考:https://uniapp.dcloud.net.cn/uniCloud/jql.html + +// 下面示例查询uni-id-users表的所有数据 +db.collection('uni-id-users').get(); diff --git a/uni_modules/iRainna-dayjs/changelog.md b/uni_modules/iRainna-dayjs/changelog.md new file mode 100644 index 0000000..92bf71c --- /dev/null +++ b/uni_modules/iRainna-dayjs/changelog.md @@ -0,0 +1,4 @@ +## 1.0.1(2024-08-09) +更新文档 +## 1.0.0(2023-09-19) +first diff --git a/uni_modules/iRainna-dayjs/js_sdk/dayjs.min.js b/uni_modules/iRainna-dayjs/js_sdk/dayjs.min.js new file mode 100644 index 0000000..0eecdfb --- /dev/null +++ b/uni_modules/iRainna-dayjs/js_sdk/dayjs.min.js @@ -0,0 +1 @@ +const fn=function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new b(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var b=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t) { +// const context = UTSHarmony.getUIAbilityContext() as common.UIAbilityContext +// let applicationContext = context.getApplicationContext(); +// let request : Want = { +// bundleName: bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT).name // 加载当前包名 +// } +// try { +// applicationContext.restartApp(request); +// } catch (error) { +// console.error(`restartApp fail, error: ${JSON.stringify(error)}`); +// } +// } +//退出应用 + +export const exitApp : ExitApp = () => { + let pro = new process.ProcessManager(); + pro.exit(0); +} \ No newline at end of file diff --git a/uni_modules/jnpf-exitApp/utssdk/interface.uts b/uni_modules/jnpf-exitApp/utssdk/interface.uts new file mode 100644 index 0000000..2e944dd --- /dev/null +++ b/uni_modules/jnpf-exitApp/utssdk/interface.uts @@ -0,0 +1,2 @@ +// export type RestartApp = () => void +export type ExitApp = () => void \ No newline at end of file diff --git a/uni_modules/jnpf-exitApp/utssdk/unierror.uts b/uni_modules/jnpf-exitApp/utssdk/unierror.uts new file mode 100644 index 0000000..ee086ef --- /dev/null +++ b/uni_modules/jnpf-exitApp/utssdk/unierror.uts @@ -0,0 +1,39 @@ +/* 此规范为 uni 规范,可以按照自己的需要选择是否实现 */ +import { MyApiErrorCode, MyApiFail } from "./interface.uts" +/** + * 错误主题 + * 注意:错误主题一般为插件名称,每个组件不同,需要使用时请更改。 + * [可选实现] + */ +export const UniErrorSubject = 'uts-api'; + + +/** + * 错误信息 + * @UniError + * [可选实现] + */ +export const MyAPIErrors : Map = new Map([ + /** + * 错误码及对应的错误信息 + */ + [9010001, 'custom error mseeage1'], + [9010002, 'custom error mseeage2'], +]); + + +/** + * 错误对象实现 + */ +export class MyApiFailImpl extends UniError implements MyApiFail { + + /** + * 错误对象构造函数 + */ + constructor(errCode : MyApiErrorCode) { + super(); + this.errSubject = UniErrorSubject; + this.errCode = errCode; + this.errMsg = MyAPIErrors.get(errCode) ?? ""; + } +} diff --git a/uni_modules/lsj-upload/changelog.md b/uni_modules/lsj-upload/changelog.md new file mode 100644 index 0000000..0b19561 --- /dev/null +++ b/uni_modules/lsj-upload/changelog.md @@ -0,0 +1,114 @@ +## 2.2.9(2023-06-01) +优化:将是否多选与count字段解绑(原逻辑是count>1为允许多选),改为新增multiple属性控制是否多选。 +## 2.2.8(2023-06-01) +修复上版本提交时accept测试值未删除导致h5端只能选择图片的问题。 +## 2.2.7(2023-05-06) +应群友建议,当instantly为true时,触发change事件后延迟1000毫秒再自动上传,方便动态修改参数,其实个人还是建议想在change事件动态设置参数的伙伴将instantly设置为false,修改参数后手动调用upload() +## 2.2.6(2023-02-09) +修复多个文件同时选择时返回多次change回调的问题 +## 2.2.5(2022-12-27) +1.修复多选文件时未能正常校验数量的问题; +2.app端与H5端支持单选或多选文件,通过count数量控制,超过1开启多选。 +## 2.2.4(2022-12-27) +1.修复多选文件时未能正常校验数量的问题; +2.app端修复多选只取到第一个文件的问题。 +## 2.2.3(2022-12-06) +修复手动调用show()导致count失效的问题 +## 2.2.2(2022-12-01) +Vue3自行修改兼容 +## 2.2.1(2022-10-19) +修复childId警告提示 +## 2.2.0(2022-10-10) +更新app端webview窗口参数clidId,默认值添加时间戳保证唯一性 +## 2.1.9(2022-07-13) +[修复] app端选择文件后初始化设置的文件列表被清空问题 +## 2.1.8(2022-07-13) +[新增] ref方法初始化文件列表,用于已提交后再次编辑时需带入已上传文件:setFiles(files),可传入数组或Map对象,传入格式请与组件选择返回格式保持一致,且name为必须属性。 +## 2.1.7(2022-07-12) +修复ios端偶现创建webview初始化参数未生效的问题 +## 2.1.6(2022-07-11) +[修复]:修复上个版本更新导致nvue窗口组件不能选择文件的问题; +[新增]: +1.应群友建议(填写禁止格式太多)格式限制formats由原来填写禁止选择的格式改为填写允许被选择的格式; +2.应群友建议(增加上传结束回调事件),上传结束回调事件@uploadEnd +3.如能帮到你请留下你的免费好评,组件使用过程中有问题可以加QQ群交流,至于Map对象怎么使用这类前端基础问题请自行百度 +## 2.1.5(2022-07-01) +app端组件销毁时添加自动销毁webview功能,避免v-if销毁组件的情况控件还能被点击的问题 +## 2.1.4(2022-07-01) +修复小程序端回显问题 +## 2.1.3(2022-06-30) +回调事件返回参数新增path字段(文件临时地址),用于回显 +## 2.1.2(2022-06-16) +修复APP端Tabbar窗口无法选择文件的问题 +## 2.1.1(2022-06-16) +优化: +1.组件优化为允许在v-if中使用; +2.允许option直接在data赋值,不再强制在onRead中初始化; +## 2.1.0(2022-06-13) +h5 pc端更改为单次可多选 +## 2.0.9(2022-06-10) +更新演示内容,部分同学不知道怎么获取服务端返回的数据 +## 2.0.8(2022-06-09) +优化动态更新上传参数函数,具体查看下方说明:动态更新参数演示 +## 2.0.7(2022-06-07) +新增wxFileType属性,用于小程序端选择附件时可选文件类型 +## 2.0.6(2022-06-07) +修复小程序端真机选择文件提示失败的问题 +## 2.0.5(2022-06-02) +优化小程序端调用hide()后未阻止触发文件选择问题 +## 2.0.4(2022-06-01) +优化APP端选择器初始定位 +## 2.0.3(2022-05-31) +修复nvue窗口选择文件报错问题 +## 2.0.2(2022-05-20) +修复ios端opiton设置过早未传入webview导致不自动上传问题 +## 2.0.1(2022-05-19) +修复APP端子窗口点击选择文件不响应问题 +## 2.0.0(2022-05-18) +此次组件更新至2.0版本,与1.0版本使用上略有差异,已使用1.0的同学请自行斟酌是否需要升级! +部分差异: +一、 2.0新增异步触发上传功能; +二、2.0新增文件批量上传功能; +三、2.0优化option,剔除属性,只保留上传接口所需字段,且允许异步更改option的值; +四、组件增加size(文件大小限制)、count(文件个数限制)、formats(文件后缀限制)、accept(文件类型限制)、instantly(是否立即自动上传)、debug(日志打印)等属性; +五、回调事件取消input事件、callback事件,新增change事件和progress事件; +六、ref事件新增upload事件、clear事件; +七、优化组件代码,show和hide函数改为显示隐藏,不再重复开关webview; + +## 1.2.3(2022-03-22) +修复Demo里传入待完善功能[手动上传属性manual=true]导致不自动上传的问题,手动提交上传待下个版本更新 +## 1.2.2(2022-02-21) +修复上版本APP优化导致H5和小程序端不自动初始化的问题,此次更新仅修复此问题。异步提交功能下个版本更新~ +## 1.2.1(2022-01-25) +QQ1群已满,已开放2群:469580165 +## 1.2.0(2021-12-09) +优化APP端页面中DOM重排后每次需要重新定位的问题 +## 1.1.1(2021-12-09) +优化,与上版本使用方式有改变,请检查后确认是否需要更新,create更名为show, close更名为hide,取消初始化时手动create, 传参方式改为props=>option +## 1.1.0(2021-12-09) +新增refresh方法,用于DOM发生重排时重新定位控件(APP端) +## 1.0.9(2021-07-15) +修复上传进度未同步渲染,直接返回100%的BUG +## 1.0.8(2021-07-12) +修复H5端传入height和width未生效的bug +## 1.0.7(2021-07-07) +修复h5和小程序端上传完成callback未返回fileName字段问题 +## 1.0.6(2021-07-07) +修复h5端提示信息debug +## 1.0.5(2021-06-29) +感谢小伙伴找出bug,上传成功回调success未置为true,已修复 +## 1.0.4(2021-06-28) +新增兼容APP,H5,小程序手动关闭控件,关闭后不再弹出文件选择框,需要重新create再次开启 +## 1.0.3(2021-06-28) +close增加条件编译,除app端外不需要close +## 1.0.2(2021-06-28) +1.修复页面滚动位置后再create控件导致控件位置不正确的问题; +2.修复nvue无法create控件; +3.示例项目新增nvue使用案例; +## 1.0.1(2021-06-28) +因为有的朋友不清楚app端切换tab时应该怎么处理webview,现重新上传一版示例项目,需要做tab切换的朋友可以导入示例项目查看 +## 1.0.0(2021-06-25) +此插件为l-file插件中上传功能改版,更新内容为: +1. 按钮内嵌入页面,不再强制固定底部,可跟随页面滚动 +2.无需再单独弹框点击上传,减去中间层 +3.通过slot自定义按钮样式 diff --git a/uni_modules/lsj-upload/components/lsj-upload/LsjFile.js b/uni_modules/lsj-upload/components/lsj-upload/LsjFile.js new file mode 100644 index 0000000..f3082c3 --- /dev/null +++ b/uni_modules/lsj-upload/components/lsj-upload/LsjFile.js @@ -0,0 +1,439 @@ +export class LsjFile { + constructor(data) { + this.dom = null; + // files.type = waiting(等待上传)|| loading(上传中)|| success(成功) || fail(失败) + this.files = new Map(); + this.debug = data.debug || false; + this.id = data.id; + this.width = data.width; + this.height = data.height; + this.option = data.option; + this.instantly = data.instantly; + this.prohibited = data.prohibited; + this.onchange = data.onchange; + this.onprogress = data.onprogress; + this.uploadHandle = this._uploadHandle; + // #ifdef MP-WEIXIN + this.uploadHandle = this._uploadHandleWX; + // #endif + } + + + /** + * 创建File节点 + * @param {string}path webview地址 + */ + create(path) { + if (!this.dom) { + // #ifdef H5 + let dom = document.createElement('input'); + dom.type = 'file' + dom.value = '' + dom.style.height = this.height + dom.style.width = this.width + dom.style.position = 'absolute' + dom.style.top = 0 + dom.style.left = 0 + dom.style.right = 0 + dom.style.bottom = 0 + dom.style.opacity = 0 + dom.style.zIndex = 999 + dom.accept = this.prohibited.accept; + if (this.prohibited.multiple) { + dom.multiple = 'multiple'; + } + dom.onchange = event => { + for (let file of event.target.files) { + if (this.files.size >= this.prohibited.count) { + this.toast(`只允许上传${this.prohibited.count}个文件`); + this.dom.value = ''; + break; + } + this.addFile(file); + } + + this._uploadAfter(); + + this.dom.value = ''; + }; + this.dom = dom; + // #endif + + // #ifdef APP-PLUS + let styles = { + top: '-200px', + left: 0, + width: '1px', + height: '200px', + background: 'transparent' + }; + let extras = { + debug: this.debug, + instantly: this.instantly, + prohibited: this.prohibited, + } + this.dom = plus.webview.create(path, this.id, styles, extras); + this.setData(this.option); + this._overrideUrlLoading(); + // #endif + return this.dom; + } + } + + + /** + * 设置上传参数 + * @param {object|string}name 上传参数,支持a.b 和 a[b] + */ + setData() { + let [name, value = ''] = arguments; + if (typeof name === 'object') { + Object.assign(this.option, name); + } else { + this._setValue(this.option, name, value); + } + + this.debug && console.log(JSON.stringify(this.option)); + + // #ifdef APP-PLUS + this.dom.evalJS(`vm.setData('${JSON.stringify(this.option)}')`); + // #endif + } + + /** + * 上传 + * @param {string}name 文件名称 + */ + async upload(name = '') { + if (!this.option.url) { + throw Error('未设置上传地址'); + } + + // #ifndef APP-PLUS + if (name && this.files.has(name)) { + await this.uploadHandle(this.files.get(name)); + } else { + for (let item of this.files.values()) { + if (item.type === 'waiting' || item.type === 'fail') { + await this.uploadHandle(item); + } + } + } + // #endif + + // #ifdef APP-PLUS + this.dom && this.dom.evalJS(`vm.upload('${name}')`); + // #endif + } + + // 选择文件change + addFile(file, isCallChange) { + let name = file.name; + this.debug && console.log('文件名称', name, '大小', file.size); + const units = { + KB: 1024, + MB: 1024 * 1024, + GB: 1024 * 1024 * 1024, + }; + if (file) { + // 限制文件格式 + let path = ''; + let suffix = name.substring(name.lastIndexOf(".") + 1).toLowerCase(); + let formats = this.prohibited.formats.toLowerCase(); + // #ifndef MP-WEIXIN + path = URL.createObjectURL(file); + // #endif + // #ifdef MP-WEIXIN + path = file.path; + // #endif + if (formats && !formats.includes(suffix)) { + this.toast(`不支持上传${suffix.toUpperCase()}格式文件`); + return false; + } + // 限制文件大小 + if (file.size > units[this.prohibited.sizeUnit] * Math.abs(this.prohibited.size)) { + this.toast(`文件大小超过${this.prohibited.size}${this.prohibited.sizeUnit}`) + return false; + } + this.files.set(file.name, { + file, + path, + name: file.name, + fullName: file.name, + size: file.size, + progress: 0, + type: 'waiting' + }); + return true; + } + } + + /** + * 移除文件 + * @param {string}name 不传name默认移除所有文件,传入name移除指定name的文件 + */ + clear(name = '') { + // #ifdef APP-PLUS + this.dom && this.dom.evalJS(`vm.clear('${name}')`); + // #endif + + if (!name) { + this.files.clear(); + } else { + this.files.delete(name); + } + return this.onchange(this.files); + } + + /** + * 提示框 + * @param {string}msg 轻提示内容 + */ + toast(msg) { + uni.showToast({ + title: msg, + icon: 'none' + }); + } + + /** + * 微信小程序选择文件 + * @param {number}count 可选择文件数量 + */ + chooseMessageFile(type, count) { + wx.chooseMessageFile({ + count: count, + type: type, + success: ({ + tempFiles + }) => { + for (let file of tempFiles) { + this.addFile(file); + } + this._uploadAfter(); + }, + fail: () => { + this.toast(`打开失败`); + } + }) + } + + _copyObject(obj) { + if (typeof obj !== "undefined") { + return JSON.parse(JSON.stringify(obj)); + } else { + return obj; + } + } + + /** + * 自动根据字符串路径设置对象中的值 支持.和[] + * @param {Object} dataObj 数据源 + * @param {String} name 支持a.b 和 a[b] + * @param {String} value 值 + * setValue(dataObj, name, value); + */ + _setValue(dataObj, name, value) { + // 通过正则表达式 查找路径数据 + let dataValue; + if (typeof value === "object") { + dataValue = this._copyObject(value); + } else { + dataValue = value; + } + let regExp = new RegExp("([\\w$]+)|\\[(:\\d)\\]", "g"); + const patten = name.match(regExp); + // 遍历路径 逐级查找 最后一级用于直接赋值 + for (let i = 0; i < patten.length - 1; i++) { + let keyName = patten[i]; + if (typeof dataObj[keyName] !== "object") dataObj[keyName] = {}; + dataObj = dataObj[keyName]; + } + // 最后一级 + dataObj[patten[patten.length - 1]] = dataValue; + this.debug && console.log('参数更新后', JSON.stringify(this.option)); + } + + _uploadAfter() { + this.onchange(this.files); + setTimeout(() => { + this.instantly && this.upload(); + }, 1000) + } + + _overrideUrlLoading() { + this.dom.overrideUrlLoading({ + mode: 'reject' + }, e => { + let { + retype, + item, + files, + end + } = this._getRequest( + e.url + ); + let _this = this; + switch (retype) { + case 'updateOption': + this.dom.evalJS(`vm.setData('${JSON.stringify(_this.option)}')`); + break + case 'change': + try { + _this.files = new Map([..._this.files, ...JSON.parse(unescape(files))]); + } catch (e) { + return console.error('出错了,请检查代码') + } + _this.onchange(_this.files); + break + case 'progress': + try { + item = JSON.parse(unescape(item)); + } catch (e) { + return console.error('出错了,请检查代码') + } + _this._changeFilesItem(item, end); + break + default: + break + } + }) + } + + _getRequest(url) { + let theRequest = new Object() + let index = url.indexOf('?') + if (index != -1) { + let str = url.substring(index + 1) + let strs = str.split('&') + for (let i = 0; i < strs.length; i++) { + theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1]) + } + } + return theRequest + } + + _changeFilesItem(item, end = false) { + this.debug && console.log('onprogress', JSON.stringify(item)); + this.onprogress(item, end); + this.files.set(item.name, item); + } + + _uploadHandle(item) { + item.type = 'loading'; + delete item.responseText; + return new Promise((resolve, reject) => { + this.debug && console.log('option', JSON.stringify(this.option)); + let { + url, + name, + method = 'POST', + header, + formData, + data, + parentId + } = this.option; + let form = new FormData(); + for (let keys in formData) { + form.append(keys, formData[keys]) + } + for (let keys in data) { + form.append(keys, data[keys]) + } + form.append(name, item.file); + let xmlRequest = new XMLHttpRequest(); + xmlRequest.open(method, `${url}?parentId=${parentId}`, true); + for (let keys in header) { + xmlRequest.setRequestHeader(keys, header[keys]) + } + + xmlRequest.upload.addEventListener( + 'progress', + event => { + if (event.lengthComputable) { + let progress = Math.ceil((event.loaded * 100) / event.total) + if (progress <= 100) { + item.progress = progress; + this._changeFilesItem(item); + } + } + }, + false + ); + + xmlRequest.ontimeout = () => { + console.error('请求超时') + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + + xmlRequest.onreadystatechange = ev => { + if (xmlRequest.readyState == 4) { + if (xmlRequest.status == 200) { + this.debug && console.log('上传完成:' + xmlRequest.responseText) + item['responseText'] = xmlRequest.responseText; + item.type = 'success'; + this._changeFilesItem(item, true); + return resolve(true); + } else if (xmlRequest.status == 0) { + console.error( + 'status = 0 :请检查请求头Content-Type与服务端是否匹配,服务端已正确开启跨域,并且nginx未拦截阻止请求' + ) + } + console.error('--ERROR--:status = ' + xmlRequest.status) + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + } + xmlRequest.send(form) + }); + } + /* 小程序上传 */ + _uploadHandleWX(item) { + item.type = 'loading'; + delete item.responseText; + return new Promise((resolve, reject) => { + this.debug && console.log('option', JSON.stringify(this.option)); + let form = { + filePath: item.file.path, + ...this.option, + url: this.option.url + '?parentId=' + this.option.parentId + '&fileName=' + item.file + .name, + formData: this.option.data || {}, + }; + form['fail'] = ({ + errMsg = '' + }) => { + console.error('--ERROR--:' + errMsg) + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + form['success'] = res => { + if (res.statusCode == 200) { + this.debug && console.log('上传完成,微信端返回不一定是字符串,根据接口返回格式判断是否需要JSON.parse:' + + res.data) + item['responseText'] = res.data; + item.type = 'success'; + this._changeFilesItem(item, true); + return resolve(true); + } + item.type = 'fail'; + this._changeFilesItem(item, true); + return resolve(false); + } + + let xmlRequest = uni.uploadFile(form); + xmlRequest.onProgressUpdate(({ + progress = 0 + }) => { + if (progress <= 100) { + item.progress = progress; + this._changeFilesItem(item); + } + }) + }); + } +} \ No newline at end of file diff --git a/uni_modules/lsj-upload/components/lsj-upload/lsj-upload.vue b/uni_modules/lsj-upload/components/lsj-upload/lsj-upload.vue new file mode 100644 index 0000000..9d7d003 --- /dev/null +++ b/uni_modules/lsj-upload/components/lsj-upload/lsj-upload.vue @@ -0,0 +1,406 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/lsj-upload/hybrid/html/js/vue.min.js b/uni_modules/lsj-upload/hybrid/html/js/vue.min.js new file mode 100644 index 0000000..97ac4cf --- /dev/null +++ b/uni_modules/lsj-upload/hybrid/html/js/vue.min.js @@ -0,0 +1,8 @@ +/*! + * Vue.js v2.3.0 + * (c) 2014-2017 Evan You + * Released under the MIT License. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Vue=t()}(this,function(){"use strict";function e(e){return void 0===e||null===e}function t(e){return void 0!==e&&null!==e}function n(e){return!0===e}function r(e){return"string"==typeof e||"number"==typeof e}function i(e){return null!==e&&"object"==typeof e}function o(e){return"[object Object]"===Ai.call(e)}function a(e){return"[object RegExp]"===Ai.call(e)}function s(e){return null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function c(e){var t=parseFloat(e);return isNaN(t)?e:t}function u(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}function f(e,t){return Si.call(e,t)}function p(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}function d(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function v(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function h(e,t){for(var n in t)e[n]=t[n];return e}function m(e){for(var t={},n=0;n=0&&$o[n].id>e.id;)n--;$o.splice(Math.max(n,Ao)+1,0,e)}else $o.push(e);Co||(Co=!0,ro($e))}}function Ae(e){To.clear(),Oe(e,To)}function Oe(e,t){var n,r,o=Array.isArray(e);if((o||i(e))&&Object.isExtensible(e)){if(e.__ob__){var a=e.__ob__.dep.id;if(t.has(a))return;t.add(a)}if(o)for(n=e.length;n--;)Oe(e[n],t);else for(r=Object.keys(e),n=r.length;n--;)Oe(e[r[n]],t)}}function Se(e,t,n){Eo.get=function(){return this[t][n]},Eo.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Eo)}function Te(e){e._watchers=[];var t=e.$options;t.props&&Ee(e,t.props),t.methods&&Me(e,t.methods),t.data?je(e):E(e._data={},!0),t.computed&&Le(e,t.computed),t.watch&&Pe(e,t.watch)}function Ee(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[],o=!e.$parent;lo.shouldConvert=o;for(var a in t)!function(o){i.push(o);var a=U(o,t,n,e);j(r,o,a),o in e||Se(e,"_props",o)}(a);lo.shouldConvert=!0}function je(e){var t=e.$options.data;t=e._data="function"==typeof t?Ne(t,e):t||{},o(t)||(t={});for(var n=Object.keys(t),r=e.$options.props,i=n.length;i--;)r&&f(r,n[i])||$(n[i])||Se(e,"_data",n[i]);E(t,!0)}function Ne(e,t){try{return e.call(t)}catch(e){return C(e,t,"data()"),{}}}function Le(e,t){var n=e._computedWatchers=Object.create(null);for(var r in t){var i=t[r],o="function"==typeof i?i:i.get;n[r]=new So(e,o,g,jo),r in e||Ie(e,r,i)}}function Ie(e,t,n){"function"==typeof n?(Eo.get=De(t),Eo.set=g):(Eo.get=n.get?!1!==n.cache?De(t):n.get:g,Eo.set=n.set?n.set:g),Object.defineProperty(e,t,Eo)}function De(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),oo.target&&t.depend(),t.value}}function Me(e,t){e.$options.props;for(var n in t)e[n]=null==t[n]?g:d(t[n],e)}function Pe(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i=0||n.indexOf(e[i])<0)&&r.push(e[i]);return r}return e}function pt(e){this._init(e)}function dt(e){e.use=function(e){if(!e.installed){var t=v(arguments,1);return t.unshift(this),"function"==typeof e.install?e.install.apply(e,t):"function"==typeof e&&e.apply(null,t),e.installed=!0,this}}}function vt(e){e.mixin=function(e){this.options=B(this.options,e)}}function ht(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,i=e._Ctor||(e._Ctor={});if(i[r])return i[r];var o=e.name||n.options.name,a=function(e){this._init(e)};return a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.cid=t++,a.options=B(n.options,e),a.super=n,a.options.props&&mt(a),a.options.computed&>(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,Di.forEach(function(e){a[e]=n[e]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=h({},a.options),i[r]=a,a}}function mt(e){var t=e.options.props;for(var n in t)Se(e.prototype,"_props",n)}function gt(e){var t=e.options.computed;for(var n in t)Ie(e.prototype,n,t[n])}function yt(e){Di.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&o(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}function _t(e){return e&&(e.Ctor.options.name||e.tag)}function bt(e,t){return"string"==typeof e?e.split(",").indexOf(t)>-1:!!a(e)&&e.test(t)}function $t(e,t,n){for(var r in e){var i=e[r];if(i){var o=_t(i.componentOptions);o&&!n(o)&&(i!==t&&xt(i),e[r]=null)}}}function xt(e){e&&e.componentInstance.$destroy()}function wt(e){for(var n=e.data,r=e,i=e;t(i.componentInstance);)i=i.componentInstance._vnode,i.data&&(n=Ct(i.data,n));for(;t(r=r.parent);)r.data&&(n=Ct(n,r.data));return kt(n)}function Ct(e,n){return{staticClass:At(e.staticClass,n.staticClass),class:t(e.class)?[e.class,n.class]:n.class}}function kt(e){var n=e.class,r=e.staticClass;return t(r)||t(n)?At(r,Ot(n)):""}function At(e,t){return e?t?e+" "+t:e:t||""}function Ot(n){if(e(n))return"";if("string"==typeof n)return n;var r="";if(Array.isArray(n)){for(var o,a=0,s=n.length;a-1?ua[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:ua[e]=/HTMLUnknownElement/.test(t.toString())}function Et(e){if("string"==typeof e){var t=document.querySelector(e);return t||document.createElement("div")}return e}function jt(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)}function Nt(e,t){return document.createElementNS(ia[e],t)}function Lt(e){return document.createTextNode(e)}function It(e){return document.createComment(e)}function Dt(e,t,n){e.insertBefore(t,n)}function Mt(e,t){e.removeChild(t)}function Pt(e,t){e.appendChild(t)}function Rt(e){return e.parentNode}function Ft(e){return e.nextSibling}function Bt(e){return e.tagName}function Ht(e,t){e.textContent=t}function Ut(e,t,n){e.setAttribute(t,n)}function Vt(e,t){var n=e.data.ref;if(n){var r=e.context,i=e.componentInstance||e.elm,o=r.$refs;t?Array.isArray(o[n])?l(o[n],i):o[n]===i&&(o[n]=void 0):e.data.refInFor?Array.isArray(o[n])&&o[n].indexOf(i)<0?o[n].push(i):o[n]=[i]:o[n]=i}}function zt(e,n){return e.key===n.key&&e.tag===n.tag&&e.isComment===n.isComment&&t(e.data)===t(n.data)&&Jt(e,n)}function Jt(e,n){if("input"!==e.tag)return!0;var r;return(t(r=e.data)&&t(r=r.attrs)&&r.type)===(t(r=n.data)&&t(r=r.attrs)&&r.type)}function Kt(e,n,r){var i,o,a={};for(i=n;i<=r;++i)o=e[i].key,t(o)&&(a[o]=i);return a}function qt(e,t){(e.data.directives||t.data.directives)&&Wt(e,t)}function Wt(e,t){var n,r,i,o=e===pa,a=t===pa,s=Zt(e.data.directives,e.context),c=Zt(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],i=c[n],r?(i.oldValue=r.value,Yt(i,"update",t,e),i.def&&i.def.componentUpdated&&l.push(i)):(Yt(i,"bind",t,e),i.def&&i.def.inserted&&u.push(i));if(u.length){var f=function(){for(var n=0;n=0&&" "===(m=e.charAt(h));h--);m&&_a.test(m)||(l=!0)}}else void 0===o?(v=i+1,o=e.slice(0,i).trim()):t();if(void 0===o?o=e.slice(0,i).trim():0!==v&&t(),a)for(i=0;i=Bo}function gn(e){return 34===e||39===e}function yn(e){var t=1;for(zo=Vo;!mn();)if(e=hn(),gn(e))_n(e);else if(91===e&&t++,93===e&&t--,0===t){Jo=Vo;break}}function _n(e){for(var t=e;!mn()&&(e=hn())!==t;);}function bn(e,t,n){Ko=n;var r=t.value,i=t.modifiers,o=e.tag,a=e.attrsMap.type;if("select"===o)wn(e,r,i);else if("input"===o&&"checkbox"===a)$n(e,r,i);else if("input"===o&&"radio"===a)xn(e,r,i);else if("input"===o||"textarea"===o)Cn(e,r,i);else if(!Pi.isReservedTag(o))return pn(e,r,i),!1;return!0}function $n(e,t,n){var r=n&&n.number,i=ln(e,"value")||"null",o=ln(e,"true-value")||"true",a=ln(e,"false-value")||"false";an(e,"checked","Array.isArray("+t+")?_i("+t+","+i+")>-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),un(e,$a,"var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$c){$$i<0&&("+t+"=$$a.concat($$v))}else{$$i>-1&&("+t+"=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{"+dn(t,"$$c")+"}",null,!0)}function xn(e,t,n){var r=n&&n.number,i=ln(e,"value")||"null";i=r?"_n("+i+")":i,an(e,"checked","_q("+t+","+i+")"),un(e,$a,dn(t,i),null,!0)}function wn(e,t,n){var r=n&&n.number,i='Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(r?"_n(val)":"val")+"})",o="var $$selectedVal = "+i+";";o=o+" "+dn(t,"$event.target.multiple ? $$selectedVal : $$selectedVal[0]"),un(e,"change",o,null,!0)}function Cn(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?ba:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=dn(t,l);c&&(f="if($event.target.composing)return;"+f),an(e,"value","("+t+")"),un(e,u,f,null,!0),(s||a||"number"===r)&&un(e,"blur","$forceUpdate()")}function kn(e){var n;t(e[ba])&&(n=zi?"change":"input",e[n]=[].concat(e[ba],e[n]||[]),delete e[ba]),t(e[$a])&&(n=Zi?"click":"change",e[n]=[].concat(e[$a],e[n]||[]),delete e[$a])}function An(e,t,n,r,i){if(n){var o=t,a=qo;t=function(n){null!==(1===arguments.length?o(n):o.apply(null,arguments))&&On(e,t,r,a)}}qo.addEventListener(e,t,Gi?{capture:r,passive:i}:r)}function On(e,t,n,r){(r||qo).removeEventListener(e,t,n)}function Sn(t,n){if(!e(t.data.on)||!e(n.data.on)){var r=n.data.on||{},i=t.data.on||{};qo=n.elm,kn(r),G(r,i,An,On,n.context)}}function Tn(n,r){if(!e(n.data.domProps)||!e(r.data.domProps)){var i,o,a=r.elm,s=n.data.domProps||{},c=r.data.domProps||{};t(c.__ob__)&&(c=r.data.domProps=h({},c));for(i in s)e(c[i])&&(a[i]="");for(i in c)if(o=c[i],"textContent"!==i&&"innerHTML"!==i||(r.children&&(r.children.length=0),o!==s[i]))if("value"===i){a._value=o;var u=null==o?"":String(o);En(a,r,u)&&(a.value=u)}else a[i]=o}}function En(e,t,n){return!e.composing&&("option"===t.tag||jn(e,n)||Nn(e,n))}function jn(e,t){return document.activeElement!==e&&e.value!==t}function Nn(e,n){var r=e.value,i=e._vModifiers;return t(i)&&i.number||"number"===e.type?c(r)!==c(n):t(i)&&i.trim?r.trim()!==n.trim():r!==n}function Ln(e){var t=In(e.style);return e.staticStyle?h(e.staticStyle,t):t}function In(e){return Array.isArray(e)?m(e):"string"==typeof e?Ca(e):e}function Dn(e,t){var n,r={};if(t)for(var i=e;i.componentInstance;)i=i.componentInstance._vnode,i.data&&(n=Ln(i.data))&&h(r,n);(n=Ln(e.data))&&h(r,n);for(var o=e;o=o.parent;)o.data&&(n=Ln(o.data))&&h(r,n);return r}function Mn(n,r){var i=r.data,o=n.data;if(!(e(i.staticStyle)&&e(i.style)&&e(o.staticStyle)&&e(o.style))){var a,s,c=r.elm,u=o.staticStyle,l=o.normalizedStyle||o.style||{},f=u||l,p=In(r.data.style)||{};r.data.normalizedStyle=t(p.__ob__)?h({},p):p;var d=Dn(r,!0);for(s in f)e(d[s])&&Oa(c,s,"");for(s in d)(a=d[s])!==f[s]&&Oa(c,s,null==a?"":a)}}function Pn(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function Rn(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t);else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");e.setAttribute("class",n.trim())}}function Fn(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&h(t,ja(e.name||"v")),h(t,e),t}return"string"==typeof e?ja(e):void 0}}function Bn(e){Fa(function(){Fa(e)})}function Hn(e,t){(e._transitionClasses||(e._transitionClasses=[])).push(t),Pn(e,t)}function Un(e,t){e._transitionClasses&&l(e._transitionClasses,t),Rn(e,t)}function Vn(e,t,n){var r=zn(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===La?Ma:Ra,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=La,l=a,f=o.length):t===Ia?u>0&&(n=Ia,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?La:Ia:null,f=n?n===La?o.length:c.length:0),{type:n,timeout:l,propCount:f,hasTransform:n===La&&Ba.test(r[Da+"Property"])}}function Jn(e,t){for(;e.length1}function Yn(e,t){!0!==t.data.show&&qn(t)}function Qn(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=e.options.length;s-1,a.selected!==o&&(a.selected=o);else if(y(er(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Xn(e,t){for(var n=0,r=t.length;n=0&&a[i].lowerCasedTag!==s;i--);else i=0;if(i>=0){for(var c=a.length-1;c>=i;c--)t.end&&t.end(a[c].tag,n,r);a.length=i,o=i&&a[i-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,r):"p"===s&&(t.start&&t.start(e,[],!1,n,r),t.end&&t.end(e,n,r))}for(var i,o,a=[],s=t.expectHTML,c=t.isUnaryTag||Ni,u=t.canBeLeftOpenTag||Ni,l=0;e;){if(i=e,o&&Ns(o)){var f=o.toLowerCase(),p=Ls[f]||(Ls[f]=new RegExp("([\\s\\S]*?)(]*>)","i")),d=0,v=e.replace(p,function(e,n,r){return d=r.length,Ns(f)||"noscript"===f||(n=n.replace(//g,"$1").replace(//g,"$1")),t.chars&&t.chars(n),""});l+=e.length-v.length,e=v,r(f,l-d,l)}else{var h=e.indexOf("<");if(0===h){if(fs.test(e)){var m=e.indexOf("--\x3e");if(m>=0){n(m+3);continue}}if(ps.test(e)){var g=e.indexOf("]>");if(g>=0){n(g+2);continue}}var y=e.match(ls);if(y){n(y[0].length);continue}var _=e.match(us);if(_){var b=l;n(_[0].length),r(_[1],b,l);continue}var $=function(){var t=e.match(ss);if(t){var r={tagName:t[1],attrs:[],start:l};n(t[0].length);for(var i,o;!(i=e.match(cs))&&(o=e.match(os));)n(o[0].length),r.attrs.push(o);if(i)return r.unarySlash=i[1],n(i[0].length),r.end=l,r}}();if($){!function(e){var n=e.tagName,i=e.unarySlash;s&&("p"===o&&rs(n)&&r(o),u(n)&&o===n&&r(n));for(var l=c(n)||"html"===n&&"head"===o||!!i,f=e.attrs.length,p=new Array(f),d=0;d=0){for(w=e.slice(h);!(us.test(w)||ss.test(w)||fs.test(w)||ps.test(w)||(C=w.indexOf("<",1))<0);)h+=C,w=e.slice(h);x=e.substring(0,h),n(h)}h<0&&(x=e,e=""),t.chars&&x&&t.chars(x)}if(e===i){t.chars&&t.chars(e);break}}r()}function mr(e,t){var n=t?Rs(t):Ps;if(n.test(e)){for(var r,i,o=[],a=n.lastIndex=0;r=n.exec(e);){i=r.index,i>a&&o.push(JSON.stringify(e.slice(a,i)));var s=tn(r[1].trim());o.push("_s("+s+")"),a=i+r[0].length}return a0,Ki=Vi&&Vi.indexOf("edge/")>0,qi=Vi&&Vi.indexOf("android")>0,Wi=Vi&&/iphone|ipad|ipod|ios/.test(Vi),Zi=Vi&&/chrome\/\d+/.test(Vi)&&!Ki,Gi=!1;if(Ui)try{var Yi={};Object.defineProperty(Yi,"passive",{get:function(){Gi=!0}}),window.addEventListener("test-passive",null,Yi)}catch(e){}var Qi,Xi,eo=function(){return void 0===Qi&&(Qi=!Ui&&"undefined"!=typeof global&&"server"===global.process.env.VUE_ENV),Qi},to=Ui&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,no="undefined"!=typeof Symbol&&k(Symbol)&&"undefined"!=typeof Reflect&&k(Reflect.ownKeys),ro=function(){function e(){r=!1;var e=n.slice(0);n.length=0;for(var t=0;t1?v(n):n;for(var r=v(arguments,1),i=0,o=n.length;i1&&(t[n[0].trim()]=n[1].trim())}}),t}),ka=/^--/,Aa=/\s*!important$/,Oa=function(e,t,n){if(ka.test(t))e.style.setProperty(t,n);else if(Aa.test(n))e.style.setProperty(t,n.replace(Aa,""),"important");else{var r=Ta(t);if(Array.isArray(n))for(var i=0,o=n.length;iv?(f=e(i[g+1])?null:i[g+1].elm,y(n,f,i,d,g,o)):d>g&&b(n,r,p,v)}function w(r,i,o,a){if(r!==i){if(n(i.isStatic)&&n(r.isStatic)&&i.key===r.key&&(n(i.isCloned)||n(i.isOnce)))return i.elm=r.elm,void(i.componentInstance=r.componentInstance);var s,c=i.data;t(c)&&t(s=c.hook)&&t(s=s.prepatch)&&s(r,i);var u=i.elm=r.elm,l=r.children,f=i.children;if(t(c)&&h(i)){for(s=0;s',n.innerHTML.indexOf(t)>0}("\n"," "),ts=u("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),ns=u("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),rs=u("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),is=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^\s"'=<>`]+)/.source],os=new RegExp("^\\s*"+/([^\s"'<>\/=]+)/.source+"(?:\\s*("+/(?:=)/.source+")\\s*(?:"+is.join("|")+"))?"),as="[a-zA-Z_][\\w\\-\\.]*",ss=new RegExp("^<((?:"+as+"\\:)?"+as+")"),cs=/^\s*(\/?)>/,us=new RegExp("^<\\/((?:"+as+"\\:)?"+as+")[^>]*>"),ls=/^]+>/i,fs=/^ + + + 提示:【path主要用于图片视频类文件回显,他用自行处理】:{{item.path}} + {{item.name}} + 大小:{{item.size}} + 状态:{{item.type}} + 进度:{{item.progress}} + 服务端返回演示:{{item.responseText}} + 重新上传 + 删除 + + + + + + {{item.name}} + 大小:{{item.size}} + 状态:{{item.type}} + 进度:{{item.progress}} + + + + + + + + + + +``` + +--- +* 函数说明 + + +``` javascript +export default { + data() { + return { + // 上传接口参数 + option: { + // 上传服务器地址,需要替换为你的接口地址 + url: 'http://hl.j56.com/dropbox/document/upload', // 该地址非真实路径,需替换为你项目自己的接口地址 + // 上传附件的key + name: 'file', + // 根据你接口需求自定义请求头,默认不要写content-type,让浏览器自适配 + header: { + // 示例参数可删除 + 'Authorization': 'bearer eyJhbGciOiJSUzI1NiIsI', + 'uid': '99', + 'client': 'app', + 'accountid': 'DP', + }, + // 根据你接口需求自定义body参数 + formData: { + // 'orderId': 1000 + } + }, + // 选择文件后是否立即自动上传,true=选择后立即上传 + instantly: true, + // 必传宽高且宽高应与slot宽高保持一致 + width: '180rpx', + height: '180rpx', + // 限制允许上传的格式,空串=不限制,默认为空 + formats: '', + // 文件上传大小限制 + size: 30, + // 文件数量限制 + count: 2, + // 文件回显列表 + files: new Map(), + // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道 + wxFiles: [], + // 是否打印日志 + debug: true, + + + // 演示用 + tabIndex: 0, + list:[], + } + }, + onReady() { + setTimeout(()=>{ + console.log('----演示动态更新参数-----'); + this.$refs['lsjUpload'+this.tabIndex].setData('formData.orderId','动态设置的参数'); + + console.log('以下注释内容为-动态更新参数更多演示,放开后可查看演示效果'); + // 修改option对象的name属性 + // this.$refs.lsjUpload.setData('name','myFile'); + + // 修改option对象的formData内的属性 + // this.$refs.lsjUpload.setData('formData.appid','1111'); + + // 替换option对象的formData + // this.$refs.lsjUpload.setData('formData',{appid:'222'}); + + // option对象的formData新增属性 + // this.$refs.lsjUpload.setData('formData.newkey','新插入到formData的属性'); + + + // ---------演示初始化值,用于已提交后再次编辑时需带入已上传文件------- + // 方式1=传入数组 + // let files1 = [{name: '1.png'},{name: '2.png',}]; + + // 方式2=传入Map对象 + // let files2 = new Map(); + // files2.set('1.png',{name: '1.png'}) + + // 此处调用setFiles设置初始files + // this.$refs.lsjUpload.setFiles(files1); + + // 初始化tab + this.onTab(0); + },2000) + }, + methods: { + // 某文件上传结束回调(成功失败都回调) + onuploadEnd(item) { + console.log(`${item.name}已上传结束,上传状态=${item.type}`); + + // 更新当前窗口状态变化的文件 + this.files.set(item.name,item); + + // ---可删除--演示上传完成后取服务端数据 + if (item['responseText']) { + console.log('演示服务器返回的字符串JSON转Object对象'); + this.files.get(item.name).responseText = JSON.parse(item.responseText); + } + + // 微信小程序Map对象for循环不显示,所以转成普通数组, + // 如果你用不惯Map对象,也可以像这样转普通数组,组件使用Map主要是避免反复文件去重操作 + // #ifdef MP-WEIXIN + this.wxFiles = [...this.files.values()]; + // #endif + + // 强制更新视图 + this.$forceUpdate(); + + + // ---可删除--演示判断是否所有文件均已上传成功 + let isAll = [...this.files.values()].find(item=>item.type!=='success'); + if (!isAll) { + console.log('已全部上传完毕'); + } + else { + console.log(isAll.name+'待上传'); + } + + }, + // 上传进度回调,如果网页上md文档没有渲染出事件名称onprogre,请复制代码的小伙伴自行添加上哈,没有哪个事件是只(item)的 + onprogre(item) { + // 更新当前状态变化的文件 + this.files.set(item.name,item); + + console.log('打印对象',JSON.stringify(this.files.get(item.name))); + // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道 + // #ifdef MP-WEIXIN + this.wxFiles = [...this.files.values()]; + // #endif + + // 强制更新视图 + this.$forceUpdate(); + + }, + // 文件选择回调 + onChange(files) { + console.log('当前选择的文件列表:',JSON.stringify([...files.values()])); + // 更新选择的文件 + this.files = files; + // 强制更新视图 + this.$forceUpdate(); + + // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道 + // #ifdef MP-WEIXIN + this.wxFiles = [...this.files.values()]; + // #endif + + // ---可删除--演示重新定位覆盖层控件 + this.$nextTick(()=>{ + console.log('演示重新定位'); + this.$refs.lsjUpload0.show(); + this.$refs.lsjUpload1.show(); + this.$refs.lsjUpload2.show(); + }); + + }, + // 手动上传 + upload() { + // name=指定文件名,不指定则上传所有type等于waiting和fail的文件 + this.$refs['lsjUpload'+this.tabIndex].upload(); + }, + // 指定上传某个文件 + resetUpload(name) { + this.$refs['lsjUpload'+this.tabIndex].upload(name); + }, + // 移除某个文件 + clear(name) { + // name=指定文件名,不传name默认移除所有文件 + this.$refs['lsjUpload'+this.tabIndex].clear(name); + }, + /** + * ---可删除--演示在组件上方添加新内容DOM变化 + * DOM重排演示,重排后组件内部updated默认会触发show方法,若特殊情况未能触发updated也可以手动调用一次show() + * 什么是DOM重排?自行百度去 + */ + add() { + this.list.push('DOM重排测试'); + }, + /** + * ---可删除--演示Tab切换时覆盖层是否能被点击 + * APP端因为是webview,层级比view高,此时若不希望点击触发选择文件,需要手动调用hide() + * 手动调用hide后,需要调用show()才能恢复覆盖层的点击 + */ + onTab(tabIndex) { + this.$refs.lsjUpload0.hide(); + this.$refs.lsjUpload1.hide(); + + this.tabIndex = tabIndex; + + this.$nextTick(()=>{ + this.$refs['lsjUpload'+this.tabIndex].show(); + }) + + }, + /** + * 打开nvue窗口查看非跟随窗口滚动效果 + */ + open() { + uni.navigateTo({ + url: '/pages/nvue-demo/nvue-demo' + }); + } + } +} + +``` + +## 温馨提示 + +* 文件上传 +0. 如说明表达还不够清楚,不清楚怎么使用可导入完整示例项目运行体验和查看 +1. APP端请优先联调Android,上传成功后再运行iOS端,如iOS返回status=0则需要后端开启允许跨域; +2. header的Content-Type类型需要与服务端要求一致,否则收不到附件(服务端若没有明文规定则可不写,使用默认匹配) +3. 服务端不清楚怎么配置跨域可加群咨询,具体百度~ +4. 欢迎加入QQ讨论群:701468256(已满) +5. 欢迎加入QQ讨论群:469580165(已满) +6. 欢迎加入QQ讨论群:667530868 +7. 若能帮到你还请点亮5颗小星星以作鼓励哈~ +8. 若能帮到你还请点亮5颗小星星以作鼓励哈~ +9. 若能帮到你还请点亮5颗小星星以作鼓励哈~ \ No newline at end of file diff --git a/uni_modules/mescroll-uni/changelog.md b/uni_modules/mescroll-uni/changelog.md new file mode 100644 index 0000000..dd6dd72 --- /dev/null +++ b/uni_modules/mescroll-uni/changelog.md @@ -0,0 +1,8 @@ +## 1.3.8(2023-03-27) +1. 新增useMescroll的hook, 支持vue3 script setup的写法 +2. 新增vue3 script setup的示例 ( 根据vue2的示例,全部重写了一遍 ) +3. mescroll-body 和 mescroll-uni 无需再写 ref="mescrollRef" +4. 解决mescroll-uni在页面渲染之后,无法动态设置height的问题 +5. 解决renderjs在h5返回有时候无法正常滑动的问题 +6. 修复小程序编辑器提示 Cannot read property 'nv_optDown' of undefined 的错误 +-by 小瑾同学 diff --git a/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.css b/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.css new file mode 100644 index 0000000..1107710 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.css @@ -0,0 +1,19 @@ +.mescroll-body { + position: relative; /* 下拉刷新区域相对自身定位 */ + height: auto; /* 不可固定高度,否则overflow:hidden导致无法滑动; 同时使设置的最小高生效,实现列表不满屏仍可下拉*/ + overflow: hidden; /* 当有元素写在mescroll-body标签前面时,可遮住下拉刷新区域 */ + box-sizing: border-box; /* 避免设置padding出现双滚动条的问题 */ +} + +/* 使sticky生效: 父元素不能overflow:hidden或者overflow:auto属性 */ +.mescroll-body.mescorll-sticky{ + overflow: unset !important +} + +/* 适配 iPhoneX */ +@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) { + .mescroll-safearea { + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + } +} \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.vue b/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.vue new file mode 100644 index 0000000..dce9d58 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.vue @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-empty/mescroll-empty.vue b/uni_modules/mescroll-uni/components/mescroll-empty/mescroll-empty.vue new file mode 100644 index 0000000..d1c9348 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-empty/mescroll-empty.vue @@ -0,0 +1,120 @@ + + + + + + \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-down.css b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-down.css new file mode 100644 index 0000000..72bf106 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-down.css @@ -0,0 +1,55 @@ +/* 下拉刷新区域 */ +.mescroll-downwarp { + position: absolute; + top: -100%; + left: 0; + width: 100%; + height: 100%; + text-align: center; +} + +/* 下拉刷新--内容区,定位于区域底部 */ +.mescroll-downwarp .downwarp-content { + position: absolute; + left: 0; + bottom: 0; + width: 100%; + min-height: 60rpx; + padding: 20rpx 0; + text-align: center; +} + +/* 下拉刷新--提示文本 */ +.mescroll-downwarp .downwarp-tip { + display: inline-block; + font-size: 28rpx; + vertical-align: middle; + margin-left: 16rpx; + /* color: gray; 已在style设置color,此处删去*/ +} + +/* 下拉刷新--旋转进度条 */ +.mescroll-downwarp .downwarp-progress { + display: inline-block; + width: 32rpx; + height: 32rpx; + border-radius: 50%; + border: 2rpx solid gray; + border-bottom-color: transparent !important; /*已在style设置border-color,此处需加 !important*/ + vertical-align: middle; +} + +/* 旋转动画 */ +.mescroll-downwarp .mescroll-rotate { + animation: mescrollDownRotate 0.6s linear infinite; +} + +@keyframes mescrollDownRotate { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-down.vue b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-down.vue new file mode 100644 index 0000000..9fd1567 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-down.vue @@ -0,0 +1,47 @@ + + + + + + diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-top.vue b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-top.vue new file mode 100644 index 0000000..a7c7e3a --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-top.vue @@ -0,0 +1,99 @@ + + + + + + diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-up.css b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-up.css new file mode 100644 index 0000000..cbf48cd --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-up.css @@ -0,0 +1,47 @@ +/* 上拉加载区域 */ +.mescroll-upwarp { + box-sizing: border-box; + min-height: 110rpx; + padding: 30rpx 0; + text-align: center; + clear: both; +} + +/*提示文本 */ +.mescroll-upwarp .upwarp-tip, +.mescroll-upwarp .upwarp-nodata { + display: inline-block; + font-size: 28rpx; + vertical-align: middle; + /* color: gray; 已在style设置color,此处删去*/ +} + +.mescroll-upwarp .upwarp-tip { + margin-left: 16rpx; +} + +/*旋转进度条 */ +.mescroll-upwarp .upwarp-progress { + display: inline-block; + width: 32rpx; + height: 32rpx; + border-radius: 50%; + border: 2rpx solid gray; + border-bottom-color: transparent !important; /*已在style设置border-color,此处需加 !important*/ + vertical-align: middle; +} + +/* 旋转动画 */ +.mescroll-upwarp .mescroll-rotate { + animation: mescrollUpRotate 0.6s linear infinite; +} + +@keyframes mescrollUpRotate { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-up.vue b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-up.vue new file mode 100644 index 0000000..11c2e1f --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/components/mescroll-up.vue @@ -0,0 +1,39 @@ + + + + + + diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-i18n.js b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-i18n.js new file mode 100644 index 0000000..2b6a50f --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-i18n.js @@ -0,0 +1,15 @@ +// 国际化工具类 +const mescrollI18n = { + // 默认语言 + def: "zh", + // 获取当前语言类型 + getType(){ + return uni.getStorageSync("mescroll-i18n") || this.def + }, + // 设置当前语言类型 + setType(type){ + uni.setStorageSync("mescroll-i18n", type) + } +} + +export default mescrollI18n diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js new file mode 100644 index 0000000..10f68c0 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js @@ -0,0 +1,46 @@ +// mescroll-body 和 mescroll-uni 通用 +const MescrollMixin = { + data() { + return { + mescroll: null //mescroll实例对象 + } + }, + // 注册系统自带的下拉刷新 (配置down.native为true时生效, 还需在pages配置enablePullDownRefresh:true;详请参考mescroll-native的案例) + onPullDownRefresh(){ + this.mescroll && this.mescroll.onPullDownRefresh(); + }, + // 注册列表滚动事件,用于判定在顶部可下拉刷新,在指定位置可显示隐藏回到顶部按钮 (此方法为页面生命周期,无法在子组件中触发, 仅在mescroll-body生效) + onPageScroll(e) { + this.mescroll && this.mescroll.onPageScroll(e); + }, + // 注册滚动到底部的事件,用于上拉加载 (此方法为页面生命周期,无法在子组件中触发, 仅在mescroll-body生效) + onReachBottom() { + this.mescroll && this.mescroll.onReachBottom(); + }, + methods: { + // mescroll组件初始化的回调,可获取到mescroll对象 + mescrollInit(mescroll) { + this.mescroll = mescroll; + }, + // 下拉刷新的回调 (mixin默认resetUpScroll) + downCallback() { + if(this.mescroll.optUp.use){ + this.mescroll.resetUpScroll() + }else{ + setTimeout(()=>{ + this.mescroll.endSuccess(); + }, 500) + } + }, + // 上拉加载的回调 + upCallback() { + // mixin默认延时500自动结束加载 + setTimeout(()=>{ + this.mescroll.endErr(); + }, 500) + } + } + +} + +export default MescrollMixin; diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni-option.js b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni-option.js new file mode 100644 index 0000000..55d331e --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni-option.js @@ -0,0 +1,64 @@ +// 全局配置 +// mescroll-body 和 mescroll-uni 通用 +const GlobalOption = { + down: { + // 其他down的配置参数也可以写,这里只展示了常用的配置: + offset: 80, // 在列表顶部,下拉大于80px,松手即可触发下拉刷新的回调 + native: false // 是否使用系统自带的下拉刷新; 默认false; 仅在mescroll-body生效 (值为true时,还需在pages配置enablePullDownRefresh:true;详请参考mescroll-native的案例) + }, + up: { + // 其他up的配置参数也可以写,这里只展示了常用的配置: + offset: 150, // 距底部多远时,触发upCallback,仅mescroll-uni生效 ( mescroll-body配置的是pages.json的 onReachBottomDistance ) + toTop: { + // 回到顶部按钮,需配置src才显示 + src: "https://www.mescroll.com/img/mescroll-totop.png", // 图片路径 (建议放入static目录, 如 /static/img/mescroll-totop.png ) + offset: 1000, // 列表滚动多少距离才显示回到顶部按钮,默认1000px + right: 20, // 到右边的距离, 默认20 (支持"20rpx", "20px", "20%"格式的值, 纯数字则默认单位rpx) + bottom: 120, // 到底部的距离, 默认120 (支持"20rpx", "20px", "20%"格式的值, 纯数字则默认单位rpx) + width: 72 // 回到顶部图标的宽度, 默认72 (支持"20rpx", "20px", "20%"格式的值, 纯数字则默认单位rpx) + }, + empty: { + use: true, // 是否显示空布局 + icon: "https://www.mescroll.com/img/mescroll-empty.png" // 图标路径 (建议放入static目录, 如 /static/img/mescroll-empty.png ) + } + }, + // 国际化配置 + i18n: { + // 中文 + zh: { + down: { + textInOffset: '下拉刷新', // 下拉的距离在offset范围内的提示文本 + textOutOffset: '释放更新', // 下拉的距离大于offset范围的提示文本 + textLoading: '加载中 ...', // 加载中的提示文本 + textSuccess: '加载成功', // 加载成功的文本 + textErr: '加载失败', // 加载失败的文本 + }, + up: { + textLoading: '加载中 ...', // 加载中的提示文本 + textNoMore: '-- END --', // 没有更多数据的提示文本 + empty: { + tip: '~ 空空如也 ~' // 空提示 + } + } + }, + // 英文 + en: { + down: { + textInOffset: 'drop down refresh', + textOutOffset: 'release updates', + textLoading: 'loading ...', + textSuccess: 'loaded successfully', + textErr: 'loading failed' + }, + up: { + textLoading: 'loading ...', + textNoMore: '-- END --', + empty: { + tip: '~ absolutely empty ~' + } + } + } + } +} + +export default GlobalOption diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.css b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.css new file mode 100644 index 0000000..39438cd --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.css @@ -0,0 +1,36 @@ +.mescroll-uni-warp{ + height: 100%; +} + +.mescroll-uni-content{ + height: 100%; +} + +.mescroll-uni { + position: relative; + width: 100%; + height: 100%; + min-height: 200rpx; + overflow-y: auto; + box-sizing: border-box; /* 避免设置padding出现双滚动条的问题 */ +} + +/* 定位的方式固定高度 */ +.mescroll-uni-fixed{ + z-index: 1; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: auto; /* 使right生效 */ + height: auto; /* 使bottom生效 */ +} + +/* 适配 iPhoneX */ +@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) { + .mescroll-safearea { + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + } +} diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.js b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.js new file mode 100644 index 0000000..3bfdac1 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.js @@ -0,0 +1,799 @@ +/* mescroll + * version 1.3.7 + * 2021-04-12 wenju + * https://www.mescroll.com + */ + +export default function MeScroll(options, isScrollBody) { + let me = this; + me.version = '1.3.7'; // mescroll版本号 + me.options = options || {}; // 配置 + me.isScrollBody = isScrollBody || false; // 滚动区域是否为原生页面滚动; 默认为scroll-view + + me.isDownScrolling = false; // 是否在执行下拉刷新的回调 + me.isUpScrolling = false; // 是否在执行上拉加载的回调 + let hasDownCallback = me.options.down && me.options.down.callback; // 是否配置了down的callback + + // 初始化下拉刷新 + me.initDownScroll(); + // 初始化上拉加载,则初始化 + me.initUpScroll(); + + // 自动加载 + setTimeout(function() { // 待主线程执行完毕再执行,避免new MeScroll未初始化,在回调获取不到mescroll的实例 + // 自动触发下拉刷新 (只有配置了down的callback才自动触发下拉刷新) + if ((me.optDown.use || me.optDown.native) && me.optDown.auto && hasDownCallback) { + if (me.optDown.autoShowLoading) { + me.triggerDownScroll(); // 显示下拉进度,执行下拉回调 + } else { + me.optDown.callback && me.optDown.callback(me); // 不显示下拉进度,直接执行下拉回调 + } + } + // 自动触发上拉加载 + if(!me.isUpAutoLoad){ // 部分小程序(头条小程序)emit是异步, 会导致isUpAutoLoad判断有误, 先延时确保先执行down的callback,再执行up的callback + setTimeout(function(){ + me.optUp.use && me.optUp.auto && !me.isUpAutoLoad && me.triggerUpScroll(); + },100) + } + }, 30); // 需让me.optDown.inited和me.optUp.inited先执行 +} + +/* 配置参数:下拉刷新 */ +MeScroll.prototype.extendDownScroll = function(optDown) { + // 下拉刷新的配置 + MeScroll.extend(optDown, { + use: true, // 是否启用下拉刷新; 默认true + auto: true, // 是否在初始化完毕之后自动执行下拉刷新的回调; 默认true + native: false, // 是否使用系统自带的下拉刷新; 默认false; 仅mescroll-body生效 (值为true时,还需在pages配置enablePullDownRefresh:true;详请参考mescroll-native的案例) + autoShowLoading: false, // 如果设置auto=true(在初始化完毕之后自动执行下拉刷新的回调),那么是否显示下拉刷新的进度; 默认false + isLock: false, // 是否锁定下拉刷新,默认false; + offset: 80, // 在列表顶部,下拉大于80px,松手即可触发下拉刷新的回调 + startTop: 100, // scroll-view快速滚动到顶部时,此时的scroll-top可能大于0, 此值用于控制最大的误差 + inOffsetRate: 1, // 在列表顶部,下拉的距离小于offset时,改变下拉区域高度比例;值小于1且越接近0,高度变化越小,表现为越往下越难拉 + outOffsetRate: 0.2, // 在列表顶部,下拉的距离大于offset时,改变下拉区域高度比例;值小于1且越接近0,高度变化越小,表现为越往下越难拉 + bottomOffset: 20, // 当手指touchmove位置在距离body底部20px范围内的时候结束上拉刷新,避免Webview嵌套导致touchend事件不执行 + minAngle: 45, // 向下滑动最少偏移的角度,取值区间 [0,90];默认45度,即向下滑动的角度大于45度则触发下拉;而小于45度,将不触发下拉,避免与左右滑动的轮播等组件冲突; + textInOffset: '下拉刷新', // 下拉的距离在offset范围内的提示文本 + textOutOffset: '释放更新', // 下拉的距离大于offset范围的提示文本 + textLoading: '加载中 ...', // 加载中的提示文本 + textSuccess: '加载成功', // 加载成功的文本 + textErr: '加载失败', // 加载失败的文本 + beforeEndDelay: 0, // 延时结束的时长 (显示加载成功/失败的时长, android小程序设置此项结束下拉会卡顿, 配置后请注意测试) + bgColor: "transparent", // 背景颜色 (建议在pages.json中再设置一下backgroundColorTop) + textColor: "gray", // 文本颜色 (当bgColor配置了颜色,而textColor未配置时,则textColor会默认为白色) + inited: null, // 下拉刷新初始化完毕的回调 + inOffset: null, // 下拉的距离进入offset范围内那一刻的回调 + outOffset: null, // 下拉的距离大于offset那一刻的回调 + onMoving: null, // 下拉过程中的回调,滑动过程一直在执行; rate下拉区域当前高度与指定距离的比值(inOffset: rate<1; outOffset: rate>=1); downHight当前下拉区域的高度 + beforeLoading: null, // 准备触发下拉刷新的回调: 如果return true,将不触发showLoading和callback回调; 常用来完全自定义下拉刷新, 参考案例【淘宝 v6.8.0】 + showLoading: null, // 显示下拉刷新进度的回调 + afterLoading: null, // 显示下拉刷新进度的回调之后,马上要执行的代码 (如: 在wxs中使用) + beforeEndDownScroll: null, // 准备结束下拉的回调. 返回结束下拉的延时执行时间,默认0ms; 常用于结束下拉之前再显示另外一小段动画,才去隐藏下拉刷新的场景, 参考案例【dotJump】 + endDownScroll: null, // 结束下拉刷新的回调 + afterEndDownScroll: null, // 结束下拉刷新的回调,马上要执行的代码 (如: 在wxs中使用) + callback: function(mescroll) { + // 下拉刷新的回调;默认重置上拉加载列表为第一页 + mescroll.resetUpScroll(); + } + }) +} + +/* 配置参数:上拉加载 */ +MeScroll.prototype.extendUpScroll = function(optUp) { + // 上拉加载的配置 + MeScroll.extend(optUp, { + use: true, // 是否启用上拉加载; 默认true + auto: true, // 是否在初始化完毕之后自动执行上拉加载的回调; 默认true + isLock: false, // 是否锁定上拉加载,默认false; + isBoth: true, // 上拉加载时,如果滑动到列表顶部是否可以同时触发下拉刷新;默认true,两者可同时触发; + callback: null, // 上拉加载的回调;function(page,mescroll){ } + page: { + num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始 + size: 10, // 每页数据的数量 + time: null // 加载第一页数据服务器返回的时间; 防止用户翻页时,后台新增了数据从而导致下一页数据重复; + }, + noMoreSize: 5, // 如果列表已无数据,可设置列表的总数量要大于等于5条才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看 + offset: 150, // 距底部多远时,触发upCallback,仅mescroll-uni生效 ( mescroll-body配置的是pages.json的 onReachBottomDistance ) + textLoading: '加载中 ...', // 加载中的提示文本 + textNoMore: '-- END --', // 没有更多数据的提示文本 + bgColor: "transparent", // 背景颜色 (建议在pages.json中再设置一下backgroundColorBottom) + textColor: "gray", // 文本颜色 (当bgColor配置了颜色,而textColor未配置时,则textColor会默认为白色) + inited: null, // 初始化完毕的回调 + showLoading: null, // 显示加载中的回调 + showNoMore: null, // 显示无更多数据的回调 + hideUpScroll: null, // 隐藏上拉加载的回调 + errDistance: 60, // endErr的时候需往上滑动一段距离,使其往下滑动时再次触发onReachBottom,仅mescroll-body生效 + toTop: { + // 回到顶部按钮,需配置src才显示 + src: null, // 图片路径,默认null (绝对路径或网络图) + offset: 1000, // 列表滚动多少距离才显示回到顶部按钮,默认1000 + duration: 300, // 回到顶部的动画时长,默认300ms (当值为0或300则使用系统自带回到顶部,更流畅; 其他值则通过step模拟,部分机型可能不够流畅,所以非特殊情况不建议修改此项) + btnClick: null, // 点击按钮的回调 + onShow: null, // 是否显示的回调 + zIndex: 9990, // fixed定位z-index值 + left: null, // 到左边的距离, 默认null. 此项有值时,right不生效. (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx) + right: 20, // 到右边的距离, 默认20 (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx) + bottom: 120, // 到底部的距离, 默认120 (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx) + safearea: false, // bottom的偏移量是否加上底部安全区的距离, 默认false, 需要适配iPhoneX时使用 (具体的界面如果不配置此项,则取本vue的safearea值) + width: 72, // 回到顶部图标的宽度, 默认72 (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx) + radius: "50%" // 圆角, 默认"50%" (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx) + }, + empty: { + use: true, // 是否显示空布局 + icon: null, // 图标路径 + tip: '~ 暂无相关数据 ~', // 提示 + btnText: '', // 按钮 + btnClick: null, // 点击按钮的回调 + onShow: null, // 是否显示的回调 + fixed: false, // 是否使用fixed定位,默认false; 配置fixed为true,以下的top和zIndex才生效 (transform会使fixed失效,最终会降级为absolute) + top: "100rpx", // fixed定位的top值 (完整的单位值,如 "10%"; "100rpx") + zIndex: 99 // fixed定位z-index值 + }, + onScroll: false // 是否监听滚动事件 + }) +} + +/* 配置参数 */ +MeScroll.extend = function(userOption, defaultOption) { + if (!userOption) return defaultOption; + for (let key in defaultOption) { + if (userOption[key] == null) { + let def = defaultOption[key]; + if (def != null && typeof def === 'object') { + userOption[key] = MeScroll.extend({}, def); // 深度匹配 + } else { + userOption[key] = def; + } + } else if (typeof userOption[key] === 'object') { + MeScroll.extend(userOption[key], defaultOption[key]); // 深度匹配 + } + } + return userOption; +} + +/* 简单判断是否配置了颜色 (非透明,非白色) */ +MeScroll.prototype.hasColor = function(color) { + if(!color) return false; + let c = color.toLowerCase(); + return c != "#fff" && c != "#ffffff" && c != "transparent" && c != "white" +} + +/* -------初始化下拉刷新------- */ +MeScroll.prototype.initDownScroll = function() { + let me = this; + // 配置参数 + me.optDown = me.options.down || {}; + if(!me.optDown.textColor && me.hasColor(me.optDown.bgColor)) me.optDown.textColor = "#fff"; // 当bgColor有值且textColor未设置,则textColor默认白色 + me.extendDownScroll(me.optDown); + + // 如果是mescroll-body且配置了native,则禁止自定义的下拉刷新 + if(me.isScrollBody && me.optDown.native){ + me.optDown.use = false + }else{ + me.optDown.native = false // 仅mescroll-body支持,mescroll-uni不支持 + } + + me.downHight = 0; // 下拉区域的高度 + + // 在页面中加入下拉布局 + if (me.optDown.use && me.optDown.inited) { + // 初始化完毕的回调 + setTimeout(function() { // 待主线程执行完毕再执行,避免new MeScroll未初始化,在回调获取不到mescroll的实例 + me.optDown.inited(me); + }, 0) + } +} + +/* 列表touchstart事件 */ +MeScroll.prototype.touchstartEvent = function(e) { + if (!this.optDown.use) return; + + this.startPoint = this.getPoint(e); // 记录起点 + this.startTop = this.getScrollTop(); // 记录此时的滚动条位置 + this.startAngle = 0; // 初始角度 + this.lastPoint = this.startPoint; // 重置上次move的点 + this.maxTouchmoveY = this.getBodyHeight() - this.optDown.bottomOffset; // 手指触摸的最大范围(写在touchstart避免body获取高度为0的情况) + this.inTouchend = false; // 标记不是touchend +} + +/* 列表touchmove事件 */ +MeScroll.prototype.touchmoveEvent = function(e) { + if (!this.optDown.use) return; + let me = this; + + let scrollTop = me.getScrollTop(); // 当前滚动条的距离 + let curPoint = me.getPoint(e); // 当前点 + + let moveY = curPoint.y - me.startPoint.y; // 和起点比,移动的距离,大于0向下拉,小于0向上拉 + + // 向下拉 && 在顶部 + // mescroll-body,直接判定在顶部即可 + // scroll-view在滚动时不会触发touchmove,当触顶/底/左/右时,才会触发touchmove + // scroll-view滚动到顶部时,scrollTop不一定为0,也有可能大于0; 在iOS的APP中scrollTop可能为负数,不一定和startTop相等 + if (moveY > 0 && ( + (me.isScrollBody && scrollTop <= 0) + || + (!me.isScrollBody && (scrollTop <= 0 || (scrollTop <= me.optDown.startTop && scrollTop === me.startTop)) ) + )) { + // 可下拉的条件 + if (!me.inTouchend && !me.isDownScrolling && !me.optDown.isLock && (!me.isUpScrolling || (me.isUpScrolling && + me.optUp.isBoth))) { + + // 下拉的初始角度是否在配置的范围内 + if(!me.startAngle) me.startAngle = me.getAngle(me.lastPoint, curPoint); // 两点之间的角度,区间 [0,90] + if (me.startAngle < me.optDown.minAngle) return; // 如果小于配置的角度,则不往下执行下拉刷新 + + // 如果手指的位置超过配置的距离,则提前结束下拉,避免Webview嵌套导致touchend无法触发 + if (me.maxTouchmoveY > 0 && curPoint.y >= me.maxTouchmoveY) { + me.inTouchend = true; // 标记执行touchend + me.touchendEvent(); // 提前触发touchend + return; + } + + me.preventDefault(e); // 阻止默认事件 + + let diff = curPoint.y - me.lastPoint.y; // 和上次比,移动的距离 (大于0向下,小于0向上) + + // 下拉距离 < 指定距离 + if (me.downHight < me.optDown.offset) { + if (me.movetype !== 1) { + me.movetype = 1; // 加入标记,保证只执行一次 + me.isDownEndSuccess = null; // 重置是否加载成功的状态 (wxs执行的是wxs.wxs) + me.optDown.inOffset && me.optDown.inOffset(me); // 进入指定距离范围内那一刻的回调,只执行一次 + me.isMoveDown = true; // 标记下拉区域高度改变,在touchend重置回来 + } + me.downHight += diff * me.optDown.inOffsetRate; // 越往下,高度变化越小 + + // 指定距离 <= 下拉距离 + } else { + if (me.movetype !== 2) { + me.movetype = 2; // 加入标记,保证只执行一次 + me.optDown.outOffset && me.optDown.outOffset(me); // 下拉超过指定距离那一刻的回调,只执行一次 + me.isMoveDown = true; // 标记下拉区域高度改变,在touchend重置回来 + } + if (diff > 0) { // 向下拉 + me.downHight += diff * me.optDown.outOffsetRate; // 越往下,高度变化越小 + } else { // 向上收 + me.downHight += diff; // 向上收回高度,则向上滑多少收多少高度 + } + } + + me.downHight = Math.round(me.downHight) // 取整 + let rate = me.downHight / me.optDown.offset; // 下拉区域当前高度与指定距离的比值 + me.optDown.onMoving && me.optDown.onMoving(me, rate, me.downHight); // 下拉过程中的回调,一直在执行 + } + } + + me.lastPoint = curPoint; // 记录本次移动的点 +} + +/* 列表touchend事件 */ +MeScroll.prototype.touchendEvent = function(e) { + if (!this.optDown.use) return; + // 如果下拉区域高度已改变,则需重置回来 + if (this.isMoveDown) { + if (this.downHight >= this.optDown.offset) { + // 符合触发刷新的条件 + this.triggerDownScroll(); + } else { + // 不符合的话 则重置 + this.downHight = 0; + this.endDownScrollCall(this); + } + this.movetype = 0; + this.isMoveDown = false; + } else if (!this.isScrollBody && this.getScrollTop() === this.startTop) { // scroll-view到顶/左/右/底的滑动事件 + let isScrollUp = this.getPoint(e).y - this.startPoint.y < 0; // 和起点比,移动的距离,大于0向下拉,小于0向上拉 + // 上滑 + if (isScrollUp) { + // 需检查滑动的角度 + let angle = this.getAngle(this.getPoint(e), this.startPoint); // 两点之间的角度,区间 [0,90] + if (angle > 80) { + // 检查并触发上拉 + this.triggerUpScroll(true); + } + } + } +} + +/* 根据点击滑动事件获取第一个手指的坐标 */ +MeScroll.prototype.getPoint = function(e) { + if (!e) { + return { + x: 0, + y: 0 + } + } + if (e.touches && e.touches[0]) { + return { + x: e.touches[0].pageX, + y: e.touches[0].pageY + } + } else if (e.changedTouches && e.changedTouches[0]) { + return { + x: e.changedTouches[0].pageX, + y: e.changedTouches[0].pageY + } + } else { + return { + x: e.clientX, + y: e.clientY + } + } +} + +/* 计算两点之间的角度: 区间 [0,90]*/ +MeScroll.prototype.getAngle = function(p1, p2) { + let x = Math.abs(p1.x - p2.x); + let y = Math.abs(p1.y - p2.y); + let z = Math.sqrt(x * x + y * y); + let angle = 0; + if (z !== 0) { + angle = Math.asin(y / z) / Math.PI * 180; + } + return angle +} + +/* 触发下拉刷新 */ +MeScroll.prototype.triggerDownScroll = function() { + if (this.optDown.beforeLoading && this.optDown.beforeLoading(this)) { + //return true则处于完全自定义状态 + } else { + this.showDownScroll(); // 下拉刷新中... + !this.optDown.native && this.optDown.callback && this.optDown.callback(this); // 执行回调,联网加载数据 + } +} + +/* 显示下拉进度布局 */ +MeScroll.prototype.showDownScroll = function() { + this.isDownScrolling = true; // 标记下拉中 + if (this.optDown.native) { + uni.startPullDownRefresh(); // 系统自带的下拉刷新 + this.showDownLoadingCall(0); // 仍触发showLoading,因为上拉加载用到 + } else{ + this.downHight = this.optDown.offset; // 更新下拉区域高度 + this.showDownLoadingCall(this.downHight); // 下拉刷新中... + } +} + +MeScroll.prototype.showDownLoadingCall = function(downHight) { + this.optDown.showLoading && this.optDown.showLoading(this, downHight); // 下拉刷新中... + this.optDown.afterLoading && this.optDown.afterLoading(this, downHight); // 下拉刷新中...触发之后马上要执行的代码 +} + +/* 显示系统自带的下拉刷新时需要处理的业务 */ +MeScroll.prototype.onPullDownRefresh = function() { + this.isDownScrolling = true; // 标记下拉中 + this.showDownLoadingCall(0); // 仍触发showLoading,因为上拉加载用到 + this.optDown.callback && this.optDown.callback(this); // 执行回调,联网加载数据 +} + +/* 结束下拉刷新 */ +MeScroll.prototype.endDownScroll = function() { + if (this.optDown.native) { // 结束原生下拉刷新 + this.isDownScrolling = false; + this.endDownScrollCall(this); + uni.stopPullDownRefresh(); + return + } + let me = this; + // 结束下拉刷新的方法 + let endScroll = function() { + me.downHight = 0; + me.isDownScrolling = false; + me.endDownScrollCall(me); + if(!me.isScrollBody){ + me.setScrollHeight(0) // scroll-view重置滚动区域,使数据不满屏时仍可检查触发翻页 + me.scrollTo(0,0) // scroll-view需重置滚动条到顶部,避免startTop大于0时,对下拉刷新的影响 + } + } + // 结束下拉刷新时的回调 + let delay = 0; + if (me.optDown.beforeEndDownScroll) { + delay = me.optDown.beforeEndDownScroll(me); // 结束下拉刷新的延时,单位ms + if(me.isDownEndSuccess == null) delay = 0; // 没有执行加载中,则不延时 + } + if (typeof delay === 'number' && delay > 0) { + setTimeout(endScroll, delay); + } else { + endScroll(); + } +} + +MeScroll.prototype.endDownScrollCall = function() { + this.optDown.endDownScroll && this.optDown.endDownScroll(this); + this.optDown.afterEndDownScroll && this.optDown.afterEndDownScroll(this); +} + +/* 锁定下拉刷新:isLock=ture,null锁定;isLock=false解锁 */ +MeScroll.prototype.lockDownScroll = function(isLock) { + if (isLock == null) isLock = true; + this.optDown.isLock = isLock; +} + +/* 锁定上拉加载:isLock=ture,null锁定;isLock=false解锁 */ +MeScroll.prototype.lockUpScroll = function(isLock) { + if (isLock == null) isLock = true; + this.optUp.isLock = isLock; +} + +/* -------初始化上拉加载------- */ +MeScroll.prototype.initUpScroll = function() { + let me = this; + // 配置参数 + me.optUp = me.options.up || {use: false} + if(!me.optUp.textColor && me.hasColor(me.optUp.bgColor)) me.optUp.textColor = "#fff"; // 当bgColor有值且textColor未设置,则textColor默认白色 + me.extendUpScroll(me.optUp); + + if (me.optUp.use === false) return; // 配置不使用上拉加载时,则不初始化上拉布局 + me.optUp.hasNext = true; // 如果使用上拉,则默认有下一页 + me.startNum = me.optUp.page.num + 1; // 记录page开始的页码 + + // 初始化完毕的回调 + if (me.optUp.inited) { + setTimeout(function() { // 待主线程执行完毕再执行,避免new MeScroll未初始化,在回调获取不到mescroll的实例 + me.optUp.inited(me); + }, 0) + } +} + +/*滚动到底部的事件 (仅mescroll-body生效)*/ +MeScroll.prototype.onReachBottom = function() { + if (this.isScrollBody && !this.isUpScrolling) { // 只能支持下拉刷新的时候同时可以触发上拉加载,否则滚动到底部就需要上滑一点才能触发onReachBottom + if (!this.optUp.isLock && this.optUp.hasNext) { + this.triggerUpScroll(); + } + } +} + +/*列表滚动事件 (仅mescroll-body生效)*/ +MeScroll.prototype.onPageScroll = function(e) { + if (!this.isScrollBody) return; + + // 更新滚动条的位置 (主要用于判断下拉刷新时,滚动条是否在顶部) + this.setScrollTop(e.scrollTop); + + // 顶部按钮的显示隐藏 + if (e.scrollTop >= this.optUp.toTop.offset) { + this.showTopBtn(); + } else { + this.hideTopBtn(); + } +} + +/*列表滚动事件*/ +MeScroll.prototype.scroll = function(e, onScroll) { + // 更新滚动条的位置 + this.setScrollTop(e.scrollTop); + // 更新滚动内容高度 + this.setScrollHeight(e.scrollHeight); + + // 向上滑还是向下滑动 + if (this.preScrollY == null) this.preScrollY = 0; + this.isScrollUp = e.scrollTop - this.preScrollY > 0; + this.preScrollY = e.scrollTop; + + // 上滑 && 检查并触发上拉 + this.isScrollUp && this.triggerUpScroll(true); + + // 顶部按钮的显示隐藏 + if (e.scrollTop >= this.optUp.toTop.offset) { + this.showTopBtn(); + } else { + this.hideTopBtn(); + } + + // 滑动监听 + this.optUp.onScroll && onScroll && onScroll() +} + +/* 触发上拉加载 */ +MeScroll.prototype.triggerUpScroll = function(isCheck) { + if (!this.isUpScrolling && this.optUp.use && this.optUp.callback) { + // 是否校验在底部; 默认不校验 + if (isCheck === true) { + let canUp = false; + // 还有下一页 && 没有锁定 && 不在下拉中 + if (this.optUp.hasNext && !this.optUp.isLock && !this.isDownScrolling) { + if (this.getScrollBottom() <= this.optUp.offset) { // 到底部 + canUp = true; // 标记可上拉 + } + } + if (canUp === false) return; + } + this.showUpScroll(); // 上拉加载中... + this.optUp.page.num++; // 预先加一页,如果失败则减回 + this.isUpAutoLoad = true; // 标记上拉已经自动执行过,避免初始化时多次触发上拉回调 + this.num = this.optUp.page.num; // 把最新的页数赋值在mescroll上,避免对page的影响 + this.size = this.optUp.page.size; // 把最新的页码赋值在mescroll上,避免对page的影响 + this.time = this.optUp.page.time; // 把最新的页码赋值在mescroll上,避免对page的影响 + this.optUp.callback(this); // 执行回调,联网加载数据 + } +} + +/* 显示上拉加载中 */ +MeScroll.prototype.showUpScroll = function() { + this.isUpScrolling = true; // 标记上拉加载中 + this.optUp.showLoading && this.optUp.showLoading(this); // 回调 +} + +/* 显示上拉无更多数据 */ +MeScroll.prototype.showNoMore = function() { + this.optUp.hasNext = false; // 标记无更多数据 + this.optUp.showNoMore && this.optUp.showNoMore(this); // 回调 +} + +/* 隐藏上拉区域**/ +MeScroll.prototype.hideUpScroll = function() { + this.optUp.hideUpScroll && this.optUp.hideUpScroll(this); // 回调 +} + +/* 结束上拉加载 */ +MeScroll.prototype.endUpScroll = function(isShowNoMore) { + if (isShowNoMore != null) { // isShowNoMore=null,不处理下拉状态,下拉刷新的时候调用 + if (isShowNoMore) { + this.showNoMore(); // isShowNoMore=true,显示无更多数据 + } else { + this.hideUpScroll(); // isShowNoMore=false,隐藏上拉加载 + } + } + this.isUpScrolling = false; // 标记结束上拉加载 +} + +/* 重置上拉加载列表为第一页 + *isShowLoading 是否显示进度布局; + * 1.默认null,不传参,则显示上拉加载的进度布局 + * 2.传参true, 则显示下拉刷新的进度布局 + * 3.传参false,则不显示上拉和下拉的进度 (常用于静默更新列表数据) + */ +MeScroll.prototype.resetUpScroll = function(isShowLoading) { + if (this.optUp && this.optUp.use) { + let page = this.optUp.page; + this.prePageNum = page.num; // 缓存重置前的页码,加载失败可退回 + this.prePageTime = page.time; // 缓存重置前的时间,加载失败可退回 + page.num = this.startNum; // 重置为第一页 + page.time = null; // 重置时间为空 + if (!this.isDownScrolling && isShowLoading !== false) { // 如果不是下拉刷新触发的resetUpScroll并且不配置列表静默更新,则显示进度; + if (isShowLoading == null) { + this.removeEmpty(); // 移除空布局 + this.showUpScroll(); // 不传参,默认显示上拉加载的进度布局 + } else { + this.showDownScroll(); // 传true,显示下拉刷新的进度布局,不清空列表 + } + } + this.isUpAutoLoad = true; // 标记上拉已经自动执行过,避免初始化时多次触发上拉回调 + this.num = page.num; // 把最新的页数赋值在mescroll上,避免对page的影响 + this.size = page.size; // 把最新的页码赋值在mescroll上,避免对page的影响 + this.time = page.time; // 把最新的页码赋值在mescroll上,避免对page的影响 + this.optUp.callback && this.optUp.callback(this); // 执行上拉回调 + } +} + +/* 设置page.num的值 */ +MeScroll.prototype.setPageNum = function(num) { + this.optUp.page.num = num - 1; +} + +/* 设置page.size的值 */ +MeScroll.prototype.setPageSize = function(size) { + this.optUp.page.size = size; +} + +/* 联网回调成功,结束下拉刷新和上拉加载 + * dataSize: 当前页的数据量(必传) + * totalPage: 总页数(必传) + * systime: 服务器时间 (可空) + */ +MeScroll.prototype.endByPage = function(dataSize, totalPage, systime) { + let hasNext; + if (this.optUp.use && totalPage != null) hasNext = this.optUp.page.num < totalPage; // 是否还有下一页 + this.endSuccess(dataSize, hasNext, systime); +} + +/* 联网回调成功,结束下拉刷新和上拉加载 + * dataSize: 当前页的数据量(必传) + * totalSize: 列表所有数据总数量(必传) + * systime: 服务器时间 (可空) + */ +MeScroll.prototype.endBySize = function(dataSize, totalSize, systime) { + let hasNext; + if (this.optUp.use && totalSize != null) { + let loadSize = (this.optUp.page.num - 1) * this.optUp.page.size + dataSize; // 已加载的数据总数 + hasNext = loadSize < totalSize; // 是否还有下一页 + } + this.endSuccess(dataSize, hasNext, systime); +} + +/* 联网回调成功,结束下拉刷新和上拉加载 + * dataSize: 当前页的数据个数(不是所有页的数据总和),用于上拉加载判断是否还有下一页.如果不传,则会判断还有下一页 + * hasNext: 是否还有下一页,布尔类型;用来解决这个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据dataSize判断,则需翻到第三页才会知道无更多数据,如果传了hasNext,则翻到第二页即可显示无更多数据. + * systime: 服务器时间(可空);用来解决这个小问题:当准备翻下一页时,数据库新增了几条记录,此时翻下一页,前面的几条数据会和上一页的重复;这里传入了systime,那么upCallback的page.time就会有值,把page.time传给服务器,让后台过滤新加入的那几条记录 + */ +MeScroll.prototype.endSuccess = function(dataSize, hasNext, systime) { + let me = this; + // 结束下拉刷新 + if (me.isDownScrolling) { + me.isDownEndSuccess = true + me.endDownScroll(); + } + + // 结束上拉加载 + if (me.optUp.use) { + let isShowNoMore; // 是否已无更多数据 + if (dataSize != null) { + let pageNum = me.optUp.page.num; // 当前页码 + let pageSize = me.optUp.page.size; // 每页长度 + // 如果是第一页 + if (pageNum === 1) { + if (systime) me.optUp.page.time = systime; // 设置加载列表数据第一页的时间 + } + if (dataSize < pageSize || hasNext === false) { + // 返回的数据不满一页时,则说明已无更多数据 + me.optUp.hasNext = false; + if (dataSize === 0 && pageNum === 1) { + // 如果第一页无任何数据且配置了空布局 + isShowNoMore = false; + me.showEmpty(); + } else { + // 总列表数少于配置的数量,则不显示无更多数据 + let allDataSize = (pageNum - 1) * pageSize + dataSize; + if (allDataSize < me.optUp.noMoreSize) { + isShowNoMore = false; + } else { + isShowNoMore = true; + } + me.removeEmpty(); // 移除空布局 + } + } else { + // 还有下一页 + isShowNoMore = false; + me.optUp.hasNext = true; + me.removeEmpty(); // 移除空布局 + } + } + + // 隐藏上拉 + me.endUpScroll(isShowNoMore); + } +} + +/* 回调失败,结束下拉刷新和上拉加载 */ +MeScroll.prototype.endErr = function(errDistance) { + // 结束下拉,回调失败重置回原来的页码和时间 + if (this.isDownScrolling) { + this.isDownEndSuccess = false + let page = this.optUp.page; + if (page && this.prePageNum) { + page.num = this.prePageNum; + page.time = this.prePageTime; + } + this.endDownScroll(); + } + // 结束上拉,回调失败重置回原来的页码 + if (this.isUpScrolling) { + this.optUp.page.num--; + this.endUpScroll(false); + // 如果是mescroll-body,则需往回滚一定距离 + if(this.isScrollBody && errDistance !== 0){ // 不处理0 + if(!errDistance) errDistance = this.optUp.errDistance; // 不传,则取默认 + this.scrollTo(this.getScrollTop() - errDistance, 0) // 往上回滚的距离 + } + } +} + +/* 显示空布局 */ +MeScroll.prototype.showEmpty = function() { + this.optUp.empty.use && this.optUp.empty.onShow && this.optUp.empty.onShow(true) +} + +/* 移除空布局 */ +MeScroll.prototype.removeEmpty = function() { + this.optUp.empty.use && this.optUp.empty.onShow && this.optUp.empty.onShow(false) +} + +/* 显示回到顶部的按钮 */ +MeScroll.prototype.showTopBtn = function() { + if (!this.topBtnShow) { + this.topBtnShow = true; + this.optUp.toTop.onShow && this.optUp.toTop.onShow(true); + } +} + +/* 隐藏回到顶部的按钮 */ +MeScroll.prototype.hideTopBtn = function() { + if (this.topBtnShow) { + this.topBtnShow = false; + this.optUp.toTop.onShow && this.optUp.toTop.onShow(false); + } +} + +/* 获取滚动条的位置 */ +MeScroll.prototype.getScrollTop = function() { + return this.scrollTop || 0 +} + +/* 记录滚动条的位置 */ +MeScroll.prototype.setScrollTop = function(y) { + this.scrollTop = y; +} + +/* 滚动到指定位置 */ +MeScroll.prototype.scrollTo = function(y, t) { + this.myScrollTo && this.myScrollTo(y, t) // scrollview需自定义回到顶部方法 +} + +/* 自定义scrollTo */ +MeScroll.prototype.resetScrollTo = function(myScrollTo) { + this.myScrollTo = myScrollTo +} + +/* 滚动条到底部的距离 */ +MeScroll.prototype.getScrollBottom = function() { + return this.getScrollHeight() - this.getClientHeight() - this.getScrollTop() +} + +/* 计步器 + star: 开始值 + end: 结束值 + callback(step,timer): 回调step值,计步器timer,可自行通过window.clearInterval(timer)结束计步器; + t: 计步时长,传0则直接回调end值;不传则默认300ms + rate: 周期;不传则默认30ms计步一次 + * */ +MeScroll.prototype.getStep = function(star, end, callback, t, rate) { + let diff = end - star; // 差值 + if (t === 0 || diff === 0) { + callback && callback(end); + return; + } + t = t || 300; // 时长 300ms + rate = rate || 30; // 周期 30ms + let count = t / rate; // 次数 + let step = diff / count; // 步长 + let i = 0; // 计数 + let timer = setInterval(function() { + if (i < count - 1) { + star += step; + callback && callback(star, timer); + i++; + } else { + callback && callback(end, timer); // 最后一次直接设置end,避免计算误差 + clearInterval(timer); + } + }, rate); +} + +/* 滚动容器的高度 */ +MeScroll.prototype.getClientHeight = function(isReal) { + let h = this.clientHeight || 0 + if (h === 0 && isReal !== true) { // 未获取到容器的高度,可临时取body的高度 (可能会有误差) + h = this.getBodyHeight() + } + return h +} +MeScroll.prototype.setClientHeight = function(h) { + this.clientHeight = h; +} + +/* 滚动内容的高度 */ +MeScroll.prototype.getScrollHeight = function() { + return this.scrollHeight || 0; +} +MeScroll.prototype.setScrollHeight = function(h) { + this.scrollHeight = h; +} + +/* body的高度 */ +MeScroll.prototype.getBodyHeight = function() { + return this.bodyHeight || 0; +} +MeScroll.prototype.setBodyHeight = function(h) { + this.bodyHeight = h; +} + +/* 阻止浏览器默认滚动事件 */ +MeScroll.prototype.preventDefault = function(e) { + // 小程序不支持e.preventDefault, 已在wxs中禁止 + // app的bounce只能通过配置pages.json的style.app-plus.bounce为"none"来禁止, 或使用renderjs禁止 + // cancelable:是否可以被禁用; defaultPrevented:是否已经被禁用 + if (e && e.cancelable && !e.defaultPrevented) e.preventDefault() +} \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue new file mode 100644 index 0000000..d59ef68 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue @@ -0,0 +1,514 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js b/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js new file mode 100644 index 0000000..abe7cd7 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js @@ -0,0 +1,47 @@ +/** + * mescroll-body写在子组件时,需通过mescroll的mixins补充子组件缺少的生命周期 + */ +const MescrollCompMixin = { + // 因为子组件无onPageScroll和onReachBottom的页面生命周期,需在页面传递进到子组件 (一级) + onPageScroll(e) { + this.handlePageScroll(e) + }, + onReachBottom() { + this.handleReachBottom() + }, + // 当down的native: true时, 还需传递此方法进到子组件 + onPullDownRefresh(){ + this.handlePullDownRefresh() + }, + data() { + return { + mescroll: { // mescroll-body写在子子子...组件的情况 (多级) + onPageScroll: e=>{ + this.handlePageScroll(e) + }, + onReachBottom: ()=>{ + this.handleReachBottom() + }, + onPullDownRefresh: ()=>{ + this.handlePullDownRefresh() + } + } + } + }, + methods:{ + handlePageScroll(e){ + let item = this.$refs["mescrollItem"]; + if(item && item.mescroll) item.mescroll.onPageScroll(e); + }, + handleReachBottom(){ + let item = this.$refs["mescrollItem"]; + if(item && item.mescroll) item.mescroll.onReachBottom(); + }, + handlePullDownRefresh(){ + let item = this.$refs["mescrollItem"]; + if(item && item.mescroll) item.mescroll.onPullDownRefresh(); + } + } +} + +export default MescrollCompMixin; diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js b/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js new file mode 100644 index 0000000..96ca9bf --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js @@ -0,0 +1,57 @@ +/** + * mescroll-more-item的mixins, 仅在多个 mescroll-body 写在子组件时使用 (参考 mescroll-more 案例) + */ +const MescrollMoreItemMixin = { + // 支付宝小程序不支持props的mixin,需写在具体的页面中 + // #ifndef MP-ALIPAY || MP-DINGTALK + props:{ + i: Number, // 每个tab页的专属下标 + index: { // 当前tab的下标 + type: Number, + default(){ + return 0 + } + } + }, + // #endif + data() { + return { + downOption:{ + auto:false // 不自动加载 + }, + upOption:{ + auto:false // 不自动加载 + }, + isInit: false // 当前tab是否已初始化 + } + }, + watch:{ + // 监听下标的变化 + index(val){ + if (this.i === val && !this.isInit) this.mescrollTrigger() + } + }, + methods: { + // mescroll组件初始化的回调,可获取到mescroll对象 (覆盖mescroll-mixins.js的mescrollInit, 为了标记isInit) + mescrollInit(mescroll) { + this.mescroll = mescroll; + // 自动加载当前tab的数据 + if(this.i === this.index){ + this.mescrollTrigger() + } + }, + // 主动触发加载 + mescrollTrigger(){ + this.isInit = true; // 标记为true + if (this.mescroll) { + if (this.mescroll.optDown.use) { + this.mescroll.triggerDownScroll(); + } else{ + this.mescroll.triggerUpScroll(); + } + } + } + } +} + +export default MescrollMoreItemMixin; diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more.js b/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more.js new file mode 100644 index 0000000..16b47d8 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more.js @@ -0,0 +1,77 @@ +/** + * mescroll-body写在子组件时, 需通过mescroll的mixins补充子组件缺少的生命周期 + */ +const MescrollMoreMixin = { + data() { + return { + tabIndex: 0, // 当前tab下标 + mescroll: { // mescroll-body写在子子子...组件的情况 (多级) + onPageScroll: e=>{ + this.handlePageScroll(e) + }, + onReachBottom: ()=>{ + this.handleReachBottom() + }, + onPullDownRefresh: ()=>{ + this.handlePullDownRefresh() + } + } + } + }, + // 因为子组件无onPageScroll和onReachBottom的页面生命周期,需在页面传递进到子组件 + onPageScroll(e) { + this.handlePageScroll(e) + }, + onReachBottom() { + this.handleReachBottom() + }, + // 当down的native: true时, 还需传递此方法进到子组件 + onPullDownRefresh(){ + this.handlePullDownRefresh() + }, + methods:{ + handlePageScroll(e){ + let mescroll = this.getMescroll(this.tabIndex); + mescroll && mescroll.onPageScroll(e); + }, + handleReachBottom(){ + let mescroll = this.getMescroll(this.tabIndex); + mescroll && mescroll.onReachBottom(); + }, + handlePullDownRefresh(){ + let mescroll = this.getMescroll(this.tabIndex); + mescroll && mescroll.onPullDownRefresh(); + }, + // 根据下标获取对应子组件的mescroll + getMescroll(i){ + if(!this.mescrollItems) this.mescrollItems = []; + if(!this.mescrollItems[i]) { + // v-for中的refs + let vForItem = this.$refs["mescrollItem"]; + if(vForItem){ + this.mescrollItems[i] = vForItem[i] + }else{ + // 普通的refs,不可重复 + this.mescrollItems[i] = this.$refs["mescrollItem"+i]; + } + } + let item = this.mescrollItems[i] + return item ? item.mescroll : null + }, + // 切换tab,恢复滚动条位置 + tabChange(i){ + let mescroll = this.getMescroll(i); + if(mescroll){ + // 恢复上次滚动条的位置 + let y = mescroll.getScrollTop() + mescroll.scrollTo(y, 0) + // 再次恢复上次滚动条的位置, 确保元素已渲染 + setTimeout(()=>{ + mescroll.scrollTo(y, 0) + },30) + } + } + } +} + +export default MescrollMoreMixin; diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/wxs/mixins.js b/uni_modules/mescroll-uni/components/mescroll-uni/wxs/mixins.js new file mode 100644 index 0000000..34ffa3c --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/wxs/mixins.js @@ -0,0 +1,109 @@ +// 定义在wxs (含renderjs) 逻辑层的数据和方法, 与视图层相互通信 +const WxsMixin = { + data() { + return { + // 传入wxs视图层的数据 (响应式) + wxsProp: { + optDown:{}, // 下拉刷新的配置 + scrollTop:0, // 滚动条的距离 + bodyHeight:0, // body的高度 + isDownScrolling:false, // 是否正在下拉刷新中 + isUpScrolling:false, // 是否正在上拉加载中 + isScrollBody:true, // 是否为mescroll-body滚动 + isUpBoth:true, // 上拉加载时,是否同时可以下拉刷新 + t: 0 // 数据更新的标记 (只有数据更新了,才会触发wxs的Observer) + }, + + // 标记调用wxs视图层的方法 + callProp: { + callType: '', // 方法名 + t: 0 // 数据更新的标记 (只有数据更新了,才会触发wxs的Observer) + }, + + // 不用wxs的平台使用此处的wxsBiz对象,抹平wxs的写法 (微信小程序和APP使用的wxsBiz对象是./wxs/wxs.wxs) + // #ifndef MP-WEIXIN || MP-QQ || APP-PLUS || H5 + wxsBiz: { + //注册列表touchstart事件,用于下拉刷新 + touchstartEvent: e=> { + this.mescroll.touchstartEvent(e); + }, + //注册列表touchmove事件,用于下拉刷新 + touchmoveEvent: e=> { + this.mescroll.touchmoveEvent(e); + }, + //注册列表touchend事件,用于下拉刷新 + touchendEvent: e=> { + this.mescroll.touchendEvent(e); + }, + propObserver(){}, // 抹平wxs的写法 + callObserver(){} // 抹平wxs的写法 + }, + // #endif + + // 不用renderjs的平台使用此处的renderBiz对象,抹平renderjs的写法 (app 和 h5 使用的renderBiz对象是./wxs/renderjs.js) + // #ifndef APP-PLUS || H5 + renderBiz: { + propObserver(){} // 抹平renderjs的写法 + } + // #endif + } + }, + methods: { + // wxs视图层调用逻辑层的回调 + wxsCall(msg){ + if(msg.type === 'setWxsProp'){ + // 更新wxsProp数据 (值改变才触发更新) + this.wxsProp = { + optDown: this.mescroll.optDown, + scrollTop: this.mescroll.getScrollTop(), + bodyHeight: this.mescroll.getBodyHeight(), + isDownScrolling: this.mescroll.isDownScrolling, + isUpScrolling: this.mescroll.isUpScrolling, + isUpBoth: this.mescroll.optUp.isBoth, + isScrollBody:this.mescroll.isScrollBody, + t: Date.now() + } + }else if(msg.type === 'setLoadType'){ + // 设置inOffset,outOffset的状态 + this.downLoadType = msg.downLoadType + // 状态挂载到mescroll对象, 以便在其他组件中使用, 比如中 + this.$set(this.mescroll, 'downLoadType', this.downLoadType) + // 重置是否加载成功的状态 + this.$set(this.mescroll, 'isDownEndSuccess', null) + }else if(msg.type === 'triggerDownScroll'){ + // 主动触发下拉刷新 + this.mescroll.triggerDownScroll(); + }else if(msg.type === 'endDownScroll'){ + // 结束下拉刷新 + this.mescroll.endDownScroll(); + }else if(msg.type === 'triggerUpScroll'){ + // 主动触发上拉加载 + this.mescroll.triggerUpScroll(true); + } + } + }, + mounted() { + // #ifdef MP-WEIXIN || MP-QQ || APP-PLUS || H5 + // 配置主动触发wxs显示加载进度的回调 + this.mescroll.optDown.afterLoading = ()=>{ + this.callProp = {callType: "showLoading", t: Date.now()} // 触发wxs的方法 (值改变才触发更新) + } + // 配置主动触发wxs隐藏加载进度的回调 + this.mescroll.optDown.afterEndDownScroll = ()=>{ + this.callProp = {callType: "endDownScroll", t: Date.now()} // 触发wxs的方法 (值改变才触发更新) + let delay = 300 + (this.mescroll.optDown.beforeEndDelay || 0) + setTimeout(()=>{ + if(this.downLoadType === 4 || this.downLoadType === 0){ + this.callProp = {callType: "clearTransform", t: Date.now()} // 触发wxs的方法 (值改变才触发更新) + } + // 状态挂载到mescroll对象, 以便在其他组件中使用, 比如中 + this.$set(this.mescroll, 'downLoadType', this.downLoadType) + }, delay) + } + // 初始化wxs的数据 + this.wxsCall({type: 'setWxsProp'}) + // #endif + } +} + +export default WxsMixin; diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/wxs/renderjs.js b/uni_modules/mescroll-uni/components/mescroll-uni/wxs/renderjs.js new file mode 100644 index 0000000..6cd1301 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/wxs/renderjs.js @@ -0,0 +1,92 @@ +// 使用renderjs直接操作window对象,实现动态控制app和h5的bounce +// bounce: iOS橡皮筋,Android半月弧,h5浏览器下拉背景等效果 (下拉刷新时禁止) +// https://uniapp.dcloud.io/frame?id=renderjs + +// 与wxs的me实例一致 +var me = {} + +// 初始化window对象的touch事件 (仅初始化一次) +if(window && !window.$mescrollRenderInit){ + window.$mescrollRenderInit = true + + + window.addEventListener('touchstart', function(e){ + if (me.disabled()) return; + me.startPoint = me.getPoint(e); // 记录起点 + }, {passive: true}) + + + window.addEventListener('touchmove', function(e){ + if (me.disabled()) return; + if (me.getScrollTop() > 0) return; // 需在顶部下拉,才禁止bounce + + var curPoint = me.getPoint(e); // 当前点 + var moveY = curPoint.y - me.startPoint.y; // 和起点比,移动的距离,大于0向下拉,小于0向上拉 + // 向下拉 + if (moveY > 0) { + // 可下拉的条件 + if (!me.isDownScrolling && !me.optDown.isLock && (!me.isUpScrolling || (me.isUpScrolling && me.isUpBoth))) { + + // 只有touch在mescroll的view上面,才禁止bounce + var el = e.target; + var isMescrollTouch = false; + while (el && el.tagName && el.tagName !== 'UNI-PAGE-BODY' && el.tagName != "BODY") { + var cls = el.classList; + if (cls && cls.contains('mescroll-render-touch')) { + isMescrollTouch = true + break; + } + el = el.parentNode; // 继续检查其父元素 + } + // 禁止bounce (不会对swiper和iOS侧滑返回造成影响) + if (isMescrollTouch && e.cancelable && !e.defaultPrevented) e.preventDefault(); + } + } + }, {passive: false}) +} + +/* 获取滚动条的位置 */ +me.getScrollTop = function() { + return me.scrollTop || document.documentElement.scrollTop || document.body.scrollTop || 0 +} + +/* 是否禁用下拉刷新 */ +me.disabled = function(){ + return !me.optDown || !me.optDown.use || me.optDown.native +} + +/* 根据点击滑动事件获取第一个手指的坐标 */ +me.getPoint = function(e) { + if (!e) { + return {x: 0,y: 0} + } + if (e.touches && e.touches[0]) { + return {x: e.touches[0].pageX,y: e.touches[0].pageY} + } else if (e.changedTouches && e.changedTouches[0]) { + return {x: e.changedTouches[0].pageX,y: e.changedTouches[0].pageY} + } else { + return {x: e.clientX,y: e.clientY} + } +} + +/** + * 监听逻辑层数据的变化 (实时更新数据) + */ +function propObserver(wxsProp) { + me.optDown = wxsProp.optDown + me.scrollTop = wxsProp.scrollTop + me.isDownScrolling = wxsProp.isDownScrolling + me.isUpScrolling = wxsProp.isUpScrolling + me.isUpBoth = wxsProp.isUpBoth +} + +/* 导出模块 */ +const renderBiz = { + data() { + return { + propObserver: propObserver, + } + } +} + +export default renderBiz; \ No newline at end of file diff --git a/uni_modules/mescroll-uni/components/mescroll-uni/wxs/wxs.wxs b/uni_modules/mescroll-uni/components/mescroll-uni/wxs/wxs.wxs new file mode 100644 index 0000000..4af4201 --- /dev/null +++ b/uni_modules/mescroll-uni/components/mescroll-uni/wxs/wxs.wxs @@ -0,0 +1,269 @@ +// 使用wxs处理交互动画, 提高性能, 同时避免小程序bounce对下拉刷新的影响 +// https://uniapp.dcloud.io/frame?id=wxs +// https://developers.weixin.qq.com/miniprogram/dev/framework/view/interactive-animation.html + +// 模拟mescroll实例, 与mescroll.js的写法尽量保持一致 +var me = {} + +// ------ 自定义下拉刷新动画 start ------ + +/* 下拉过程中的回调,滑动过程一直在执行 (rate<1为inOffset; rate>1为outOffset) */ +me.onMoving = function (ins, rate, downHight){ + ins.requestAnimationFrame(function () { + ins.selectComponent('.mescroll-wxs-content').setStyle({ + 'will-change': 'transform', // 可解决下拉过程中, image和swiper脱离文档流的问题 + 'transform': 'translateY(' + downHight + 'px)', + 'transition': '' + }) + // 环形进度条 + var progress = ins.selectComponent('.mescroll-wxs-progress') + progress && progress.setStyle({transform: 'rotate(' + 360 * rate + 'deg)'}) + }) +} + +/* 显示下拉刷新进度 */ +me.showLoading = function (ins){ + me.downHight = me.optDown.offset + ins.requestAnimationFrame(function () { + ins.selectComponent('.mescroll-wxs-content').setStyle({ + 'will-change': 'auto', + 'transform': 'translateY(' + me.downHight + 'px)', + 'transition': 'transform 300ms' + }) + }) +} + +/* 结束下拉 */ +me.endDownScroll = function (ins){ + me.downHight = 0; + me.isDownScrolling = false; + ins.requestAnimationFrame(function () { + ins.selectComponent('.mescroll-wxs-content').setStyle({ + 'will-change': 'auto', + 'transform': 'translateY(0)', // 不可以写空串,否则scroll-view渲染不完整 (延时350ms会调clearTransform置空) + 'transition': 'transform 300ms' + }) + }) +} + +/* 结束下拉动画执行完毕后, 清除transform和transition, 避免对列表内容样式造成影响, 如: h5的list-msg示例下拉进度条漏出来等 */ +me.clearTransform = function (ins){ + ins.requestAnimationFrame(function () { + ins.selectComponent('.mescroll-wxs-content').setStyle({ + 'will-change': '', + 'transform': '', + 'transition': '' + }) + }) +} + +// ------ 自定义下拉刷新动画 end ------ + +/** + * 监听逻辑层数据的变化 (实时更新数据) + */ +function propObserver(wxsProp) { + if(!wxsProp) return + me.optDown = wxsProp.optDown + me.scrollTop = wxsProp.scrollTop + me.bodyHeight = wxsProp.bodyHeight + me.isDownScrolling = wxsProp.isDownScrolling + me.isUpScrolling = wxsProp.isUpScrolling + me.isUpBoth = wxsProp.isUpBoth + me.isScrollBody = wxsProp.isScrollBody + me.startTop = wxsProp.scrollTop // 及时更新touchstart触发的startTop, 避免scroll-view快速惯性滚动到顶部取值不准确 +} + +/** + * 监听逻辑层数据的变化 (调用wxs的方法) + */ +function callObserver(callProp, oldValue, ins) { + if (me.disabled()) return; + if(callProp.callType){ + // 逻辑层(App Service)的style已失效,需在视图层(Webview)设置style + if(callProp.callType === 'showLoading'){ + me.showLoading(ins) + }else if(callProp.callType === 'endDownScroll'){ + me.endDownScroll(ins) + }else if(callProp.callType === 'clearTransform'){ + me.clearTransform(ins) + } + } +} + +/** + * touch事件 + */ +function touchstartEvent(e, ins) { + me.downHight = 0; // 下拉的距离 + me.startPoint = me.getPoint(e); // 记录起点 + me.startTop = me.getScrollTop(); // 记录此时的滚动条位置 + me.startAngle = 0; // 初始角度 + me.lastPoint = me.startPoint; // 重置上次move的点 + me.maxTouchmoveY = me.getBodyHeight() - me.optDown.bottomOffset; // 手指触摸的最大范围(写在touchstart避免body获取高度为0的情况) + me.inTouchend = false; // 标记不是touchend + + me.callMethod(ins, {type: 'setWxsProp'}) // 同步更新wxsProp的数据 (小程序是异步的,可能touchmove先执行,才到propObserver; h5和app是同步) +} + +function touchmoveEvent(e, ins) { + var isPrevent = true // false表示不往上冒泡,相当于调用了同时调用了stopPropagation和preventDefault (对小程序生效, h5和app无效) + + if (me.disabled()) return isPrevent; + + var scrollTop = me.getScrollTop(); // 当前滚动条的距离 + var curPoint = me.getPoint(e); // 当前点 + + var moveY = curPoint.y - me.startPoint.y; // 和起点比,移动的距离,大于0向下拉,小于0向上拉 + + // 向下拉 && 在顶部 + // mescroll-body,直接判定在顶部即可 + // scroll-view在滚动时不会触发touchmove,当触顶/底/左/右时,才会触发touchmove + // scroll-view滚动到顶部时,scrollTop不一定为0,也有可能大于0; 在iOS的APP中scrollTop可能为负数,不一定和startTop相等 + if (moveY > 0 && ( + (me.isScrollBody && scrollTop <= 0) + || + (!me.isScrollBody && (scrollTop <= 0 || (scrollTop <= me.optDown.startTop && scrollTop === me.startTop)) ) + )) { + // 可下拉的条件 + if (!me.inTouchend && !me.isDownScrolling && !me.optDown.isLock && (!me.isUpScrolling || (me.isUpScrolling && + me.isUpBoth))) { + + // 下拉的角度是否在配置的范围内 + if(!me.startAngle) me.startAngle = me.getAngle(me.lastPoint, curPoint); // 两点之间的角度,区间 [0,90] + if (me.startAngle < me.optDown.minAngle) return isPrevent; // 如果小于配置的角度,则不往下执行下拉刷新 + + // 如果手指的位置超过配置的距离,则提前结束下拉,避免Webview嵌套导致touchend无法触发 + if (me.maxTouchmoveY > 0 && curPoint.y >= me.maxTouchmoveY) { + me.inTouchend = true; // 标记执行touchend + touchendEvent(e, ins); // 提前触发touchend + return isPrevent; + } + + isPrevent = false // 小程序是return false + + var diff = curPoint.y - me.lastPoint.y; // 和上次比,移动的距离 (大于0向下,小于0向上) + + // 下拉距离 < 指定距离 + if (me.downHight < me.optDown.offset) { + if (me.movetype !== 1) { + me.movetype = 1; // 加入标记,保证只执行一次 + // me.optDown.inOffset && me.optDown.inOffset(me); // 进入指定距离范围内那一刻的回调,只执行一次 + me.callMethod(ins, {type: 'setLoadType', downLoadType: 1}) + me.isMoveDown = true; // 标记下拉区域高度改变,在touchend重置回来 + } + me.downHight += diff * me.optDown.inOffsetRate; // 越往下,高度变化越小 + + // 指定距离 <= 下拉距离 + } else { + if (me.movetype !== 2) { + me.movetype = 2; // 加入标记,保证只执行一次 + // me.optDown.outOffset && me.optDown.outOffset(me); // 下拉超过指定距离那一刻的回调,只执行一次 + me.callMethod(ins, {type: 'setLoadType', downLoadType: 2}) + me.isMoveDown = true; // 标记下拉区域高度改变,在touchend重置回来 + } + if (diff > 0) { // 向下拉 + me.downHight += diff * me.optDown.outOffsetRate; // 越往下,高度变化越小 + } else { // 向上收 + me.downHight += diff; // 向上收回高度,则向上滑多少收多少高度 + } + } + + me.downHight = Math.round(me.downHight) // 取整 + var rate = me.downHight / me.optDown.offset; // 下拉区域当前高度与指定距离的比值 + // me.optDown.onMoving && me.optDown.onMoving(me, rate, me.downHight); // 下拉过程中的回调,一直在执行 + me.onMoving(ins, rate, me.downHight) + } + } + + me.lastPoint = curPoint; // 记录本次移动的点 + + return isPrevent // false表示不往上冒泡,相当于调用了同时调用了stopPropagation和preventDefault (对小程序生效, h5和app无效) +} + +function touchendEvent(e, ins) { + // 如果下拉区域高度已改变,则需重置回来 + if (me.isMoveDown) { + if (me.downHight >= me.optDown.offset) { + // 符合触发刷新的条件 + me.downHight = me.optDown.offset; // 更新下拉区域高度 + // me.triggerDownScroll(); + me.callMethod(ins, {type: 'triggerDownScroll'}) + } else { + // 不符合的话 则重置 + me.downHight = 0; + // me.optDown.endDownScroll && me.optDown.endDownScroll(me); + me.callMethod(ins, {type: 'endDownScroll'}) + } + me.movetype = 0; + me.isMoveDown = false; + } else if (!me.isScrollBody && me.getScrollTop() === me.startTop) { // scroll-view到顶/左/右/底的滑动事件 + var isScrollUp = me.getPoint(e).y - me.startPoint.y < 0; // 和起点比,移动的距离,大于0向下拉,小于0向上拉 + // 上滑 + if (isScrollUp) { + // 需检查滑动的角度 + var angle = me.getAngle(me.getPoint(e), me.startPoint); // 两点之间的角度,区间 [0,90] + if (angle > 80) { + // 检查并触发上拉 + // me.triggerUpScroll(true); + me.callMethod(ins, {type: 'triggerUpScroll'}) + } + } + } + me.callMethod(ins, {type: 'setWxsProp'}) // 同步更新wxsProp的数据 (小程序是异步的,可能touchmove先执行,才到propObserver; h5和app是同步) +} + +/* 是否禁用下拉刷新 */ +me.disabled = function(){ + return !me.optDown || !me.optDown.use || me.optDown.native +} + +/* 根据点击滑动事件获取第一个手指的坐标 */ +me.getPoint = function(e) { + if (!e) { + return {x: 0,y: 0} + } + if (e.touches && e.touches[0]) { + return {x: e.touches[0].pageX,y: e.touches[0].pageY} + } else if (e.changedTouches && e.changedTouches[0]) { + return {x: e.changedTouches[0].pageX,y: e.changedTouches[0].pageY} + } else { + return {x: e.clientX,y: e.clientY} + } +} + +/* 计算两点之间的角度: 区间 [0,90]*/ +me.getAngle = function (p1, p2) { + var x = Math.abs(p1.x - p2.x); + var y = Math.abs(p1.y - p2.y); + var z = Math.sqrt(x * x + y * y); + var angle = 0; + if (z !== 0) { + angle = Math.asin(y / z) / Math.PI * 180; + } + return angle +} + +/* 获取滚动条的位置 */ +me.getScrollTop = function() { + return me.scrollTop || 0 +} + +/* 获取body的高度 */ +me.getBodyHeight = function() { + return me.bodyHeight || 0; +} + +/* 调用逻辑层的方法 */ +me.callMethod = function(ins, param) { + if(ins) ins.callMethod('wxsCall', param) +} + +/* 导出模块 */ +module.exports = { + propObserver: propObserver, + callObserver: callObserver, + touchstartEvent: touchstartEvent, + touchmoveEvent: touchmoveEvent, + touchendEvent: touchendEvent +} \ No newline at end of file diff --git a/uni_modules/mescroll-uni/hooks/useMescroll.js b/uni_modules/mescroll-uni/hooks/useMescroll.js new file mode 100644 index 0000000..ef91cd1 --- /dev/null +++ b/uni_modules/mescroll-uni/hooks/useMescroll.js @@ -0,0 +1,66 @@ +// 小程序无法在hook中使用页面级别生命周期,需单独传入: https://ask.dcloud.net.cn/question/161173 +// import { onPageScroll, onReachBottom, onPullDownRefresh} from '@dcloudio/uni-app'; + +/** + * 初始化mescroll, 相当于vue2的mescroll-mixins.js文件 (mescroll-body 和 mescroll-uni 通用) + * mescroll-body需传入onPageScroll, onReachBottom + * mescroll-uni无需传onPageScroll, onReachBottom + * 当down.native为true时,需传入onPullDownRefresh + */ +function useMescroll(onPageScroll, onReachBottom, onPullDownRefresh){ + // mescroll实例对象 + let mescroll = null; + + // mescroll组件初始化的回调,可获取到mescroll对象 + const mescrollInit = (e)=> { + mescroll = e; + } + + // 获取mescroll对象, mescrollInit执行之后会有值, 生命周期created中会有值 + const getMescroll = ()=>{ + return mescroll + } + + // 下拉刷新的回调 (mixin默认resetUpScroll) + const downCallback = ()=> { + if(mescroll.optUp.use){ + mescroll.resetUpScroll() + }else{ + setTimeout(()=>{ + mescroll.endSuccess(); + }, 500) + } + } + + // 上拉加载的回调 + const upCallback = ()=> { + // mixin默认延时500自动结束加载 + setTimeout(()=>{ + mescroll.endErr(); + }, 500) + } + + // 注册系统自带的下拉刷新 (配置down.native为true时生效, 还需在pages配置enablePullDownRefresh:true;详请参考mescroll-native的案例) + onPullDownRefresh && onPullDownRefresh(() => { + mescroll && mescroll.onPullDownRefresh(); + }) + + // 注册列表滚动事件,用于判定在顶部可下拉刷新,在指定位置可显示隐藏回到顶部按钮 (此方法为页面生命周期,无法在子组件中触发, 仅在mescroll-body生效) + onPageScroll && onPageScroll(e=>{ + mescroll && mescroll.onPageScroll(e); + }) + + // 注册滚动到底部的事件,用于上拉加载 (此方法为页面生命周期,无法在子组件中触发, 仅在mescroll-body生效) + onReachBottom && onReachBottom(()=>{ + mescroll && mescroll.onReachBottom(); + }) + + return { + getMescroll, + mescrollInit, + downCallback, + upCallback + } +} + +export default useMescroll \ No newline at end of file diff --git a/uni_modules/mescroll-uni/hooks/useMescrollComp.js b/uni_modules/mescroll-uni/hooks/useMescrollComp.js new file mode 100644 index 0000000..3b83847 --- /dev/null +++ b/uni_modules/mescroll-uni/hooks/useMescrollComp.js @@ -0,0 +1,56 @@ +import { ref } from 'vue'; + +// 小程序无法在hook中使用页面级别生命周期,需单独传入: https://ask.dcloud.net.cn/question/161173 +// import { onPageScroll, onReachBottom, onPullDownRefresh} from '@dcloudio/uni-app'; + +/** + * mescroll-body写在子组件时,需通过useMescrollComp补充子组件缺少的生命周期, 相当于vue2的mescroll-comp.js文件 + * 必须传入onPageScroll, onReachBottom + * 当down.native为true时,需传入onPullDownRefresh + */ +function useMescrollComp(onPageScroll, onReachBottom, onPullDownRefresh){ + // 因为子组件无onPageScroll和onReachBottom的页面生命周期,需在页面传递进到子组件 + onPageScroll(e=>{ + handlePageScroll(e) + }) + + onReachBottom(()=>{ + handleReachBottom() + }) + + // 当down的native: true时, 还需传递此方法进到子组件 + onPullDownRefresh && onPullDownRefresh(()=>{ + handlePullDownRefresh() + }) + + const mescrollItem = ref(null) + + const handlePageScroll = (e)=>{ + const mescroll = getMescroll() + mescroll && mescroll.onPageScroll(e); + } + + const handleReachBottom = ()=>{ + const mescroll = getMescroll() + mescroll && mescroll.onReachBottom(); + } + + const handlePullDownRefresh = ()=>{ + const mescroll = getMescroll() + mescroll && mescroll.onPullDownRefresh(); + } + + const getMescroll = ()=>{ + if(mescrollItem.value && mescrollItem.value.getMescroll){ + return mescrollItem.value.getMescroll() + } + return null + } + + return { + mescrollItem, + getMescroll + } +} + +export default useMescrollComp \ No newline at end of file diff --git a/uni_modules/mescroll-uni/hooks/useMescrollMore.js b/uni_modules/mescroll-uni/hooks/useMescrollMore.js new file mode 100644 index 0000000..f9a3cd0 --- /dev/null +++ b/uni_modules/mescroll-uni/hooks/useMescrollMore.js @@ -0,0 +1,69 @@ +import { ref } from 'vue'; + +// 小程序无法在hook中使用页面级别生命周期,需单独传入: https://ask.dcloud.net.cn/question/161173 +// import { onPageScroll, onReachBottom, onPullDownRefresh} from '@dcloudio/uni-app'; + +/** mescroll-more示例写在子组件时,需通过useMescrollMore补充子组件缺少的生命周期, 相当于vue2的mescroll-more.js文件 */ +function useMescrollMore(mescrollItems, onPageScroll, onReachBottom, onPullDownRefresh){ + // 当前tab下标 + const tabIndex = ref(0) + + // 因为子组件无onPageScroll和onReachBottom的页面生命周期,需在页面传递进到子组件 + onPageScroll && onPageScroll(e=>{ + handlePageScroll(e) + }) + + onReachBottom && onReachBottom(()=>{ + handleReachBottom() + }) + + // 当down的native: true时, 还需传递此方法进到子组件 + onPullDownRefresh && onPullDownRefresh(()=>{ + handlePullDownRefresh() + }) + + const handlePageScroll = (e)=>{ + let mescroll = getMescroll(tabIndex.value); + mescroll && mescroll.onPageScroll(e); + } + const handleReachBottom = ()=>{ + let mescroll = getMescroll(tabIndex.value); + mescroll && mescroll.onReachBottom(); + } + + const handlePullDownRefresh = ()=>{ + let mescroll = getMescroll(tabIndex.value); + mescroll && mescroll.onPullDownRefresh(); + } + + // 根据下标获取对应子组件的mescroll + const getMescroll = (i)=>{ + if (mescrollItems && mescrollItems[i]) { + return mescrollItems[i].value.getMescroll() + } else{ + return null + } + } + + // 切换tab,恢复滚动条位置 + const scrollToLastY = ()=>{ + let mescroll = getMescroll(tabIndex.value); + if(mescroll){ + // 恢复上次滚动条的位置 + let y = mescroll.getScrollTop() + mescroll.scrollTo(y, 0) + // 再次恢复上次滚动条的位置, 确保元素已渲染 + setTimeout(()=>{ + mescroll.scrollTo(y, 0) + },20) + } + } + + return { + tabIndex, + getMescroll, + scrollToLastY + } +} + +export default useMescrollMore \ No newline at end of file diff --git a/uni_modules/mescroll-uni/package.json b/uni_modules/mescroll-uni/package.json new file mode 100644 index 0000000..ef37663 --- /dev/null +++ b/uni_modules/mescroll-uni/package.json @@ -0,0 +1,76 @@ +{ + "id": "mescroll-uni", + "displayName": "高性能下拉刷新上拉加载组件 支持vue3 setup", + "version": "1.3.8", + "description": "wxs+renderjs实现, 支持原生页面和局部区域滚动, 支持vue3 script setup的写法", + "keywords": [ + "下拉刷新", + "上拉加载", + "翻页分页", + "wxs", + "setup" +], + "repository": "https://github.com/mescroll/mescroll", +"engines": { + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/mescroll-uni", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/mescroll-uni/readme.md b/uni_modules/mescroll-uni/readme.md new file mode 100644 index 0000000..4bce178 --- /dev/null +++ b/uni_modules/mescroll-uni/readme.md @@ -0,0 +1,45 @@ +## mescroll --【wxs+renderjs实现】高性能的下拉刷新上拉加载组件 +1. mescroll的uni版本 是专门用在uni-app的下拉刷新和上拉加载的组件 + +2. mescroll的uni版本 继承了mescroll.js的实用功能: 自动处理分页, 自动控制无数据, 空布局提示, 回到顶部按钮 .. + +3. mescroll的uni版本 丰富的案例, 自由灵活的api, 超详细的注释, 可让您快速自定义真正属于自己的下拉上拉组件 + +
+ + +## 最新文档(1.3.8版本): https://www.mescroll.com/uni.html +2023-03-26 by 小瑾同学 (文档可能会有缓存,建议打开时刷新一下) + + +## 1.3.5版本已调整为[uni_modules](https://uniapp.dcloud.io/uni_modules) +uni_modules版本的mescroll-body 和 mescroll-empty 支持 [easycom规范](https://uniapp.dcloud.io/collocation/pages?id=easycom) +所以 main.js 无需再为mescroll-body注册全局组件 +所以个别页面要单独使用 mescroll-empty , 也无需手动注册 +#### 1.3.5以前的用户升级为uni_modules版本: +``` +1. 删除原来的 @/components/mescroll-uni 组件 +2. 删除 main.js 注册的 mescroll 组件 +3. 从插件市场导入最新mescroll组件 (1.3.5+uni_modules版本) +4. 全局搜索 '@/components/mescroll-uni/' 替换为 '@/uni_modules/mescroll-uni/components/mescroll-uni/' +5. mescroll-empty遵循easycom规范, 若某些页面单独使用 'mescroll-empty.vue', 可删除手动导入的代码 +``` + +## 近期已更新优化的内容: +1. 新增vue3 script setup的示例 +2. 新增`入门极简`示例, 国际化`mescroll-i18n.vue`示例, 轮播吸顶菜单`mescroll-swiper-sticky.vue`示例 +3. 新增 "局部区域滚动" 的案例: mescroll-body-part.vue 和 mescroll-uni-part.vue +4. 新增 me-video 视频组件, 解决APP端视频下拉悬浮错位的问题, 参考 mescroll-options.vue 示例 +5. 新增 me-tabs 组件,tabs支持水平滑动; 优化mescroll-more和mescroll-swiper的案例, 顶部tab支持水平滑动 +6. 吸顶悬浮提供了原生sticky和监听滚动条实现的示例: sticky.vue 和 sticky-scroll.vue (推荐使用sticky样式实现) +7. mescroll.scrollTo(y)的y支持css选择器, 包括跨自定义组件的后代选择器, 支持滚动到子组件的view (参考 mescroll-options.vue) +8. topbar 顶部是否预留状态栏的高度, 默认false; 还可支持设置状态栏背景: 如 '#ffff00', 'url(xxx) 0 0/100% 100%', 'linear-gradient(xx)' +9. down.bgColor 和 up.bgColor 加载区域的背景,不仅支持色值, 而且还是支持背景图和渐变: 如 'url(xxx) 0 0/100% 100%', 'linear-gradient(xx)' +10. topbar,bgColor支持一行代码定义background: [https://www.runoob.com/cssref/css3-pr-background.html](https://www.runoob.com/cssref/css3-pr-background.html) +
+
+查看更多 ... + +
+ +#### mescroll不支持nvue,也暂无支持的计划哈,so sorry~ \ No newline at end of file diff --git a/uni_modules/mp-html/README.md b/uni_modules/mp-html/README.md new file mode 100644 index 0000000..cf9ba73 --- /dev/null +++ b/uni_modules/mp-html/README.md @@ -0,0 +1,192 @@ +## 为减小组件包的大小,默认组件包中不包含编辑、latex 公式等扩展功能,需要使用扩展功能的请参考下方的 插件扩展 栏的说明 + +## 功能介绍 +- 全端支持(含 `v3、NVUE`) +- 支持丰富的标签(包括 `table`、`video`、`svg` 等) +- 支持丰富的事件效果(自动预览图片、链接处理等) +- 支持设置占位图(加载中、出错时、预览时) +- 支持锚点跳转、长按复制等丰富功能 +- 支持大部分 *html* 实体 +- 丰富的插件(关键词搜索、内容编辑、`latex` 公式等) +- 效率高、容错性强且轻量化 + +查看 [功能介绍](https://jin-yufeng.github.io/mp-html/#/overview/feature) 了解更多 + +## 使用方法 +- `uni_modules` 方式 + 1. 点击右上角的 `使用 HBuilder X 导入插件` 按钮直接导入项目或点击 `下载插件 ZIP` 按钮下载插件包并解压到项目的 `uni_modules/mp-html` 目录下 + 2. 在需要使用页面的 `(n)vue` 文件中添加 + ```html + + + ``` + ```javascript + export default { + data() { + return { + html: '
Hello World!
' + } + } + } + ``` + 3. 需要更新版本时在 `HBuilder X` 中右键 `uni_modules/mp-html` 目录选择 `从插件市场更新` 即可 + +- 源码方式 + 1. 从 [github](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 或 [gitee](https://gitee.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 下载源码 + 插件市场的 **非 uni_modules 版本** 无法更新,不建议从插件市场获取 + 2. 在需要使用页面的 `(n)vue` 文件中添加 + ```html + + ``` + ```javascript + import mpHtml from '@/components/mp-html/mp-html' + export default { + // HBuilderX 2.5.5+ 可以通过 easycom 自动引入 + components: { + mpHtml + }, + data() { + return { + html: '
Hello World!
' + } + } + } + ``` + +- npm 方式 + 1. 在项目根目录下执行 + ```bash + npm install mp-html + ``` + 2. 在需要使用页面的 `(n)vue` 文件中添加 + ```html + + ``` + ```javascript + import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html' + export default { + // 不可省略 + components: { + mpHtml + }, + data() { + return { + html: '
Hello World!
' + } + } + } + ``` + 3. 需要更新版本时执行以下命令即可 + ```bash + npm update mp-html + ``` + + 使用 *cli* 方式运行的项目,通过 *npm* 方式引入时,需要在 *vue.config.js* 中配置 *transpileDependencies*,详情可见 [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687) + 如果在 **nvue** 中使用还要将 `dist/uni-app/static` 目录下的内容拷贝到项目的 `static` 目录下,否则无法运行 + +查看 [快速开始](https://jin-yufeng.github.io/mp-html/#/overview/quickstart) 了解更多 + +## 组件属性 + +| 属性 | 类型 | 默认值 | 说明 | +|:---:|:---:|:---:|---| +| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v210)) | +| content | String | | 用于渲染的 html 字符串 | +| copy-link | Boolean | true | 是否允许外部链接被点击时自动复制 | +| domain | String | | 主域名(用于链接拼接) | +| error-img | String | | 图片出错时的占位图链接 | +| lazy-load | Boolean | false | 是否开启图片懒加载 | +| loading-img | String | | 图片加载过程中的占位图链接 | +| pause-video | Boolean | true | 是否在播放一个视频时自动暂停其他视频 | +| preview-img | Boolean | true | 是否允许图片被点击时自动预览 | +| scroll-table | Boolean | false | 是否给每个表格添加一个滚动层使其能单独横向滚动 | +| selectable | Boolean | false | 是否开启文本长按复制 | +| set-title | Boolean | true | 是否将 title 标签的内容设置到页面标题 | +| show-img-menu | Boolean | true | 是否允许图片被长按时显示菜单 | +| tag-style | Object | | 设置标签的默认样式 | +| use-anchor | Boolean | false | 是否使用锚点链接 | + +查看 [属性](https://jin-yufeng.github.io/mp-html/#/basic/prop) 了解更多 + +## 组件事件 + +| 名称 | 触发时机 | +|:---:|---| +| load | dom 树加载完毕时 | +| ready | 图片加载完毕时 | +| error | 发生渲染错误时 | +| imgtap | 图片被点击时 | +| linktap | 链接被点击时 | +| play | 音视频播放时 | + +查看 [事件](https://jin-yufeng.github.io/mp-html/#/basic/event) 了解更多 + +## api +组件实例上提供了一些 `api` 方法可供调用 + +| 名称 | 作用 | +|:---:|---| +| in | 将锚点跳转的范围限定在一个 scroll-view 内 | +| navigateTo | 锚点跳转 | +| getText | 获取文本内容 | +| getRect | 获取富文本内容的位置和大小 | +| setContent | 设置富文本内容 | +| imgList | 获取所有图片的数组 | +| pauseMedia | 暂停播放音视频([2.2.2+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v222)) | +| setPlaybackRate | 设置音视频播放速率([2.4.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v240)) | + +查看 [api](https://jin-yufeng.github.io/mp-html/#/advanced/api) 了解更多 + +## 插件扩展 +除基本功能外,本组件还提供了丰富的扩展,可按照需要选用 + +| 名称 | 作用 | +|:---:|---| +| audio | 音乐播放器 | +| editable | 富文本 **编辑**([示例项目](https://mp-html.oss-cn-hangzhou.aliyuncs.com/editable.zip)) | +| emoji | 解析 emoji | +| highlight | 代码块高亮显示 | +| markdown | 渲染 markdown | +| search | 关键词搜索 | +| style | 匹配 style 标签中的样式 | +| txv-video | 使用腾讯视频 | +| img-cache | 图片缓存 by [@PentaTea](https://github.com/PentaTea) | +| latex | 渲染 latex 公式 by [@Zeng-J](https://github.com/Zeng-J) | + +从插件市场导入的包中 **不含有** 扩展插件,使用插件需通过微信小程序 `富文本插件` 获取或参考以下方法进行打包: +1. 获取完整组件包 + ```bash + npm install mp-html + ``` +2. 编辑 `tools/config.js` 中的 `plugins` 项,选择需要的插件 +3. 生成新的组件包 + 在 `node_modules/mp-html` 目录下执行 + ```bash + npm install + npm run build:uni-app + ``` +4. 拷贝 `dist/uni-app` 中的内容到项目根目录 + +查看 [插件](https://jin-yufeng.github.io/mp-html/#/advanced/plugin) 了解更多 + +## 关于 nvue +`nvue` 使用原生渲染,不支持部分 `css` 样式,为实现和 `html` 相同的效果,组件内部通过 `web-view` 进行渲染,性能上差于原生,根据 `weex` 官方建议,`web` 标签仅应用在非常规的降级场景。因此,如果通过原生的方式(如 `richtext`)能够满足需要,则不建议使用本组件,如果有较多的富文本内容,则可以直接使用 `vue` 页面 +由于渲染方式与其他端不同,有以下限制: +1. 不支持 `lazy-load` 属性 +2. 视频不支持全屏播放 +3. 如果在 `flex-direction: row` 的容器中使用,需要给组件设置宽度或设置 `flex: 1` 占满剩余宽度 + +纯 `nvue` 模式下,[此问题](https://ask.dcloud.net.cn/question/119678) 修复前,不支持通过 `uni_modules` 引入,需要本地引入(将 [dist/uni-app](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 中的内容拷贝到项目根目录下) + + +## 问题反馈 +遇到问题时,请先查阅 [常见问题](https://jin-yufeng.github.io/mp-html/#/question/faq) 和 [issue](https://github.com/jin-yufeng/mp-html/issues) 中是否已有相同的问题 +可通过 [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose) 、插件问答或发送邮件到 [mp_html@126.com](mailto:mp_html@126.com) 提问,不建议在评论区提问(不方便回复) +提问请严格按照 [issue 模板](https://github.com/jin-yufeng/mp-html/issues/new/choose) ,描述清楚使用环境、`html` 内容或可复现的 `demo` 项目以及复现方式,对于 **描述不清**、**无法复现** 或重复的问题将不予回复 + +欢迎加入 `QQ` 交流群: +群1(已满):`699734691` +群2(已满):`778239129` +群3:`960265313` + +查看 [问题反馈](https://jin-yufeng.github.io/mp-html/#/question/feedback) 了解更多 diff --git a/uni_modules/mp-html/changelog.md b/uni_modules/mp-html/changelog.md new file mode 100644 index 0000000..ebb557a --- /dev/null +++ b/uni_modules/mp-html/changelog.md @@ -0,0 +1,156 @@ +## v2.5.1(2025-04-20) +1. `U` 适配鸿蒙 `APP` [详细](https://github.com/jin-yufeng/mp-html/issues/615) +2. `U` 微信小程序替换废弃 `api` `getSystemInfoSync` [详细](https://github.com/jin-yufeng/mp-html/issues/613) +3. `F` 修复了 `app` 端播放视频可能报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/617) +4. `F` 修复了 `latex` 插件可能出现 `xxx can be used only in display mode` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/632) +5. `F` 修复了 `uni-app` 包 `latex` 公式可能不显示的问题 [#599](https://github.com/jin-yufeng/mp-html/issues/599)、[#627](https://github.com/jin-yufeng/mp-html/issues/627) +## v2.5.0(2024-04-22) +1. `U` `play` 事件增加返回 `src` 等信息 [详细](https://github.com/jin-yufeng/mp-html/issues/526) +2. `U` `preview-img` 属性支持设置为 `all` 开启 `base64` 图片预览 [详细](https://github.com/jin-yufeng/mp-html/issues/536) +3. `U` `editable` 插件增加简易模式(点击文字直接编辑) +4. `U` `latex` 插件支持块级公式 [详细](https://github.com/jin-yufeng/mp-html/issues/582) +5. `F` 修复了表格部分情况下背景丢失的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/587) +6. `F` 修复了部分 `svg` 无法显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/591) +7. `F` 修复了 `h5` 和 `app` 端部分情况下样式无法识别的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/518) +8. `F` 修复了 `latex` 插件部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/580) +9. `F` 修复了 `editable` 插件表格无法删除的问题 +10. `F` 修复了 `editable` 插件 `vue3` `h5` 端点击图片报错的问题 +11. `F` 修复了 `editable` 插件点击表格没有菜单栏的问题 +## v2.4.3(2024-01-21) +1. `A` 增加 [card](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#card) 插件 [详细](https://github.com/jin-yufeng/mp-html/pull/533) by [@whoooami](https://github.com/whoooami) +2. `F` 修复了 `svg` 中包含 `foreignobject` 可能不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/523) +3. `F` 修复了合并单元格的表格部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/561) +4. `F` 修复了 `img` 标签设置 `object-fit` 无效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/567) +5. `F` 修复了 `latex` 插件公式会换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/540) +6. `F` 修复了 `editable` 和 `audio` 插件共用时点击 `audio` 无法编辑的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/529) by [@whoooami](https://github.com/whoooami) +7. `F` 修复了微信小程序部分情况下图片会报错 `replace of undefined` 的问题 +8. `F` 修复了快手小程序图片不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/571) +## v2.4.2(2023-05-14) +1. `A` `editable` 插件支持修改文字颜色 [详细](https://github.com/jin-yufeng/mp-html/issues/254) +2. `F` 修复了 `svg` 中有 `style` 不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/505) +3. `F` 修复了使用旧版编译器可能报错 `Bad attr nodes` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/472) +4. `F` 修复了 `app` 端可能出现无法读取 `lazyLoad` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/513) +5. `F` 修复了 `editable` 插件在点击换图时未拼接 `domain` 的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/497) by [@TwoKe945](https://github.com/TwoKe945) +6. `F` 修复了 `latex` 插件部分情况下不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/515) +7. `F` 修复了 `editable` 插件点击音视频时其他标签框不消失的问题 +## v2.4.1(2022-12-25) +1. `F` 修复了没有图片时 `ready` 事件可能不触发的问题 +2. `F` 修复了加载过程中可能出现 `Root label not found` 错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/470) +3. `F` 修复了 `audio` 插件退出页面可能会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/457) +4. `F` 修复了 `vue3` 运行到 `app` 在 `HBuilder X 3.6.10` 以上报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/480) +5. `F` 修复了 `nvue` 端链接中包含 `%22` 时可能无法显示的问题 +6. `F` 修复了 `vue3` 使用 `highlight` 插件可能报错的问题 +## v2.4.0(2022-08-27) +1. `A` 增加了 [setPlaybackRate](https://jin-yufeng.gitee.io/mp-html/#/advanced/api#setPlaybackRate) 的 `api`,可以设置音视频的播放速率 [详细](https://github.com/jin-yufeng/mp-html/issues/452) +2. `A` 示例小程序代码开源 [详细](https://github.com/jin-yufeng/mp-html-demo) +3. `U` 优化 `ready` 事件触发时机,未设置懒加载的情况下基本可以准确触发 [详细](https://github.com/jin-yufeng/mp-html/issues/195) +4. `U` `highlight` 插件在编辑状态下不进行高亮处理,便于编辑 +5. `F` 修复了 `flex` 布局下图片大小可能不正确的问题 +6. `F` 修复了 `selectable` 属性没有设置 `force` 也可能出现渲染异常的问题 +7. `F` 修复了表格中的图片大小可能不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/448) +8. `F` 修复了含有合并单元格的表格可能无法设置竖直对齐的问题 +9. `F` 修复了 `editable` 插件在 `scroll-view` 中使用时工具条位置可能不正确的问题 +10. `F` 修复了 `vue3` 使用 [search](advanced/plugin#search) 插件可能导致错误换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/449) +## v2.3.2(2022-08-13) +1. `A` 增加 [latex](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#latex) 插件,可以渲染数学公式 [详细](https://github.com/jin-yufeng/mp-html/pull/447) by [@Zeng-J](https://github.com/Zeng-J) +2. `U` 优化根节点下有很多标签的长内容渲染速度 +3. `U` `highlight` 插件适配 `lang-xxx` 格式 +4. `F` 修复了 `table` 标签设置 `border` 属性后可能无法修改边框样式的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/439) by [@zouxingjie](https://github.com/zouxingjie) +5. `F` 修复了 `editable` 插件输入连续空格无效的问题 +6. `F` 修复了 `vue3` 图片设置 `inline` 会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/438) +7. `F` 修复了 `vue3` 使用 `table` 可能报错的问题 +## v2.3.1(2022-05-20) +1. `U` `app` 端支持使用本地图片 +2. `U` 优化了微信小程序 `selectable` 属性在 `ios` 端的处理 [详细](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#selectable) +3. `F` 修复了 `editable` 插件不在顶部时 `tooltip` 位置可能错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/430) +4. `F` 修复了 `vue3` 运行到微信小程序可能报错丢失内容的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/414) +5. `F` 修复了 `vue3` 部分标签可能被错误换行的问题 +6. `F` 修复了 `editable` 插件 `app` 端插入视频无法预览的问题 +## v2.3.0(2022-04-01) +1. `A` 增加了 `play` 事件,音视频播放时触发,可用于与页面其他音视频进行互斥播放 [详细](basic/event#play) +2. `U` `show-img-menu` 属性支持控制预览时是否长按弹出菜单 +3. `U` 优化 `wxs` 处理,提高渲染性能 [详细](https://developers.weixin.qq.com/community/develop/article/doc/0006cc2b204740f601bd43fa25a413) +4. `U` `video` 标签支持 `object-fit` 属性 +5. `U` 增加支持一些常用实体编码 [详细](https://github.com/jin-yufeng/mp-html/issues/418) +6. `F` 修复了图片仅设置高度可能不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/410) +7. `F` 修复了 `video` 标签高度设置为 `auto` 不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/411) +8. `F` 修复了使用 `grid` 布局时可能样式错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/413) +9. `F` 修复了含有合并单元格的表格部分情况下显示异常的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/417) +10. `F` 修复了 `editable` 插件连续插入内容时顺序不正确的问题 +11. `F` 修复了 `uni-app` 包 `vue3` 使用 `audio` 插件报错的问题 +12. `F` 修复了 `uni-app` 包 `highlight` 插件使用自定义的 `prism.min.js` 报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/416) +## v2.2.2(2022-02-26) +1. `A` 增加了 [pauseMedia](https://jin-yufeng.gitee.io/mp-html/#/advanced/api#pauseMedia) 的 `api`,可用于暂停播放音视频 [详细](https://github.com/jin-yufeng/mp-html/issues/317) +2. `U` 优化了长内容的加载速度 +3. `U` 适配 `vue3` [#389](https://github.com/jin-yufeng/mp-html/issues/389)、[#398](https://github.com/jin-yufeng/mp-html/pull/398) by [@zhouhuafei](https://github.com/zhouhuafei)、[#400](https://github.com/jin-yufeng/mp-html/issues/400) +4. `F` 修复了小程序端图片高度设置为百分比时可能不显示的问题 +5. `F` 修复了 `highlight` 插件部分情况下可能显示不完整的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/403) +## v2.2.1(2021-12-24) +1. `A` `editable` 插件增加上下移动标签功能 +2. `U` `editable` 插件支持在文本中间光标处插入内容 +3. `F` 修复了 `nvue` 端设置 `margin` 后可能导致高度不正确的问题 +4. `F` 修复了 `highlight` 插件使用压缩版的 `prism.css` 可能导致背景失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/367) +5. `F` 修复了编辑状态下使用 `emoji` 插件内容为空时可能报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/371) +6. `F` 修复了使用 `editable` 插件后将 `selectable` 属性设置为 `force` 不生效的问题 +## v2.2.0(2021-10-12) +1. `A` 增加 `customElements` 配置项,便于添加自定义功能性标签 [详细](https://github.com/jin-yufeng/mp-html/issues/350) +2. `A` `editable` 插件增加切换音视频自动播放状态的功能 [详细](https://github.com/jin-yufeng/mp-html/pull/341) by [@leeseett](https://github.com/leeseett) +3. `A` `editable` 插件删除媒体标签时触发 `remove` 事件,便于删除已上传的文件 +4. `U` `editable` 插件 `insertImg` 方法支持同时插入多张图片 [详细](https://github.com/jin-yufeng/mp-html/issues/342) +5. `U` `editable` 插入图片和音视频时支持拼接 `domian` 主域名 +6. `F` 修复了内部链接参数中包含 `://` 时被认为是外部链接的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/356) +7. `F` 修复了部分 `svg` 标签名或属性名大小写不正确时不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/351) +8. `F` 修复了 `nvue` 页面运行到非 `app` 平台时可能样式错误的问题 +## v2.1.5(2021-08-13) +1. `A` 增加支持标签的 `dir` 属性 +2. `F` 修复了 `ruby` 标签文字与拼音没有居中对齐的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/325) +3. `F` 修复了音视频标签内有 `a` 标签时可能无法播放的问题 +4. `F` 修复了 `externStyle` 中的 `class` 名包含下划线或数字时可能失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/326) +5. `F` 修复了 `h5` 端引入 `externStyle` 可能不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/326) +## v2.1.4(2021-07-14) +1. `F` 修复了 `rt` 标签无法设置样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/318) +2. `F` 修复了表格中有单元格同时合并行和列时可能显示不正确的问题 +3. `F` 修复了 `app` 端无法关闭图片长按菜单的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/322) +4. `F` 修复了 `editable` 插件只能添加图片链接不能修改的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/312) by [@leeseett](https://github.com/leeseett) +## v2.1.3(2021-06-12) +1. `A` `editable` 插件增加 `insertTable` 方法 +2. `U` `editable` 插件支持编辑表格中的空白单元格 [详细](https://github.com/jin-yufeng/mp-html/issues/310) +3. `F` 修复了 `externStyle` 中使用伪类可能失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/298) +4. `F` 修复了多个组件同时使用时 `tag-style` 属性时可能互相影响的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/305) by [@woodguoyu](https://github.com/woodguoyu) +5. `F` 修复了包含 `linearGradient` 的 `svg` 可能无法显示的问题 +6. `F` 修复了编译到头条小程序时可能报错的问题 +7. `F` 修复了 `nvue` 端不触发 `click` 事件的问题 +8. `F` 修复了 `editable` 插件尾部插入时无法撤销的问题 +9. `F` 修复了 `editable` 插件的 `insertHtml` 方法只能在末尾插入的问题 +10. `F` 修复了 `editable` 插件插入音频不显示的问题 +## v2.1.2(2021-04-24) +1. `A` 增加了 [img-cache](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#img-cache) 插件,可以在 `app` 端缓存图片 [详细](https://github.com/jin-yufeng/mp-html/issues/292) by [@PentaTea](https://github.com/PentaTea) +2. `U` 支持通过 `container-style` 属性设置 `white-space` 来保留连续空格和换行符 [详细](https://jin-yufeng.gitee.io/mp-html/#/question/faq#space) +3. `U` 代码风格符合 [standard](https://standardjs.com) 标准 +4. `U` `editable` 插件编辑状态下支持预览视频 [详细](https://github.com/jin-yufeng/mp-html/issues/286) +5. `F` 修复了 `svg` 标签内嵌 `svg` 时无法显示的问题 +6. `F` 修复了编译到支付宝和头条小程序时部分区域不可复制的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/291) +## v2.1.1(2021-04-09) +1. 修复了对 `p` 标签设置 `tag-style` 可能不生效的问题 +2. 修复了 `svg` 标签中的文本无法显示的问题 +3. 修复了使用 `editable` 插件编辑表格时可能报错的问题 +4. 修复了使用 `highlight` 插件运行到头条小程序时可能没有样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/280) +5. 修复了使用 `editable` 插件 `editable` 属性为 `false` 时会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/284) +6. 修复了 `style` 插件连续子选择器失效的问题 +7. 修复了 `editable` 插件无法修改图片和字体大小的问题 +## v2.1.0.2(2021-03-21) +修复了 `nvue` 端使用可能报错的问题 +## v2.1.0(2021-03-20) +1. `A` 增加了 [container-style](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#container-style) 属性 [详细](https://gitee.com/jin-yufeng/mp-html/pulls/1) +2. `A` 增加支持 `strike` 标签 +3. `A` `editable` 插件增加 `placeholder` 属性 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#editable) +4. `A` `editable` 插件增加 `insertHtml` 方法 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#editable) +5. `U` 外部样式支持标签名选择器 [详细](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart#setting) +6. `F` 修复了 `nvue` 端部分情况下可能不显示的问题 +## v2.0.5(2021-03-12) +1. `U` [linktap](https://jin-yufeng.gitee.io/mp-html/#/basic/event#linktap) 事件增加返回内部文本内容 `innerText` [详细](https://github.com/jin-yufeng/mp-html/issues/271) +2. `U` [selectable](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#selectable) 属性设置为 `force` 时能够在微信 `iOS` 端生效(文本块会变成 `inline-block`) [详细](https://github.com/jin-yufeng/mp-html/issues/267) +3. `F` 修复了部分情况下竖向无法滚动的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/182) +4. `F` 修复了多次修改富文本数据时部分内容可能不显示的问题 +5. `F` 修复了 [腾讯视频](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#txv-video) 插件可能无法播放的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/265) +6. `F` 修复了 [highlight](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#highlight) 插件没有设置高亮语言时没有应用默认样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/276) by [@fuzui](https://github.com/fuzui) diff --git a/uni_modules/mp-html/components/mp-html/mp-html.vue b/uni_modules/mp-html/components/mp-html/mp-html.vue new file mode 100644 index 0000000..796762b --- /dev/null +++ b/uni_modules/mp-html/components/mp-html/mp-html.vue @@ -0,0 +1,498 @@ + + + + + diff --git a/uni_modules/mp-html/components/mp-html/node/node.vue b/uni_modules/mp-html/components/mp-html/node/node.vue new file mode 100644 index 0000000..d3457c5 --- /dev/null +++ b/uni_modules/mp-html/components/mp-html/node/node.vue @@ -0,0 +1,597 @@ +