Commit 567eb23c by 李伟康

commit

0 parents
Showing 84 changed files with 8977 additions and 0 deletions
project.private.config.json
project.config.json
File mode changed
import {
preReleaseAppId
} from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 1
/**
*
0本地
1开发
2测试
3生产
4预发布
*/
const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync()
// console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion)
//手动控制体验版环境的请求 true就依据下面index false就默认为2
const manual = true
const release = false
// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
// trial:体验版
// release:正式版
// console.log( systemInfo.platform);
// console.log(accountInfo.miniProgram.envVersion);
// 对比一下appkey
// console.log();
if (systemInfo.platform != 'devtools') {
// 判断预发布的appid 是强制锁定为4(预发布的地址)
if (accountInfo.miniProgram.appId == preReleaseAppId) {
index = 4
} else {
switch (accountInfo.miniProgram.envVersion) {
case 'develop':
// this.globalData.url = 'http://192.168.0.252:3000/api'; //
break
case 'trial':
index = manual ? index : 2
break
case 'release':
index = release ? index : 3
break
default:
index = 3
break
}
}
}
const secretKey = {
ip: {},
dev: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
uat: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
prod: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
preRelease: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
}
} [target[index]]
const domain = {
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip: 'http://192.168.1.117:8315',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: 'https://scrm.dev.glsx.com.cn',
uat: 'https://scrm.test.glsx.com.cn',
preRelease: 'https://scrm.beta.glsx.com.cn',
prod: 'https://scrm.glsx.com.cn'
} [target[index]]
const djDomain = {
ip: 'https://dj.dev.glsx.com.cn',
dev: 'https://dj.dev.glsx.com.cn',
preRelease: 'https://dj.beta.glsx.com.cn',
uat: 'https://dj.test.glsx.com.cn',
prod: 'https://dj.glsx.com.cn',
} [target[index]]
const djSecretKey = {
ip: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
dev: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
uat: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
preRelease: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
prod: {
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
},
pet: {
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
}
} [target[index]]
const gscDomain = {
ip: 'http://192.168.3.145:9898',
dev: 'https://gsc-agent.dev.glsx.com.cn',
uat: 'https://gsc-agent.test.glsx.com.cn',
preRelease: 'https://gsc-agent.beta.glsx.com.cn',
prod: 'https://gsc-agent.gldijia.com.cn'
} [target[index]]
const pathEnum = {
sso: '/rop-scrm-sso/',
shopmall: '/rop-scrm-shopmall/',
coupon: '/rop-scrm-coupon/',
carlife: '/rop-scrm-carlife/',
live: '/rop-scrm-live/',
equity: '/rop-scrm-equity/',
entmicro: '/rop-scrm-entmicro/',
wechat: '/rop-scrm-wechat/',
boutiquecoupon: '/rop-scrm-boutiquecoupon/',
material: '/rop-scrm-marketing/', //素材
sop: '/rop-scrm-sop/',
customercollect: '/rop-scrm-bigdatautil/',
drac: '/rop-scrm-entmicro/',
busassistant: '/rop-scrm-busassistant/',
pad: '/rop-dj-pad/',
}
const defaultMerchantId = {
ip: '44211227',
dev: '44211227',
uat: '44210895',
prod: '44208317',
preRelease: '44211283'
} [target[index]]
const CONFIG_ENV_MAP = {
'1': 'develope',
'2': 'test',
'3': 'production',
'4': 'beta'
}
module.exports = {
index,
domain,
pathEnum,
secretKey,
defaultMerchantId,
env: CONFIG_ENV_MAP[index],
gscDomain,
djSecretKey,
djDomain
}
\ No newline at end of file
import apiModules from './module/index'
module.exports = apiModules
\ No newline at end of file
import http from '../request/http'
const common = 'scrm.api.carlife.common.'
module.exports = {
/**上传图片
*/
uploadImg(data) {
return http.post({
method: `${common}uploadImg`,
...data,
noSignAttr: ["file"],
});
},
/**视频上传
*/
uploadVideo(data) {
return http.post({
method: `${common}uploadVideo`,
...data,
noSignAttr: ["file"],
});
},
/**获取图片版本号 */
getImgVersion() {
return http.getMock();
},
//获取北森SSO鉴权
findBeiSenSSOToken(data) {
return http.post({
method: 'dj.pad.api.beisen.findBeiSenSSOToken',
projectName: 'pad',
...data
}, true)
},
};
\ No newline at end of file
import wechatApi from './wechat'
import userApi from './user'
import common from './common'
module.exports = {
wechatApi,
userApi,
common,
}
\ No newline at end of file
import http from '../request/http'
const {
appId
} = wx.getAccountInfoSync().miniProgram
let loginCount = null,
loginCache = null,
loginTimer = null
class UsersApi {
/**调用后台接口获取用户信息 */
async login() {
const appEnter = wx.getEnterOptionsSync()
try {
if (appEnter.scene === 1154 && appEnter.mode === 'singlePage') throw 'login:fail rejected due to no permission currently'
if (!loginCount) {
loginCache = null
loginCount = Date.now()
const {
code
} = await this.getWxCode(),
data = await http.fetch('scrm.api.sso.weapp.jscode.login', {
appId,
code,
delSessionId: true
})
loginCache = data
loginCount = null
return Promise.resolve(data)
} else {
return new Promise((resolve) => {
loginTimer = setInterval(() => {
if (loginCache) {
clearInterval(loginTimer)
loginCount = null
resolve(loginCache)
}
}, 1e3)
})
}
} catch (error) {
if (loginTimer) clearInterval(loginTimer)
loginCount = null
return Promise.reject(error)
}
}
/**调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。 */
getWxCode() {
return new Promise((resolve, reject) => {
wx.login({
success: res => resolve(res),
fail: err => reject(err)
})
})
}
/**调用后台接口获取用户信息js_code换取sessionId */
async wxCodeLogin() {
const appEnter = wx.getEnterOptionsSync()
try {
if (appEnter.scene === 1154 && appEnter.mode === 'singlePage') throw 'login:fail rejected due to no permission currently'
const {
code
} = await this.getWxCode()
return await http.fetch('scrm.api.sso.wechat.applets.jscode.login', {
appId,
code
})
} catch (error) {
return Promise.reject(error)
}
}
/** 手机号授权解析(单纯解析内容返回前端)
* 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号
*/
async getUserProfile(loginToken, detail = {}) {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (!loginToken) {
let res = await this.wxCodeLogin()
loginToken = res.data
}
detail.loginToken = loginToken
return http.post({
method: 'scrm.api.sso.wechat.applets.phone.grant.analysis',
...detail,
platformEntrance: 'BUSINESS_ASSISTANT'
}, true)
}
/**授权手机号 */
async authUserPhone(detail, sessionId) {
if (!sessionId) {
wx.p.wxApi.showToast('缺少sessionId')
Promise.reject({
errMsg: '缺少sessionId'
})
}
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
wx.p.wxApi.showLoading()
detail.sessionId = sessionId
return http.fetch('scrm.api.sso.weapp.auth.phone', detail)
} else Promise.reject(detail.errMsg)
}
/**退出登录 */
logout() {
return http.fetch('scrm.api.sso.user.logout')
}
/** 手机号获取短信验证码 */
getSmsCode(mobile) {
return http.fetch('scrm.api.sso.wechat.applets.sms.get.code', {
mobile
})
}
/** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) {
return http.fetch('scrm.api.sso.wechat.applets.sms.login', {
...data,
source: 'MINIAPP',
platformEntrance: 'BUSINESS_ASSISTANT'
})
}
/*
*C端手机号短信登录
*/
phoneLogin(data) {
return http.fetch('scrm.api.sso.weapp.auth.phone.mini', {
source: 'MINIAPP',
...data
})
}
/**
* 北森登录
*/
async beisenLogin(loginToken, detail = {}) {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (!loginToken) {
let res = await this.wxCodeLogin()
loginToken = res.data
}
detail.loginToken = loginToken
return http.post({
method: 'scrm.api.sso.beisen.token.get',
...detail,
}, true)
}
/**
* 通过手机号获取北森token
*
*/
getBeisenToken(data){
return http.fetch('scrm.api.sso.beisen.token.by.phone', data)
}
}
export default new UsersApi()
\ No newline at end of file
import http from '../request/http'
const path = 'scrm.api.wechat.'
module.exports = {
/** 解析scene */
getSceneById(data) {
// return api.post({
// method: `${path}get.scene.by.id`,
// ...data
// }, true)
return http.fetch(`${path}get.scene.by.id`,data);
}
}
import sign from './sign.js'
import {
defaultMerchantId,
secretKey,
pathEnum,
domain,
gscDomain,
djDomain,
djSecretKey
} from '../env/index'
const HOST = {
scrm: domain,
dj: djDomain
}
/**接口 */
class Request {
get(params, returnAll = false, hostType = 'scrm') {
return this.request('GET', params, returnAll, hostType)
}
post(params, returnAll = false, hostType = 'scrm') {
return this.request('POST', params, returnAll, hostType)
}
fetch(method, data, returnAll = true, hostType = 'scrm') {
return this.post({
method,
...data,
},
returnAll,
hostType
);
}
wx_request({
url,
method = 'GET',
data = {},
header = {},
dataType = 'json',
responseType = "text"
}) {
return new Promise((resolve) => {
wx.request({
url,
data,
method,
header,
dataType,
responseType,
success(response) {
resolve(response.data)
}
})
})
}
reportTrack(params) {
return this.request('POST', params, true)
}
request(RequestMethods, params, returnAll , hostType = 'scrm') {
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
let header = RequestMethods === 'POST' ? {
'content-type': 'application/x-www-form-urlencoded'
} : {
'Cache-Control': 'no-cache'
}
let {
merchantId
} = wx.p.storage.get('merchant_info')
header.merchantId = wx.$merchant_id || merchantId || defaultMerchantId
let projectName = params.projectName
if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName]
params = this.getData(params, hostType)
wx.request({
url: `${HOST[hostType]}${path}router?method=${params.method}`,
data: params,
method: RequestMethods,
header,
dataType: 'json',
responseType: 'text',
success(response) {
/**业务代码 */
let {
data: {
code,
message
},
data
} = response
if (returnAll) {
resolve(data)
return
}
if (code == 20 || code == 21) {
wx.hideLoading()
const thisPage = wx.p.router.getPageInstance(),
options = Object.keys(thisPage.options)
let currentRoute = thisPage.route,
query = []
if (options.length) {
options.map(key => {
query.push(`${key}=${thisPage.options[key]}`)
})
}
if (query.length) currentRoute += `?${query.join('&')}`
return wx.p.router.redirectTo('/pages/loading/loading', {
url: `/${currentRoute}`
})
} else {
if (code == '0') {
resolve(data.data)
} else {
wx.showToast({
title: message || '系统异常',
icon: 'none'
})
}
}
},
fail(error) {
wx.hideLoading()
console.error(`接口异常:`, error)
wx.showToast({
title: typeof error == 'string' ? error : JSON.stringify(error) || '系统异常',
icon: 'error'
})
reject(error)
},
complete() {
wx.stopPullDownRefresh()
wx.hideNavigationBarLoading()
}
})
})
}
getData(params,hostType) {
let projectName = params.projectName
if (!projectName) projectName = this.getRopProject(params.method)
else delete params.projectName
let appKey = '48e5e13229b82c1b4e6e8c96151f0637'
let secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
if (secretKey[projectName]) {
appKey = secretKey[projectName].appKey
secret = secretKey[projectName].secret
}
if(hostType == 'dj'){
appKey = djSecretKey.appKey
secret = djSecretKey.secret
}
let {
sessionId
} = wx.p.storage.get()
let noSignAttr = []
if (!params.sessionId && sessionId) params.sessionId = sessionId
if (params.delSessionId) {
delete params.sessionId
delete params.delSessionId
}
if (params.noSignAttr) {
noSignAttr = params.noSignAttr
delete params.noSignAttr
}
params.v = '1.0.0'
params.format = 'json'
params.locale = 'zh_CN'
params.source = 'dj-wechat'
params.appKey = appKey
return sign(params, secret, noSignAttr)
}
getRopProject(method) {
const projectName = method.split('.')[2]
return projectName
}
gscGet(url, data = {}, returnAll = false) {
return this.gscRequest(url, params, 'GET', returnAll)
}
gscPost(url, data = {}, returnAll = false) {
return this.gscRequest(url, data, 'POST', returnAll)
}
gscRequest(url, data = {}, method = 'GET', returnAll) {
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
wx.request({
url: `${gscDomain}/gsc-agent-manage-biz/${url}`,
data,
method,
success(response) {
let {
data
} = response
if (returnAll) {
resolve(data)
return
}
resolve(data.data)
},
fail(error) {
wx.hideLoading()
reject(error)
},
complete() {
wx.stopPullDownRefresh()
wx.hideNavigationBarLoading()
}
})
})
}
}
export default new Request()
\ No newline at end of file
import {sha1,qs} from '../../lib/index'
const sign = (params, secret, noSignAttr = []) => {
delete params.sign
var objStr = qs.stringify(params, {
arrayFormat: 'indices',
allowDots: true,
encodeValuesOnly: true
})
var objVal = objStr.split('&')
var realObj = {}
objVal.forEach(item => {
const idx = item.indexOf('=')
realObj[item.split('=')[0]] = decodeURIComponent(item.slice(idx + 1))
})
const keys = Object.keys(realObj).sort()
var str = []
var obj = null
for (const key in realObj) {
obj = realObj[key]
if (obj === null) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
realObj[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + realObj[e])
})
realObj.sign = sha1(secret + str.join('') + secret).toUpperCase()
return realObj
}
export default sign
\ No newline at end of file
// app.js
// 初始化sentry
import sentryInit from "~/utils/sentryConfig/sentryInit";
sentryInit();
import api from "./api/index";
import { router } from "./router/index";
// 判断小程序是否需要更新
import { getUpdateManager } from "./lib/index";
import utils from "./utils/index";
// 埋点 有需要再引入
// import './utils/track/Track'
/**分享 */
import '~/utils/share'
App({
onLaunch(options) {
getUpdateManager();
/**挂载到wx对象 */
wx.p = {
authStatus: false,
...utils,
api,
router,
storage: new utils.cache.Storage(),
};
// 存储设备信息
utils.cache.storageApi.setSystem_info();
},
/**页面不存在时触发 */
onPageNotFound(e) {
wx.p.router.goHome();
},
onHide() {},
globalData: {
ROUTE_QUERY: {},
},
});
{
"pages": [
"pages/loading/loading",
"pages/login/login",
"pages/webView/webView",
"pages/noAccess/noAccess"
],
"requiredPrivateInfos": [],
"lazyCodeLoading": "requiredComponents",
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "广联数科EHR系统"
},
"subPackages": [
{
"root": "packageIndex",
"pages": [
"pages/index/index"
]
}
],
"usingComponents": {
"navigation-bar": "/components/NavigationBar/NavigationBar"
},
"style": "v2",
"resolveAlias": {
"~/*": "/*"
},
"sitemapLocation": "sitemap.json",
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
}
}
\ No newline at end of file
@import "assets/style/common.wxss";
page {
background-color: #F9F7F7 !important;
color: #282829;
font-size: 28rpx;
--themeColor: #14c2c3;
--btnColor: #14c2c3;
--fontColor:#23b7bb;
--borderRadius: 8rpx;
--margin: 32rpx;
/* 兼容 IOS<11.2 先constant再env */
--constantSafeAreaInsetBottom: constant(safe-area-inset-bottom);
/* 兼容 IOS>11.2 */
--envSafeAreaInsetBottom: env(safe-area-inset-bottom);
}
image {
width: 100%;
height: 100%;
vertical-align: top;
}
.flex_sc {
display: flex;
align-items: center;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
\ No newline at end of file
/**app.wxss**/
.flex {
display: flex;
align-items: center;
}
.sticky {
position: sticky;
top: 0;
left: 0;
z-index: 2;
background-color: #fff;
}
.flex-center {
display: flex;
align-items: center;
justify-content: start;
}
.y-center {
top: 50%;
transform: translateY(-50%);
}
.x-center {
left: 50%;
transform: translateX(-50%);
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.isFullSucreen {
/* padding-bottom: 34px !important; */
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.isFullSucreen-bottom {
bottom: constant(safe-area-inset-bottom) !important;
bottom: env(safe-area-inset-bottom) !important;
}
.default-btn {
width: 622rpx;
height: 104rpx;
background: var(--btnColor);
border-radius: var(--borderRadius);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: var(--margin);
}
.list-nothing {
width: 100%;
padding: 8rpx 0 30rpx;
text-align: center;
font-size: 28rpx;
color: #C1C2C3;
}
.list-nothing .icon {
width: 320rpx;
height: 320rpx;
}
.list-not {
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-size: 24rpx;
height: 100%;
}
@keyframes show-box {
0% {
opacity: 0;
transform: scale(2.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes show-box-opacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes show-box-inset{
0% {
opacity: 0;
transform: scale(.1);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.safe-area {
display: block;
width: 100%;
height: 0;
opacity: 0;
}
\ No newline at end of file
// components/Modal/Modal.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
cancelText: {
type: String,
value: '不同意'
},
confirmText: {
type: String,
value: '同意'
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
cancel() {
this.setData({
show: false
})
this.triggerEvent('cancel')
},
getPhoneNumber(e) {
this.setData({
show: false
})
this.triggerEvent('confirm', e.detail)
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* components/Modal/Modal.wxss */
.popup {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
z-index: 998;
&-bg {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #00000080;
}
.modal-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 622rpx;
min-height: 404rpx;
border-radius: 20rpx;
background: #ffffff;
display: flex;
flex-direction: column;
.footer-box {
height: 144rpx;
margin-top: auto;
display: flex;
align-items: center;
justify-content: center;
gap: 0 24rpx;
.btn {
width: 251rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
border-radius: 8rpx;
margin: 0 !important;
}
.cancel {
background: #f4f6f7;
color: #222222;
}
.confirm {
background: var(--themeColor);
color: #fff;
}
}
}
}
\ No newline at end of file
<view class="popup" wx:if="{{show}}">
<view class="popup-bg"></view>
<view class="modal-box box-center">
<slot></slot>
<view class="footer-box">
<view class="cancel btn" bind:tap="cancel">{{cancelText}}</view>
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="confirm btn">{{confirmText}}</button>
</view>
</view>
</view>
\ No newline at end of file
// components/navigationBar/navigationBar.js
Component({
/**
* 组件的属性列表
*/
properties: {
navStyle: String,
custom: Boolean,
showBack: Boolean,
pageTitle: {
type: String,
value: '',
observer(n) {
if (n) {
this.title = n
this.setPageTitle()
}
}
}
},
title: '',
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
setPageTitle() {
let thisPage = wx.p.router.getPageInstance()
if (thisPage) thisPage.navigationBarTitleText = this.title
},
init() {
/**
* 获取自定义导航栏信息
*/
wx.getSystemInfo().then(res => {
let {
fontSizeSetting,
statusBarHeight,
screenWidth
} = res
const {
height,
right,
width,
top
} = wx.getMenuButtonBoundingClientRect(),
currentPages = getCurrentPages(), {
showBack
} = this.data
if (showBack && currentPages.length > 1) this.setData({
SHOWBACK: true
})
let navigationBarHeight = height + ((top - statusBarHeight) * 2)
let navigationBarPadding = screenWidth - right
let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width * 2)
this.setData({
statusBarHeight,
navigationBarHeight,
navigationBarStyle: `font-size:${fontSizeSetting}px;`,
navigationBarTextWidth: `width:${navigationBarWidth}px;padding:0 ${navigationBarPadding}px;`
})
this.emit({
navigationBarHeight,
statusBarHeight
})
})
},
emit({
navigationBarHeight,
statusBarHeight
}) {
let navHeight = navigationBarHeight + statusBarHeight
const thisPage = wx.p.router.getPageInstance()
this.triggerEvent('navbarReady', {
height: navHeight,
statusBarHeight
})
this.setData({
showNavBar: true
})
thisPage.setData({
navHeight,
statusBarHeight
})
},
back() {
wx.p.router.back()
}
},
lifetimes: {
attached() {
this.init()
this.setPageTitle()
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}">
<block wx:if="{{SHOWBACK}}">
<view class="back " bindtap="back">
<image class="img" src="./images/icon-back.png" />
</view>
</block>
<view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}">
<slot/>
</view>
</view>
</block>
<block wx:else>
<slot/>
</block>
</view>
\ No newline at end of file
/* components/navigationBar/navigationBar.wxss */
.navigation-bar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 99;
background-color: #FFFFFF;
transition: all .15s;
}
.navigation-bar-box {
position: relative;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.navigation-bar-titleText {
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
box-sizing: border-box;
text-align: center;
letter-spacing: 1rpx;
}
.back-box {
width: 76rpx;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.back {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 100rpx;
/* height: 34rpx; */
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back .img {
width: 16rpx;
height: 34rpx;
}
\ No newline at end of file
/**
* 用来配置小程序项目的变量
* 统一管理
*/
// 配置预发布的小程序aapId
export const preReleaseAppId = 'wx6e40cfb83ce4ffb1'
// sentry Dsn 地址
export const dsnUrl = 'https://44b18e4acc2e4ab18f12a69a561b55bc@sentry.glsx.com.cn/39'
// cdn图片地址
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/hmd/'
import sha1 from './sha1.js'
import qs from './qs'
import wxqrcode from './wxqrcode.js'
import getUpdateManager from "./wxUpdateManager";
import * as Sentry from './sentry-miniapp'
module.exports ={ sha1,qs,wxqrcode,getUpdateManager,Sentry }
\ No newline at end of file
(function () {
'use strict';
var ERROR = 'input is invalid type';
var WINDOW = typeof window === 'object';
var root = WINDOW ? window : {};
if (root.JS_MD5_NO_WINDOW) {
WINDOW = false;
}
var WEB_WORKER = !WINDOW && typeof self === 'object';
var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
if (NODE_JS) {
root = global;
} else if (WEB_WORKER) {
root = self;
}
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === 'object' && module.exports;
var AMD = typeof define === 'function' && define.amd;
var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
var HEX_CHARS = '0123456789abcdef'.split('');
var EXTRA = [128, 32768, 8388608, -2147483648];
var SHIFT = [0, 8, 16, 24];
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer', 'base64'];
var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
var blocks = [], buffer8;
if (ARRAY_BUFFER) {
var buffer = new ArrayBuffer(68);
buffer8 = new Uint8Array(buffer);
blocks = new Uint32Array(buffer);
}
if (root.JS_MD5_NO_NODE_JS || !Array.isArray) {
Array.isArray = function (obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
};
}
if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
ArrayBuffer.isView = function (obj) {
return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
};
}
/**
* @method hex
* @memberof md5
* @description Output hash as hex string
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {String} Hex string
* @example
* md5.hex('The quick brown fox jumps over the lazy dog');
* // equal to
* md5('The quick brown fox jumps over the lazy dog');
*/
/**
* @method digest
* @memberof md5
* @description Output hash as bytes array
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Array} Bytes array
* @example
* md5.digest('The quick brown fox jumps over the lazy dog');
*/
/**
* @method array
* @memberof md5
* @description Output hash as bytes array
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Array} Bytes array
* @example
* md5.array('The quick brown fox jumps over the lazy dog');
*/
/**
* @method arrayBuffer
* @memberof md5
* @description Output hash as ArrayBuffer
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {ArrayBuffer} ArrayBuffer
* @example
* md5.arrayBuffer('The quick brown fox jumps over the lazy dog');
*/
/**
* @method buffer
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
* @memberof md5
* @description Output hash as ArrayBuffer
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {ArrayBuffer} ArrayBuffer
* @example
* md5.buffer('The quick brown fox jumps over the lazy dog');
*/
/**
* @method base64
* @memberof md5
* @description Output hash as base64 string
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {String} base64 string
* @example
* md5.base64('The quick brown fox jumps over the lazy dog');
*/
var createOutputMethod = function (outputType) {
return function (message) {
return new Md5(true).update(message)[outputType]();
};
};
/**
* @method create
* @memberof md5
* @description Create Md5 object
* @returns {Md5} Md5 object.
* @example
* var hash = md5.create();
*/
/**
* @method update
* @memberof md5
* @description Create and update Md5 object
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Md5} Md5 object.
* @example
* var hash = md5.update('The quick brown fox jumps over the lazy dog');
* // equal to
* var hash = md5.create();
* hash.update('The quick brown fox jumps over the lazy dog');
*/
var createMethod = function () {
var method = createOutputMethod('hex');
if (NODE_JS) {
method = nodeWrap(method);
}
method.create = function () {
return new Md5();
};
method.update = function (message) {
return method.create().update(message);
};
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
var type = OUTPUT_TYPES[i];
method[type] = createOutputMethod(type);
}
return method;
};
var nodeWrap = function (method) {
var crypto = eval("require('crypto')");
var Buffer = eval("require('buffer').Buffer");
var nodeMethod = function (message) {
if (typeof message === 'string') {
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
} else {
if (message === null || message === undefined) {
throw ERROR;
} else if (message.constructor === ArrayBuffer) {
message = new Uint8Array(message);
}
}
if (Array.isArray(message) || ArrayBuffer.isView(message) ||
message.constructor === Buffer) {
return crypto.createHash('md5').update(new Buffer(message)).digest('hex');
} else {
return method(message);
}
};
return nodeMethod;
};
/**
* Md5 class
* @class Md5
* @description This is internal class.
* @see {@link md5.create}
*/
function Md5(sharedMemory) {
if (sharedMemory) {
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] =
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
this.blocks = blocks;
this.buffer8 = buffer8;
} else {
if (ARRAY_BUFFER) {
var buffer = new ArrayBuffer(68);
this.buffer8 = new Uint8Array(buffer);
this.blocks = new Uint32Array(buffer);
} else {
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
}
}
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
this.finalized = this.hashed = false;
this.first = true;
}
/**
* @method update
* @memberof Md5
* @instance
* @description Update hash
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {Md5} Md5 object.
* @see {@link md5.update}
*/
Md5.prototype.update = function (message) {
if (this.finalized) {
return;
}
var notString, type = typeof message;
if (type !== 'string') {
if (type === 'object') {
if (message === null) {
throw ERROR;
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
message = new Uint8Array(message);
} else if (!Array.isArray(message)) {
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
throw ERROR;
}
}
} else {
throw ERROR;
}
notString = true;
}
var code, index = 0, i, length = message.length, blocks = this.blocks;
var buffer8 = this.buffer8;
while (index < length) {
if (this.hashed) {
this.hashed = false;
blocks[0] = blocks[16];
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
}
if (notString) {
if (ARRAY_BUFFER) {
for (i = this.start; index < length && i < 64; ++index) {
buffer8[i++] = message[index];
}
} else {
for (i = this.start; index < length && i < 64; ++index) {
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
}
}
} else {
if (ARRAY_BUFFER) {
for (i = this.start; index < length && i < 64; ++index) {
code = message.charCodeAt(index);
if (code < 0x80) {
buffer8[i++] = code;
} else if (code < 0x800) {
buffer8[i++] = 0xc0 | (code >> 6);
buffer8[i++] = 0x80 | (code & 0x3f);
} else if (code < 0xd800 || code >= 0xe000) {
buffer8[i++] = 0xe0 | (code >> 12);
buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
buffer8[i++] = 0x80 | (code & 0x3f);
} else {
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
buffer8[i++] = 0xf0 | (code >> 18);
buffer8[i++] = 0x80 | ((code >> 12) & 0x3f);
buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
buffer8[i++] = 0x80 | (code & 0x3f);
}
}
} else {
for (i = this.start; index < length && i < 64; ++index) {
code = message.charCodeAt(index);
if (code < 0x80) {
blocks[i >> 2] |= code << SHIFT[i++ & 3];
} else if (code < 0x800) {
blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
} else if (code < 0xd800 || code >= 0xe000) {
blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
} else {
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
}
}
}
}
this.lastByteIndex = i;
this.bytes += i - this.start;
if (i >= 64) {
this.start = i - 64;
this.hash();
this.hashed = true;
} else {
this.start = i;
}
}
if (this.bytes > 4294967295) {
this.hBytes += this.bytes / 4294967296 << 0;
this.bytes = this.bytes % 4294967296;
}
return this;
};
Md5.prototype.finalize = function () {
if (this.finalized) {
return;
}
this.finalized = true;
var blocks = this.blocks, i = this.lastByteIndex;
blocks[i >> 2] |= EXTRA[i & 3];
if (i >= 56) {
if (!this.hashed) {
this.hash();
}
blocks[0] = blocks[16];
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
}
blocks[14] = this.bytes << 3;
blocks[15] = this.hBytes << 3 | this.bytes >>> 29;
this.hash();
};
Md5.prototype.hash = function () {
var a, b, c, d, bc, da, blocks = this.blocks;
if (this.first) {
a = blocks[0] - 680876937;
a = (a << 7 | a >>> 25) - 271733879 << 0;
d = (-1732584194 ^ a & 2004318071) + blocks[1] - 117830708;
d = (d << 12 | d >>> 20) + a << 0;
c = (-271733879 ^ (d & (a ^ -271733879))) + blocks[2] - 1126478375;
c = (c << 17 | c >>> 15) + d << 0;
b = (a ^ (c & (d ^ a))) + blocks[3] - 1316259209;
b = (b << 22 | b >>> 10) + c << 0;
} else {
a = this.h0;
b = this.h1;
c = this.h2;
d = this.h3;
a += (d ^ (b & (c ^ d))) + blocks[0] - 680876936;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[1] - 389564586;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[2] + 606105819;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[3] - 1044525330;
b = (b << 22 | b >>> 10) + c << 0;
}
a += (d ^ (b & (c ^ d))) + blocks[4] - 176418897;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[5] + 1200080426;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[6] - 1473231341;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[7] - 45705983;
b = (b << 22 | b >>> 10) + c << 0;
a += (d ^ (b & (c ^ d))) + blocks[8] + 1770035416;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[9] - 1958414417;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[10] - 42063;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[11] - 1990404162;
b = (b << 22 | b >>> 10) + c << 0;
a += (d ^ (b & (c ^ d))) + blocks[12] + 1804603682;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ (a & (b ^ c))) + blocks[13] - 40341101;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ (d & (a ^ b))) + blocks[14] - 1502002290;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ (c & (d ^ a))) + blocks[15] + 1236535329;
b = (b << 22 | b >>> 10) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[1] - 165796510;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[6] - 1069501632;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[11] + 643717713;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[0] - 373897302;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[5] - 701558691;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[10] + 38016083;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[15] - 660478335;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[4] - 405537848;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[9] + 568446438;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[14] - 1019803690;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[3] - 187363961;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[8] + 1163531501;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ (d & (b ^ c))) + blocks[13] - 1444681467;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ (c & (a ^ b))) + blocks[2] - 51403784;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ (b & (d ^ a))) + blocks[7] + 1735328473;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ (a & (c ^ d))) + blocks[12] - 1926607734;
b = (b << 20 | b >>> 12) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[5] - 378558;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[8] - 2022574463;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[11] + 1839030562;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[14] - 35309556;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[1] - 1530992060;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[4] + 1272893353;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[7] - 155497632;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[10] - 1094730640;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[13] + 681279174;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[0] - 358537222;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[3] - 722521979;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[6] + 76029189;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks[9] - 640364487;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks[12] - 421815835;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks[15] + 530742520;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks[2] - 995338651;
b = (b << 23 | b >>> 9) + c << 0;
a += (c ^ (b | ~d)) + blocks[0] - 198630844;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[7] + 1126891415;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[14] - 1416354905;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[5] - 57434055;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks[12] + 1700485571;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[3] - 1894986606;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[10] - 1051523;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[1] - 2054922799;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks[8] + 1873313359;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[15] - 30611744;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[6] - 1560198380;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[13] + 1309151649;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks[4] - 145523070;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks[11] - 1120210379;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks[2] + 718787259;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks[9] - 343485551;
b = (b << 21 | b >>> 11) + c << 0;
if (this.first) {
this.h0 = a + 1732584193 << 0;
this.h1 = b - 271733879 << 0;
this.h2 = c - 1732584194 << 0;
this.h3 = d + 271733878 << 0;
this.first = false;
} else {
this.h0 = this.h0 + a << 0;
this.h1 = this.h1 + b << 0;
this.h2 = this.h2 + c << 0;
this.h3 = this.h3 + d << 0;
}
};
/**
* @method hex
* @memberof Md5
* @instance
* @description Output hash as hex string
* @returns {String} Hex string
* @see {@link md5.hex}
* @example
* hash.hex();
*/
Md5.prototype.hex = function () {
this.finalize();
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
return HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +
HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +
HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +
HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +
HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +
HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +
HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +
HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +
HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +
HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +
HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +
HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +
HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +
HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +
HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +
HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F];
};
/**
* @method toString
* @memberof Md5
* @instance
* @description Output hash as hex string
* @returns {String} Hex string
* @see {@link md5.hex}
* @example
* hash.toString();
*/
Md5.prototype.toString = Md5.prototype.hex;
/**
* @method digest
* @memberof Md5
* @instance
* @description Output hash as bytes array
* @returns {Array} Bytes array
* @see {@link md5.digest}
* @example
* hash.digest();
*/
Md5.prototype.digest = function () {
this.finalize();
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
return [
h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 24) & 0xFF,
h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 24) & 0xFF,
h2 & 0xFF, (h2 >> 8) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 24) & 0xFF,
h3 & 0xFF, (h3 >> 8) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 24) & 0xFF
];
};
/**
* @method array
* @memberof Md5
* @instance
* @description Output hash as bytes array
* @returns {Array} Bytes array
* @see {@link md5.array}
* @example
* hash.array();
*/
Md5.prototype.array = Md5.prototype.digest;
/**
* @method arrayBuffer
* @memberof Md5
* @instance
* @description Output hash as ArrayBuffer
* @returns {ArrayBuffer} ArrayBuffer
* @see {@link md5.arrayBuffer}
* @example
* hash.arrayBuffer();
*/
Md5.prototype.arrayBuffer = function () {
this.finalize();
var buffer = new ArrayBuffer(16);
var blocks = new Uint32Array(buffer);
blocks[0] = this.h0;
blocks[1] = this.h1;
blocks[2] = this.h2;
blocks[3] = this.h3;
return buffer;
};
/**
* @method buffer
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
* @memberof Md5
* @instance
* @description Output hash as ArrayBuffer
* @returns {ArrayBuffer} ArrayBuffer
* @see {@link md5.buffer}
* @example
* hash.buffer();
*/
Md5.prototype.buffer = Md5.prototype.arrayBuffer;
/**
* @method base64
* @memberof Md5
* @instance
* @description Output hash as base64 string
* @returns {String} base64 string
* @see {@link md5.base64}
* @example
* hash.base64();
*/
Md5.prototype.base64 = function () {
var v1, v2, v3, base64Str = '', bytes = this.array();
for (var i = 0; i < 15;) {
v1 = bytes[i++];
v2 = bytes[i++];
v3 = bytes[i++];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
BASE64_ENCODE_CHAR[v3 & 63];
}
v1 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
'==';
return base64Str;
};
var exports = createMethod();
if (COMMON_JS) {
module.exports = exports;
} else {
/**
* @method md5
* @description Md5 hash function, export to global in browsers.
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {String} md5 hashes
* @example
* md5(''); // d41d8cd98f00b204e9800998ecf8427e
* md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
* md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
*
* // It also supports UTF-8 encoding
* md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
*
* // It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
* md5([]); // d41d8cd98f00b204e9800998ecf8427e
* md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
*/
root.md5 = exports;
if (AMD) {
define(function () {
return exports;
});
}
}
})();
\ No newline at end of file
var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var S=_((le,M)=>{"use strict";M.exports=N;function y(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function N(t){if(t=t||{},t.circles)return Q(t);return t.proto?s:a;function e(f,i){for(var r=Object.keys(f),n=new Array(r.length),u=0;u<r.length;u++){var o=r[u],p=f[o];typeof p!="object"||p===null?n[o]=p:p instanceof Date?n[o]=new Date(p):ArrayBuffer.isView(p)?n[o]=y(p):n[o]=i(p)}return n}function a(f){if(typeof f!="object"||f===null)return f;if(f instanceof Date)return new Date(f);if(Array.isArray(f))return e(f,a);if(f instanceof Map)return new Map(e(Array.from(f),a));if(f instanceof Set)return new Set(e(Array.from(f),a));var i={};for(var r in f)if(Object.hasOwnProperty.call(f,r)!==!1){var n=f[r];typeof n!="object"||n===null?i[r]=n:n instanceof Date?i[r]=new Date(n):n instanceof Map?i[r]=new Map(e(Array.from(n),a)):n instanceof Set?i[r]=new Set(e(Array.from(n),a)):ArrayBuffer.isView(n)?i[r]=y(n):i[r]=a(n)}return i}function s(f){if(typeof f!="object"||f===null)return f;if(f instanceof Date)return new Date(f);if(Array.isArray(f))return e(f,s);if(f instanceof Map)return new Map(e(Array.from(f),s));if(f instanceof Set)return new Set(e(Array.from(f),s));var i={};for(var r in f){var n=f[r];typeof n!="object"||n===null?i[r]=n:n instanceof Date?i[r]=new Date(n):n instanceof Map?i[r]=new Map(e(Array.from(n),s)):n instanceof Set?i[r]=new Set(e(Array.from(n),s)):ArrayBuffer.isView(n)?i[r]=y(n):i[r]=s(n)}return i}}function Q(t){var e=[],a=[];return t.proto?i:f;function s(r,n){for(var u=Object.keys(r),o=new Array(u.length),p=0;p<u.length;p++){var c=u[p],l=r[c];if(typeof l!="object"||l===null)o[c]=l;else if(l instanceof Date)o[c]=new Date(l);else if(ArrayBuffer.isView(l))o[c]=y(l);else{var h=e.indexOf(l);h!==-1?o[c]=a[h]:o[c]=n(l)}}return o}function f(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return s(r,f);if(r instanceof Map)return new Map(s(Array.from(r),f));if(r instanceof Set)return new Set(s(Array.from(r),f));var n={};e.push(r),a.push(n);for(var u in r)if(Object.hasOwnProperty.call(r,u)!==!1){var o=r[u];if(typeof o!="object"||o===null)n[u]=o;else if(o instanceof Date)n[u]=new Date(o);else if(o instanceof Map)n[u]=new Map(s(Array.from(o),f));else if(o instanceof Set)n[u]=new Set(s(Array.from(o),f));else if(ArrayBuffer.isView(o))n[u]=y(o);else{var p=e.indexOf(o);p!==-1?n[u]=a[p]:n[u]=f(o)}}return e.pop(),a.pop(),n}function i(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return s(r,i);if(r instanceof Map)return new Map(s(Array.from(r),i));if(r instanceof Set)return new Set(s(Array.from(r),i));var n={};e.push(r),a.push(n);for(var u in r){var o=r[u];if(typeof o!="object"||o===null)n[u]=o;else if(o instanceof Date)n[u]=new Date(o);else if(o instanceof Map)n[u]=new Map(s(Array.from(o),i));else if(o instanceof Set)n[u]=new Set(s(Array.from(o),i));else if(ArrayBuffer.isView(o))n[u]=y(o);else{var p=e.indexOf(o);p!==-1?n[u]=a[p]:n[u]=i(o)}}return e.pop(),a.pop(),n}}});var V=_((ce,I)=>{"use strict";var C=Array.isArray,W=Object.keys,Z=Object.prototype.hasOwnProperty;I.exports=function t(e,a){if(e===a)return!0;if(e&&a&&typeof e=="object"&&typeof a=="object"){var s=C(e),f=C(a),i,r,n;if(s&&f){if(r=e.length,r!=a.length)return!1;for(i=r;i--!=0;)if(!t(e[i],a[i]))return!1;return!0}if(s!=f)return!1;var u=e instanceof Date,o=a instanceof Date;if(u!=o)return!1;if(u&&o)return e.getTime()==a.getTime();var p=e instanceof RegExp,c=a instanceof RegExp;if(p!=c)return!1;if(p&&c)return e.toString()==a.toString();var l=W(e);if(r=l.length,r!==W(a).length)return!1;for(i=r;i--!=0;)if(!Z.call(a,l[i]))return!1;for(i=r;i--!=0;)if(n=l[i],!t(e[n],a[n]))return!1;return!0}return e!==e&&a!==a}});var q=_(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0}),A.parseMultiDataPaths=ee,A.getDataOnPath=void 0;var E=/^\s/,b=function(t,e){throw new Error('Parsing data path "'+t+'" failed at char "'+t[e]+'" (index '+e+")")},L=function(t,e){for(var a=e.index;e.index<e.length;){var s=t[e.index];if(/^[0-9]/.test(s)){e.index++;continue}break}return a===e.index&&b(t,e.index),parseInt(t.slice(a,e.index),10)},R=function(t,e){var a=e.index,s=t[a];if(/^[_a-zA-Z$]/.test(s))for(e.index++;e.index<e.length;){var f=t[e.index];if(/^[_a-zA-Z0-9$]/.test(f)){e.index++;continue}break}else b(t,e.index);return t.slice(a,e.index)},B=function(t,e){for(var a=[R(t,e)],s={deepCmp:!1};e.index<e.length;){var f=t[e.index];if(f==="[")e.index++,a.push(L(t,e)),t[e.index]!=="]"&&b(t,e.index),e.index++;else if(f==="."){if(e.index++,t[e.index]==="*"){if(e.index++,t[e.index]==="*"){e.index++,s.deepCmp=!0;break}b(t,e.index)}a.push(R(t,e))}else break}return{path:a,options:s}},X=function(t,e){for(;E.test(t[e.index]);)e.index++;for(var a=[B(t,e)],s=!1;e.index<e.length;){var f=t[e.index];E.test(f)?e.index++:f===","?(s=!0,e.index++):s?(s=!1,a.push(B(t,e))):b(t,e.index)}return a},k=function(t,e){e.index<e.length&&b(t,e.index)};function ee(t){var e={length:t.length,index:0},a=X(t,e);return k(t,e),a}var te=function(t,e){var a=t;return e.forEach(function(s){a=typeof a!="object"||a===null?void 0:a[s]}),a};A.getDataOnPath=te});var H=_(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0}),m.create=re,m.unwrap=ne;var z=function(t,e,a){if(typeof t!="object"||t===null)return t;var s={get:function(f,i){if(i==="__rawObject__")return t;var r=a.concat(i),n=t[i];return e.push({path:r,value:n}),z(n,e,r)}};return new Proxy(t,s)};function re(t,e){return z(t,e,[])}function ne(t){return typeof t!="object"||t===null||typeof t.__rawObject__!="object"?t:t.__rawObject__}});var K=_(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.behavior=void 0;var $,ae=G(S()),ie=G(V()),w=U(q()),j=U(H());function F(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function G(t){return t&&t.__esModule?t:{default:t}}function U(t){if(t&&t.__esModule)return t;var e={};if(t!=null){for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){var s=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,a):{};s.get||s.set?Object.defineProperty(e,a,s):e[a]=t[a]}}return e.default=t,e}var T=ae.default({proto:!0}),fe=0,oe=Behavior({lifetimes:{attached:function(){this.setData({_computedWatchInit:"attached"})},created:function(){this.setData({_computedWatchInit:"created"})}},definitionFilter:function(t){var e=t.computed,a=t.watch,s=[],f=fe++;s.push({fields:"_computedWatchInit",observer:function(){var i=this.data._computedWatchInit;if(i==="created"){var r={computedUpdaters:[],computedRelatedPathValues:{},watchCurVal:{}};this._computedWatchInfo||(this._computedWatchInfo={}),this._computedWatchInfo[f]=r,a&&Object.keys(a).forEach(function(u){var o=w.parseMultiDataPaths(u).map(function(p){var c=p.path,l=p.options,h=w.getDataOnPath(this.data,c);return l.deepCmp?T(h):h}.bind(this));r.watchCurVal[u]=o}.bind(this))}else if(i==="attached"){var n=this._computedWatchInfo[f];e&&Object.keys(e).forEach(function(u){var o=e[u],p=[],c=o(j.create(this.data,p)),l=p.map(function(d){var v=d.path;return{path:v,value:w.getDataOnPath(this.data,v)}}.bind(this));this.setData(F({},u,j.unwrap(c))),n.computedRelatedPathValues[u]=l;var h=function(){for(var d=n.computedRelatedPathValues[u],v=!1,D=0;D<d.length;D++){var P=d[D],Y=P.path;if(P.value!==w.getDataOnPath(this.data,Y)){v=!0;break}}if(!v)return!1;var g=[],J=o(j.create(this.data,g));return this.setData(F({},u,j.unwrap(J))),n.computedRelatedPathValues[u]=g,!0}.bind(this);n.computedUpdaters.push(h)}.bind(this))}}}),e&&s.push({fields:"**",observer:function(){if(this._computedWatchInfo){var i,r=this._computedWatchInfo[f];if(r)do i=r.computedUpdaters.some(function(n){return n.call(this)}.bind(this));while(i)}}}),a&&Object.keys(a).forEach(function(i){var r=w.parseMultiDataPaths(i);s.push({fields:i,observer:function(){if(this._computedWatchInfo){var n=this._computedWatchInfo[f];if(n){var u=n.watchCurVal[i],o=r.map(function(h){var d=h.path,v=h.options;return{val:w.getDataOnPath(this.data,d),options:v}}.bind(this)),p=o.map(function(h){var d=h.val;return h.options.deepCmp?T(d):d});n.watchCurVal[i]=p;for(var c=!1,l=0;l<p.length;l++)if(r[l].options.deepCmp?!ie.default(u[l],p[l]):u[l]!==p[l]){c=!0;break}c&&a[i].apply(this,o.map(function(h){return h.val}))}}}})}),typeof t.observers!="object"&&(t.observers={}),Array.isArray(t.observers)?($=t.observers).push.apply($,s):s.forEach(function(i){var r=t.observers[i.fields];r?t.observers[i.fields]=function(){i.observer.call(this),r.call(this)}:t.observers[i.fields]=i.observer})}});x.behavior=oe});"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"behavior",{enumerable:!0,get:function(){return O.behavior}}),exports.ComponentWithComputed=se,exports.BehaviorWithComputed=ue;var O=K();function se(t){return Array.isArray(t.behaviors)||(t.behaviors=[]),t.behaviors.unshift(O.behavior),Component(t)}function ue(t){return Array.isArray(t.behaviors)||(t.behaviors=[]),t.behaviors.unshift(O.behavior),Behavior(t)}
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';
var replace = String.prototype.replace;
var percentTwenties = /%20/g;
module.exports = {
'default': 'RFC3986',
formatters: {
RFC1738: function (value) {
return replace.call(value, percentTwenties, '+');
},
RFC3986: function (value) {
return value;
}
},
RFC1738: 'RFC1738',
RFC3986: 'RFC3986'
};
},{}],2:[function(require,module,exports){
'use strict';
var stringify = require('./stringify');
var parse = require('./parse');
var formats = require('./formats');
module.exports = {
formats: formats,
parse: parse,
stringify: stringify
};
},{"./formats":1,"./parse":3,"./stringify":4}],3:[function(require,module,exports){
'use strict';
var utils = require('./utils');
var has = Object.prototype.hasOwnProperty;
var defaults = {
allowDots: false,
allowPrototypes: false,
arrayLimit: 20,
decoder: utils.decode,
delimiter: '&',
depth: 5,
parameterLimit: 1000,
plainObjects: false,
strictNullHandling: false
};
var parseValues = function parseQueryStringValues(str, options) {
var obj = {};
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
var parts = cleanStr.split(options.delimiter, limit);
for (var i = 0; i < parts.length; ++i) {
var part = parts[i];
var bracketEqualsPos = part.indexOf(']=');
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
var key, val;
if (pos === -1) {
key = options.decoder(part, defaults.decoder);
val = options.strictNullHandling ? null : '';
} else {
key = options.decoder(part.slice(0, pos), defaults.decoder);
val = options.decoder(part.slice(pos + 1), defaults.decoder);
}
if (has.call(obj, key)) {
obj[key] = [].concat(obj[key]).concat(val);
} else {
obj[key] = val;
}
}
return obj;
};
var parseObject = function (chain, val, options) {
var leaf = val;
for (var i = chain.length - 1; i >= 0; --i) {
var obj;
var root = chain[i];
if (root === '[]') {
obj = [];
obj = obj.concat(leaf);
} else {
obj = options.plainObjects ? Object.create(null) : {};
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
var index = parseInt(cleanRoot, 10);
if (
!isNaN(index)
&& root !== cleanRoot
&& String(index) === cleanRoot
&& index >= 0
&& (options.parseArrays && index <= options.arrayLimit)
) {
obj = [];
obj[index] = leaf;
} else {
obj[cleanRoot] = leaf;
}
}
leaf = obj;
}
return leaf;
};
var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
if (!givenKey) {
return;
}
// Transform dot notation to bracket notation
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
// The regex chunks
var brackets = /(\[[^[\]]*])/;
var child = /(\[[^[\]]*])/g;
// Get the parent
var segment = brackets.exec(key);
var parent = segment ? key.slice(0, segment.index) : key;
// Stash the parent if it exists
var keys = [];
if (parent) {
// If we aren't using plain objects, optionally prefix keys
// that would overwrite object prototype properties
if (!options.plainObjects && has.call(Object.prototype, parent)) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(parent);
}
// Loop through children appending to the array until we hit depth
var i = 0;
while ((segment = child.exec(key)) !== null && i < options.depth) {
i += 1;
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(segment[1]);
}
// If there's a remainder, just add whatever is left
if (segment) {
keys.push('[' + key.slice(segment.index) + ']');
}
return parseObject(keys, val, options);
};
module.exports = function (str, opts) {
var options = opts ? utils.assign({}, opts) : {};
if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {
throw new TypeError('Decoder has to be a function.');
}
options.ignoreQueryPrefix = options.ignoreQueryPrefix === true;
options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;
options.parseArrays = options.parseArrays !== false;
options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;
options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;
options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;
options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;
options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
if (str === '' || str === null || typeof str === 'undefined') {
return options.plainObjects ? Object.create(null) : {};
}
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
var obj = options.plainObjects ? Object.create(null) : {};
// Iterate over the keys and setup the new object
var keys = Object.keys(tempObj);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options);
obj = utils.merge(obj, newObj, options);
}
return utils.compact(obj);
};
},{"./utils":5}],4:[function(require,module,exports){
'use strict';
var utils = require('./utils');
var formats = require('./formats');
var arrayPrefixGenerators = {
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
return prefix + '[]';
},
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
return prefix + '[' + key + ']';
},
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
return prefix;
}
};
var toISO = Date.prototype.toISOString;
var defaults = {
delimiter: '&',
encode: true,
encoder: utils.encode,
encodeValuesOnly: false,
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
return toISO.call(date);
},
skipNulls: false,
strictNullHandling: false
};
var stringify = function stringify( // eslint-disable-line func-name-matching
object,
prefix,
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
) {
var obj = object;
if (typeof filter === 'function') {
obj = filter(prefix, obj);
} else if (obj instanceof Date) {
obj = serializeDate(obj);
} else if (obj === null) {
if (strictNullHandling) {
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix;
}
obj = '';
}
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
if (encoder) {
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder);
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))];
}
return [formatter(prefix) + '=' + formatter(String(obj))];
}
var values = [];
if (typeof obj === 'undefined') {
return values;
}
var objKeys;
if (Array.isArray(filter)) {
objKeys = filter;
} else {
var keys = Object.keys(obj);
objKeys = sort ? keys.sort(sort) : keys;
}
for (var i = 0; i < objKeys.length; ++i) {
var key = objKeys[i];
if (skipNulls && obj[key] === null) {
continue;
}
if (Array.isArray(obj)) {
values = values.concat(stringify(
obj[key],
generateArrayPrefix(prefix, key),
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
} else {
values = values.concat(stringify(
obj[key],
prefix + (allowDots ? '.' + key : '[' + key + ']'),
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
}
}
return values;
};
module.exports = function (object, opts) {
var obj = object;
var options = opts ? utils.assign({}, opts) : {};
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
throw new TypeError('Encoder has to be a function.');
}
var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;
var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;
var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;
var sort = typeof options.sort === 'function' ? options.sort : null;
var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;
if (typeof options.format === 'undefined') {
options.format = formats['default'];
} else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
throw new TypeError('Unknown format option provided.');
}
var formatter = formats.formatters[options.format];
var objKeys;
var filter;
if (typeof options.filter === 'function') {
filter = options.filter;
obj = filter('', obj);
} else if (Array.isArray(options.filter)) {
filter = options.filter;
objKeys = filter;
}
var keys = [];
if (typeof obj !== 'object' || obj === null) {
return '';
}
var arrayFormat;
if (options.arrayFormat in arrayPrefixGenerators) {
arrayFormat = options.arrayFormat;
} else if ('indices' in options) {
arrayFormat = options.indices ? 'indices' : 'repeat';
} else {
arrayFormat = 'indices';
}
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
if (!objKeys) {
objKeys = Object.keys(obj);
}
if (sort) {
objKeys.sort(sort);
}
for (var i = 0; i < objKeys.length; ++i) {
var key = objKeys[i];
if (skipNulls && obj[key] === null) {
continue;
}
keys = keys.concat(stringify(
obj[key],
key,
generateArrayPrefix,
strictNullHandling,
skipNulls,
encode ? encoder : null,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
}
var joined = keys.join(delimiter);
var prefix = options.addQueryPrefix === true ? '?' : '';
return joined.length > 0 ? prefix + joined : '';
};
},{"./formats":1,"./utils":5}],5:[function(require,module,exports){
'use strict';
var has = Object.prototype.hasOwnProperty;
var hexTable = (function () {
var array = [];
for (var i = 0; i < 256; ++i) {
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
}
return array;
}());
var compactQueue = function compactQueue(queue) {
var obj;
while (queue.length) {
var item = queue.pop();
obj = item.obj[item.prop];
if (Array.isArray(obj)) {
var compacted = [];
for (var j = 0; j < obj.length; ++j) {
if (typeof obj[j] !== 'undefined') {
compacted.push(obj[j]);
}
}
item.obj[item.prop] = compacted;
}
}
return obj;
};
var arrayToObject = function arrayToObject(source, options) {
var obj = options && options.plainObjects ? Object.create(null) : {};
for (var i = 0; i < source.length; ++i) {
if (typeof source[i] !== 'undefined') {
obj[i] = source[i];
}
}
return obj;
};
var merge = function merge(target, source, options) {
if (!source) {
return target;
}
if (typeof source !== 'object') {
if (Array.isArray(target)) {
target.push(source);
} else if (typeof target === 'object') {
if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
target[source] = true;
}
} else {
return [target, source];
}
return target;
}
if (typeof target !== 'object') {
return [target].concat(source);
}
var mergeTarget = target;
if (Array.isArray(target) && !Array.isArray(source)) {
mergeTarget = arrayToObject(target, options);
}
if (Array.isArray(target) && Array.isArray(source)) {
source.forEach(function (item, i) {
if (has.call(target, i)) {
if (target[i] && typeof target[i] === 'object') {
target[i] = merge(target[i], item, options);
} else {
target.push(item);
}
} else {
target[i] = item;
}
});
return target;
}
return Object.keys(source).reduce(function (acc, key) {
var value = source[key];
if (has.call(acc, key)) {
acc[key] = merge(acc[key], value, options);
} else {
acc[key] = value;
}
return acc;
}, mergeTarget);
};
var assign = function assignSingleSource(target, source) {
return Object.keys(source).reduce(function (acc, key) {
acc[key] = source[key];
return acc;
}, target);
};
var decode = function (str) {
try {
return decodeURIComponent(str.replace(/\+/g, ' '));
} catch (e) {
return str;
}
};
var encode = function encode(str) {
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
// It has been adapted here for stricter adherence to RFC 3986
if (str.length === 0) {
return str;
}
var string = typeof str === 'string' ? str : String(str);
var out = '';
for (var i = 0; i < string.length; ++i) {
var c = string.charCodeAt(i);
if (
c === 0x2D // -
|| c === 0x2E // .
|| c === 0x5F // _
|| c === 0x7E // ~
|| (c >= 0x30 && c <= 0x39) // 0-9
|| (c >= 0x41 && c <= 0x5A) // a-z
|| (c >= 0x61 && c <= 0x7A) // A-Z
) {
out += string.charAt(i);
continue;
}
if (c < 0x80) {
out = out + hexTable[c];
continue;
}
if (c < 0x800) {
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
continue;
}
if (c < 0xD800 || c >= 0xE000) {
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
continue;
}
i += 1;
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
out += hexTable[0xF0 | (c >> 18)]
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
+ hexTable[0x80 | (c & 0x3F)];
}
return out;
};
var compact = function compact(value) {
var queue = [{ obj: { o: value }, prop: 'o' }];
var refs = [];
for (var i = 0; i < queue.length; ++i) {
var item = queue[i];
var obj = item.obj[item.prop];
var keys = Object.keys(obj);
for (var j = 0; j < keys.length; ++j) {
var key = keys[j];
var val = obj[key];
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
queue.push({ obj: obj, prop: key });
refs.push(val);
}
}
}
return compactQueue(queue);
};
var isRegExp = function isRegExp(obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
};
var isBuffer = function isBuffer(obj) {
if (obj === null || typeof obj === 'undefined') {
return false;
}
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
};
module.exports = {
arrayToObject: arrayToObject,
assign: assign,
compact: compact,
decode: decode,
encode: encode,
isBuffer: isBuffer,
isRegExp: isRegExp,
merge: merge
};
},{}]},{},[2])(2)
});
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=38)}([function(t,e,n){"use strict";n.r(e),n.d(e,"__extends",(function(){return i})),n.d(e,"__assign",(function(){return o})),n.d(e,"__rest",(function(){return a})),n.d(e,"__decorate",(function(){return s})),n.d(e,"__param",(function(){return u})),n.d(e,"__metadata",(function(){return c})),n.d(e,"__awaiter",(function(){return f})),n.d(e,"__generator",(function(){return d})),n.d(e,"__createBinding",(function(){return p})),n.d(e,"__exportStar",(function(){return l})),n.d(e,"__values",(function(){return h})),n.d(e,"__read",(function(){return _})),n.d(e,"__spread",(function(){return v})),n.d(e,"__spreadArrays",(function(){return g})),n.d(e,"__await",(function(){return b})),n.d(e,"__asyncGenerator",(function(){return y})),n.d(e,"__asyncDelegator",(function(){return m})),n.d(e,"__asyncValues",(function(){return O})),n.d(e,"__makeTemplateObject",(function(){return j})),n.d(e,"__importStar",(function(){return E})),n.d(e,"__importDefault",(function(){return S})),n.d(e,"__classPrivateFieldGet",(function(){return w})),n.d(e,"__classPrivateFieldSet",(function(){return x}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var r=function(t,e){return(r=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])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function a(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function s(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}function u(t,e){return function(n,r){e(n,r,t)}}function c(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function f(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function d(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function p(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}function l(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||(e[n]=t[n])}function h(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function v(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(_(arguments[e]));return t}function g(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function b(t){return this instanceof b?(this.v=t,this):new b(t)}function y(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||s(t,e)}))})}function s(t,e){try{(n=i[t](e)).value instanceof b?Promise.resolve(n.value.v).then(u,c):f(o[0][2],n)}catch(t){f(o[0][3],t)}var n}function u(t){s("next",t)}function c(t){s("throw",t)}function f(t,e){t(e),o.shift(),o.length&&s(o[0][0],o[0][1])}}function m(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,i){e[r]=t[r]?function(e){return(n=!n)?{value:b(t[r](e)),done:"return"===r}:i?i(e):e}:i}}function O(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=h(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}}function j(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function E(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function S(t){return t&&t.__esModule?t:{default:t}}function w(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function x(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}},function(t,e,n){"use strict";n.d(e,"d",(function(){return i})),n.d(e,"e",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return u})),n.d(e,"l",(function(){return c})),n.d(e,"j",(function(){return f})),n.d(e,"i",(function(){return d})),n.d(e,"f",(function(){return p})),n.d(e,"c",(function(){return l})),n.d(e,"k",(function(){return h})),n.d(e,"n",(function(){return _})),n.d(e,"m",(function(){return v})),n.d(e,"h",(function(){return g})),n.d(e,"g",(function(){return b}));var r=Object.prototype.toString;function i(t){switch(r.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return b(t,Error)}}function o(t,e){return r.call(t)==="[object "+e+"]"}function a(t){return o(t,"ErrorEvent")}function s(t){return o(t,"DOMError")}function u(t){return o(t,"DOMException")}function c(t){return o(t,"String")}function f(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function d(t){return o(t,"Object")}function p(t){return"undefined"!=typeof Event&&b(t,Event)}function l(t){return"undefined"!=typeof Element&&b(t,Element)}function h(t){return o(t,"RegExp")}function _(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function v(t){return d(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function g(t){return"number"==typeof t&&t!=t}function b(t,e){try{return t instanceof e}catch(t){return!1}}},function(t,e,n){"use strict";function r(t){t.then(null,(function(t){console.error(t)}))}n.r(e),n.d(e,"forget",(function(){return r})),n.d(e,"htmlTreeAsString",(function(){return i.b})),n.d(e,"getLocationHref",(function(){return i.a})),n.d(e,"dsnToString",(function(){return o.a})),n.d(e,"makeDsn",(function(){return o.b})),n.d(e,"SeverityLevels",(function(){return a})),n.d(e,"SentryError",(function(){return s.a})),n.d(e,"getGlobalObject",(function(){return u.a})),n.d(e,"getGlobalSingleton",(function(){return u.b})),n.d(e,"addInstrumentationHandler",(function(){return P})),n.d(e,"isError",(function(){return d.d})),n.d(e,"isErrorEvent",(function(){return d.e})),n.d(e,"isDOMError",(function(){return d.a})),n.d(e,"isDOMException",(function(){return d.b})),n.d(e,"isString",(function(){return d.l})),n.d(e,"isPrimitive",(function(){return d.j})),n.d(e,"isPlainObject",(function(){return d.i})),n.d(e,"isEvent",(function(){return d.f})),n.d(e,"isElement",(function(){return d.c})),n.d(e,"isRegExp",(function(){return d.k})),n.d(e,"isThenable",(function(){return d.n})),n.d(e,"isSyntheticEvent",(function(){return d.m})),n.d(e,"isNaN",(function(){return d.h})),n.d(e,"isInstanceOf",(function(){return d.g})),n.d(e,"CONSOLE_LEVELS",(function(){return p.a})),n.d(e,"consoleSandbox",(function(){return p.b})),n.d(e,"logger",(function(){return p.c})),n.d(e,"memoBuilder",(function(){return F.a})),n.d(e,"uuid4",(function(){return L.i})),n.d(e,"parseUrl",(function(){return L.g})),n.d(e,"getEventDescription",(function(){return L.e})),n.d(e,"addExceptionTypeValue",(function(){return L.c})),n.d(e,"addExceptionMechanism",(function(){return L.b})),n.d(e,"parseSemver",(function(){return L.f})),n.d(e,"addContextToFrame",(function(){return L.a})),n.d(e,"stripUrlQueryAndFragment",(function(){return L.h})),n.d(e,"checkOrSetAlreadyCaught",(function(){return L.d})),n.d(e,"isNodeEnv",(function(){return U.b})),n.d(e,"dynamicRequire",(function(){return U.a})),n.d(e,"loadModule",(function(){return U.c})),n.d(e,"normalize",(function(){return B.a})),n.d(e,"normalizeToSize",(function(){return B.b})),n.d(e,"walk",(function(){return B.c})),n.d(e,"fill",(function(){return l.e})),n.d(e,"addNonEnumerableProperty",(function(){return l.a})),n.d(e,"markFunctionWrapped",(function(){return l.g})),n.d(e,"getOriginalFunction",(function(){return l.f})),n.d(e,"urlEncode",(function(){return l.i})),n.d(e,"convertToPlainObject",(function(){return l.b})),n.d(e,"extractExceptionKeysForMessage",(function(){return l.d})),n.d(e,"dropUndefinedKeys",(function(){return l.c})),n.d(e,"objectify",(function(){return l.h})),n.d(e,"resolve",(function(){return W})),n.d(e,"relative",(function(){return Y})),n.d(e,"normalizePath",(function(){return V})),n.d(e,"isAbsolute",(function(){return J})),n.d(e,"join",(function(){return $})),n.d(e,"dirname",(function(){return X})),n.d(e,"basename",(function(){return Z})),n.d(e,"makePromiseBuffer",(function(){return Q.a})),n.d(e,"severityFromString",(function(){return et})),n.d(e,"createStackParser",(function(){return h.a})),n.d(e,"stripSentryFramesAndReverse",(function(){return h.c})),n.d(e,"getFunctionName",(function(){return h.b})),n.d(e,"eventStatusFromHttpCode",(function(){return nt.a})),n.d(e,"truncate",(function(){return rt.e})),n.d(e,"snipLine",(function(){return rt.d})),n.d(e,"safeJoin",(function(){return rt.c})),n.d(e,"isMatchingPattern",(function(){return rt.b})),n.d(e,"escapeStringForRegex",(function(){return rt.a})),n.d(e,"supportsErrorEvent",(function(){return _})),n.d(e,"supportsDOMError",(function(){return v})),n.d(e,"supportsDOMException",(function(){return g})),n.d(e,"supportsFetch",(function(){return b})),n.d(e,"isNativeFetch",(function(){return y})),n.d(e,"supportsNativeFetch",(function(){return m})),n.d(e,"supportsReportingObserver",(function(){return O})),n.d(e,"supportsReferrerPolicy",(function(){return j})),n.d(e,"supportsHistory",(function(){return E})),n.d(e,"resolvedSyncPromise",(function(){return it.c})),n.d(e,"rejectedSyncPromise",(function(){return it.b})),n.d(e,"SyncPromise",(function(){return it.a})),n.d(e,"dateTimestampInSeconds",(function(){return ot.c})),n.d(e,"timestampInSeconds",(function(){return ot.d})),n.d(e,"timestampWithMs",(function(){return ot.e})),n.d(e,"usingPerformanceAPI",(function(){return ot.f})),n.d(e,"_browserPerformanceTimeOriginMode",(function(){return ot.a})),n.d(e,"browserPerformanceTimeOrigin",(function(){return ot.b})),n.d(e,"TRACEPARENT_REGEXP",(function(){return at})),n.d(e,"extractTraceparentData",(function(){return st})),n.d(e,"isBrowserBundle",(function(){return ut.a})),n.d(e,"createEnvelope",(function(){return ct.b})),n.d(e,"addItemToEnvelope",(function(){return ct.a})),n.d(e,"getEnvelopeType",(function(){return ct.c})),n.d(e,"serializeEnvelope",(function(){return ct.d})),n.d(e,"createClientReportEnvelope",(function(){return ft})),n.d(e,"DEFAULT_RETRY_AFTER",(function(){return dt.a})),n.d(e,"parseRetryAfterHeader",(function(){return dt.d})),n.d(e,"disabledUntil",(function(){return dt.b})),n.d(e,"isRateLimited",(function(){return dt.c})),n.d(e,"updateRateLimits",(function(){return dt.e}));var i=n(18),o=n(26),a=["fatal","error","warning","log","info","debug","critical"],s=n(7),u=n(3),c=n(0),f=n(6),d=n(1),p=n(9),l=n(4),h=n(11);function _(){try{return new ErrorEvent(""),!0}catch(t){return!1}}function v(){try{return new DOMError(""),!0}catch(t){return!1}}function g(){try{return new DOMException(""),!0}catch(t){return!1}}function b(){if(!("fetch"in Object(u.a)()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(t){return!1}}function y(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function m(){if(!b())return!1;var t=Object(u.a)();if(y(t.fetch))return!0;var e=!1,n=t.document;if(n&&"function"==typeof n.createElement)try{var r=n.createElement("iframe");r.hidden=!0,n.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(e=y(r.contentWindow.fetch)),n.head.removeChild(r)}catch(t){f.a&&p.c.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return e}function O(){return"ReportingObserver"in Object(u.a)()}function j(){if(!b())return!1;try{return new Request("_",{referrerPolicy:"origin"}),!0}catch(t){return!1}}function E(){var t=Object(u.a)(),e=t.chrome,n=e&&e.app&&e.app.runtime,r="history"in t&&!!t.history.pushState&&!!t.history.replaceState;return!n&&r}var S,w=Object(u.a)(),x={},k={};function T(t){if(!k[t])switch(k[t]=!0,t){case"console":!function(){if(!("console"in w))return;p.a.forEach((function(t){t in w.console&&Object(l.e)(w.console,t,(function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];M("console",{args:n,level:t}),e&&e.apply(w.console,n)}}))}))}();break;case"dom":!function(){if(!("document"in w))return;var t=M.bind(null,"dom"),e=C(t,!0);w.document.addEventListener("click",e,!1),w.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach((function(e){var n=w[e]&&w[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(Object(l.e)(n,"addEventListener",(function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{var o=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},a=o[n]=o[n]||{refCount:0};if(!a.handler){var s=C(t);a.handler=s,e.call(this,n,s,i)}a.refCount+=1}catch(t){}return e.call(this,n,r,i)}})),Object(l.e)(n,"removeEventListener",(function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{var i=this.__sentry_instrumentation_handlers__||{},o=i[e];o&&(o.refCount-=1,o.refCount<=0&&(t.call(this,e,o.handler,r),o.handler=void 0,delete i[e]),0===Object.keys(i).length&&delete this.__sentry_instrumentation_handlers__)}catch(t){}return t.call(this,e,n,r)}})))}))}();break;case"xhr":!function(){if(!("XMLHttpRequest"in w))return;var t=XMLHttpRequest.prototype;Object(l.e)(t,"open",(function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=this,i=e[1],o=r.__sentry_xhr__={method:Object(d.l)(e[0])?e[0].toUpperCase():e[0],url:e[1]};Object(d.l)(i)&&"POST"===o.method&&i.match(/sentry_key/)&&(r.__sentry_own_request__=!0);var a=function(){if(4===r.readyState){try{o.status_code=r.status}catch(t){}M("xhr",{args:e,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:r})}};return"onreadystatechange"in r&&"function"==typeof r.onreadystatechange?Object(l.e)(r,"onreadystatechange",(function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return a(),t.apply(r,e)}})):r.addEventListener("readystatechange",a),t.apply(r,e)}})),Object(l.e)(t,"send",(function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this.__sentry_xhr__&&void 0!==e[0]&&(this.__sentry_xhr__.body=e[0]),M("xhr",{args:e,startTimestamp:Date.now(),xhr:this}),t.apply(this,e)}}))}();break;case"fetch":!function(){if(!m())return;Object(l.e)(w,"fetch",(function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r={args:e,fetchData:{method:I(e),url:N(e)},startTimestamp:Date.now()};return M("fetch",Object(c.__assign)({},r)),t.apply(w,e).then((function(t){return M("fetch",Object(c.__assign)(Object(c.__assign)({},r),{endTimestamp:Date.now(),response:t})),t}),(function(t){throw M("fetch",Object(c.__assign)(Object(c.__assign)({},r),{endTimestamp:Date.now(),error:t})),t}))}}))}();break;case"history":!function(){if(!E())return;var t=w.onpopstate;function e(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e.length>2?e[2]:void 0;if(r){var i=S,o=String(r);S=o,M("history",{from:i,to:o})}return t.apply(this,e)}}w.onpopstate=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=w.location.href,i=S;if(S=r,M("history",{from:i,to:r}),t)try{return t.apply(this,e)}catch(t){}},Object(l.e)(w.history,"pushState",e),Object(l.e)(w.history,"replaceState",e)}();break;case"error":A=w.onerror,w.onerror=function(t,e,n,r,i){return M("error",{column:r,error:i,line:n,msg:t,url:e}),!!A&&A.apply(this,arguments)};break;case"unhandledrejection":H=w.onunhandledrejection,w.onunhandledrejection=function(t){return M("unhandledrejection",t),!H||H.apply(this,arguments)};break;default:return void(f.a&&p.c.warn("unknown instrumentation type:",t))}}function P(t,e){x[t]=x[t]||[],x[t].push(e),T(t)}function M(t,e){var n,r;if(t&&x[t])try{for(var i=Object(c.__values)(x[t]||[]),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(e)}catch(e){f.a&&p.c.error("Error while triggering instrumentation handler.\nType: "+t+"\nName: "+Object(h.b)(a)+"\nError:",e)}}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}function I(t){return void 0===t&&(t=[]),"Request"in w&&Object(d.g)(t[0],Request)&&t[0].method?String(t[0].method).toUpperCase():t[1]&&t[1].method?String(t[1].method).toUpperCase():"GET"}function N(t){return void 0===t&&(t=[]),"string"==typeof t[0]?t[0]:"Request"in w&&Object(d.g)(t[0],Request)?t[0].url:String(t[0])}var R,D;function C(t,e){return void 0===e&&(e=!1),function(n){if(n&&D!==n&&!function(t){if("keypress"!==t.type)return!1;try{var e=t.target;if(!e||!e.tagName)return!0;if("INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable)return!1}catch(t){}return!0}(n)){var r="keypress"===n.type?"input":n.type;(void 0===R||function(t,e){if(!t)return!0;if(t.type!==e.type)return!0;try{if(t.target!==e.target)return!0}catch(t){}return!1}(D,n))&&(t({event:n,name:r,global:e}),D=n),clearTimeout(R),R=w.setTimeout((function(){R=void 0}),1e3)}}}var A=null;var H=null;var F=n(19),L=n(25),U=n(10),B=n(27);function q(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var G=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;function z(t){var e=G.exec(t);return e?e.slice(1):[]}function W(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n="",r=!1,i=t.length-1;i>=-1&&!r;i--){var o=i>=0?t[i]:"/";o&&(n=o+"/"+n,r="/"===o.charAt(0))}return(r?"/":"")+(n=q(n.split("/").filter((function(t){return!!t})),!r).join("/"))||"."}function K(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}function Y(t,e){t=W(t).substr(1),e=W(e).substr(1);for(var n=K(t.split("/")),r=K(e.split("/")),i=Math.min(n.length,r.length),o=i,a=0;a<i;a++)if(n[a]!==r[a]){o=a;break}var s=[];for(a=o;a<n.length;a++)s.push("..");return(s=s.concat(r.slice(o))).join("/")}function V(t){var e=J(t),n="/"===t.substr(-1),r=q(t.split("/").filter((function(t){return!!t})),!e).join("/");return r||e||(r="."),r&&n&&(r+="/"),(e?"/":"")+r}function J(t){return"/"===t.charAt(0)}function $(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return V(t.join("/"))}function X(t){var e=z(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function Z(t,e){var n=z(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n}var Q=n(28),tt=n(14);function et(t){return"warn"===t?tt.a.Warning:function(t){return-1!==a.indexOf(t)}(t)?t:tt.a.Log}var nt=n(30),rt=n(8),it=n(12),ot=n(16),at=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function st(t){var e=t.match(at);if(e){var n=void 0;return"1"===e[3]?n=!0:"0"===e[3]&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}}var ut=n(17),ct=n(20);function ft(t,e,n){var r=[{type:"client_report"},{timestamp:n||Object(ot.c)(),discarded_events:t}];return Object(ct.b)(e?{dsn:e}:{},[r])}var dt=n(29)},function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));var r=n(10),i={};function o(){return Object(r.b)()?t:"undefined"!=typeof window?window:"undefined"!=typeof self?self:i}function a(t,e,n){var r=n||o(),i=r.__SENTRY__=r.__SENTRY__||{};return i[t]||(i[t]=e())}}).call(this,n(24))},function(t,e,n){"use strict";n.d(e,"e",(function(){return s})),n.d(e,"a",(function(){return u})),n.d(e,"g",(function(){return c})),n.d(e,"f",(function(){return f})),n.d(e,"i",(function(){return d})),n.d(e,"b",(function(){return p})),n.d(e,"d",(function(){return _})),n.d(e,"c",(function(){return v})),n.d(e,"h",(function(){return g}));var r=n(0),i=n(18),o=n(1),a=n(8);function s(t,e,n){if(e in t){var r=t[e],i=n(r);if("function"==typeof i)try{c(i,r)}catch(t){}t[e]=i}}function u(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}function c(t,e){var n=e.prototype||{};t.prototype=e.prototype=n,u(t,"__sentry_original__",e)}function f(t){return t.__sentry_original__}function d(t){return Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&")}function p(t){var e=t;if(Object(o.d)(t))e=Object(r.__assign)({message:t.message,name:t.name,stack:t.stack},h(t));else if(Object(o.f)(t)){var n=t;e=Object(r.__assign)({type:n.type,target:l(n.target),currentTarget:l(n.currentTarget)},h(n)),"undefined"!=typeof CustomEvent&&Object(o.g)(t,CustomEvent)&&(e.detail=n.detail)}return e}function l(t){try{return Object(o.c)(t)?Object(i.b)(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}}function h(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function _(t,e){void 0===e&&(e=40);var n=Object.keys(p(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return Object(a.e)(n[0],e);for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>e))return r===n.length?i:Object(a.e)(i,e)}return""}function v(t){var e,n;if(Object(o.i)(t)){var i={};try{for(var a=Object(r.__values)(Object.keys(t)),s=a.next();!s.done;s=a.next()){var u=s.value;void 0!==t[u]&&(i[u]=v(t[u]))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return i}return Array.isArray(t)?t.map(v):t}function g(t){var e;switch(!0){case null==t:e=new String(t);break;case"symbol"==typeof t||"bigint"==typeof t:e=Object(t);break;case Object(o.j)(t):e=new t.constructor(t);break;default:e=t}return e}},function(t,e,n){"use strict";n.r(e),n.d(e,"addBreadcrumb",(function(){return M})),n.d(e,"captureException",(function(){return x})),n.d(e,"captureEvent",(function(){return T})),n.d(e,"captureMessage",(function(){return k})),n.d(e,"configureScope",(function(){return P})),n.d(e,"startTransaction",(function(){return F})),n.d(e,"setContext",(function(){return I})),n.d(e,"setExtra",(function(){return D})),n.d(e,"setExtras",(function(){return N})),n.d(e,"setTag",(function(){return C})),n.d(e,"setTags",(function(){return R})),n.d(e,"setUser",(function(){return A})),n.d(e,"withScope",(function(){return H})),n.d(e,"addGlobalEventProcessor",(function(){return _})),n.d(e,"getCurrentHub",(function(){return O})),n.d(e,"getHubFromCarrier",(function(){return E})),n.d(e,"Hub",(function(){return b})),n.d(e,"makeMain",(function(){return m})),n.d(e,"Scope",(function(){return l})),n.d(e,"Session",(function(){return g})),n.d(e,"API",(function(){return U})),n.d(e,"getEnvelopeEndpointWithUrlEncodedAuth",(function(){return Y})),n.d(e,"getStoreEndpointWithUrlEncodedAuth",(function(){return K})),n.d(e,"getRequestHeaders",(function(){return V})),n.d(e,"initAPIDetails",(function(){return B})),n.d(e,"getReportDialogEndpoint",(function(){return J})),n.d(e,"BaseClient",(function(){return it})),n.d(e,"BaseBackend",(function(){return pt})),n.d(e,"eventToSentryRequest",(function(){return ft})),n.d(e,"sessionToSentryRequest",(function(){return ct})),n.d(e,"initAndBind",(function(){return lt})),n.d(e,"NoopTransport",(function(){return dt})),n.d(e,"createTransport",(function(){return gt})),n.d(e,"SDK_VERSION",(function(){return mt})),n.d(e,"Integrations",(function(){return r}));var r={};n.r(r),n.d(r,"FunctionToString",(function(){return Ot})),n.d(r,"InboundFilters",(function(){return Et}));var i=n(0),o=n(25),a=n(16),s=n(9),u=n(3),c=n(10),f="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,d=n(1),p=n(12),l=function(){function t(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}return t.clone=function(e){var n=new t;return e&&(n._breadcrumbs=Object(i.__spread)(e._breadcrumbs),n._tags=Object(i.__assign)({},e._tags),n._extra=Object(i.__assign)({},e._extra),n._contexts=Object(i.__assign)({},e._contexts),n._user=e._user,n._level=e._level,n._span=e._span,n._session=e._session,n._transactionName=e._transactionName,n._fingerprint=e._fingerprint,n._eventProcessors=Object(i.__spread)(e._eventProcessors),n._requestSession=e._requestSession),n},t.prototype.addScopeListener=function(t){this._scopeListeners.push(t)},t.prototype.addEventProcessor=function(t){return this._eventProcessors.push(t),this},t.prototype.setUser=function(t){return this._user=t||{},this._session&&this._session.update({user:t}),this._notifyScopeListeners(),this},t.prototype.getUser=function(){return this._user},t.prototype.getRequestSession=function(){return this._requestSession},t.prototype.setRequestSession=function(t){return this._requestSession=t,this},t.prototype.setTags=function(t){return this._tags=Object(i.__assign)(Object(i.__assign)({},this._tags),t),this._notifyScopeListeners(),this},t.prototype.setTag=function(t,e){var n;return this._tags=Object(i.__assign)(Object(i.__assign)({},this._tags),((n={})[t]=e,n)),this._notifyScopeListeners(),this},t.prototype.setExtras=function(t){return this._extra=Object(i.__assign)(Object(i.__assign)({},this._extra),t),this._notifyScopeListeners(),this},t.prototype.setExtra=function(t,e){var n;return this._extra=Object(i.__assign)(Object(i.__assign)({},this._extra),((n={})[t]=e,n)),this._notifyScopeListeners(),this},t.prototype.setFingerprint=function(t){return this._fingerprint=t,this._notifyScopeListeners(),this},t.prototype.setLevel=function(t){return this._level=t,this._notifyScopeListeners(),this},t.prototype.setTransactionName=function(t){return this._transactionName=t,this._notifyScopeListeners(),this},t.prototype.setTransaction=function(t){return this.setTransactionName(t)},t.prototype.setContext=function(t,e){var n;return null===e?delete this._contexts[t]:this._contexts=Object(i.__assign)(Object(i.__assign)({},this._contexts),((n={})[t]=e,n)),this._notifyScopeListeners(),this},t.prototype.setSpan=function(t){return this._span=t,this._notifyScopeListeners(),this},t.prototype.getSpan=function(){return this._span},t.prototype.getTransaction=function(){var t=this.getSpan();return t&&t.transaction},t.prototype.setSession=function(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this},t.prototype.getSession=function(){return this._session},t.prototype.update=function(e){if(!e)return this;if("function"==typeof e){var n=e(this);return n instanceof t?n:this}return e instanceof t?(this._tags=Object(i.__assign)(Object(i.__assign)({},this._tags),e._tags),this._extra=Object(i.__assign)(Object(i.__assign)({},this._extra),e._extra),this._contexts=Object(i.__assign)(Object(i.__assign)({},this._contexts),e._contexts),e._user&&Object.keys(e._user).length&&(this._user=e._user),e._level&&(this._level=e._level),e._fingerprint&&(this._fingerprint=e._fingerprint),e._requestSession&&(this._requestSession=e._requestSession)):Object(d.i)(e)&&(e=e,this._tags=Object(i.__assign)(Object(i.__assign)({},this._tags),e.tags),this._extra=Object(i.__assign)(Object(i.__assign)({},this._extra),e.extra),this._contexts=Object(i.__assign)(Object(i.__assign)({},this._contexts),e.contexts),e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession)),this},t.prototype.clear=function(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this},t.prototype.addBreadcrumb=function(t,e){var n="number"==typeof e?Math.min(e,100):100;if(n<=0)return this;var r=Object(i.__assign)({timestamp:Object(a.c)()},t);return this._breadcrumbs=Object(i.__spread)(this._breadcrumbs,[r]).slice(-n),this._notifyScopeListeners(),this},t.prototype.clearBreadcrumbs=function(){return this._breadcrumbs=[],this._notifyScopeListeners(),this},t.prototype.applyToEvent=function(t,e){if(this._extra&&Object.keys(this._extra).length&&(t.extra=Object(i.__assign)(Object(i.__assign)({},this._extra),t.extra)),this._tags&&Object.keys(this._tags).length&&(t.tags=Object(i.__assign)(Object(i.__assign)({},this._tags),t.tags)),this._user&&Object.keys(this._user).length&&(t.user=Object(i.__assign)(Object(i.__assign)({},this._user),t.user)),this._contexts&&Object.keys(this._contexts).length&&(t.contexts=Object(i.__assign)(Object(i.__assign)({},this._contexts),t.contexts)),this._level&&(t.level=this._level),this._transactionName&&(t.transaction=this._transactionName),this._span){t.contexts=Object(i.__assign)({trace:this._span.getTraceContext()},t.contexts);var n=this._span.transaction&&this._span.transaction.name;n&&(t.tags=Object(i.__assign)({transaction:n},t.tags))}return this._applyFingerprint(t),t.breadcrumbs=Object(i.__spread)(t.breadcrumbs||[],this._breadcrumbs),t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,t.sdkProcessingMetadata=this._sdkProcessingMetadata,this._notifyEventProcessors(Object(i.__spread)(h(),this._eventProcessors),t,e)},t.prototype.setSDKProcessingMetadata=function(t){return this._sdkProcessingMetadata=Object(i.__assign)(Object(i.__assign)({},this._sdkProcessingMetadata),t),this},t.prototype._notifyEventProcessors=function(t,e,n,r){var o=this;return void 0===r&&(r=0),new p.a((function(a,s){var u=t[r];if(null===e||"function"!=typeof u)a(e);else{var c=u(Object(i.__assign)({},e),n);Object(d.n)(c)?c.then((function(e){return o._notifyEventProcessors(t,e,n,r+1).then(a)})).then(null,s):o._notifyEventProcessors(t,c,n,r+1).then(a).then(null,s)}}))},t.prototype._notifyScopeListeners=function(){var t=this;this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((function(e){e(t)})),this._notifyingListeners=!1)},t.prototype._applyFingerprint=function(t){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],this._fingerprint&&(t.fingerprint=t.fingerprint.concat(this._fingerprint)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint},t}();function h(){return Object(u.b)("globalEventProcessors",(function(){return[]}))}function _(t){h().push(t)}var v=n(4),g=function(){function t(t){this.errors=0,this.sid=Object(o.i)(),this.duration=0,this.status="ok",this.init=!0,this.ignoreDuration=!1;var e=Object(a.d)();this.timestamp=e,this.started=e,t&&this.update(t)}return t.prototype.update=function(t){if(void 0===t&&(t={}),t.user&&(!this.ipAddress&&t.user.ip_address&&(this.ipAddress=t.user.ip_address),this.did||t.did||(this.did=t.user.id||t.user.email||t.user.username)),this.timestamp=t.timestamp||Object(a.d)(),t.ignoreDuration&&(this.ignoreDuration=t.ignoreDuration),t.sid&&(this.sid=32===t.sid.length?t.sid:Object(o.i)()),void 0!==t.init&&(this.init=t.init),!this.did&&t.did&&(this.did=""+t.did),"number"==typeof t.started&&(this.started=t.started),this.ignoreDuration)this.duration=void 0;else if("number"==typeof t.duration)this.duration=t.duration;else{var e=this.timestamp-this.started;this.duration=e>=0?e:0}t.release&&(this.release=t.release),t.environment&&(this.environment=t.environment),!this.ipAddress&&t.ipAddress&&(this.ipAddress=t.ipAddress),!this.userAgent&&t.userAgent&&(this.userAgent=t.userAgent),"number"==typeof t.errors&&(this.errors=t.errors),t.status&&(this.status=t.status)},t.prototype.close=function(t){t?this.update({status:t}):"ok"===this.status?this.update({status:"exited"}):this.update()},t.prototype.toJSON=function(){return Object(v.c)({sid:""+this.sid,init:this.init,started:new Date(1e3*this.started).toISOString(),timestamp:new Date(1e3*this.timestamp).toISOString(),status:this.status,errors:this.errors,did:"number"==typeof this.did||"string"==typeof this.did?""+this.did:void 0,duration:this.duration,attrs:{release:this.release,environment:this.environment,ip_address:this.ipAddress,user_agent:this.userAgent}})},t}(),b=function(){function t(t,e,n){void 0===e&&(e=new l),void 0===n&&(n=4),this._version=n,this._stack=[{}],this.getStackTop().scope=e,t&&this.bindClient(t)}return t.prototype.isOlderThan=function(t){return this._version<t},t.prototype.bindClient=function(t){this.getStackTop().client=t,t&&t.setupIntegrations&&t.setupIntegrations()},t.prototype.pushScope=function(){var t=l.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:t}),t},t.prototype.popScope=function(){return!(this.getStack().length<=1)&&!!this.getStack().pop()},t.prototype.withScope=function(t){var e=this.pushScope();try{t(e)}finally{this.popScope()}},t.prototype.getClient=function(){return this.getStackTop().client},t.prototype.getScope=function(){return this.getStackTop().scope},t.prototype.getStack=function(){return this._stack},t.prototype.getStackTop=function(){return this._stack[this._stack.length-1]},t.prototype.captureException=function(t,e){var n=this._lastEventId=e&&e.event_id?e.event_id:Object(o.i)(),r=e;if(!e){var a=void 0;try{throw new Error("Sentry syntheticException")}catch(t){a=t}r={originalException:t,syntheticException:a}}return this._invokeClient("captureException",t,Object(i.__assign)(Object(i.__assign)({},r),{event_id:n})),n},t.prototype.captureMessage=function(t,e,n){var r=this._lastEventId=n&&n.event_id?n.event_id:Object(o.i)(),a=n;if(!n){var s=void 0;try{throw new Error(t)}catch(t){s=t}a={originalException:t,syntheticException:s}}return this._invokeClient("captureMessage",t,e,Object(i.__assign)(Object(i.__assign)({},a),{event_id:r})),r},t.prototype.captureEvent=function(t,e){var n=e&&e.event_id?e.event_id:Object(o.i)();return"transaction"!==t.type&&(this._lastEventId=n),this._invokeClient("captureEvent",t,Object(i.__assign)(Object(i.__assign)({},e),{event_id:n})),n},t.prototype.lastEventId=function(){return this._lastEventId},t.prototype.addBreadcrumb=function(t,e){var n=this.getStackTop(),r=n.scope,o=n.client;if(r&&o){var u=o.getOptions&&o.getOptions()||{},c=u.beforeBreadcrumb,f=void 0===c?null:c,d=u.maxBreadcrumbs,p=void 0===d?100:d;if(!(p<=0)){var l=Object(a.c)(),h=Object(i.__assign)({timestamp:l},t),_=f?Object(s.b)((function(){return f(h,e)})):h;null!==_&&r.addBreadcrumb(_,p)}}},t.prototype.setUser=function(t){var e=this.getScope();e&&e.setUser(t)},t.prototype.setTags=function(t){var e=this.getScope();e&&e.setTags(t)},t.prototype.setExtras=function(t){var e=this.getScope();e&&e.setExtras(t)},t.prototype.setTag=function(t,e){var n=this.getScope();n&&n.setTag(t,e)},t.prototype.setExtra=function(t,e){var n=this.getScope();n&&n.setExtra(t,e)},t.prototype.setContext=function(t,e){var n=this.getScope();n&&n.setContext(t,e)},t.prototype.configureScope=function(t){var e=this.getStackTop(),n=e.scope,r=e.client;n&&r&&t(n)},t.prototype.run=function(t){var e=m(this);try{t(this)}finally{m(e)}},t.prototype.getIntegration=function(t){var e=this.getClient();if(!e)return null;try{return e.getIntegration(t)}catch(e){return f&&s.c.warn("Cannot retrieve integration "+t.id+" from the current Hub"),null}},t.prototype.startSpan=function(t){return this._callExtensionMethod("startSpan",t)},t.prototype.startTransaction=function(t,e){return this._callExtensionMethod("startTransaction",t,e)},t.prototype.traceHeaders=function(){return this._callExtensionMethod("traceHeaders")},t.prototype.captureSession=function(t){if(void 0===t&&(t=!1),t)return this.endSession();this._sendSessionUpdate()},t.prototype.endSession=function(){var t=this.getStackTop(),e=t&&t.scope,n=e&&e.getSession();n&&n.close(),this._sendSessionUpdate(),e&&e.setSession()},t.prototype.startSession=function(t){var e=this.getStackTop(),n=e.scope,r=e.client,o=r&&r.getOptions()||{},a=o.release,s=o.environment,c=(Object(u.a)().navigator||{}).userAgent,f=new g(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({release:a,environment:s},n&&{user:n.getUser()}),c&&{userAgent:c}),t));if(n){var d=n.getSession&&n.getSession();d&&"ok"===d.status&&d.update({status:"exited"}),this.endSession(),n.setSession(f)}return f},t.prototype._sendSessionUpdate=function(){var t=this.getStackTop(),e=t.scope,n=t.client;if(e){var r=e.getSession&&e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}},t.prototype._invokeClient=function(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.getStackTop(),a=o.scope,s=o.client;s&&s[t]&&(e=s)[t].apply(e,Object(i.__spread)(n,[a]))},t.prototype._callExtensionMethod=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=y(),i=r.__SENTRY__;if(i&&i.extensions&&"function"==typeof i.extensions[t])return i.extensions[t].apply(this,e);f&&s.c.warn("Extension method "+t+" couldn't be found, doing nothing.")},t}();function y(){var t=Object(u.a)();return t.__SENTRY__=t.__SENTRY__||{extensions:{},hub:void 0},t}function m(t){var e=y(),n=E(e);return S(e,t),n}function O(){var t=y();return j(t)&&!E(t).isOlderThan(4)||S(t,new b),Object(c.b)()?function(t){try{var e=y().__SENTRY__,n=e&&e.extensions&&e.extensions.domain&&e.extensions.domain.active;if(!n)return E(t);if(!j(n)||E(n).isOlderThan(4)){var r=E(t).getStackTop();S(n,new b(r.client,l.clone(r.scope)))}return E(n)}catch(e){return E(t)}}(t):E(t)}function j(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function E(t){return Object(u.b)("hub",(function(){return new b}),t)}function S(t,e){return!!t&&((t.__SENTRY__=t.__SENTRY__||{}).hub=e,!0)}function w(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=O();if(r&&r[t])return r[t].apply(r,Object(i.__spread)(e));throw new Error("No hub defined or "+t+" was not found on the hub, please open a bug report.")}function x(t,e){return w("captureException",t,{captureContext:e,originalException:t,syntheticException:new Error("Sentry syntheticException")})}function k(t,e){var n=new Error(t),r="string"!=typeof e?{captureContext:e}:void 0;return w("captureMessage",t,"string"==typeof e?e:void 0,Object(i.__assign)({originalException:t,syntheticException:n},r))}function T(t){return w("captureEvent",t)}function P(t){w("configureScope",t)}function M(t){w("addBreadcrumb",t)}function I(t,e){w("setContext",t,e)}function N(t){w("setExtras",t)}function R(t){w("setTags",t)}function D(t,e){w("setExtra",t,e)}function C(t,e){w("setTag",t,e)}function A(t){w("setUser",t)}function H(t){w("withScope",t)}function F(t,e){return w("startTransaction",Object(i.__assign)({},t),e)}var L=n(26),U=function(){function t(t,e,n){void 0===e&&(e={}),this.dsn=t,this._dsnObject=Object(L.b)(t),this.metadata=e,this._tunnel=n}return t.prototype.getDsn=function(){return this._dsnObject},t.prototype.forceEnvelope=function(){return!!this._tunnel},t.prototype.getBaseApiEndpoint=function(){return q(this._dsnObject)},t.prototype.getStoreEndpoint=function(){return W(this._dsnObject)},t.prototype.getStoreEndpointWithUrlEncodedAuth=function(){return K(this._dsnObject)},t.prototype.getEnvelopeEndpointWithUrlEncodedAuth=function(){return Y(this._dsnObject,this._tunnel)},t}();function B(t,e,n){return{initDsn:t,metadata:e||{},dsn:Object(L.b)(t),tunnel:n}}function q(t){var e=t.protocol?t.protocol+":":"",n=t.port?":"+t.port:"";return e+"//"+t.host+n+(t.path?"/"+t.path:"")+"/api/"}function G(t,e){return""+q(t)+t.projectId+"/"+e+"/"}function z(t){return Object(v.i)({sentry_key:t.publicKey,sentry_version:"7"})}function W(t){return G(t,"store")}function K(t){return W(t)+"?"+z(t)}function Y(t,e){return e||function(t){return G(t,"envelope")}(t)+"?"+z(t)}function V(t,e,n){var r=["Sentry sentry_version=7"];return r.push("sentry_client="+e+"/"+n),r.push("sentry_key="+t.publicKey),t.pass&&r.push("sentry_secret="+t.pass),{"Content-Type":"application/json","X-Sentry-Auth":r.join(", ")}}function J(t,e){var n=Object(L.b)(t),r=q(n)+"embed/error-page/",i="dsn="+Object(L.a)(n);for(var o in e)if("dsn"!==o)if("user"===o){if(!e.user)continue;e.user.name&&(i+="&name="+encodeURIComponent(e.user.name)),e.user.email&&(i+="&email="+encodeURIComponent(e.user.email))}else i+="&"+encodeURIComponent(o)+"="+encodeURIComponent(e[o]);return r+"?"+i}var $=n(27),X=n(8),Z=n(7),Q="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,tt=[];function et(t){return t.reduce((function(t,e){return t.every((function(t){return e.name!==t.name}))&&t.push(e),t}),[])}function nt(t){var e={};return function(t){var e=t.defaultIntegrations&&Object(i.__spread)(t.defaultIntegrations)||[],n=t.integrations,r=Object(i.__spread)(et(e));Array.isArray(n)?r=Object(i.__spread)(r.filter((function(t){return n.every((function(e){return e.name!==t.name}))})),et(n)):"function"==typeof n&&(r=n(r),r=Array.isArray(r)?r:[r]);var o=r.map((function(t){return t.name}));return-1!==o.indexOf("Debug")&&r.push.apply(r,Object(i.__spread)(r.splice(o.indexOf("Debug"),1))),r}(t).forEach((function(t){e[t.name]=t,function(t){-1===tt.indexOf(t.name)&&(t.setupOnce(_,O),tt.push(t.name),Q&&s.c.log("Integration installed: "+t.name))}(t)})),Object(v.a)(e,"initialized",!0),e}var rt="Not capturing exception because it's already been captured.",it=function(){function t(t,e){this._integrations={},this._numProcessing=0,this._backend=new t(e),this._options=e,e.dsn&&(this._dsn=Object(L.b)(e.dsn))}return t.prototype.captureException=function(t,e,n){var r=this;if(!Object(o.d)(t)){var i=e&&e.event_id;return this._process(this._getBackend().eventFromException(t,e).then((function(t){return r._captureEvent(t,e,n)})).then((function(t){i=t}))),i}Q&&s.c.log(rt)},t.prototype.captureMessage=function(t,e,n,r){var i=this,o=n&&n.event_id,a=Object(d.j)(t)?this._getBackend().eventFromMessage(String(t),e,n):this._getBackend().eventFromException(t,n);return this._process(a.then((function(t){return i._captureEvent(t,n,r)})).then((function(t){o=t}))),o},t.prototype.captureEvent=function(t,e,n){if(!(e&&e.originalException&&Object(o.d)(e.originalException))){var r=e&&e.event_id;return this._process(this._captureEvent(t,e,n).then((function(t){r=t}))),r}Q&&s.c.log(rt)},t.prototype.captureSession=function(t){this._isEnabled()?"string"!=typeof t.release?Q&&s.c.warn("Discarded session because of missing or non-string release"):(this._sendSession(t),t.update({init:!1})):Q&&s.c.warn("SDK not enabled, will not capture session.")},t.prototype.getDsn=function(){return this._dsn},t.prototype.getOptions=function(){return this._options},t.prototype.getTransport=function(){return this._getBackend().getTransport()},t.prototype.flush=function(t){var e=this;return this._isClientDoneProcessing(t).then((function(n){return e.getTransport().close(t).then((function(t){return n&&t}))}))},t.prototype.close=function(t){var e=this;return this.flush(t).then((function(t){return e.getOptions().enabled=!1,t}))},t.prototype.setupIntegrations=function(){this._isEnabled()&&!this._integrations.initialized&&(this._integrations=nt(this._options))},t.prototype.getIntegration=function(t){try{return this._integrations[t.id]||null}catch(e){return Q&&s.c.warn("Cannot retrieve integration "+t.id+" from the current Client"),null}},t.prototype._updateSessionFromEvent=function(t,e){var n,r,o=!1,a=!1,s=e.exception&&e.exception.values;if(s){a=!0;try{for(var u=Object(i.__values)(s),c=u.next();!c.done;c=u.next()){var f=c.value.mechanism;if(f&&!1===f.handled){o=!0;break}}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}var d="ok"===t.status;(d&&0===t.errors||d&&o)&&(t.update(Object(i.__assign)(Object(i.__assign)({},o&&{status:"crashed"}),{errors:t.errors||Number(a||o)})),this.captureSession(t))},t.prototype._sendSession=function(t){this._getBackend().sendSession(t)},t.prototype._isClientDoneProcessing=function(t){var e=this;return new p.a((function(n){var r=0,i=setInterval((function(){0==e._numProcessing?(clearInterval(i),n(!0)):(r+=1,t&&r>=t&&(clearInterval(i),n(!1)))}),1)}))},t.prototype._getBackend=function(){return this._backend},t.prototype._isEnabled=function(){return!1!==this.getOptions().enabled&&void 0!==this._dsn},t.prototype._prepareEvent=function(t,e,n){var r=this,s=this.getOptions(),u=s.normalizeDepth,c=void 0===u?3:u,f=s.normalizeMaxBreadth,d=void 0===f?1e3:f,h=Object(i.__assign)(Object(i.__assign)({},t),{event_id:t.event_id||(n&&n.event_id?n.event_id:Object(o.i)()),timestamp:t.timestamp||Object(a.c)()});this._applyClientOptions(h),this._applyIntegrationsMetadata(h);var _=e;n&&n.captureContext&&(_=l.clone(_).update(n.captureContext));var v=Object(p.c)(h);return _&&(v=_.applyToEvent(h,n)),v.then((function(t){return t&&(t.sdkProcessingMetadata=Object(i.__assign)(Object(i.__assign)({},t.sdkProcessingMetadata),{normalizeDepth:Object($.a)(c)+" ("+typeof c+")"})),"number"==typeof c&&c>0?r._normalizeEvent(t,c,d):t}))},t.prototype._normalizeEvent=function(t,e,n){if(!t)return null;var r=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map((function(t){return Object(i.__assign)(Object(i.__assign)({},t),t.data&&{data:Object($.a)(t.data,e,n)})}))}),t.user&&{user:Object($.a)(t.user,e,n)}),t.contexts&&{contexts:Object($.a)(t.contexts,e,n)}),t.extra&&{extra:Object($.a)(t.extra,e,n)});return t.contexts&&t.contexts.trace&&(r.contexts.trace=t.contexts.trace),r.sdkProcessingMetadata=Object(i.__assign)(Object(i.__assign)({},r.sdkProcessingMetadata),{baseClientNormalized:!0}),r},t.prototype._applyClientOptions=function(t){var e=this.getOptions(),n=e.environment,r=e.release,i=e.dist,o=e.maxValueLength,a=void 0===o?250:o;"environment"in t||(t.environment="environment"in e?n:"production"),void 0===t.release&&void 0!==r&&(t.release=r),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=Object(X.e)(t.message,a));var s=t.exception&&t.exception.values&&t.exception.values[0];s&&s.value&&(s.value=Object(X.e)(s.value,a));var u=t.request;u&&u.url&&(u.url=Object(X.e)(u.url,a))},t.prototype._applyIntegrationsMetadata=function(t){var e=Object.keys(this._integrations);e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=Object(i.__spread)(t.sdk.integrations||[],e))},t.prototype._sendEvent=function(t){this._getBackend().sendEvent(t)},t.prototype._captureEvent=function(t,e,n){return this._processEvent(t,e,n).then((function(t){return t.event_id}),(function(t){Q&&s.c.error(t)}))},t.prototype._processEvent=function(t,e,n){var r=this,i=this.getOptions(),o=i.beforeSend,a=i.sampleRate,s=this.getTransport();function u(t,e){s.recordLostEvent&&s.recordLostEvent(t,e)}if(!this._isEnabled())return Object(p.b)(new Z.a("SDK not enabled, will not capture event."));var c="transaction"===t.type;return!c&&"number"==typeof a&&Math.random()>a?(u("sample_rate","event"),Object(p.b)(new Z.a("Discarding event because it's not included in the random sample (sampling rate = "+a+")"))):this._prepareEvent(t,n,e).then((function(n){if(null===n)throw u("event_processor",t.type||"event"),new Z.a("An event processor returned null, will not send event.");return e&&e.data&&!0===e.data.__sentry__||c||!o?n:function(t){var e="`beforeSend` method has to return `null` or a valid event.";if(Object(d.n)(t))return t.then((function(t){if(!Object(d.i)(t)&&null!==t)throw new Z.a(e);return t}),(function(t){throw new Z.a("beforeSend rejected with "+t)}));if(!Object(d.i)(t)&&null!==t)throw new Z.a(e);return t}(o(n,e))})).then((function(e){if(null===e)throw u("before_send",t.type||"event"),new Z.a("`beforeSend` returned `null`, will not send event.");var i=n&&n.getSession&&n.getSession();return!c&&i&&r._updateSessionFromEvent(i,e),r._sendEvent(e),e})).then(null,(function(t){if(t instanceof Z.a)throw t;throw r.captureException(t,{data:{__sentry__:!0},originalException:t}),new Z.a("Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: "+t)}))},t.prototype._process=function(t){var e=this;this._numProcessing+=1,t.then((function(t){return e._numProcessing-=1,t}),(function(t){return e._numProcessing-=1,t}))},t}();var ot=n(20);function at(t){if(t.metadata&&t.metadata.sdk){var e=t.metadata.sdk;return{name:e.name,version:e.version}}}function st(t,e){return e?(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=Object(i.__spread)(t.sdk.integrations||[],e.integrations||[]),t.sdk.packages=Object(i.__spread)(t.sdk.packages||[],e.packages||[]),t):t}function ut(t,e){var n=at(e),r=Object(i.__assign)(Object(i.__assign)({sent_at:(new Date).toISOString()},n&&{sdk:n}),!!e.tunnel&&{dsn:Object(L.a)(e.dsn)}),o="aggregates"in t?"sessions":"session",a=[{type:o},t];return[Object(ot.b)(r,[a]),o]}function ct(t,e){var n=Object(i.__read)(ut(t,e),2),r=n[0],o=n[1];return{body:Object(ot.d)(r),type:o,url:Y(e.dsn,e.tunnel)}}function ft(t,e){var n,r=at(e),o=t.type||"event",a="transaction"===o||!!e.tunnel,s=(t.sdkProcessingMetadata||{}).transactionSampling||{},u=s.method,c=s.rate;st(t,e.metadata.sdk),t.tags=t.tags||{},t.extra=t.extra||{},t.sdkProcessingMetadata&&t.sdkProcessingMetadata.baseClientNormalized||(t.tags.skippedNormalization=!0,t.extra.normalizeDepth=t.sdkProcessingMetadata?t.sdkProcessingMetadata.normalizeDepth:"unset"),delete t.sdkProcessingMetadata;try{n=JSON.stringify(t)}catch(e){t.tags.JSONStringifyError=!0,t.extra.JSONStringifyError=e;try{n=JSON.stringify(Object($.a)(t))}catch(t){var f=t;n=JSON.stringify({message:"JSON.stringify error after renormalization",extra:{message:f.message,stack:f.stack}})}}var d={body:n,type:o,url:a?Y(e.dsn,e.tunnel):K(e.dsn)};if(a){var p=Object(i.__assign)(Object(i.__assign)({event_id:t.event_id,sent_at:(new Date).toISOString()},r&&{sdk:r}),!!e.tunnel&&{dsn:Object(L.a)(e.dsn)}),l=[{type:o,sample_rates:[{id:u,rate:c}]},d.body],h=Object(ot.b)(p,[l]);d.body=Object(ot.d)(h)}return d}var dt=function(){function t(){}return t.prototype.sendEvent=function(t){return Object(p.c)({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:"skipped"})},t.prototype.close=function(t){return Object(p.c)(!0)},t}(),pt=function(){function t(t){this._options=t,this._options.dsn||Q&&s.c.warn("No DSN provided, backend will not do anything."),this._transport=this._setupTransport()}return t.prototype.eventFromException=function(t,e){throw new Z.a("Backend has to implement `eventFromException` method")},t.prototype.eventFromMessage=function(t,e,n){throw new Z.a("Backend has to implement `eventFromMessage` method")},t.prototype.sendEvent=function(t){if(this._newTransport&&this._options.dsn&&this._options._experiments&&this._options._experiments.newTransport){var e=function(t,e){var n=at(e),r=t.type||"event",o=(t.sdkProcessingMetadata||{}).transactionSampling||{},a=o.method,s=o.rate;st(t,e.metadata.sdk),t.tags=t.tags||{},t.extra=t.extra||{},t.sdkProcessingMetadata&&t.sdkProcessingMetadata.baseClientNormalized||(t.tags.skippedNormalization=!0,t.extra.normalizeDepth=t.sdkProcessingMetadata?t.sdkProcessingMetadata.normalizeDepth:"unset"),delete t.sdkProcessingMetadata;var u=Object(i.__assign)(Object(i.__assign)({event_id:t.event_id,sent_at:(new Date).toISOString()},n&&{sdk:n}),!!e.tunnel&&{dsn:Object(L.a)(e.dsn)}),c=[{type:r,sample_rates:[{id:a,rate:s}]},t];return Object(ot.b)(u,[c])}(t,B(this._options.dsn,this._options._metadata,this._options.tunnel));this._newTransport.send(e).then(null,(function(t){Q&&s.c.error("Error while sending event:",t)}))}else this._transport.sendEvent(t).then(null,(function(t){Q&&s.c.error("Error while sending event:",t)}))},t.prototype.sendSession=function(t){if(this._transport.sendSession)if(this._newTransport&&this._options.dsn&&this._options._experiments&&this._options._experiments.newTransport){var e=B(this._options.dsn,this._options._metadata,this._options.tunnel),n=Object(i.__read)(ut(t,e),1)[0];this._newTransport.send(n).then(null,(function(t){Q&&s.c.error("Error while sending session:",t)}))}else this._transport.sendSession(t).then(null,(function(t){Q&&s.c.error("Error while sending session:",t)}));else Q&&s.c.warn("Dropping session because custom transport doesn't implement sendSession")},t.prototype.getTransport=function(){return this._transport},t.prototype._setupTransport=function(){return new dt},t}();function lt(t,e){!0===e.debug&&(Q?s.c.enable():console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle."));var n=O(),r=n.getScope();r&&r.update(e.initialScope);var i=new t(e);n.bindClient(i)}var ht=n(28),_t=n(29),vt=n(30);function gt(t,e,n){void 0===n&&(n=Object(ht.a)(t.bufferSize||30));var r={};return{send:function(t){var i=Object(ot.c)(t),o="event"===i?"error":i,a={category:o,body:Object(ot.d)(t)};return Object(_t.c)(r,o)?Object(p.b)({status:"rate_limit",reason:bt(r,o)}):n.add((function(){return e(a).then((function(t){var e=t.body,n=t.headers,i=t.reason,a=t.statusCode,s=Object(vt.a)(a);return n&&(r=Object(_t.e)(r,n)),"success"===s?Object(p.c)({status:s,reason:i}):Object(p.b)({status:s,reason:i||e||("rate_limit"===s?bt(r,o):"Unknown transport error")})}))}))},flush:function(t){return n.drain(t)}}}function bt(t,e){return"Too many "+e+" requests, backing off until: "+new Date(Object(_t.b)(t,e)).toISOString()}var yt,mt="6.19.7",Ot=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){yt=Function.prototype.toString,Function.prototype.toString=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Object(v.f)(this)||this;return yt.apply(n,t)}},t.id="FunctionToString",t}(),jt=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],Et=function(){function t(e){void 0===e&&(e={}),this._options=e,this.name=t.id}return t.prototype.setupOnce=function(e,n){e((function(e){var r=n();if(r){var a=r.getIntegration(t);if(a){var u=r.getClient(),c=u?u.getOptions():{};return function(t,e){if(e.ignoreInternal&&function(t){try{return"SentryError"===t.exception.values[0].type}catch(t){}return!1}(t))return Q&&s.c.warn("Event dropped due to being internal Sentry Error.\nEvent: "+Object(o.e)(t)),!0;if(function(t,e){if(!e||!e.length)return!1;return function(t){if(t.message)return[t.message];if(t.exception)try{var e=t.exception.values&&t.exception.values[0]||{},n=e.type,r=void 0===n?"":n,i=e.value,a=void 0===i?"":i;return[""+a,r+": "+a]}catch(e){return Q&&s.c.error("Cannot extract message for event "+Object(o.e)(t)),[]}return[]}(t).some((function(t){return e.some((function(e){return Object(X.b)(t,e)}))}))}(t,e.ignoreErrors))return Q&&s.c.warn("Event dropped due to being matched by `ignoreErrors` option.\nEvent: "+Object(o.e)(t)),!0;if(function(t,e){if(!e||!e.length)return!1;var n=wt(t);return!!n&&e.some((function(t){return Object(X.b)(n,t)}))}(t,e.denyUrls))return Q&&s.c.warn("Event dropped due to being matched by `denyUrls` option.\nEvent: "+Object(o.e)(t)+".\nUrl: "+wt(t)),!0;if(!function(t,e){if(!e||!e.length)return!0;var n=wt(t);return!n||e.some((function(t){return Object(X.b)(n,t)}))}(t,e.allowUrls))return Q&&s.c.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: "+Object(o.e)(t)+".\nUrl: "+wt(t)),!0;return!1}(e,function(t,e){void 0===t&&(t={});void 0===e&&(e={});return{allowUrls:Object(i.__spread)(t.whitelistUrls||[],t.allowUrls||[],e.whitelistUrls||[],e.allowUrls||[]),denyUrls:Object(i.__spread)(t.blacklistUrls||[],t.denyUrls||[],e.blacklistUrls||[],e.denyUrls||[]),ignoreErrors:Object(i.__spread)(t.ignoreErrors||[],e.ignoreErrors||[],jt),ignoreInternal:void 0===t.ignoreInternal||t.ignoreInternal}}(a._options,c))?null:e}}return e}))},t.id="InboundFilters",t}();function St(t){void 0===t&&(t=[]);for(var e=t.length-1;e>=0;e--){var n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}function wt(t){try{if(t.stacktrace)return St(t.stacktrace.frames);var e;try{e=t.exception.values[0].stacktrace.frames}catch(t){}return e?St(e):null}catch(e){return Q&&s.c.error("Cannot extract url for event "+Object(o.e)(t)),null}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){return t.__proto__=e,t}:function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n]);return t});var o=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return r.message=e,r.name=n.prototype.constructor.name,i(r,n.prototype),r}return Object(r.__extends)(e,t),e}(Error)},function(t,e,n){"use strict";n.d(e,"e",(function(){return i})),n.d(e,"d",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"b",(function(){return s})),n.d(e,"a",(function(){return u}));var r=n(1);function i(t,e){return void 0===e&&(e=0),"string"!=typeof t||0===e||t.length<=e?t:t.substr(0,e)+"..."}function o(t,e){var n=t,r=n.length;if(r<=150)return n;e>r&&(e=r);var i=Math.max(e-60,0);i<5&&(i=0);var o=Math.min(i+140,r);return o>r-5&&(o=r),o===r&&(i=Math.max(o-140,0)),n=n.slice(i,o),i>0&&(n="'{snip} "+n),o<r&&(n+=" {snip}"),n}function a(t,e){if(!Array.isArray(t))return"";for(var n=[],r=0;r<t.length;r++){var i=t[r];try{n.push(String(i))}catch(t){n.push("[value cannot be serialized]")}}return n.join(e)}function s(t,e){return!!Object(r.l)(t)&&(Object(r.k)(e)?e.test(t):"string"==typeof e&&-1!==t.indexOf(e))}function u(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return r}));var r,i=n(0),o=n(6),a=n(3),s=Object(a.a)(),u=["debug","info","warn","error","log","assert"];function c(t){var e=Object(a.a)();if(!("console"in e))return t();var n=e.console,r={};u.forEach((function(t){var i=n[t]&&n[t].__sentry_original__;t in e.console&&i&&(r[t]=n[t],n[t]=i)}));try{return t()}finally{Object.keys(r).forEach((function(t){n[t]=r[t]}))}}function f(){var t=!1,e={enable:function(){t=!0},disable:function(){t=!1}};return o.a?u.forEach((function(n){e[n]=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t&&c((function(){var t;(t=s.console)[n].apply(t,Object(i.__spread)(["Sentry Logger ["+n+"]:"],e))}))}})):u.forEach((function(t){e[t]=function(){}})),e}r=o.a?Object(a.b)("logger",f):f()},function(t,e,n){"use strict";(function(t,r){n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"c",(function(){return s}));var i=n(17);function o(){return!Object(i.a)()&&"[object process]"===Object.prototype.toString.call(void 0!==t?t:0)}function a(t,e){return t.require(e)}function s(t){var e;try{e=a(r,t)}catch(t){}try{var n=a(r,"process").cwd;e=a(r,n()+"/node_modules/"+t)}catch(t){}return e}}).call(this,n(39),n(23)(t))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"b",(function(){return a}));var r=n(0);function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.sort((function(t,e){return t[0]-e[0]})).map((function(t){return t[1]}));return function(t,e){var i,a,s,u;void 0===e&&(e=0);var c=[];try{for(var f=Object(r.__values)(t.split("\n").slice(e)),d=f.next();!d.done;d=f.next()){var p=d.value;try{for(var l=(s=void 0,Object(r.__values)(n)),h=l.next();!h.done;h=l.next()){var _=(0,h.value)(p);if(_){c.push(_);break}}}catch(t){s={error:t}}finally{try{h&&!h.done&&(u=l.return)&&u.call(l)}finally{if(s)throw s.error}}}}catch(t){i={error:t}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}return o(c)}}function o(t){if(!t.length)return[];var e=t,n=e[0].function||"",i=e[e.length-1].function||"";return-1===n.indexOf("captureMessage")&&-1===n.indexOf("captureException")||(e=e.slice(1)),-1!==i.indexOf("sentryWrapped")&&(e=e.slice(0,-1)),e.slice(0,50).map((function(t){return Object(r.__assign)(Object(r.__assign)({},t),{filename:t.filename||e[0].filename,function:t.function||"?"})})).reverse()}function a(t){try{return t&&"function"==typeof t&&t.name||"<anonymous>"}catch(t){return"<anonymous>"}}},function(t,e,n){"use strict";n.d(e,"c",(function(){return i})),n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a}));var r=n(1);function i(t){return new a((function(e){e(t)}))}function o(t){return new a((function(e,n){n(t)}))}var a=function(){function t(t){var e=this;this._state=0,this._handlers=[],this._resolve=function(t){e._setResult(1,t)},this._reject=function(t){e._setResult(2,t)},this._setResult=function(t,n){0===e._state&&(Object(r.n)(n)?n.then(e._resolve,e._reject):(e._state=t,e._value=n,e._executeHandlers()))},this._executeHandlers=function(){if(0!==e._state){var t=e._handlers.slice();e._handlers=[],t.forEach((function(t){t[0]||(1===e._state&&t[1](e._value),2===e._state&&t[2](e._value),t[0]=!0)}))}};try{t(this._resolve,this._reject)}catch(t){this._reject(t)}}return t.prototype.then=function(e,n){var r=this;return new t((function(t,i){r._handlers.push([!1,function(n){if(e)try{t(e(n))}catch(t){i(t)}else t(n)},function(e){if(n)try{t(n(e))}catch(t){i(t)}else i(e)}]),r._executeHandlers()}))},t.prototype.catch=function(t){return this.then((function(t){return t}),t)},t.prototype.finally=function(e){var n=this;return new t((function(t,r){var i,o;return n.then((function(t){o=!1,i=t,e&&e()}),(function(t){o=!0,i=t,e&&e()})).then((function(){o?r(i):t(i)}))}))},t}()},,function(t,e,n){"use strict";var r;n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i})),function(t){t.Fatal="fatal",t.Error="error",t.Warning="warning",t.Log="log",t.Info="info",t.Debug="debug",t.Critical="critical"}(r||(r={}));var i=["fatal","error","warning","log","info","debug","critical"]},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.appName=e.sdk=void 0;var n=function(){var t={request:function(){},httpRequest:function(){},getSystemInfoSync:function(){}};if("object"==typeof wx)t=wx;else if("object"==typeof my)t=my;else if("object"==typeof tt)t=tt;else if("object"==typeof dd)t=dd;else if("object"==typeof qq)t=qq;else{if("object"!=typeof swan)throw new Error("sentry-miniapp 暂不支持此平台");t=swan}return t}();e.sdk=n;var r,i=(r="unknown","object"==typeof wx?r="wechat":"object"==typeof my?r="alipay":"object"==typeof tt?r="bytedance":"object"==typeof dd?r="dingtalk":"object"==typeof qq?r="qq":"object"==typeof swan&&(r="swan"),r);e.appName=i},function(t,e,n){"use strict";(function(t){n.d(e,"c",(function(){return c})),n.d(e,"d",(function(){return f})),n.d(e,"e",(function(){return d})),n.d(e,"f",(function(){return p})),n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return l}));var r=n(3),i=n(10),o={nowSeconds:function(){return Date.now()/1e3}};var a,s=Object(i.b)()?function(){try{return Object(i.a)(t,"perf_hooks").performance}catch(t){return}}():function(){var t=Object(r.a)().performance;if(t&&t.now)return{now:function(){return t.now()},timeOrigin:Date.now()-t.now()}}(),u=void 0===s?o:{nowSeconds:function(){return(s.timeOrigin+s.now())/1e3}},c=o.nowSeconds.bind(o),f=u.nowSeconds.bind(u),d=f,p=void 0!==s,l=function(){var t=Object(r.a)().performance;if(t&&t.now){var e=t.now(),n=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+e-n):36e5,o=i<36e5,s=t.timing&&t.timing.navigationStart,u="number"==typeof s?Math.abs(s+e-n):36e5;return o||u<36e5?i<=u?(a="timeOrigin",t.timeOrigin):(a="navigationStart",s):(a="dateNow",n)}a="none"}()}).call(this,n(23)(t))},function(t,e,n){"use strict";function r(){return"undefined"!=typeof __SENTRY_BROWSER_BUNDLE__&&!!__SENTRY_BROWSER_BUNDLE__}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return s}));var r=n(3),i=n(1);function o(t,e){try{for(var n=t,r=[],i=0,o=0,s=" > ".length,u=void 0;n&&i++<5&&!("html"===(u=a(n,e))||i>1&&o+r.length*s+u.length>=80);)r.push(u),o+=u.length,n=n.parentNode;return r.reverse().join(" > ")}catch(t){return"<unknown>"}}function a(t,e){var n,r,o,a,s,u=t,c=[];if(!u||!u.tagName)return"";c.push(u.tagName.toLowerCase());var f=e&&e.length?e.filter((function(t){return u.getAttribute(t)})).map((function(t){return[t,u.getAttribute(t)]})):null;if(f&&f.length)f.forEach((function(t){c.push("["+t[0]+'="'+t[1]+'"]')}));else if(u.id&&c.push("#"+u.id),(n=u.className)&&Object(i.l)(n))for(r=n.split(/\s+/),s=0;s<r.length;s++)c.push("."+r[s]);var d=["type","name","title","alt"];for(s=0;s<d.length;s++)o=d[s],(a=u.getAttribute(o))&&c.push("["+o+'="'+a+'"]');return c.join("")}function s(){var t=Object(r.a)();try{return t.document.location.href}catch(t){return""}}},function(t,e,n){"use strict";function r(){var t="function"==typeof WeakSet,e=t?new WeakSet:[];return[function(n){if(t)return!!e.has(n)||(e.add(n),!1);for(var r=0;r<e.length;r++){if(e[r]===n)return!0}return e.push(n),!1},function(n){if(t)e.delete(n);else for(var r=0;r<e.length;r++)if(e[r]===n){e.splice(r,1);break}}]}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"d",(function(){return u}));var r=n(0),i=n(1);function o(t,e){return void 0===e&&(e=[]),[t,e]}function a(t,e){var n=Object(r.__read)(t,2),i=n[0],o=n[1];return[i,Object(r.__spread)(o,[e])]}function s(t){var e=Object(r.__read)(t,2),n=Object(r.__read)(e[1],1);return Object(r.__read)(n[0],1)[0].type}function u(t){var e=Object(r.__read)(t,2),n=e[0],o=e[1],a=JSON.stringify(n);return o.reduce((function(t,e){var n=Object(r.__read)(e,2),o=n[0],a=n[1],s=Object(i.j)(a)?String(a):JSON.stringify(a);return t+"\n"+JSON.stringify(o)+"\n"+s}),a)}},function(t,e,n){"use strict";n.r(e);var r=n(14);n.d(e,"Severity",(function(){return r.a})),n.d(e,"SeverityLevels",(function(){return r.b}))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.computeStackTrace=void 0;var r=n(0),i=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[-a-z]+:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,o=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,a=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,s=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,u=/\((\S*)(?::(\d+))(?::(\d+))\)/,c=/^\s*at (\w.*) \((\w*.js):(\d*):(\d*)/i;function f(t,e){try{return r.__assign(r.__assign({},t),{stack:t.stack.slice(e)})}catch(e){return t}}function d(t){var e=t&&t.message;return e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}e.computeStackTrace=function(t){var e=null,n=t&&t.framesToPop;try{if(e=function(t){if(!t||!t.stacktrace)return null;for(var e,n=t.stacktrace,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=n.split("\n"),a=[],s=0;s<o.length;s+=2){var u=null;(e=r.exec(o[s]))?u={url:e[2],func:e[3],args:[],line:+e[1],column:null}:(e=i.exec(o[s]))&&(u={url:e[6],func:e[3]||e[4],args:e[5]?e[5].split(","):[],line:+e[1],column:+e[2]}),u&&(!u.func&&u.line&&(u.func="?"),a.push(u))}if(!a.length)return null;return{message:d(t),name:t.name,stack:a}}(t))return f(e,n)}catch(t){}try{if(e=function(t){if(!t||!t.stack)return null;for(var e,n,r,f=[],p=t.stack.split("\n"),l=0;l<p.length;++l){if(n=i.exec(p[l])){var h=n[2]&&0===n[2].indexOf("native");n[2]&&0===n[2].indexOf("eval")&&(e=u.exec(n[2]))&&(n[2]=e[1],n[3]=e[2],n[4]=e[3]),r={url:n[2],func:n[1]||"?",args:h?[n[2]]:[],line:n[3]?+n[3]:null,column:n[4]?+n[4]:null}}else if(n=a.exec(p[l]))r={url:n[2],func:n[1]||"?",args:[],line:+n[3],column:n[4]?+n[4]:null};else if(n=o.exec(p[l]))n[3]&&n[3].indexOf(" > eval")>-1&&(e=s.exec(n[3]))?(n[1]=n[1]||"eval",n[3]=e[1],n[4]=e[2],n[5]=""):0!==l||n[5]||void 0===t.columnNumber||(f[0].column=t.columnNumber+1),r={url:n[3],func:n[1]||"?",args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null};else{if(!(n=c.exec(p[l])))continue;r={url:n[2],func:n[1]||"?",args:[],line:n[3]?+n[3]:null,column:n[4]?+n[4]:null}}!r.func&&r.line&&(r.func="?"),f.push(r)}if(!f.length)return null;return{message:d(t),name:t.name,stack:f}}(t))return f(e,n)}catch(t){}return{message:d(t),name:t&&t.name,stack:[],failed:!0}}},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.d(e,"i",(function(){return s})),n.d(e,"g",(function(){return u})),n.d(e,"e",(function(){return f})),n.d(e,"c",(function(){return d})),n.d(e,"b",(function(){return p})),n.d(e,"f",(function(){return h})),n.d(e,"a",(function(){return _})),n.d(e,"h",(function(){return v})),n.d(e,"d",(function(){return g}));var r=n(0),i=n(3),o=n(4),a=n(8);function s(){var t=Object(i.a)(),e=t.crypto||t.msCrypto;if(void 0!==e&&e.getRandomValues){var n=new Uint16Array(8);e.getRandomValues(n),n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768;var r=function(t){for(var e=t.toString(16);e.length<4;)e="0"+e;return e};return r(n[0])+r(n[1])+r(n[2])+r(n[3])+r(n[4])+r(n[5])+r(n[6])+r(n[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}function u(t){if(!t)return{};var e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};var n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+r}}function c(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function f(t){var e=t.message,n=t.event_id;if(e)return e;var r=c(t);return r?r.type&&r.value?r.type+": "+r.value:r.type||r.value||n||"<unknown>":n||"<unknown>"}function d(t,e,n){var r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=n||"Error")}function p(t,e){var n=c(t);if(n){var i=n.mechanism;if(n.mechanism=Object(r.__assign)(Object(r.__assign)(Object(r.__assign)({},{type:"generic",handled:!0}),i),e),e&&"data"in e){var o=Object(r.__assign)(Object(r.__assign)({},i&&i.data),e.data);n.mechanism.data=o}}}var l=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function h(t){var e=t.match(l)||[],n=parseInt(e[1],10),r=parseInt(e[2],10),i=parseInt(e[3],10);return{buildmetadata:e[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:e[4]}}function _(t,e,n){void 0===n&&(n=5);var r=e.lineno||0,i=t.length,o=Math.max(Math.min(i,r-1),0);e.pre_context=t.slice(Math.max(0,o-n),o).map((function(t){return Object(a.d)(t,0)})),e.context_line=Object(a.d)(t[Math.min(i-1,o)],e.colno||0),e.post_context=t.slice(Math.min(o+1,i),o+1+n).map((function(t){return Object(a.d)(t,0)}))}function v(t){return t.split(/[\?#]/,1)[0]}function g(t){if(t&&t.__sentry_captured__)return!0;try{Object(o.a)(t,"__sentry_captured__",!0)}catch(t){}return!1}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return c}));var r=n(0),i=n(7),o=n(6),a=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;function s(t,e){void 0===e&&(e=!1);var n=t.host,r=t.path,i=t.pass,o=t.port,a=t.projectId;return t.protocol+"://"+t.publicKey+(e&&i?":"+i:"")+"@"+n+(o?":"+o:"")+"/"+(r?r+"/":r)+a}function u(t){return"user"in t&&!("publicKey"in t)&&(t.publicKey=t.user),{user:t.publicKey||"",protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function c(t){var e="string"==typeof t?function(t){var e=a.exec(t);if(!e)throw new i.a("Invalid Sentry Dsn: "+t);var n=Object(r.__read)(e.slice(1),6),o=n[0],s=n[1],c=n[2],f=void 0===c?"":c,d=n[3],p=n[4],l=void 0===p?"":p,h="",_=n[5],v=_.split("/");if(v.length>1&&(h=v.slice(0,-1).join("/"),_=v.pop()),_){var g=_.match(/^\d+/);g&&(_=g[0])}return u({host:d,pass:f,path:h,projectId:_,port:l,protocol:o,publicKey:s})}(t):u(t);return function(t){if(o.a){var e=t.port,n=t.projectId,r=t.protocol;if(["protocol","publicKey","host","projectId"].forEach((function(e){if(!t[e])throw new i.a("Invalid Sentry Dsn: "+e+" missing")})),!n.match(/^\d+$/))throw new i.a("Invalid Sentry Dsn: Invalid projectId "+n);if(!function(t){return"http"===t||"https"===t}(r))throw new i.a("Invalid Sentry Dsn: Invalid protocol "+r);if(e&&isNaN(parseInt(e,10)))throw new i.a("Invalid Sentry Dsn: Invalid port "+e)}}(e),e}},function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return f}));var r=n(0),i=n(1),o=n(19),a=n(4),s=n(11);function u(t,e,n){void 0===e&&(e=1/0),void 0===n&&(n=1/0);try{return f("",t,e,n)}catch(t){return{ERROR:"**non-serializable** ("+t+")"}}}function c(t,e,n){void 0===e&&(e=3),void 0===n&&(n=102400);var r,i=u(t,e);return r=i,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(r))>n?c(t,e-1,n):i}function f(e,n,u,c,d){void 0===u&&(u=1/0),void 0===c&&(c=1/0),void 0===d&&(d=Object(o.a)());var p=Object(r.__read)(d,2),l=p[0],h=p[1],_=n;if(_&&"function"==typeof _.toJSON)try{return _.toJSON()}catch(t){}if(null===n||["number","boolean","string"].includes(typeof n)&&!Object(i.h)(n))return n;var v=function(e,n){try{return"domain"===e&&n&&"object"==typeof n&&n._events?"[Domain]":"domainEmitter"===e?"[DomainEmitter]":void 0!==t&&n===t?"[Global]":"undefined"!=typeof window&&n===window?"[Window]":"undefined"!=typeof document&&n===document?"[Document]":Object(i.m)(n)?"[SyntheticEvent]":"number"==typeof n&&n!=n?"[NaN]":void 0===n?"[undefined]":"function"==typeof n?"[Function: "+Object(s.b)(n)+"]":"symbol"==typeof n?"["+String(n)+"]":"bigint"==typeof n?"[BigInt: "+String(n)+"]":"[object "+Object.getPrototypeOf(n).constructor.name+"]"}catch(t){return"**non-serializable** ("+t+")"}}(e,n);if(!v.startsWith("[object "))return v;if(0===u)return v.replace("object ","");if(l(n))return"[Circular ~]";var g=Array.isArray(n)?[]:{},b=0,y=Object(i.d)(n)||Object(i.f)(n)?Object(a.b)(n):n;for(var m in y)if(Object.prototype.hasOwnProperty.call(y,m)){if(b>=c){g[m]="[MaxProperties ~]";break}var O=y[m];g[m]=f(m,O,u-1,c,d),b+=1}return h(n),g}}).call(this,n(24))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(7),i=n(12);function o(t){var e=[];function n(t){return e.splice(e.indexOf(t),1)[0]}return{$:e,add:function(o){if(!(void 0===t||e.length<t))return Object(i.b)(new r.a("Not adding Promise due to buffer limit reached."));var a=o();return-1===e.indexOf(a)&&e.push(a),a.then((function(){return n(a)})).then(null,(function(){return n(a).then(null,(function(){}))})),a},drain:function(t){return new i.a((function(n,r){var o=e.length;if(!o)return n(!0);var a=setTimeout((function(){t&&t>0&&n(!1)}),t);e.forEach((function(t){Object(i.c)(t).then((function(){--o||(clearTimeout(a),n(!0))}),r)}))}))}}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"d",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"e",(function(){return u}));var r=n(0),i=6e4;function o(t,e){void 0===e&&(e=Date.now());var n=parseInt(""+t,10);if(!isNaN(n))return 1e3*n;var r=Date.parse(""+t);return isNaN(r)?i:r-e}function a(t,e){return t[e]||t.all||0}function s(t,e,n){return void 0===n&&(n=Date.now()),a(t,e)>n}function u(t,e,n){var i,a,s,u;void 0===n&&(n=Date.now());var c=Object(r.__assign)({},t),f=e["x-sentry-rate-limits"],d=e["retry-after"];if(f)try{for(var p=Object(r.__values)(f.trim().split(",")),l=p.next();!l.done;l=p.next()){var h=l.value.split(":",2),_=parseInt(h[0],10),v=1e3*(isNaN(_)?60:_);if(h[1])try{for(var g=(s=void 0,Object(r.__values)(h[1].split(";"))),b=g.next();!b.done;b=g.next()){c[b.value]=n+v}}catch(t){s={error:t}}finally{try{b&&!b.done&&(u=g.return)&&u.call(g)}finally{if(s)throw s.error}}else c.all=n+v}}catch(t){i={error:t}}finally{try{l&&!l.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}else d&&(c.all=n+o(d,n));return c}},function(t,e,n){"use strict";function r(t){return t>=200&&t<300?"success":429===t?"rate_limit":t>=400&&t<500?"invalid":t>=500?"failed":"unknown"}n.d(e,"a",(function(){return r}))},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SDK_VERSION=e.SDK_NAME=void 0,e.SDK_NAME="sentry.javascript.miniapp",e.SDK_VERSION="0.12.0"},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.MiniappClient=void 0;var r=n(0),i=n(5),o=n(41),a=n(31),s=function(t){function e(e){return void 0===e&&(e={}),t.call(this,o.MiniappBackend,e)||this}return r.__extends(e,t),e.prototype._prepareEvent=function(e,n,i){return e.platform=e.platform||"javascript",e.sdk=r.__assign(r.__assign({},e.sdk),{name:a.SDK_NAME,packages:r.__spread(e.sdk&&e.sdk.packages||[],[{name:"npm:@sentry/miniapp",version:a.SDK_VERSION}]),version:a.SDK_VERSION}),t.prototype._prepareEvent.call(this,e,n,i)},e.prototype.showReportDialog=function(t){void 0===t&&(t={}),console.log("sentry-miniapp 暂未实现该方法",t)},e}(i.BaseClient);e.MiniappClient=s},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.prepareFramesForEvent=e.eventFromStacktrace=e.eventFromPlainObject=e.exceptionFromStacktrace=void 0;var r=n(2),i=n(22);function o(t){var e=a(t.stack),n={type:t.name,value:t.message};return e&&e.length&&(n.stacktrace={frames:e}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function a(t){if(!t||!t.length)return[];var e=t,n=e[0].func||"",r=e[e.length-1].func||"";return-1===n.indexOf("captureMessage")&&-1===n.indexOf("captureException")||(e=e.slice(1)),-1!==r.indexOf("sentryWrapped")&&(e=e.slice(0,-1)),e.map((function(t){return{colno:null===t.column?void 0:t.column,filename:t.url||e[0].url,function:t.func||"?",in_app:!0,lineno:null===t.line?void 0:t.line}})).slice(0,100).reverse()}e.exceptionFromStacktrace=o,e.eventFromPlainObject=function(t,e,n){var o={exception:{values:[{type:r.isEvent(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:"Non-Error "+(n?"promise rejection":"exception")+" captured with keys: "+r.extractExceptionKeysForMessage(t)}]},extra:{__serialized__:r.normalizeToSize(t)}};if(e){var s=a(i.computeStackTrace(e).stack);o.stacktrace={frames:s}}return o},e.eventFromStacktrace=function(t){return{exception:{values:[o(t)]}}},e.prepareFramesForEvent=a},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(35);Object.defineProperty(e,"BaseTransport",{enumerable:!0,get:function(){return r.BaseTransport}});var i=n(43);Object.defineProperty(e,"XHRTransport",{enumerable:!0,get:function(){return i.XHRTransport}})},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.BaseTransport=void 0;var r=n(5),i=n(2),o=function(){function t(t){this.options=t,this._buffer=i.makePromiseBuffer(30),this.url=new r.API(this.options.dsn).getStoreEndpointWithUrlEncodedAuth()}return t.prototype.sendEvent=function(t){throw new i.SentryError("Transport Class has to implement `sendEvent` method")},t.prototype.close=function(t){return this._buffer.drain(t)},t}();e.BaseTransport=o},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.keypressEventHandler=e.breadcrumbEventHandler=e.wrap=e.ignoreNextOnError=e.shouldIgnoreOnError=void 0;var r,i,o=n(0),a=n(5),s=n(2),u=0;function c(){u+=1,setTimeout((function(){u-=1}))}e.shouldIgnoreOnError=function(){return u>0},e.ignoreNextOnError=c,e.wrap=function t(e,n,r){if(void 0===n&&(n={}),"function"!=typeof e)return e;try{if(e.__sentry__)return e;if(e.__sentry_wrapped__)return e.__sentry_wrapped__}catch(t){return e}var i=function(){r&&"function"==typeof r&&r.apply(this,arguments);var i=Array.prototype.slice.call(arguments);try{var u=i.map((function(e){return t(e,n)}));return e.handleEvent?e.handleEvent.apply(this,u):e.apply(this,u)}catch(t){throw c(),a.withScope((function(e){e.addEventProcessor((function(t){var e=o.__assign({},t);return n.mechanism&&(s.addExceptionTypeValue(e,void 0,void 0),s.addExceptionMechanism(e,n.mechanism)),e.extra=o.__assign(o.__assign({},e.extra),{arguments:s.normalize(i,3)}),e})),a.captureException(t)})),t}};try{for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&(i[u]=e[u])}catch(t){}e.prototype=e.prototype||{},i.prototype=e.prototype,Object.defineProperty(e,"__sentry_wrapped__",{enumerable:!1,value:i}),Object.defineProperties(i,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:e}});try{Object.getOwnPropertyDescriptor(i,"name").configurable&&Object.defineProperty(i,"name",{get:function(){return e.name}})}catch(t){}return i};var f=0;function d(t,e){return void 0===e&&(e=!1),function(n){if(r=void 0,n&&i!==n){i=n;var o=function(){var e;try{e=n.target?s.htmlTreeAsString(n.target):s.htmlTreeAsString(n)}catch(t){e="<unknown>"}0!==e.length&&a.getCurrentHub().addBreadcrumb({category:"ui."+t,message:e},{event:n,name:t})};f&&clearTimeout(f),e?f=setTimeout(o):o()}}}e.breadcrumbEventHandler=d,e.keypressEventHandler=function(){return function(t){var e;try{e=t.target}catch(t){return}var n=e&&e.tagName;n&&("INPUT"===n||"TEXTAREA"===n||e.isContentEditable)&&(r||d("input")(t),clearTimeout(r),r=setTimeout((function(){r=void 0}),1e3))}}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(44);Object.defineProperty(e,"GlobalHandlers",{enumerable:!0,get:function(){return r.GlobalHandlers}});var i=n(45);Object.defineProperty(e,"TryCatch",{enumerable:!0,get:function(){return i.TryCatch}});var o=n(46);Object.defineProperty(e,"LinkedErrors",{enumerable:!0,get:function(){return o.LinkedErrors}});var a=n(47);Object.defineProperty(e,"System",{enumerable:!0,get:function(){return a.System}});var s=n(48);Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return s.Router}});var u=n(49);Object.defineProperty(e,"IgnoreMpcrawlerErrors",{enumerable:!0,get:function(){return u.IgnoreMpcrawlerErrors}})},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.Transports=e.Integrations=void 0;var r=n(21);Object.defineProperty(e,"Severity",{enumerable:!0,get:function(){return r.Severity}});var i=n(5);Object.defineProperty(e,"addGlobalEventProcessor",{enumerable:!0,get:function(){return i.addGlobalEventProcessor}}),Object.defineProperty(e,"addBreadcrumb",{enumerable:!0,get:function(){return i.addBreadcrumb}}),Object.defineProperty(e,"captureException",{enumerable:!0,get:function(){return i.captureException}}),Object.defineProperty(e,"captureEvent",{enumerable:!0,get:function(){return i.captureEvent}}),Object.defineProperty(e,"captureMessage",{enumerable:!0,get:function(){return i.captureMessage}}),Object.defineProperty(e,"configureScope",{enumerable:!0,get:function(){return i.configureScope}}),Object.defineProperty(e,"getHubFromCarrier",{enumerable:!0,get:function(){return i.getHubFromCarrier}}),Object.defineProperty(e,"getCurrentHub",{enumerable:!0,get:function(){return i.getCurrentHub}}),Object.defineProperty(e,"Hub",{enumerable:!0,get:function(){return i.Hub}}),Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"setContext",{enumerable:!0,get:function(){return i.setContext}}),Object.defineProperty(e,"setExtra",{enumerable:!0,get:function(){return i.setExtra}}),Object.defineProperty(e,"setExtras",{enumerable:!0,get:function(){return i.setExtras}}),Object.defineProperty(e,"setTag",{enumerable:!0,get:function(){return i.setTag}}),Object.defineProperty(e,"setTags",{enumerable:!0,get:function(){return i.setTags}}),Object.defineProperty(e,"setUser",{enumerable:!0,get:function(){return i.setUser}}),Object.defineProperty(e,"withScope",{enumerable:!0,get:function(){return i.withScope}});var o=n(31);Object.defineProperty(e,"SDK_NAME",{enumerable:!0,get:function(){return o.SDK_NAME}}),Object.defineProperty(e,"SDK_VERSION",{enumerable:!0,get:function(){return o.SDK_VERSION}});var a=n(40);Object.defineProperty(e,"defaultIntegrations",{enumerable:!0,get:function(){return a.defaultIntegrations}}),Object.defineProperty(e,"init",{enumerable:!0,get:function(){return a.init}}),Object.defineProperty(e,"lastEventId",{enumerable:!0,get:function(){return a.lastEventId}}),Object.defineProperty(e,"showReportDialog",{enumerable:!0,get:function(){return a.showReportDialog}}),Object.defineProperty(e,"flush",{enumerable:!0,get:function(){return a.flush}}),Object.defineProperty(e,"close",{enumerable:!0,get:function(){return a.close}}),Object.defineProperty(e,"wrap",{enumerable:!0,get:function(){return a.wrap}});var s=n(32);Object.defineProperty(e,"MiniappClient",{enumerable:!0,get:function(){return s.MiniappClient}});var u=n(37);e.Integrations=u;var c=n(34);e.Transports=c},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],f=!1,d=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):d=-1,c.length&&l())}function l(){if(!f){var t=s(p);f=!0;for(var e=c.length;e;){for(u=c,c=[];++d<e;)u&&u[d].run();d=-1,e=c.length}u=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function _(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new h(t,e)),1!==c.length||f||s(l)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=_,i.addListener=_,i.once=_,i.off=_,i.removeListener=_,i.removeAllListeners=_,i.emit=_,i.prependListener=_,i.prependOnceListener=_,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.wrap=e.close=e.flush=e.lastEventId=e.showReportDialog=e.init=e.defaultIntegrations=void 0;var r=n(5),i=n(2),o=n(32),a=n(36),s=n(37);e.defaultIntegrations=[new r.Integrations.InboundFilters,new r.Integrations.FunctionToString,new s.TryCatch,new s.GlobalHandlers,new s.LinkedErrors,new s.System,new s.Router,new s.IgnoreMpcrawlerErrors],e.init=function(t){void 0===t&&(t={}),void 0===t.defaultIntegrations&&(t.defaultIntegrations=e.defaultIntegrations),t.normalizeDepth=t.normalizeDepth||5,r.initAndBind(o.MiniappClient,t)},e.showReportDialog=function(t){void 0===t&&(t={}),t.eventId||(t.eventId=r.getCurrentHub().lastEventId());var e=r.getCurrentHub().getClient();e&&e.showReportDialog(t)},e.lastEventId=function(){return r.getCurrentHub().lastEventId()},e.flush=function(t){var e=r.getCurrentHub().getClient();return e?e.flush(t):i.resolvedSyncPromise(!1)},e.close=function(t){var e=r.getCurrentHub().getClient();return e?e.close(t):i.resolvedSyncPromise(!1)},e.wrap=function(t){return a.wrap(t)()}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.MiniappBackend=void 0;var r=n(0),i=n(5),o=n(21),a=n(2),s=n(42),u=n(34),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(e,t),e.prototype._setupTransport=function(){if(!this._options.dsn)return t.prototype._setupTransport.call(this);var e=r.__assign(r.__assign({},this._options.transportOptions),{dsn:this._options.dsn});return this._options.transport?new this._options.transport(e):new u.XHRTransport(e)},e.prototype.eventFromException=function(t,e){var n=e&&e.syntheticException||void 0,r=s.eventFromUnknownInput(t,n,{attachStacktrace:this._options.attachStacktrace});return a.addExceptionMechanism(r,{handled:!0,type:"generic"}),r.level=o.Severity.Error,e&&e.event_id&&(r.event_id=e.event_id),a.resolvedSyncPromise(r)},e.prototype.eventFromMessage=function(t,e,n){void 0===e&&(e=o.Severity.Info);var r=n&&n.syntheticException||void 0,i=s.eventFromString(t,r,{attachStacktrace:this._options.attachStacktrace});return i.level=e,n&&n.event_id&&(i.event_id=n.event_id),a.resolvedSyncPromise(i)},e}(i.BaseBackend);e.MiniappBackend=c},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.eventFromString=e.eventFromUnknownInput=void 0;var r=n(2),i=n(33),o=n(22);function a(t,e,n){void 0===n&&(n={});var r={message:t};if(n.attachStacktrace&&e){var a=o.computeStackTrace(e),s=i.prepareFramesForEvent(a.stack);r.stacktrace={frames:s}}return r}e.eventFromUnknownInput=function(t,e,n){var s;if(void 0===n&&(n={}),r.isErrorEvent(t)&&t.error)return t=t.error,s=i.eventFromStacktrace(o.computeStackTrace(t));if(r.isDOMError(t)||r.isDOMException(t)){var u=t,c=u.name||(r.isDOMError(u)?"DOMError":"DOMException"),f=u.message?c+": "+u.message:c;return s=a(f,e,n),r.addExceptionTypeValue(s,f),s}if(r.isError(t))return s=i.eventFromStacktrace(o.computeStackTrace(t));if(r.isPlainObject(t)||r.isEvent(t)){var d=t;return s=i.eventFromPlainObject(d,e,n.rejection),r.addExceptionMechanism(s,{synthetic:!0}),s}return s=a(t,e,n),r.addExceptionTypeValue(s,""+t,void 0),r.addExceptionMechanism(s,{synthetic:!0}),s},e.eventFromString=a},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.XHRTransport=void 0;var r=n(0),i=n(2),o=n(15),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(e,t),e.prototype.sendEvent=function(t){var e=this,n=o.sdk.request||o.sdk.httpRequest;return this._buffer.add((function(){return new Promise((function(r,o){n({url:e.url,method:"POST",data:JSON.stringify(t),header:{"content-type":"application/json"},success:function(t){r({status:i.eventStatusFromHttpCode(t.statusCode)})},fail:function(t){o(t)}})}))}))},e}(n(35).BaseTransport);e.XHRTransport=a},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalHandlers=void 0;var r=n(0),i=n(5),o=n(2),a=n(15),s=function(){function t(e){this.name=t.id,this._onErrorHandlerInstalled=!1,this._onUnhandledRejectionHandlerInstalled=!1,this._onPageNotFoundHandlerInstalled=!1,this._onMemoryWarningHandlerInstalled=!1,this._options=r.__assign({onerror:!0,onunhandledrejection:!0,onpagenotfound:!0,onmemorywarning:!0},e)}return t.prototype.setupOnce=function(){Error.stackTraceLimit=50,this._options.onerror&&(o.logger.log("Global Handler attached: onError"),this._installGlobalOnErrorHandler()),this._options.onunhandledrejection&&(o.logger.log("Global Handler attached: onunhandledrejection"),this._installGlobalOnUnhandledRejectionHandler()),this._options.onpagenotfound&&(o.logger.log("Global Handler attached: onPageNotFound"),this._installGlobalOnPageNotFoundHandler()),this._options.onmemorywarning&&(o.logger.log("Global Handler attached: onMemoryWarning"),this._installGlobalOnMemoryWarningHandler())},t.prototype._installGlobalOnErrorHandler=function(){if(!this._onErrorHandlerInstalled){if(a.sdk.onError){var t=i.getCurrentHub();a.sdk.onError((function(e){var n="string"==typeof e?new Error(e):e;t.captureException(n)}))}this._onErrorHandlerInstalled=!0}},t.prototype._installGlobalOnUnhandledRejectionHandler=function(){if(!this._onUnhandledRejectionHandlerInstalled){if(a.sdk.onUnhandledRejection){var t=i.getCurrentHub();a.sdk.onUnhandledRejection((function(e){var n=e.reason,r=e.promise,i="string"==typeof n?new Error(n):n;t.captureException(i,{data:r})}))}this._onUnhandledRejectionHandlerInstalled=!0}},t.prototype._installGlobalOnPageNotFoundHandler=function(){if(!this._onPageNotFoundHandlerInstalled){if(a.sdk.onPageNotFound){var t=i.getCurrentHub();a.sdk.onPageNotFound((function(e){var n=e.path.split("?")[0];t.setTag("pagenotfound",n),t.setExtra("message",JSON.stringify(e)),t.captureMessage("页面无法找到: "+n)}))}this._onPageNotFoundHandlerInstalled=!0}},t.prototype._installGlobalOnMemoryWarningHandler=function(){if(!this._onMemoryWarningHandlerInstalled){if(a.sdk.onMemoryWarning){var t=i.getCurrentHub();a.sdk.onMemoryWarning((function(e){var n=e.level,r=void 0===n?-1:n,i="没有获取到告警级别信息";switch(r){case 5:i="TRIM_MEMORY_RUNNING_MODERATE";break;case 10:i="TRIM_MEMORY_RUNNING_LOW";break;case 15:i="TRIM_MEMORY_RUNNING_CRITICAL";break;default:return}t.setTag("memory-warning",String(r)),t.setExtra("message",i),t.captureMessage("内存不足告警")}))}this._onMemoryWarningHandlerInstalled=!0}},t.id="GlobalHandlers",t}();e.GlobalHandlers=s},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.TryCatch=void 0;var r=n(2),i=n(36),o=function(){function t(){this._ignoreOnError=0,this.name=t.id}return t.prototype._wrapTimeFunction=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e[0];return e[0]=i.wrap(r,{mechanism:{data:{function:a(t)},handled:!0,type:"instrument"}}),t.apply(this,e)}},t.prototype._wrapRAF=function(t){return function(e){return t(i.wrap(e,{mechanism:{data:{function:"requestAnimationFrame",handler:a(t)},handled:!0,type:"instrument"}}))}},t.prototype._wrapEventTarget=function(t){var e=r.getGlobalObject(),n=e[t]&&e[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(r.fill(n,"addEventListener",(function(e){return function(n,r,o){try{"function"==typeof r.handleEvent&&(r.handleEvent=i.wrap(r.handleEvent.bind(r),{mechanism:{data:{function:"handleEvent",handler:a(r),target:t},handled:!0,type:"instrument"}}))}catch(t){}return e.call(this,n,i.wrap(r,{mechanism:{data:{function:"addEventListener",handler:a(r),target:t},handled:!0,type:"instrument"}}),o)}})),r.fill(n,"removeEventListener",(function(t){return function(e,n,r){var i=n;try{i=i&&(i.__sentry_wrapped__||i)}catch(t){}return t.call(this,e,i,r)}})))},t.prototype.setupOnce=function(){this._ignoreOnError=this._ignoreOnError;var t=r.getGlobalObject();r.fill(t,"setTimeout",this._wrapTimeFunction.bind(this)),r.fill(t,"setInterval",this._wrapTimeFunction.bind(this)),r.fill(t,"requestAnimationFrame",this._wrapRAF.bind(this)),["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"].forEach(this._wrapEventTarget.bind(this))},t.id="TryCatch",t}();function a(t){try{return t&&t.name||"<anonymous>"}catch(t){return"<anonymous>"}}e.TryCatch=o},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedErrors=void 0;var r=n(0),i=n(5),o=n(33),a=n(22),s=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this._key=e.key||"cause",this._limit=e.limit||5}return t.prototype.setupOnce=function(){i.addGlobalEventProcessor((function(e,n){var r=i.getCurrentHub().getIntegration(t);return r?r._handler(e,n):e}))},t.prototype._handler=function(t,e){if(!(t.exception&&t.exception.values&&e&&e.originalException instanceof Error))return t;var n=this._walkErrorTree(e.originalException,this._key);return t.exception.values=r.__spread(n,t.exception.values),t},t.prototype._walkErrorTree=function(t,e,n){if(void 0===n&&(n=[]),!(t[e]instanceof Error)||n.length+1>=this._limit)return n;var i=a.computeStackTrace(t[e]),s=o.exceptionFromStacktrace(i);return this._walkErrorTree(t[e],e,r.__spread([s],n))},t.id="LinkedErrors",t}();e.LinkedErrors=s},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.System=void 0;var r=n(0),i=n(5),o=n(15),a=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){i.addGlobalEventProcessor((function(e){if(i.getCurrentHub().getIntegration(t))try{var n=o.sdk.getSystemInfoSync(),a=n.SDKVersion,s=void 0===a?"0.0.0":a,u=n.batteryLevel,c=n.currentBattery,f=n.battery,d=n.brand,p=n.language,l=n.model,h=n.pixelRatio,_=n.platform,v=n.screenHeight,g=n.screenWidth,b=n.statusBarHeight,y=n.system,m=n.version,O=n.windowHeight,j=n.windowWidth,E=n.app,S=n.appName,w=n.fontSizeSetting,x=r.__read(y.split(" "),2),k=x[0],T=x[1];return r.__assign(r.__assign({},e),{contexts:r.__assign(r.__assign({},e.contexts),{device:{brand:d,battery_level:u||c||f,model:l,screen_dpi:h},os:{name:k||y,version:T||y},extra:r.__assign({SDKVersion:s,language:p,platform:_,screenHeight:v,screenWidth:g,statusBarHeight:b,version:m,windowHeight:O,windowWidth:j,fontSizeSetting:w,app:E||S||o.appName},n)})})}catch(t){console.warn("sentry-miniapp get system info fail: "+t)}return e}))},t.id="System",t}();e.System=a},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.Router=void 0;var r=n(0),i=n(5),o=function(){function t(e){this.name=t.id,this._options=r.__assign({enable:!0},e)}return t.prototype.setupOnce=function(){var e=this;i.addGlobalEventProcessor((function(n){if(i.getCurrentHub().getIntegration(t)&&e._options.enable)try{var o=getCurrentPages().map((function(t){return{route:t.route,options:t.options}}));return r.__assign(r.__assign({},n),{extra:r.__assign(r.__assign({},n.extra),{routers:o})})}catch(t){console.warn("sentry-miniapp get router info fail: "+t)}return n}))},t.id="Router",t}();e.Router=o},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.IgnoreMpcrawlerErrors=void 0;var r=n(5),i=n(15),o=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){r.addGlobalEventProcessor((function(e){if(r.getCurrentHub().getIntegration(t)&&"wechat"===i.appName&&i.sdk.getLaunchOptionsSync&&1129===i.sdk.getLaunchOptionsSync().scene)return null;return e}))},t.id="IgnoreMpcrawlerErrors",t}();e.IgnoreMpcrawlerErrors=o}]);
//# sourceMappingURL=sentry-miniapp.wx.min.js.map
\ No newline at end of file
function encodeUTF8(s) {
var i, r = [], c, x;
for (i = 0; i < s.length; i++)
if ((c = s.charCodeAt(i)) < 0x80) r.push(c);
else if (c < 0x800) r.push(0xC0 + (c >> 6 & 0x1F), 0x80 + (c & 0x3F));
else {
if ((x = c ^ 0xD800) >> 10 == 0) //对四字节UTF-16转换为Unicode
c = (x << 10) + (s.charCodeAt(++i) ^ 0xDC00) + 0x10000,
r.push(0xF0 + (c >> 18 & 0x7), 0x80 + (c >> 12 & 0x3F));
else r.push(0xE0 + (c >> 12 & 0xF));
r.push(0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F));
};
return r;
}
// 字符串加密成 hex 字符串
function sha1(s) {
var data = new Uint8Array(encodeUTF8(s))
var i, j, t;
var l = ((data.length + 8) >>> 6 << 4) + 16, s = new Uint8Array(l << 2);
s.set(new Uint8Array(data.buffer)), s = new Uint32Array(s.buffer);
for (t = new DataView(s.buffer), i = 0; i < l; i++)s[i] = t.getUint32(i << 2);
s[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8);
s[l - 1] = data.length << 3;
var w = [], f = [
function () { return m[1] & m[2] | ~m[1] & m[3]; },
function () { return m[1] ^ m[2] ^ m[3]; },
function () { return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; },
function () { return m[1] ^ m[2] ^ m[3]; }
], rol = function (n, c) { return n << c | n >>> (32 - c); },
k = [1518500249, 1859775393, -1894007588, -899497514],
m = [1732584193, -271733879, null, null, -1009589776];
m[2] = ~m[0], m[3] = ~m[1];
for (i = 0; i < s.length; i += 16) {
var o = m.slice(0);
for (j = 0; j < 80; j++)
w[j] = j < 16 ? s[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1),
t = rol(m[0], 5) + f[j / 20 | 0]() + m[4] + w[j] + k[j / 20 | 0] | 0,
m[1] = rol(m[1], 30), m.pop(), m.unshift(t);
for (j = 0; j < 5; j++)m[j] = m[j] + o[j] | 0;
};
t = new DataView(new Uint32Array(m).buffer);
for (var i = 0; i < 5; i++)m[i] = t.getUint32(i << 2);
var hex = Array.prototype.map.call(new Uint8Array(new Uint32Array(m).buffer), function (e) {
return (e < 16 ? "0" : "") + e.toString(16);
}).join("");
return hex;
}
module.exports = sha1
/**
* weapp.qrcode.js v1.0.0 (https://github.com/yingye/weapp-qrcode#readme)
*/
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? (module.exports = factory()) : typeof define === 'function' && define.amd ? define(factory) : (global.drawQrcode = factory())
})(this, function () {
'use strict'
var hasOwn = Object.prototype.hasOwnProperty
var toStr = Object.prototype.toString
var defineProperty = Object.defineProperty
var gOPD = Object.getOwnPropertyDescriptor
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
return Array.isArray(arr)
}
return toStr.call(arr) === '[object Array]'
}
var isPlainObject = function isPlainObject(obj) {
if (!obj || toStr.call(obj) !== '[object Object]') {
return false
}
var hasOwnConstructor = hasOwn.call(obj, 'constructor')
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')
// Not own constructor property must be Object
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
return false
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key
for (key in obj) {
/**/
}
return typeof key === 'undefined' || hasOwn.call(obj, key)
}
// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
var setProperty = function setProperty(target, options) {
if (defineProperty && options.name === '__proto__') {
defineProperty(target, options.name, {
enumerable: true,
configurable: true,
value: options.newValue,
writable: true
})
} else {
target[options.name] = options.newValue
}
}
// Return undefined instead of __proto__ if '__proto__' is not an own property
var getProperty = function getProperty(obj, name) {
if (name === '__proto__') {
if (!hasOwn.call(obj, name)) {
return void 0
} else if (gOPD) {
// In early versions of node, obj['__proto__'] is buggy when obj has
// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
return gOPD(obj, name).value
}
}
return obj[name]
}
var extend = function extend() {
var options, name, src, copy, copyIsArray, clone
var target = arguments[0]
var i = 1
var length = arguments.length
var deep = false
// Handle a deep copy situation
if (typeof target === 'boolean') {
deep = target
target = arguments[1] || {}
// skip the boolean and the target
i = 2
}
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
target = {}
}
for (; i < length; ++i) {
options = arguments[i]
// Only deal with non-null/undefined values
if (options != null) {
// Extend the base object
for (name in options) {
src = getProperty(target, name)
copy = getProperty(options, name)
// Prevent never-ending loop
if (target !== copy) {
// Recurse if we're merging plain objects or arrays
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false
clone = src && isArray(src) ? src : []
} else {
clone = src && isPlainObject(src) ? src : {}
}
// Never move original objects, clone them
setProperty(target, { name: name, newValue: extend(deep, clone, copy) })
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
setProperty(target, { name: name, newValue: copy })
}
}
}
}
}
// Return the modified object
return target
}
//---------------------------------------------------------------------
// QRCode for JavaScript
//
// Copyright (c) 2009 Kazuhiko Arase
//
// URL: http://www.d-project.com/
//
// Licensed under the MIT license:
// http://www.opensource.org/licenses/mit-license.php
//
// The word "QR Code" is registered trademark of
// DENSO WAVE INCORPORATED
// http://www.denso-wave.com/qrcode/faqpatent-e.html
//
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// QR8bitByte
//---------------------------------------------------------------------
function QR8bitByte(data) {
this.mode = QRMode.MODE_8BIT_BYTE
this.data = data
}
QR8bitByte.prototype = {
getLength: function (buffer) {
return this.data.length
},
write: function (buffer) {
for (var i = 0; i < this.data.length; i++) {
// not JIS ...
buffer.put(this.data.charCodeAt(i), 8)
}
}
}
//---------------------------------------------------------------------
// QRCode
//---------------------------------------------------------------------
function QRCode(typeNumber, errorCorrectLevel) {
this.typeNumber = typeNumber
this.errorCorrectLevel = errorCorrectLevel
this.modules = null
this.moduleCount = 0
this.dataCache = null
this.dataList = new Array()
}
QRCode.prototype = {
addData: function (data) {
var newData = new QR8bitByte(data)
this.dataList.push(newData)
this.dataCache = null
},
isDark: function (row, col) {
if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
throw new Error(row + ',' + col)
}
return this.modules[row][col]
},
getModuleCount: function () {
return this.moduleCount
},
make: function () {
// Calculate automatically typeNumber if provided is < 1
if (this.typeNumber < 1) {
var typeNumber = 1
for (typeNumber = 1; typeNumber < 40; typeNumber++) {
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel)
var buffer = new QRBitBuffer()
var totalDataCount = 0
for (var i = 0; i < rsBlocks.length; i++) {
totalDataCount += rsBlocks[i].dataCount
}
for (var i = 0; i < this.dataList.length; i++) {
var data = this.dataList[i]
buffer.put(data.mode, 4)
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber))
data.write(buffer)
}
if (buffer.getLengthInBits() <= totalDataCount * 8) break
}
this.typeNumber = typeNumber
}
this.makeImpl(false, this.getBestMaskPattern())
},
makeImpl: function (test, 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)
for (var col = 0; col < this.moduleCount; col++) {
this.modules[row][col] = null //(col + row) % 3;
}
}
this.setupPositionProbePattern(0, 0)
this.setupPositionProbePattern(this.moduleCount - 7, 0)
this.setupPositionProbePattern(0, this.moduleCount - 7)
this.setupPositionAdjustPattern()
this.setupTimingPattern()
this.setupTypeInfo(test, maskPattern)
if (this.typeNumber >= 7) {
this.setupTypeNumber(test)
}
if (this.dataCache == null) {
this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList)
}
this.mapData(this.dataCache, maskPattern)
},
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
}
}
}
},
getBestMaskPattern: function () {
var minLostPoint = 0
var pattern = 0
for (var i = 0; i < 8; i++) {
this.makeImpl(true, i)
var lostPoint = QRUtil.getLostPoint(this)
if (i == 0 || minLostPoint > lostPoint) {
minLostPoint = lostPoint
pattern = i
}
}
return pattern
},
createMovieClip: function (target_mc, instance_name, depth) {
var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth)
var cs = 1
this.make()
for (var row = 0; row < this.modules.length; row++) {
var y = row * cs
for (var col = 0; col < this.modules[row].length; col++) {
var x = col * cs
var dark = this.modules[row][col]
if (dark) {
qr_mc.beginFill(0, 100)
qr_mc.moveTo(x, y)
qr_mc.lineTo(x + cs, y)
qr_mc.lineTo(x + cs, y + cs)
qr_mc.lineTo(x, y + cs)
qr_mc.endFill()
}
}
}
return qr_mc
},
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
}
for (var c = 8; c < this.moduleCount - 8; c++) {
if (this.modules[6][c] != null) {
continue
}
this.modules[6][c] = c % 2 == 0
}
},
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
}
}
}
}
}
},
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
}
for (var i = 0; i < 18; i++) {
var mod = !test && ((bits >> i) & 1) == 1
this.modules[(i % 3) + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod
}
},
setupTypeInfo: function (test, maskPattern) {
var data = (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
for (var i = 0; i < 15; i++) {
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
},
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
}
}
}
}
}
QRCode.PAD0 = 0xec
QRCode.PAD1 = 0x11
QRCode.createData = function (typeNumber, errorCorrectLevel, dataList) {
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel)
var buffer = new QRBitBuffer()
for (var i = 0; i < dataList.length; i++) {
var data = dataList[i]
buffer.put(data.mode, 4)
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber))
data.write(buffer)
}
// calc num max data.
var totalDataCount = 0
for (var i = 0; i < rsBlocks.length; i++) {
totalDataCount += rsBlocks[i].dataCount
}
if (buffer.getLengthInBits() > totalDataCount * 8) {
throw new Error('code length overflow. (' + buffer.getLengthInBits() + '>' + totalDataCount * 8 + ')')
}
// end code
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
buffer.put(0, 4)
}
// padding
while (buffer.getLengthInBits() % 8 != 0) {
buffer.putBit(false)
}
// padding
while (true) {
if (buffer.getLengthInBits() >= totalDataCount * 8) {
break
}
buffer.put(QRCode.PAD0, 8)
if (buffer.getLengthInBits() >= totalDataCount * 8) {
break
}
buffer.put(QRCode.PAD1, 8)
}
return QRCode.createBytes(buffer, rsBlocks)
}
QRCode.createBytes = function (buffer, rsBlocks) {
var offset = 0
var maxDcCount = 0
var maxEcCount = 0
var dcdata = new Array(rsBlocks.length)
var ecdata = new Array(rsBlocks.length)
for (var r = 0; r < rsBlocks.length; r++) {
var dcCount = rsBlocks[r].dataCount
var ecCount = rsBlocks[r].totalCount - 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 totalCodeCount = 0
for (var i = 0; i < rsBlocks.length; i++) {
totalCodeCount += rsBlocks[i].totalCount
}
var data = new Array(totalCodeCount)
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
}
//---------------------------------------------------------------------
// QRMode
//---------------------------------------------------------------------
var QRMode = {
MODE_NUMBER: 1 << 0,
MODE_ALPHA_NUM: 1 << 1,
MODE_8BIT_BYTE: 1 << 2,
MODE_KANJI: 1 << 3
}
//---------------------------------------------------------------------
// QRErrorCorrectLevel
//---------------------------------------------------------------------
var QRErrorCorrectLevel = {
L: 1,
M: 0,
Q: 3,
H: 2
}
//---------------------------------------------------------------------
// QRMaskPattern
//---------------------------------------------------------------------
var QRMaskPattern = {
PATTERN000: 0,
PATTERN001: 1,
PATTERN010: 2,
PATTERN011: 3,
PATTERN100: 4,
PATTERN101: 5,
PATTERN110: 6,
PATTERN111: 7
}
//---------------------------------------------------------------------
// QRUtil
//---------------------------------------------------------------------
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),
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
},
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
},
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)
}
},
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
},
getLengthInBits: function (mode, type) {
if (1 <= type && type < 10) {
// 1 - 9
switch (mode) {
case QRMode.MODE_NUMBER:
return 10
case QRMode.MODE_ALPHA_NUM:
return 9
case QRMode.MODE_8BIT_BYTE:
return 8
case QRMode.MODE_KANJI:
return 8
default:
throw new Error('mode:' + mode)
}
} else if (type < 27) {
// 10 - 26
switch (mode) {
case QRMode.MODE_NUMBER:
return 12
case QRMode.MODE_ALPHA_NUM:
return 11
case QRMode.MODE_8BIT_BYTE:
return 16
case QRMode.MODE_KANJI:
return 10
default:
throw new Error('mode:' + mode)
}
} else if (type < 41) {
// 27 - 40
switch (mode) {
case QRMode.MODE_NUMBER:
return 14
case QRMode.MODE_ALPHA_NUM:
return 13
case QRMode.MODE_8BIT_BYTE:
return 16
case QRMode.MODE_KANJI:
return 12
default:
throw new Error('mode:' + mode)
}
} else {
throw new Error('type:' + type)
}
},
getLostPoint: function (qrCode) {
var moduleCount = qrCode.getModuleCount()
var lostPoint = 0
// LEVEL1
for (var row = 0; row < moduleCount; row++) {
for (var col = 0; col < moduleCount; col++) {
var sameCount = 0
var dark = qrCode.isDark(row, col)
for (var r = -1; r <= 1; r++) {
if (row + r < 0 || moduleCount <= row + r) {
continue
}
for (var c = -1; c <= 1; c++) {
if (col + c < 0 || moduleCount <= col + c) {
continue
}
if (r == 0 && c == 0) {
continue
}
if (dark == qrCode.isDark(row + r, col + c)) {
sameCount++
}
}
}
if (sameCount > 5) {
lostPoint += 3 + sameCount - 5
}
}
}
// LEVEL2
for (var row = 0; row < moduleCount - 1; row++) {
for (var col = 0; col < moduleCount - 1; col++) {
var count = 0
if (qrCode.isDark(row, col)) count++
if (qrCode.isDark(row + 1, col)) count++
if (qrCode.isDark(row, col + 1)) count++
if (qrCode.isDark(row + 1, col + 1)) count++
if (count == 0 || count == 4) {
lostPoint += 3
}
}
}
// LEVEL3
for (var row = 0; row < moduleCount; row++) {
for (var col = 0; col < moduleCount - 6; col++) {
if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
lostPoint += 40
}
}
}
for (var col = 0; col < moduleCount; col++) {
for (var row = 0; row < moduleCount - 6; row++) {
if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
lostPoint += 40
}
}
}
// LEVEL4
var darkCount = 0
for (var col = 0; col < moduleCount; col++) {
for (var row = 0; row < moduleCount; row++) {
if (qrCode.isDark(row, col)) {
darkCount++
}
}
}
var ratio = Math.abs((100 * darkCount) / moduleCount / moduleCount - 50) / 5
lostPoint += ratio * 10
return lostPoint
}
}
//---------------------------------------------------------------------
// QRMath
//---------------------------------------------------------------------
var QRMath = {
glog: function (n) {
if (n < 1) {
throw new Error('glog(' + n + ')')
}
return QRMath.LOG_TABLE[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
//---------------------------------------------------------------------
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
},
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)
},
mod: function (e) {
if (this.getLength() - e.getLength() < 0) {
return this
}
var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0))
var num = new Array(this.getLength())
for (var i = 0; i < this.getLength(); i++) {
num[i] = this.get(i)
}
for (var i = 0; i < e.getLength(); i++) {
num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio)
}
// recursive call
return new QRPolynomial(num, 0).mod(e)
}
}
//---------------------------------------------------------------------
// QRRSBlock
//---------------------------------------------------------------------
function QRRSBlock(totalCount, dataCount) {
this.totalCount = totalCount
this.dataCount = dataCount
}
QRRSBlock.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]
]
QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel)
if (rsBlock == undefined) {
throw new Error('bad rs block @ typeNumber:' + typeNumber + '/errorCorrectLevel:' + errorCorrectLevel)
}
var length = rsBlock.length / 3
var list = new Array()
for (var i = 0; i < length; i++) {
var count = rsBlock[i * 3 + 0]
var totalCount = rsBlock[i * 3 + 1]
var dataCount = rsBlock[i * 3 + 2]
for (var j = 0; j < count; j++) {
list.push(new QRRSBlock(totalCount, dataCount))
}
}
return list
}
QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) {
switch (errorCorrectLevel) {
case QRErrorCorrectLevel.L:
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]
case QRErrorCorrectLevel.M:
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]
case QRErrorCorrectLevel.Q:
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]
case QRErrorCorrectLevel.H:
return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]
default:
return undefined
}
}
//---------------------------------------------------------------------
// 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) == 1
},
put: function (num, length) {
for (var i = 0; i < length; i++) {
this.putBit(((num >>> (length - i - 1)) & 1) == 1)
}
},
getLengthInBits: function () {
return this.length
},
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++
}
}
// support Chinese
function utf16to8(str) {
var out, i, len, c
out = ''
len = str.length
for (i = 0; i < len; i++) {
c = str.charCodeAt(i)
if (c >= 0x0001 && c <= 0x007f) {
out += str.charAt(i)
} else if (c > 0x07ff) {
out += String.fromCharCode(0xe0 | ((c >> 12) & 0x0f))
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3f))
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3f))
} else {
out += String.fromCharCode(0xc0 | ((c >> 6) & 0x1f))
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3f))
}
}
return out
}
function drawQrcode(options) {
options = options || {}
options = extend(
true,
{
width: 256,
height: 256,
x: 0,
y: 0,
typeNumber: -1,
correctLevel: QRErrorCorrectLevel.H,
background: '#ffffff',
foreground: '#000000',
image: {
imageResource: '',
dx: 0,
dy: 0,
dWidth: 100,
dHeight: 100
}
},
options
)
if (!options.canvasId && !options.ctx) {
console.warn('please set canvasId or ctx!')
return
}
createCanvas()
function createCanvas() {
// create the qrcode itself
var qrcode = new QRCode(options.typeNumber, options.correctLevel)
qrcode.addData(utf16to8(options.text))
qrcode.make()
// get canvas context
var ctx
if (options.ctx) {
ctx = options.ctx
} else {
ctx = options._this ? wx.createCanvasContext && wx.createCanvasContext(options.canvasId, options._this) : wx.createCanvasContext && wx.createCanvasContext(options.canvasId)
}
// compute tileW/tileH based on options.width/options.height
var tileW = options.width / qrcode.getModuleCount()
var tileH = options.height / qrcode.getModuleCount()
// draw in the canvas
for (var row = 0; row < qrcode.getModuleCount(); row++) {
for (var col = 0; col < qrcode.getModuleCount(); col++) {
var style = qrcode.isDark(row, col) ? options.foreground : options.background
ctx.setFillStyle(style)
var w = Math.ceil((col + 1) * tileW) - Math.floor(col * tileW)
var h = Math.ceil((row + 1) * tileW) - Math.floor(row * tileW)
ctx.fillRect(Math.round(col * tileW) + options.x, Math.round(row * tileH) + options.y, w, h)
}
}
if (options.image.imageResource) {
ctx.drawImage(options.image.imageResource, options.image.dx, options.image.dy, options.image.dWidth, options.image.dHeight)
}
ctx.draw(false, function (e) {
options.callback && options.callback(e)
})
}
}
return drawQrcode
})
function e(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,a)}return o}function t(t){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?e(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var a=["canvasGetImageData","canvasPutImageData","canvasToTempFilePath","setEnableDebug","startAccelerometer","stopAccelerometer","getBatteryInfo","getClipboardData","setClipboardData","startCompass","stopCompass","addPhoneContact","startGyroscope","stopGyroscope","startBeaconDiscovery","stopBeaconDiscovery","getBeacons","startLocalServiceDiscovery","stopLocalServiceDiscovery","startDeviceMotionListening","stopDeviceMotionListening","getNetworkType","makePhoneCall","scanCode","getSystemInfo","vibrateShort","vibrateLong","getExtConfig","chooseLocation","getLocation","openLocation","chooseMessageFile","loadFontFace","chooseImage","previewImage","getImageInfo","saveImageToPhotosAlbum","compressImage","chooseVideo","saveVideoToPhotosAlbum","downloadFile","request","connectSocket","closeSocket","sendSocketMessage","uploadFile","login","checkSession","chooseAddress","authorize","addCard","openCard","chooseInvoice","chooseInvoiceTitle","getUserInfo","requestPayment","getWeRunData","showModal","showToast","hideToast","showLoading","hideLoading","showActionSheet","pageScrollTo","startPullDownRefresh","stopPullDownRefresh","setBackgroundColor","setBackgroundTextStyle","setTabBarBadge","removeTabBarBadge","showTabBarRedDot","hideTabBarRedDot","showTabBar","hideTabBar","setTabBarStyle","setTabBarItem","setTopBarText","saveFile","openDocument","getSavedFileList","getSavedFileInfo","removeSavedFile","getFileInfo","getStorage","setStorage","removeStorage","clearStorage","getStorageInfo","closeBLEConnection","closeBluetoothAdapter","createBLEConnection","getBLEDeviceCharacteristics","getBLEDeviceServices","getBluetoothAdapterState","getBluetoothDevices","getConnectedBluetoothDevices","notifyBLECharacteristicValueChange","openBluetoothAdapter","readBLECharacteristicValue","startBluetoothDevicesDiscovery","stopBluetoothDevicesDiscovery","writeBLECharacteristicValue","getHCEState","sendHCEMessage","startHCE","stopHCE","getScreenBrightness","setKeepScreenOn","setScreenBrightness","connectWifi","getConnectedWifi","getWifiList","setWifiList","startWifi","stopWifi","getBackgroundAudioPlayerState","playBackgroundAudio","pauseBackgroundAudio","seekBackgroundAudio","stopBackgroundAudio","getAvailableAudioSources","startRecord","stopRecord","setInnerAudioOption","playVoice","pauseVoice","stopVoice","getSetting","openSetting","getShareInfo","hideShareMenu","showShareMenu","updateShareMenu","checkIsSoterEnrolledInDevice","checkIsSupportSoterAuthentication","startSoterAuthentication","navigateBackMiniProgram","navigateToMiniProgram","setNavigationBarTitle","showNavigationBarLoading","hideNavigationBarLoading","setNavigationBarColor","redirectTo","reLaunch","navigateTo","switchTab","navigateBack"];Promise.prototype.finally||(Promise.prototype.finally=function(e){var t=this.constructor;return this.then((function(o){return t.resolve(e()).then((function(){return o}))}),(function(o){return t.resolve(e()).then((function(){throw o}))}))});var r=function(e){return function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise((function(a,r){e(t({fail:r,success:a},o))}))}},n=function(){wx.pro={},Object.keys(wx).forEach((function(e){a.indexOf(e)>=0?wx.pro[e]=r(wx[e]):"createSignal"!==e&&"lanDebug"!==e&&(wx.pro[e]=wx[e])}))};export{r as promisify,n as promisifyAll};
//# sourceMappingURL=wx-promise-pro.js.map
const getUpdateManager = () => {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
})
}
export default getUpdateManager
//---------------------------------------------------------------------
//
// QR Code Generator for JavaScript
//
// Copyright (c) 2009 Kazuhiko Arase
//
// URL: [url=http://www.d-project.com/]http://www.d-project.com/[/url]
//
// Licensed under the MIT license:
// [url=http://www.opensource.org/licenses/mit-license.php]http://www.opensource.org/licenses/mit-license.php[/url]
//
// The word 'QR Code' is registered trademark of
// DENSO WAVE INCORPORATED
// [url=http://www.denso-wave.com/qrcode/faqpatent-e.html]http://www.denso-wave.com/qrcode/faqpatent-e.html[/url]
//
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// qrcode
//代码第1588行为补充代码
//修改人:chenxing
//2017-02-27 16:21:32
//---------------------------------------------------------------------
/**
* qrcode
* @param typeNumber 1 to 40
* @param errorCorrectLevel 'L','M','Q','H'
*/
var qrcode = function(typeNumber, errorCorrectLevel) {
var PAD0 = 0xEC;
var PAD1 = 0x11;
var _typeNumber = typeNumber;
var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];
var _modules = null;
var _moduleCount = 0;
var _dataCache = null;
var _dataList = new Array();
var _this = {};
var makeImpl = function(test, maskPattern) {
_moduleCount = _typeNumber * 4 + 17;
_modules = function(moduleCount) {
var modules = new Array(moduleCount);
for (var row = 0; row < moduleCount; row += 1) {
modules[row] = new Array(moduleCount);
for (var col = 0; col < moduleCount; col += 1) {
modules[row][col] = null;
}
}
return modules;
}(_moduleCount);
setupPositionProbePattern(0, 0);
setupPositionProbePattern(_moduleCount - 7, 0);
setupPositionProbePattern(0, _moduleCount - 7);
setupPositionAdjustPattern();
setupTimingPattern();
setupTypeInfo(test, maskPattern);
if (_typeNumber >= 7) {
setupTypeNumber(test);
}
if (_dataCache == null) {
_dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);
}
mapData(_dataCache, maskPattern);
};
var setupPositionProbePattern = function(row, col) {
for (var r = -1; r <= 7; r += 1) {
if (row + r <= -1 || _moduleCount <= row + r) continue;
for (var c = -1; c <= 7; c += 1) {
if (col + c <= -1 || _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) ) {
_modules[row + r][col + c] = true;
} else {
_modules[row + r][col + c] = false;
}
}
}
};
var getBestMaskPattern = function() {
var minLostPoint = 0;
var pattern = 0;
for (var i = 0; i < 8; i += 1) {
makeImpl(true, i);
var lostPoint = QRUtil.getLostPoint(_this);
if (i == 0 || minLostPoint > lostPoint) {
minLostPoint = lostPoint;
pattern = i;
}
}
return pattern;
};
var setupTimingPattern = function() {
for (var r = 8; r < _moduleCount - 8; r += 1) {
if (_modules[r][6] != null) {
continue;
}
_modules[r][6] = (r % 2 == 0);
}
for (var c = 8; c < _moduleCount - 8; c += 1) {
if (_modules[6][c] != null) {
continue;
}
_modules[6][c] = (c % 2 == 0);
}
};
var setupPositionAdjustPattern = function() {
var pos = QRUtil.getPatternPosition(_typeNumber);
for (var i = 0; i < pos.length; i += 1) {
for (var j = 0; j < pos.length; j += 1) {
var row = pos[i];
var col = pos[j];
if (_modules[row][col] != null) {
continue;
}
for (var r = -2; r <= 2; r += 1) {
for (var c = -2; c <= 2; c += 1) {
if (r == -2 || r == 2 || c == -2 || c == 2
|| (r == 0 && c == 0) ) {
_modules[row + r][col + c] = true;
} else {
_modules[row + r][col + c] = false;
}
}
}
}
}
};
var setupTypeNumber = function(test) {
var bits = QRUtil.getBCHTypeNumber(_typeNumber);
for (var i = 0; i < 18; i += 1) {
var mod = (!test && ( (bits >> i) & 1) == 1);
_modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
}
for (var i = 0; i < 18; i += 1) {
var mod = (!test && ( (bits >> i) & 1) == 1);
_modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
}
};
var setupTypeInfo = function(test, maskPattern) {
var data = (_errorCorrectLevel << 3) | maskPattern;
var bits = QRUtil.getBCHTypeInfo(data);
// vertical
for (var i = 0; i < 15; i += 1) {
var mod = (!test && ( (bits >> i) & 1) == 1);
if (i < 6) {
_modules[i][8] = mod;
} else if (i < 8) {
_modules[i + 1][8] = mod;
} else {
_modules[_moduleCount - 15 + i][8] = mod;
}
}
// horizontal
for (var i = 0; i < 15; i += 1) {
var mod = (!test && ( (bits >> i) & 1) == 1);
if (i < 8) {
_modules[8][_moduleCount - i - 1] = mod;
} else if (i < 9) {
_modules[8][15 - i - 1 + 1] = mod;
} else {
_modules[8][15 - i - 1] = mod;
}
}
// fixed module
_modules[_moduleCount - 8][8] = (!test);
};
var mapData = function(data, maskPattern) {
var inc = -1;
var row = _moduleCount - 1;
var bitIndex = 7;
var byteIndex = 0;
var maskFunc = QRUtil.getMaskFunction(maskPattern);
for (var col = _moduleCount - 1; col > 0; col -= 2) {
if (col == 6) col -= 1;
while (true) {
for (var c = 0; c < 2; c += 1) {
if (_modules[row][col - c] == null) {
var dark = false;
if (byteIndex < data.length) {
dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);
}
var mask = maskFunc(row, col - c);
if (mask) {
dark = !dark;
}
_modules[row][col - c] = dark;
bitIndex -= 1;
if (bitIndex == -1) {
byteIndex += 1;
bitIndex = 7;
}
}
}
row += inc;
if (row < 0 || _moduleCount <= row) {
row -= inc;
inc = -inc;
break;
}
}
}
};
var createBytes = function(buffer, rsBlocks) {
var offset = 0;
var maxDcCount = 0;
var maxEcCount = 0;
var dcdata = new Array(rsBlocks.length);
var ecdata = new Array(rsBlocks.length);
for (var r = 0; r < rsBlocks.length; r += 1) {
var dcCount = rsBlocks[r].dataCount;
var ecCount = rsBlocks[r].totalCount - 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 += 1) {
dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
}
offset += dcCount;
var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
var rawPoly = 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 += 1) {
var modIndex = i + modPoly.getLength() - ecdata[r].length;
ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0;
}
}
var totalCodeCount = 0;
for (var i = 0; i < rsBlocks.length; i += 1) {
totalCodeCount += rsBlocks[i].totalCount;
}
var data = new Array(totalCodeCount);
var index = 0;
for (var i = 0; i < maxDcCount; i += 1) {
for (var r = 0; r < rsBlocks.length; r += 1) {
if (i < dcdata[r].length) {
data[index] = dcdata[r][i];
index += 1;
}
}
}
for (var i = 0; i < maxEcCount; i += 1) {
for (var r = 0; r < rsBlocks.length; r += 1) {
if (i < ecdata[r].length) {
data[index] = ecdata[r][i];
index += 1;
}
}
}
return data;
};
var createData = function(typeNumber, errorCorrectLevel, dataList) {
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
var buffer = qrBitBuffer();
for (var i = 0; i < dataList.length; i += 1) {
var data = dataList[i];
buffer.put(data.getMode(), 4);
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
data.write(buffer);
}
// calc num max data.
var totalDataCount = 0;
for (var i = 0; i < rsBlocks.length; i += 1) {
totalDataCount += rsBlocks[i].dataCount;
}
if (buffer.getLengthInBits() > totalDataCount * 8) {
throw new Error('code length overflow. ('
+ buffer.getLengthInBits()
+ '>'
+ totalDataCount * 8
+ ')');
}
// end code
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
buffer.put(0, 4);
}
// padding
while (buffer.getLengthInBits() % 8 != 0) {
buffer.putBit(false);
}
// padding
while (true) {
if (buffer.getLengthInBits() >= totalDataCount * 8) {
break;
}
buffer.put(PAD0, 8);
if (buffer.getLengthInBits() >= totalDataCount * 8) {
break;
}
buffer.put(PAD1, 8);
}
return createBytes(buffer, rsBlocks);
};
_this.addData = function(data) {
var newData = qr8BitByte(data);
_dataList.push(newData);
_dataCache = null;
};
_this.isDark = function(row, col) {
if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
throw new Error(row + ',' + col);
}
return _modules[row][col];
};
_this.getModuleCount = function() {
return _moduleCount;
};
_this.make = function() {
makeImpl(false, getBestMaskPattern() );
};
_this.createTableTag = function(cellSize, margin) {
cellSize = cellSize || 2;
margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
var qrHtml = '';
qrHtml += '<table style="';
qrHtml += ' border-width: 0px; border-style: none;';
qrHtml += ' border-collapse: collapse;';
qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
qrHtml += '">';
qrHtml += '<tbody>';
for (var r = 0; r < _this.getModuleCount(); r += 1) {
qrHtml += '<tr>';
for (var c = 0; c < _this.getModuleCount(); c += 1) {
qrHtml += '<td style="';
qrHtml += ' border-width: 0px; border-style: none;';
qrHtml += ' border-collapse: collapse;';
qrHtml += ' padding: 0px; margin: 0px;';
qrHtml += ' width: ' + cellSize + 'px;';
qrHtml += ' height: ' + cellSize + 'px;';
qrHtml += ' background-color: ';
qrHtml += _this.isDark(r, c)? '#000000' : '#ffffff';
qrHtml += ';';
qrHtml += '"/>';
}
qrHtml += '</tr>';
}
qrHtml += '</tbody>';
qrHtml += '</table>';
return qrHtml;
};
_this.createImgTag = function(cellSize, margin, size) {
cellSize = cellSize || 2;
margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
var min = margin;
var max = _this.getModuleCount() * cellSize + margin;
return createImgTag(size, size, function(x, y) {
if (min <= x && x < max && min <= y && y < max) {
var c = Math.floor( (x - min) / cellSize);
var r = Math.floor( (y - min) / cellSize);
return _this.isDark(r, c)? 0 : 1;
} else {
return 1;
}
} );
};
return _this;
};
//---------------------------------------------------------------------
// qrcode.stringToBytes
//---------------------------------------------------------------------
qrcode.stringToBytes = function(s) {
var bytes = new Array();
for (var i = 0; i < s.length; i += 1) {
var c = s.charCodeAt(i);
bytes.push(c & 0xff);
}
return bytes;
};
//---------------------------------------------------------------------
// qrcode.createStringToBytes
//---------------------------------------------------------------------
/**
* @param unicodeData base64 string of byte array.
* [16bit Unicode],[16bit Bytes], ...
* @param numChars
*/
qrcode.createStringToBytes = function(unicodeData, numChars) {
// create conversion map.
var unicodeMap = function() {
var bin = base64DecodeInputStream(unicodeData);
var read = function() {
var b = bin.read();
if (b == -1) throw new Error();
return b;
};
var count = 0;
var unicodeMap = {};
while (true) {
var b0 = bin.read();
if (b0 == -1) break;
var b1 = read();
var b2 = read();
var b3 = read();
var k = String.fromCharCode( (b0 << 8) | b1);
var v = (b2 << 8) | b3;
unicodeMap[k] = v;
count += 1;
}
if (count != numChars) {
throw new Error(count + ' != ' + numChars);
}
return unicodeMap;
}();
var unknownChar = '?'.charCodeAt(0);
return function(s) {
var bytes = new Array();
for (var i = 0; i < s.length; i += 1) {
var c = s.charCodeAt(i);
if (c < 128) {
bytes.push(c);
} else {
var b = unicodeMap[s.charAt(i)];
if (typeof b == 'number') {
if ( (b & 0xff) == b) {
// 1byte
bytes.push(b);
} else {
// 2bytes
bytes.push(b >>> 8);
bytes.push(b & 0xff);
}
} else {
bytes.push(unknownChar);
}
}
}
return bytes;
};
};
//---------------------------------------------------------------------
// QRMode
//---------------------------------------------------------------------
var QRMode = {
MODE_NUMBER : 1 << 0,
MODE_ALPHA_NUM : 1 << 1,
MODE_8BIT_BYTE : 1 << 2,
MODE_KANJI : 1 << 3
};
//---------------------------------------------------------------------
// QRErrorCorrectLevel
//---------------------------------------------------------------------
var QRErrorCorrectLevel = {
L : 1,
M : 0,
Q : 3,
H : 2
};
//---------------------------------------------------------------------
// QRMaskPattern
//---------------------------------------------------------------------
var QRMaskPattern = {
PATTERN000 : 0,
PATTERN001 : 1,
PATTERN010 : 2,
PATTERN011 : 3,
PATTERN100 : 4,
PATTERN101 : 5,
PATTERN110 : 6,
PATTERN111 : 7
};
//---------------------------------------------------------------------
// QRUtil
//---------------------------------------------------------------------
var QRUtil = function() {
var 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]
];
var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
var _this = {};
var getBCHDigit = function(data) {
var digit = 0;
while (data != 0) {
digit += 1;
data >>>= 1;
}
return digit;
};
_this.getBCHTypeInfo = function(data) {
var d = data << 10;
while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) );
}
return ( (data << 10) | d) ^ G15_MASK;
};
_this.getBCHTypeNumber = function(data) {
var d = data << 12;
while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) );
}
return (data << 12) | d;
};
_this.getPatternPosition = function(typeNumber) {
return PATTERN_POSITION_TABLE[typeNumber - 1];
};
_this.getMaskFunction = function(maskPattern) {
switch (maskPattern) {
case QRMaskPattern.PATTERN000 :
return function(i, j) { return (i + j) % 2 == 0; };
case QRMaskPattern.PATTERN001 :
return function(i, j) { return i % 2 == 0; };
case QRMaskPattern.PATTERN010 :
return function(i, j) { return j % 3 == 0; };
case QRMaskPattern.PATTERN011 :
return function(i, j) { return (i + j) % 3 == 0; };
case QRMaskPattern.PATTERN100 :
return function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; };
case QRMaskPattern.PATTERN101 :
return function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; };
case QRMaskPattern.PATTERN110 :
return function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; };
case QRMaskPattern.PATTERN111 :
return function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; };
default :
throw new Error('bad maskPattern:' + maskPattern);
}
};
_this.getErrorCorrectPolynomial = function(errorCorrectLength) {
var a = qrPolynomial([1], 0);
for (var i = 0; i < errorCorrectLength; i += 1) {
a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) );
}
return a;
};
_this.getLengthInBits = function(mode, type) {
if (1 <= type && type < 10) {
// 1 - 9
switch(mode) {
case QRMode.MODE_NUMBER : return 10;
case QRMode.MODE_ALPHA_NUM : return 9;
case QRMode.MODE_8BIT_BYTE : return 8;
case QRMode.MODE_KANJI : return 8;
default :
throw new Error('mode:' + mode);
}
} else if (type < 27) {
// 10 - 26
switch(mode) {
case QRMode.MODE_NUMBER : return 12;
case QRMode.MODE_ALPHA_NUM : return 11;
case QRMode.MODE_8BIT_BYTE : return 16;
case QRMode.MODE_KANJI : return 10;
default :
throw new Error('mode:' + mode);
}
} else if (type < 41) {
// 27 - 40
switch(mode) {
case QRMode.MODE_NUMBER : return 14;
case QRMode.MODE_ALPHA_NUM : return 13;
case QRMode.MODE_8BIT_BYTE : return 16;
case QRMode.MODE_KANJI : return 12;
default :
throw new Error('mode:' + mode);
}
} else {
throw new Error('type:' + type);
}
};
_this.getLostPoint = function(qrcode) {
var moduleCount = qrcode.getModuleCount();
var lostPoint = 0;
// LEVEL1
for (var row = 0; row < moduleCount; row += 1) {
for (var col = 0; col < moduleCount; col += 1) {
var sameCount = 0;
var dark = qrcode.isDark(row, col);
for (var r = -1; r <= 1; r += 1) {
if (row + r < 0 || moduleCount <= row + r) {
continue;
}
for (var c = -1; c <= 1; c += 1) {
if (col + c < 0 || moduleCount <= col + c) {
continue;
}
if (r == 0 && c == 0) {
continue;
}
if (dark == qrcode.isDark(row + r, col + c) ) {
sameCount += 1;
}
}
}
if (sameCount > 5) {
lostPoint += (3 + sameCount - 5);
}
}
};
// LEVEL2
for (var row = 0; row < moduleCount - 1; row += 1) {
for (var col = 0; col < moduleCount - 1; col += 1) {
var count = 0;
if (qrcode.isDark(row, col) ) count += 1;
if (qrcode.isDark(row + 1, col) ) count += 1;
if (qrcode.isDark(row, col + 1) ) count += 1;
if (qrcode.isDark(row + 1, col + 1) ) count += 1;
if (count == 0 || count == 4) {
lostPoint += 3;
}
}
}
// LEVEL3
for (var row = 0; row < moduleCount; row += 1) {
for (var col = 0; col < moduleCount - 6; col += 1) {
if (qrcode.isDark(row, col)
&& !qrcode.isDark(row, col + 1)
&& qrcode.isDark(row, col + 2)
&& qrcode.isDark(row, col + 3)
&& qrcode.isDark(row, col + 4)
&& !qrcode.isDark(row, col + 5)
&& qrcode.isDark(row, col + 6) ) {
lostPoint += 40;
}
}
}
for (var col = 0; col < moduleCount; col += 1) {
for (var row = 0; row < moduleCount - 6; row += 1) {
if (qrcode.isDark(row, col)
&& !qrcode.isDark(row + 1, col)
&& qrcode.isDark(row + 2, col)
&& qrcode.isDark(row + 3, col)
&& qrcode.isDark(row + 4, col)
&& !qrcode.isDark(row + 5, col)
&& qrcode.isDark(row + 6, col) ) {
lostPoint += 40;
}
}
}
// LEVEL4
var darkCount = 0;
for (var col = 0; col < moduleCount; col += 1) {
for (var row = 0; row < moduleCount; row += 1) {
if (qrcode.isDark(row, col) ) {
darkCount += 1;
}
}
}
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
lostPoint += ratio * 10;
return lostPoint;
};
return _this;
}();
//---------------------------------------------------------------------
// QRMath
//---------------------------------------------------------------------
var QRMath = function() {
var EXP_TABLE = new Array(256);
var LOG_TABLE = new Array(256);
// initialize tables
for (var i = 0; i < 8; i += 1) {
EXP_TABLE[i] = 1 << i;
}
for (var i = 8; i < 256; i += 1) {
EXP_TABLE[i] = EXP_TABLE[i - 4]
^ EXP_TABLE[i - 5]
^ EXP_TABLE[i - 6]
^ EXP_TABLE[i - 8];
}
for (var i = 0; i < 255; i += 1) {
LOG_TABLE[EXP_TABLE[i] ] = i;
}
var _this = {};
_this.glog = function(n) {
if (n < 1) {
throw new Error('glog(' + n + ')');
}
return LOG_TABLE[n];
};
_this.gexp = function(n) {
while (n < 0) {
n += 255;
}
while (n >= 256) {
n -= 255;
}
return EXP_TABLE[n];
};
return _this;
}();
//---------------------------------------------------------------------
// qrPolynomial
//---------------------------------------------------------------------
function qrPolynomial(num, shift) {
if (typeof num.length == 'undefined') {
throw new Error(num.length + '/' + shift);
}
var _num = function() {
var offset = 0;
while (offset < num.length && num[offset] == 0) {
offset += 1;
}
var _num = new Array(num.length - offset + shift);
for (var i = 0; i < num.length - offset; i += 1) {
_num[i] = num[i + offset];
}
return _num;
}();
var _this = {};
_this.getAt = function(index) {
return _num[index];
};
_this.getLength = function() {
return _num.length;
};
_this.multiply = function(e) {
var num = new Array(_this.getLength() + e.getLength() - 1);
for (var i = 0; i < _this.getLength(); i += 1) {
for (var j = 0; j < e.getLength(); j += 1) {
num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) );
}
}
return qrPolynomial(num, 0);
};
_this.mod = function(e) {
if (_this.getLength() - e.getLength() < 0) {
return _this;
}
var ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) );
var num = new Array(_this.getLength() );
for (var i = 0; i < _this.getLength(); i += 1) {
num[i] = _this.getAt(i);
}
for (var i = 0; i < e.getLength(); i += 1) {
num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio);
}
// recursive call
return qrPolynomial(num, 0).mod(e);
};
return _this;
};
//---------------------------------------------------------------------
// QRRSBlock
//---------------------------------------------------------------------
var QRRSBlock = function() {
// [1: [L, M, Q, H], ..]
var RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];
var qrRSBlock = function(totalCount, dataCount) {
var _this = {};
_this.totalCount = totalCount;
_this.dataCount = dataCount;
return _this;
};
var _this = {};
var getRsBlockTable = function(typeNumber, errorCorrectLevel) {
switch(errorCorrectLevel) {
case QRErrorCorrectLevel.L :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
case QRErrorCorrectLevel.M :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
case QRErrorCorrectLevel.Q :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
case QRErrorCorrectLevel.H :
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
default :
return undefined;
}
};
_this.getRSBlocks = function(typeNumber, errorCorrectLevel) {
var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);
if (typeof rsBlock == 'undefined') {
throw new Error('bad rs block [url=home.php?mod=space&uid=5302]@[/url] typeNumber:' + typeNumber +
'/errorCorrectLevel:' + errorCorrectLevel);
}
var length = rsBlock.length / 3;
var list = new Array();
for (var i = 0; i < length; i += 1) {
var count = rsBlock[i * 3 + 0];
var totalCount = rsBlock[i * 3 + 1];
var dataCount = rsBlock[i * 3 + 2];
for (var j = 0; j < count; j += 1) {
list.push(qrRSBlock(totalCount, dataCount) );
}
}
return list;
};
return _this;
}();
//---------------------------------------------------------------------
// qrBitBuffer
//---------------------------------------------------------------------
var qrBitBuffer = function() {
var _buffer = new Array();
var _length = 0;
var _this = {};
_this.getBuffer = function() {
return _buffer;
};
_this.getAt = function(index) {
var bufIndex = Math.floor(index / 8);
return ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
};
_this.put = function(num, length) {
for (var i = 0; i < length; i += 1) {
_this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
}
};
_this.getLengthInBits = function() {
return _length;
};
_this.putBit = function(bit) {
var bufIndex = Math.floor(_length / 8);
if (_buffer.length <= bufIndex) {
_buffer.push(0);
}
if (bit) {
_buffer[bufIndex] |= (0x80 >>> (_length % 8) );
}
_length += 1;
};
return _this;
};
//---------------------------------------------------------------------
// qr8BitByte
//---------------------------------------------------------------------
var qr8BitByte = function(data) {
var _mode = QRMode.MODE_8BIT_BYTE;
var _data = data;
var _parsedData = [];
var _this = {};
// Added to support UTF-8 Characters
for (var i = 0, l = _data.length; i < l; i++) {
var byteArray = [];
var code = _data.charCodeAt(i);
if (code > 0x10000) {
byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
byteArray[3] = 0x80 | (code & 0x3F);
} else if (code > 0x800) {
byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
byteArray[2] = 0x80 | (code & 0x3F);
} else if (code > 0x80) {
byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
byteArray[1] = 0x80 | (code & 0x3F);
} else {
byteArray[0] = code;
}
// Fix Unicode corruption bug
_parsedData.push(byteArray);
}
_parsedData = Array.prototype.concat.apply([], _parsedData);
if (_parsedData.length != _data.length) {
_parsedData.unshift(191);
_parsedData.unshift(187);
_parsedData.unshift(239);
}
var _bytes = _parsedData;
_this.getMode = function() {
return _mode;
};
_this.getLength = function(buffer) {
return _bytes.length;
};
_this.write = function(buffer) {
for (var i = 0; i < _bytes.length; i += 1) {
buffer.put(_bytes[i], 8);
}
};
return _this;
};
//=====================================================================
// GIF Support etc.
//
//---------------------------------------------------------------------
// byteArrayOutputStream
//---------------------------------------------------------------------
var byteArrayOutputStream = function() {
var _bytes = new Array();
var _this = {};
_this.writeByte = function(b) {
_bytes.push(b & 0xff);
};
_this.writeShort = function(i) {
_this.writeByte(i);
_this.writeByte(i >>> 8);
};
_this.writeBytes = function(b, off, len) {
off = off || 0;
len = len || b.length;
for (var i = 0; i < len; i += 1) {
_this.writeByte(b[i + off]);
}
};
_this.writeString = function(s) {
for (var i = 0; i < s.length; i += 1) {
_this.writeByte(s.charCodeAt(i) );
}
};
_this.toByteArray = function() {
return _bytes;
};
_this.toString = function() {
var s = '';
s += '[';
for (var i = 0; i < _bytes.length; i += 1) {
if (i > 0) {
s += ',';
}
s += _bytes[i];
}
s += ']';
return s;
};
return _this;
};
//---------------------------------------------------------------------
// base64EncodeOutputStream
//---------------------------------------------------------------------
var base64EncodeOutputStream = function() {
var _buffer = 0;
var _buflen = 0;
var _length = 0;
var _base64 = '';
var _this = {};
var writeEncoded = function(b) {
_base64 += String.fromCharCode(encode(b & 0x3f) );
};
var encode = function(n) {
if (n < 0) {
// error.
} else if (n < 26) {
return 0x41 + n;
} else if (n < 52) {
return 0x61 + (n - 26);
} else if (n < 62) {
return 0x30 + (n - 52);
} else if (n == 62) {
return 0x2b;
} else if (n == 63) {
return 0x2f;
}
throw new Error('n:' + n);
};
_this.writeByte = function(n) {
_buffer = (_buffer << 8) | (n & 0xff);
_buflen += 8;
_length += 1;
while (_buflen >= 6) {
writeEncoded(_buffer >>> (_buflen - 6) );
_buflen -= 6;
}
};
_this.flush = function() {
if (_buflen > 0) {
writeEncoded(_buffer << (6 - _buflen) );
_buffer = 0;
_buflen = 0;
}
if (_length % 3 != 0) {
// padding
var padlen = 3 - _length % 3;
for (var i = 0; i < padlen; i += 1) {
_base64 += '=';
}
}
};
_this.toString = function() {
return _base64;
};
return _this;
};
//---------------------------------------------------------------------
// base64DecodeInputStream
//---------------------------------------------------------------------
var base64DecodeInputStream = function(str) {
var _str = str;
var _pos = 0;
var _buffer = 0;
var _buflen = 0;
var _this = {};
_this.read = function() {
while (_buflen < 8) {
if (_pos >= _str.length) {
if (_buflen == 0) {
return -1;
}
throw new Error('unexpected end of file./' + _buflen);
}
var c = _str.charAt(_pos);
_pos += 1;
if (c == '=') {
_buflen = 0;
return -1;
} else if (c.match(/^\s$/) ) {
// ignore if whitespace.
continue;
}
_buffer = (_buffer << 6) | decode(c.charCodeAt(0) );
_buflen += 6;
}
var n = (_buffer >>> (_buflen - 8) ) & 0xff;
_buflen -= 8;
return n;
};
var decode = function(c) {
if (0x41 <= c && c <= 0x5a) {
return c - 0x41;
} else if (0x61 <= c && c <= 0x7a) {
return c - 0x61 + 26;
} else if (0x30 <= c && c <= 0x39) {
return c - 0x30 + 52;
} else if (c == 0x2b) {
return 62;
} else if (c == 0x2f) {
return 63;
} else {
throw new Error('c:' + c);
}
};
return _this;
};
//---------------------------------------------------------------------
// gifImage (B/W)
//---------------------------------------------------------------------
var gifImage = function(width, height) {
var _width = width;
var _height = height;
var _data = new Array(width * height);
var _this = {};
_this.setPixel = function(x, y, pixel) {
_data[y * _width + x] = pixel;
};
_this.write = function(out) {
//---------------------------------
// GIF Signature
out.writeString('GIF87a');
//---------------------------------
// Screen Descriptor
out.writeShort(_width);
out.writeShort(_height);
out.writeByte(0x80); // 2bit
out.writeByte(0);
out.writeByte(0);
//---------------------------------
// Global Color Map
// black
out.writeByte(0x00);
out.writeByte(0x00);
out.writeByte(0x00);
// white
out.writeByte(0xff);
out.writeByte(0xff);
out.writeByte(0xff);
//---------------------------------
// Image Descriptor
out.writeString(',');
out.writeShort(0);
out.writeShort(0);
out.writeShort(_width);
out.writeShort(_height);
out.writeByte(0);
//---------------------------------
// Local Color Map
//---------------------------------
// Raster Data
var lzwMinCodeSize = 2;
var raster = getLZWRaster(lzwMinCodeSize);
out.writeByte(lzwMinCodeSize);
var offset = 0;
while (raster.length - offset > 255) {
out.writeByte(255);
out.writeBytes(raster, offset, 255);
offset += 255;
}
out.writeByte(raster.length - offset);
out.writeBytes(raster, offset, raster.length - offset);
out.writeByte(0x00);
//---------------------------------
// GIF Terminator
out.writeString(';');
};
var bitOutputStream = function(out) {
var _out = out;
var _bitLength = 0;
var _bitBuffer = 0;
var _this = {};
_this.write = function(data, length) {
if ( (data >>> length) != 0) {
throw new Error('length over');
}
while (_bitLength + length >= 8) {
_out.writeByte(0xff & ( (data << _bitLength) | _bitBuffer) );
length -= (8 - _bitLength);
data >>>= (8 - _bitLength);
_bitBuffer = 0;
_bitLength = 0;
}
_bitBuffer = (data << _bitLength) | _bitBuffer;
_bitLength = _bitLength + length;
};
_this.flush = function() {
if (_bitLength > 0) {
_out.writeByte(_bitBuffer);
}
};
return _this;
};
var getLZWRaster = function(lzwMinCodeSize) {
var clearCode = 1 << lzwMinCodeSize;
var endCode = (1 << lzwMinCodeSize) + 1;
var bitLength = lzwMinCodeSize + 1;
// Setup LZWTable
var table = lzwTable();
for (var i = 0; i < clearCode; i += 1) {
table.add(String.fromCharCode(i) );
}
table.add(String.fromCharCode(clearCode) );
table.add(String.fromCharCode(endCode) );
var byteOut = byteArrayOutputStream();
var bitOut = bitOutputStream(byteOut);
// clear code
bitOut.write(clearCode, bitLength);
var dataIndex = 0;
var s = String.fromCharCode(_data[dataIndex]);
dataIndex += 1;
while (dataIndex < _data.length) {
var c = String.fromCharCode(_data[dataIndex]);
dataIndex += 1;
if (table.contains(s + c) ) {
s = s + c;
} else {
bitOut.write(table.indexOf(s), bitLength);
if (table.size() < 0xfff) {
if (table.size() == (1 << bitLength) ) {
bitLength += 1;
}
table.add(s + c);
}
s = c;
}
}
bitOut.write(table.indexOf(s), bitLength);
// end code
bitOut.write(endCode, bitLength);
bitOut.flush();
return byteOut.toByteArray();
};
var lzwTable = function() {
var _map = {};
var _size = 0;
var _this = {};
_this.add = function(key) {
if (_this.contains(key) ) {
throw new Error('dup key:' + key);
}
_map[key] = _size;
_size += 1;
};
_this.size = function() {
return _size;
};
_this.indexOf = function(key) {
return _map[key];
};
_this.contains = function(key) {
return typeof _map[key] != 'undefined';
};
return _this;
};
return _this;
};
var createImgTag = function(width, height, getPixel, alt) {
var gif = gifImage(width, height);
for (var y = 0; y < height; y += 1) {
for (var x = 0; x < width; x += 1) {
gif.setPixel(x, y, getPixel(x, y) );
}
}
var b = byteArrayOutputStream();
gif.write(b);
var base64 = base64EncodeOutputStream();
var bytes = b.toByteArray();
for (var i = 0; i < bytes.length; i += 1) {
base64.writeByte(bytes[i]);
}
base64.flush();
var img = '';
img += 'data:image/gif;base64,';
img += base64;
return img;
};
//---------------------------------------------------------------------
// returns qrcode function.
var createQrCodeImg = function(text, options) {
options = options || {};
var typeNumber = options.typeNumber || 4;
var errorCorrectLevel = options.errorCorrectLevel || 'M';
var size = options.size || 500;
var qr;
try {
qr = qrcode(typeNumber, errorCorrectLevel || 'M');
qr.addData(text);
qr.make();
} catch (e) {
if(typeNumber >= 40) {
throw new Error('Text too long to encode');
} else {
return gen(text, {
size: size,
errorCorrectLevel: errorCorrectLevel,
typeNumber: typeNumber + 1
});
}
}
// calc cellsize and margin
var cellsize = parseInt(size / qr.getModuleCount());
var margin = parseInt((size - qr.getModuleCount() * cellsize) / 2);
return qr.createImgTag(cellsize, margin, size);
};
// var module = {}; 需要注释这一行,否则微信小程序无法使用
module.exports = {
createQrCodeImg : createQrCodeImg
};
\ No newline at end of file
module.exports = {
}
{
"name": "hmd",
"version": "1.0.0",
"lockfileVersion": 1
}
{
"name": "hmd",
"version": "1.0.0",
"main": "app.js",
"dependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "http://192.168.3.233:8090/saas/mini-program/hmd"
},
"author": "",
"license": "ISC",
"description": ""
}
// packageIndex/pages/index/index.js
const BeiSenIndexUrl = 'https://cloud.italent.cn/mrest/ITalentApp/iTalentMobile/100000/PageControl/RedirectUsagePage?scene=0'
Page({
/**
* 页面的初始数据
*/
data: {
indexUrl: ''
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
const returnUrl = encodeURIComponent(BeiSenIndexUrl)
if (options.beiSenToken) {
this.setData({
indexUrl: `${options.beiSenToken}&return_url=${returnUrl}`
})
} else {
const {
userInfo
} = this.data || {}
if (!userInfo.beiSenToken || !userInfo.phone) return wx.p.router.goHome()
try {
wx.p.wxApi.showLoading()
const {
code,
data,
message
} = await wx.p.api.userApi.getBeisenToken({
phone: userInfo.phone
})
wx.p.wxApi.hideLoading()
if (code == 0) {
wx.p.storage.set('userInfo', data)
this.setData({
indexUrl: `${data.beiSenToken}&return_url=${returnUrl}`
})
} else throw message
} catch (error) {
wx.p.wxApi.hideLoading()
if (error) wx.p.wxApi.showToast(String(error))
}
//
// this.setData({
// indexUrl: `}&return_url=${returnUrl}`
// })
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
wx.hideHomeButton()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
/* packageIndex/pages/index/index.wxss */
\ No newline at end of file
<web-view src="{{indexUrl}}"/>
\ No newline at end of file
// pages/loading/loading.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
console.log('---------------- 页面初始化 ----------------')
console.log('options参数:', options)
this.tabList = __wxConfig?.tabBar?.list || []
wx.p.wxApi.showLoading()
//scenc获取页面参数并跳转
if (options.scene) {
return this.getSceneById(options.scene)
}
if (options.url) {
return this.login(options)
}
this.login()
},
async login(options = {}) {
try {
const userInfo = wx.p.storage.get('userInfo')
if (!userInfo.beiSenToken) wx.p.router.goHome(this.options)
else {
wx.p.wxApi.hideLoading()
wx.$LoginStatus = false
if (options.url) return this.jumpPage(options.url)
wx.p.router.reLaunch('/packageIndex/pages/index/index', this.options)
}
} catch (error) {
wx.p.wxApi.hideLoading()
wx.$LoginStatus = true //请求失败默认未登录
if (error) wx.p.wxApi.showToast(String(error))
wx.p.router.goHome(this.options)
}
},
async getSceneById(scene) {
const id = decodeURIComponent(scene).split('=').at(-1)
try {
const {
code,
data
} = await wx.p.api.wechatApi.getSceneById({
id
})
const params = data.scene.split('url='),
options = {}
if (params.length > 1) options.url = params.at(-1)
if (code == 0) this.login(options)
else throw {}
} catch (error) {
wx.p.wxApi.showToast(error || '获取scene失败')
this.login()
}
},
jumpPage(val) {
const targetPath = decodeURIComponent(val),
{
url,
events
} = this.setRouteData(targetPath),
routeName = this.tabList.findIndex(e => `/${e.pagePath}` == `${url}.html`) > -1 ? 'switchTab' : 'redirectTo'
events.notIntercept = true
wx.p.router[routeName](url, events)
},
setRouteData(targetPath) {
let [url, query] = targetPath.split('?'),
events = {}
if (query) {
let arr = query.split('&')
arr.map(e => {
let [key, val] = e.split('=')
if (val == 'false' || val == 'true') val = JSON.parse(val)
Object.assign(events, {
[key]: val
})
})
}
return {
url,
events
}
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom"
}
\ No newline at end of file
/* pages/loading/loading.wxss */
\ No newline at end of file
// pages/login/login.js
Page({
/**
* 页面的初始数据
*/
data: {
isAgree: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
async getPhoneNumber({
detail
}) {
this.setData({
isAgree: true
})
try {
const {
wxCode
} = this
if (detail.errMsg && ['authorized', 'deny'].findIndex(e => detail.errMsg.toLowerCase().includes(e)) != -1) return
if (!detail?.code) throw '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
wx.p.wxApi.showLoading()
const {
code,
data,
message
} = await wx.p.api.userApi.beisenLogin(wxCode, detail)
wx.hideLoading()
if (code == '0') {
wx.p.storage.set('userInfo', data)
if (data.beiSenToken) wx.p.router.reLaunch('/packageIndex/pages/index/index', data)
else wx.p.router.go('/pages/noAccess/noAccess', data)
} else {
this.onLoad()
throw message
}
} catch (error) {
if (error) wx.p.wxApi.showToast(String(error))
}
},
showTips() {
this.setData({
showModal: true
})
},
// 同意隐私政策
handleChangeAgree() {
this.setData({
isAgree: !this.data.isAgree
})
},
// 跳转隐私政策页面
handleAgree(e) {
const {
name
} = e.currentTarget.dataset
wx.p.router.jumpH5(`https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/${name}.html`, true)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
async onShow() {
let {
options
} = this
if (options.wxCode) {
this.wxCode = wxCode
return
}
wx.p.wxApi.showLoading()
const {
data
} = await wx.p.api.userApi.wxCodeLogin()
if (data) this.wxCode = data
wx.hideLoading()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
{
"usingComponents": {
"modal":"/components/Modal/Modal"
},
"navigationStyle": "custom"
}
\ No newline at end of file
/* pages/login/login.wxss */
page {
// background-color: #FAFBFF !important;
}
.layout {
&::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/shuke-hr/login-bg.webp') no-repeat;
background-size: 100% 100%;
z-index: -1;
}
.logo-box {
display: flex;
align-items: center;
flex-direction: column;
padding-top: 416rpx;
.logo {
width: 208rpx;
height: 208rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/shuke-hr/logo.webp') no-repeat;
background-size: 100% 100%;
}
.title {
font-size: 48rpx;
font-weight: 700;
line-height: 64rpx;
color: #222222;
text-align: center;
margin-top: 40rpx;
}
}
}
.wx-box {
margin: 20vh auto 0;
}
.wx-auth-button {
width: 622rpx !important;
height: 104rpx;
background: var(--themeColor);
border-radius: 8rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
padding: 0;
}
.wx-auth-button[disabled]:not([type]) {
background: #CCCED1 !important;
border-color: #CCCED1 !important;
color: #fff !important;
box-shadow: none;
}
.wx-auth-button[disabled]:not([type])::after {
border-color: #CCCED1 !important;
}
.tips {
font-size: 24rpx;
color: #999999;
width: 100%;
padding-top: 50rpx;
}
.tips .check {
width: 28rpx;
height: 28rpx;
box-sizing: border-box;
border-radius: 100%;
border: 2rpx solid #999999;
margin-right: 8rpx;
position: relative;
}
.tips .check.true {
border-color: var(--fontColor);
background-color: var(--fontColor);
}
.tips .check .icon {
display: none;
position: absolute;
width: 30rpx;
height: 30rpx;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.tips .check.true .icon {
display: block;
}
.txt-orange {
color: var(--fontColor);
}
.modal-content {
padding-top: 48rpx;
.modal-title {
font-size: 34rpx;
font-weight: 500;
line-height: 52rpx;
color: #222222;
text-align: center;
margin-bottom: 16rpx;
}
.modal-text {
text-align: center;
font-size: 32rpx;
font-weight: 400;
line-height: 48rpx;
color: #666666;
}
}
\ No newline at end of file
<view class="layout">
<view class="content">
<view class="logo-box">
<view class="logo"></view>
<view class="title">
广联数科EHR系统
</view>
</view>
<view class="wx-box">
<block wx:if="{{!isAgree}}">
<button class="wx-auth-button text-center {{isAgree}}" bindtap="showTips">登录</button>
</block>
<block wx:else>
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="wx-auth-button text-center">登录</button>
</block>
<view class="tips text-center" bindtap="handleChangeAgree">
<view class="check {{isAgree}}">
<image src="/assets/images/check.png" class="icon" />
</view>
我已阅读并同意
<text class="txt-orange" catchtap="handleAgree" data-name="privacy">《隐私协议》</text>
<text class="txt-orange" catchtap="handleAgree" data-name="agreement">《用户协议》</text>
</view>
</view>
</view>
</view>
<modal bindconfirm="getPhoneNumber" model:show="{{showModal}}">
<view class="modal-content">
<view class="modal-title">隐私协议与用户协议</view>
<view class="modal-text">
<view class="modal-tips">为保障你的合法权益,请阅读并同意</view>
<text class="txt-orange" catchtap="handleAgree" data-name="privacy">《隐私协议》</text>
<text class="txt-orange" catchtap="handleAgree" data-name="agreement">《用户协议》</text>
</view>
</view>
</modal>
\ No newline at end of file
// pages/noAccess/noAccess.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if(options.phone) options.phone = options.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
this.setData({
options
})
},
back(){
wx.p.router.back()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
/* pages/noAccess/noAccess.wxss */
.layout {
.content {
padding-top: 368rpx;
display: flex;
flex-direction: column;
align-items: center;
.icon {
width: 216rpx;
height: 216rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/shuke-hr/no-access.webp') no-repeat;
background-size: 100% 100%;
margin-bottom: 32rpx;
}
.text {
font-size: 28rpx;
font-weight: 400;
line-height: 44rpx;
color: #333333;
text-align: center;
max-width: 590rpx;
}
}
.back-btn {
margin: 288rpx auto 0;
}
}
\ No newline at end of file
<view class="layout">
<view class="content">
<view class="icon"></view>
<view class="text">
当前手机号[{{options.phone || '****'}}]未授权北森iTalent,
</view>
<view class="text">无法登录,请联系人事或重新授权登录</view>
</view>
<view class="back-btn default-btn" bindtap="back">返回登录页</view>
</view>
\ No newline at end of file
// pages/webView/webView.js
Page({
/**
* 页面的初始数据
*/
data: {
flag: true
},
getParams(str) {
let params = str.split('?')
if (params.length < 2) return {}
let param = params[1].split('&')
let obj = {}
for (let i = 0; i < param.length; i++) {
let paramsA = param[i].split('=')
let key = paramsA[0]
let value = paramsA[1]
obj[key] = value
}
return obj
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.p.wxApi.showLoading('加载中...')
let decodeUrl = decodeURIComponent(options.url)
let param = this.getParams(decodeUrl)
if (param.urlParam) {
let query = JSON.parse(param.urlParam)
this.data.refresh = query.refresh
}
this.setData({
url: decodeUrl
})
wx.hideLoading()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (this.data.refresh) {
this.setData(
{
flag: true
},
() => {
this.setData({
url: this.data.url
})
}
)
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
if (this.data.refresh) {
this.setData({
flag: false
})
}
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
if (this.data.refresh) {
this.setData({
flag: false
})
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
{
"usingComponents": {}
}
\ No newline at end of file
/* pages/webView/webView.wxss */
\ No newline at end of file
<!-- <web-view src="{{url}}"></web-view> -->
<block wx:if="{{flag}}">
<web-view src="{{url}}"></web-view>
</block>
\ No newline at end of file
/* pages/webView/webView.wxss */
\ No newline at end of file
import router from "./router.js";
import routerBefore from './routerBefore'
module.exports={
router,
routerBefore
}
\ No newline at end of file
class Router {
constructor(router) {}
/**获取页面对象实例 */
getPageInstance = (size = 1) => {
const pages = getCurrentPages();
return pages[pages.length - size];
};
/**跳转至H5 */
jumpH5(url, notIntercept) {
if (notIntercept) wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`,
})
else this.intercept(url).then((response) => {
if (response) return;
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`,
});
});
}
/**
* 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 ||
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/
go(route, events = {}) {
this._to(
route,
events,
'navigateTo',
(res) => events && res.eventChannel.emit('getData', events)
);
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events = {}) {
this._to(route, events, 'reLaunch');
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events = {}) {
this._to(route, events, 'redirectTo');
}
/**
* 跳转到switchTab
*/
switchTab(route, events = {}) {
this._to(route, events, 'switchTab');
}
_to(route, events = {}, to, success) {
getApp().globalData.ROUTE_QUERY = events
if (events.notIntercept) {
wx[to]({
url: route,
success
});
} else {
this.intercept().then((result) => {
!result && wx[to]({
url: route,
success
});
});
}
}
/**prevPageSize = 1
* 返回上prevPageSize页
* callBack返回上prevPageSize页对象 */
back(callBack, prevPageSize = 1) {
let prevPage = this.getPageInstance(Number(prevPageSize) + 1);
if (callBack && 'function' === typeof callBack) callBack(prevPage);
wx.navigateBack({
delta: prevPageSize,
}).catch((err) => {
this.goHome();
});
}
goHome(options) {
this._to('/pages/login/login', options, 'reLaunch')
}
/**获取上一个页面传的数据 */
getData(callBack) {
const data = this.getPageInstance().getOpenerEventChannel();
if (Object.keys(data).length !== 0)
data.on('getData', (res) => callBack(res));
}
/**
*
* @param {*} auto 是否自动跳转到登录,默认自动跳转
* @param {*} callBack true未登录 false已登录
*/
async intercept(auto = true) {
return false;
const authStatus = wx.$LoginStatus
if (authStatus) {
if (auto) wx.navigateTo({
url: '/pages/Login/Login',
})
return true;
} else {
return false;
}
}
}
export default new Router();
\ No newline at end of file
class RouterBefore {
constructor(options) {
console.log('---------------- 路由初始化 ----------------')
this.initPageProxy()
}
/**监听页面 */
pageLeaveProxy(thisPage) {
let onLoad = thisPage.onLoad,
onShow = thisPage.onShow
thisPage.onLoad = function () {
const event = getApp().globalData.ROUTE_QUERY
const userInfo = wx.p.storage.get('userInfo')
let options = {
...event,
...arguments[0]
}
getApp().globalData.ROUTE_QUERY = {}
this.setData({
userInfo: userInfo || {}
})
onLoad && onLoad.apply(this, [options]), (this.options = options)
}
thisPage.onShow = function () {
const userInfo = wx.p.storage.get('userInfo')
onShow && onShow.apply(this, arguments), (this.setData({
userInfo: userInfo || {}
}))
}
}
/**全局注册事件 */
initPageProxy() {
let thisPage = Page
let _this = this
Page = function (el) {
try {
el || (el = {}), _this.pageLeaveProxy(el), thisPage.apply(this, arguments)
} catch (el) {
thisPage.apply(this, arguments)
}
}
}
}
export default new RouterBefore()
\ No newline at end of file
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
/**
* 表单验证
*
* @param {Object} rules 验证字段的规则
* @param {Object} messages 验证字段的提示信息
*
*/
class WxValidate {
constructor(rules = {}, messages = {}) {
Object.assign(this, {
data: {},
rules,
messages,
})
this.__init()
}
/**
* __init
*/
__init() {
this.__initMethods()
this.__initDefaults()
this.__initData()
}
/**
* 初始化数据
*/
__initData() {
this.form = {}
this.errorList = []
}
/**
* 初始化默认提示信息
*/
__initDefaults() {
this.defaults = {
messages: {
required: '这是必填字段。',
email: '请输入有效的电子邮件地址。',
tel: '请输入11位的手机号码。',
url: '请输入有效的网址。',
date: '请输入有效的日期。',
dateISO: '请输入有效的日期(ISO),例如:2009-06-23,1998/01/22。',
number: '请输入有效的数字。',
digits: '只能输入数字。',
idcard: '请输入18位的有效身份证。',
equalTo: this.formatTpl('输入值必须和 {0} 相同。'),
contains: this.formatTpl('输入值必须包含 {0}。'),
minlength: this.formatTpl('最少要输入 {0} 个字符。'),
maxlength: this.formatTpl('最多可以输入 {0} 个字符。'),
rangelength: this.formatTpl('请输入长度在 {0} 到 {1} 之间的字符。'),
min: this.formatTpl('请输入不小于 {0} 的数值。'),
max: this.formatTpl('请输入不大于 {0} 的数值。'),
range: this.formatTpl('请输入范围在 {0} 到 {1} 之间的数值。'),
}
}
}
/**
* 初始化默认验证方法
*/
__initMethods() {
const that = this
that.methods = {
/**
* 验证必填元素
*/
required(value, param) {
if (!that.depend(param)) {
return 'dependency-mismatch'
} else if (typeof value === 'number') {
value = value.toString()
} else if (typeof value === 'boolean') {
return !0
}
return value.length > 0
},
/**
* 验证电子邮箱格式
*/
email(value) {
return that.optional(value) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value)
},
/**
* 验证手机格式
*/
tel(value) {
return that.optional(value) || /^1[34578]\d{9}$/.test(value)
},
/**
* 验证URL格式
*/
url(value) {
return that.optional(value) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(value)
},
/**
* 验证日期格式
*/
date(value) {
return that.optional(value) || !/Invalid|NaN/.test(new Date(value).toString())
},
/**
* 验证ISO类型的日期格式
*/
dateISO(value) {
return that.optional(value) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value)
},
/**
* 验证十进制数字
*/
number(value) {
return that.optional(value) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value)
},
/**
* 验证整数
*/
digits(value) {
return that.optional(value) || /^\d+$/.test(value)
},
/**
* 验证身份证号码
*/
idcard(value) {
return that.optional(value) || /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)
},
/**
* 验证两个输入框的内容是否相同
*/
equalTo(value, param) {
return that.optional(value) || value === that.data[param]
},
/**
* 验证是否包含某个值
*/
contains(value, param) {
return that.optional(value) || value.indexOf(param) >= 0
},
/**
* 验证最小长度
*/
minlength(value, param) {
return that.optional(value) || value.length >= param
},
/**
* 验证最大长度
*/
maxlength(value, param) {
return that.optional(value) || value.length <= param
},
/**
* 验证一个长度范围[min, max]
*/
rangelength(value, param) {
return that.optional(value) || (value.length >= param[0] && value.length <= param[1])
},
/**
* 验证最小值
*/
min(value, param) {
return that.optional(value) || value >= param
},
/**
* 验证最大值
*/
max(value, param) {
return that.optional(value) || value <= param
},
/**
* 验证一个值范围[min, max]
*/
range(value, param) {
return that.optional(value) || (value >= param[0] && value <= param[1])
},
}
}
/**
* 添加自定义验证方法
* @param {String} name 方法名
* @param {Function} method 函数体,接收两个参数(value, param),value表示元素的值,param表示参数
* @param {String} message 提示信息
*/
addMethod(name, method, message) {
this.methods[name] = method
this.defaults.messages[name] = message !== undefined ? message : this.defaults.messages[name]
}
/**
* 判断验证方法是否存在
*/
isValidMethod(value) {
let methods = []
for (let method in this.methods) {
if (method && typeof this.methods[method] === 'function') {
methods.push(method)
}
}
return methods.indexOf(value) !== -1
}
/**
* 格式化提示信息模板
*/
formatTpl(source, params) {
const that = this
if (arguments.length === 1) {
return function() {
let args = Array.from(arguments)
args.unshift(source)
return that.formatTpl.apply(this, args)
}
}
if (params === undefined) {
return source
}
if (arguments.length > 2 && params.constructor !== Array) {
params = Array.from(arguments).slice(1)
}
if (params.constructor !== Array) {
params = [params]
}
params.forEach(function(n, i) {
source = source.replace(new RegExp("\\{" + i + "\\}", "g"), function() {
return n
})
})
return source
}
/**
* 判断规则依赖是否存在
*/
depend(param) {
switch (typeof param) {
case 'boolean':
param = param
break
case 'string':
param = !!param.length
break
case 'function':
param = param()
default:
param = !0
}
return param
}
/**
* 判断输入值是否为空
*/
optional(value) {
return !this.methods.required(value) && 'dependency-mismatch'
}
/**
* 获取自定义字段的提示信息
* @param {String} param 字段名
* @param {Object} rule 规则
*/
customMessage(param, rule) {
const params = this.messages[param]
const isObject = typeof params === 'object'
if (params && isObject) return params[rule.method]
}
/**
* 获取某个指定字段的提示信息
* @param {String} param 字段名
* @param {Object} rule 规则
*/
defaultMessage(param, rule) {
let message = this.customMessage(param, rule) || this.defaults.messages[rule.method]
let type = typeof message
if (type === 'undefined') {
message = `Warning: No message defined for ${rule.method}.`
} else if (type === 'function') {
message = message.call(this, rule.parameters)
}
return message
}
/**
* 缓存错误信息
* @param {String} param 字段名
* @param {Object} rule 规则
* @param {String} value 元素的值
*/
formatTplAndAdd(param, rule, value) {
let msg = this.defaultMessage(param, rule)
this.errorList.push({
param: param,
msg: msg,
value: value,
})
}
/**
* 验证某个指定字段的规则
* @param {String} param 字段名
* @param {Object} rules 规则
* @param {Object} data 需要验证的数据对象
*/
checkParam(param, rules, data) {
// 缓存数据对象
this.data = data
// 缓存字段对应的值
const value = data[param] !== null && data[param] !== undefined ? data[param] : ''
// 遍历某个指定字段的所有规则,依次验证规则,否则缓存错误信息
for (let method in rules) {
// 判断验证方法是否存在
if (this.isValidMethod(method)) {
// 缓存规则的属性及值
const rule = {
method: method,
parameters: rules[method]
}
// 调用验证方法
const result = this.methods[method](value, rule.parameters)
// 若result返回值为dependency-mismatch,则说明该字段的值为空或非必填字段
if (result === 'dependency-mismatch') {
continue
}
this.setValue(param, method, result, value)
// 判断是否通过验证,否则缓存错误信息,跳出循环
if (!result) {
this.formatTplAndAdd(param, rule, value)
break
}
}
}
}
/**
* 设置字段的默认验证值
* @param {String} param 字段名
*/
setView(param) {
this.form[param] = {
$name: param,
$valid: true,
$invalid: false,
$error: {},
$success: {},
$viewValue: ``,
}
}
/**
* 设置字段的验证值
* @param {String} param 字段名
* @param {String} method 字段的方法
* @param {Boolean} result 是否通过验证
* @param {String} value 字段的值
*/
setValue(param, method, result, value) {
const params = this.form[param]
params.$valid = result
params.$invalid = !result
params.$error[method] = !result
params.$success[method] = result
params.$viewValue = value
}
/**
* 验证所有字段的规则,返回验证是否通过
* @param {Object} data 需要验证数据对象
*/
checkForm(data) {
this.__initData()
for (let param in this.rules) {
this.setView(param)
this.checkParam(param, this.rules[param], data)
}
return this.valid()
}
/**
* 返回验证是否通过
*/
valid() {
return this.size() === 0
}
/**
* 返回错误信息的个数
*/
size() {
return this.errorList.length
}
/**
* 返回所有错误信息
*/
validationErrors() {
return this.errorList
}
}
export default WxValidate
\ No newline at end of file
import Storage from './storage'
import userInfo from './userInfo'
import storageApi from './storageApi'
module.exports={Storage,userInfo,storageApi}
\ No newline at end of file
/**
* 微信小程序标准版:统一封装的 storage 操作类
*/
import { DEFAULT_GET_STORAGEKEY, STORAGE_OBJECTkEY } from '~/utils/constants'
class Storage {
types = {
1: 'get', // get
2: 'set', // set
3: 'rm' // rm
}
envVersion = {
develop: '开发版',
trial: '体验版',
release: '正式版'
}
// defaultGetStorageKey = DEFAULT_GET_STORAGEKEY
/** 构造函数 */
constructor() {
/** 获取当前小程序环境变量 */
const accountInfo = wx.getAccountInfoSync()
this.environment = accountInfo?.miniProgram.envVersion || 'release'
}
/**
*
* @param {*} key | 要操作的键值
* @param {*} type | 类型,是 get set rm
* @param {*} emptyFlag | 是否判断为空情况,默认判断 true,false 为不判断
*/
checkKeyType(key, type, emptyFlag = true) {
if (typeof key != 'string') {
throw new Error(`Storage ${this.types[type]} func: key must be string`)
return false
}
if (emptyFlag) {
let tmpKey = key.TrimStr()
if (tmpKey == '') {
throw new Error(`Storage ${this.types[type]} func: key can not be empty`)
return false
}
// if STORAGE_OBJECTkEY[key]
return tmpKey
}
return key
}
/**
*
* @param {*} key | 要操作的键值
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/
get = (key, syncFlag = true) => {
// 有值默认取key值
if (key) {
// 判断值是否是指定的对象值
let tmpKey = this.checkKeyType(key, 1)
let isObjectKey = STORAGE_OBJECTkEY[tmpKey]
// console.log(key)
// console.log(isObjectKey)
if (isObjectKey) {
return this.getObjectKeyValue(isObjectKey)
} else {
throw new Error(`Storage ${this.types[1]} ${key}: key must be register`)
}
} else {
return this.getObjectKeyValue(DEFAULT_GET_STORAGEKEY)
}
}
/**
*
* @param {*} 空key返回默认定义数组的值
*/
getObjectKeyValue(key) {
// ObjectList
if (typeof key == 'string') {
key = this.addEvnToKey(key)
let res = wx.getStorageSync(key)
if (res) {
return JSON.parse(res)
} else {
// reject(errMsg)
return ''
}
} else {
let Obj = {}
key.forEach(key => {
let defaultKey = this.addEvnToKey(key)
let res = wx.getStorageSync(defaultKey)
Obj[key] = res ? JSON.parse(res) : ''
})
return Obj
}
}
/**
*
* @param {*} key | 要操作的键值
* @param {*} data | 要存储的值,会转换为 JSON 串进行存储
* @param {*} syncFlag | 同步状态,默认为同步 false (异步),true 为同步
*/
set = (key, data, syncFlag = true) => {
let tmpKey = this.checkKeyType(key, 2)
if (tmpKey) {
tmpKey = this.addEvnToKey(tmpKey)
const sucMsg = 'Storage set: set data successfully'
const errMsg = 'Storage set: failed to set data'
return new Promise((resolve, reject) => {
let tmpData = JSON.stringify(data)
if (syncFlag) {
try {
wx.setStorageSync(tmpKey, tmpData)
resolve(sucMsg)
} catch (err) {
console.log(err)
reject(errMsg)
}
} else {
wx.setStorage({
data: tmpData,
key: tmpKey,
success: () => {
resolve(sucMsg)
},
fail: err => {
console.log(err)
reject(errMsg)
}
})
}
})
}
}
/**
*
* @param {*} key | 要操作的键值,为空则清空所有,有值则清空指定的值
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/
rm = (key = '', syncFlag = false) => {
let tmpKey = this.checkKeyType(key, 3, false)
tmpKey = tmpKey.TrimStr()
const sucMsg = 'Storage rm: rm data successfully'
const errMsg = 'Storage rm: failed to rm data'
return new Promise((resolve, reject) => {
if (tmpKey == '') {
if (syncFlag) {
try {
wx.clearStorageSync()
resolve(sucMsg)
} catch (err) {
console.log(err)
reject(errMsg)
}
} else {
wx.clearStorage({
success: res => {
resolve(sucMsg)
},
fail: err => {
console.log(err)
reject(errMsg)
}
})
}
} else {
tmpKey = this.addEvnToKey(tmpKey)
if (syncFlag) {
try {
wx.removeStorageSync(tmpKey)
resolve(sucMsg)
} catch (err) {
console.log(err)
reject(errMsg)
}
} else {
wx.removeStorage({
key: tmpKey,
success: () => {
resolve(sucMsg)
},
fail: err => {
console.log(err)
reject(errMsg)
}
})
}
}
})
}
/**
* @description: key 拼接小程序环境变量
* @param {*} key | 要操作的键值,
* @returns {String} 拼接后的值
*/
addEvnToKey = key => {
// return // console.log(this.environment)
return `${this.environment}_${key}`
}
}
/** 去除前导空格和后导空格 */
String.prototype.TrimStr = function () {
return this.replace(/(^\s*)|(\s*$)/g, '')
}
export default Storage
// 实例化对象存储
import Storage from './storage'
const storage = new Storage()
// console.log(storage)
/** */
export function getSessionId() {
return storage.get('sessionId')
}
export function setSessionId(sessionId) {
storage.set('sessionId', sessionId)
}
export function getUserInfo() {
return storage.get('userInfo')
}
export function setUserInfo(data) {
storage.set('userInfo', data || {})
}
export function removeSystemStorage() {
// storage.rm('srcm_shopmall_user_info')
// storage.rm('scrm_shopmall_sessionId')
// storage.rm('guest_no')
// storage.rm('equity_info')
// storage.rm('packageList')
// storage.rm('isVIP')
// storage.rm('bizjiaUrl')
// storage.rm('vip_card_info')
}
export function setStorageSync(key, data) {
storage.set(key, JSON.stringify(data))
}
export function getStorageSync(key) {
return storage.get(key) || null
// JSON.parse(data)
}
/**设置标题栏 */
export function setNavigationBarTitleText(title) {
storage.set('app_title', title)
}
/**获取app标题 */
export function getNavigationBarTitleText() {
return storage.get('app_title')
}
/** 存储设备信息 */
export function setSystem_info(that) {
let info = storage.get('system_info')
!info &&
wx.getSystemInfo({
success(res) {
// console.log(res)
storage.set('system_info', res)
}
})
}
export default{
getSessionId,
setSessionId,
getUserInfo,
setUserInfo,
removeSystemStorage,
setStorageSync,
getStorageSync,
setNavigationBarTitleText,
getNavigationBarTitleText,
setSystem_info
}
/**获取用户信息 */
export function getUserInfo() {
let user = wx.p.storage.get('userInfo') || {}
return user
}
/**设置用户信息 */
export function setUserInfo(userInfo) {
wx.p.storage.set('userInfo', userInfo)
}
export function isMember(isNeedToHttp, callBack) {
if (isNeedToHttp) {
wx.p.api.equityApi.checkOpenMember().then(res => {
let flag = false
if (res.code == 0 && res.data) {
flag = true
}
wx.p.storage.set('isVIP', flag)
callBack && callBack(flag, res.data)
})
return
}
return wx.p.storage.get('isVIP') || false
}
export default{
getUserInfo,
setUserInfo,
isMember
}
// 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
// 缓存get方法key的对应才映射值
export const STORAGE_OBJECTkEY = {
system_info: 'system_info',
mock_data: 'mock_data',
merchant_info: 'merchant_info',
address_info: 'address_info',
userInfo: 'userInfo',
sessionId: 'sessionId',
bindInfo:'bindInfo',
unauthorized:'unauthorized',
wx_user_info:'wx_user_info'
}
export default{
DEFAULT_GET_STORAGEKEY,
STORAGE_OBJECTkEY
}
\ No newline at end of file
const _ctx_ = Symbol('_ctx_')
const _pixelRatio_ = Symbol('_pixelRatio_')
const _canvasObject_ = Symbol('_canvasObject_')
const _canvas_ = Symbol('_canvas_')
class Draw {
[_ctx_] = null;
[_pixelRatio_] = null;
[_canvasObject_] = null;
[_canvas_] = null
constructor(canvasObject, isCompInst) {
//createOffscreenCanvas height最大值 4096
this[_canvasObject_] = canvasObject
this[_pixelRatio_] = canvasObject.pixelRatio || 2
const canvasObjectHeight = this.toRpx(canvasObject.height)
let height = canvasObjectHeight,
width = this.toRpx(canvasObject.width)
let canvas = wx.createOffscreenCanvas({
type: '2d',
width,
height,
compInst: isCompInst
}),
ctx = canvas.getContext('2d')
this[_canvas_] = canvas
this[_ctx_] = ctx
this[_ctx_].clearRect(0, 0, width, height)
this.drawFill({
x: 0,
y: 0,
width,
height,
color: canvasObject.backgroundColor || 'rgb(255, 255, 255)'
})
this[_ctx_].save()
}
async drawImages(imageParams, callback) {
this[_ctx_].beginPath()
this[_ctx_].save()
let { borderRadius, height, width, url, x, y } = imageParams
height = this.toRpx(height)
width = this.toRpx(width)
x = this.toRpx(x)
y = this.toRpx(y)
if (borderRadius) {
this.drawRadiusRect({
borderRadius,
height,
width,
x,
y
})
this[_ctx_].clip()
}
let image = this[_canvas_].createImage()
image.src = `${url}?v=${Date.now()}`
return new Promise(resolve => {
image.onload = () => {
this[_ctx_].drawImage(image, x, y, width, height)
this[_ctx_].restore()
if (callback) callback()
resolve(imageParams)
}
image.onerror = err => {
wx.hideLoading()
wx.showToast({
title: '图片加载失败',
icon: 'error'
})
}
})
}
toRpx(val) {
return this[_pixelRatio_] * val
}
getTextWidth(text, fontSize) {
let font = this[_ctx_].font.split('px')[1]
if (fontSize) this[_ctx_].font = `${fontSize}px${font}`
return this[_ctx_].measureText(text).width
}
// 画块形状
drawFill({ x, y, width, height, color }) {
height = this.toRpx(height)
width = this.toRpx(width)
x = this.toRpx(x)
y = this.toRpx(y)
this[_ctx_].beginPath()
this[_ctx_].fillStyle = color
this[_ctx_].fillRect(x, y, width, height)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].save()
}
drawText(textParams) {
let { textDecoration, textBaseline, lineHeight, fontWeight, textAlign, textWidth, maxWidth, fontSize, lastFont, opacity, lineNum, width, color, text, x, y } = textParams,
font = this[_ctx_].font.split('px')[1]
textAlign = textAlign || 'left'
textBaseline = textBaseline || 'normal'
opacity = typeof opacity === 'number' ? opacity : 1
lineHeight = this.toRpx(lineHeight || fontSize || 12)
textWidth = this.toRpx(textWidth || 0)
fontSize = this.toRpx(fontSize || 12)
maxWidth = this.toRpx(maxWidth || width || this[_canvasObject_].width)
width = this.toRpx(width || this[_canvasObject_].width)
x = this.toRpx(x)
y = this.toRpx(y)
let fontX = this.getFontWidth({
textAlign,
fontSize,
text,
x
})
this[_ctx_].beginPath()
this[_ctx_].globalAlpha = opacity
this[_ctx_].font = `${fontWeight || 400} ${fontSize}px${font}`
this[_ctx_].fillStyle = color || '#000'
this[_ctx_].textBaseline = textBaseline
this[_ctx_].textAlign = textAlign
this[_ctx_].lineWidth = this.toRpx(2)
let text_width = this.getTextWidth(text)
const drawOneLineText = () => {
let textArr = text.toString().split(''),
newText = '',
ellipsis = false
try {
textArr.map(e => {
newText += e
if (this.getTextWidth(newText) > width - fontX) throw true
})
} catch (error) {
ellipsis = error
}
if (ellipsis) newText += '…'
if (lastFont) newText += lastFont
this[_ctx_].fillText(newText, x, y, maxWidth)
if (checkTextDecoration(textDecoration)) {
this.drawDecoration({
textDecoration,
textBaseline,
textAlign,
fontSize,
newText,
opacity,
text,
y,
x
})
}
}
if (lineNum > 1) {
let textArr = text.split(''),
textRowArr = [],
currentText = '',
viewWidth = width - fontX
if (text_width > viewWidth) {
textArr.map(e => {
currentText += e
if (this.getTextWidth(currentText) >= viewWidth && textRowArr.length < lineNum - 1) {
textRowArr.push(currentText)
currentText = ''
}
})
if (currentText.length) textRowArr.push(currentText)
textRowArr.map((e, index) => {
if (this.getTextWidth(e) > viewWidth && index == lineNum - 1) {
try {
let lastText = '',
lastArr = e.split('')
lastArr.map(i => {
lastText += i
if (this.getTextWidth(lastText) > width - fontX - this.getTextWidth('…')) throw lastText
})
} catch (error) {
if (lastFont) e = `${error.substring(0, error.length - lastFont.length)}…${lastFont}`
else e = `${error}…`
}
}
if (lastFont && e.indexOf(lastFont) == -1 && textRowArr.length < 2) e = `${e.substring(0, e.length - lastFont.length)}…${lastFont}`
let textHeight = y + index * (lineHeight || fontSize)
this[_ctx_].fillText(e, x, textHeight, maxWidth)
if (checkTextDecoration(textDecoration)) {
this.drawDecoration({
y: textHeight,
textDecoration,
textBaseline,
textAlign,
fontSize,
newText: e,
opacity,
text,
x
})
}
})
} else drawOneLineText()
} else drawOneLineText()
if (textParams.border)
this.drawBorder({
text,
x: textParams.x,
y: textParams.y,
fontSize: textParams.fontSize || 12,
...textParams.border
})
this[_ctx_].stroke()
}
drawBorder(params) {
let { x, y, text, color, width, radius, opacity, padding, fontSize } = params,
paddingX = 0,
paddingY = 0
if (padding && padding.length) {
paddingX = this.toRpx(padding[0])
paddingY = this.toRpx(padding[0])
if (padding.length > 1) paddingX = this.toRpx(padding[1])
}
let startX = this.toRpx(x) - paddingX,
endX = this.toRpx(x) + this.getTextWidth(text) + paddingX,
startY = this.toRpx(y) - paddingY,
endY = this.toRpx(y + fontSize) + paddingY / 2,
arr = [
{
x: startX,
y: startY,
width: endX
},
{
x: endX,
y: startY,
height: endY
},
{
x: startX,
y: endY,
width: endX
},
{
x: startX,
y: startY,
height: endY
}
]
console.log(this.toRpx(y), paddingY)
this[_ctx_].beginPath()
this[_ctx_].globalAlpha = typeof opacity === 'number' ? opacity : 1
this[_ctx_].lineWidth = width || this.toRpx(1)
if (radius) {
radius = this.toRpx(radius)
let arcArr = [
{
moveTo: [startX, startY + radius],
arcTo: [startX, startY, startX + radius, startY]
},
{
moveTo: [endX - radius, startY],
arcTo: [endX, startY, endX, startY + radius]
},
{
moveTo: [startX, endY - radius],
arcTo: [startX, endY, startX + radius, endY]
},
{
moveTo: [endX, endY - radius],
arcTo: [endX, endY, endX - radius, endY]
}
]
arr.map((e, index) => {
if (index == 0 || index == 2) {
e.x += radius
e.width -= radius
} else {
e.y += radius
e.height -= radius
}
})
arcArr.map((e, index) => {
this[_ctx_].moveTo(...e.moveTo)
this[_ctx_].arcTo(...e.arcTo, radius)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].save()
})
}
arr.map((e, index) => {
this[_ctx_].moveTo(e.x, e.y)
this[_ctx_].lineTo(e.width ? e.width : e.x, e.height ? e.height : e.y)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].strokeStyle = color || '#000'
this[_ctx_].save()
})
}
drawLine(lineParams, callback) {
this[_ctx_].beginPath()
let { noTransition, opacity, startX, startY, width, color, endX, endY } = lineParams
if (!noTransition) {
startX = this.toRpx(startX)
startY = this.toRpx(startY)
width = this.toRpx(width)
endX = this.toRpx(endX)
endY = this.toRpx(endY)
}
this[_ctx_].globalAlpha = typeof opacity === 'number' ? opacity : 1
this[_ctx_].lineWidth = width || this.toRpx(1)
this[_ctx_].moveTo(startX, startY)
this[_ctx_].lineTo(endX, endY)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].strokeStyle = color || '#000'
this[_ctx_].save()
if (callback) callback()
}
setLineY = params => {
let { textDecoration, textBaseline, fontSize, y } = params
let type = {
underline: {
top: y + fontSize,
middle: y + fontSize / 2,
bottom: y,
normal: y
},
overline: {
top: y,
middle: y - fontSize / 2,
bottom: y - fontSize,
normal: y
},
'line-through': {
top: y + fontSize / 2,
middle: y - fontSize / 2,
bottom: y,
normal: y
}
}
return type[textDecoration][textBaseline]
}
setLineX({ textAlign, text, x }) {
let textWidth = this.getTextWidth(text)
let type = {
left: x,
center: x - textWidth / 2,
right: x - textWidth
}
return type[textAlign]
}
drawRadiusRect({ borderRadius, height, width, x, y }, callBack) {
let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2
radius = radius || 0
this[_ctx_].beginPath()
for (let i = 1; i < 5; i++) {
let arcX = i === 1 || i === 4 ? x + width - radius : x + radius
let arcY = i === 1 || i === 2 ? y + height - radius : y + radius
this[_ctx_].arc(arcX, arcY, radius, 2 * Math.PI * ((i - 1) / 4), 2 * Math.PI * (i / 4))
}
if (callBack) callBack()
}
getFontWidth({ textAlign, fontSize, text, x }) {
let type = {
left: x,
center: x - (fontSize * text.length) / 2,
right: x - fontSize * text.length
}
return type[textAlign] < 0 ? 0 : type[textAlign]
}
drawDecoration(params) {
let { newText, opacity, y, x } = params
let lineX = x
let lineY = y
lineX = this.setLineX(params)
lineY = this.setLineY(params)
this[_ctx_].globalAlpha = opacity
this[_ctx_].moveTo(lineX, lineY)
this[_ctx_].lineTo(lineX + this.getTextWidth(newText), lineY)
}
toDataURL(callBack) {
let url = this[_canvas_].toDataURL('image/png')
const base64src = function (base64data) {
return new Promise((resolve, reject) => {
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || []
if (!format) reject(new Error('ERROR_BASE64SRC_PARSE'))
const fileId = Date.now()
const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src_${fileId}.${format}`
const buffer = wx.base64ToArrayBuffer(bodyData)
wx.getFileSystemManager().writeFile({
filePath,
data: buffer,
encoding: 'binary',
success() {
resolve({
filePath,
fileId
})
},
fail() {
reject(new Error('ERROR_BASE64SRC_WRITE'))
}
})
})
}
base64src(url).then(img => {
createLocalImg(img, callBack)
})
}
async begin(data = {}) {
return new Promise(async (resolve, reject) => {
const drawFun = () => {
data.textList &&
data.textList.length &&
data.textList.map(e => {
this.drawText(e)
})
data.lineList &&
data.lineList.length &&
data.lineList.map(e => {
this.drawLine(e)
})
wx.nextTick(() => {
this.toDataURL(res => resolve(res))
})
}
if (data.imageList && data.imageList.length) {
await this.drawImages(data.imageList[0])
if (data.imageList.length > 1)
for (let index = 1; index < data.imageList.length; index++) {
await this.drawImages(data.imageList[index])
if (index == data.imageList.length - 1) drawFun()
}
else drawFun()
} else drawFun()
})
}
}
const checkTextDecoration = textDecoration => {
return textDecoration && (textDecoration === 'underline' || textDecoration === 'overline' || textDecoration === 'line-through')
}
/**网络图片转成本地资源 */
const createLocalImg = ({ filePath, fileId }, callBack) => {
wx.getImageInfo({
src: filePath,
success(res) {
callBack({
...res,
fileId
})
},
fail() {
wx.showToast({
title: '图片生成失败,请稍后再试',
icon: 'none'
})
wx.hideLoading()
console.error(`图片转换本地失败,${url}`)
}
})
}
export default Draw
/**emoji正则 */
const emojiReg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac])/g
/**过滤表情 */
export function haveEmoji(value) {
let val = false
value = value.replace(/\s/g, '').trimStart().trimEnd()
if (emojiReg.test(value) && !/\s/g.test(value)) {
showToast({
icon: 'error',
title: '不能输入表情'
})
val = true
}
return val
}
/**替换表情 */
export function replaceEmoji(value) {
let val = value.replace(emojiReg, '')
return val.trimStart().trimEnd()
}
export default{
emojiReg,
haveEmoji,
replaceEmoji
}
class Bus {
constructor() {
this.events = {}
}
on(Event, cb) {
if(this.events[Event]) {
this.events[Event].push(cb);
} else {
this.events[Event] = [cb];
}
// 如果是匿名函数就给用户个警告
if(!cb.name) {
console.warn('on 接口的 handler 参数推荐使用具名函数。具名函数可以使用 off 接口取消订阅,匿名函数无法取消订阅。')
}
}
emit(Event, obj) {
if(!this.events[Event]) return
this.events[Event].forEach(cb => {
cb(obj)
})
}
off(Event,cb) {
if(!this.events[Event]) return
const index = this.events[Event].findIndex(item => item === cb);
if (index === -1) {
// console.error(new Error('该 handle 没有订阅者,取消订阅失败'));
return;
}
this.events[Event].splice(index, 1);
}
// 给这个类加一个静态方法,用来判断这个类之前有没有生成过对象
static getInstance() {
if (!Bus.instance) {
Bus.instance = new Bus()
}
return Bus.instance;
}
}
// 导出这里返回 Bus 类静态 getInstance 的执行结果
export default Bus.getInstance();
\ No newline at end of file
/** 根据时间回显时间格式 */
export function timeAgo(dateTimeStamp) {
let result = '刚刚'
let minute = 1000 * 60
let hour = minute * 60
let day = hour * 24
let now = new Date().getTime() //获取当前时间毫秒
let diffValue = now - dateTimeStamp //时间差
let todayValue = new Date()
todayValue.setHours(0)
todayValue.setMinutes(0)
todayValue.setSeconds(0)
todayValue.setMilliseconds(0)
let todayTimeStamp = todayValue.getTime() //获取当天零时毫秒
if (diffValue < 0) {
return result
}
let diffTodayValue = todayTimeStamp - dateTimeStamp
//计算时间差的分,时,天,周,月
let minC = diffValue / minute
let hourC = diffValue / hour
let dayC = diffTodayValue / day
if (diffTodayValue > 0) {
if (dayC >= 2) {
return new Date(dateTimeStamp).format('MM月dd日 hh:mm:ss')
}
if (dayC >= 1 && dayC < 2) {
return '前天' + new Date(dateTimeStamp).format(' hh:mm:ss')
}
return '昨天' + new Date(dateTimeStamp).format(' hh:mm:ss')
}
if (hourC >= 1 && hourC <= 23) {
return parseInt(hourC) + '小时前'
}
if (minC >= 1 && minC <= 59) {
return parseInt(minC) + '分钟前'
}
if (diffValue >= 0 && diffValue <= minute) {
return '刚刚'
}
return new Date(dateTimeStamp).format('MM月dd日 hh:mm:ss')
}
//用来判断评论时间
export function commentTime(dateTimeStamp) {
var result
let time = dateTimeStamp
let nowTime = new Date().getTime()
let timeDifference = nowTime - time
let minTime = 60000
let hourTime = minTime * 60
let dayTime = hourTime * 24
let weektTime = dayTime * 7
let monthTime = dayTime * 30
let yearTime = dayTime * 365
if (Math.floor(timeDifference / yearTime) >= 1) {
result = Math.floor(timeDifference / yearTime) + '年前'
} else if (Math.floor(timeDifference / monthTime) >= 1) {
result = Math.floor(timeDifference / monthTime) + '月前'
} else if (Math.floor(timeDifference / weektTime) >= 1) {
result = Math.floor(timeDifference / weektTime) + '周前'
} else if (Math.floor(timeDifference / dayTime) >= 1) {
result = Math.floor(timeDifference / dayTime) + '天前'
} else if (Math.floor(timeDifference / hourTime) >= 1) {
result = Math.floor(timeDifference / hourTime) + '小时前'
} else if (Math.floor(timeDifference / minTime) >= 1) {
result = Math.floor(timeDifference / minTime) + '分钟前'
if (Math.floor(timeDifference / minTime) <= 5) {
//五分钟内就是刚刚
result = '刚刚'
}
}
return result
}
/**IOS时间兼容 */
export function iosTimeFormat(time) {
if (!time) return ''
return typeof time != 'string' ? time : time.replace(/\-/g, '/')
}
/**获取时间段总时长 */
export function getScopeTime(inputTime, curTime) {
let obj = {
text: '-',
day: 0,
isDanger: false
}
if (!inputTime || arguments.length === 0) return obj
let time = curTime / 1000 - inputTime / 1000
if (time < 60) {
let s = parseInt(time)
obj.text = `00:00:${s}`
} else if (time < 3600) {
let m = parseInt(time / 60)
let s = parseInt(time % 60)
m = m < 10 ? `0${m}` : m
s = s < 10 ? `0${s}` : s
obj.text = `00:${m}:${s}`
} else if (time < 86400) {
let h = parseInt(time / 3600)
let min = time - h * 3600
let m = parseInt(min / 60)
let s = parseInt(time % 60)
m = m < 10 ? `0${m}` : m
s = s < 10 ? `0${s}` : s
obj.text = `${h}:${m}:${s}`
} else if (time > 86400) {
let day = parseInt(time / 86400)
let hour = time - day * 86400
let h = parseInt(hour / 3600)
let min = hour - h * 3600
let m = parseInt(min / 60)
let s = parseInt(time % 60)
h = h < 10 ? `0${h}` : h
m = m < 10 ? `0${m}` : m
s = s < 10 ? `0${s}` : s
if (day > 7 || (day == 7 && h > 0)) obj.isDanger = false
obj.day = day
obj.text = `${day}天${h}:${m}:${s}`
}
return obj.text
}
/**num:要转换的数值,fixed:精确几位小数 */
export function decimal(num, fixed = 2) {
const pow = Math.pow(10, fixed)
return Number(Math.round(num * pow) / pow)
}
/**分转元 */
export function centsToyuan(price) {
// console.log(decimal)
return decimal(price / 100, 2).toFixed(2)
}
/**设置价格 */
export function setPrice(price) {
let [num, decimal] = price.toString().split('.')
if (!decimal) decimal = '00'
return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + `.${decimal}`
}
export default{
timeAgo,
commentTime,
iosTimeFormat,
getScopeTime,
decimal,
centsToyuan,
setPrice
}
import util from './util'
import wxApi from './utils_wx'
import constants from './constants'
import draw from './draw'
import emoji from './emoji'
import eventbus from './eventbus'
import format from './format'
import network from './network'
import routerApi from './routerApi'
import WxValidate from './WxValidate'
import cache from './cache/index'
module.exports ={util,wxApi,constants,draw,emoji,eventbus,format,network,routerApi,WxValidate,cache}
\ No newline at end of file
const ISCOMMECTED = Symbol('ISCOMMECTED')
class NetWork {
[ISCOMMECTED] = false;
constructor() {
this.onNetworkStatusChange()
}
/**监听网络变化 */
onNetworkStatusChange() {
wx.onNetworkStatusChange(({
isConnected,
networkType
}) => {
if (!isConnected && !this[ISCOMMECTED]) {
this[ISCOMMECTED] = true
wx.showToast({
icon: 'loading',
title: '网络尚未连接',
mask: true,
duration: 36e3 * 24
})
} else {
if (this[ISCOMMECTED]) {
const thisPage = wx.p.router.getPageInstance(),
options = Object.keys(thisPage.options)
this[ISCOMMECTED] = false
wx.showLoading()
wx.hideLoading()
// if (thisPage.noPageAuth) {
// wx.showLoading()
// this.refreshPage()
// } else {
// let url = `/${thisPage.route}`
// if (options.length) {
// let query = []
// options.map(key => {
// query.push(`${key}=${thisPage.options[key]}`)
// })
// url += `?${query.join('&')}`
// }
// wx.p.router.redirectTo('login.loading', {
// url
// })
// }
}
}
})
}
getNetworkType() {
const that = this
return new Promise((resolve, reject) => {
wx.getNetworkType({
success({
networkType
}) {
that[ISCOMMECTED] = networkType == 'none'
resolve(networkType)
},
fail: err => reject(err)
})
})
}
netWorkModal(confirmText = '返回') {
return new Promise((resolve, reject) => {
wx.showModal({
content: '网络尚未连接,请稍后再试',
confirmText,
showCancel: false,
confirmColor: '#3666FE',
success(res) {
if (res.confirm) resolve()
if (res.cancel) reject()
}
})
})
}
/**页面重载 */
refreshPage() {
wx.hideLoading()
wx.showNavigationBarLoading()
const thisPage = wx.p.router.getPageInstance(),
{
onLoad,
onShow,
options
} = thisPage
if (onLoad) thisPage.onLoad(options, true)
if (onShow) thisPage.onShow(options, true)
}
}
export default new NetWork()
\ No newline at end of file
/** */
export function getSceneId(path) {
let [_route_, _options_] = path.split('?')
let [target] = _route_.split('/')
let name = _route_.split('/').pop()
let scene = _options_ ? _options_.split('=')[1] : ''
return {
name,
scene,
target
}
}
/**
* 获取url参数
*/
export function filterUrlParam(urlSearch) {
let ret = {}
let regParam = /([^&=]+)=([\w\W]*?)(&|$|#)/g
if (urlSearch) {
var strParam = urlSearch
var result
while ((result = regParam.exec(strParam)) != null) {
ret[result[1]] = result[2]
}
}
return ret
}
/**跳转至购物车 */
export function goShoppingCart() {
wx.p.router.go('packageMall.shoppingCart')
}
export function decodeUrlLink(options) {
let op = {}
let query = Object.keys(options)
if (query.length) {
try {
query.map(e => {
let params = decodeURIComponent(e).split('&')
params.map((i, index) => {
let [key, val] = i.split('=')
if (val) op[key] = val
if (index == params.length - 1) {
throw op
}
})
})
} catch (res) {
let that = wx.p.router.getPageInstance()
that.onLoad(res)
}
}
}
export default{
getSceneId,
filterUrlParam,
goShoppingCart,
decodeUrlLink
}
\ No newline at end of file
import { dsnUrl } from "~/config";
import { Sentry } from "~/lib/index";
export default function sentryInit() {
// accountInfo.miniProgram.envVersion == 'release' &&
const accountInfo = wx.getAccountInfoSync();
//测试和生产才开发sentry
const env = ["trial", "release"];
env.includes(accountInfo.miniProgram.envVersion) &&
Sentry.init({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn: dsnUrl,
});
}
/** 分享
* @param {*} shareTitle 分享标题
* @param {*} sharePath 分享页面路径 不传默认当前页
* @param {*} shareImage 分享图片 不传默认当前页面截图
* @param {*} shareQuery 分享页面参数
* @param {*} noPageAuth 分享页面是否需要登录拦截
* @param {*} shareFun 分享页面
* @param {*} shareTrackData 分享埋点数据
* @param {*} onViewTrack 开启浏览埋点
* @returns
*/
// import { reportData } from '~/api/index.js'
class Share {
constructor() {
console.log('---------------- 分享初始化 ----------------')
this.initPageProxy()
}
/**全局注册事件 */
initPageProxy() {
let thisPage = Page
let _this = this
Page = function (el) {
try {
el || (el = {}), _this.pageLeaveProxy(el), thisPage.apply(this, arguments)
} catch (el) {
thisPage.apply(this, arguments)
}
}
}
/**设置全局分享 */
pageLeaveProxy(page) {
const onLoad = page.onLoad,
that = this
if (page.onShareAppMessage) {
const that = this
page.onShareAppMessage = function () {
let { shareTitle, sharePath, shareImage, shareQuery, noPageAuth, shareFun, shareTrackData } = this,
path = `/${this.route}`
if (sharePath) path = `/${sharePath}`
path += that.setCommonShareQuery()
if (shareQuery) path += `&${shareQuery}`
console.log('===============', path)
if (!noPageAuth) path = `/pages/loading/loading?url=${encodeURIComponent(path)}`
if (shareFun) shareFun()
// if (shareTrackData) that.reportShareData(shareTrackData)
console.table( {
path,
title: shareTitle,
imageUrl: shareImage
})
return {
path,
title: shareTitle,
imageUrl: shareImage
}
}
}
if (page.onShareTimeline) {
page.onShareTimeline = function () {
let { shareTitle, shareImage, shareQuery, shareFun, shareTrackData } = this
if (shareFun) shareFun()
// if (shareTrackData) that.reportShareData(shareTrackData)
shareQuery = that.setCommonShareQuery(shareQuery)
console.log(shareQuery)
return {
query: shareQuery,
title: shareTitle,
imageUrl: shareImage
}
}
}
page.onLoad = async function () {
onLoad && onLoad.apply(this, arguments)
if (this.onViewTrack) {
// const WXUSERINFO = await USERAPI.getWXUserInfo(),
// { USERINFO } = that.getCommonData(),
// shareInfo = this.options
// if (shareInfo.shareOpenId)
// reportData(
// {
// openId: WXUSERINFO.openId || '',
// unionId: WXUSERINFO.unionId || '',
// nickName: WXUSERINFO.nickName || '',
// avatar: WXUSERINFO.avatarUrl || '',
// phone: WXUSERINFO.phone || USERINFO.phone || '',
// ...shareInfo
// },
// 1
// )
}
}
}
getCommonData() {
const WXUSERINFO = wx.p.storage.get('wx_user_info'), //针对没登录用户,有openid
USERINFO = wx.p.storage.get('userInfo') //这个是针对登录的
return {
WXUSERINFO,
USERINFO
}
}
setCommonShareQuery(query) {
const { WXUSERINFO, USERINFO } = this.getCommonData(),
thisPage = wx.p.router.getPageInstance().options
query = `${query ? `?${query}&` : '?'}merchantId=${thisPage.merchantId || USERINFO.merchantId || ''}&shareOpenId=${thisPage.shareOpenId || WXUSERINFO.openId || ''}&sharePhone=${thisPage.sharePhone || USERINFO.phone || ''}`
return query
}
reportShareData(shareTrackData) {
const { WXUSERINFO, USERINFO } = this.getCommonData(),
thisPage = wx.p.router.getPageInstance().options
reportData({
openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '',
phone: WXUSERINFO.phone || '', //浏览用户授权的手机号
merchantId: thisPage.merchantId || USERINFO.merchantId || '',
shareOpenId: thisPage.shareOpenId || WXUSERINFO.openId || '',
sharePhone: thisPage.sharePhone || USERINFO.phone || '', //登陆人,服务商的手机号
...shareTrackData
})
}
}
export default new Share()
/**
*/
import mapApi from '../mapapi/mapapi'
import api from '~/api/request/http'
import { getUserInfo } from '~/utils/cache/userInfo'
// 实例化对象存储
import { Storage } from '~/utils/cache/storage'
const $Storage = new Storage()
let TRACK_TIME = null,
ADDRESS_INFO = null
const track_interval_time = 60 * 1e3
class TRACK {
constructor() {
console.log('---------------- 埋点初始化 ----------------')
this.initPageProxy()
// this.sendTrack()
//this.getAddressInfo().then(res => (ADDRESS_INFO = res))
// this.appHide()
}
/**监听页面 */
pageLeaveProxy(thisPage) {
let _this = this,
onHide = thisPage.onHide,
onUnload = thisPage.onUnload,
onLoad = thisPage.onLoad,
onShow = thisPage.onShow,
onTabItemTap = thisPage.onTabItemTap
thisPage.onTabItemTap = function (options) {
onTabItemTap && onTabItemTap.apply(this, arguments)
// , _this.setTrack({}, 1)
}
thisPage.onLoad = function () {
onLoad && onLoad.apply(this, arguments)
//, _this.setTrack({
// enterTime: new Date().format('yyyy-MM-dd hh:mm:ss')
// })
}
thisPage.onShow = function () {
onShow && onShow.apply(this, arguments)
// , (_this.getPageInstance().page_show_time = Date.now())
}
thisPage.onHide = function () {
let { page_show_time } = _this.getPageInstance()
onHide && onHide.apply(this, arguments)
// ,_this.setTrack(
// {
// duration: getDuration(page_show_time)
// },
// 2
// )
}
thisPage.onUnload = function () {
let { page_show_time } = _this.getPageInstance()
onUnload && onUnload.apply(this, arguments)
// ,_this.setTrack(
// {
// duration: getDuration(page_show_time)
// },
// 2
// )
}
const getDuration = page_show_time => (Date.now() - page_show_time) / 1e3
}
/**全局注册事件 */
initPageProxy() {
let thisPage = Page
let _this = this
Page = function (el) {
try {
el || (el = {}), _this.pageLeaveProxy(el), thisPage.apply(this, arguments)
} catch (el) {
thisPage.apply(this, arguments)
}
}
}
appShow() {
wx.onAppShow(() => {
// if (TRACK_TIME) clearInterval(TRACK_TIME)
// this.sendTrack()
// wx.offAppShow()
// this.appHide()
// console.log('---------------- 重新打开埋点 ----------------')
})
}
appHide() {
wx.onAppHide(() => {
// if (TRACK_TIME) clearInterval(TRACK_TIME)
// wx.offAppHide()
// this.appShow()
// console.log('---------------- APP隐藏 埋点停止推送 ----------------')
})
}
/**设置埋点数据 */
setTrack() {}
getGuestNo() {
let guest_no = $Storage.get('guest_no')
if (!guest_no) {
guest_no = this.setGuestNo()
$Storage.set('guest_no', guest_no)
}
return guest_no
}
/**定时发送埋点数据 */
sendTrack() {
TRACK_TIME = setInterval(() => {
let prepare_data = $Storage.get('prepare_data')
let data = {
method: 'entmicro.api.customercollect.reportCustomerList',
jsonList: prepare_data
}
if (prepare_data && prepare_data.length)
api.post(data, true).then(({ code, data, message }) => {
if (code == 0 && data) {
$Storage.set('prepare_data', [])
console.log('---------------- 埋点定时推送成功 ----------------', new Date().format('yyyy-MM-dd hh:mm:ss'), ':', prepare_data)
} else console.log('---------------- 埋点定时推送失败 ----------------', new Date().format('yyyy-MM-dd hh:mm:ss'), ':', message)
})
}, track_interval_time)
}
/**获取页面对象实例 */
getPageInstance = (size = 1) => {
const pages = getCurrentPages()
return pages[pages.length - size]
}
/**获取页面标题 */
getPageTitle() {
let { route, navigationBarTitleText } = this.getPageInstance()
if ('\u672a\u53d6\u5230' === route || !route) return ''
let title = ''
if (__wxConfig) {
let { window } = __wxConfig.page[`${route}.html`]
title = window.navigationStyle == 'custom' ? navigationBarTitleText : window.navigationBarTitleText
}
if (!title) title = '广联数科EHR系统'
return title
}
/**获取设备信息 */
getSystemInfo() {
let { SDKVersion, brand, model, system, version } = $Storage.get('system_info')
return {
SDK_version: SDKVersion,
brand,
model,
system,
version
}
}
/**获取门店信息 */
getMerchantInfo() {
let { merchantId } = $Storage.get('merchant_info')
return {
merchant_id: merchantId
}
}
/**获取用户位置信息 */
getAddressInfo() {
let addressInfo = $Storage.get('address_info')
return new Promise(resolve => {
if (addressInfo && Date.now() - addressInfo.createTime < 2 * 60 * 1e3) resolve(addressInfo)
else
wx.getLocation({
type: 'gcj02'
}).then(({ latitude, longitude }) => {
if (!addressInfo) this.setTrack({}, 5)
console.log('---------------- 更新地理位置 ----------------')
mapApi.detailedAdrress([latitude, longitude]).then(detail => {
let info = {
...detail,
createTime: Date.now()
}
resolve(info)
$Storage.set('address_info', info)
})
})
})
}
/**获取游客ID */
setGuestNo(length = 30) {
let name = '',
n = ['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', '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']
for (let i = 0; i < Number(length); i++) {
name += n[Math.round(Math.random() * (n.length - 1))]
}
return `GH_${name}_${Date.now()}`
}
}
wx.$Track = new TRACK()
/**
* 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss') //log 2020-07-31 10:00:00
*/
Date.prototype.format = function (fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'q+': Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds() //毫秒
}
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
for (let k in o) {
if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
}
return fmt
}
/**触底加载 */
const onReachBottom = (obj, callBack) => {
let _this = obj._this || wx.p.router.getPageInstance()
let {
pageNum,
total,
pageSize,
nothing
} = obj
if (!total && !pageNum) {
console.error('total&&pageNum为必传')
return
}
if (!pageSize) pageSize = 10
if (!nothing) nothing = 'nothing'
if (Math.ceil(total / pageSize) > pageNum) {
_this.setData({
pageNum: pageNum + 1
})
callBack()
} else {
_this.setData({
[nothing]: true
})
}
}
/**节流 */
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
// 返回新的函数
return function () {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments) //将this和参数传给原函数
_lastTime = _nowTime
}
}
}
/**删除对象里的null值 */
const clearObjNull = options => {
let obj = {}
Object.keys(options).map(e => {
if (options[e] != null && options[e] != undefined) {
if (typeof options[e] == 'object') {
Object.keys(options[e]).map(key => {
if (options[e][key] == null || options[e][key] == undefined) delete options[e][key]
})
}
obj[e] = options[e]
}
})
return obj
}
/**
* 判断是否是空对象
* @param {*} obj 传进来的对象
* @returns
*/
const isEmptyObj = obj => {
return JSON.stringify(obj) === '{}'
}
// 解析参数成对象 "actNum=1&activeNavIdx=0&isShare=true"
const parseString = str => {
// console.log('str: ', str);
if (!str) return
let obj = {}
let strArr = str.split('&')
// console.log('strArr: ', strArr);
strArr.forEach(item => {
// console.log("item: ", item);
let keyArr = item.split('=')
obj[keyArr[0]] = keyArr[1]
})
return obj
}
const Util = {
onReachBottom,
clearObjNull,
throttle,
isEmptyObj,
parseString,
}
export default Util
\ No newline at end of file
import {wxqrcode} from '~/lib/index.js'
/**
* 禁止滑动
*/
const noScroll = () => {}
/**设置粘贴板内容 */
const setCopyData = (data, callBack) => {
wx.setClipboardData({
data: data,
success(res) {
if (callBack && typeof callBack === 'function') callBack(res)
}
})
}
/**
* 防止重复点击
*/
const showLoading = (title = '') => {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.showLoading({
title,
mask: true
})
} else {
// 低版本采用Toast兼容处理并将时间设为20秒以免自动消失
wx.showToast({
title,
icon: 'loading',
mask: true,
duration: 20000
})
}
}
const hideLoading = () => {
if (wx.hideLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.hideLoading()
} else {
wx.hideToast()
}
}
const showToast = val => {
let obj = {}
if (val && typeof val === 'string') {
obj.title = val
obj.icon = 'none'
} else {
obj = val
}
return wx.showToast(obj)
}
/**获取设备信息 */
const getSystemInfo = callBack => {
wx.getSystemInfo({
success(res) {
callBack(res)
},
fail(err) {
callBack(err)
}
})
}
/**拨打电话 */
const phoneCall = phoneNumber => {
wx.makePhoneCall({
phoneNumber: `${phoneNumber}`
})
}
/**查看大图 */
const previewImage = params => {
wx.previewImage(params)
}
export function handleCopy(url) {
// var { idx } = e.currentTarget.dataset
// var currentItem = this.data.orderObj.activityList[idx]
var qr = wxqrcode.createQrCodeImg(url)
const base64src = function (base64data) {
return new Promise((resolve, reject) => {
const [a, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || []
if (!format) reject(new Error('ERROR_BASE64SRC_PARSE'))
const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src.${format}`
const buffer = wx.base64ToArrayBuffer(bodyData)
wx.getFileSystemManager().writeFile({
filePath,
data: buffer,
encoding: 'binary',
success() {
resolve(filePath)
},
fail() {
reject(new Error('ERROR_BASE64SRC_WRITE'))
}
})
})
}
base64src(qr).then(res => {
console.log(res)
wx.getImageInfo({
src: res,
success(obj) {
wx.showShareImageMenu({
path: obj.path
})
},
fail() {}
})
})
}
/**获取节点信息
* name(id获取class)
* callBack 回调函数
* componentThis是否在组件 (传组件this)
*/
const getViewInfo = (name, callBack, componentThis) => {
const query = !componentThis ? wx.createSelectorQuery() : wx.createSelectorQuery().in(componentThis)
query
.selectAll(name)
.boundingClientRect(res => {
callBack(res[0])
})
.exec()
}
/** 获取小程序 appId */
const getAppId = () => {
return wx.getAccountInfoSync().miniProgram.appId
}
const wxApi = {
previewImage,
getSystemInfo,
showLoading,
hideLoading,
setCopyData,
showToast,
phoneCall,
noScroll,
getViewInfo,
getAppId
}
export default wxApi
分类逻辑是 按功能区分 有多个相关就分类成一个文件夹 没有就单独一个文件
|-- utils
​ |-- constantData.js //静态变量导出
​ |-- Draw.js //画图方法
​ |-- emoji.js //表情方法相关
​ |-- evenbus.js //组件事件传递(已默认挂载在wx.$event)
​ |-- format.js (格式化 例如日期和价格)
​ |-- funcProtypeExtend.js (为函数挂hook)
​ |-- routerApi.js (处理路由相关的 参数解析和调整)
​ |-- util.js (处理wx对应api的方法)
​ |-- watch.js (实现vue watch功能)
​ |-- WxValidate.js (表单校验方法)
​ |-- cache (缓存相关)
​ | |-- storage.js (默认挂载在wx.p.storage)
​ | |-- storageApi.js ()
​ | |-- userInfo.js
​ |-- lib (导入的文件 跟业务没啥关系)
​ | |-- sentry-miniapp.js
​ | |-- wx-promise-pro.js
​ | |-- wxqrcode.js
​ | |-- wxUpdateManager.js
​ | |-- md5.js
| |-- sha1.js
| |-- qs.js
​ |-- mapapi (地图需要导入配置)
​ | |-- mapapi.js
​ |-- request (请求相关)
​ | |-- environment.js (切换请求环境 根据index )
​ | |-- http.js
​ | |-- request.js (封装的请求方法)
​
​ |-- track (埋点相关)
​ |-- Track.js
# 小程序模板 说明
<img src="./小程序通用模板文件结构.jpg" style="zoom:25%;" />
## 命名规范
小程序 components 组件文件夹命名规则是 第一个字母大写
其他文件适用驼峰规则
utils/constantData 文件为配置常量用 使用全大写加下滑线拼接
```js
const IMG_URL = 'xxx'
```
## 小程序配置sass
在project.config.json增加如下配置,对应页面新增.sass 编写即可
存在问题:
1. 小程序开发工具没有配套对应代码高亮功能, 可以vscode安装 sass 和Beautify css/sass/scss/less做代码高亮和格式化 然后在微信开发者工具中的拓展 选择从vscode 导入即可以实现高亮
2. 无法使用sass 的mixin功能
```
{
"setting": {
"useCompilerPlugins": [
"less"
]
}
}
```
Tips: 编译优先级 wxss>saas 或 wxss>less
## 小程序配置绝对路径
在 app.json 文件 新增 下面配置即可实现 [官方文档地址](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#resolveAlias)
```
~/* 使用时的路径前缀 /* 根目录下对应的文件名字
"resolveAlias": {
"~/*": "/*"
},
```
## stroage 存储使用说明
可点击查看[流程调用图](https://www.yuque.com/docs/share/fb9ef957-acd8-412b-9653-e7a4eb160876?# 《小程序缓存功能》)
默认小程序实例化时已自带挂载在全局对象下 无需单独引入 只需要获取全局小程序对象调用即可
使用promise风格处理成功结果then里面获取,处理失败catch获取
方法有三个方法(注意! rm方法无key值为清空全部存储值)
get: 通过 wx.p.storage.get 调用
​ 输入值: 1.key对象 2. syncFlag (同步状态,true 为同步, false (异步),默认)
key为空值会返回默认定义的数组集合参数 为关键字则返回定义的数组集合参数 (这个方法是一个对象)
都不是则作为取值的key
​ 输出: 对应key值的JSON.parse 内容(没有对应的key 默认返回空)
set: 通过 $storage.set 或setStorage 调用
​ 输入值: 1.key对象
​ 2.data | 要存储的值,会转换为 JSON 串进行存储
​ 3.syncFlag (同步状态,默认 false (异步),true 为同步)
​ 输出: 存储成功或错误提示
rm: 通过 $Storage.rm 或rmStorage 调用
​ 输入值: 1.key对象 | 要操作的键值,为空则清空所有,有值则清空指定的值
​ 2.syncFlag | 同步状态,默认 false (异步),true 为同步
​ 输出: 删除key值的成功或错误提示
```javascript
代码示例
设置缓存
wx.p.storage
.set('aaa', { a: 'a', b: 'b' })
.then(res => {
//成功之后的逻辑代码
})
.catch(err => {
console.log(err)
})
取变量方法 默认同步取值写法(没有值是返回空值回来)
wx.p.storage.get('key值')
异步写法
wx.p.storage.get('key值',false).then((result)=>console.log(result)).catch((error)=>)
```
## 路由钩子使用说明
| - utils
​ | - funcProtypeExtend.js 扩展函数原型上的方法
| - router
​ | - index.js 最终生成导出路由实例文件,包含前置、后置钩子逻辑
​ | - router.js 路由实例类,分享了一些路由常用的方法,跳转,返回等
​ | - routerBefore.js 路由前置钩子的业务逻辑(后置钩子类似)
​ | - routers.js 生成特定格式的路由配置
​ | - wxOnAppRoute.js 执行wx.onAppRoute期间的钩子
使用方法:在/router/index.js下
```javascript
import routerBefore from "./routerBefore.js";
// 添加路由前置后置钩子
let routerInstance = () => {
return new Router(routes);
};
routerInstance = routerInstance
.before(function () {
console.log("前置");
/**处理前置钩子逻辑 */
routerBefore()
})
.after(function () {
/**处理后置钩子逻辑 */
console.log("后置");
});
在routerBefore.js文件写上相应的逻辑即可完成前置的一些逻辑,路由后置钩子类似。
```
## 提示统一管理
| - utils
​ | - wxShowToast.js 微信校验通知类工具封装
使用方式,用法,参数和**wx**的**showToast**用法一致
```js
import wxShowToast from './utils/wxShowToast.js'
使用方法一:wxShowToast(name,params)
使用内置的文本,以 tipsObj 中 phone 为例:(tipsObj可扩展)
wxShowToast('phone',{duration:2000})
使用方法二:wxShowToast(params)
完全自定义里边的参数,与wx的showToast一致:
wxShowToast({
title: '成功',
icon: 'success',
duration: 2000
})
```
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!