diff --git a/app.wxss b/app.wxss index 40a8d80..4f44d2a 100644 --- a/app.wxss +++ b/app.wxss @@ -13,4 +13,9 @@ width: 0; height: 0; color: transparent; +} + +page { + width: 100%; + height: 100%; } \ No newline at end of file diff --git a/miniprogram_npm/.DS_Store b/miniprogram_npm/.DS_Store deleted file mode 100644 index e3b0527..0000000 Binary files a/miniprogram_npm/.DS_Store and /dev/null differ diff --git a/miniprogram_npm/dayjs/index.js b/miniprogram_npm/dayjs/index.js index 91e0815..578d740 100644 --- a/miniprogram_npm/dayjs/index.js +++ b/miniprogram_npm/dayjs/index.js @@ -4,10 +4,10 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; -__DEFINE__(1683383058314, function(require, module, exports) { +__DEFINE__(1689036503189, function(require, module, exports) { !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=QRCode.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var o=-1;o<=7;o++)e+o<=-1||this.moduleCount<=e+o||(this.modules[t+r][e+o]=0<=r&&r<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=QRUtil.getLostPoint(this);(0==r||t>o)&&(t=o,e=r)}return e},createMovieClip:function(t,e,r){var o=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;r<18;r++){o=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,o=QRUtil.getBCHTypeInfo(r),n=0;n<15;n++){var i=!t&&1==(o>>n&1);n<6?this.modules[n][8]=i:n<8?this.modules[n+1][8]=i:this.modules[this.moduleCount-15+n][8]=i}for(n=0;n<15;n++){i=!t&&1==(o>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=i:n<9?this.modules[8][15-n-1+1]=i:this.modules[8][15-n-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[o][a-s]){var u=!1;i>>n&1)),QRUtil.getMask(e,o,a-s)&&(u=!u),this.modules[o][a-s]=u,-1==--n&&(i++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},QRCode.PAD0=236,QRCode.PAD1=17,QRCode.createData=function(t,e,r){for(var o=QRRSBlock.getRSBlocks(t,e),n=new QRBitBuffer,i=0;i8*s)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*s+")");for(n.getLengthInBits()+4<=8*s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*s||(n.put(QRCode.PAD0,8),n.getLengthInBits()>=8*s));)n.put(QRCode.PAD1,8);return QRCode.createBytes(n,o)},QRCode.createBytes=function(t,e){for(var r=0,o=0,n=0,i=new Array(e.length),a=new Array(e.length),s=0;s=0?g.get(c):0}}var d=0;for(h=0;h=0;)e^=QRUtil.G15<=0;)e^=QRUtil.G18<>>=1;return e},getPatternPosition:function(t){return QRUtil.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case QRMaskPattern.PATTERN000:return(e+r)%2==0;case QRMaskPattern.PATTERN001:return e%2==0;case QRMaskPattern.PATTERN010:return r%3==0;case QRMaskPattern.PATTERN011:return(e+r)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case QRMaskPattern.PATTERN101:return e*r%2+e*r%3==0;case QRMaskPattern.PATTERN110:return(e*r%2+e*r%3)%2==0;case QRMaskPattern.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new QRPolynomial([1],0),r=0;r5&&(r+=3+i-5)}for(o=0;o=256;)t-=255;return QRMath.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},i=0;i<8;i++)QRMath.EXP_TABLE[i]=1<=1&&n<=127?e+=t.charAt(r):n>2047?(e+=String.fromCharCode(224|n>>12&15),e+=String.fromCharCode(128|n>>6&63),e+=String.fromCharCode(128|n>>0&63)):(e+=String.fromCharCode(192|n>>6&31),e+=String.fromCharCode(128|n>>0&63));return e}function drawQrcode(t,e){if(t=t||{},(t=extend(!0,{canvasId:"myQrcode",text:"爱一个人就要勇敢说出来",width:260,height:260,padding:20,typeNumber:-1,correctLevel:QRErrorCorrectLevel.H,background:"#ffffff",foreground:"#000000",image:{imageResource:"",width:80,height:80,round:!0}},t)).canvasId||t.canvas){if(t.paddingColor||(t.paddingColor=t.background),e){var r=new QRCode(t.typeNumber,t.correctLevel);return r.addData(utf16to8(t.text)),r.make(),new Promise(function(t,e){t(r)})}return new Promise(function(e,r){return e(function(){var e=new QRCode(t.typeNumber,t.correctLevel);e.addData(utf16to8(t.text)),e.make();const r=wx.getSystemInfoSync().pixelRatio;var o=t.canvas;const n=o.getContext("2d");o.width=t.width*r,o.height=t.width*r;const i=o.width;n.fillStyle=t.paddingColor,n.fillRect(0,0,i+2*t.padding,i+2*t.padding);for(var a=(i-2*t.padding)/e.getModuleCount(),s=(i-2*t.padding)/e.getModuleCount(),u=0;u>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},module.exports=drawQrcode; }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); }) -return __REQUIRE__(1683383058315); +return __REQUIRE__(1689036503190); })() //miniprogram-npm-outsideDeps=[] //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/miniprogram_npm/wxml2canvas/index.js b/miniprogram_npm/wxml2canvas/index.js new file mode 100644 index 0000000..e05f508 --- /dev/null +++ b/miniprogram_npm/wxml2canvas/index.js @@ -0,0 +1,1533 @@ +module.exports = (function() { +var __MODS__ = {}; +var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; }; +var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; +var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; +var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; +__DEFINE__(1689036503191, function(require, module, exports) { +var __TEMP__ = require('./src/index');var Wxml2Canvas = __REQUIRE_DEFAULT__(__TEMP__); + +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });exports.default = Wxml2Canvas; +}, function(modId) {var map = {"./src/index":1689036503192}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503192, function(require, module, exports) { +var __TEMP__ = require('./util');var Util = __REQUIRE_DEFAULT__(__TEMP__); + +const imageMode = ['scaleToFill', 'aspectFit', 'aspectFill', 'widthFix', 'top', 'bottom', 'center', 'left', 'right', 'top left', 'top right', 'bottom left', 'bottom right'] + +class Wxml2Canvas { + constructor (options = {}) { + this.device = wx.getSystemInfoSync && wx.getSystemInfoSync() || {}; + + if (!options.zoom) { + this.zoom = this.device.windowWidth / 375; + } else { + this.zoom = options.zoom || 1; + } + + this.element = options.element; + this.object = options.obj; + this.width = options.width * this.zoom || 0; + this.height = options.height * this.zoom || 0; + this.destZoom = options.destZoom || 3; + this.destWidth = this.width * this.destZoom; + this.destHeight = this.height * this.destZoom; + this.translateX = options.translateX * this.zoom || 0; + this.translateY = options.translateY * this.zoom || 0; + this.gradientBackground = options.gradientBackground || null; + this.background = options.background || '#ffffff'; + this.finishDraw = options.finish || function finish(params) {} + this.errorHandler = options.error || function error(params) {} + this.progress = options.progress || function progress(params) {} + this.textAlign = options.textAlign || 'left'; + this.fullText = options.fullText || false; + this.font = options.font || '14px PingFang SC'; + + this._init(); + } + + draw (data = {}, that) { + let self = this; + this.data = data; + this.fef = that; + + this.progress(10); + this._preloadImage(data.list).then((result) => { + this.progress(30); + self._draw(); + }).catch((res) => { + self.errorHandler(res); + }) + } + + measureWidth (text, font) { + if(font) { + this.ctx.font = font; + } + let res = this.ctx.measureText(text) || {}; + return res.width || 0; + } + + _init () { + this.progressPercent = 0; // 绘制进度百分比 + this.data = null; + this.ref = null; + this.allPic = []; + this.screenList = []; + this.asyncList = []; + this.imgUrl = ''; + this.progressPercent = 0; + this.distance = 0; + this.progress(0); + + this.ctx = wx.createCanvasContext(this.element, this.obj); + this.ctx.font = this.font; + this.ctx.setTextBaseline('top'); + this.ctx.setStrokeStyle('white'); + + this.debug = this.device.platform === 'devtools' ? true : false; + + this._drawBakcground(); + } + + _drawBakcground () { + if (this.gradientBackground) { + let line = this.gradientBackground.line || [0, 0, 0, this.height]; + let color = this.gradientBackground.color || ['#fff', '#fff']; + let style = { fill: { line, color } } + this._drawRectToCanvas(0, 0, this.width, this.height, style); + } else { + let style = { fill: this.background } + this._drawRectToCanvas(0, 0, this.width, this.height, style); + } + } + + _draw () { + let self = this; + let list = this.data.list || []; + let index = 0; + let all = []; + let count = 0; + + list.forEach(item => { + if(item.type === 'wxml') { + count += 3; + } else { + count += 1; + } + }) + + this.distance = 60 / (count || 1); // 进度条的间距 + this.progressPercent = 30; + this.asyncList = list.filter( item => item.delay == true ); + list = list.filter( item => item.delay != true ); + drawList(list); + + Promise.all(all).then(results => { + index = 0; + drawList(self.asyncList, true); + + Promise.all(all).then(results => { + self.progress(90); + self._saveCanvasToImage(); + }); + }).catch (e => { + console.log(e) + self.errorHandler(e); + }); + + function drawList(list = [], noDelay) { + list.forEach((item, i) => { + all[index++] = new Promise((resolve, reject) => { + let attr = item.style; + item.progress = self.distance; + if (noDelay) { + item.delay = 0; + } + if (item.type === 'radius-image') { + self._drawCircle(item, attr, resolve, reject, 'image'); + } else if (item.type === 'text') { + self._drawText(item, attr, resolve, reject); + } else if (item.type === 'line') { + self._drawLine(item, attr, resolve, reject); + } else if (item.type === 'circle') { + self._drawCircle(item, attr, resolve, reject); + } else if (item.type === 'rect') { + self._drawRect(item, attr, resolve, reject); + } else if (item.type === 'image') { + self._drawRect(item, attr, resolve, reject, 'image'); + } else if (item.type === 'wxml') { + self._drawWxml(item, attr, resolve, reject); + }else { + resolve(); + } + }); + }); + } + } + + _saveCanvasToImage () { + let self = this; + + // 延时保存有两个原因,一个是等待绘制delay的元素,另一个是安卓上样式会错乱 + setTimeout(() => { + self.progress(95); + + let obj = { + x: 0, + y: 0, + width: self.width, + height: self.height, + canvasId: self.element, + success: function (res) { + + self.progress(100); + self.imgUrl = res.tempFilePath; + self.finishDraw(self.imgUrl); + }, + fail: function (res) { + + self.errorHandler({errcode: 1000, errmsg: 'save canvas error', e: res}); + } + } + + if(self.destZoom !== 3) { + obj.destWidth = self.destWidth; + obj.destHeight = self.destHeight; + } + + wx.canvasToTempFilePath(obj, self.object); + }, self.device.system.indexOf('iOS') === -1 ? 300 : 100); + } + + _preloadImage (list = []) { + let self = this; + let all = []; + let count = 0; + + list.forEach((item, i) => { + if (item.url && self._findPicIndex(item.url) === -1) { + + // 避免重复下载同一图片 + self.allPic.push({ + url: item.url, + local: '' + }); + all[count++] = new Promise((resolve, reject) => { + // 非http(s)域名的就不下载了 + if (!/^http/.test(item.url) || /^http:\/\/(tmp)|(usr)\//.test(item.url) || /^http:\/\/127\.0\.0\.1/.test(item.url)) { + if(item.isBase64) { + let fileManager = wx.getFileSystemManager(); + + fileManager.writeFile({ + filePath: item.url, + data: item.isBase64.replace(/data:image\/(.*);base64,/, ''), + encoding: 'base64', + success (res) { + imageInfo(item.url); + }, + fail (res) { + reject(res); + }, + }) + + }else { + imageInfo(item.url); + } + + function imageInfo (url) { + wx.getImageInfo({ + src: url, + success (res) { + let index = self._findPicIndex(url); + if(index > -1) { + self.allPic[index].local = url; + self.allPic[index].width = res.width; + self.allPic[index].height = res.height; + } + resolve({ tempFilePath: url }); + }, + fail (res) { + reject(res); + } + }) + } + } else { + wx.downloadFile({ + url: item.url.replace(/^https?/, 'https'), + success: function (res) { + wx.getImageInfo({ + src: res.tempFilePath, + success (img) { + let index = self._findPicIndex(item.url); + if (index > -1) { + self.allPic[index].local = res.tempFilePath; + self.allPic[index].width = img.width; + self.allPic[index].height = img.height; + } + resolve(res); + }, + fail (res) { + reject(res); + } + }) + }, + fail: (res) => { + reject({errcode: 1001, errmsg: 'download pic error'}); + } + }) + } + }) + } + }); + + return Promise.all(all).then(results => { + return new Promise(resolve => { resolve() }) + }).catch((results) => { + return new Promise((resolve, reject) => { reject(results) }) + }) + } + + _findPicIndex (url) { + let index = this.allPic.findIndex(pic => pic.url === url); + return index; + } + + _drawRect (item, style, resolve, reject, isImage, isWxml) { + let zoom = this.zoom; + let leftOffset = 0; + let topOffset = 0; + let width = style.width; + let height = style.height; + let imgWidth = style.width; + let imgHeight = style.height; + let mode = null; + + try { + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style); + + let url; + if(isImage) { + let index = this._findPicIndex(item.url); + if(index > -1) { + url = this.allPic[index].local + imgWidth = this.allPic[index].width + imgHeight = this.allPic[index].height + }else { + url = item.url; + } + } + + style.padding = style.padding || []; + if(isWxml === 'inline-wxml') { + item.x = item.x + (style.padding[3] && style.padding[3] || 0) + item.y = item.y + (style.padding[0] && style.padding[0] || 0) + } + + leftOffset = item.x + style.width + (style.padding[1] && style.padding[1] || 0); + + if(!isWxml) { + width = width * zoom; + height = height * zoom; + } + + if(style.dataset && style.dataset.mode && imageMode.indexOf(style.dataset.mode) > -1) { + mode = { + type: style.dataset.mode, + width: imgWidth, + height: imgHeight + }; + } + + this._drawRectToCanvas(item.x, item.y, width, height, style, url, mode); + this._updateProgress(item.progress); + + if(resolve) { + resolve(); + }else { + return { + leftOffset, + topOffset + } + } + } catch (e) { + reject && reject({ errcode: (isImage ? 1003 : 1002), errmsg: (isImage ? 'drawImage error' : 'drawRect error'), e }); + } + } + + _drawRectToCanvas (x, y, width, height, style, url, mode) { + let { fill, border, boxShadow } = style; + this.ctx.save(); + this._drawBoxShadow(boxShadow, (res) => { + // 真机上填充渐变色时,没有阴影,先画个相等大小的纯色矩形来实现阴影 + if(fill && typeof fill !== 'string' && !this.debug) { + this.ctx.setFillStyle(res.color || '#ffffff'); + this.ctx.fillRect(x, y, width, height); + } + }); + + if(url) { + // 开发者工具有bug,先不裁剪 + if(mode) { + this._resetImageByMode(url, x, y, width, height, mode); + }else { + this.ctx.drawImage(url, x, y, width, height) + } + }else { + this._setFill(fill, () => { + this.ctx.fillRect(x, y, width, height); + }); + } + + this._drawBorder(border, style, (border) => { + let fixBorder = border.width; + this.ctx.strokeRect(x - fixBorder / 2, y - fixBorder / 2, width + fixBorder, height + fixBorder); + }); + + this.ctx.draw(true); + this.ctx.restore(); + } + + _resetImageByMode (url, x, y, width, height, mode) { + let self = this; + let offsetX = 0; + let offsetY = 0; + let imgWidth = mode.width; + let imgHeight = mode.height; + + switch (mode.type) { + case 'scaleToFill': + imgWidth = width; + imgHeight = height; + self.ctx.drawImage(url, x, y, width, height) + break; + case 'widthFix': + height = width / ((imgWidth || 1) / (imgHeight || 1)) + self.ctx.drawImage(url, x, y, width, height) + break; + case 'aspectFit': + if(imgWidth > imgHeight) { + let realHeight = width / ((imgWidth || 1) / (imgHeight || 1)) + offsetY = -(height - realHeight) / 2 + imgWidth = width; + imgHeight = realHeight; + }else { + let realWidth = height / ((imgHeight || 1) / (imgWidth || 1)) + offsetX = -(width - realWidth) / 2 + imgWidth = realWidth; + imgHeight = height; + } + + _clip(); + break; + case 'aspectFill': + if(imgWidth > imgHeight) { + let realWidth = imgWidth / ((imgHeight || 1) / (height || 1)) + offsetX = (realWidth - width) / 2 + imgWidth = realWidth; + imgHeight = height; + }else { + let realHeight = imgHeight / ((imgWidth || 1) / (width || 1)) + offsetY = (realHeight - height) / 2 + imgWidth = width; + imgHeight = realHeight; + } + + _clip(); + break; + case 'top left': + _clip(); + break; + case 'top': + offsetX = (mode.width - width) / 2; + _clip(); + break; + case 'top right': + offsetX = (mode.width - width); + _clip(); + break; + case 'left': + offsetY = (mode.height - height) / 2; + _clip(); + break; + case 'center': + offsetX = (mode.width - width) / 2; + offsetY = (mode.height - height) / 2; + _clip(); + break; + case 'right': + offsetX = (mode.width - width); + offsetY = (mode.height - height) / 2; + _clip(); + break; + case 'bottom left': + offsetY = (mode.height - height) + _clip(); + break; + case 'bottom': + offsetX = (mode.width - width) / 2; + offsetY = (mode.height - height) + _clip(); + break; + case 'bottom right': + offsetX = (mode.width - width); + offsetY = (mode.height - height) + _clip(); + break; + default: + imgWidth = width; + imgHeight = height; + break; + } + + function _clip () { + self.ctx.save(); + self.ctx.beginPath() + self.ctx.rect(x, y, width, height) + self.ctx.clip(); + self.ctx.drawImage(url, x - offsetX, y - offsetY, imgWidth, imgHeight) + self.ctx.closePath(); + self.ctx.restore(); + } + } + + _drawText (item, style, resolve, reject, type, isWxml) { + let zoom = this.zoom; + let leftOffset = 0; + let topOffset = 0; + + try { + style.fontSize = this._parseNumber(style.fontSize); + let fontSize = Math.ceil((style.fontSize || 14) * zoom) + this.ctx.setTextBaseline('top'); + this.ctx.font = (`${style.fontWeight ? (style.fontWeight) : 'normal'} ${ fontSize }px ${ style.fontFamily || 'PingFang SC' }`); + this.ctx.setFillStyle(style.color || '#454545'); + + let text = item.text || ''; + let textWidth = Math.floor(this.measureWidth(text, style.font || this.ctx.font)); + let lineHeight = this._getLineHeight(style); + let textHeight = Math.ceil(textWidth / (style.width || textWidth)) * lineHeight; + let width = Math.ceil((style.width || textWidth) * (!isWxml ? zoom : 1)); + let whiteSpace = style.whiteSpace || 'wrap'; + let x = 0; + let y = 0; + + if(typeof style.padding === 'string') { + style.padding = Util.transferPadding(style.padding); + } + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style, textHeight); + this._drawBoxShadow(style.boxShadow); + + if(style.background || style.border) { + this._drawTextBackgroud(item, style, textWidth, textHeight, isWxml); + } + + // 行内文本 + if(type === 'inline-text') { + width = item.maxWidth; + if(item.leftOffset + textWidth > width) { + // 如果上一个行内元素换行了,这个元素要继续在后面补足一行 + let lineNum = Math.max(Math.floor(textWidth / width), 1); + let length = text.length; + let singleLength = Math.floor(length / lineNum); + let widthOffset = item.leftOffset ? item.leftOffset - item.originX : 0; + let { endIndex: currentIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, 0, widthOffset) + x = this._resetTextPositionX(item, style, singleWidth); + y = this._resetTextPositionY(item, style); + this.ctx.fillText(single, x, y); + leftOffset = x + singleWidth; + topOffset = y; + + // 去除第一行补的内容,然后重置 + text = text.substring(currentIndex, text.length); + currentIndex = 0; + lineNum = Math.max(Math.floor(textWidth / width), 1); + textWidth = Math.floor(this.measureWidth(text, style.font || this.ctx.font)); + item.x = item.originX; // 还原换行后的x + for (let i = 0; i < lineNum; i++) { + let { endIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, currentIndex); + currentIndex = endIndex; + if(single) { + x = this._resetTextPositionX(item, style, singleWidth, width); + y = this._resetTextPositionY(item, style, i + 1); + this.ctx.fillText(single, x, y); + if(i === lineNum - 1) { + leftOffset = x + singleWidth; + topOffset = lineHeight * lineNum; + } + } + } + + let last = text.substring(currentIndex, length); + let lastWidth = this.measureWidth(last); + + if(last) { + x = this._resetTextPositionX(item, style, lastWidth, width); + y = this._resetTextPositionY(item, style, lineNum + 1); + this.ctx.fillText(last, x, y); + leftOffset = x + lastWidth; + topOffset = lineHeight * (lineNum + 1); + } + }else { + x = this._resetTextPositionX(item, style, textWidth, width); + y = this._resetTextPositionY(item, style); + this.ctx.fillText(item.text, x, y); + leftOffset = x + textWidth; + topOffset = lineHeight; + } + }else { + // block文本,如果文本长度超过宽度换行 + if (width && textWidth > width && whiteSpace !== 'nowrap') { + let lineNum = Math.max(Math.floor(textWidth / width), 1); + let length = text.length; + let singleLength = Math.floor(length / lineNum); + let currentIndex = 0; + + // lineClamp参数限制最多行数 + if (style.lineClamp && lineNum + 1 > style.lineClamp) { + lineNum = style.lineClamp - 1; + } + + for (let i = 0; i < lineNum; i++) { + let { endIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, currentIndex); + currentIndex = endIndex; + x = this._resetTextPositionX(item, style, singleWidth, width); + y = this._resetTextPositionY(item, style, i); + this.ctx.fillText(single, x, y); + + } + + // 换行后剩余的文字,超过一行则截断增加省略号 + let last = text.substring(currentIndex, length); + let lastWidth = this.measureWidth(last); + if(lastWidth > width) { + let { single, singleWidth } = this._getTextSingleLine(last, width, singleLength); + lastWidth = singleWidth; + last = single.substring(0, single.length - 1) + '...'; + } + + x = this._resetTextPositionX(item, style, lastWidth, width); + y = this._resetTextPositionY(item, style, lineNum); + this.ctx.fillText(last, x, y); + + }else { + x = this._resetTextPositionX(item, style, textWidth, width); + y = this._resetTextPositionY(item, style); + this.ctx.fillText(item.text, x, y); + } + } + + this.ctx.draw(true); + + this._updateProgress(item.progress); + + if(resolve) { + resolve(); + }else { + return { + leftOffset, + topOffset + } + } + } catch(e) { + reject && reject({ errcode: 1004, errmsg: 'drawText error', e: e }); + } + } + + _drawTextBackgroud (item, style, textWidth, textHeight, isWxml) { + if(!style.width) return; + let zoom = isWxml ? 1 : this.zoom; + let width = style.width || textWidth; + let height = style.height || textHeight; + let rectStyle = { + fill: style.background, + border: style.border + } + style.padding = style.padding || [0, 0, 0, 0]; + width += (style.padding[1] || 0) + (style.padding[3] || 0); + height += (style.padding[0] || 0) + (style.padding[2] || 0); + width = width * zoom + height = height * zoom + this._drawRectToCanvas(item.x, item.y, width, height, rectStyle); + } + + _drawCircle (item, style, resolve, reject, isImage, isWxml) { + let zoom = this.zoom; + let r = style.r; + try { + + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style); + + let url; + if(isImage) { + let index = this._findPicIndex(item.url); + if (index > -1) { + url = this.allPic[index].local; + } else { + url = item.url; + } + } + + if(!isWxml) { + r = r * zoom; + } + + this._drawCircleToCanvas(item.x, item.y, r, style, url); + + this._updateProgress(item.progress); + resolve && resolve(); + } catch (e) { + reject && reject({ errcode: (isImage ? 1006 : 1005), errmsg: (isImage ? 'drawCircleImage error' : 'drawCircle error'), e }); + } + } + + _drawCircleToCanvas (x, y, r, style, url) { + let { fill, border, boxShadow } = style; + + this.ctx.save(); + + this._drawBoxShadow(boxShadow, (res) => { + // 真机上填充渐变色时,没有阴影,先画个相等大小的纯色矩形来实现阴影 + if((fill && typeof fill !== 'string') || (url && res.color)) { + this.ctx.setFillStyle(res.color || '#ffffff'); + this.ctx.beginPath(); + this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI); + this.ctx.closePath(); + this.ctx.fill(); + } + }); + + if(url) { + this.ctx.save(); + this.ctx.beginPath(); + this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI); + this.ctx.clip(); + this.ctx.drawImage(url, x, y, r * 2, r * 2); + this.ctx.closePath(); + this.ctx.restore(); + }else { + this._setFill(fill, () => { + this.ctx.beginPath(); + this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI); + this.ctx.closePath(); + this.ctx.fill(); + }); + } + + this._drawBorder(border, style, (border) => { + this.ctx.beginPath() + this.ctx.arc(x + r, y + r, r + border.width / 2, 0, 2 * Math.PI) + this.ctx.stroke() + this.ctx.closePath(); + }); + + this.ctx.draw(true); + this.ctx.restore(); + } + + _drawLine (item, style, resolve, reject, isWxml) { + let zoom = this.zoom; + try { + let x1 = item.x * zoom + this.translateX; + let y1 = item.y * zoom + this.translateY; + let x2 = item.x2 * zoom + this.translateX; + let y2 = item.y2 * zoom + this.translateY; + this._drawLineToCanvas(x1, y1, x2, y2, style); + + this._updateProgress(item.progress); + resolve && resolve(); + } catch (e) { + reject && reject({ errcode: 1007, errmsg: 'drawLine error', e }); + } + } + + _drawLineToCanvas (x1, y1, x2, y2, style) { + let { stroke, dash, boxShadow } = style; + + this.ctx.save(); + if(stroke) { + this._setStroke(stroke); + } + + this._drawBoxShadow(boxShadow); + + if(dash) { + let dash = [style.dash[0] || 5, style.dash[1] || 5]; + let offset = style.dash[2] || 0; + this.ctx.setLineDash(dash, offset || 0); + } + + this.ctx.moveTo(x1, y1); + this.ctx.setLineWidth((style.width || 1) * this.zoom); + this.ctx.lineTo(x2, y2); + this.ctx.stroke(); + this.ctx.draw(true); + this.ctx.restore(); + } + + // 废弃,合并到_drawRect + _drawImage (item, style, resolve, reject, isWxml) { + let zoom = this.zoom; + try { + + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style); + item.x = item.x + (style.padding[3] || 0); + item.y = item.y + (style.padding[0] || 0); + + let index = this._findPicIndex(item.url); + let url = index > -1 ? this.allPic[index].local : item.url; + this._drawImageToCanvas(url, item.x, item.y, style.width * zoom, style.height * zoom, style); + + this._updateProgress(item.progress); + resolve && resolve(); + } catch (e) { + reject && reject({ errcode: 1012, errmsg: 'drawRect error', e }); + } + } + + // 废弃,合并到_drawRect + _drawImageToCanvas (url, x, y, width, height, style) { + let { fill, border, boxShadow } = style; + this.ctx.save(); + + this._drawBoxShadow(boxShadow); + this.ctx.drawImage(url, x, y, width, height); + + this._drawBorder(border, style, (border) => { + let fixBorder = border.width; + this.ctx.strokeRect(x - fixBorder / 2, y - fixBorder / 2, width + fixBorder, height + fixBorder); + }); + this.ctx.draw(true); + this.ctx.restore(); + } + + _drawWxml (item, style, resolve, reject) { + let self = this; + let all = []; + try { + this._getWxml(item, style).then((results) => { + + // 上 -> 下 + let sorted = self._sortListByTop(results[0]); + let count = 0; + let progress = 0; + Object.keys(sorted).forEach(item => { + count += sorted[item].length; + }) + progress = this.distance * 3 / (count || 1); + + all = this._drawWxmlBlock(item, sorted, all, progress, results[1]); + all = this._drawWxmlInline(item, sorted, all, progress, results[1]); + + Promise.all(all).then(results => { + resolve && resolve(); + }).catch (e => { + reject && reject(e); + }); + }); + } catch (e) { + reject && reject({ errcode: 1008, errmsg: 'drawWxml error' }); + } + } + + _drawWxmlBlock (item, sorted, all, progress, results) { + let self = this; + // 用来限定位置范围,取相对位置 + let limitLeft = (results ? results.left : 0); + let limitTop = (results ? results.top : 0); + Object.keys(sorted).forEach((top, topIndex) => { + // 左 -> 右 + let list = sorted[top].sort((a, b) => { + return (a.left - b.left); + }); + + list = list.filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') === -1); + + list.forEach((sub, index) => { + all[index] = new Promise((resolve2, reject2) => { + sub = self._transferWxmlStyle(sub, item, limitLeft, limitTop); + sub.progress = progress; + let type = sub.dataset.type; + if(sub.dataset.delay) { + setTimeout(() => { + drawWxmlItem(); + }, sub.dataset.delay) + } else { + drawWxmlItem(); + } + function drawWxmlItem () { + if (type === 'text') { + self._drawWxmlText(sub, resolve2, reject2); + } else if (type === 'image') { + self._drawWxmlImage(sub, resolve2, reject2); + } else if (type === 'radius-image') { + self._drawWxmlCircleImage(sub, resolve2, reject2); + } else if (type === 'background-image') { + self._drawWxmlBackgroundImage(sub, resolve2, reject2); + } + } + }); + }); + }); + + return all; + + } + + _drawWxmlInline (item, sorted, all, progress, results) { + let self = this; + let topOffset = 0; + let leftOffset = 0; + let lastTop = 0; + let limitLeft = (results ? results.left : 0); + let limitTop = (results ? results.top : 0); + let p = new Promise((resolve2, reject2) => { + let maxWidth = 0; + let minLeft = Infinity; + let maxRight = 0; + + // 找出同一top下的最小left和最大right,得到最大的宽度,用于换行 + Object.keys(sorted).forEach(top => { + let inlineList = sorted[top].filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') > -1); + inlineList.forEach(sub => { + if(sub.left < minLeft) { + minLeft = sub.left + } + if(sub.right > maxRight) { + maxRight = sub.right; + } + }) + }); + maxWidth = Math.ceil((maxRight - minLeft) || self.width); + + Object.keys(sorted).forEach((top, topIndex) => { + // 左 -> 右 + let list = sorted[top].sort((a, b) => { + return (a.left - b.left); + }); + + // 换行的行内元素left放到后面,version2.0.6后无法获取高度,改用bottom值来判断是否换行了 + let position = -1; + for(let i = 0, len = list.length; i < len; i++) { + if(list[i] && list[i + 1]) { + if(list[i].bottom > list[i + 1].bottom) { + position = i; + break; + } + } + } + + if(position > -1) { + list.push(list.splice(position, 1)[0]); + } + + let inlineList = list.filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') > -1); + let originLeft = (inlineList[0] ? inlineList[0].left : 0); + // 换行后和top不相等时,认为是换行了,要清除左边距;当左偏移量大于最大宽度时,也要清除左边距; 当左偏移小于左边距时,也要清除 + if (Math.abs(topOffset + lastTop - top) > 2 || leftOffset - originLeft - limitLeft >= maxWidth || leftOffset <= originLeft - limitLeft - 2) { + leftOffset = 0; + } + + lastTop = +top; + topOffset = 0; + + inlineList.forEach((sub, index) => { + sub = self._transferWxmlStyle(sub, item, limitLeft, limitTop); + sub.progress = progress; + let type = sub.dataset.type; + if (type === 'inline-text') { + let drawRes = self._drawWxmlInlineText(sub, leftOffset, maxWidth); + leftOffset = drawRes.leftOffset; + topOffset = drawRes.topOffset; + } else if (type === 'inline-image') { + let drawRes = self._drawWxmlImage(sub) || {}; + leftOffset = drawRes.leftOffset || 0; + topOffset = drawRes.topOffset || 0; + } + }); + }); + resolve2(); + }) + + all.push(p); + return all; + } + + _drawWxmlInlineText (sub, leftOffset = 0, maxWidth) { + let text = sub.dataset.text || ''; + if(sub.dataset.maxlength && text.length > sub.dataset.maxlength) { + text = text.substring(0, sub.dataset.maxlength) + '...'; + } + + let textData = { + text, + originX: sub.left, + x: leftOffset ? leftOffset : sub.left, + y: sub.top, + progress: sub.progress, + leftOffset: leftOffset, + maxWidth: maxWidth // 行内元素的最大宽度,取决于limit的宽度 + } + + if (sub.backgroundColor !== 'rgba(0, 0, 0, 0)') { + sub.background = sub.backgroundColor; + }else { + sub.background = 'rgba(0, 0, 0, 0)'; + } + + if(sub.dataset.background) { + sub.background = sub.dataset.background; + } + + let res = this._drawText(textData, sub, null, null, 'inline-text', 'wxml'); + + return res + } + + _drawWxmlText (sub, resolve, reject) { + let text = sub.dataset.text || ''; + if(sub.dataset.maxlength && text.length > sub.dataset.maxlength) { + text = text.substring(0, sub.dataset.maxlength) + '...'; + } + + let textData = { + text, + x: sub.left, + y: sub.top, + progress: sub.progress + } + if (sub.backgroundColor !== 'rgba(0, 0, 0, 0)') { + sub.background = sub.backgroundColor; + }else { + sub.background = 'rgba(0, 0, 0, 0)'; + } + + if(sub.dataset.background) { + sub.background = sub.dataset.background; + } + + this._drawText(textData, sub, resolve, reject, 'text', 'wxml'); + } + + _drawWxmlImage (sub, resolve, reject) { + let imageData = { + url: sub.dataset.url, + x: sub.left, + y: sub.top, + progress: sub.progress + } + + let res = this._drawRect(imageData, sub, resolve, reject, 'image', 'inline-wxml'); + + return res + } + + _drawWxmlCircleImage (sub, resolve, reject) { + let imageData = { + url: sub.dataset.url, + x: sub.left, + y: sub.top, + progress: sub.progress + } + sub.r = sub.width / 2; + + this._drawCircle(imageData, sub, resolve, reject, true, 'wxml'); + } + + _drawWxmlBackgroundImage (sub, resolve, reject) { + let url = sub.dataset.url; + let index = this._findPicIndex(url); + url = index > -1 ? this.allPic[index].local : url; + let size = sub.backgroundSize.replace(/px/g, '').split(' '); + + let imageData = { + url: url, + x: sub.left, + y: sub.top, + progress: sub.progress + } + + this._drawRect(imageData, sub, resolve, reject, 'image', 'wxml'); + } + + _getWxml (item, style) { + let self = this; + let query; + if(this.obj) { + query = wx.createSelectorQuery().in(this.obj); + }else { + query = wx.createSelectorQuery(); + } + + let p1 = new Promise((resolve, reject) => { + // 会触发两次,要限制 + let count = 0; + query.selectAll(`${item.class}`).fields({ + dataset: true, + size: true, + rect: true, + computedStyle: ['width', 'height', 'font', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'textAlign', + 'color', 'lineHeight', 'border', 'borderColor', 'borderStyle', 'borderWidth', 'verticalAlign', 'boxShadow', + 'background', 'backgroundColor', 'backgroundImage', 'backgroundPosition', 'backgroundSize', 'paddingLeft', 'paddingTop', + 'paddingRight', 'paddingBottom' + ] + }, (res) => { + if(count++ === 0) { + let formated = self._formatImage(res); + let list = formated.list; + res = formated.res; + + self._preloadImage(list).then(result => { + resolve(res); + }).catch((res) => { + reject && reject({ errcode: 1009, errmsg: 'drawWxml preLoadImage error' }); + }); + } + }).exec(); + }); + + let p2 = new Promise((resolve, reject) => { + if (!item.limit) { + resolve({ top: 0, width: self.width / self.zoom }); + } + + query.select(`${item.limit}`).fields({ + dataset: true, + size: true, + rect: true, + }, (res) => { + resolve(res); + }).exec(); + }); + + return Promise.all([p1, p2]); + } + + _getLineHeight (style) { + let zoom = this.zoom; + if(style.dataset && style.dataset.type) { + zoom = 1; + } + let lineHeight; + if(!isNaN(style.lineHeight) && style.lineHeight > style.fontSize) { + lineHeight = style.lineHeight; + }else { + style.lineHeight = (style.lineHeight || '') + ''; + lineHeight = +style.lineHeight.replace('px', ''); + lineHeight = lineHeight ? lineHeight : (style.fontSize || 14) * 1.2; + } + return lineHeight * zoom; + } + + _formatImage (res = []) { + let list = []; + res.forEach((item, index) => { + let dataset = item.dataset; + let uid = Util.getUid(); + let filename = `${wx.env.USER_DATA_PATH}/${uid}.png`; + if ((dataset.type === "image" || dataset.type === "radius-image") && dataset.url) { + let sub = { + url: dataset.base64 ? filename : dataset.url, + isBase64: dataset.base64 ? dataset.url : false + } + + res[index].dataset = Object.assign(res[index].dataset, sub); + list.push(sub) + } else if (dataset.type === 'background-image' && item.backgroundImage.indexOf('url') > -1) { + let url = item.backgroundImage.replace(/url\((\"|\')?/, '').replace(/(\"|\')?\)$/, ''); + let sub = { + url: dataset.base64 ? filename : url, + isBase64: dataset.base64 ? url : false + } + res[index].dataset = Object.assign(res[index].dataset, sub); + list.push(sub) + } + }); + + return { list, res }; + } + + _updateProgress (distance) { + this.progressPercent += distance; + this.progress(this.progressPercent); + } + + _sortListByTop (list = []) { + let sorted = {}; + + // 粗略地认为2px相差的元素在同一行 + list.forEach((item, index) => { + let top = item.top; + if (!sorted[top]) { + if (sorted[top - 2]) { + top = top - 2; + }else if (sorted[top - 1]) { + top = top - 1; + } else if (sorted[top + 1]) { + top = top + 1; + } else if (sorted[top + 2]) { + top = top + 2; + } else { + sorted[top] = []; + } + } + sorted[top].push(item); + }); + + return sorted; + } + + _parseNumber (number) { + return isNaN(number) ? +(number || '').replace('px', '') : number; + } + + _transferWxmlStyle (sub, item, limitLeft, limitTop) { + let leftFix = (+sub.dataset.left || 0); + let topFix = (+sub.dataset.top || 0); + + sub.width = this._parseNumber(sub.width); + sub.height = this._parseNumber(sub.height); + sub.left = this._parseNumber(sub.left) - limitLeft + (leftFix + (item.x || 0)) * this.zoom; + sub.top = this._parseNumber(sub.top) - limitTop + (topFix + (item.y || 0)) * this.zoom; + + let padding = sub.dataset.padding || '0 0 0 0'; + if (typeof padding === 'string') { + padding = Util.transferPadding(padding); + } + let paddingTop = Number(sub.paddingTop.replace('px', '')) + Number(padding[0]); + let paddingRight = Number(sub.paddingRight.replace('px', '')) + Number(padding[1]); + let paddingBottom = Number(sub.paddingBottom.replace('px', '')) + Number(padding[2]); + let paddingLeft = Number(sub.paddingLeft.replace('px', '')) + Number(padding[3]); + sub.padding = [paddingTop, paddingRight, paddingBottom, paddingLeft]; + + return sub; + } + + /** + * 支持负值绘制,从右边计算 + * @param {*} item + * @param {*} style + */ + _resetPositionX (item, style) { + let zoom = this.zoom; + let x = 0; + + if(style.dataset && style.dataset.type) { + zoom = 1; + } + + // 通过wxml获取的不需要重置坐标 + if (item.x < 0 && item.type) { + x = this.width + item.x * zoom - style.width * zoom; + } else { + x = item.x * zoom; + } + + if (parseInt(style.borderWidth)) { + x += parseInt(style.borderWidth) + } + + return x + this.translateX; + } + + /** + * 支持负值绘制,从底部计算 + * @param {*} item + * @param {*} style + */ + _resetPositionY (item, style, textHeight) { + let zoom = this.zoom; + let y = 0; + + if(style.dataset && style.dataset.type) { + zoom = 1; + } + + if (item.y < 0) { + y = this.height + item.y * zoom - (textHeight ? textHeight : style.height * zoom) + } else { + y = item.y * zoom; + } + + if (parseInt(style.borderWidth)) { + y += parseInt(style.borderWidth) + } + + return y + this.translateY; + } + + /** + * 文字的padding、text-align + * @param {*} item + * @param {*} style + * @param {*} textWidth + */ + _resetTextPositionX (item, style, textWidth, width) { + let textAlign = style.textAlign || 'left'; + let x = item.x; + if (textAlign === 'center') { + x = (width - textWidth) / 2 + item.x; + } else if (textAlign === 'right') { + x = width - textWidth + item.x; + } + + let left = style.padding ? (style.padding[3] || 0) : 0; + + return x + left + this.translateX; + } + + /** + * 文字的padding、text-align + * @param {*} item + * @param {*} style + * @param {*} textWidth + */ + _resetTextPositionY (item, style, lineNum = 0) { + let zoom = this.zoom; + if(style.dataset && style.dataset.type) { + zoom = 1; + } + + let lineHeight = this._getLineHeight(style); + let fontSize = Math.ceil((style.fontSize || 14) * zoom) + + let blockLineHeightFix = (style.dataset && style.dataset.type || '').indexOf('inline') > -1 ? 0 : (lineHeight - fontSize) / 2 + + let top = style.padding ? (style.padding[0] || 0) : 0; + + // y + lineheight偏移 + 行数 + paddingTop + 整体画布位移 + return item.y + blockLineHeightFix + lineNum * lineHeight + top + this.translateY; + } + + /** + * 当文本超过宽度时,计算每一行应该绘制的文本 + * @param {*} text + * @param {*} width + * @param {*} singleLength + * @param {*} currentIndex + * @param {*} widthOffset + */ + _getTextSingleLine(text, width, singleLength, currentIndex = 0, widthOffset = 0) { + let offset = 0; + let endIndex = currentIndex + singleLength + offset; + let single = text.substring(currentIndex, endIndex); + let singleWidth = this.measureWidth(single); + + while (Math.round(widthOffset + singleWidth) > width) { + offset--; + endIndex = currentIndex + singleLength + offset; + single = text.substring(currentIndex, endIndex); + singleWidth = this.measureWidth(single); + } + + return { + endIndex, + single, + singleWidth + } + } + + _drawBorder (border, style, callback) { + let zoom = this.zoom; + if(style.dataset && style.dataset.type) { + zoom = 1; + } + border = Util.transferBorder(border); + + if (border && border.width) { + // 空白阴影,清空掉边框的阴影 + this._drawBoxShadow(); + if (border) { + + this.ctx.setLineWidth(border.width * zoom); + + if (border.style === 'dashed') { + let dash = style.dash || [5, 5, 0]; + let offset = dash[2] || 0; + let array = [dash[0] || 5, dash[1] || 5]; + this.ctx.setLineDash(array, offset); + } + this.ctx.setStrokeStyle(border.color); + } + callback && callback(border); + } + } + + _drawBoxShadow (boxShadow, callback) { + boxShadow = Util.transferBoxShadow(boxShadow); + if (boxShadow) { + this.ctx.setShadow(boxShadow.offsetX, boxShadow.offsetY, boxShadow.blur, boxShadow.color); + }else { + this.ctx.setShadow(0, 0, 0, '#ffffff'); + } + + callback && callback(boxShadow || {}); + } + + _setFill (fill, callback) { + if(fill) { + if (typeof fill === 'string') { + this.ctx.setFillStyle(fill); + } else { + let line = fill.line; + let color = fill.color; + let grd = this.ctx.createLinearGradient(line[0], line[1], line[2], line[3]); + grd.addColorStop(0, color[0]); + grd.addColorStop(1, color[1]); + this.ctx.setFillStyle(grd); + } + callback && callback(); + } + } + + _setStroke (stroke, callback) { + if(stroke) { + if (typeof stroke === 'string') { + this.ctx.setStrokeStyle(stroke); + } else { + let line = stroke.line; + let color = stroke.color; + let grd = this.ctx.createLinearGradient(line[0], line[1], line[2], line[3]); + grd.addColorStop(0, color[0]); + grd.addColorStop(1, color[1]); + this.ctx.setStrokeStyle(grd); + } + + callback && callback(); + } + } +} + +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });exports.default = Wxml2Canvas; +}, function(modId) { var map = {"./util":1689036503193}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503193, function(require, module, exports) { +/** + * 获取字符的长度,full为true时,一个汉字算两个长度 + * @param {String} str + * @param {Boolean} full + */ + +function getTextLength (str, full) { + let len = 0; + for (let i = 0; i < str.length; i++) { + let c = str.charCodeAt(i); + //单字节加1 + if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) { + len++; + } + else { + len += (full ? 2 : 1); + } + } + return len; +} + +/** + * rgba(255, 255, 255, 1) => #ffffff + * @param {String} color + */ +function transferColor (color = '') { + let res = '#'; + color = color.replace(/^rgba?\(/, '').replace(/\)$/, ''); + color = color.split(', '); + + color.length > 3 ? color.length = 3 : ''; + for(let item of color) { + item = parseInt(item || 0); + if(item < 10) { + res += ('0' + item) + }else { + res += (item.toString(16)) + } + } + + return res; +} + +function transferBorder (border = '') { + let res = border.match(/(\w+)px\s(\w+)\s(.*)/); + let obj = {}; + + if(res) { + obj = { + width: +res[1], + style: res[2], + color: res[3] + } + } + + return res ? obj : null; +} + + +/** + * 内边距,依次为上右下左 + * @param {*} padding + */ +function transferPadding (padding = '0 0 0 0') { + padding = padding.split(' '); + for(let i = 0, len = padding.length; i < len; i++) { + padding[i] = +padding[i].replace('px', ''); + } + + return padding; +} +/** + * type1: 0, 25, 17, rgba(0, 0, 0, 0.3) + * type2: rgba(0, 0, 0, 0.3) 0px 25px 17px 0px => (0, 25, 17, rgba(0, 0, 0, 0.3)) + * @param {*} shadow + */ +function transferBoxShadow(shadow = '', type) { + if(!shadow || shadow === 'none') return; + let color; + let split; + + split = shadow.match(/(\w+)\s(\w+)\s(\w+)\s(rgb.*)/); + + if (split) { + split.shift(); + shadow = split; + color = split[3] || '#ffffff'; + } else { + split = shadow.split(') '); + color = split[0] + ')' + shadow = split[1].split('px '); + } + + return { + offsetX: +shadow[0] || 0, + offsetY: +shadow[1] || 0, + blur: +shadow[2] || 0, + color + } +} + +function getUid(prefix) { + prefix = prefix || ''; + + return ( + prefix + + 'xxyxxyxx'.replace(/[xy]/g, c => { + let r = (Math.random() * 16) | 0; + let v = c === 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }) + ); +} + +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });exports.default = { + getTextLength, + transferBorder, + transferColor, + transferPadding, + transferBoxShadow, + getUid +}; +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +return __REQUIRE__(1689036503191); +})() +//miniprogram-npm-outsideDeps=[] +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/miniprogram_npm/wxml2canvas/index.js.map b/miniprogram_npm/wxml2canvas/index.js.map new file mode 100644 index 0000000..acffe54 --- /dev/null +++ b/miniprogram_npm/wxml2canvas/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.js","src/index.js","src/util.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;ACFA;AACA;AACA;AACA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["var __TEMP__ = require('./src/index');var Wxml2Canvas = __REQUIRE_DEFAULT__(__TEMP__);\n\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });exports.default = Wxml2Canvas;","var __TEMP__ = require('./util');var Util = __REQUIRE_DEFAULT__(__TEMP__);\n\nconst imageMode = ['scaleToFill', 'aspectFit', 'aspectFill', 'widthFix', 'top', 'bottom', 'center', 'left', 'right', 'top left', 'top right', 'bottom left', 'bottom right']\n\nclass Wxml2Canvas {\n constructor (options = {}) {\n this.device = wx.getSystemInfoSync && wx.getSystemInfoSync() || {};\n \n if (!options.zoom) {\n this.zoom = this.device.windowWidth / 375;\n } else {\n this.zoom = options.zoom || 1;\n } \n \n this.element = options.element;\n this.object = options.obj;\n this.width = options.width * this.zoom || 0;\n this.height = options.height * this.zoom || 0;\n this.destZoom = options.destZoom || 3;\n this.destWidth = this.width * this.destZoom;\n this.destHeight = this.height * this.destZoom;\n this.translateX = options.translateX * this.zoom || 0;\n this.translateY = options.translateY * this.zoom || 0;\n this.gradientBackground = options.gradientBackground || null;\n this.background = options.background || '#ffffff';\n this.finishDraw = options.finish || function finish(params) {}\n this.errorHandler = options.error || function error(params) {}\n this.progress = options.progress || function progress(params) {}\n this.textAlign = options.textAlign || 'left';\n this.fullText = options.fullText || false;\n this.font = options.font || '14px PingFang SC';\n\n this._init();\n }\n\n draw (data = {}, that) {\n let self = this;\n this.data = data;\n this.fef = that;\n\n this.progress(10);\n this._preloadImage(data.list).then((result) => {\n this.progress(30);\n self._draw();\n }).catch((res) => {\n self.errorHandler(res);\n })\n }\n\n measureWidth (text, font) {\n if(font) {\n this.ctx.font = font;\n }\n let res = this.ctx.measureText(text) || {};\n return res.width || 0;\n }\n\n _init () {\n this.progressPercent = 0; // 绘制进度百分比\n this.data = null;\n this.ref = null;\n this.allPic = [];\n this.screenList = []; \n this.asyncList = [];\n this.imgUrl = '';\n this.progressPercent = 0;\n this.distance = 0;\n this.progress(0);\n\n this.ctx = wx.createCanvasContext(this.element, this.obj);\n this.ctx.font = this.font;\n this.ctx.setTextBaseline('top');\n this.ctx.setStrokeStyle('white');\n\n this.debug = this.device.platform === 'devtools' ? true : false;\n\n this._drawBakcground();\n }\n\n _drawBakcground () {\n if (this.gradientBackground) {\n let line = this.gradientBackground.line || [0, 0, 0, this.height];\n let color = this.gradientBackground.color || ['#fff', '#fff'];\n let style = { fill: { line, color } }\n this._drawRectToCanvas(0, 0, this.width, this.height, style);\n } else {\n let style = { fill: this.background }\n this._drawRectToCanvas(0, 0, this.width, this.height, style);\n }\n }\n\n _draw () {\n let self = this;\n let list = this.data.list || [];\n let index = 0;\n let all = [];\n let count = 0;\n\n list.forEach(item => {\n if(item.type === 'wxml') {\n count += 3;\n } else {\n count += 1;\n }\n })\n\n this.distance = 60 / (count || 1); // 进度条的间距\n this.progressPercent = 30;\n this.asyncList = list.filter( item => item.delay == true );\n list = list.filter( item => item.delay != true );\n drawList(list);\n\n Promise.all(all).then(results => {\n index = 0;\n drawList(self.asyncList, true);\n\n Promise.all(all).then(results => {\n self.progress(90);\n self._saveCanvasToImage();\n });\n }).catch (e => {\n console.log(e)\n self.errorHandler(e);\n });\n\n function drawList(list = [], noDelay) {\n list.forEach((item, i) => {\n all[index++] = new Promise((resolve, reject) => {\n let attr = item.style;\n item.progress = self.distance;\n if (noDelay) {\n item.delay = 0;\n }\n if (item.type === 'radius-image') {\n self._drawCircle(item, attr, resolve, reject, 'image');\n } else if (item.type === 'text') {\n self._drawText(item, attr, resolve, reject);\n } else if (item.type === 'line') {\n self._drawLine(item, attr, resolve, reject);\n } else if (item.type === 'circle') {\n self._drawCircle(item, attr, resolve, reject);\n } else if (item.type === 'rect') {\n self._drawRect(item, attr, resolve, reject);\n } else if (item.type === 'image') {\n self._drawRect(item, attr, resolve, reject, 'image');\n } else if (item.type === 'wxml') {\n self._drawWxml(item, attr, resolve, reject);\n }else {\n resolve();\n }\n });\n });\n }\n }\n\n _saveCanvasToImage () {\n let self = this; \n\n // 延时保存有两个原因,一个是等待绘制delay的元素,另一个是安卓上样式会错乱\n setTimeout(() => {\n self.progress(95);\n\n let obj = {\n x: 0,\n y: 0,\n width: self.width,\n height: self.height,\n canvasId: self.element,\n success: function (res) {\n\n self.progress(100);\n self.imgUrl = res.tempFilePath;\n self.finishDraw(self.imgUrl);\n },\n fail: function (res) {\n\n self.errorHandler({errcode: 1000, errmsg: 'save canvas error', e: res});\n }\n }\n\n if(self.destZoom !== 3) {\n obj.destWidth = self.destWidth;\n obj.destHeight = self.destHeight;\n }\n\n wx.canvasToTempFilePath(obj, self.object);\n }, self.device.system.indexOf('iOS') === -1 ? 300 : 100);\n }\n\n _preloadImage (list = []) {\n let self = this;\n let all = [];\n let count = 0;\n\n list.forEach((item, i) => {\n if (item.url && self._findPicIndex(item.url) === -1) {\n \n // 避免重复下载同一图片\n self.allPic.push({\n url: item.url,\n local: ''\n });\n all[count++] = new Promise((resolve, reject) => {\n // 非http(s)域名的就不下载了\n if (!/^http/.test(item.url) || /^http:\\/\\/(tmp)|(usr)\\//.test(item.url) || /^http:\\/\\/127\\.0\\.0\\.1/.test(item.url)) {\n if(item.isBase64) {\n let fileManager = wx.getFileSystemManager();\n\n fileManager.writeFile({\n filePath: item.url,\n data: item.isBase64.replace(/data:image\\/(.*);base64,/, ''),\n encoding: 'base64',\n success (res) {\n imageInfo(item.url);\n },\n fail (res) {\n reject(res);\n },\n })\n \n }else {\n imageInfo(item.url);\n }\n\n function imageInfo (url) {\n wx.getImageInfo({\n src: url,\n success (res) {\n let index = self._findPicIndex(url);\n if(index > -1) {\n self.allPic[index].local = url;\n self.allPic[index].width = res.width;\n self.allPic[index].height = res.height;\n }\n resolve({ tempFilePath: url });\n }, \n fail (res) {\n reject(res);\n }\n })\n }\n } else {\n wx.downloadFile({\n url: item.url.replace(/^https?/, 'https'),\n success: function (res) {\n wx.getImageInfo({\n src: res.tempFilePath,\n success (img) {\n let index = self._findPicIndex(item.url);\n if (index > -1) {\n self.allPic[index].local = res.tempFilePath;\n self.allPic[index].width = img.width;\n self.allPic[index].height = img.height;\n }\n resolve(res);\n },\n fail (res) {\n reject(res);\n }\n })\n },\n fail: (res) => {\n reject({errcode: 1001, errmsg: 'download pic error'});\n }\n })\n }\n }) \n }\n });\n\n return Promise.all(all).then(results => {\n return new Promise(resolve => { resolve() })\n }).catch((results) => {\n return new Promise((resolve, reject) => { reject(results) })\n })\n }\n\n _findPicIndex (url) {\n let index = this.allPic.findIndex(pic => pic.url === url);\n return index;\n }\n\n _drawRect (item, style, resolve, reject, isImage, isWxml) {\n let zoom = this.zoom;\n let leftOffset = 0;\n let topOffset = 0;\n let width = style.width;\n let height = style.height;\n let imgWidth = style.width;\n let imgHeight = style.height;\n let mode = null;\n\n try {\n item.x = this._resetPositionX(item, style);\n item.y = this._resetPositionY(item, style);\n \n let url;\n if(isImage) {\n let index = this._findPicIndex(item.url);\n if(index > -1) {\n url = this.allPic[index].local\n imgWidth = this.allPic[index].width\n imgHeight = this.allPic[index].height\n }else {\n url = item.url;\n }\n }\n\n style.padding = style.padding || [];\n if(isWxml === 'inline-wxml') {\n item.x = item.x + (style.padding[3] && style.padding[3] || 0)\n item.y = item.y + (style.padding[0] && style.padding[0] || 0)\n }\n\n leftOffset = item.x + style.width + (style.padding[1] && style.padding[1] || 0);\n\n if(!isWxml) {\n width = width * zoom;\n height = height * zoom;\n }\n\n if(style.dataset && style.dataset.mode && imageMode.indexOf(style.dataset.mode) > -1) {\n mode = {\n type: style.dataset.mode,\n width: imgWidth,\n height: imgHeight\n };\n }\n\n this._drawRectToCanvas(item.x, item.y, width, height, style, url, mode);\n this._updateProgress(item.progress);\n\n if(resolve) {\n resolve();\n }else {\n return {\n leftOffset,\n topOffset\n }\n }\n } catch (e) {\n reject && reject({ errcode: (isImage ? 1003 : 1002), errmsg: (isImage ? 'drawImage error' : 'drawRect error'), e });\n }\n }\n\n _drawRectToCanvas (x, y, width, height, style, url, mode) {\n let { fill, border, boxShadow } = style;\n this.ctx.save();\n this._drawBoxShadow(boxShadow, (res) => {\n // 真机上填充渐变色时,没有阴影,先画个相等大小的纯色矩形来实现阴影\n if(fill && typeof fill !== 'string' && !this.debug) {\n this.ctx.setFillStyle(res.color || '#ffffff');\n this.ctx.fillRect(x, y, width, height);\n }\n });\n \n if(url) {\n // 开发者工具有bug,先不裁剪\n if(mode) {\n this._resetImageByMode(url, x, y, width, height, mode);\n }else {\n this.ctx.drawImage(url, x, y, width, height)\n }\n }else {\n this._setFill(fill, () => {\n this.ctx.fillRect(x, y, width, height);\n });\n }\n\n this._drawBorder(border, style, (border) => {\n let fixBorder = border.width;\n this.ctx.strokeRect(x - fixBorder / 2, y - fixBorder / 2, width + fixBorder, height + fixBorder);\n });\n\n this.ctx.draw(true);\n this.ctx.restore();\n }\n\n _resetImageByMode (url, x, y, width, height, mode) {\n let self = this;\n let offsetX = 0;\n let offsetY = 0;\n let imgWidth = mode.width;\n let imgHeight = mode.height;\n\n switch (mode.type) {\n case 'scaleToFill': \n imgWidth = width;\n imgHeight = height;\n self.ctx.drawImage(url, x, y, width, height)\n break;\n case 'widthFix': \n height = width / ((imgWidth || 1) / (imgHeight || 1))\n self.ctx.drawImage(url, x, y, width, height)\n break; \n case 'aspectFit': \n if(imgWidth > imgHeight) {\n let realHeight = width / ((imgWidth || 1) / (imgHeight || 1))\n offsetY = -(height - realHeight) / 2\n imgWidth = width;\n imgHeight = realHeight;\n }else {\n let realWidth = height / ((imgHeight || 1) / (imgWidth || 1))\n offsetX = -(width - realWidth) / 2\n imgWidth = realWidth;\n imgHeight = height;\n }\n\n _clip();\n break;\n case 'aspectFill': \n if(imgWidth > imgHeight) {\n let realWidth = imgWidth / ((imgHeight || 1) / (height || 1))\n offsetX = (realWidth - width) / 2\n imgWidth = realWidth;\n imgHeight = height;\n }else {\n let realHeight = imgHeight / ((imgWidth || 1) / (width || 1))\n offsetY = (realHeight - height) / 2\n imgWidth = width;\n imgHeight = realHeight;\n }\n\n _clip();\n break;\n case 'top left': \n _clip();\n break;\n case 'top': \n offsetX = (mode.width - width) / 2;\n _clip();\n break;\n case 'top right': \n offsetX = (mode.width - width);\n _clip();\n break;\n case 'left': \n offsetY = (mode.height - height) / 2;\n _clip();\n break;\n case 'center': \n offsetX = (mode.width - width) / 2;\n offsetY = (mode.height - height) / 2;\n _clip();\n break;\n case 'right': \n offsetX = (mode.width - width);\n offsetY = (mode.height - height) / 2;\n _clip();\n break;\n case 'bottom left': \n offsetY = (mode.height - height)\n _clip();\n break;\n case 'bottom': \n offsetX = (mode.width - width) / 2;\n offsetY = (mode.height - height)\n _clip();\n break;\n case 'bottom right': \n offsetX = (mode.width - width);\n offsetY = (mode.height - height)\n _clip();\n break;\n default: \n imgWidth = width;\n imgHeight = height;\n break; \n }\n\n function _clip () {\n self.ctx.save();\n self.ctx.beginPath()\n self.ctx.rect(x, y, width, height)\n self.ctx.clip();\n self.ctx.drawImage(url, x - offsetX, y - offsetY, imgWidth, imgHeight)\n self.ctx.closePath();\n self.ctx.restore();\n }\n }\n\n _drawText (item, style, resolve, reject, type, isWxml) {\n let zoom = this.zoom;\n let leftOffset = 0;\n let topOffset = 0;\n\n try {\n style.fontSize = this._parseNumber(style.fontSize);\n let fontSize = Math.ceil((style.fontSize || 14) * zoom)\n this.ctx.setTextBaseline('top');\n this.ctx.font = (`${style.fontWeight ? (style.fontWeight) : 'normal'} ${ fontSize }px ${ style.fontFamily || 'PingFang SC' }`);\n this.ctx.setFillStyle(style.color || '#454545');\n\n let text = item.text || '';\n let textWidth = Math.floor(this.measureWidth(text, style.font || this.ctx.font));\n let lineHeight = this._getLineHeight(style);\n let textHeight = Math.ceil(textWidth / (style.width || textWidth)) * lineHeight;\n let width = Math.ceil((style.width || textWidth) * (!isWxml ? zoom : 1));\n let whiteSpace = style.whiteSpace || 'wrap';\n let x = 0;\n let y = 0; \n\n if(typeof style.padding === 'string') {\n style.padding = Util.transferPadding(style.padding);\n }\n item.x = this._resetPositionX(item, style);\n item.y = this._resetPositionY(item, style, textHeight);\n this._drawBoxShadow(style.boxShadow);\n\n if(style.background || style.border) {\n this._drawTextBackgroud(item, style, textWidth, textHeight, isWxml);\n }\n \n // 行内文本\n if(type === 'inline-text') {\n width = item.maxWidth;\n if(item.leftOffset + textWidth > width) {\n // 如果上一个行内元素换行了,这个元素要继续在后面补足一行\n let lineNum = Math.max(Math.floor(textWidth / width), 1);\n let length = text.length;\n let singleLength = Math.floor(length / lineNum);\n let widthOffset = item.leftOffset ? item.leftOffset - item.originX : 0;\n let { endIndex: currentIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, 0, widthOffset)\n x = this._resetTextPositionX(item, style, singleWidth);\n y = this._resetTextPositionY(item, style);\n this.ctx.fillText(single, x, y);\n leftOffset = x + singleWidth;\n topOffset = y;\n\n // 去除第一行补的内容,然后重置\n text = text.substring(currentIndex, text.length);\n currentIndex = 0;\n lineNum = Math.max(Math.floor(textWidth / width), 1);\n textWidth = Math.floor(this.measureWidth(text, style.font || this.ctx.font));\n item.x = item.originX; // 还原换行后的x\n for (let i = 0; i < lineNum; i++) {\n let { endIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, currentIndex);\n currentIndex = endIndex;\n if(single) {\n x = this._resetTextPositionX(item, style, singleWidth, width);\n y = this._resetTextPositionY(item, style, i + 1);\n this.ctx.fillText(single, x, y);\n if(i === lineNum - 1) {\n leftOffset = x + singleWidth;\n topOffset = lineHeight * lineNum;\n }\n }\n }\n\n let last = text.substring(currentIndex, length);\n let lastWidth = this.measureWidth(last);\n\n if(last) {\n x = this._resetTextPositionX(item, style, lastWidth, width);\n y = this._resetTextPositionY(item, style, lineNum + 1);\n this.ctx.fillText(last, x, y);\n leftOffset = x + lastWidth;\n topOffset = lineHeight * (lineNum + 1);\n }\n }else {\n x = this._resetTextPositionX(item, style, textWidth, width);\n y = this._resetTextPositionY(item, style);\n this.ctx.fillText(item.text, x, y);\n leftOffset = x + textWidth;\n topOffset = lineHeight;\n }\n }else {\n // block文本,如果文本长度超过宽度换行\n if (width && textWidth > width && whiteSpace !== 'nowrap') {\n let lineNum = Math.max(Math.floor(textWidth / width), 1);\n let length = text.length;\n let singleLength = Math.floor(length / lineNum);\n let currentIndex = 0;\n\n // lineClamp参数限制最多行数\n if (style.lineClamp && lineNum + 1 > style.lineClamp) {\n lineNum = style.lineClamp - 1;\n }\n\n for (let i = 0; i < lineNum; i++) {\n let { endIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, currentIndex);\n currentIndex = endIndex;\n x = this._resetTextPositionX(item, style, singleWidth, width);\n y = this._resetTextPositionY(item, style, i);\n this.ctx.fillText(single, x, y);\n\n }\n\n // 换行后剩余的文字,超过一行则截断增加省略号\n let last = text.substring(currentIndex, length);\n let lastWidth = this.measureWidth(last);\n if(lastWidth > width) {\n let { single, singleWidth } = this._getTextSingleLine(last, width, singleLength);\n lastWidth = singleWidth;\n last = single.substring(0, single.length - 1) + '...';\n }\n\n x = this._resetTextPositionX(item, style, lastWidth, width);\n y = this._resetTextPositionY(item, style, lineNum);\n this.ctx.fillText(last, x, y);\n\n }else {\n x = this._resetTextPositionX(item, style, textWidth, width);\n y = this._resetTextPositionY(item, style);\n this.ctx.fillText(item.text, x, y);\n }\n }\n \n this.ctx.draw(true);\n \n this._updateProgress(item.progress);\n\n if(resolve) {\n resolve();\n }else {\n return {\n leftOffset,\n topOffset\n }\n }\n } catch(e) {\n reject && reject({ errcode: 1004, errmsg: 'drawText error', e: e });\n }\n }\n\n _drawTextBackgroud (item, style, textWidth, textHeight, isWxml) {\n if(!style.width) return;\n let zoom = isWxml ? 1 : this.zoom;\n let width = style.width || textWidth;\n let height = style.height || textHeight;\n let rectStyle = {\n fill: style.background,\n border: style.border\n }\n style.padding = style.padding || [0, 0, 0, 0];\n width += (style.padding[1] || 0) + (style.padding[3] || 0);\n height += (style.padding[0] || 0) + (style.padding[2] || 0);\n width = width * zoom\n height = height * zoom\n this._drawRectToCanvas(item.x, item.y, width, height, rectStyle);\n }\n\n _drawCircle (item, style, resolve, reject, isImage, isWxml) {\n let zoom = this.zoom;\n let r = style.r;\n try {\n \n item.x = this._resetPositionX(item, style);\n item.y = this._resetPositionY(item, style);\n\n let url;\n if(isImage) {\n let index = this._findPicIndex(item.url);\n if (index > -1) {\n url = this.allPic[index].local;\n } else {\n url = item.url;\n }\n }\n\n if(!isWxml) {\n r = r * zoom;\n }\n\n this._drawCircleToCanvas(item.x, item.y, r, style, url);\n \n this._updateProgress(item.progress);\n resolve && resolve();\n } catch (e) {\n reject && reject({ errcode: (isImage ? 1006 : 1005), errmsg: (isImage ? 'drawCircleImage error' : 'drawCircle error'), e });\n }\n }\n\n _drawCircleToCanvas (x, y, r, style, url) {\n let { fill, border, boxShadow } = style;\n\n this.ctx.save();\n\n this._drawBoxShadow(boxShadow, (res) => {\n // 真机上填充渐变色时,没有阴影,先画个相等大小的纯色矩形来实现阴影\n if((fill && typeof fill !== 'string') || (url && res.color)) {\n this.ctx.setFillStyle(res.color || '#ffffff');\n this.ctx.beginPath();\n this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI);\n this.ctx.closePath();\n this.ctx.fill();\n }\n });\n\n if(url) {\n this.ctx.save();\n this.ctx.beginPath();\n this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI);\n this.ctx.clip();\n this.ctx.drawImage(url, x, y, r * 2, r * 2);\n this.ctx.closePath();\n this.ctx.restore();\n }else {\n this._setFill(fill, () => {\n this.ctx.beginPath();\n this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI);\n this.ctx.closePath();\n this.ctx.fill();\n });\n }\n\n this._drawBorder(border, style, (border) => {\n this.ctx.beginPath()\n this.ctx.arc(x + r, y + r, r + border.width / 2, 0, 2 * Math.PI)\n this.ctx.stroke()\n this.ctx.closePath();\n });\n\n this.ctx.draw(true);\n this.ctx.restore();\n }\n\n _drawLine (item, style, resolve, reject, isWxml) {\n let zoom = this.zoom;\n try {\n let x1 = item.x * zoom + this.translateX;\n let y1 = item.y * zoom + this.translateY;\n let x2 = item.x2 * zoom + this.translateX;\n let y2 = item.y2 * zoom + this.translateY;\n this._drawLineToCanvas(x1, y1, x2, y2, style);\n\n this._updateProgress(item.progress);\n resolve && resolve();\n } catch (e) {\n reject && reject({ errcode: 1007, errmsg: 'drawLine error', e });\n }\n }\n\n _drawLineToCanvas (x1, y1, x2, y2, style) {\n let { stroke, dash, boxShadow } = style;\n\n this.ctx.save();\n if(stroke) {\n this._setStroke(stroke);\n }\n\n this._drawBoxShadow(boxShadow);\n\n if(dash) {\n let dash = [style.dash[0] || 5, style.dash[1] || 5];\n let offset = style.dash[2] || 0;\n this.ctx.setLineDash(dash, offset || 0);\n }\n\n this.ctx.moveTo(x1, y1);\n this.ctx.setLineWidth((style.width || 1) * this.zoom);\n this.ctx.lineTo(x2, y2);\n this.ctx.stroke();\n this.ctx.draw(true);\n this.ctx.restore();\n }\n\n // 废弃,合并到_drawRect\n _drawImage (item, style, resolve, reject, isWxml) {\n let zoom = this.zoom;\n try {\n \n item.x = this._resetPositionX(item, style);\n item.y = this._resetPositionY(item, style);\n item.x = item.x + (style.padding[3] || 0);\n item.y = item.y + (style.padding[0] || 0);\n\n let index = this._findPicIndex(item.url);\n let url = index > -1 ? this.allPic[index].local : item.url;\n this._drawImageToCanvas(url, item.x, item.y, style.width * zoom, style.height * zoom, style);\n\n this._updateProgress(item.progress);\n resolve && resolve();\n } catch (e) {\n reject && reject({ errcode: 1012, errmsg: 'drawRect error', e });\n }\n }\n\n // 废弃,合并到_drawRect\n _drawImageToCanvas (url, x, y, width, height, style) {\n let { fill, border, boxShadow } = style;\n this.ctx.save();\n\n this._drawBoxShadow(boxShadow);\n this.ctx.drawImage(url, x, y, width, height);\n\n this._drawBorder(border, style, (border) => {\n let fixBorder = border.width;\n this.ctx.strokeRect(x - fixBorder / 2, y - fixBorder / 2, width + fixBorder, height + fixBorder);\n });\n this.ctx.draw(true);\n this.ctx.restore();\n }\n\n _drawWxml (item, style, resolve, reject) {\n let self = this;\n let all = [];\n try {\n this._getWxml(item, style).then((results) => {\n \n // 上 -> 下\n let sorted = self._sortListByTop(results[0]);\n let count = 0;\n let progress = 0;\n Object.keys(sorted).forEach(item => {\n count += sorted[item].length;\n })\n progress = this.distance * 3 / (count || 1);\n\n all = this._drawWxmlBlock(item, sorted, all, progress, results[1]);\n all = this._drawWxmlInline(item, sorted, all, progress, results[1]);\n\n Promise.all(all).then(results => {\n resolve && resolve();\n }).catch (e => {\n reject && reject(e);\n });\n });\n } catch (e) {\n reject && reject({ errcode: 1008, errmsg: 'drawWxml error' });\n }\n }\n\n _drawWxmlBlock (item, sorted, all, progress, results) {\n let self = this;\n // 用来限定位置范围,取相对位置\n let limitLeft = (results ? results.left : 0);\n let limitTop = (results ? results.top : 0);\n Object.keys(sorted).forEach((top, topIndex) => {\n // 左 -> 右\n let list = sorted[top].sort((a, b) => {\n return (a.left - b.left);\n });\n\n list = list.filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') === -1);\n\n list.forEach((sub, index) => {\n all[index] = new Promise((resolve2, reject2) => {\n sub = self._transferWxmlStyle(sub, item, limitLeft, limitTop);\n sub.progress = progress;\n let type = sub.dataset.type;\n if(sub.dataset.delay) {\n setTimeout(() => {\n drawWxmlItem();\n }, sub.dataset.delay)\n } else {\n drawWxmlItem();\n }\n function drawWxmlItem () {\n if (type === 'text') {\n self._drawWxmlText(sub, resolve2, reject2);\n } else if (type === 'image') {\n self._drawWxmlImage(sub, resolve2, reject2);\n } else if (type === 'radius-image') {\n self._drawWxmlCircleImage(sub, resolve2, reject2);\n } else if (type === 'background-image') {\n self._drawWxmlBackgroundImage(sub, resolve2, reject2);\n }\n }\n });\n });\n });\n\n return all;\n\n }\n\n _drawWxmlInline (item, sorted, all, progress, results) {\n let self = this;\n let topOffset = 0;\n let leftOffset = 0;\n let lastTop = 0;\n let limitLeft = (results ? results.left : 0);\n let limitTop = (results ? results.top : 0);\n let p = new Promise((resolve2, reject2) => {\n let maxWidth = 0;\n let minLeft = Infinity;\n let maxRight = 0;\n\n // 找出同一top下的最小left和最大right,得到最大的宽度,用于换行\n Object.keys(sorted).forEach(top => {\n let inlineList = sorted[top].filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') > -1);\n inlineList.forEach(sub => {\n if(sub.left < minLeft) {\n minLeft = sub.left\n }\n if(sub.right > maxRight) {\n maxRight = sub.right;\n }\n })\n });\n maxWidth = Math.ceil((maxRight - minLeft) || self.width);\n\n Object.keys(sorted).forEach((top, topIndex) => {\n // 左 -> 右\n let list = sorted[top].sort((a, b) => {\n return (a.left - b.left);\n });\n\n // 换行的行内元素left放到后面,version2.0.6后无法获取高度,改用bottom值来判断是否换行了\n let position = -1;\n for(let i = 0, len = list.length; i < len; i++) {\n if(list[i] && list[i + 1]) {\n if(list[i].bottom > list[i + 1].bottom) {\n position = i;\n break;\n }\n }\n }\n\n if(position > -1) {\n list.push(list.splice(position, 1)[0]);\n }\n\n let inlineList = list.filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') > -1);\n let originLeft = (inlineList[0] ? inlineList[0].left : 0);\n // 换行后和top不相等时,认为是换行了,要清除左边距;当左偏移量大于最大宽度时,也要清除左边距; 当左偏移小于左边距时,也要清除\n if (Math.abs(topOffset + lastTop - top) > 2 || leftOffset - originLeft - limitLeft >= maxWidth || leftOffset <= originLeft - limitLeft - 2) {\n leftOffset = 0;\n }\n\n lastTop = +top;\n topOffset = 0;\n \n inlineList.forEach((sub, index) => {\n sub = self._transferWxmlStyle(sub, item, limitLeft, limitTop);\n sub.progress = progress;\n let type = sub.dataset.type;\n if (type === 'inline-text') {\n let drawRes = self._drawWxmlInlineText(sub, leftOffset, maxWidth);\n leftOffset = drawRes.leftOffset;\n topOffset = drawRes.topOffset;\n } else if (type === 'inline-image') {\n let drawRes = self._drawWxmlImage(sub) || {};\n leftOffset = drawRes.leftOffset || 0;\n topOffset = drawRes.topOffset || 0;\n }\n });\n });\n resolve2();\n })\n\n all.push(p); \n return all;\n }\n\n _drawWxmlInlineText (sub, leftOffset = 0, maxWidth) {\n let text = sub.dataset.text || '';\n if(sub.dataset.maxlength && text.length > sub.dataset.maxlength) {\n text = text.substring(0, sub.dataset.maxlength) + '...';\n }\n \n let textData = {\n text,\n originX: sub.left,\n x: leftOffset ? leftOffset : sub.left,\n y: sub.top,\n progress: sub.progress,\n leftOffset: leftOffset,\n maxWidth: maxWidth // 行内元素的最大宽度,取决于limit的宽度\n }\n\n if (sub.backgroundColor !== 'rgba(0, 0, 0, 0)') {\n sub.background = sub.backgroundColor;\n }else {\n sub.background = 'rgba(0, 0, 0, 0)';\n }\n\n if(sub.dataset.background) {\n sub.background = sub.dataset.background;\n }\n\n let res = this._drawText(textData, sub, null, null, 'inline-text', 'wxml');\n\n return res\n }\n\n _drawWxmlText (sub, resolve, reject) {\n let text = sub.dataset.text || '';\n if(sub.dataset.maxlength && text.length > sub.dataset.maxlength) {\n text = text.substring(0, sub.dataset.maxlength) + '...';\n }\n \n let textData = {\n text,\n x: sub.left,\n y: sub.top,\n progress: sub.progress\n }\n if (sub.backgroundColor !== 'rgba(0, 0, 0, 0)') {\n sub.background = sub.backgroundColor;\n }else {\n sub.background = 'rgba(0, 0, 0, 0)';\n }\n\n if(sub.dataset.background) {\n sub.background = sub.dataset.background;\n }\n\n this._drawText(textData, sub, resolve, reject, 'text', 'wxml');\n }\n\n _drawWxmlImage (sub, resolve, reject) {\n let imageData = {\n url: sub.dataset.url,\n x: sub.left,\n y: sub.top,\n progress: sub.progress\n }\n\n let res = this._drawRect(imageData, sub, resolve, reject, 'image', 'inline-wxml');\n\n return res\n }\n\n _drawWxmlCircleImage (sub, resolve, reject) {\n let imageData = {\n url: sub.dataset.url,\n x: sub.left,\n y: sub.top,\n progress: sub.progress\n }\n sub.r = sub.width / 2;\n\n this._drawCircle(imageData, sub, resolve, reject, true, 'wxml');\n }\n\n _drawWxmlBackgroundImage (sub, resolve, reject) {\n let url = sub.dataset.url;\n let index = this._findPicIndex(url);\n url = index > -1 ? this.allPic[index].local : url;\n let size = sub.backgroundSize.replace(/px/g, '').split(' ');\n\n let imageData = {\n url: url,\n x: sub.left,\n y: sub.top,\n progress: sub.progress\n }\n\n this._drawRect(imageData, sub, resolve, reject, 'image', 'wxml');\n }\n\n _getWxml (item, style) {\n let self = this;\n let query;\n if(this.obj) {\n query = wx.createSelectorQuery().in(this.obj);\n }else {\n query = wx.createSelectorQuery();\n }\n\n let p1 = new Promise((resolve, reject) => {\n // 会触发两次,要限制\n let count = 0;\n query.selectAll(`${item.class}`).fields({\n dataset: true,\n size: true,\n rect: true,\n computedStyle: ['width', 'height', 'font', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'textAlign', \n 'color', 'lineHeight', 'border', 'borderColor', 'borderStyle', 'borderWidth', 'verticalAlign', 'boxShadow',\n 'background', 'backgroundColor', 'backgroundImage', 'backgroundPosition', 'backgroundSize', 'paddingLeft', 'paddingTop',\n 'paddingRight', 'paddingBottom'\n ]\n }, (res) => {\n if(count++ === 0) {\n let formated = self._formatImage(res);\n let list = formated.list;\n res = formated.res;\n\n self._preloadImage(list).then(result => {\n resolve(res);\n }).catch((res) => {\n reject && reject({ errcode: 1009, errmsg: 'drawWxml preLoadImage error' });\n });\n }\n }).exec();\n });\n\n let p2 = new Promise((resolve, reject) => {\n if (!item.limit) {\n resolve({ top: 0, width: self.width / self.zoom });\n }\n\n query.select(`${item.limit}`).fields({\n dataset: true,\n size: true,\n rect: true,\n }, (res) => {\n resolve(res);\n }).exec();\n });\n\n return Promise.all([p1, p2]);\n }\n\n _getLineHeight (style) {\n let zoom = this.zoom;\n if(style.dataset && style.dataset.type) {\n zoom = 1;\n }\n let lineHeight;\n if(!isNaN(style.lineHeight) && style.lineHeight > style.fontSize) {\n lineHeight = style.lineHeight;\n }else {\n style.lineHeight = (style.lineHeight || '') + '';\n lineHeight = +style.lineHeight.replace('px', '');\n lineHeight = lineHeight ? lineHeight : (style.fontSize || 14) * 1.2;\n }\n return lineHeight * zoom;\n }\n\n _formatImage (res = []) {\n let list = [];\n res.forEach((item, index) => {\n let dataset = item.dataset;\n let uid = Util.getUid();\n let filename = `${wx.env.USER_DATA_PATH}/${uid}.png`;\n if ((dataset.type === \"image\" || dataset.type === \"radius-image\") && dataset.url) {\n let sub = {\n url: dataset.base64 ? filename : dataset.url,\n isBase64: dataset.base64 ? dataset.url : false\n }\n\n res[index].dataset = Object.assign(res[index].dataset, sub);\n list.push(sub)\n } else if (dataset.type === 'background-image' && item.backgroundImage.indexOf('url') > -1) {\n let url = item.backgroundImage.replace(/url\\((\\\"|\\')?/, '').replace(/(\\\"|\\')?\\)$/, '');\n let sub = {\n url: dataset.base64 ? filename : url,\n isBase64: dataset.base64 ? url : false\n }\n res[index].dataset = Object.assign(res[index].dataset, sub);\n list.push(sub)\n }\n });\n\n return { list, res };\n }\n\n _updateProgress (distance) {\n this.progressPercent += distance;\n this.progress(this.progressPercent);\n }\n\n _sortListByTop (list = []) {\n let sorted = {};\n\n // 粗略地认为2px相差的元素在同一行\n list.forEach((item, index) => {\n let top = item.top;\n if (!sorted[top]) {\n if (sorted[top - 2]) {\n top = top - 2;\n }else if (sorted[top - 1]) {\n top = top - 1;\n } else if (sorted[top + 1]) {\n top = top + 1;\n } else if (sorted[top + 2]) {\n top = top + 2;\n } else {\n sorted[top] = [];\n }\n }\n sorted[top].push(item);\n });\n\n return sorted;\n }\n\n _parseNumber (number) {\n return isNaN(number) ? +(number || '').replace('px', '') : number;\n }\n\n _transferWxmlStyle (sub, item, limitLeft, limitTop) {\n let leftFix = (+sub.dataset.left || 0);\n let topFix = (+sub.dataset.top || 0);\n\n sub.width = this._parseNumber(sub.width);\n sub.height = this._parseNumber(sub.height);\n sub.left = this._parseNumber(sub.left) - limitLeft + (leftFix + (item.x || 0)) * this.zoom;\n sub.top = this._parseNumber(sub.top) - limitTop + (topFix + (item.y || 0)) * this.zoom;\n\n let padding = sub.dataset.padding || '0 0 0 0';\n if (typeof padding === 'string') {\n padding = Util.transferPadding(padding);\n }\n let paddingTop = Number(sub.paddingTop.replace('px', '')) + Number(padding[0]);\n let paddingRight = Number(sub.paddingRight.replace('px', '')) + Number(padding[1]);\n let paddingBottom = Number(sub.paddingBottom.replace('px', '')) + Number(padding[2]);\n let paddingLeft = Number(sub.paddingLeft.replace('px', '')) + Number(padding[3]);\n sub.padding = [paddingTop, paddingRight, paddingBottom, paddingLeft];\n \n return sub;\n }\n\n /**\n * 支持负值绘制,从右边计算\n * @param {*} item \n * @param {*} style \n */\n _resetPositionX (item, style) {\n let zoom = this.zoom;\n let x = 0;\n\n if(style.dataset && style.dataset.type) {\n zoom = 1;\n }\n\n // 通过wxml获取的不需要重置坐标\n if (item.x < 0 && item.type) {\n x = this.width + item.x * zoom - style.width * zoom;\n } else {\n x = item.x * zoom;\n }\n\n if (parseInt(style.borderWidth)) {\n x += parseInt(style.borderWidth)\n }\n\n return x + this.translateX;\n }\n\n /**\n * 支持负值绘制,从底部计算\n * @param {*} item \n * @param {*} style \n */\n _resetPositionY (item, style, textHeight) {\n let zoom = this.zoom;\n let y = 0;\n\n if(style.dataset && style.dataset.type) {\n zoom = 1;\n }\n\n if (item.y < 0) {\n y = this.height + item.y * zoom - (textHeight ? textHeight : style.height * zoom)\n } else {\n y = item.y * zoom;\n }\n\n if (parseInt(style.borderWidth)) {\n y += parseInt(style.borderWidth)\n }\n \n return y + this.translateY;\n }\n\n /**\n * 文字的padding、text-align\n * @param {*} item \n * @param {*} style \n * @param {*} textWidth\n */\n _resetTextPositionX (item, style, textWidth, width) {\n let textAlign = style.textAlign || 'left';\n let x = item.x;\n if (textAlign === 'center') {\n x = (width - textWidth) / 2 + item.x;\n } else if (textAlign === 'right') {\n x = width - textWidth + item.x;\n }\n\n let left = style.padding ? (style.padding[3] || 0) : 0;\n\n return x + left + this.translateX;\n }\n\n /**\n * 文字的padding、text-align\n * @param {*} item \n * @param {*} style \n * @param {*} textWidth\n */\n _resetTextPositionY (item, style, lineNum = 0) {\n let zoom = this.zoom;\n if(style.dataset && style.dataset.type) {\n zoom = 1;\n }\n\n let lineHeight = this._getLineHeight(style);\n let fontSize = Math.ceil((style.fontSize || 14) * zoom)\n\n let blockLineHeightFix = (style.dataset && style.dataset.type || '').indexOf('inline') > -1 ? 0 : (lineHeight - fontSize) / 2\n\n let top = style.padding ? (style.padding[0] || 0) : 0;\n\n // y + lineheight偏移 + 行数 + paddingTop + 整体画布位移\n return item.y + blockLineHeightFix + lineNum * lineHeight + top + this.translateY;\n }\n\n /**\n * 当文本超过宽度时,计算每一行应该绘制的文本\n * @param {*} text \n * @param {*} width \n * @param {*} singleLength \n * @param {*} currentIndex \n * @param {*} widthOffset\n */\n _getTextSingleLine(text, width, singleLength, currentIndex = 0, widthOffset = 0) {\n let offset = 0;\n let endIndex = currentIndex + singleLength + offset;\n let single = text.substring(currentIndex, endIndex);\n let singleWidth = this.measureWidth(single);\n\n while (Math.round(widthOffset + singleWidth) > width) {\n offset--;\n endIndex = currentIndex + singleLength + offset;\n single = text.substring(currentIndex, endIndex);\n singleWidth = this.measureWidth(single);\n }\n\n return {\n endIndex, \n single, \n singleWidth\n }\n }\n\n _drawBorder (border, style, callback) {\n let zoom = this.zoom;\n if(style.dataset && style.dataset.type) {\n zoom = 1;\n }\n border = Util.transferBorder(border);\n\n if (border && border.width) {\n // 空白阴影,清空掉边框的阴影\n this._drawBoxShadow();\n if (border) {\n \n this.ctx.setLineWidth(border.width * zoom);\n\n if (border.style === 'dashed') {\n let dash = style.dash || [5, 5, 0];\n let offset = dash[2] || 0;\n let array = [dash[0] || 5, dash[1] || 5];\n this.ctx.setLineDash(array, offset);\n }\n this.ctx.setStrokeStyle(border.color);\n }\n callback && callback(border);\n }\n } \n\n _drawBoxShadow (boxShadow, callback) {\n boxShadow = Util.transferBoxShadow(boxShadow);\n if (boxShadow) {\n this.ctx.setShadow(boxShadow.offsetX, boxShadow.offsetY, boxShadow.blur, boxShadow.color);\n }else {\n this.ctx.setShadow(0, 0, 0, '#ffffff');\n }\n\n callback && callback(boxShadow || {});\n }\n\n _setFill (fill, callback) {\n if(fill) {\n if (typeof fill === 'string') {\n this.ctx.setFillStyle(fill);\n } else {\n let line = fill.line;\n let color = fill.color;\n let grd = this.ctx.createLinearGradient(line[0], line[1], line[2], line[3]);\n grd.addColorStop(0, color[0]);\n grd.addColorStop(1, color[1]);\n this.ctx.setFillStyle(grd);\n }\n callback && callback();\n }\n }\n\n _setStroke (stroke, callback) {\n if(stroke) {\n if (typeof stroke === 'string') {\n this.ctx.setStrokeStyle(stroke);\n } else {\n let line = stroke.line;\n let color = stroke.color;\n let grd = this.ctx.createLinearGradient(line[0], line[1], line[2], line[3]);\n grd.addColorStop(0, color[0]);\n grd.addColorStop(1, color[1]);\n this.ctx.setStrokeStyle(grd);\n }\n\n callback && callback();\n }\n }\n}\n\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });exports.default = Wxml2Canvas;","/**\n * 获取字符的长度,full为true时,一个汉字算两个长度\n * @param {String} str \n * @param {Boolean} full \n */\n\nfunction getTextLength (str, full) {\n let len = 0;\n for (let i = 0; i < str.length; i++) {\n let c = str.charCodeAt(i);\n //单字节加1 \n if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {\n len++;\n }\n else {\n len += (full ? 2 : 1);\n }\n }\n return len;\n}\n\n/**\n * rgba(255, 255, 255, 1) => #ffffff\n * @param {String} color \n */\nfunction transferColor (color = '') {\n let res = '#';\n color = color.replace(/^rgba?\\(/, '').replace(/\\)$/, '');\n color = color.split(', ');\n \n color.length > 3 ? color.length = 3 : '';\n for(let item of color) {\n item = parseInt(item || 0);\n if(item < 10) {\n res += ('0' + item)\n }else {\n res += (item.toString(16))\n }\n }\n\n return res;\n}\n\nfunction transferBorder (border = '') {\n let res = border.match(/(\\w+)px\\s(\\w+)\\s(.*)/);\n let obj = {};\n\n if(res) {\n obj = {\n width: +res[1],\n style: res[2],\n color: res[3]\n }\n }\n \n return res ? obj : null;\n}\n\n\n/**\n * 内边距,依次为上右下左\n * @param {*} padding \n */\nfunction transferPadding (padding = '0 0 0 0') {\n padding = padding.split(' ');\n for(let i = 0, len = padding.length; i < len; i++) {\n padding[i] = +padding[i].replace('px', '');\n }\n\n return padding;\n}\n/**\n * type1: 0, 25, 17, rgba(0, 0, 0, 0.3)\n * type2: rgba(0, 0, 0, 0.3) 0px 25px 17px 0px => (0, 25, 17, rgba(0, 0, 0, 0.3))\n * @param {*} shadow \n */\nfunction transferBoxShadow(shadow = '', type) {\n if(!shadow || shadow === 'none') return;\n let color;\n let split;\n\n split = shadow.match(/(\\w+)\\s(\\w+)\\s(\\w+)\\s(rgb.*)/);\n\n if (split) {\n split.shift();\n shadow = split;\n color = split[3] || '#ffffff';\n } else {\n split = shadow.split(') ');\n color = split[0] + ')'\n shadow = split[1].split('px ');\n }\n\n return {\n offsetX: +shadow[0] || 0,\n offsetY: +shadow[1] || 0,\n blur: +shadow[2] || 0,\n color\n }\n}\n\nfunction getUid(prefix) {\n prefix = prefix || '';\n\n return (\n prefix +\n 'xxyxxyxx'.replace(/[xy]/g, c => {\n let r = (Math.random() * 16) | 0;\n let v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n })\n );\n}\n\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });exports.default = {\n getTextLength,\n transferBorder,\n transferColor,\n transferPadding,\n transferBoxShadow,\n getUid\n};"]} \ No newline at end of file diff --git a/miniprogram_npm/wxmp-rsa/index.js b/miniprogram_npm/wxmp-rsa/index.js index ef46bdf..2dc3223 100644 --- a/miniprogram_npm/wxmp-rsa/index.js +++ b/miniprogram_npm/wxmp-rsa/index.js @@ -4,13 +4,13 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; -__DEFINE__(1683383058316, function(require, module, exports) { +__DEFINE__(1689036503194, function(require, module, exports) { var __TEMP__ = require('./JSEncrypt');var JSEncrypt = __TEMP__['JSEncrypt']; if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } }); if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });exports.default = JSEncrypt; -}, function(modId) {var map = {"./JSEncrypt":1683383058317}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058317, function(require, module, exports) { +}, function(modId) {var map = {"./JSEncrypt":1689036503195}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503195, function(require, module, exports) { var __TEMP__ = require('./lib/jsbn/base64');var b64tohex = __TEMP__['b64tohex'];var hex2b64 = __TEMP__['hex2b64']; var __TEMP__ = require('./JSEncryptRSAKey');var JSEncryptRSAKey = __TEMP__['JSEncryptRSAKey']; var __TEMP__ = require('./version.json');var version = __REQUIRE_DEFAULT__(__TEMP__); @@ -217,8 +217,8 @@ var JSEncrypt = /** @class */ (function () { }()); if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } }); -}, function(modId) { var map = {"./lib/jsbn/base64":1683383058318,"./JSEncryptRSAKey":1683383058320,"./version.json":1683383058331}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058318, function(require, module, exports) { +}, function(modId) { var map = {"./lib/jsbn/base64":1689036503196,"./JSEncryptRSAKey":1689036503198,"./version.json":1689036503209}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503196, function(require, module, exports) { var __TEMP__ = require('./util');var int2char = __TEMP__['int2char']; var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var b64pad = "="; @@ -296,8 +296,8 @@ if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: t return a; };exports.b64toBA = b64toBA -}, function(modId) { var map = {"./util":1683383058319}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058319, function(require, module, exports) { +}, function(modId) { var map = {"./util":1689036503197}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503197, function(require, module, exports) { var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function int2char(n) { return BI_RM.charAt(n); @@ -358,7 +358,7 @@ if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: t //#endregion BIT_OPERATIONS }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058320, function(require, module, exports) { +__DEFINE__(1689036503198, function(require, module, exports) { var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || @@ -675,8 +675,8 @@ var JSEncryptRSAKey = /** @class */ (function (_super) { }(RSAKey)); if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'JSEncryptRSAKey', { enumerable: true, configurable: true, get: function() { return JSEncryptRSAKey; } }); -}, function(modId) { var map = {"./lib/jsbn/base64":1683383058318,"./lib/asn1js/hex":1683383058321,"./lib/asn1js/base64":1683383058322,"./lib/asn1js/asn1":1683383058323,"./lib/jsbn/rsa":1683383058325,"./lib/jsbn/jsbn":1683383058326,"./lib/jsrsasign/asn1-1.0":1683383058329}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058321, function(require, module, exports) { +}, function(modId) { var map = {"./lib/jsbn/base64":1689036503196,"./lib/asn1js/hex":1689036503199,"./lib/asn1js/base64":1689036503200,"./lib/asn1js/asn1":1689036503201,"./lib/jsbn/rsa":1689036503203,"./lib/jsbn/jsbn":1689036503204,"./lib/jsrsasign/asn1-1.0":1689036503207}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503199, function(require, module, exports) { // Hex JavaScript decoder // Copyright (c) 2008-2013 Lapo Luchini // Permission to use, copy, modify, and/or distribute this software for any @@ -743,7 +743,7 @@ if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: t }; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058322, function(require, module, exports) { +__DEFINE__(1689036503200, function(require, module, exports) { // Base64 JavaScript decoder // Copyright (c) 2008-2013 Lapo Luchini // Permission to use, copy, modify, and/or distribute this software for any @@ -834,7 +834,7 @@ if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: t }; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058323, function(require, module, exports) { +__DEFINE__(1689036503201, function(require, module, exports) { // ASN.1 JavaScript decoder // Copyright (c) 2008-2014 Lapo Luchini // Permission to use, copy, modify, and/or distribute this software for any @@ -1401,8 +1401,8 @@ var ASN1Tag = /** @class */ (function () { }()); if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'ASN1Tag', { enumerable: true, configurable: true, get: function() { return ASN1Tag; } }); -}, function(modId) { var map = {"./int10":1683383058324}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058324, function(require, module, exports) { +}, function(modId) { var map = {"./int10":1689036503202}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503202, function(require, module, exports) { // Big integer base-10 printing library // Copyright (c) 2014 Lapo Luchini // Permission to use, copy, modify, and/or distribute this software for any @@ -1492,7 +1492,7 @@ var Int10 = /** @class */ (function () { if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'Int10', { enumerable: true, configurable: true, get: function() { return Int10; } }); }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058325, function(require, module, exports) { +__DEFINE__(1689036503203, function(require, module, exports) { // Depends on jsbn.js and rng.js // Version 1.1: support utf-8 encoding in pkcs1pad2 // convert a (hex) string to a bignum object @@ -1965,8 +1965,8 @@ function removeDigestHeader(str) { // public // RSAKey.prototype.encrypt_b64 = RSAEncryptB64; -}, function(modId) { var map = {"./jsbn":1683383058326,"./rng":1683383058327}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058326, function(require, module, exports) { +}, function(modId) { var map = {"./jsbn":1689036503204,"./rng":1689036503205}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503204, function(require, module, exports) { // Copyright (c) 2005 Tom Wu // All Rights Reserved. // See "LICENSE" for details. @@ -3722,8 +3722,8 @@ if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: t BigInteger.ZERO = nbv(0); BigInteger.ONE = nbv(1); -}, function(modId) { var map = {"./util":1683383058319}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058327, function(require, module, exports) { +}, function(modId) { var map = {"./util":1689036503197}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503205, function(require, module, exports) { // Random number generator - requires a PRNG backend, e.g. prng4.js var __TEMP__ = require('./prng4');var prng_newstate = __TEMP__['prng_newstate'];var rng_psize = __TEMP__['rng_psize']; var rng_state; @@ -3781,8 +3781,8 @@ var SecureRandom = /** @class */ (function () { }()); if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'SecureRandom', { enumerable: true, configurable: true, get: function() { return SecureRandom; } }); -}, function(modId) { var map = {"./prng4":1683383058328}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058328, function(require, module, exports) { +}, function(modId) { var map = {"./prng4":1689036503206}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503206, function(require, module, exports) { // prng4.js - uses Arcfour as a PRNG var Arcfour = /** @class */ (function () { function Arcfour() { @@ -3831,7 +3831,7 @@ if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: t if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var rng_psize = exports.rng_psize = 256; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058329, function(require, module, exports) { +__DEFINE__(1689036503207, function(require, module, exports) { /* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license */ /* @@ -5426,8 +5426,8 @@ KJUR.asn1.DERTaggedObject = function (params) { }; YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); -}, function(modId) { var map = {"../jsbn/jsbn":1683383058326,"./yahoo":1683383058330}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058330, function(require, module, exports) { +}, function(modId) { var map = {"../jsbn/jsbn":1689036503204,"./yahoo":1689036503208}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1689036503208, function(require, module, exports) { /*! Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: @@ -5499,13 +5499,13 @@ YAHOO.lang = { }; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) -__DEFINE__(1683383058331, function(require, module, exports) { +__DEFINE__(1689036503209, function(require, module, exports) { module.exports = { "version": "3.2.1" } }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) -return __REQUIRE__(1683383058316); +return __REQUIRE__(1689036503194); })() //miniprogram-npm-outsideDeps=[] //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/miniprogram_npm/wxmp-rsa/index.js.map b/miniprogram_npm/wxmp-rsa/index.js.map index 2357654..9a25fa2 100644 --- a/miniprogram_npm/wxmp-rsa/index.js.map +++ b/miniprogram_npm/wxmp-rsa/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.js","JSEncrypt.js","lib/jsbn/base64.js","lib/jsbn/util.js","JSEncryptRSAKey.js","lib/asn1js/hex.js","lib/asn1js/base64.js","lib/asn1js/asn1.js","lib/asn1js/int10.js","lib/jsbn/rsa.js","lib/jsbn/jsbn.js","lib/jsbn/rng.js","lib/jsbn/prng4.js","lib/jsrsasign/asn1-1.0.js","lib/jsrsasign/yahoo.js","version.json"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;ACFA,ADGA;ACFA;AACA;AACA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA,ACHA;AFOA,ACHA,ACHA;AFOA,ACHA,ACHA;AFOA,AGTA,AFMA,ACHA;AFOA,AGTA,AFMA,ACHA;AFOA,AGTA,AFMA,ACHA;AFOA,AGTA,ACHA,AHSA,ACHA;AFOA,AGTA,ACHA,AHSA,ACHA;AFOA,AGTA,ACHA,AHSA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A;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["var __TEMP__ = require('./JSEncrypt');var JSEncrypt = __TEMP__['JSEncrypt'];\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } });\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });exports.default = JSEncrypt;\r\n","var __TEMP__ = require('./lib/jsbn/base64');var b64tohex = __TEMP__['b64tohex'];var hex2b64 = __TEMP__['hex2b64'];\r\nvar __TEMP__ = require('./JSEncryptRSAKey');var JSEncryptRSAKey = __TEMP__['JSEncryptRSAKey'];\r\nvar __TEMP__ = require('./version.json');var version = __REQUIRE_DEFAULT__(__TEMP__);\r\n/**\r\n *\r\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\r\n * possible parameters are:\r\n * - default_key_size {number} default: 1024 the key size in bit\r\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\r\n * - log {boolean} default: false whether log warn/error or not\r\n * @constructor\r\n */\r\nvar JSEncrypt = /** @class */ (function () {\r\n function JSEncrypt(options) {\r\n if (options === void 0) { options = {}; }\r\n options = options || {};\r\n this.default_key_size = options.default_key_size ? parseInt(options.default_key_size, 10) : 1024;\r\n this.default_public_exponent = options.default_public_exponent || \"010001\"; // 65537 default openssl public exponent for rsa key type\r\n this.log = options.log || false;\r\n // The private and public key.\r\n this.key = null;\r\n }\r\n /**\r\n * Method to set the rsa key parameter (one method is enough to set both the public\r\n * and the private key, since the private key contains the public key paramenters)\r\n * Log a warning if logs are enabled\r\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\r\n * @public\r\n */\r\n JSEncrypt.prototype.setKey = function (key) {\r\n if (this.log && this.key) {\r\n console.warn(\"A key was already set, overriding existing.\");\r\n }\r\n this.key = new JSEncryptRSAKey(key);\r\n };\r\n /**\r\n * Proxy method for setKey, for api compatibility\r\n * @see setKey\r\n * @public\r\n */\r\n JSEncrypt.prototype.setPrivateKey = function (privkey) {\r\n // Create the key.\r\n this.setKey(privkey);\r\n };\r\n /**\r\n * Proxy method for setKey, for api compatibility\r\n * @see setKey\r\n * @public\r\n */\r\n JSEncrypt.prototype.setPublicKey = function (pubkey) {\r\n // Sets the public key.\r\n this.setKey(pubkey);\r\n };\r\n /**\r\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\r\n * components of the rsa key object. Note that if the object was not set will be created\r\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\r\n * @param {string} str base64 encoded crypted string to decrypt\r\n * @return {string} the decrypted string\r\n * @public\r\n */\r\n JSEncrypt.prototype.decrypt = function (str) {\r\n // Return the decrypted string.\r\n try {\r\n return this.getKey().decrypt(b64tohex(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\r\n * components of the rsa key object. Note that if the object was not set will be created\r\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\r\n * @param {string} str the string to encrypt\r\n * @return {string} the encrypted string encoded in base64\r\n * @public\r\n */\r\n JSEncrypt.prototype.encrypt = function (str) {\r\n // Return the encrypted string.\r\n try {\r\n return hex2b64(this.getKey().encrypt(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n // 超长文本加密\r\n JSEncrypt.prototype.encryptLong = function (str) {\r\n try {\r\n return hex2b64(this.getKey().encryptLong(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n // 超长文本解密\r\n JSEncrypt.prototype.decryptLong = function (str) {\r\n try {\r\n return this.getKey().decryptLong(b64tohex(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Proxy method for RSAKey object's sign.\r\n * @param {string} str the string to sign\r\n * @param {function} digestMethod hash method\r\n * @param {string} digestName the name of the hash algorithm\r\n * @return {string} the signature encoded in base64\r\n * @public\r\n */\r\n JSEncrypt.prototype.sign = function (str, digestMethod, digestName) {\r\n // return the RSA signature of 'str' in 'hex' format.\r\n try {\r\n return hex2b64(this.getKey().sign(str, digestMethod, digestName));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Proxy method for RSAKey object's verify.\r\n * @param {string} str the string to verify\r\n * @param {string} signature the signature encoded in base64 to compare the string to\r\n * @param {function} digestMethod hash method\r\n * @return {boolean} whether the data and signature match\r\n * @public\r\n */\r\n JSEncrypt.prototype.verify = function (str, signature, digestMethod) {\r\n // Return the decrypted 'digest' of the signature.\r\n try {\r\n return this.getKey().verify(str, b64tohex(signature), digestMethod);\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\r\n * will be created and returned\r\n * @param {callback} [cb] the callback to be called if we want the key to be generated\r\n * in an async fashion\r\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\r\n * @public\r\n */\r\n JSEncrypt.prototype.getKey = function (cb) {\r\n // Only create new if it does not exist.\r\n if (!this.key) {\r\n // Get a new private key.\r\n this.key = new JSEncryptRSAKey();\r\n if (cb && {}.toString.call(cb) === \"[object Function]\") {\r\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\r\n return;\r\n }\r\n // Generate the key.\r\n this.key.generate(this.default_key_size, this.default_public_exponent);\r\n }\r\n return this.key;\r\n };\r\n /**\r\n * Returns the pem encoded representation of the private key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the private key WITH header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPrivateKey = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPrivateKey();\r\n };\r\n /**\r\n * Returns the pem encoded representation of the private key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPrivateKeyB64 = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPrivateBaseKeyB64();\r\n };\r\n /**\r\n * Returns the pem encoded representation of the public key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the public key WITH header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPublicKey = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPublicKey();\r\n };\r\n /**\r\n * Returns the pem encoded representation of the public key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPublicKeyB64 = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPublicBaseKeyB64();\r\n };\r\n JSEncrypt.version = version.version;\r\n return JSEncrypt;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } });\r\n","var __TEMP__ = require('./util');var int2char = __TEMP__['int2char'];\r\nvar b64map = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\nvar b64pad = \"=\";\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function hex2b64(h) {\r\n var i;\r\n var c;\r\n var ret = \"\";\r\n for (i = 0; i + 3 <= h.length; i += 3) {\r\n c = parseInt(h.substring(i, i + 3), 16);\r\n ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);\r\n }\r\n if (i + 1 == h.length) {\r\n c = parseInt(h.substring(i, i + 1), 16);\r\n ret += b64map.charAt(c << 2);\r\n }\r\n else if (i + 2 == h.length) {\r\n c = parseInt(h.substring(i, i + 2), 16);\r\n ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);\r\n }\r\n while ((ret.length & 3) > 0) {\r\n ret += b64pad;\r\n }\r\n return ret;\r\n};exports.hex2b64 = hex2b64\r\n// convert a base64 string to hex\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function b64tohex(s) {\r\n var ret = \"\";\r\n var i;\r\n var k = 0; // b64 state, 0-3\r\n var slop = 0;\r\n for (i = 0; i < s.length; ++i) {\r\n if (s.charAt(i) == b64pad) {\r\n break;\r\n }\r\n var v = b64map.indexOf(s.charAt(i));\r\n if (v < 0) {\r\n continue;\r\n }\r\n if (k == 0) {\r\n ret += int2char(v >> 2);\r\n slop = v & 3;\r\n k = 1;\r\n }\r\n else if (k == 1) {\r\n ret += int2char((slop << 2) | (v >> 4));\r\n slop = v & 0xf;\r\n k = 2;\r\n }\r\n else if (k == 2) {\r\n ret += int2char(slop);\r\n ret += int2char(v >> 2);\r\n slop = v & 3;\r\n k = 3;\r\n }\r\n else {\r\n ret += int2char((slop << 2) | (v >> 4));\r\n ret += int2char(v & 0xf);\r\n k = 0;\r\n }\r\n }\r\n if (k == 1) {\r\n ret += int2char(slop << 2);\r\n }\r\n return ret;\r\n};exports.b64tohex = b64tohex\r\n// convert a base64 string to a byte/number array\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function b64toBA(s) {\r\n // piggyback on b64tohex for now, optimize later\r\n var h = b64tohex(s);\r\n var i;\r\n var a = [];\r\n for (i = 0; 2 * i < h.length; ++i) {\r\n a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);\r\n }\r\n return a;\r\n};exports.b64toBA = b64toBA\r\n","var BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function int2char(n) {\r\n return BI_RM.charAt(n);\r\n};exports.int2char = int2char\r\n//#region BIT_OPERATIONS\r\n// (public) this & a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_and(x, y) {\r\n return x & y;\r\n};exports.op_and = op_and\r\n// (public) this | a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_or(x, y) {\r\n return x | y;\r\n};exports.op_or = op_or\r\n// (public) this ^ a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_xor(x, y) {\r\n return x ^ y;\r\n};exports.op_xor = op_xor\r\n// (public) this & ~a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_andnot(x, y) {\r\n return x & ~y;\r\n};exports.op_andnot = op_andnot\r\n// return index of lowest 1-bit in x, x < 2^31\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function lbit(x) {\r\n if (x == 0) {\r\n return -1;\r\n }\r\n var r = 0;\r\n if ((x & 0xffff) == 0) {\r\n x >>= 16;\r\n r += 16;\r\n }\r\n if ((x & 0xff) == 0) {\r\n x >>= 8;\r\n r += 8;\r\n }\r\n if ((x & 0xf) == 0) {\r\n x >>= 4;\r\n r += 4;\r\n }\r\n if ((x & 3) == 0) {\r\n x >>= 2;\r\n r += 2;\r\n }\r\n if ((x & 1) == 0) {\r\n ++r;\r\n }\r\n return r;\r\n};exports.lbit = lbit\r\n// return number of 1 bits in x\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function cbit(x) {\r\n var r = 0;\r\n while (x != 0) {\r\n x &= x - 1;\r\n ++r;\r\n }\r\n return r;\r\n};exports.cbit = cbit\r\n//#endregion BIT_OPERATIONS\r\n","var __extends = (this && this.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar __TEMP__ = require('./lib/jsbn/base64');var hex2b64 = __TEMP__['hex2b64'];\r\nvar __TEMP__ = require('./lib/asn1js/hex');var Hex = __TEMP__['Hex'];\r\nvar __TEMP__ = require('./lib/asn1js/base64');var Base64 = __TEMP__['Base64'];\r\nvar __TEMP__ = require('./lib/asn1js/asn1');var ASN1 = __TEMP__['ASN1'];\r\nvar __TEMP__ = require('./lib/jsbn/rsa');var RSAKey = __TEMP__['RSAKey'];\r\nvar __TEMP__ = require('./lib/jsbn/jsbn');var parseBigInt = __TEMP__['parseBigInt'];\r\nvar __TEMP__ = require('./lib/jsrsasign/asn1-1.0');var KJUR = __TEMP__['KJUR'];\r\n/**\r\n * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.\r\n * This object is just a decorator for parsing the key parameter\r\n * @param {string|Object} key - The key in string format, or an object containing\r\n * the parameters needed to build a RSAKey object.\r\n * @constructor\r\n */\r\nvar JSEncryptRSAKey = /** @class */ (function (_super) {\r\n __extends(JSEncryptRSAKey, _super);\r\n function JSEncryptRSAKey(key) {\r\n var _this = _super.call(this) || this;\r\n // Call the super constructor.\r\n // RSAKey.call(this);\r\n // If a key key was provided.\r\n if (key) {\r\n // If this is a string...\r\n if (typeof key === \"string\") {\r\n _this.parseKey(key);\r\n }\r\n else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) ||\r\n JSEncryptRSAKey.hasPublicKeyProperty(key)) {\r\n // Set the values for the key.\r\n _this.parsePropertiesFrom(key);\r\n }\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Method to parse a pem encoded string containing both a public or private key.\r\n * The method will translate the pem encoded string in a der encoded string and\r\n * will parse private key and public key parameters. This method accepts public key\r\n * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).\r\n *\r\n * @todo Check how many rsa formats use the same format of pkcs #1.\r\n *\r\n * The format is defined as:\r\n * PublicKeyInfo ::= SEQUENCE {\r\n * algorithm AlgorithmIdentifier,\r\n * PublicKey BIT STRING\r\n * }\r\n * Where AlgorithmIdentifier is:\r\n * AlgorithmIdentifier ::= SEQUENCE {\r\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\r\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\r\n * }\r\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\r\n * RSAPublicKey ::= SEQUENCE {\r\n * modulus INTEGER, -- n\r\n * publicExponent INTEGER -- e\r\n * }\r\n * it's possible to examine the structure of the keys obtained from openssl using\r\n * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/\r\n * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.parseKey = function (pem) {\r\n try {\r\n var modulus = 0;\r\n var public_exponent = 0;\r\n var reHex = /^\\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\\s*)+$/;\r\n var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);\r\n var asn1 = ASN1.decode(der);\r\n // Fixes a bug with OpenSSL 1.0+ private keys\r\n if (asn1.sub.length === 3) {\r\n asn1 = asn1.sub[2].sub[0];\r\n }\r\n if (asn1.sub.length === 9) {\r\n // Parse the private key.\r\n modulus = asn1.sub[1].getHexStringValue(); // bigint\r\n this.n = parseBigInt(modulus, 16);\r\n public_exponent = asn1.sub[2].getHexStringValue(); // int\r\n this.e = parseInt(public_exponent, 16);\r\n var private_exponent = asn1.sub[3].getHexStringValue(); // bigint\r\n this.d = parseBigInt(private_exponent, 16);\r\n var prime1 = asn1.sub[4].getHexStringValue(); // bigint\r\n this.p = parseBigInt(prime1, 16);\r\n var prime2 = asn1.sub[5].getHexStringValue(); // bigint\r\n this.q = parseBigInt(prime2, 16);\r\n var exponent1 = asn1.sub[6].getHexStringValue(); // bigint\r\n this.dmp1 = parseBigInt(exponent1, 16);\r\n var exponent2 = asn1.sub[7].getHexStringValue(); // bigint\r\n this.dmq1 = parseBigInt(exponent2, 16);\r\n var coefficient = asn1.sub[8].getHexStringValue(); // bigint\r\n this.coeff = parseBigInt(coefficient, 16);\r\n }\r\n else if (asn1.sub.length === 2) {\r\n // Parse the public key.\r\n var bit_string = asn1.sub[1];\r\n var sequence = bit_string.sub[0];\r\n modulus = sequence.sub[0].getHexStringValue();\r\n this.n = parseBigInt(modulus, 16);\r\n public_exponent = sequence.sub[1].getHexStringValue();\r\n this.e = parseInt(public_exponent, 16);\r\n }\r\n else {\r\n return false;\r\n }\r\n return true;\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Translate rsa parameters in a hex encoded string representing the rsa key.\r\n *\r\n * The translation follow the ASN.1 notation :\r\n * RSAPrivateKey ::= SEQUENCE {\r\n * version Version,\r\n * modulus INTEGER, -- n\r\n * publicExponent INTEGER, -- e\r\n * privateExponent INTEGER, -- d\r\n * prime1 INTEGER, -- p\r\n * prime2 INTEGER, -- q\r\n * exponent1 INTEGER, -- d mod (p1)\r\n * exponent2 INTEGER, -- d mod (q-1)\r\n * coefficient INTEGER, -- (inverse of q) mod p\r\n * }\r\n * @returns {string} DER Encoded String representing the rsa private key\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.getPrivateBaseKey = function () {\r\n var options = {\r\n array: [\r\n new KJUR.asn1.DERInteger({ int: 0 }),\r\n new KJUR.asn1.DERInteger({ bigint: this.n }),\r\n new KJUR.asn1.DERInteger({ int: this.e }),\r\n new KJUR.asn1.DERInteger({ bigint: this.d }),\r\n new KJUR.asn1.DERInteger({ bigint: this.p }),\r\n new KJUR.asn1.DERInteger({ bigint: this.q }),\r\n new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),\r\n new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),\r\n new KJUR.asn1.DERInteger({ bigint: this.coeff })\r\n ]\r\n };\r\n var seq = new KJUR.asn1.DERSequence(options);\r\n return seq.getEncodedHex();\r\n };\r\n /**\r\n * base64 (pem) encoded version of the DER encoded representation\r\n * @returns {string} pem encoded representation without header and footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function () {\r\n return hex2b64(this.getPrivateBaseKey());\r\n };\r\n /**\r\n * Translate rsa parameters in a hex encoded string representing the rsa public key.\r\n * The representation follow the ASN.1 notation :\r\n * PublicKeyInfo ::= SEQUENCE {\r\n * algorithm AlgorithmIdentifier,\r\n * PublicKey BIT STRING\r\n * }\r\n * Where AlgorithmIdentifier is:\r\n * AlgorithmIdentifier ::= SEQUENCE {\r\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\r\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\r\n * }\r\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\r\n * RSAPublicKey ::= SEQUENCE {\r\n * modulus INTEGER, -- n\r\n * publicExponent INTEGER -- e\r\n * }\r\n * @returns {string} DER Encoded String representing the rsa public key\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.getPublicBaseKey = function () {\r\n var first_sequence = new KJUR.asn1.DERSequence({\r\n array: [\r\n new KJUR.asn1.DERObjectIdentifier({ oid: \"1.2.840.113549.1.1.1\" }),\r\n new KJUR.asn1.DERNull()\r\n ]\r\n });\r\n var second_sequence = new KJUR.asn1.DERSequence({\r\n array: [\r\n new KJUR.asn1.DERInteger({ bigint: this.n }),\r\n new KJUR.asn1.DERInteger({ int: this.e })\r\n ]\r\n });\r\n var bit_string = new KJUR.asn1.DERBitString({\r\n hex: \"00\" + second_sequence.getEncodedHex()\r\n });\r\n var seq = new KJUR.asn1.DERSequence({\r\n array: [\r\n first_sequence,\r\n bit_string\r\n ]\r\n });\r\n return seq.getEncodedHex();\r\n };\r\n /**\r\n * base64 (pem) encoded version of the DER encoded representation\r\n * @returns {string} pem encoded representation without header and footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function () {\r\n return hex2b64(this.getPublicBaseKey());\r\n };\r\n /**\r\n * wrap the string in block of width chars. The default value for rsa keys is 64\r\n * characters.\r\n * @param {string} str the pem encoded string without header and footer\r\n * @param {Number} [width=64] - the length the string has to be wrapped at\r\n * @returns {string}\r\n * @private\r\n */\r\n JSEncryptRSAKey.wordwrap = function (str, width) {\r\n width = width || 64;\r\n if (!str) {\r\n return str;\r\n }\r\n var regex = \"(.{1,\" + width + \"})( +|$\\n?)|(.{1,\" + width + \"})\";\r\n return str.match(RegExp(regex, \"g\")).join(\"\\n\");\r\n };\r\n /**\r\n * Retrieve the pem encoded private key\r\n * @returns {string} the pem encoded private key with header/footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPrivateKey = function () {\r\n var key = \"-----BEGIN RSA PRIVATE KEY-----\\n\";\r\n key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + \"\\n\";\r\n key += \"-----END RSA PRIVATE KEY-----\";\r\n return key;\r\n };\r\n /**\r\n * Retrieve the pem encoded public key\r\n * @returns {string} the pem encoded public key with header/footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPublicKey = function () {\r\n var key = \"-----BEGIN PUBLIC KEY-----\\n\";\r\n key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + \"\\n\";\r\n key += \"-----END PUBLIC KEY-----\";\r\n return key;\r\n };\r\n /**\r\n * Check if the object contains the necessary parameters to populate the rsa modulus\r\n * and public exponent parameters.\r\n * @param {Object} [obj={}] - An object that may contain the two public key\r\n * parameters\r\n * @returns {boolean} true if the object contains both the modulus and the public exponent\r\n * properties (n and e)\r\n * @todo check for types of n and e. N should be a parseable bigInt object, E should\r\n * be a parseable integer number\r\n * @private\r\n */\r\n JSEncryptRSAKey.hasPublicKeyProperty = function (obj) {\r\n obj = obj || {};\r\n return (obj.hasOwnProperty(\"n\") &&\r\n obj.hasOwnProperty(\"e\"));\r\n };\r\n /**\r\n * Check if the object contains ALL the parameters of an RSA key.\r\n * @param {Object} [obj={}] - An object that may contain nine rsa key\r\n * parameters\r\n * @returns {boolean} true if the object contains all the parameters needed\r\n * @todo check for types of the parameters all the parameters but the public exponent\r\n * should be parseable bigint objects, the public exponent should be a parseable integer number\r\n * @private\r\n */\r\n JSEncryptRSAKey.hasPrivateKeyProperty = function (obj) {\r\n obj = obj || {};\r\n return (obj.hasOwnProperty(\"n\") &&\r\n obj.hasOwnProperty(\"e\") &&\r\n obj.hasOwnProperty(\"d\") &&\r\n obj.hasOwnProperty(\"p\") &&\r\n obj.hasOwnProperty(\"q\") &&\r\n obj.hasOwnProperty(\"dmp1\") &&\r\n obj.hasOwnProperty(\"dmq1\") &&\r\n obj.hasOwnProperty(\"coeff\"));\r\n };\r\n /**\r\n * Parse the properties of obj in the current rsa object. Obj should AT LEAST\r\n * include the modulus and public exponent (n, e) parameters.\r\n * @param {Object} obj - the object containing rsa parameters\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.parsePropertiesFrom = function (obj) {\r\n this.n = obj.n;\r\n this.e = obj.e;\r\n if (obj.hasOwnProperty(\"d\")) {\r\n this.d = obj.d;\r\n this.p = obj.p;\r\n this.q = obj.q;\r\n this.dmp1 = obj.dmp1;\r\n this.dmq1 = obj.dmq1;\r\n this.coeff = obj.coeff;\r\n }\r\n };\r\n return JSEncryptRSAKey;\r\n}(RSAKey));\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncryptRSAKey', { enumerable: true, configurable: true, get: function() { return JSEncryptRSAKey; } });\r\n","// Hex JavaScript decoder\r\n// Copyright (c) 2008-2013 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\nvar decoder;\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var Hex = exports.Hex = {\r\n decode: function (a) {\r\n var i;\r\n if (decoder === undefined) {\r\n var hex = \"0123456789ABCDEF\";\r\n var ignore = \" \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\r\n decoder = {};\r\n for (i = 0; i < 16; ++i) {\r\n decoder[hex.charAt(i)] = i;\r\n }\r\n hex = hex.toLowerCase();\r\n for (i = 10; i < 16; ++i) {\r\n decoder[hex.charAt(i)] = i;\r\n }\r\n for (i = 0; i < ignore.length; ++i) {\r\n decoder[ignore.charAt(i)] = -1;\r\n }\r\n }\r\n var out = [];\r\n var bits = 0;\r\n var char_count = 0;\r\n for (i = 0; i < a.length; ++i) {\r\n var c = a.charAt(i);\r\n if (c == \"=\") {\r\n break;\r\n }\r\n c = decoder[c];\r\n if (c == -1) {\r\n continue;\r\n }\r\n if (c === undefined) {\r\n throw new Error(\"Illegal character at offset \" + i);\r\n }\r\n bits |= c;\r\n if (++char_count >= 2) {\r\n out[out.length] = bits;\r\n bits = 0;\r\n char_count = 0;\r\n }\r\n else {\r\n bits <<= 4;\r\n }\r\n }\r\n if (char_count) {\r\n throw new Error(\"Hex encoding incomplete: 4 bits missing\");\r\n }\r\n return out;\r\n }\r\n};\r\n","// Base64 JavaScript decoder\r\n// Copyright (c) 2008-2013 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\nvar decoder;\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var Base64 = exports.Base64 = {\r\n decode: function (a) {\r\n var i;\r\n if (decoder === undefined) {\r\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n var ignore = \"= \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\r\n decoder = Object.create(null);\r\n for (i = 0; i < 64; ++i) {\r\n decoder[b64.charAt(i)] = i;\r\n }\r\n decoder['-'] = 62; //+\r\n decoder['_'] = 63; //-\r\n for (i = 0; i < ignore.length; ++i) {\r\n decoder[ignore.charAt(i)] = -1;\r\n }\r\n }\r\n var out = [];\r\n var bits = 0;\r\n var char_count = 0;\r\n for (i = 0; i < a.length; ++i) {\r\n var c = a.charAt(i);\r\n if (c == \"=\") {\r\n break;\r\n }\r\n c = decoder[c];\r\n if (c == -1) {\r\n continue;\r\n }\r\n if (c === undefined) {\r\n throw new Error(\"Illegal character at offset \" + i);\r\n }\r\n bits |= c;\r\n if (++char_count >= 4) {\r\n out[out.length] = (bits >> 16);\r\n out[out.length] = (bits >> 8) & 0xFF;\r\n out[out.length] = bits & 0xFF;\r\n bits = 0;\r\n char_count = 0;\r\n }\r\n else {\r\n bits <<= 6;\r\n }\r\n }\r\n switch (char_count) {\r\n case 1:\r\n throw new Error(\"Base64 encoding incomplete: at least 2 bits missing\");\r\n case 2:\r\n out[out.length] = (bits >> 10);\r\n break;\r\n case 3:\r\n out[out.length] = (bits >> 16);\r\n out[out.length] = (bits >> 8) & 0xFF;\r\n break;\r\n }\r\n return out;\r\n },\r\n re: /-----BEGIN [^-]+-----([A-Za-z0-9+\\/=\\s]+)-----END [^-]+-----|begin-base64[^\\n]+\\n([A-Za-z0-9+\\/=\\s]+)====/,\r\n unarmor: function (a) {\r\n var m = Base64.re.exec(a);\r\n if (m) {\r\n if (m[1]) {\r\n a = m[1];\r\n }\r\n else if (m[2]) {\r\n a = m[2];\r\n }\r\n else {\r\n throw new Error(\"RegExp out of sync\");\r\n }\r\n }\r\n return Base64.decode(a);\r\n }\r\n};\r\n","// ASN.1 JavaScript decoder\r\n// Copyright (c) 2008-2014 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\n/*global oids */\r\nvar __TEMP__ = require('./int10');var Int10 = __TEMP__['Int10'];\r\nvar ellipsis = \"\\u2026\";\r\nvar reTimeS = /^(\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\r\nvar reTimeL = /^(\\d\\d\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\r\nfunction stringCut(str, len) {\r\n if (str.length > len) {\r\n str = str.substring(0, len) + ellipsis;\r\n }\r\n return str;\r\n}\r\nvar Stream = /** @class */ (function () {\r\n function Stream(enc, pos) {\r\n this.hexDigits = \"0123456789ABCDEF\";\r\n if (enc instanceof Stream) {\r\n this.enc = enc.enc;\r\n this.pos = enc.pos;\r\n }\r\n else {\r\n // enc should be an array or a binary string\r\n this.enc = enc;\r\n this.pos = pos;\r\n }\r\n }\r\n Stream.prototype.get = function (pos) {\r\n if (pos === undefined) {\r\n pos = this.pos++;\r\n }\r\n if (pos >= this.enc.length) {\r\n throw new Error(\"Requesting byte offset \" + pos + \" on a stream of length \" + this.enc.length);\r\n }\r\n return (\"string\" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos];\r\n };\r\n Stream.prototype.hexByte = function (b) {\r\n return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF);\r\n };\r\n Stream.prototype.hexDump = function (start, end, raw) {\r\n var s = \"\";\r\n for (var i = start; i < end; ++i) {\r\n s += this.hexByte(this.get(i));\r\n if (raw !== true) {\r\n switch (i & 0xF) {\r\n case 0x7:\r\n s += \" \";\r\n break;\r\n case 0xF:\r\n s += \"\\n\";\r\n break;\r\n default:\r\n s += \" \";\r\n }\r\n }\r\n }\r\n return s;\r\n };\r\n Stream.prototype.isASCII = function (start, end) {\r\n for (var i = start; i < end; ++i) {\r\n var c = this.get(i);\r\n if (c < 32 || c > 176) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Stream.prototype.parseStringISO = function (start, end) {\r\n var s = \"\";\r\n for (var i = start; i < end; ++i) {\r\n s += String.fromCharCode(this.get(i));\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseStringUTF = function (start, end) {\r\n var s = \"\";\r\n for (var i = start; i < end;) {\r\n var c = this.get(i++);\r\n if (c < 128) {\r\n s += String.fromCharCode(c);\r\n }\r\n else if ((c > 191) && (c < 224)) {\r\n s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F));\r\n }\r\n else {\r\n s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F));\r\n }\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseStringBMP = function (start, end) {\r\n var str = \"\";\r\n var hi;\r\n var lo;\r\n for (var i = start; i < end;) {\r\n hi = this.get(i++);\r\n lo = this.get(i++);\r\n str += String.fromCharCode((hi << 8) | lo);\r\n }\r\n return str;\r\n };\r\n Stream.prototype.parseTime = function (start, end, shortYear) {\r\n var s = this.parseStringISO(start, end);\r\n var m = (shortYear ? reTimeS : reTimeL).exec(s);\r\n if (!m) {\r\n return \"Unrecognized time: \" + s;\r\n }\r\n if (shortYear) {\r\n // to avoid querying the timer, use the fixed range [1970, 2069]\r\n // it will conform with ITU X.400 [-10, +40] sliding window until 2030\r\n m[1] = +m[1];\r\n m[1] += (+m[1] < 70) ? 2000 : 1900;\r\n }\r\n s = m[1] + \"-\" + m[2] + \"-\" + m[3] + \" \" + m[4];\r\n if (m[5]) {\r\n s += \":\" + m[5];\r\n if (m[6]) {\r\n s += \":\" + m[6];\r\n if (m[7]) {\r\n s += \".\" + m[7];\r\n }\r\n }\r\n }\r\n if (m[8]) {\r\n s += \" UTC\";\r\n if (m[8] != \"Z\") {\r\n s += m[8];\r\n if (m[9]) {\r\n s += \":\" + m[9];\r\n }\r\n }\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseInteger = function (start, end) {\r\n var v = this.get(start);\r\n var neg = (v > 127);\r\n var pad = neg ? 255 : 0;\r\n var len;\r\n var s = \"\";\r\n // skip unuseful bits (not allowed in DER)\r\n while (v == pad && ++start < end) {\r\n v = this.get(start);\r\n }\r\n len = end - start;\r\n if (len === 0) {\r\n return neg ? -1 : 0;\r\n }\r\n // show bit length of huge integers\r\n if (len > 4) {\r\n s = v;\r\n len <<= 3;\r\n while (((+s ^ pad) & 0x80) == 0) {\r\n s = +s << 1;\r\n --len;\r\n }\r\n s = \"(\" + len + \" bit)\\n\";\r\n }\r\n // decode the integer\r\n if (neg) {\r\n v = v - 256;\r\n }\r\n var n = new Int10(v);\r\n for (var i = start + 1; i < end; ++i) {\r\n n.mulAdd(256, this.get(i));\r\n }\r\n return s + n.toString();\r\n };\r\n Stream.prototype.parseBitString = function (start, end, maxLength) {\r\n var unusedBit = this.get(start);\r\n var lenBit = ((end - start - 1) << 3) - unusedBit;\r\n var intro = \"(\" + lenBit + \" bit)\\n\";\r\n var s = \"\";\r\n for (var i = start + 1; i < end; ++i) {\r\n var b = this.get(i);\r\n var skip = (i == end - 1) ? unusedBit : 0;\r\n for (var j = 7; j >= skip; --j) {\r\n s += (b >> j) & 1 ? \"1\" : \"0\";\r\n }\r\n if (s.length > maxLength) {\r\n return intro + stringCut(s, maxLength);\r\n }\r\n }\r\n return intro + s;\r\n };\r\n Stream.prototype.parseOctetString = function (start, end, maxLength) {\r\n if (this.isASCII(start, end)) {\r\n return stringCut(this.parseStringISO(start, end), maxLength);\r\n }\r\n var len = end - start;\r\n var s = \"(\" + len + \" byte)\\n\";\r\n maxLength /= 2; // we work in bytes\r\n if (len > maxLength) {\r\n end = start + maxLength;\r\n }\r\n for (var i = start; i < end; ++i) {\r\n s += this.hexByte(this.get(i));\r\n }\r\n if (len > maxLength) {\r\n s += ellipsis;\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseOID = function (start, end, maxLength) {\r\n var s = \"\";\r\n var n = new Int10();\r\n var bits = 0;\r\n for (var i = start; i < end; ++i) {\r\n var v = this.get(i);\r\n n.mulAdd(128, v & 0x7F);\r\n bits += 7;\r\n if (!(v & 0x80)) { // finished\r\n if (s === \"\") {\r\n n = n.simplify();\r\n if (n instanceof Int10) {\r\n n.sub(80);\r\n s = \"2.\" + n.toString();\r\n }\r\n else {\r\n var m = n < 80 ? n < 40 ? 0 : 1 : 2;\r\n s = m + \".\" + (n - m * 40);\r\n }\r\n }\r\n else {\r\n s += \".\" + n.toString();\r\n }\r\n if (s.length > maxLength) {\r\n return stringCut(s, maxLength);\r\n }\r\n n = new Int10();\r\n bits = 0;\r\n }\r\n }\r\n if (bits > 0) {\r\n s += \".incomplete\";\r\n }\r\n return s;\r\n };\r\n return Stream;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Stream', { enumerable: true, configurable: true, get: function() { return Stream; } });\r\nvar ASN1 = /** @class */ (function () {\r\n function ASN1(stream, header, length, tag, sub) {\r\n if (!(tag instanceof ASN1Tag)) {\r\n throw new Error(\"Invalid tag value.\");\r\n }\r\n this.stream = stream;\r\n this.header = header;\r\n this.length = length;\r\n this.tag = tag;\r\n this.sub = sub;\r\n }\r\n ASN1.prototype.typeName = function () {\r\n switch (this.tag.tagClass) {\r\n case 0: // universal\r\n switch (this.tag.tagNumber) {\r\n case 0x00:\r\n return \"EOC\";\r\n case 0x01:\r\n return \"BOOLEAN\";\r\n case 0x02:\r\n return \"INTEGER\";\r\n case 0x03:\r\n return \"BIT_STRING\";\r\n case 0x04:\r\n return \"OCTET_STRING\";\r\n case 0x05:\r\n return \"NULL\";\r\n case 0x06:\r\n return \"OBJECT_IDENTIFIER\";\r\n case 0x07:\r\n return \"ObjectDescriptor\";\r\n case 0x08:\r\n return \"EXTERNAL\";\r\n case 0x09:\r\n return \"REAL\";\r\n case 0x0A:\r\n return \"ENUMERATED\";\r\n case 0x0B:\r\n return \"EMBEDDED_PDV\";\r\n case 0x0C:\r\n return \"UTF8String\";\r\n case 0x10:\r\n return \"SEQUENCE\";\r\n case 0x11:\r\n return \"SET\";\r\n case 0x12:\r\n return \"NumericString\";\r\n case 0x13:\r\n return \"PrintableString\"; // ASCII subset\r\n case 0x14:\r\n return \"TeletexString\"; // aka T61String\r\n case 0x15:\r\n return \"VideotexString\";\r\n case 0x16:\r\n return \"IA5String\"; // ASCII\r\n case 0x17:\r\n return \"UTCTime\";\r\n case 0x18:\r\n return \"GeneralizedTime\";\r\n case 0x19:\r\n return \"GraphicString\";\r\n case 0x1A:\r\n return \"VisibleString\"; // ASCII subset\r\n case 0x1B:\r\n return \"GeneralString\";\r\n case 0x1C:\r\n return \"UniversalString\";\r\n case 0x1E:\r\n return \"BMPString\";\r\n }\r\n return \"Universal_\" + this.tag.tagNumber.toString();\r\n case 1:\r\n return \"Application_\" + this.tag.tagNumber.toString();\r\n case 2:\r\n return \"[\" + this.tag.tagNumber.toString() + \"]\"; // Context\r\n case 3:\r\n return \"Private_\" + this.tag.tagNumber.toString();\r\n }\r\n };\r\n ASN1.prototype.content = function (maxLength) {\r\n if (this.tag === undefined) {\r\n return null;\r\n }\r\n if (maxLength === undefined) {\r\n maxLength = Infinity;\r\n }\r\n var content = this.posContent();\r\n var len = Math.abs(this.length);\r\n if (!this.tag.isUniversal()) {\r\n if (this.sub !== null) {\r\n return \"(\" + this.sub.length + \" elem)\";\r\n }\r\n return this.stream.parseOctetString(content, content + len, maxLength);\r\n }\r\n switch (this.tag.tagNumber) {\r\n case 0x01: // BOOLEAN\r\n return (this.stream.get(content) === 0) ? \"false\" : \"true\";\r\n case 0x02: // INTEGER\r\n return this.stream.parseInteger(content, content + len);\r\n case 0x03: // BIT_STRING\r\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\r\n this.stream.parseBitString(content, content + len, maxLength);\r\n case 0x04: // OCTET_STRING\r\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\r\n this.stream.parseOctetString(content, content + len, maxLength);\r\n // case 0x05: // NULL\r\n case 0x06: // OBJECT_IDENTIFIER\r\n return this.stream.parseOID(content, content + len, maxLength);\r\n // case 0x07: // ObjectDescriptor\r\n // case 0x08: // EXTERNAL\r\n // case 0x09: // REAL\r\n // case 0x0A: // ENUMERATED\r\n // case 0x0B: // EMBEDDED_PDV\r\n case 0x10: // SEQUENCE\r\n case 0x11: // SET\r\n if (this.sub !== null) {\r\n return \"(\" + this.sub.length + \" elem)\";\r\n }\r\n else {\r\n return \"(no elem)\";\r\n }\r\n case 0x0C: // UTF8String\r\n return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);\r\n case 0x12: // NumericString\r\n case 0x13: // PrintableString\r\n case 0x14: // TeletexString\r\n case 0x15: // VideotexString\r\n case 0x16: // IA5String\r\n // case 0x19: // GraphicString\r\n case 0x1A: // VisibleString\r\n // case 0x1B: // GeneralString\r\n // case 0x1C: // UniversalString\r\n return stringCut(this.stream.parseStringISO(content, content + len), maxLength);\r\n case 0x1E: // BMPString\r\n return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);\r\n case 0x17: // UTCTime\r\n case 0x18: // GeneralizedTime\r\n return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17));\r\n }\r\n return null;\r\n };\r\n ASN1.prototype.toString = function () {\r\n return this.typeName() + \"@\" + this.stream.pos + \"[header:\" + this.header + \",length:\" + this.length + \",sub:\" + ((this.sub === null) ? \"null\" : this.sub.length) + \"]\";\r\n };\r\n ASN1.prototype.toPrettyString = function (indent) {\r\n if (indent === undefined) {\r\n indent = \"\";\r\n }\r\n var s = indent + this.typeName() + \" @\" + this.stream.pos;\r\n if (this.length >= 0) {\r\n s += \"+\";\r\n }\r\n s += this.length;\r\n if (this.tag.tagConstructed) {\r\n s += \" (constructed)\";\r\n }\r\n else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) {\r\n s += \" (encapsulates)\";\r\n }\r\n s += \"\\n\";\r\n if (this.sub !== null) {\r\n indent += \" \";\r\n for (var i = 0, max = this.sub.length; i < max; ++i) {\r\n s += this.sub[i].toPrettyString(indent);\r\n }\r\n }\r\n return s;\r\n };\r\n ASN1.prototype.posStart = function () {\r\n return this.stream.pos;\r\n };\r\n ASN1.prototype.posContent = function () {\r\n return this.stream.pos + this.header;\r\n };\r\n ASN1.prototype.posEnd = function () {\r\n return this.stream.pos + this.header + Math.abs(this.length);\r\n };\r\n ASN1.prototype.toHexString = function () {\r\n return this.stream.hexDump(this.posStart(), this.posEnd(), true);\r\n };\r\n ASN1.decodeLength = function (stream) {\r\n var buf = stream.get();\r\n var len = buf & 0x7F;\r\n if (len == buf) {\r\n return len;\r\n }\r\n // no reason to use Int10, as it would be a huge buffer anyways\r\n if (len > 6) {\r\n throw new Error(\"Length over 48 bits not supported at position \" + (stream.pos - 1));\r\n }\r\n if (len === 0) {\r\n return null;\r\n } // undefined\r\n buf = 0;\r\n for (var i = 0; i < len; ++i) {\r\n buf = (buf * 256) + stream.get();\r\n }\r\n return buf;\r\n };\r\n /**\r\n * Retrieve the hexadecimal value (as a string) of the current ASN.1 element\r\n * @returns {string}\r\n * @public\r\n */\r\n ASN1.prototype.getHexStringValue = function () {\r\n var hexString = this.toHexString();\r\n var offset = this.header * 2;\r\n var length = this.length * 2;\r\n return hexString.substr(offset, length);\r\n };\r\n ASN1.decode = function (str) {\r\n var stream;\r\n if (!(str instanceof Stream)) {\r\n stream = new Stream(str, 0);\r\n }\r\n else {\r\n stream = str;\r\n }\r\n var streamStart = new Stream(stream);\r\n var tag = new ASN1Tag(stream);\r\n var len = ASN1.decodeLength(stream);\r\n var start = stream.pos;\r\n var header = start - streamStart.pos;\r\n var sub = null;\r\n var getSub = function () {\r\n var ret = [];\r\n if (len !== null) {\r\n // definite length\r\n var end = start + len;\r\n while (stream.pos < end) {\r\n ret[ret.length] = ASN1.decode(stream);\r\n }\r\n if (stream.pos != end) {\r\n throw new Error(\"Content size is not correct for container starting at offset \" + start);\r\n }\r\n }\r\n else {\r\n // undefined length\r\n try {\r\n for (;;) {\r\n var s = ASN1.decode(stream);\r\n if (s.tag.isEOC()) {\r\n break;\r\n }\r\n ret[ret.length] = s;\r\n }\r\n len = start - stream.pos; // undefined lengths are represented as negative values\r\n }\r\n catch (e) {\r\n throw new Error(\"Exception while decoding undefined length content: \" + e);\r\n }\r\n }\r\n return ret;\r\n };\r\n if (tag.tagConstructed) {\r\n // must have valid content\r\n sub = getSub();\r\n }\r\n else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) {\r\n // sometimes BitString and OctetString are used to encapsulate ASN.1\r\n try {\r\n if (tag.tagNumber == 0x03) {\r\n if (stream.get() != 0) {\r\n throw new Error(\"BIT STRINGs with unused bits cannot encapsulate.\");\r\n }\r\n }\r\n sub = getSub();\r\n for (var i = 0; i < sub.length; ++i) {\r\n if (sub[i].tag.isEOC()) {\r\n throw new Error(\"EOC is not supposed to be actual content.\");\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // but silently ignore when they don't\r\n sub = null;\r\n }\r\n }\r\n if (sub === null) {\r\n if (len === null) {\r\n throw new Error(\"We can't skip over an invalid tag with undefined length at offset \" + start);\r\n }\r\n stream.pos = start + Math.abs(len);\r\n }\r\n return new ASN1(streamStart, header, len, tag, sub);\r\n };\r\n return ASN1;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'ASN1', { enumerable: true, configurable: true, get: function() { return ASN1; } });\r\nvar ASN1Tag = /** @class */ (function () {\r\n function ASN1Tag(stream) {\r\n var buf = stream.get();\r\n this.tagClass = buf >> 6;\r\n this.tagConstructed = ((buf & 0x20) !== 0);\r\n this.tagNumber = buf & 0x1F;\r\n if (this.tagNumber == 0x1F) { // long tag\r\n var n = new Int10();\r\n do {\r\n buf = stream.get();\r\n n.mulAdd(128, buf & 0x7F);\r\n } while (buf & 0x80);\r\n this.tagNumber = n.simplify();\r\n }\r\n }\r\n ASN1Tag.prototype.isUniversal = function () {\r\n return this.tagClass === 0x00;\r\n };\r\n ASN1Tag.prototype.isEOC = function () {\r\n return this.tagClass === 0x00 && this.tagNumber === 0x00;\r\n };\r\n return ASN1Tag;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'ASN1Tag', { enumerable: true, configurable: true, get: function() { return ASN1Tag; } });\r\n","// Big integer base-10 printing library\r\n// Copyright (c) 2014 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\nvar max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256\r\nvar Int10 = /** @class */ (function () {\r\n function Int10(value) {\r\n this.buf = [+value || 0];\r\n }\r\n Int10.prototype.mulAdd = function (m, c) {\r\n // assert(m <= 256)\r\n var b = this.buf;\r\n var l = b.length;\r\n var i;\r\n var t;\r\n for (i = 0; i < l; ++i) {\r\n t = b[i] * m + c;\r\n if (t < max) {\r\n c = 0;\r\n }\r\n else {\r\n c = 0 | (t / max);\r\n t -= c * max;\r\n }\r\n b[i] = t;\r\n }\r\n if (c > 0) {\r\n b[i] = c;\r\n }\r\n };\r\n Int10.prototype.sub = function (c) {\r\n // assert(m <= 256)\r\n var b = this.buf;\r\n var l = b.length;\r\n var i;\r\n var t;\r\n for (i = 0; i < l; ++i) {\r\n t = b[i] - c;\r\n if (t < 0) {\r\n t += max;\r\n c = 1;\r\n }\r\n else {\r\n c = 0;\r\n }\r\n b[i] = t;\r\n }\r\n while (b[b.length - 1] === 0) {\r\n b.pop();\r\n }\r\n };\r\n Int10.prototype.toString = function (base) {\r\n if ((base || 10) != 10) {\r\n throw new Error(\"only base 10 is supported\");\r\n }\r\n var b = this.buf;\r\n var s = b[b.length - 1].toString();\r\n for (var i = b.length - 2; i >= 0; --i) {\r\n s += (max + b[i]).toString().substring(1);\r\n }\r\n return s;\r\n };\r\n Int10.prototype.valueOf = function () {\r\n var b = this.buf;\r\n var v = 0;\r\n for (var i = b.length - 1; i >= 0; --i) {\r\n v = v * max + b[i];\r\n }\r\n return v;\r\n };\r\n Int10.prototype.simplify = function () {\r\n var b = this.buf;\r\n return (b.length == 1) ? b[0] : this;\r\n };\r\n return Int10;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Int10', { enumerable: true, configurable: true, get: function() { return Int10; } });\r\n","// Depends on jsbn.js and rng.js\r\n// Version 1.1: support utf-8 encoding in pkcs1pad2\r\n// convert a (hex) string to a bignum object\r\nvar __TEMP__ = require('./jsbn');var BigInteger = __TEMP__['BigInteger'];var nbi = __TEMP__['nbi'];var parseBigInt = __TEMP__['parseBigInt'];\r\nvar __TEMP__ = require('./rng');var SecureRandom = __TEMP__['SecureRandom'];\r\n// function linebrk(s,n) {\r\n// var ret = \"\";\r\n// var i = 0;\r\n// while(i + n < s.length) {\r\n// ret += s.substring(i,i+n) + \"\\n\";\r\n// i += n;\r\n// }\r\n// return ret + s.substring(i,s.length);\r\n// }\r\n// function byte2Hex(b) {\r\n// if(b < 0x10)\r\n// return \"0\" + b.toString(16);\r\n// else\r\n// return b.toString(16);\r\n// }\r\nfunction pkcs1pad1(s, n) {\r\n if (n < s.length + 22) {\r\n console.error(\"Message too long for RSA\");\r\n return null;\r\n }\r\n var len = n - s.length - 6;\r\n var filler = \"\";\r\n for (var f = 0; f < len; f += 2) {\r\n filler += \"ff\";\r\n }\r\n var m = \"0001\" + filler + \"00\" + s;\r\n return parseBigInt(m, 16);\r\n}\r\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\r\nfunction pkcs1pad2(s, n) {\r\n if (n < s.length + 11) { // TODO: fix for utf-8\r\n console.error(\"Message too long for RSA\");\r\n return null;\r\n }\r\n var ba = [];\r\n var i = s.length - 1;\r\n while (i >= 0 && n > 0) {\r\n var c = s.charCodeAt(i--);\r\n if (c < 128) { // encode using utf-8\r\n ba[--n] = c;\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n ba[--n] = (c & 63) | 128;\r\n ba[--n] = (c >> 6) | 192;\r\n }\r\n else {\r\n ba[--n] = (c & 63) | 128;\r\n ba[--n] = ((c >> 6) & 63) | 128;\r\n ba[--n] = (c >> 12) | 224;\r\n }\r\n }\r\n ba[--n] = 0;\r\n var rng = new SecureRandom();\r\n var x = [];\r\n while (n > 2) { // random non-zero pad\r\n x[0] = 0;\r\n while (x[0] == 0) {\r\n rng.nextBytes(x);\r\n }\r\n ba[--n] = x[0];\r\n }\r\n ba[--n] = 2;\r\n ba[--n] = 0;\r\n return new BigInteger(ba);\r\n}\r\n// \"empty\" RSA key constructor\r\nvar RSAKey = /** @class */ (function () {\r\n function RSAKey() {\r\n this.n = null;\r\n this.e = 0;\r\n this.d = null;\r\n this.p = null;\r\n this.q = null;\r\n this.dmp1 = null;\r\n this.dmq1 = null;\r\n this.coeff = null;\r\n }\r\n //#region PROTECTED\r\n // protected\r\n // RSAKey.prototype.doPublic = RSADoPublic;\r\n // Perform raw public operation on \"x\": return x^e (mod n)\r\n RSAKey.prototype.doPublic = function (x) {\r\n return x.modPowInt(this.e, this.n);\r\n };\r\n // RSAKey.prototype.doPrivate = RSADoPrivate;\r\n // Perform raw private operation on \"x\": return x^d (mod n)\r\n RSAKey.prototype.doPrivate = function (x) {\r\n if (this.p == null || this.q == null) {\r\n return x.modPow(this.d, this.n);\r\n }\r\n // TODO: re-calculate any missing CRT params\r\n var xp = x.mod(this.p).modPow(this.dmp1, this.p);\r\n var xq = x.mod(this.q).modPow(this.dmq1, this.q);\r\n while (xp.compareTo(xq) < 0) {\r\n xp = xp.add(this.p);\r\n }\r\n return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);\r\n };\r\n //#endregion PROTECTED\r\n //#region PUBLIC\r\n // RSAKey.prototype.setPublic = RSASetPublic;\r\n // Set the public key fields N and e from hex strings\r\n RSAKey.prototype.setPublic = function (N, E) {\r\n if (N != null && E != null && N.length > 0 && E.length > 0) {\r\n this.n = parseBigInt(N, 16);\r\n this.e = parseInt(E, 16);\r\n }\r\n else {\r\n console.error(\"Invalid RSA public key\");\r\n }\r\n };\r\n // RSAKey.prototype.encrypt = RSAEncrypt;\r\n // Return the PKCS#1 RSA encryption of \"text\" as an even-length hex string\r\n RSAKey.prototype.encrypt = function (text) {\r\n var maxLength = (this.n.bitLength() + 7) >> 3;\r\n var m = pkcs1pad2(text, maxLength);\r\n if (m == null) {\r\n return null;\r\n }\r\n var c = this.doPublic(m);\r\n if (c == null) {\r\n return null;\r\n }\r\n var h = c.toString(16);\r\n var length = h.length;\r\n // fix zero before result\r\n for (var i = 0; i < maxLength * 2 - length; i++) {\r\n h = \"0\" + h;\r\n }\r\n return h;\r\n };\r\n // RSAKey.prototype.setPrivate = RSASetPrivate;\r\n // Set the private key fields N, e, and d from hex strings\r\n RSAKey.prototype.setPrivate = function (N, E, D) {\r\n if (N != null && E != null && N.length > 0 && E.length > 0) {\r\n this.n = parseBigInt(N, 16);\r\n this.e = parseInt(E, 16);\r\n this.d = parseBigInt(D, 16);\r\n }\r\n else {\r\n console.error(\"Invalid RSA private key\");\r\n }\r\n };\r\n // RSAKey.prototype.setPrivateEx = RSASetPrivateEx;\r\n // Set the private key fields N, e, d and CRT params from hex strings\r\n RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) {\r\n if (N != null && E != null && N.length > 0 && E.length > 0) {\r\n this.n = parseBigInt(N, 16);\r\n this.e = parseInt(E, 16);\r\n this.d = parseBigInt(D, 16);\r\n this.p = parseBigInt(P, 16);\r\n this.q = parseBigInt(Q, 16);\r\n this.dmp1 = parseBigInt(DP, 16);\r\n this.dmq1 = parseBigInt(DQ, 16);\r\n this.coeff = parseBigInt(C, 16);\r\n }\r\n else {\r\n console.error(\"Invalid RSA private key\");\r\n }\r\n };\r\n // RSAKey.prototype.generate = RSAGenerate;\r\n // Generate a new random private key B bits long, using public expt E\r\n RSAKey.prototype.generate = function (B, E) {\r\n var rng = new SecureRandom();\r\n var qs = B >> 1;\r\n this.e = parseInt(E, 16);\r\n var ee = new BigInteger(E, 16);\r\n for (;;) {\r\n for (;;) {\r\n this.p = new BigInteger(B - qs, 1, rng);\r\n if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) {\r\n break;\r\n }\r\n }\r\n for (;;) {\r\n this.q = new BigInteger(qs, 1, rng);\r\n if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) {\r\n break;\r\n }\r\n }\r\n if (this.p.compareTo(this.q) <= 0) {\r\n var t = this.p;\r\n this.p = this.q;\r\n this.q = t;\r\n }\r\n var p1 = this.p.subtract(BigInteger.ONE);\r\n var q1 = this.q.subtract(BigInteger.ONE);\r\n var phi = p1.multiply(q1);\r\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\r\n this.n = this.p.multiply(this.q);\r\n this.d = ee.modInverse(phi);\r\n this.dmp1 = this.d.mod(p1);\r\n this.dmq1 = this.d.mod(q1);\r\n this.coeff = this.q.modInverse(this.p);\r\n break;\r\n }\r\n }\r\n };\r\n // RSAKey.prototype.decrypt = RSADecrypt;\r\n // Return the PKCS#1 RSA decryption of \"ctext\".\r\n // \"ctext\" is an even-length hex string and the output is a plain string.\r\n RSAKey.prototype.decrypt = function (ctext) {\r\n var c = parseBigInt(ctext, 16);\r\n var m = this.doPrivate(c);\r\n if (m == null) {\r\n return null;\r\n }\r\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\r\n };\r\n // Generate a new random private key B bits long, using public expt E\r\n RSAKey.prototype.generateAsync = function (B, E, callback) {\r\n var rng = new SecureRandom();\r\n var qs = B >> 1;\r\n this.e = parseInt(E, 16);\r\n var ee = new BigInteger(E, 16);\r\n var rsa = this;\r\n // These functions have non-descript names because they were originally for(;;) loops.\r\n // I don't know about cryptography to give them better names than loop1-4.\r\n var loop1 = function () {\r\n var loop4 = function () {\r\n if (rsa.p.compareTo(rsa.q) <= 0) {\r\n var t = rsa.p;\r\n rsa.p = rsa.q;\r\n rsa.q = t;\r\n }\r\n var p1 = rsa.p.subtract(BigInteger.ONE);\r\n var q1 = rsa.q.subtract(BigInteger.ONE);\r\n var phi = p1.multiply(q1);\r\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\r\n rsa.n = rsa.p.multiply(rsa.q);\r\n rsa.d = ee.modInverse(phi);\r\n rsa.dmp1 = rsa.d.mod(p1);\r\n rsa.dmq1 = rsa.d.mod(q1);\r\n rsa.coeff = rsa.q.modInverse(rsa.p);\r\n setTimeout(function () { callback(); }, 0); // escape\r\n }\r\n else {\r\n setTimeout(loop1, 0);\r\n }\r\n };\r\n var loop3 = function () {\r\n rsa.q = nbi();\r\n rsa.q.fromNumberAsync(qs, 1, rng, function () {\r\n rsa.q.subtract(BigInteger.ONE).gcda(ee, function (r) {\r\n if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) {\r\n setTimeout(loop4, 0);\r\n }\r\n else {\r\n setTimeout(loop3, 0);\r\n }\r\n });\r\n });\r\n };\r\n var loop2 = function () {\r\n rsa.p = nbi();\r\n rsa.p.fromNumberAsync(B - qs, 1, rng, function () {\r\n rsa.p.subtract(BigInteger.ONE).gcda(ee, function (r) {\r\n if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) {\r\n setTimeout(loop3, 0);\r\n }\r\n else {\r\n setTimeout(loop2, 0);\r\n }\r\n });\r\n });\r\n };\r\n setTimeout(loop2, 0);\r\n };\r\n setTimeout(loop1, 0);\r\n };\r\n RSAKey.prototype.sign = function (text, digestMethod, digestName) {\r\n var header = getDigestHeader(digestName);\r\n var digest = header + digestMethod(text).toString();\r\n var m = pkcs1pad1(digest, this.n.bitLength() / 4);\r\n if (m == null) {\r\n return null;\r\n }\r\n var c = this.doPrivate(m);\r\n if (c == null) {\r\n return null;\r\n }\r\n var h = c.toString(16);\r\n if ((h.length & 1) == 0) {\r\n return h;\r\n }\r\n else {\r\n return \"0\" + h;\r\n }\r\n };\r\n RSAKey.prototype.verify = function (text, signature, digestMethod) {\r\n var c = parseBigInt(signature, 16);\r\n var m = this.doPublic(c);\r\n if (m == null) {\r\n return null;\r\n }\r\n var unpadded = m.toString(16).replace(/^1f+00/, \"\");\r\n var digest = removeDigestHeader(unpadded);\r\n return digest == digestMethod(text).toString();\r\n };\r\n RSAKey.prototype.encryptLong = function (text) {\r\n var _this = this;\r\n var res = '';\r\n var maxLen = ((this.n.bitLength() + 7) >> 3) - 11;\r\n var textArr = this.setSplitChn(text, maxLen);\r\n textArr.forEach(function (v) {\r\n res += _this.encrypt(v);\r\n });\r\n return res;\r\n };\r\n RSAKey.prototype.decryptLong = function (ctext) {\r\n var res = '';\r\n var maxLen = (this.n.bitLength() + 7) >> 3;\r\n var splitMaxLen = maxLen * 2;\r\n if (ctext.length > splitMaxLen) {\r\n var ctextArr = ctext.match(new RegExp('.{1,' + splitMaxLen + '}', 'g')) || [];\r\n var mArr = [];\r\n for (var i = 0; i < ctextArr.length; i++) {\r\n var c = parseBigInt(ctextArr[i], 16);\r\n var m = this.doPrivate(c);\r\n if (m == null) {\r\n return null;\r\n }\r\n mArr.push(m);\r\n }\r\n res = pkcs1unpad2Long(mArr, maxLen);\r\n }\r\n else {\r\n res = this.decrypt(ctext);\r\n }\r\n return res;\r\n };\r\n RSAKey.prototype.setSplitChn = function (str, maxLen, res) {\r\n if (res === void 0) { res = []; }\r\n var arr = str.split('');\r\n var len = 0;\r\n for (var i = 0; i < arr.length; i++) {\r\n var charCode = arr[i].charCodeAt(0);\r\n if (charCode <= 0x007f) {\r\n len += 1;\r\n }\r\n else if (charCode <= 0x07ff) {\r\n len += 2;\r\n }\r\n else if (charCode <= 0xffff) {\r\n len += 3;\r\n }\r\n else {\r\n len += 4;\r\n }\r\n if (len > maxLen) {\r\n var currentStr = str.substring(0, i);\r\n res.push(currentStr);\r\n return this.setSplitChn(str.substring(i), maxLen, res);\r\n }\r\n }\r\n res.push(str);\r\n return res;\r\n };\r\n return RSAKey;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'RSAKey', { enumerable: true, configurable: true, get: function() { return RSAKey; } });\r\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\r\nfunction pkcs1unpad2(d, n) {\r\n var b = d.toByteArray();\r\n var i = 0;\r\n while (i < b.length && b[i] == 0) {\r\n ++i;\r\n }\r\n if (b.length - i != n - 1 || b[i] != 2) {\r\n return null;\r\n }\r\n ++i;\r\n while (b[i] != 0) {\r\n if (++i >= b.length) {\r\n return null;\r\n }\r\n }\r\n var ret = \"\";\r\n while (++i < b.length) {\r\n var c = b[i] & 255;\r\n if (c < 128) { // utf-8 decode\r\n ret += String.fromCharCode(c);\r\n }\r\n else if ((c > 191) && (c < 224)) {\r\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\r\n ++i;\r\n }\r\n else {\r\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\r\n i += 2;\r\n }\r\n }\r\n return ret;\r\n}\r\nfunction pkcs1unpad2Long(dArr, n) {\r\n var bArr = [];\r\n for (var j = 0; j < dArr.length; j++) {\r\n var d = dArr[j];\r\n var b_1 = d.toByteArray();\r\n var i_1 = 0;\r\n while (i_1 < b_1.length && b_1[i_1] == 0) {\r\n ++i_1;\r\n }\r\n if (b_1.length - i_1 != n - 1 || b_1[i_1] != 2) {\r\n return null;\r\n }\r\n ++i_1;\r\n while (b_1[i_1] != 0) {\r\n if (++i_1 >= b_1.length) {\r\n return null;\r\n }\r\n }\r\n bArr = bArr.concat(b_1.slice(i_1 + 1));\r\n }\r\n var b = bArr;\r\n var i = -1;\r\n var ret = \"\";\r\n while (++i < b.length) {\r\n var c = b[i] & 255;\r\n if (c < 128) { // utf-8 decode\r\n ret += String.fromCharCode(c);\r\n }\r\n else if ((c > 191) && (c < 224)) {\r\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\r\n ++i;\r\n }\r\n else {\r\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\r\n i += 2;\r\n }\r\n }\r\n return ret;\r\n}\r\n// https://tools.ietf.org/html/rfc3447#page-43\r\nvar DIGEST_HEADERS = {\r\n md2: \"3020300c06082a864886f70d020205000410\",\r\n md5: \"3020300c06082a864886f70d020505000410\",\r\n sha1: \"3021300906052b0e03021a05000414\",\r\n sha224: \"302d300d06096086480165030402040500041c\",\r\n sha256: \"3031300d060960864801650304020105000420\",\r\n sha384: \"3041300d060960864801650304020205000430\",\r\n sha512: \"3051300d060960864801650304020305000440\",\r\n ripemd160: \"3021300906052b2403020105000414\"\r\n};\r\nfunction getDigestHeader(name) {\r\n return DIGEST_HEADERS[name] || \"\";\r\n}\r\nfunction removeDigestHeader(str) {\r\n for (var name_1 in DIGEST_HEADERS) {\r\n if (DIGEST_HEADERS.hasOwnProperty(name_1)) {\r\n var header = DIGEST_HEADERS[name_1];\r\n var len = header.length;\r\n if (str.substr(0, len) == header) {\r\n return str.substr(len);\r\n }\r\n }\r\n }\r\n return str;\r\n}\r\n// Return the PKCS#1 RSA encryption of \"text\" as a Base64-encoded string\r\n// function RSAEncryptB64(text) {\r\n// var h = this.encrypt(text);\r\n// if(h) return hex2b64(h); else return null;\r\n// }\r\n// public\r\n// RSAKey.prototype.encrypt_b64 = RSAEncryptB64;\r\n","// Copyright (c) 2005 Tom Wu\r\n// All Rights Reserved.\r\n// See \"LICENSE\" for details.\r\n// Basic JavaScript BN library - subset useful for RSA encryption.\r\nvar __TEMP__ = require('./util');var cbit = __TEMP__['cbit'];var int2char = __TEMP__['int2char'];var lbit = __TEMP__['lbit'];var op_and = __TEMP__['op_and'];var op_andnot = __TEMP__['op_andnot'];var op_or = __TEMP__['op_or'];var op_xor = __TEMP__['op_xor'];\r\n// Bits per digit\r\nvar dbits;\r\n// JavaScript engine analysis\r\nvar canary = 0xdeadbeefcafe;\r\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\r\n//#region\r\nvar lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];\r\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\r\n//#endregion\r\n// (public) Constructor\r\nvar BigInteger = /** @class */ (function () {\r\n function BigInteger(a, b, c) {\r\n if (a != null) {\r\n if (\"number\" == typeof a) {\r\n this.fromNumber(a, b, c);\r\n }\r\n else if (b == null && \"string\" != typeof a) {\r\n this.fromString(a, 256);\r\n }\r\n else {\r\n this.fromString(a, b);\r\n }\r\n }\r\n }\r\n //#region PUBLIC\r\n // BigInteger.prototype.toString = bnToString;\r\n // (public) return string representation in given radix\r\n BigInteger.prototype.toString = function (b) {\r\n if (this.s < 0) {\r\n return \"-\" + this.negate().toString(b);\r\n }\r\n var k;\r\n if (b == 16) {\r\n k = 4;\r\n }\r\n else if (b == 8) {\r\n k = 3;\r\n }\r\n else if (b == 2) {\r\n k = 1;\r\n }\r\n else if (b == 32) {\r\n k = 5;\r\n }\r\n else if (b == 4) {\r\n k = 2;\r\n }\r\n else {\r\n return this.toRadix(b);\r\n }\r\n var km = (1 << k) - 1;\r\n var d;\r\n var m = false;\r\n var r = \"\";\r\n var i = this.t;\r\n var p = this.DB - (i * this.DB) % k;\r\n if (i-- > 0) {\r\n if (p < this.DB && (d = this[i] >> p) > 0) {\r\n m = true;\r\n r = int2char(d);\r\n }\r\n while (i >= 0) {\r\n if (p < k) {\r\n d = (this[i] & ((1 << p) - 1)) << (k - p);\r\n d |= this[--i] >> (p += this.DB - k);\r\n }\r\n else {\r\n d = (this[i] >> (p -= k)) & km;\r\n if (p <= 0) {\r\n p += this.DB;\r\n --i;\r\n }\r\n }\r\n if (d > 0) {\r\n m = true;\r\n }\r\n if (m) {\r\n r += int2char(d);\r\n }\r\n }\r\n }\r\n return m ? r : \"0\";\r\n };\r\n // BigInteger.prototype.negate = bnNegate;\r\n // (public) -this\r\n BigInteger.prototype.negate = function () {\r\n var r = nbi();\r\n BigInteger.ZERO.subTo(this, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.abs = bnAbs;\r\n // (public) |this|\r\n BigInteger.prototype.abs = function () {\r\n return (this.s < 0) ? this.negate() : this;\r\n };\r\n // BigInteger.prototype.compareTo = bnCompareTo;\r\n // (public) return + if this > a, - if this < a, 0 if equal\r\n BigInteger.prototype.compareTo = function (a) {\r\n var r = this.s - a.s;\r\n if (r != 0) {\r\n return r;\r\n }\r\n var i = this.t;\r\n r = i - a.t;\r\n if (r != 0) {\r\n return (this.s < 0) ? -r : r;\r\n }\r\n while (--i >= 0) {\r\n if ((r = this[i] - a[i]) != 0) {\r\n return r;\r\n }\r\n }\r\n return 0;\r\n };\r\n // BigInteger.prototype.bitLength = bnBitLength;\r\n // (public) return the number of bits in \"this\"\r\n BigInteger.prototype.bitLength = function () {\r\n if (this.t <= 0) {\r\n return 0;\r\n }\r\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\r\n };\r\n // BigInteger.prototype.mod = bnMod;\r\n // (public) this mod a\r\n BigInteger.prototype.mod = function (a) {\r\n var r = nbi();\r\n this.abs().divRemTo(a, null, r);\r\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\r\n a.subTo(r, r);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.modPowInt = bnModPowInt;\r\n // (public) this^e % m, 0 <= e < 2^32\r\n BigInteger.prototype.modPowInt = function (e, m) {\r\n var z;\r\n if (e < 256 || m.isEven()) {\r\n z = new Classic(m);\r\n }\r\n else {\r\n z = new Montgomery(m);\r\n }\r\n return this.exp(e, z);\r\n };\r\n // BigInteger.prototype.clone = bnClone;\r\n // (public)\r\n BigInteger.prototype.clone = function () {\r\n var r = nbi();\r\n this.copyTo(r);\r\n return r;\r\n };\r\n // BigInteger.prototype.intValue = bnIntValue;\r\n // (public) return value as integer\r\n BigInteger.prototype.intValue = function () {\r\n if (this.s < 0) {\r\n if (this.t == 1) {\r\n return this[0] - this.DV;\r\n }\r\n else if (this.t == 0) {\r\n return -1;\r\n }\r\n }\r\n else if (this.t == 1) {\r\n return this[0];\r\n }\r\n else if (this.t == 0) {\r\n return 0;\r\n }\r\n // assumes 16 < DB < 32\r\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\r\n };\r\n // BigInteger.prototype.byteValue = bnByteValue;\r\n // (public) return value as byte\r\n BigInteger.prototype.byteValue = function () {\r\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24;\r\n };\r\n // BigInteger.prototype.shortValue = bnShortValue;\r\n // (public) return value as short (assumes DB>=16)\r\n BigInteger.prototype.shortValue = function () {\r\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16;\r\n };\r\n // BigInteger.prototype.signum = bnSigNum;\r\n // (public) 0 if this == 0, 1 if this > 0\r\n BigInteger.prototype.signum = function () {\r\n if (this.s < 0) {\r\n return -1;\r\n }\r\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) {\r\n return 0;\r\n }\r\n else {\r\n return 1;\r\n }\r\n };\r\n // BigInteger.prototype.toByteArray = bnToByteArray;\r\n // (public) convert to bigendian byte array\r\n BigInteger.prototype.toByteArray = function () {\r\n var i = this.t;\r\n var r = [];\r\n r[0] = this.s;\r\n var p = this.DB - (i * this.DB) % 8;\r\n var d;\r\n var k = 0;\r\n if (i-- > 0) {\r\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) {\r\n r[k++] = d | (this.s << (this.DB - p));\r\n }\r\n while (i >= 0) {\r\n if (p < 8) {\r\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\r\n d |= this[--i] >> (p += this.DB - 8);\r\n }\r\n else {\r\n d = (this[i] >> (p -= 8)) & 0xff;\r\n if (p <= 0) {\r\n p += this.DB;\r\n --i;\r\n }\r\n }\r\n if ((d & 0x80) != 0) {\r\n d |= -256;\r\n }\r\n if (k == 0 && (this.s & 0x80) != (d & 0x80)) {\r\n ++k;\r\n }\r\n if (k > 0 || d != this.s) {\r\n r[k++] = d;\r\n }\r\n }\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.equals = bnEquals;\r\n BigInteger.prototype.equals = function (a) {\r\n return (this.compareTo(a) == 0);\r\n };\r\n // BigInteger.prototype.min = bnMin;\r\n BigInteger.prototype.min = function (a) {\r\n return (this.compareTo(a) < 0) ? this : a;\r\n };\r\n // BigInteger.prototype.max = bnMax;\r\n BigInteger.prototype.max = function (a) {\r\n return (this.compareTo(a) > 0) ? this : a;\r\n };\r\n // BigInteger.prototype.and = bnAnd;\r\n BigInteger.prototype.and = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_and, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.or = bnOr;\r\n BigInteger.prototype.or = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_or, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.xor = bnXor;\r\n BigInteger.prototype.xor = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_xor, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.andNot = bnAndNot;\r\n BigInteger.prototype.andNot = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_andnot, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.not = bnNot;\r\n // (public) ~this\r\n BigInteger.prototype.not = function () {\r\n var r = nbi();\r\n for (var i = 0; i < this.t; ++i) {\r\n r[i] = this.DM & ~this[i];\r\n }\r\n r.t = this.t;\r\n r.s = ~this.s;\r\n return r;\r\n };\r\n // BigInteger.prototype.shiftLeft = bnShiftLeft;\r\n // (public) this << n\r\n BigInteger.prototype.shiftLeft = function (n) {\r\n var r = nbi();\r\n if (n < 0) {\r\n this.rShiftTo(-n, r);\r\n }\r\n else {\r\n this.lShiftTo(n, r);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.shiftRight = bnShiftRight;\r\n // (public) this >> n\r\n BigInteger.prototype.shiftRight = function (n) {\r\n var r = nbi();\r\n if (n < 0) {\r\n this.lShiftTo(-n, r);\r\n }\r\n else {\r\n this.rShiftTo(n, r);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\r\n // (public) returns index of lowest 1-bit (or -1 if none)\r\n BigInteger.prototype.getLowestSetBit = function () {\r\n for (var i = 0; i < this.t; ++i) {\r\n if (this[i] != 0) {\r\n return i * this.DB + lbit(this[i]);\r\n }\r\n }\r\n if (this.s < 0) {\r\n return this.t * this.DB;\r\n }\r\n return -1;\r\n };\r\n // BigInteger.prototype.bitCount = bnBitCount;\r\n // (public) return number of set bits\r\n BigInteger.prototype.bitCount = function () {\r\n var r = 0;\r\n var x = this.s & this.DM;\r\n for (var i = 0; i < this.t; ++i) {\r\n r += cbit(this[i] ^ x);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.testBit = bnTestBit;\r\n // (public) true iff nth bit is set\r\n BigInteger.prototype.testBit = function (n) {\r\n var j = Math.floor(n / this.DB);\r\n if (j >= this.t) {\r\n return (this.s != 0);\r\n }\r\n return ((this[j] & (1 << (n % this.DB))) != 0);\r\n };\r\n // BigInteger.prototype.setBit = bnSetBit;\r\n // (public) this | (1< 1) {\r\n var g2 = nbi();\r\n z.sqrTo(g[1], g2);\r\n while (n <= km) {\r\n g[n] = nbi();\r\n z.mulTo(g2, g[n - 2], g[n]);\r\n n += 2;\r\n }\r\n }\r\n var j = e.t - 1;\r\n var w;\r\n var is1 = true;\r\n var r2 = nbi();\r\n var t;\r\n i = nbits(e[j]) - 1;\r\n while (j >= 0) {\r\n if (i >= k1) {\r\n w = (e[j] >> (i - k1)) & km;\r\n }\r\n else {\r\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\r\n if (j > 0) {\r\n w |= e[j - 1] >> (this.DB + i - k1);\r\n }\r\n }\r\n n = k;\r\n while ((w & 1) == 0) {\r\n w >>= 1;\r\n --n;\r\n }\r\n if ((i -= n) < 0) {\r\n i += this.DB;\r\n --j;\r\n }\r\n if (is1) { // ret == 1, don't bother squaring or multiplying it\r\n g[w].copyTo(r);\r\n is1 = false;\r\n }\r\n else {\r\n while (n > 1) {\r\n z.sqrTo(r, r2);\r\n z.sqrTo(r2, r);\r\n n -= 2;\r\n }\r\n if (n > 0) {\r\n z.sqrTo(r, r2);\r\n }\r\n else {\r\n t = r;\r\n r = r2;\r\n r2 = t;\r\n }\r\n z.mulTo(r2, g[w], r);\r\n }\r\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\r\n z.sqrTo(r, r2);\r\n t = r;\r\n r = r2;\r\n r2 = t;\r\n if (--i < 0) {\r\n i = this.DB - 1;\r\n --j;\r\n }\r\n }\r\n }\r\n return z.revert(r);\r\n };\r\n // BigInteger.prototype.modInverse = bnModInverse;\r\n // (public) 1/this % m (HAC 14.61)\r\n BigInteger.prototype.modInverse = function (m) {\r\n var ac = m.isEven();\r\n if ((this.isEven() && ac) || m.signum() == 0) {\r\n return BigInteger.ZERO;\r\n }\r\n var u = m.clone();\r\n var v = this.clone();\r\n var a = nbv(1);\r\n var b = nbv(0);\r\n var c = nbv(0);\r\n var d = nbv(1);\r\n while (u.signum() != 0) {\r\n while (u.isEven()) {\r\n u.rShiftTo(1, u);\r\n if (ac) {\r\n if (!a.isEven() || !b.isEven()) {\r\n a.addTo(this, a);\r\n b.subTo(m, b);\r\n }\r\n a.rShiftTo(1, a);\r\n }\r\n else if (!b.isEven()) {\r\n b.subTo(m, b);\r\n }\r\n b.rShiftTo(1, b);\r\n }\r\n while (v.isEven()) {\r\n v.rShiftTo(1, v);\r\n if (ac) {\r\n if (!c.isEven() || !d.isEven()) {\r\n c.addTo(this, c);\r\n d.subTo(m, d);\r\n }\r\n c.rShiftTo(1, c);\r\n }\r\n else if (!d.isEven()) {\r\n d.subTo(m, d);\r\n }\r\n d.rShiftTo(1, d);\r\n }\r\n if (u.compareTo(v) >= 0) {\r\n u.subTo(v, u);\r\n if (ac) {\r\n a.subTo(c, a);\r\n }\r\n b.subTo(d, b);\r\n }\r\n else {\r\n v.subTo(u, v);\r\n if (ac) {\r\n c.subTo(a, c);\r\n }\r\n d.subTo(b, d);\r\n }\r\n }\r\n if (v.compareTo(BigInteger.ONE) != 0) {\r\n return BigInteger.ZERO;\r\n }\r\n if (d.compareTo(m) >= 0) {\r\n return d.subtract(m);\r\n }\r\n if (d.signum() < 0) {\r\n d.addTo(m, d);\r\n }\r\n else {\r\n return d;\r\n }\r\n if (d.signum() < 0) {\r\n return d.add(m);\r\n }\r\n else {\r\n return d;\r\n }\r\n };\r\n // BigInteger.prototype.pow = bnPow;\r\n // (public) this^e\r\n BigInteger.prototype.pow = function (e) {\r\n return this.exp(e, new NullExp());\r\n };\r\n // BigInteger.prototype.gcd = bnGCD;\r\n // (public) gcd(this,a) (HAC 14.54)\r\n BigInteger.prototype.gcd = function (a) {\r\n var x = (this.s < 0) ? this.negate() : this.clone();\r\n var y = (a.s < 0) ? a.negate() : a.clone();\r\n if (x.compareTo(y) < 0) {\r\n var t = x;\r\n x = y;\r\n y = t;\r\n }\r\n var i = x.getLowestSetBit();\r\n var g = y.getLowestSetBit();\r\n if (g < 0) {\r\n return x;\r\n }\r\n if (i < g) {\r\n g = i;\r\n }\r\n if (g > 0) {\r\n x.rShiftTo(g, x);\r\n y.rShiftTo(g, y);\r\n }\r\n while (x.signum() > 0) {\r\n if ((i = x.getLowestSetBit()) > 0) {\r\n x.rShiftTo(i, x);\r\n }\r\n if ((i = y.getLowestSetBit()) > 0) {\r\n y.rShiftTo(i, y);\r\n }\r\n if (x.compareTo(y) >= 0) {\r\n x.subTo(y, x);\r\n x.rShiftTo(1, x);\r\n }\r\n else {\r\n y.subTo(x, y);\r\n y.rShiftTo(1, y);\r\n }\r\n }\r\n if (g > 0) {\r\n y.lShiftTo(g, y);\r\n }\r\n return y;\r\n };\r\n // BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\r\n // (public) test primality with certainty >= 1-.5^t\r\n BigInteger.prototype.isProbablePrime = function (t) {\r\n var i;\r\n var x = this.abs();\r\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\r\n for (i = 0; i < lowprimes.length; ++i) {\r\n if (x[0] == lowprimes[i]) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n if (x.isEven()) {\r\n return false;\r\n }\r\n i = 1;\r\n while (i < lowprimes.length) {\r\n var m = lowprimes[i];\r\n var j = i + 1;\r\n while (j < lowprimes.length && m < lplim) {\r\n m *= lowprimes[j++];\r\n }\r\n m = x.modInt(m);\r\n while (i < j) {\r\n if (m % lowprimes[i++] == 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return x.millerRabin(t);\r\n };\r\n //#endregion PUBLIC\r\n //#region PROTECTED\r\n // BigInteger.prototype.copyTo = bnpCopyTo;\r\n // (protected) copy this to r\r\n BigInteger.prototype.copyTo = function (r) {\r\n for (var i = this.t - 1; i >= 0; --i) {\r\n r[i] = this[i];\r\n }\r\n r.t = this.t;\r\n r.s = this.s;\r\n };\r\n // BigInteger.prototype.fromInt = bnpFromInt;\r\n // (protected) set from integer value x, -DV <= x < DV\r\n BigInteger.prototype.fromInt = function (x) {\r\n this.t = 1;\r\n this.s = (x < 0) ? -1 : 0;\r\n if (x > 0) {\r\n this[0] = x;\r\n }\r\n else if (x < -1) {\r\n this[0] = x + this.DV;\r\n }\r\n else {\r\n this.t = 0;\r\n }\r\n };\r\n // BigInteger.prototype.fromString = bnpFromString;\r\n // (protected) set from string and radix\r\n BigInteger.prototype.fromString = function (s, b) {\r\n var k;\r\n if (b == 16) {\r\n k = 4;\r\n }\r\n else if (b == 8) {\r\n k = 3;\r\n }\r\n else if (b == 256) {\r\n k = 8;\r\n /* byte array */\r\n }\r\n else if (b == 2) {\r\n k = 1;\r\n }\r\n else if (b == 32) {\r\n k = 5;\r\n }\r\n else if (b == 4) {\r\n k = 2;\r\n }\r\n else {\r\n this.fromRadix(s, b);\r\n return;\r\n }\r\n this.t = 0;\r\n this.s = 0;\r\n var i = s.length;\r\n var mi = false;\r\n var sh = 0;\r\n while (--i >= 0) {\r\n var x = (k == 8) ? (+s[i]) & 0xff : intAt(s, i);\r\n if (x < 0) {\r\n if (s.charAt(i) == \"-\") {\r\n mi = true;\r\n }\r\n continue;\r\n }\r\n mi = false;\r\n if (sh == 0) {\r\n this[this.t++] = x;\r\n }\r\n else if (sh + k > this.DB) {\r\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\r\n this[this.t++] = (x >> (this.DB - sh));\r\n }\r\n else {\r\n this[this.t - 1] |= x << sh;\r\n }\r\n sh += k;\r\n if (sh >= this.DB) {\r\n sh -= this.DB;\r\n }\r\n }\r\n if (k == 8 && ((+s[0]) & 0x80) != 0) {\r\n this.s = -1;\r\n if (sh > 0) {\r\n this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\r\n }\r\n }\r\n this.clamp();\r\n if (mi) {\r\n BigInteger.ZERO.subTo(this, this);\r\n }\r\n };\r\n // BigInteger.prototype.clamp = bnpClamp;\r\n // (protected) clamp off excess high words\r\n BigInteger.prototype.clamp = function () {\r\n var c = this.s & this.DM;\r\n while (this.t > 0 && this[this.t - 1] == c) {\r\n --this.t;\r\n }\r\n };\r\n // BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\r\n // (protected) r = this << n*DB\r\n BigInteger.prototype.dlShiftTo = function (n, r) {\r\n var i;\r\n for (i = this.t - 1; i >= 0; --i) {\r\n r[i + n] = this[i];\r\n }\r\n for (i = n - 1; i >= 0; --i) {\r\n r[i] = 0;\r\n }\r\n r.t = this.t + n;\r\n r.s = this.s;\r\n };\r\n // BigInteger.prototype.drShiftTo = bnpDRShiftTo;\r\n // (protected) r = this >> n*DB\r\n BigInteger.prototype.drShiftTo = function (n, r) {\r\n for (var i = n; i < this.t; ++i) {\r\n r[i - n] = this[i];\r\n }\r\n r.t = Math.max(this.t - n, 0);\r\n r.s = this.s;\r\n };\r\n // BigInteger.prototype.lShiftTo = bnpLShiftTo;\r\n // (protected) r = this << n\r\n BigInteger.prototype.lShiftTo = function (n, r) {\r\n var bs = n % this.DB;\r\n var cbs = this.DB - bs;\r\n var bm = (1 << cbs) - 1;\r\n var ds = Math.floor(n / this.DB);\r\n var c = (this.s << bs) & this.DM;\r\n for (var i = this.t - 1; i >= 0; --i) {\r\n r[i + ds + 1] = (this[i] >> cbs) | c;\r\n c = (this[i] & bm) << bs;\r\n }\r\n for (var i = ds - 1; i >= 0; --i) {\r\n r[i] = 0;\r\n }\r\n r[ds] = c;\r\n r.t = this.t + ds + 1;\r\n r.s = this.s;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.rShiftTo = bnpRShiftTo;\r\n // (protected) r = this >> n\r\n BigInteger.prototype.rShiftTo = function (n, r) {\r\n r.s = this.s;\r\n var ds = Math.floor(n / this.DB);\r\n if (ds >= this.t) {\r\n r.t = 0;\r\n return;\r\n }\r\n var bs = n % this.DB;\r\n var cbs = this.DB - bs;\r\n var bm = (1 << bs) - 1;\r\n r[0] = this[ds] >> bs;\r\n for (var i = ds + 1; i < this.t; ++i) {\r\n r[i - ds - 1] |= (this[i] & bm) << cbs;\r\n r[i - ds] = this[i] >> bs;\r\n }\r\n if (bs > 0) {\r\n r[this.t - ds - 1] |= (this.s & bm) << cbs;\r\n }\r\n r.t = this.t - ds;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.subTo = bnpSubTo;\r\n // (protected) r = this - a\r\n BigInteger.prototype.subTo = function (a, r) {\r\n var i = 0;\r\n var c = 0;\r\n var m = Math.min(a.t, this.t);\r\n while (i < m) {\r\n c += this[i] - a[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n if (a.t < this.t) {\r\n c -= a.s;\r\n while (i < this.t) {\r\n c += this[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c += this.s;\r\n }\r\n else {\r\n c += this.s;\r\n while (i < a.t) {\r\n c -= a[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c -= a.s;\r\n }\r\n r.s = (c < 0) ? -1 : 0;\r\n if (c < -1) {\r\n r[i++] = this.DV + c;\r\n }\r\n else if (c > 0) {\r\n r[i++] = c;\r\n }\r\n r.t = i;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.multiplyTo = bnpMultiplyTo;\r\n // (protected) r = this * a, r != this,a (HAC 14.12)\r\n // \"this\" should be the larger one if appropriate.\r\n BigInteger.prototype.multiplyTo = function (a, r) {\r\n var x = this.abs();\r\n var y = a.abs();\r\n var i = x.t;\r\n r.t = i + y.t;\r\n while (--i >= 0) {\r\n r[i] = 0;\r\n }\r\n for (i = 0; i < y.t; ++i) {\r\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\r\n }\r\n r.s = 0;\r\n r.clamp();\r\n if (this.s != a.s) {\r\n BigInteger.ZERO.subTo(r, r);\r\n }\r\n };\r\n // BigInteger.prototype.squareTo = bnpSquareTo;\r\n // (protected) r = this^2, r != this (HAC 14.16)\r\n BigInteger.prototype.squareTo = function (r) {\r\n var x = this.abs();\r\n var i = r.t = 2 * x.t;\r\n while (--i >= 0) {\r\n r[i] = 0;\r\n }\r\n for (i = 0; i < x.t - 1; ++i) {\r\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\r\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\r\n r[i + x.t] -= x.DV;\r\n r[i + x.t + 1] = 1;\r\n }\r\n }\r\n if (r.t > 0) {\r\n r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\r\n }\r\n r.s = 0;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.divRemTo = bnpDivRemTo;\r\n // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\r\n // r != q, this != m. q or r may be null.\r\n BigInteger.prototype.divRemTo = function (m, q, r) {\r\n var pm = m.abs();\r\n if (pm.t <= 0) {\r\n return;\r\n }\r\n var pt = this.abs();\r\n if (pt.t < pm.t) {\r\n if (q != null) {\r\n q.fromInt(0);\r\n }\r\n if (r != null) {\r\n this.copyTo(r);\r\n }\r\n return;\r\n }\r\n if (r == null) {\r\n r = nbi();\r\n }\r\n var y = nbi();\r\n var ts = this.s;\r\n var ms = m.s;\r\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\r\n if (nsh > 0) {\r\n pm.lShiftTo(nsh, y);\r\n pt.lShiftTo(nsh, r);\r\n }\r\n else {\r\n pm.copyTo(y);\r\n pt.copyTo(r);\r\n }\r\n var ys = y.t;\r\n var y0 = y[ys - 1];\r\n if (y0 == 0) {\r\n return;\r\n }\r\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\r\n var d1 = this.FV / yt;\r\n var d2 = (1 << this.F1) / yt;\r\n var e = 1 << this.F2;\r\n var i = r.t;\r\n var j = i - ys;\r\n var t = (q == null) ? nbi() : q;\r\n y.dlShiftTo(j, t);\r\n if (r.compareTo(t) >= 0) {\r\n r[r.t++] = 1;\r\n r.subTo(t, r);\r\n }\r\n BigInteger.ONE.dlShiftTo(ys, t);\r\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\r\n while (y.t < ys) {\r\n y[y.t++] = 0;\r\n }\r\n while (--j >= 0) {\r\n // Estimate quotient digit\r\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\r\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out\r\n y.dlShiftTo(j, t);\r\n r.subTo(t, r);\r\n while (r[i] < --qd) {\r\n r.subTo(t, r);\r\n }\r\n }\r\n }\r\n if (q != null) {\r\n r.drShiftTo(ys, q);\r\n if (ts != ms) {\r\n BigInteger.ZERO.subTo(q, q);\r\n }\r\n }\r\n r.t = ys;\r\n r.clamp();\r\n if (nsh > 0) {\r\n r.rShiftTo(nsh, r);\r\n } // Denormalize remainder\r\n if (ts < 0) {\r\n BigInteger.ZERO.subTo(r, r);\r\n }\r\n };\r\n // BigInteger.prototype.invDigit = bnpInvDigit;\r\n // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\r\n // justification:\r\n // xy == 1 (mod m)\r\n // xy = 1+km\r\n // xy(2-xy) = (1+km)(1-km)\r\n // x[y(2-xy)] = 1-k^2m^2\r\n // x[y(2-xy)] == 1 (mod m^2)\r\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\r\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\r\n // JS multiply \"overflows\" differently from C/C++, so care is needed here.\r\n BigInteger.prototype.invDigit = function () {\r\n if (this.t < 1) {\r\n return 0;\r\n }\r\n var x = this[0];\r\n if ((x & 1) == 0) {\r\n return 0;\r\n }\r\n var y = x & 3; // y == 1/x mod 2^2\r\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\r\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\r\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\r\n // last step - calculate inverse mod DV directly;\r\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\r\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\r\n // we really want the negative inverse, and -DV < y < DV\r\n return (y > 0) ? this.DV - y : -y;\r\n };\r\n // BigInteger.prototype.isEven = bnpIsEven;\r\n // (protected) true iff this is even\r\n BigInteger.prototype.isEven = function () {\r\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\r\n };\r\n // BigInteger.prototype.exp = bnpExp;\r\n // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\r\n BigInteger.prototype.exp = function (e, z) {\r\n if (e > 0xffffffff || e < 1) {\r\n return BigInteger.ONE;\r\n }\r\n var r = nbi();\r\n var r2 = nbi();\r\n var g = z.convert(this);\r\n var i = nbits(e) - 1;\r\n g.copyTo(r);\r\n while (--i >= 0) {\r\n z.sqrTo(r, r2);\r\n if ((e & (1 << i)) > 0) {\r\n z.mulTo(r2, g, r);\r\n }\r\n else {\r\n var t = r;\r\n r = r2;\r\n r2 = t;\r\n }\r\n }\r\n return z.revert(r);\r\n };\r\n // BigInteger.prototype.chunkSize = bnpChunkSize;\r\n // (protected) return x s.t. r^x < DV\r\n BigInteger.prototype.chunkSize = function (r) {\r\n return Math.floor(Math.LN2 * this.DB / Math.log(r));\r\n };\r\n // BigInteger.prototype.toRadix = bnpToRadix;\r\n // (protected) convert to radix string\r\n BigInteger.prototype.toRadix = function (b) {\r\n if (b == null) {\r\n b = 10;\r\n }\r\n if (this.signum() == 0 || b < 2 || b > 36) {\r\n return \"0\";\r\n }\r\n var cs = this.chunkSize(b);\r\n var a = Math.pow(b, cs);\r\n var d = nbv(a);\r\n var y = nbi();\r\n var z = nbi();\r\n var r = \"\";\r\n this.divRemTo(d, y, z);\r\n while (y.signum() > 0) {\r\n r = (a + z.intValue()).toString(b).substr(1) + r;\r\n y.divRemTo(d, y, z);\r\n }\r\n return z.intValue().toString(b) + r;\r\n };\r\n // BigInteger.prototype.fromRadix = bnpFromRadix;\r\n // (protected) convert from radix string\r\n BigInteger.prototype.fromRadix = function (s, b) {\r\n this.fromInt(0);\r\n if (b == null) {\r\n b = 10;\r\n }\r\n var cs = this.chunkSize(b);\r\n var d = Math.pow(b, cs);\r\n var mi = false;\r\n var j = 0;\r\n var w = 0;\r\n for (var i = 0; i < s.length; ++i) {\r\n var x = intAt(s, i);\r\n if (x < 0) {\r\n if (s.charAt(i) == \"-\" && this.signum() == 0) {\r\n mi = true;\r\n }\r\n continue;\r\n }\r\n w = b * w + x;\r\n if (++j >= cs) {\r\n this.dMultiply(d);\r\n this.dAddOffset(w, 0);\r\n j = 0;\r\n w = 0;\r\n }\r\n }\r\n if (j > 0) {\r\n this.dMultiply(Math.pow(b, j));\r\n this.dAddOffset(w, 0);\r\n }\r\n if (mi) {\r\n BigInteger.ZERO.subTo(this, this);\r\n }\r\n };\r\n // BigInteger.prototype.fromNumber = bnpFromNumber;\r\n // (protected) alternate constructor\r\n BigInteger.prototype.fromNumber = function (a, b, c) {\r\n if (\"number\" == typeof b) {\r\n // new BigInteger(int,int,RNG)\r\n if (a < 2) {\r\n this.fromInt(1);\r\n }\r\n else {\r\n this.fromNumber(a, c);\r\n if (!this.testBit(a - 1)) {\r\n // force MSB set\r\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\r\n }\r\n if (this.isEven()) {\r\n this.dAddOffset(1, 0);\r\n } // force odd\r\n while (!this.isProbablePrime(b)) {\r\n this.dAddOffset(2, 0);\r\n if (this.bitLength() > a) {\r\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // new BigInteger(int,RNG)\r\n var x = [];\r\n var t = a & 7;\r\n x.length = (a >> 3) + 1;\r\n b.nextBytes(x);\r\n if (t > 0) {\r\n x[0] &= ((1 << t) - 1);\r\n }\r\n else {\r\n x[0] = 0;\r\n }\r\n this.fromString(x, 256);\r\n }\r\n };\r\n // BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\r\n // (protected) r = this op a (bitwise)\r\n BigInteger.prototype.bitwiseTo = function (a, op, r) {\r\n var i;\r\n var f;\r\n var m = Math.min(a.t, this.t);\r\n for (i = 0; i < m; ++i) {\r\n r[i] = op(this[i], a[i]);\r\n }\r\n if (a.t < this.t) {\r\n f = a.s & this.DM;\r\n for (i = m; i < this.t; ++i) {\r\n r[i] = op(this[i], f);\r\n }\r\n r.t = this.t;\r\n }\r\n else {\r\n f = this.s & this.DM;\r\n for (i = m; i < a.t; ++i) {\r\n r[i] = op(f, a[i]);\r\n }\r\n r.t = a.t;\r\n }\r\n r.s = op(this.s, a.s);\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.changeBit = bnpChangeBit;\r\n // (protected) this op (1<>= this.DB;\r\n }\r\n if (a.t < this.t) {\r\n c += a.s;\r\n while (i < this.t) {\r\n c += this[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c += this.s;\r\n }\r\n else {\r\n c += this.s;\r\n while (i < a.t) {\r\n c += a[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c += a.s;\r\n }\r\n r.s = (c < 0) ? -1 : 0;\r\n if (c > 0) {\r\n r[i++] = c;\r\n }\r\n else if (c < -1) {\r\n r[i++] = this.DV + c;\r\n }\r\n r.t = i;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.dMultiply = bnpDMultiply;\r\n // (protected) this *= n, this >= 0, 1 < n < DV\r\n BigInteger.prototype.dMultiply = function (n) {\r\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\r\n ++this.t;\r\n this.clamp();\r\n };\r\n // BigInteger.prototype.dAddOffset = bnpDAddOffset;\r\n // (protected) this += n << w words, this >= 0\r\n BigInteger.prototype.dAddOffset = function (n, w) {\r\n if (n == 0) {\r\n return;\r\n }\r\n while (this.t <= w) {\r\n this[this.t++] = 0;\r\n }\r\n this[w] += n;\r\n while (this[w] >= this.DV) {\r\n this[w] -= this.DV;\r\n if (++w >= this.t) {\r\n this[this.t++] = 0;\r\n }\r\n ++this[w];\r\n }\r\n };\r\n // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\r\n // (protected) r = lower n words of \"this * a\", a.t <= n\r\n // \"this\" should be the larger one if appropriate.\r\n BigInteger.prototype.multiplyLowerTo = function (a, n, r) {\r\n var i = Math.min(this.t + a.t, n);\r\n r.s = 0; // assumes a,this >= 0\r\n r.t = i;\r\n while (i > 0) {\r\n r[--i] = 0;\r\n }\r\n for (var j = r.t - this.t; i < j; ++i) {\r\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\r\n }\r\n for (var j = Math.min(a.t, n); i < j; ++i) {\r\n this.am(0, a[i], r, i, 0, n - i);\r\n }\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\r\n // (protected) r = \"this * a\" without lower n words, n > 0\r\n // \"this\" should be the larger one if appropriate.\r\n BigInteger.prototype.multiplyUpperTo = function (a, n, r) {\r\n --n;\r\n var i = r.t = this.t + a.t - n;\r\n r.s = 0; // assumes a,this >= 0\r\n while (--i >= 0) {\r\n r[i] = 0;\r\n }\r\n for (i = Math.max(n - this.t, 0); i < a.t; ++i) {\r\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\r\n }\r\n r.clamp();\r\n r.drShiftTo(1, r);\r\n };\r\n // BigInteger.prototype.modInt = bnpModInt;\r\n // (protected) this % n, n < 2^26\r\n BigInteger.prototype.modInt = function (n) {\r\n if (n <= 0) {\r\n return 0;\r\n }\r\n var d = this.DV % n;\r\n var r = (this.s < 0) ? n - 1 : 0;\r\n if (this.t > 0) {\r\n if (d == 0) {\r\n r = this[0] % n;\r\n }\r\n else {\r\n for (var i = this.t - 1; i >= 0; --i) {\r\n r = (d * r + this[i]) % n;\r\n }\r\n }\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.millerRabin = bnpMillerRabin;\r\n // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\r\n BigInteger.prototype.millerRabin = function (t) {\r\n var n1 = this.subtract(BigInteger.ONE);\r\n var k = n1.getLowestSetBit();\r\n if (k <= 0) {\r\n return false;\r\n }\r\n var r = n1.shiftRight(k);\r\n t = (t + 1) >> 1;\r\n if (t > lowprimes.length) {\r\n t = lowprimes.length;\r\n }\r\n var a = nbi();\r\n for (var i = 0; i < t; ++i) {\r\n // Pick bases at random, instead of starting at 2\r\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\r\n var y = a.modPow(r, this);\r\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\r\n var j = 1;\r\n while (j++ < k && y.compareTo(n1) != 0) {\r\n y = y.modPowInt(2, this);\r\n if (y.compareTo(BigInteger.ONE) == 0) {\r\n return false;\r\n }\r\n }\r\n if (y.compareTo(n1) != 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n // BigInteger.prototype.square = bnSquare;\r\n // (public) this^2\r\n BigInteger.prototype.square = function () {\r\n var r = nbi();\r\n this.squareTo(r);\r\n return r;\r\n };\r\n //#region ASYNC\r\n // Public API method\r\n BigInteger.prototype.gcda = function (a, callback) {\r\n var x = (this.s < 0) ? this.negate() : this.clone();\r\n var y = (a.s < 0) ? a.negate() : a.clone();\r\n if (x.compareTo(y) < 0) {\r\n var t = x;\r\n x = y;\r\n y = t;\r\n }\r\n var i = x.getLowestSetBit();\r\n var g = y.getLowestSetBit();\r\n if (g < 0) {\r\n callback(x);\r\n return;\r\n }\r\n if (i < g) {\r\n g = i;\r\n }\r\n if (g > 0) {\r\n x.rShiftTo(g, x);\r\n y.rShiftTo(g, y);\r\n }\r\n // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen.\r\n var gcda1 = function () {\r\n if ((i = x.getLowestSetBit()) > 0) {\r\n x.rShiftTo(i, x);\r\n }\r\n if ((i = y.getLowestSetBit()) > 0) {\r\n y.rShiftTo(i, y);\r\n }\r\n if (x.compareTo(y) >= 0) {\r\n x.subTo(y, x);\r\n x.rShiftTo(1, x);\r\n }\r\n else {\r\n y.subTo(x, y);\r\n y.rShiftTo(1, y);\r\n }\r\n if (!(x.signum() > 0)) {\r\n if (g > 0) {\r\n y.lShiftTo(g, y);\r\n }\r\n setTimeout(function () { callback(y); }, 0); // escape\r\n }\r\n else {\r\n setTimeout(gcda1, 0);\r\n }\r\n };\r\n setTimeout(gcda1, 10);\r\n };\r\n // (protected) alternate constructor\r\n BigInteger.prototype.fromNumberAsync = function (a, b, c, callback) {\r\n if (\"number\" == typeof b) {\r\n if (a < 2) {\r\n this.fromInt(1);\r\n }\r\n else {\r\n this.fromNumber(a, c);\r\n if (!this.testBit(a - 1)) {\r\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\r\n }\r\n if (this.isEven()) {\r\n this.dAddOffset(1, 0);\r\n }\r\n var bnp_1 = this;\r\n var bnpfn1_1 = function () {\r\n bnp_1.dAddOffset(2, 0);\r\n if (bnp_1.bitLength() > a) {\r\n bnp_1.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp_1);\r\n }\r\n if (bnp_1.isProbablePrime(b)) {\r\n setTimeout(function () { callback(); }, 0); // escape\r\n }\r\n else {\r\n setTimeout(bnpfn1_1, 0);\r\n }\r\n };\r\n setTimeout(bnpfn1_1, 0);\r\n }\r\n }\r\n else {\r\n var x = [];\r\n var t = a & 7;\r\n x.length = (a >> 3) + 1;\r\n b.nextBytes(x);\r\n if (t > 0) {\r\n x[0] &= ((1 << t) - 1);\r\n }\r\n else {\r\n x[0] = 0;\r\n }\r\n this.fromString(x, 256);\r\n }\r\n };\r\n return BigInteger;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'BigInteger', { enumerable: true, configurable: true, get: function() { return BigInteger; } });\r\n//#region REDUCERS\r\n//#region NullExp\r\nvar NullExp = /** @class */ (function () {\r\n function NullExp() {\r\n }\r\n // NullExp.prototype.convert = nNop;\r\n NullExp.prototype.convert = function (x) {\r\n return x;\r\n };\r\n // NullExp.prototype.revert = nNop;\r\n NullExp.prototype.revert = function (x) {\r\n return x;\r\n };\r\n // NullExp.prototype.mulTo = nMulTo;\r\n NullExp.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n };\r\n // NullExp.prototype.sqrTo = nSqrTo;\r\n NullExp.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n };\r\n return NullExp;\r\n}());\r\n// Modular reduction using \"classic\" algorithm\r\nvar Classic = /** @class */ (function () {\r\n function Classic(m) {\r\n this.m = m;\r\n }\r\n // Classic.prototype.convert = cConvert;\r\n Classic.prototype.convert = function (x) {\r\n if (x.s < 0 || x.compareTo(this.m) >= 0) {\r\n return x.mod(this.m);\r\n }\r\n else {\r\n return x;\r\n }\r\n };\r\n // Classic.prototype.revert = cRevert;\r\n Classic.prototype.revert = function (x) {\r\n return x;\r\n };\r\n // Classic.prototype.reduce = cReduce;\r\n Classic.prototype.reduce = function (x) {\r\n x.divRemTo(this.m, null, x);\r\n };\r\n // Classic.prototype.mulTo = cMulTo;\r\n Classic.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n this.reduce(r);\r\n };\r\n // Classic.prototype.sqrTo = cSqrTo;\r\n Classic.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n this.reduce(r);\r\n };\r\n return Classic;\r\n}());\r\n//#endregion\r\n//#region Montgomery\r\n// Montgomery reduction\r\nvar Montgomery = /** @class */ (function () {\r\n function Montgomery(m) {\r\n this.m = m;\r\n this.mp = m.invDigit();\r\n this.mpl = this.mp & 0x7fff;\r\n this.mph = this.mp >> 15;\r\n this.um = (1 << (m.DB - 15)) - 1;\r\n this.mt2 = 2 * m.t;\r\n }\r\n // Montgomery.prototype.convert = montConvert;\r\n // xR mod m\r\n Montgomery.prototype.convert = function (x) {\r\n var r = nbi();\r\n x.abs().dlShiftTo(this.m.t, r);\r\n r.divRemTo(this.m, null, r);\r\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\r\n this.m.subTo(r, r);\r\n }\r\n return r;\r\n };\r\n // Montgomery.prototype.revert = montRevert;\r\n // x/R mod m\r\n Montgomery.prototype.revert = function (x) {\r\n var r = nbi();\r\n x.copyTo(r);\r\n this.reduce(r);\r\n return r;\r\n };\r\n // Montgomery.prototype.reduce = montReduce;\r\n // x = x/R mod m (HAC 14.32)\r\n Montgomery.prototype.reduce = function (x) {\r\n while (x.t <= this.mt2) {\r\n // pad x so am has enough room later\r\n x[x.t++] = 0;\r\n }\r\n for (var i = 0; i < this.m.t; ++i) {\r\n // faster way of calculating u0 = x[i]*mp mod DV\r\n var j = x[i] & 0x7fff;\r\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\r\n // use am to combine the multiply-shift-add into one call\r\n j = i + this.m.t;\r\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\r\n // propagate carry\r\n while (x[j] >= x.DV) {\r\n x[j] -= x.DV;\r\n x[++j]++;\r\n }\r\n }\r\n x.clamp();\r\n x.drShiftTo(this.m.t, x);\r\n if (x.compareTo(this.m) >= 0) {\r\n x.subTo(this.m, x);\r\n }\r\n };\r\n // Montgomery.prototype.mulTo = montMulTo;\r\n // r = \"xy/R mod m\"; x,y != r\r\n Montgomery.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n this.reduce(r);\r\n };\r\n // Montgomery.prototype.sqrTo = montSqrTo;\r\n // r = \"x^2/R mod m\"; x != r\r\n Montgomery.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n this.reduce(r);\r\n };\r\n return Montgomery;\r\n}());\r\n//#endregion Montgomery\r\n//#region Barrett\r\n// Barrett modular reduction\r\nvar Barrett = /** @class */ (function () {\r\n function Barrett(m) {\r\n this.m = m;\r\n // setup Barrett\r\n this.r2 = nbi();\r\n this.q3 = nbi();\r\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\r\n this.mu = this.r2.divide(m);\r\n }\r\n // Barrett.prototype.convert = barrettConvert;\r\n Barrett.prototype.convert = function (x) {\r\n if (x.s < 0 || x.t > 2 * this.m.t) {\r\n return x.mod(this.m);\r\n }\r\n else if (x.compareTo(this.m) < 0) {\r\n return x;\r\n }\r\n else {\r\n var r = nbi();\r\n x.copyTo(r);\r\n this.reduce(r);\r\n return r;\r\n }\r\n };\r\n // Barrett.prototype.revert = barrettRevert;\r\n Barrett.prototype.revert = function (x) {\r\n return x;\r\n };\r\n // Barrett.prototype.reduce = barrettReduce;\r\n // x = x mod m (HAC 14.42)\r\n Barrett.prototype.reduce = function (x) {\r\n x.drShiftTo(this.m.t - 1, this.r2);\r\n if (x.t > this.m.t + 1) {\r\n x.t = this.m.t + 1;\r\n x.clamp();\r\n }\r\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\r\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\r\n while (x.compareTo(this.r2) < 0) {\r\n x.dAddOffset(1, this.m.t + 1);\r\n }\r\n x.subTo(this.r2, x);\r\n while (x.compareTo(this.m) >= 0) {\r\n x.subTo(this.m, x);\r\n }\r\n };\r\n // Barrett.prototype.mulTo = barrettMulTo;\r\n // r = x*y mod m; x,y != r\r\n Barrett.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n this.reduce(r);\r\n };\r\n // Barrett.prototype.sqrTo = barrettSqrTo;\r\n // r = x^2 mod m; x != r\r\n Barrett.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n this.reduce(r);\r\n };\r\n return Barrett;\r\n}());\r\n//#endregion\r\n//#endregion REDUCERS\r\n// return new, unset BigInteger\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbi() { return new BigInteger(null); };exports.nbi = nbi\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function parseBigInt(str, r) {\r\n return new BigInteger(str, r);\r\n};exports.parseBigInt = parseBigInt\r\n// am: Compute w_j += (x*this_i), propagate carries,\r\n// c is initial carry, returns final carry.\r\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\r\n// We need to select the fastest one that works in this environment.\r\nvar inBrowser = typeof navigator !== \"undefined\";\r\nif (inBrowser && j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\r\n // am2 avoids a big mult-and-extract completely.\r\n // Max digit bits should be <= 30 because we do bitwise ops\r\n // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\r\n BigInteger.prototype.am = function am2(i, x, w, j, c, n) {\r\n var xl = x & 0x7fff;\r\n var xh = x >> 15;\r\n while (--n >= 0) {\r\n var l = this[i] & 0x7fff;\r\n var h = this[i++] >> 15;\r\n var m = xh * l + h * xl;\r\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\r\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\r\n w[j++] = l & 0x3fffffff;\r\n }\r\n return c;\r\n };\r\n dbits = 30;\r\n}\r\nelse if (inBrowser && j_lm && (navigator.appName != \"Netscape\")) {\r\n // am1: use a single mult and divide to get the high bits,\r\n // max digit bits should be 26 because\r\n // max internal value = 2*dvalue^2-2*dvalue (< 2^53)\r\n BigInteger.prototype.am = function am1(i, x, w, j, c, n) {\r\n while (--n >= 0) {\r\n var v = x * this[i++] + w[j] + c;\r\n c = Math.floor(v / 0x4000000);\r\n w[j++] = v & 0x3ffffff;\r\n }\r\n return c;\r\n };\r\n dbits = 26;\r\n}\r\nelse { // Mozilla/Netscape seems to prefer am3\r\n // Alternately, set max digit bits to 28 since some\r\n // browsers slow down when dealing with 32-bit numbers.\r\n BigInteger.prototype.am = function am3(i, x, w, j, c, n) {\r\n var xl = x & 0x3fff;\r\n var xh = x >> 14;\r\n while (--n >= 0) {\r\n var l = this[i] & 0x3fff;\r\n var h = this[i++] >> 14;\r\n var m = xh * l + h * xl;\r\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\r\n c = (l >> 28) + (m >> 14) + xh * h;\r\n w[j++] = l & 0xfffffff;\r\n }\r\n return c;\r\n };\r\n dbits = 28;\r\n}\r\nBigInteger.prototype.DB = dbits;\r\nBigInteger.prototype.DM = ((1 << dbits) - 1);\r\nBigInteger.prototype.DV = (1 << dbits);\r\nvar BI_FP = 52;\r\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\r\nBigInteger.prototype.F1 = BI_FP - dbits;\r\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\r\n// Digit conversions\r\nvar BI_RC = [];\r\nvar rr;\r\nvar vv;\r\nrr = \"0\".charCodeAt(0);\r\nfor (vv = 0; vv <= 9; ++vv) {\r\n BI_RC[rr++] = vv;\r\n}\r\nrr = \"a\".charCodeAt(0);\r\nfor (vv = 10; vv < 36; ++vv) {\r\n BI_RC[rr++] = vv;\r\n}\r\nrr = \"A\".charCodeAt(0);\r\nfor (vv = 10; vv < 36; ++vv) {\r\n BI_RC[rr++] = vv;\r\n}\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function intAt(s, i) {\r\n var c = BI_RC[s.charCodeAt(i)];\r\n return (c == null) ? -1 : c;\r\n};exports.intAt = intAt\r\n// return bigint initialized to value\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbv(i) {\r\n var r = nbi();\r\n r.fromInt(i);\r\n return r;\r\n};exports.nbv = nbv\r\n// returns bit length of the integer x\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbits(x) {\r\n var r = 1;\r\n var t;\r\n if ((t = x >>> 16) != 0) {\r\n x = t;\r\n r += 16;\r\n }\r\n if ((t = x >> 8) != 0) {\r\n x = t;\r\n r += 8;\r\n }\r\n if ((t = x >> 4) != 0) {\r\n x = t;\r\n r += 4;\r\n }\r\n if ((t = x >> 2) != 0) {\r\n x = t;\r\n r += 2;\r\n }\r\n if ((t = x >> 1) != 0) {\r\n x = t;\r\n r += 1;\r\n }\r\n return r;\r\n};exports.nbits = nbits\r\n// \"constants\"\r\nBigInteger.ZERO = nbv(0);\r\nBigInteger.ONE = nbv(1);\r\n","// Random number generator - requires a PRNG backend, e.g. prng4.js\r\nvar __TEMP__ = require('./prng4');var prng_newstate = __TEMP__['prng_newstate'];var rng_psize = __TEMP__['rng_psize'];\r\nvar rng_state;\r\nvar rng_pool = null;\r\nvar rng_pptr;\r\n// Initialize the pool with junk if needed.\r\nif (rng_pool == null) {\r\n rng_pool = [];\r\n rng_pptr = 0;\r\n var t = void 0;\r\n // Use mouse events for entropy, if we do not have enough entropy by the time\r\n // we need it, entropy will be generated by Math.random.\r\n var count = 0;\r\n var onMouseMoveListener = function (ev) {\r\n count = count || 0;\r\n if (count >= 256 || rng_pptr >= rng_psize) {\r\n return;\r\n }\r\n try {\r\n var mouseCoordinates = ev.x + ev.y;\r\n rng_pool[rng_pptr++] = mouseCoordinates & 255;\r\n count += 1;\r\n }\r\n catch (e) {\r\n // Sometimes Firefox will deny permission to access event properties for some reason. Ignore.\r\n }\r\n };\r\n}\r\nfunction rng_get_byte() {\r\n if (rng_state == null) {\r\n rng_state = prng_newstate();\r\n // At this point, we may not have collected enough entropy. If not, fall back to Math.random\r\n while (rng_pptr < rng_psize) {\r\n var random = Math.floor(65536 * Math.random());\r\n rng_pool[rng_pptr++] = random & 255;\r\n }\r\n rng_state.init(rng_pool);\r\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {\r\n rng_pool[rng_pptr] = 0;\r\n }\r\n rng_pptr = 0;\r\n }\r\n // TODO: allow reseeding after first request\r\n return rng_state.next();\r\n}\r\nvar SecureRandom = /** @class */ (function () {\r\n function SecureRandom() {\r\n }\r\n SecureRandom.prototype.nextBytes = function (ba) {\r\n for (var i = 0; i < ba.length; ++i) {\r\n ba[i] = rng_get_byte();\r\n }\r\n };\r\n return SecureRandom;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'SecureRandom', { enumerable: true, configurable: true, get: function() { return SecureRandom; } });\r\n","// prng4.js - uses Arcfour as a PRNG\r\nvar Arcfour = /** @class */ (function () {\r\n function Arcfour() {\r\n this.i = 0;\r\n this.j = 0;\r\n this.S = [];\r\n }\r\n // Arcfour.prototype.init = ARC4init;\r\n // Initialize arcfour context from key, an array of ints, each from [0..255]\r\n Arcfour.prototype.init = function (key) {\r\n var i;\r\n var j;\r\n var t;\r\n for (i = 0; i < 256; ++i) {\r\n this.S[i] = i;\r\n }\r\n j = 0;\r\n for (i = 0; i < 256; ++i) {\r\n j = (j + this.S[i] + key[i % key.length]) & 255;\r\n t = this.S[i];\r\n this.S[i] = this.S[j];\r\n this.S[j] = t;\r\n }\r\n this.i = 0;\r\n this.j = 0;\r\n };\r\n // Arcfour.prototype.next = ARC4next;\r\n Arcfour.prototype.next = function () {\r\n var t;\r\n this.i = (this.i + 1) & 255;\r\n this.j = (this.j + this.S[this.i]) & 255;\r\n t = this.S[this.i];\r\n this.S[this.i] = this.S[this.j];\r\n this.S[this.j] = t;\r\n return this.S[(t + this.S[this.i]) & 255];\r\n };\r\n return Arcfour;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Arcfour', { enumerable: true, configurable: true, get: function() { return Arcfour; } });\r\n// Plug in your RNG constructor here\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function prng_newstate() {\r\n return new Arcfour();\r\n};exports.prng_newstate = prng_newstate\r\n// Pool size must be a multiple of 4 and greater than 32.\r\n// An array of bytes the size of the pool will be passed to init()\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var rng_psize = exports.rng_psize = 256;\r\n","/* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license\r\n */\r\n/*\r\n * asn1.js - ASN.1 DER encoder classes\r\n *\r\n * Copyright (c) 2013-2017 Kenji Urushima (kenji.urushima@gmail.com)\r\n *\r\n * This software is licensed under the terms of the MIT License.\r\n * https://kjur.github.io/jsrsasign/license\r\n *\r\n * The above copyright and license notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n */\r\nvar __TEMP__ = require('../jsbn/jsbn');var BigInteger = __TEMP__['BigInteger'];\r\nvar __TEMP__ = require('./yahoo');var YAHOO = __TEMP__['YAHOO'];\r\n/**\r\n * @fileOverview\r\n * @name asn1-1.0.js\r\n * @author Kenji Urushima kenji.urushima@gmail.com\r\n * @version asn1 1.0.13 (2017-Jun-02)\r\n * @since jsrsasign 2.1\r\n * @license MIT License\r\n */\r\n/**\r\n * kjur's class library name space\r\n *

\r\n * This name space provides following name spaces:\r\n *

    \r\n *
  • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
  • \r\n *
  • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
  • \r\n *
  • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature\r\n * class and utilities
  • \r\n *
\r\n *

\r\n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\r\n * @name KJUR\r\n * @namespace kjur's class library name space\r\n */\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var KJUR = exports.KJUR = {};\r\n/**\r\n * kjur's ASN.1 class library name space\r\n *

\r\n * This is ITU-T X.690 ASN.1 DER encoder class library and\r\n * class structure and methods is very similar to\r\n * org.bouncycastle.asn1 package of\r\n * well known BouncyCaslte Cryptography Library.\r\n *

PROVIDING ASN.1 PRIMITIVES

\r\n * Here are ASN.1 DER primitive classes.\r\n *
    \r\n *
  • 0x01 {@link KJUR.asn1.DERBoolean}
  • \r\n *
  • 0x02 {@link KJUR.asn1.DERInteger}
  • \r\n *
  • 0x03 {@link KJUR.asn1.DERBitString}
  • \r\n *
  • 0x04 {@link KJUR.asn1.DEROctetString}
  • \r\n *
  • 0x05 {@link KJUR.asn1.DERNull}
  • \r\n *
  • 0x06 {@link KJUR.asn1.DERObjectIdentifier}
  • \r\n *
  • 0x0a {@link KJUR.asn1.DEREnumerated}
  • \r\n *
  • 0x0c {@link KJUR.asn1.DERUTF8String}
  • \r\n *
  • 0x12 {@link KJUR.asn1.DERNumericString}
  • \r\n *
  • 0x13 {@link KJUR.asn1.DERPrintableString}
  • \r\n *
  • 0x14 {@link KJUR.asn1.DERTeletexString}
  • \r\n *
  • 0x16 {@link KJUR.asn1.DERIA5String}
  • \r\n *
  • 0x17 {@link KJUR.asn1.DERUTCTime}
  • \r\n *
  • 0x18 {@link KJUR.asn1.DERGeneralizedTime}
  • \r\n *
  • 0x30 {@link KJUR.asn1.DERSequence}
  • \r\n *
  • 0x31 {@link KJUR.asn1.DERSet}
  • \r\n *
\r\n *

OTHER ASN.1 CLASSES

\r\n *
    \r\n *
  • {@link KJUR.asn1.ASN1Object}
  • \r\n *
  • {@link KJUR.asn1.DERAbstractString}
  • \r\n *
  • {@link KJUR.asn1.DERAbstractTime}
  • \r\n *
  • {@link KJUR.asn1.DERAbstractStructured}
  • \r\n *
  • {@link KJUR.asn1.DERTaggedObject}
  • \r\n *
\r\n *

SUB NAME SPACES

\r\n *
    \r\n *
  • {@link KJUR.asn1.cades} - CAdES long term signature format
  • \r\n *
  • {@link KJUR.asn1.cms} - Cryptographic Message Syntax
  • \r\n *
  • {@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)
  • \r\n *
  • {@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format
  • \r\n *
  • {@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL
  • \r\n *
\r\n *

\r\n * NOTE: Please ignore method summary and document of this namespace.\r\n * This caused by a bug of jsdoc2.\r\n * @name KJUR.asn1\r\n * @namespace\r\n */\r\nif (typeof KJUR.asn1 == \"undefined\" || !KJUR.asn1)\r\n KJUR.asn1 = {};\r\n/**\r\n * ASN1 utilities class\r\n * @name KJUR.asn1.ASN1Util\r\n * @class ASN1 utilities class\r\n * @since asn1 1.0.2\r\n */\r\nKJUR.asn1.ASN1Util = new function () {\r\n this.integerToByteHex = function (i) {\r\n var h = i.toString(16);\r\n if ((h.length % 2) == 1)\r\n h = '0' + h;\r\n return h;\r\n };\r\n this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) {\r\n var h = bigIntegerValue.toString(16);\r\n if (h.substr(0, 1) != '-') {\r\n if (h.length % 2 == 1) {\r\n h = '0' + h;\r\n }\r\n else {\r\n if (!h.match(/^[0-7]/)) {\r\n h = '00' + h;\r\n }\r\n }\r\n }\r\n else {\r\n var hPos = h.substr(1);\r\n var xorLen = hPos.length;\r\n if (xorLen % 2 == 1) {\r\n xorLen += 1;\r\n }\r\n else {\r\n if (!h.match(/^[0-7]/)) {\r\n xorLen += 2;\r\n }\r\n }\r\n var hMask = '';\r\n for (var i = 0; i < xorLen; i++) {\r\n hMask += 'f';\r\n }\r\n var biMask = new BigInteger(hMask, 16);\r\n var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);\r\n h = biNeg.toString(16).replace(/^-/, '');\r\n }\r\n return h;\r\n };\r\n /**\r\n * get PEM string from hexadecimal data and header string\r\n * @name getPEMStringFromHex\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {String} dataHex hexadecimal string of PEM body\r\n * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')\r\n * @return {String} PEM formatted string of input data\r\n * @description\r\n * This method converts a hexadecimal string to a PEM string with\r\n * a specified header. Its line break will be CRLF(\"\\r\\n\").\r\n * @example\r\n * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');\r\n * // value of pem will be:\r\n * -----BEGIN PRIVATE KEY-----\r\n * YWFh\r\n * -----END PRIVATE KEY-----\r\n */\r\n this.getPEMStringFromHex = function (dataHex, pemHeader) {\r\n return hextopem(dataHex, pemHeader);\r\n };\r\n /**\r\n * generate ASN1Object specifed by JSON parameters\r\n * @name newObject\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {Array} param JSON parameter to generate ASN1Object\r\n * @return {KJUR.asn1.ASN1Object} generated object\r\n * @since asn1 1.0.3\r\n * @description\r\n * generate any ASN1Object specified by JSON param\r\n * including ASN.1 primitive or structured.\r\n * Generally 'param' can be described as follows:\r\n *
\r\n * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}\r\n *
\r\n * 'TYPE-OF-ASN1OBJ' can be one of following symbols:\r\n *
    \r\n *
  • 'bool' - DERBoolean
  • \r\n *
  • 'int' - DERInteger
  • \r\n *
  • 'bitstr' - DERBitString
  • \r\n *
  • 'octstr' - DEROctetString
  • \r\n *
  • 'null' - DERNull
  • \r\n *
  • 'oid' - DERObjectIdentifier
  • \r\n *
  • 'enum' - DEREnumerated
  • \r\n *
  • 'utf8str' - DERUTF8String
  • \r\n *
  • 'numstr' - DERNumericString
  • \r\n *
  • 'prnstr' - DERPrintableString
  • \r\n *
  • 'telstr' - DERTeletexString
  • \r\n *
  • 'ia5str' - DERIA5String
  • \r\n *
  • 'utctime' - DERUTCTime
  • \r\n *
  • 'gentime' - DERGeneralizedTime
  • \r\n *
  • 'seq' - DERSequence
  • \r\n *
  • 'set' - DERSet
  • \r\n *
  • 'tag' - DERTaggedObject
  • \r\n *
\r\n * @example\r\n * newObject({'prnstr': 'aaa'});\r\n * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})\r\n * // ASN.1 Tagged Object\r\n * newObject({'tag': {'tag': 'a1',\r\n * 'explicit': true,\r\n * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});\r\n * // more simple representation of ASN.1 Tagged Object\r\n * newObject({'tag': ['a1',\r\n * true,\r\n * {'seq': [\r\n * {'int': 3},\r\n * {'prnstr': 'aaa'}]}\r\n * ]});\r\n */\r\n this.newObject = function (param) {\r\n var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject;\r\n var keys = Object.keys(param);\r\n if (keys.length != 1)\r\n throw \"key of param shall be only one.\";\r\n var key = keys[0];\r\n if (\":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:\".indexOf(\":\" + key + \":\") == -1)\r\n throw \"undefined key: \" + key;\r\n if (key == \"bool\")\r\n return new _DERBoolean(param[key]);\r\n if (key == \"int\")\r\n return new _DERInteger(param[key]);\r\n if (key == \"bitstr\")\r\n return new _DERBitString(param[key]);\r\n if (key == \"octstr\")\r\n return new _DEROctetString(param[key]);\r\n if (key == \"null\")\r\n return new _DERNull(param[key]);\r\n if (key == \"oid\")\r\n return new _DERObjectIdentifier(param[key]);\r\n if (key == \"enum\")\r\n return new _DEREnumerated(param[key]);\r\n if (key == \"utf8str\")\r\n return new _DERUTF8String(param[key]);\r\n if (key == \"numstr\")\r\n return new _DERNumericString(param[key]);\r\n if (key == \"prnstr\")\r\n return new _DERPrintableString(param[key]);\r\n if (key == \"telstr\")\r\n return new _DERTeletexString(param[key]);\r\n if (key == \"ia5str\")\r\n return new _DERIA5String(param[key]);\r\n if (key == \"utctime\")\r\n return new _DERUTCTime(param[key]);\r\n if (key == \"gentime\")\r\n return new _DERGeneralizedTime(param[key]);\r\n if (key == \"seq\") {\r\n var paramList = param[key];\r\n var a = [];\r\n for (var i = 0; i < paramList.length; i++) {\r\n var asn1Obj = _newObject(paramList[i]);\r\n a.push(asn1Obj);\r\n }\r\n return new _DERSequence({ 'array': a });\r\n }\r\n if (key == \"set\") {\r\n var paramList = param[key];\r\n var a = [];\r\n for (var i = 0; i < paramList.length; i++) {\r\n var asn1Obj = _newObject(paramList[i]);\r\n a.push(asn1Obj);\r\n }\r\n return new _DERSet({ 'array': a });\r\n }\r\n if (key == \"tag\") {\r\n var tagParam = param[key];\r\n if (Object.prototype.toString.call(tagParam) === '[object Array]' &&\r\n tagParam.length == 3) {\r\n var obj = _newObject(tagParam[2]);\r\n return new _DERTaggedObject({ tag: tagParam[0],\r\n explicit: tagParam[1],\r\n obj: obj });\r\n }\r\n else {\r\n var newParam = {};\r\n if (tagParam.explicit !== undefined)\r\n newParam.explicit = tagParam.explicit;\r\n if (tagParam.tag !== undefined)\r\n newParam.tag = tagParam.tag;\r\n if (tagParam.obj === undefined)\r\n throw \"obj shall be specified for 'tag'.\";\r\n newParam.obj = _newObject(tagParam.obj);\r\n return new _DERTaggedObject(newParam);\r\n }\r\n }\r\n };\r\n /**\r\n * get encoded hexadecimal string of ASN1Object specifed by JSON parameters\r\n * @name jsonToASN1HEX\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {Array} param JSON parameter to generate ASN1Object\r\n * @return hexadecimal string of ASN1Object\r\n * @since asn1 1.0.4\r\n * @description\r\n * As for ASN.1 object representation of JSON object,\r\n * please see {@link newObject}.\r\n * @example\r\n * jsonToASN1HEX({'prnstr': 'aaa'});\r\n */\r\n this.jsonToASN1HEX = function (param) {\r\n var asn1Obj = this.newObject(param);\r\n return asn1Obj.getEncodedHex();\r\n };\r\n};\r\n/**\r\n * get dot noted oid number string from hexadecimal value of OID\r\n * @name oidHexToInt\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {String} hex hexadecimal value of object identifier\r\n * @return {String} dot noted string of object identifier\r\n * @since jsrsasign 4.8.3 asn1 1.0.7\r\n * @description\r\n * This static method converts from hexadecimal string representation of\r\n * ASN.1 value of object identifier to oid number string.\r\n * @example\r\n * KJUR.asn1.ASN1Util.oidHexToInt('550406') → \"2.5.4.6\"\r\n */\r\nKJUR.asn1.ASN1Util.oidHexToInt = function (hex) {\r\n var s = \"\";\r\n var i01 = parseInt(hex.substr(0, 2), 16);\r\n var i0 = Math.floor(i01 / 40);\r\n var i1 = i01 % 40;\r\n var s = i0 + \".\" + i1;\r\n var binbuf = \"\";\r\n for (var i = 2; i < hex.length; i += 2) {\r\n var value = parseInt(hex.substr(i, 2), 16);\r\n var bin = (\"00000000\" + value.toString(2)).slice(-8);\r\n binbuf = binbuf + bin.substr(1, 7);\r\n if (bin.substr(0, 1) == \"0\") {\r\n var bi = new BigInteger(binbuf, 2);\r\n s = s + \".\" + bi.toString(10);\r\n binbuf = \"\";\r\n }\r\n }\r\n ;\r\n return s;\r\n};\r\n/**\r\n * get hexadecimal value of object identifier from dot noted oid value\r\n * @name oidIntToHex\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {String} oidString dot noted string of object identifier\r\n * @return {String} hexadecimal value of object identifier\r\n * @since jsrsasign 4.8.3 asn1 1.0.7\r\n * @description\r\n * This static method converts from object identifier value string.\r\n * to hexadecimal string representation of it.\r\n * @example\r\n * KJUR.asn1.ASN1Util.oidIntToHex(\"2.5.4.6\") → \"550406\"\r\n */\r\nKJUR.asn1.ASN1Util.oidIntToHex = function (oidString) {\r\n var itox = function (i) {\r\n var h = i.toString(16);\r\n if (h.length == 1)\r\n h = '0' + h;\r\n return h;\r\n };\r\n var roidtox = function (roid) {\r\n var h = '';\r\n var bi = new BigInteger(roid, 10);\r\n var b = bi.toString(2);\r\n var padLen = 7 - b.length % 7;\r\n if (padLen == 7)\r\n padLen = 0;\r\n var bPad = '';\r\n for (var i = 0; i < padLen; i++)\r\n bPad += '0';\r\n b = bPad + b;\r\n for (var i = 0; i < b.length - 1; i += 7) {\r\n var b8 = b.substr(i, 7);\r\n if (i != b.length - 7)\r\n b8 = '1' + b8;\r\n h += itox(parseInt(b8, 2));\r\n }\r\n return h;\r\n };\r\n if (!oidString.match(/^[0-9.]+$/)) {\r\n throw \"malformed oid string: \" + oidString;\r\n }\r\n var h = '';\r\n var a = oidString.split('.');\r\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\r\n h += itox(i0);\r\n a.splice(0, 2);\r\n for (var i = 0; i < a.length; i++) {\r\n h += roidtox(a[i]);\r\n }\r\n return h;\r\n};\r\n// ********************************************************************\r\n// Abstract ASN.1 Classes\r\n// ********************************************************************\r\n// ********************************************************************\r\n/**\r\n * base class for ASN.1 DER encoder object\r\n * @name KJUR.asn1.ASN1Object\r\n * @class base class for ASN.1 DER encoder object\r\n * @property {Boolean} isModified flag whether internal data was changed\r\n * @property {String} hTLV hexadecimal string of ASN.1 TLV\r\n * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)\r\n * @property {String} hL hexadecimal string of ASN.1 TLV length(L)\r\n * @property {String} hV hexadecimal string of ASN.1 TLV value(V)\r\n * @description\r\n */\r\nKJUR.asn1.ASN1Object = function () {\r\n var isModified = true;\r\n var hTLV = null;\r\n var hT = '00';\r\n var hL = '00';\r\n var hV = '';\r\n /**\r\n * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)\r\n * @name getLengthHexFromValue\r\n * @memberOf KJUR.asn1.ASN1Object#\r\n * @function\r\n * @return {String} hexadecimal string of ASN.1 TLV length(L)\r\n */\r\n this.getLengthHexFromValue = function () {\r\n if (typeof this.hV == \"undefined\" || this.hV == null) {\r\n throw \"this.hV is null or undefined.\";\r\n }\r\n if (this.hV.length % 2 == 1) {\r\n throw \"value hex must be even length: n=\" + hV.length + \",v=\" + this.hV;\r\n }\r\n var n = this.hV.length / 2;\r\n var hN = n.toString(16);\r\n if (hN.length % 2 == 1) {\r\n hN = \"0\" + hN;\r\n }\r\n if (n < 128) {\r\n return hN;\r\n }\r\n else {\r\n var hNlen = hN.length / 2;\r\n if (hNlen > 15) {\r\n throw \"ASN.1 length too long to represent by 8x: n = \" + n.toString(16);\r\n }\r\n var head = 128 + hNlen;\r\n return head.toString(16) + hN;\r\n }\r\n };\r\n /**\r\n * get hexadecimal string of ASN.1 TLV bytes\r\n * @name getEncodedHex\r\n * @memberOf KJUR.asn1.ASN1Object#\r\n * @function\r\n * @return {String} hexadecimal string of ASN.1 TLV\r\n */\r\n this.getEncodedHex = function () {\r\n if (this.hTLV == null || this.isModified) {\r\n this.hV = this.getFreshValueHex();\r\n this.hL = this.getLengthHexFromValue();\r\n this.hTLV = this.hT + this.hL + this.hV;\r\n this.isModified = false;\r\n //alert(\"first time: \" + this.hTLV);\r\n }\r\n return this.hTLV;\r\n };\r\n /**\r\n * get hexadecimal string of ASN.1 TLV value(V) bytes\r\n * @name getValueHex\r\n * @memberOf KJUR.asn1.ASN1Object#\r\n * @function\r\n * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes\r\n */\r\n this.getValueHex = function () {\r\n this.getEncodedHex();\r\n return this.hV;\r\n };\r\n this.getFreshValueHex = function () {\r\n return '';\r\n };\r\n};\r\n// == BEGIN DERAbstractString ================================================\r\n/**\r\n * base class for ASN.1 DER string classes\r\n * @name KJUR.asn1.DERAbstractString\r\n * @class base class for ASN.1 DER string classes\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @property {String} s internal string of value\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • str - specify initial ASN.1 value(V) by a string
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERAbstractString = function (params) {\r\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\r\n var s = null;\r\n var hV = null;\r\n /**\r\n * get string value of this string object\r\n * @name getString\r\n * @memberOf KJUR.asn1.DERAbstractString#\r\n * @function\r\n * @return {String} string value of this string object\r\n */\r\n this.getString = function () {\r\n return this.s;\r\n };\r\n /**\r\n * set value by a string\r\n * @name setString\r\n * @memberOf KJUR.asn1.DERAbstractString#\r\n * @function\r\n * @param {String} newS value by a string to set\r\n */\r\n this.setString = function (newS) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = newS;\r\n this.hV = stohex(this.s);\r\n };\r\n /**\r\n * set value by a hexadecimal string\r\n * @name setStringHex\r\n * @memberOf KJUR.asn1.DERAbstractString#\r\n * @function\r\n * @param {String} newHexString value by a hexadecimal string to set\r\n */\r\n this.setStringHex = function (newHexString) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = null;\r\n this.hV = newHexString;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params == \"string\") {\r\n this.setString(params);\r\n }\r\n else if (typeof params['str'] != \"undefined\") {\r\n this.setString(params['str']);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setStringHex(params['hex']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);\r\n// == END DERAbstractString ================================================\r\n// == BEGIN DERAbstractTime ==================================================\r\n/**\r\n * base class for ASN.1 DER Generalized/UTCTime class\r\n * @name KJUR.asn1.DERAbstractTime\r\n * @class base class for ASN.1 DER Generalized/UTCTime class\r\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERAbstractTime = function (params) {\r\n KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);\r\n var s = null;\r\n var date = null;\r\n // --- PRIVATE METHODS --------------------\r\n this.localDateToUTC = function (d) {\r\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\r\n var utcDate = new Date(utc);\r\n return utcDate;\r\n };\r\n /*\r\n * format date string by Data object\r\n * @name formatDate\r\n * @memberOf KJUR.asn1.AbstractTime;\r\n * @param {Date} dateObject\r\n * @param {string} type 'utc' or 'gen'\r\n * @param {boolean} withMillis flag for with millisections or not\r\n * @description\r\n * 'withMillis' flag is supported from asn1 1.0.6.\r\n */\r\n this.formatDate = function (dateObject, type, withMillis) {\r\n var pad = this.zeroPadding;\r\n var d = this.localDateToUTC(dateObject);\r\n var year = String(d.getFullYear());\r\n if (type == 'utc')\r\n year = year.substr(2, 2);\r\n var month = pad(String(d.getMonth() + 1), 2);\r\n var day = pad(String(d.getDate()), 2);\r\n var hour = pad(String(d.getHours()), 2);\r\n var min = pad(String(d.getMinutes()), 2);\r\n var sec = pad(String(d.getSeconds()), 2);\r\n var s = year + month + day + hour + min + sec;\r\n if (withMillis === true) {\r\n var millis = d.getMilliseconds();\r\n if (millis != 0) {\r\n var sMillis = pad(String(millis), 3);\r\n sMillis = sMillis.replace(/[0]+$/, \"\");\r\n s = s + \".\" + sMillis;\r\n }\r\n }\r\n return s + \"Z\";\r\n };\r\n this.zeroPadding = function (s, len) {\r\n if (s.length >= len)\r\n return s;\r\n return new Array(len - s.length + 1).join('0') + s;\r\n };\r\n // --- PUBLIC METHODS --------------------\r\n /**\r\n * get string value of this string object\r\n * @name getString\r\n * @memberOf KJUR.asn1.DERAbstractTime#\r\n * @function\r\n * @return {String} string value of this time object\r\n */\r\n this.getString = function () {\r\n return this.s;\r\n };\r\n /**\r\n * set value by a string\r\n * @name setString\r\n * @memberOf KJUR.asn1.DERAbstractTime#\r\n * @function\r\n * @param {String} newS value by a string to set such like \"130430235959Z\"\r\n */\r\n this.setString = function (newS) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = newS;\r\n this.hV = stohex(newS);\r\n };\r\n /**\r\n * set value by a Date object\r\n * @name setByDateValue\r\n * @memberOf KJUR.asn1.DERAbstractTime#\r\n * @function\r\n * @param {Integer} year year of date (ex. 2013)\r\n * @param {Integer} month month of date between 1 and 12 (ex. 12)\r\n * @param {Integer} day day of month\r\n * @param {Integer} hour hours of date\r\n * @param {Integer} min minutes of date\r\n * @param {Integer} sec seconds of date\r\n */\r\n this.setByDateValue = function (year, month, day, hour, min, sec) {\r\n var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));\r\n this.setByDate(dateObject);\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);\r\n// == END DERAbstractTime ==================================================\r\n// == BEGIN DERAbstractStructured ============================================\r\n/**\r\n * base class for ASN.1 DER structured class\r\n * @name KJUR.asn1.DERAbstractStructured\r\n * @class base class for ASN.1 DER structured class\r\n * @property {Array} asn1Array internal array of ASN1Object\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERAbstractStructured = function (params) {\r\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\r\n var asn1Array = null;\r\n /**\r\n * set value by array of ASN1Object\r\n * @name setByASN1ObjectArray\r\n * @memberOf KJUR.asn1.DERAbstractStructured#\r\n * @function\r\n * @param {array} asn1ObjectArray array of ASN1Object to set\r\n */\r\n this.setByASN1ObjectArray = function (asn1ObjectArray) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.asn1Array = asn1ObjectArray;\r\n };\r\n /**\r\n * append an ASN1Object to internal array\r\n * @name appendASN1Object\r\n * @memberOf KJUR.asn1.DERAbstractStructured#\r\n * @function\r\n * @param {ASN1Object} asn1Object to add\r\n */\r\n this.appendASN1Object = function (asn1Object) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.asn1Array.push(asn1Object);\r\n };\r\n this.asn1Array = new Array();\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['array'] != \"undefined\") {\r\n this.asn1Array = params['array'];\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n// ASN.1 Object Classes\r\n// ********************************************************************\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Boolean\r\n * @name KJUR.asn1.DERBoolean\r\n * @class class for ASN.1 DER Boolean\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERBoolean = function () {\r\n KJUR.asn1.DERBoolean.superclass.constructor.call(this);\r\n this.hT = \"01\";\r\n this.hTLV = \"0101ff\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Integer\r\n * @name KJUR.asn1.DERInteger\r\n * @class class for ASN.1 DER Integer\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • int - specify initial ASN.1 value(V) by integer value
  • \r\n *
  • bigint - specify initial ASN.1 value(V) by BigInteger object
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERInteger = function (params) {\r\n KJUR.asn1.DERInteger.superclass.constructor.call(this);\r\n this.hT = \"02\";\r\n /**\r\n * set value by Tom Wu's BigInteger object\r\n * @name setByBigInteger\r\n * @memberOf KJUR.asn1.DERInteger#\r\n * @function\r\n * @param {BigInteger} bigIntegerValue to set\r\n */\r\n this.setByBigInteger = function (bigIntegerValue) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setByInteger\r\n * @memberOf KJUR.asn1.DERInteger\r\n * @function\r\n * @param {Integer} integer value to set\r\n */\r\n this.setByInteger = function (intValue) {\r\n var bi = new BigInteger(String(intValue), 10);\r\n this.setByBigInteger(bi);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setValueHex\r\n * @memberOf KJUR.asn1.DERInteger#\r\n * @function\r\n * @param {String} hexadecimal string of integer value\r\n * @description\r\n *
\r\n * NOTE: Value shall be represented by minimum octet length of\r\n * two's complement representation.\r\n * @example\r\n * new KJUR.asn1.DERInteger(123);\r\n * new KJUR.asn1.DERInteger({'int': 123});\r\n * new KJUR.asn1.DERInteger({'hex': '1fad'});\r\n */\r\n this.setValueHex = function (newHexString) {\r\n this.hV = newHexString;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['bigint'] != \"undefined\") {\r\n this.setByBigInteger(params['bigint']);\r\n }\r\n else if (typeof params['int'] != \"undefined\") {\r\n this.setByInteger(params['int']);\r\n }\r\n else if (typeof params == \"number\") {\r\n this.setByInteger(params);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setValueHex(params['hex']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER encoded BitString primitive\r\n * @name KJUR.asn1.DERBitString\r\n * @class class for ASN.1 DER encoded BitString primitive\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • bin - specify binary string (ex. '10111')
  • \r\n *
  • array - specify array of boolean (ex. [true,false,true,true])
  • \r\n *
  • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
  • \r\n *
  • obj - specify {@link KJUR.asn1.ASN1Util.newObject}\r\n * argument for \"BitString encapsulates\" structure.
  • \r\n *
\r\n * NOTE1: 'params' can be omitted.
\r\n * NOTE2: 'obj' parameter have been supported since\r\n * asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
\r\n * @example\r\n * // default constructor\r\n * o = new KJUR.asn1.DERBitString();\r\n * // initialize with binary string\r\n * o = new KJUR.asn1.DERBitString({bin: \"1011\"});\r\n * // initialize with boolean array\r\n * o = new KJUR.asn1.DERBitString({array: [true,false,true,true]});\r\n * // initialize with hexadecimal string (04 is unused bits)\r\n * o = new KJUR.asn1.DEROctetString({hex: \"04bac0\"});\r\n * // initialize with ASN1Util.newObject argument for encapsulated\r\n * o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\r\n * // above generates a ASN.1 data like this:\r\n * // BIT STRING, encapsulates {\r\n * // SEQUENCE {\r\n * // INTEGER 3\r\n * // PrintableString 'aaa'\r\n * // }\r\n * // }\r\n */\r\nKJUR.asn1.DERBitString = function (params) {\r\n if (params !== undefined && typeof params.obj !== \"undefined\") {\r\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\r\n params.hex = \"00\" + o.getEncodedHex();\r\n }\r\n KJUR.asn1.DERBitString.superclass.constructor.call(this);\r\n this.hT = \"03\";\r\n /**\r\n * set ASN.1 value(V) by a hexadecimal string including unused bits\r\n * @name setHexValueIncludingUnusedBits\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {String} newHexStringIncludingUnusedBits\r\n */\r\n this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = newHexStringIncludingUnusedBits;\r\n };\r\n /**\r\n * set ASN.1 value(V) by unused bit and hexadecimal string of value\r\n * @name setUnusedBitsAndHexValue\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {Integer} unusedBits\r\n * @param {String} hValue\r\n */\r\n this.setUnusedBitsAndHexValue = function (unusedBits, hValue) {\r\n if (unusedBits < 0 || 7 < unusedBits) {\r\n throw \"unused bits shall be from 0 to 7: u = \" + unusedBits;\r\n }\r\n var hUnusedBits = \"0\" + unusedBits;\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = hUnusedBits + hValue;\r\n };\r\n /**\r\n * set ASN.1 DER BitString by binary string
\r\n * @name setByBinaryString\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {String} binaryString binary value string (i.e. '10111')\r\n * @description\r\n * Its unused bits will be calculated automatically by length of\r\n * 'binaryValue'.
\r\n * NOTE: Trailing zeros '0' will be ignored.\r\n * @example\r\n * o = new KJUR.asn1.DERBitString();\r\n * o.setByBooleanArray(\"01011\");\r\n */\r\n this.setByBinaryString = function (binaryString) {\r\n binaryString = binaryString.replace(/0+$/, '');\r\n var unusedBits = 8 - binaryString.length % 8;\r\n if (unusedBits == 8)\r\n unusedBits = 0;\r\n for (var i = 0; i <= unusedBits; i++) {\r\n binaryString += '0';\r\n }\r\n var h = '';\r\n for (var i = 0; i < binaryString.length - 1; i += 8) {\r\n var b = binaryString.substr(i, 8);\r\n var x = parseInt(b, 2).toString(16);\r\n if (x.length == 1)\r\n x = '0' + x;\r\n h += x;\r\n }\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = '0' + unusedBits + h;\r\n };\r\n /**\r\n * set ASN.1 TLV value(V) by an array of boolean
\r\n * @name setByBooleanArray\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {array} booleanArray array of boolean (ex. [true, false, true])\r\n * @description\r\n * NOTE: Trailing falses will be ignored in the ASN.1 DER Object.\r\n * @example\r\n * o = new KJUR.asn1.DERBitString();\r\n * o.setByBooleanArray([false, true, false, true, true]);\r\n */\r\n this.setByBooleanArray = function (booleanArray) {\r\n var s = '';\r\n for (var i = 0; i < booleanArray.length; i++) {\r\n if (booleanArray[i] == true) {\r\n s += '1';\r\n }\r\n else {\r\n s += '0';\r\n }\r\n }\r\n this.setByBinaryString(s);\r\n };\r\n /**\r\n * generate an array of falses with specified length
\r\n * @name newFalseArray\r\n * @memberOf KJUR.asn1.DERBitString\r\n * @function\r\n * @param {Integer} nLength length of array to generate\r\n * @return {array} array of boolean falses\r\n * @description\r\n * This static method may be useful to initialize boolean array.\r\n * @example\r\n * o = new KJUR.asn1.DERBitString();\r\n * o.newFalseArray(3) → [false, false, false]\r\n */\r\n this.newFalseArray = function (nLength) {\r\n var a = new Array(nLength);\r\n for (var i = 0; i < nLength; i++) {\r\n a[i] = false;\r\n }\r\n return a;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params == \"string\" && params.toLowerCase().match(/^[0-9a-f]+$/)) {\r\n this.setHexValueIncludingUnusedBits(params);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setHexValueIncludingUnusedBits(params['hex']);\r\n }\r\n else if (typeof params['bin'] != \"undefined\") {\r\n this.setByBinaryString(params['bin']);\r\n }\r\n else if (typeof params['array'] != \"undefined\") {\r\n this.setByBooleanArray(params['array']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER OctetString
\r\n * @name KJUR.asn1.DEROctetString\r\n * @class class for ASN.1 DER OctetString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * This class provides ASN.1 OctetString simple type.
\r\n * Supported \"params\" attributes are:\r\n *
    \r\n *
  • str - to set a string as a value
  • \r\n *
  • hex - to set a hexadecimal string as a value
  • \r\n *
  • obj - to set a encapsulated ASN.1 value by JSON object\r\n * which is defined in {@link KJUR.asn1.ASN1Util.newObject}
  • \r\n *
\r\n * NOTE: A parameter 'obj' have been supported\r\n * for \"OCTET STRING, encapsulates\" structure.\r\n * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n * @example\r\n * // default constructor\r\n * o = new KJUR.asn1.DEROctetString();\r\n * // initialize with string\r\n * o = new KJUR.asn1.DEROctetString({str: \"aaa\"});\r\n * // initialize with hexadecimal string\r\n * o = new KJUR.asn1.DEROctetString({hex: \"616161\"});\r\n * // initialize with ASN1Util.newObject argument\r\n * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\r\n * // above generates a ASN.1 data like this:\r\n * // OCTET STRING, encapsulates {\r\n * // SEQUENCE {\r\n * // INTEGER 3\r\n * // PrintableString 'aaa'\r\n * // }\r\n * // }\r\n */\r\nKJUR.asn1.DEROctetString = function (params) {\r\n if (params !== undefined && typeof params.obj !== \"undefined\") {\r\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\r\n params.hex = o.getEncodedHex();\r\n }\r\n KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);\r\n this.hT = \"04\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Null\r\n * @name KJUR.asn1.DERNull\r\n * @class class for ASN.1 DER Null\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERNull = function () {\r\n KJUR.asn1.DERNull.superclass.constructor.call(this);\r\n this.hT = \"05\";\r\n this.hTLV = \"0500\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER ObjectIdentifier\r\n * @name KJUR.asn1.DERObjectIdentifier\r\n * @class class for ASN.1 DER ObjectIdentifier\r\n * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERObjectIdentifier = function (params) {\r\n var itox = function (i) {\r\n var h = i.toString(16);\r\n if (h.length == 1)\r\n h = '0' + h;\r\n return h;\r\n };\r\n var roidtox = function (roid) {\r\n var h = '';\r\n var bi = new BigInteger(roid, 10);\r\n var b = bi.toString(2);\r\n var padLen = 7 - b.length % 7;\r\n if (padLen == 7)\r\n padLen = 0;\r\n var bPad = '';\r\n for (var i = 0; i < padLen; i++)\r\n bPad += '0';\r\n b = bPad + b;\r\n for (var i = 0; i < b.length - 1; i += 7) {\r\n var b8 = b.substr(i, 7);\r\n if (i != b.length - 7)\r\n b8 = '1' + b8;\r\n h += itox(parseInt(b8, 2));\r\n }\r\n return h;\r\n };\r\n KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);\r\n this.hT = \"06\";\r\n /**\r\n * set value by a hexadecimal string\r\n * @name setValueHex\r\n * @memberOf KJUR.asn1.DERObjectIdentifier#\r\n * @function\r\n * @param {String} newHexString hexadecimal value of OID bytes\r\n */\r\n this.setValueHex = function (newHexString) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = null;\r\n this.hV = newHexString;\r\n };\r\n /**\r\n * set value by a OID string
\r\n * @name setValueOidString\r\n * @memberOf KJUR.asn1.DERObjectIdentifier#\r\n * @function\r\n * @param {String} oidString OID string (ex. 2.5.4.13)\r\n * @example\r\n * o = new KJUR.asn1.DERObjectIdentifier();\r\n * o.setValueOidString(\"2.5.4.13\");\r\n */\r\n this.setValueOidString = function (oidString) {\r\n if (!oidString.match(/^[0-9.]+$/)) {\r\n throw \"malformed oid string: \" + oidString;\r\n }\r\n var h = '';\r\n var a = oidString.split('.');\r\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\r\n h += itox(i0);\r\n a.splice(0, 2);\r\n for (var i = 0; i < a.length; i++) {\r\n h += roidtox(a[i]);\r\n }\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = null;\r\n this.hV = h;\r\n };\r\n /**\r\n * set value by a OID name\r\n * @name setValueName\r\n * @memberOf KJUR.asn1.DERObjectIdentifier#\r\n * @function\r\n * @param {String} oidName OID name (ex. 'serverAuth')\r\n * @since 1.0.1\r\n * @description\r\n * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.\r\n * Otherwise raise error.\r\n * @example\r\n * o = new KJUR.asn1.DERObjectIdentifier();\r\n * o.setValueName(\"serverAuth\");\r\n */\r\n this.setValueName = function (oidName) {\r\n var oid = KJUR.asn1.x509.OID.name2oid(oidName);\r\n if (oid !== '') {\r\n this.setValueOidString(oid);\r\n }\r\n else {\r\n throw \"DERObjectIdentifier oidName undefined: \" + oidName;\r\n }\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (params !== undefined) {\r\n if (typeof params === \"string\") {\r\n if (params.match(/^[0-2].[0-9.]+$/)) {\r\n this.setValueOidString(params);\r\n }\r\n else {\r\n this.setValueName(params);\r\n }\r\n }\r\n else if (params.oid !== undefined) {\r\n this.setValueOidString(params.oid);\r\n }\r\n else if (params.hex !== undefined) {\r\n this.setValueHex(params.hex);\r\n }\r\n else if (params.name !== undefined) {\r\n this.setValueName(params.name);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Enumerated\r\n * @name KJUR.asn1.DEREnumerated\r\n * @class class for ASN.1 DER Enumerated\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • int - specify initial ASN.1 value(V) by integer value
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n * @example\r\n * new KJUR.asn1.DEREnumerated(123);\r\n * new KJUR.asn1.DEREnumerated({int: 123});\r\n * new KJUR.asn1.DEREnumerated({hex: '1fad'});\r\n */\r\nKJUR.asn1.DEREnumerated = function (params) {\r\n KJUR.asn1.DEREnumerated.superclass.constructor.call(this);\r\n this.hT = \"0a\";\r\n /**\r\n * set value by Tom Wu's BigInteger object\r\n * @name setByBigInteger\r\n * @memberOf KJUR.asn1.DEREnumerated#\r\n * @function\r\n * @param {BigInteger} bigIntegerValue to set\r\n */\r\n this.setByBigInteger = function (bigIntegerValue) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setByInteger\r\n * @memberOf KJUR.asn1.DEREnumerated#\r\n * @function\r\n * @param {Integer} integer value to set\r\n */\r\n this.setByInteger = function (intValue) {\r\n var bi = new BigInteger(String(intValue), 10);\r\n this.setByBigInteger(bi);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setValueHex\r\n * @memberOf KJUR.asn1.DEREnumerated#\r\n * @function\r\n * @param {String} hexadecimal string of integer value\r\n * @description\r\n *
\r\n * NOTE: Value shall be represented by minimum octet length of\r\n * two's complement representation.\r\n */\r\n this.setValueHex = function (newHexString) {\r\n this.hV = newHexString;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['int'] != \"undefined\") {\r\n this.setByInteger(params['int']);\r\n }\r\n else if (typeof params == \"number\") {\r\n this.setByInteger(params);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setValueHex(params['hex']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER UTF8String\r\n * @name KJUR.asn1.DERUTF8String\r\n * @class class for ASN.1 DER UTF8String\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERUTF8String = function (params) {\r\n KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);\r\n this.hT = \"0c\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER NumericString\r\n * @name KJUR.asn1.DERNumericString\r\n * @class class for ASN.1 DER NumericString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERNumericString = function (params) {\r\n KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);\r\n this.hT = \"12\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER PrintableString\r\n * @name KJUR.asn1.DERPrintableString\r\n * @class class for ASN.1 DER PrintableString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERPrintableString = function (params) {\r\n KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);\r\n this.hT = \"13\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER TeletexString\r\n * @name KJUR.asn1.DERTeletexString\r\n * @class class for ASN.1 DER TeletexString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERTeletexString = function (params) {\r\n KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);\r\n this.hT = \"14\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER IA5String\r\n * @name KJUR.asn1.DERIA5String\r\n * @class class for ASN.1 DER IA5String\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERIA5String = function (params) {\r\n KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);\r\n this.hT = \"16\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER UTCTime\r\n * @name KJUR.asn1.DERUTCTime\r\n * @class class for ASN.1 DER UTCTime\r\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\r\n * @extends KJUR.asn1.DERAbstractTime\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
  • date - specify Date object.
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n *

EXAMPLES

\r\n * @example\r\n * d1 = new KJUR.asn1.DERUTCTime();\r\n * d1.setString('130430125959Z');\r\n *\r\n * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});\r\n * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});\r\n * d4 = new KJUR.asn1.DERUTCTime('130430125959Z');\r\n */\r\nKJUR.asn1.DERUTCTime = function (params) {\r\n KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);\r\n this.hT = \"17\";\r\n /**\r\n * set value by a Date object
\r\n * @name setByDate\r\n * @memberOf KJUR.asn1.DERUTCTime#\r\n * @function\r\n * @param {Date} dateObject Date object to set ASN.1 value(V)\r\n * @example\r\n * o = new KJUR.asn1.DERUTCTime();\r\n * o.setByDate(new Date(\"2016/12/31\"));\r\n */\r\n this.setByDate = function (dateObject) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.date = dateObject;\r\n this.s = this.formatDate(this.date, 'utc');\r\n this.hV = stohex(this.s);\r\n };\r\n this.getFreshValueHex = function () {\r\n if (typeof this.date == \"undefined\" && typeof this.s == \"undefined\") {\r\n this.date = new Date();\r\n this.s = this.formatDate(this.date, 'utc');\r\n this.hV = stohex(this.s);\r\n }\r\n return this.hV;\r\n };\r\n if (params !== undefined) {\r\n if (params.str !== undefined) {\r\n this.setString(params.str);\r\n }\r\n else if (typeof params == \"string\" && params.match(/^[0-9]{12}Z$/)) {\r\n this.setString(params);\r\n }\r\n else if (params.hex !== undefined) {\r\n this.setStringHex(params.hex);\r\n }\r\n else if (params.date !== undefined) {\r\n this.setByDate(params.date);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER GeneralizedTime\r\n * @name KJUR.asn1.DERGeneralizedTime\r\n * @class class for ASN.1 DER GeneralizedTime\r\n * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})\r\n * @property {Boolean} withMillis flag to show milliseconds or not\r\n * @extends KJUR.asn1.DERAbstractTime\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
  • date - specify Date object.
  • \r\n *
  • millis - specify flag to show milliseconds (from 1.0.6)
  • \r\n *
\r\n * NOTE1: 'params' can be omitted.\r\n * NOTE2: 'withMillis' property is supported from asn1 1.0.6.\r\n */\r\nKJUR.asn1.DERGeneralizedTime = function (params) {\r\n KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);\r\n this.hT = \"18\";\r\n this.withMillis = false;\r\n /**\r\n * set value by a Date object\r\n * @name setByDate\r\n * @memberOf KJUR.asn1.DERGeneralizedTime#\r\n * @function\r\n * @param {Date} dateObject Date object to set ASN.1 value(V)\r\n * @example\r\n * When you specify UTC time, use 'Date.UTC' method like this:
\r\n * o1 = new DERUTCTime();\r\n * o1.setByDate(date);\r\n *\r\n * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59\r\n */\r\n this.setByDate = function (dateObject) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.date = dateObject;\r\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\r\n this.hV = stohex(this.s);\r\n };\r\n this.getFreshValueHex = function () {\r\n if (this.date === undefined && this.s === undefined) {\r\n this.date = new Date();\r\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\r\n this.hV = stohex(this.s);\r\n }\r\n return this.hV;\r\n };\r\n if (params !== undefined) {\r\n if (params.str !== undefined) {\r\n this.setString(params.str);\r\n }\r\n else if (typeof params == \"string\" && params.match(/^[0-9]{14}Z$/)) {\r\n this.setString(params);\r\n }\r\n else if (params.hex !== undefined) {\r\n this.setStringHex(params.hex);\r\n }\r\n else if (params.date !== undefined) {\r\n this.setByDate(params.date);\r\n }\r\n if (params.millis === true) {\r\n this.withMillis = true;\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Sequence\r\n * @name KJUR.asn1.DERSequence\r\n * @class class for ASN.1 DER Sequence\r\n * @extends KJUR.asn1.DERAbstractStructured\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • array - specify array of ASN1Object to set elements of content
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERSequence = function (params) {\r\n KJUR.asn1.DERSequence.superclass.constructor.call(this, params);\r\n this.hT = \"30\";\r\n this.getFreshValueHex = function () {\r\n var h = '';\r\n for (var i = 0; i < this.asn1Array.length; i++) {\r\n var asn1Obj = this.asn1Array[i];\r\n h += asn1Obj.getEncodedHex();\r\n }\r\n this.hV = h;\r\n return this.hV;\r\n };\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Set\r\n * @name KJUR.asn1.DERSet\r\n * @class class for ASN.1 DER Set\r\n * @extends KJUR.asn1.DERAbstractStructured\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • array - specify array of ASN1Object to set elements of content
  • \r\n *
  • sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
  • \r\n *
\r\n * NOTE1: 'params' can be omitted.
\r\n * NOTE2: sortflag is supported since 1.0.5.\r\n */\r\nKJUR.asn1.DERSet = function (params) {\r\n KJUR.asn1.DERSet.superclass.constructor.call(this, params);\r\n this.hT = \"31\";\r\n this.sortFlag = true; // item shall be sorted only in ASN.1 DER\r\n this.getFreshValueHex = function () {\r\n var a = new Array();\r\n for (var i = 0; i < this.asn1Array.length; i++) {\r\n var asn1Obj = this.asn1Array[i];\r\n a.push(asn1Obj.getEncodedHex());\r\n }\r\n if (this.sortFlag == true)\r\n a.sort();\r\n this.hV = a.join('');\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params.sortflag != \"undefined\" &&\r\n params.sortflag == false)\r\n this.sortFlag = false;\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER TaggedObject\r\n * @name KJUR.asn1.DERTaggedObject\r\n * @class class for ASN.1 DER TaggedObject\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.\r\n * For example, if you find '[1]' tag in a ASN.1 dump,\r\n * 'tagNoHex' will be 'a1'.\r\n *
\r\n * As for optional argument 'params' for constructor, you can specify *ANY* of\r\n * following properties:\r\n *
    \r\n *
  • explicit - specify true if this is explicit tag otherwise false\r\n * (default is 'true').
  • \r\n *
  • tag - specify tag (default is 'a0' which means [0])
  • \r\n *
  • obj - specify ASN1Object which is tagged
  • \r\n *
\r\n * @example\r\n * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});\r\n * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});\r\n * hex = d2.getEncodedHex();\r\n */\r\nKJUR.asn1.DERTaggedObject = function (params) {\r\n KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);\r\n this.hT = \"a0\";\r\n this.hV = '';\r\n this.isExplicit = true;\r\n this.asn1Object = null;\r\n /**\r\n * set value by an ASN1Object\r\n * @name setString\r\n * @memberOf KJUR.asn1.DERTaggedObject#\r\n * @function\r\n * @param {Boolean} isExplicitFlag flag for explicit/implicit tag\r\n * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag\r\n * @param {ASN1Object} asn1Object ASN.1 to encapsulate\r\n */\r\n this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) {\r\n this.hT = tagNoHex;\r\n this.isExplicit = isExplicitFlag;\r\n this.asn1Object = asn1Object;\r\n if (this.isExplicit) {\r\n this.hV = this.asn1Object.getEncodedHex();\r\n this.hTLV = null;\r\n this.isModified = true;\r\n }\r\n else {\r\n this.hV = null;\r\n this.hTLV = asn1Object.getEncodedHex();\r\n this.hTLV = this.hTLV.replace(/^../, tagNoHex);\r\n this.isModified = false;\r\n }\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['tag'] != \"undefined\") {\r\n this.hT = params['tag'];\r\n }\r\n if (typeof params['explicit'] != \"undefined\") {\r\n this.isExplicit = params['explicit'];\r\n }\r\n if (typeof params['obj'] != \"undefined\") {\r\n this.asn1Object = params['obj'];\r\n this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);\r\n","/*!\r\nCopyright (c) 2011, Yahoo! Inc. All rights reserved.\r\nCode licensed under the BSD License:\r\nhttp://developer.yahoo.com/yui/license.html\r\nversion: 2.9.0\r\n*/\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var YAHOO = exports.YAHOO = {};\r\nYAHOO.lang = {\r\n /**\r\n * Utility to set up the prototype, constructor and superclass properties to\r\n * support an inheritance strategy that can chain constructors and methods.\r\n * Static members will not be inherited.\r\n *\r\n * @method extend\r\n * @static\r\n * @param {Function} subc the object to modify\r\n * @param {Function} superc the object to inherit\r\n * @param {Object} overrides additional properties/methods to add to the\r\n * subclass prototype. These will override the\r\n * matching items obtained from the superclass\r\n * if present.\r\n */\r\n extend: function (subc, superc, overrides) {\r\n if (!superc || !subc) {\r\n throw new Error(\"YAHOO.lang.extend failed, please check that \" +\r\n \"all dependencies are included.\");\r\n }\r\n var F = function () { };\r\n F.prototype = superc.prototype;\r\n subc.prototype = new F();\r\n subc.prototype.constructor = subc;\r\n subc.superclass = superc.prototype;\r\n if (superc.prototype.constructor == Object.prototype.constructor) {\r\n superc.prototype.constructor = superc;\r\n }\r\n if (overrides) {\r\n var i;\r\n for (i in overrides) {\r\n subc.prototype[i] = overrides[i];\r\n }\r\n /*\r\n * IE will not enumerate native functions in a derived object even if the\r\n * function was overridden. This is a workaround for specific functions\r\n * we care about on the Object prototype.\r\n * @property _IEEnumFix\r\n * @param {Function} r the object to receive the augmentation\r\n * @param {Function} s the object that supplies the properties to augment\r\n * @static\r\n * @private\r\n */\r\n var _IEEnumFix = function () { }, ADD = [\"toString\", \"valueOf\"];\r\n try {\r\n if (/MSIE/.test(navigator.userAgent)) {\r\n _IEEnumFix = function (r, s) {\r\n for (i = 0; i < ADD.length; i = i + 1) {\r\n var fname = ADD[i], f = s[fname];\r\n if (typeof f === 'function' && f != Object.prototype[fname]) {\r\n r[fname] = f;\r\n }\r\n }\r\n };\r\n }\r\n }\r\n catch (ex) { }\r\n ;\r\n _IEEnumFix(subc.prototype, overrides);\r\n }\r\n }\r\n};\r\n","module.exports = {\r\n \"version\": \"3.2.1\"\r\n}\r\n"]} \ No newline at end of file +{"version":3,"sources":["index.js","JSEncrypt.js","lib/jsbn/base64.js","lib/jsbn/util.js","JSEncryptRSAKey.js","lib/asn1js/hex.js","lib/asn1js/base64.js","lib/asn1js/asn1.js","lib/asn1js/int10.js","lib/jsbn/rsa.js","lib/jsbn/jsbn.js","lib/jsbn/rng.js","lib/jsbn/prng4.js","lib/jsrsasign/asn1-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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["var __TEMP__ = require('./JSEncrypt');var JSEncrypt = __TEMP__['JSEncrypt'];\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } });\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });exports.default = JSEncrypt;\n","var __TEMP__ = require('./lib/jsbn/base64');var b64tohex = __TEMP__['b64tohex'];var hex2b64 = __TEMP__['hex2b64'];\nvar __TEMP__ = require('./JSEncryptRSAKey');var JSEncryptRSAKey = __TEMP__['JSEncryptRSAKey'];\nvar __TEMP__ = require('./version.json');var version = __REQUIRE_DEFAULT__(__TEMP__);\n/**\n *\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\n * possible parameters are:\n * - default_key_size {number} default: 1024 the key size in bit\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\n * - log {boolean} default: false whether log warn/error or not\n * @constructor\n */\nvar JSEncrypt = /** @class */ (function () {\n function JSEncrypt(options) {\n if (options === void 0) { options = {}; }\n options = options || {};\n this.default_key_size = options.default_key_size ? parseInt(options.default_key_size, 10) : 1024;\n this.default_public_exponent = options.default_public_exponent || \"010001\"; // 65537 default openssl public exponent for rsa key type\n this.log = options.log || false;\n // The private and public key.\n this.key = null;\n }\n /**\n * Method to set the rsa key parameter (one method is enough to set both the public\n * and the private key, since the private key contains the public key paramenters)\n * Log a warning if logs are enabled\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\n * @public\n */\n JSEncrypt.prototype.setKey = function (key) {\n if (this.log && this.key) {\n console.warn(\"A key was already set, overriding existing.\");\n }\n this.key = new JSEncryptRSAKey(key);\n };\n /**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\n JSEncrypt.prototype.setPrivateKey = function (privkey) {\n // Create the key.\n this.setKey(privkey);\n };\n /**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\n JSEncrypt.prototype.setPublicKey = function (pubkey) {\n // Sets the public key.\n this.setKey(pubkey);\n };\n /**\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} str base64 encoded crypted string to decrypt\n * @return {string} the decrypted string\n * @public\n */\n JSEncrypt.prototype.decrypt = function (str) {\n // Return the decrypted string.\n try {\n return this.getKey().decrypt(b64tohex(str));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} str the string to encrypt\n * @return {string} the encrypted string encoded in base64\n * @public\n */\n JSEncrypt.prototype.encrypt = function (str) {\n // Return the encrypted string.\n try {\n return hex2b64(this.getKey().encrypt(str));\n }\n catch (ex) {\n return false;\n }\n };\n // 超长文本加密\n JSEncrypt.prototype.encryptLong = function (str) {\n try {\n return hex2b64(this.getKey().encryptLong(str));\n }\n catch (ex) {\n return false;\n }\n };\n // 超长文本解密\n JSEncrypt.prototype.decryptLong = function (str) {\n try {\n return this.getKey().decryptLong(b64tohex(str));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's sign.\n * @param {string} str the string to sign\n * @param {function} digestMethod hash method\n * @param {string} digestName the name of the hash algorithm\n * @return {string} the signature encoded in base64\n * @public\n */\n JSEncrypt.prototype.sign = function (str, digestMethod, digestName) {\n // return the RSA signature of 'str' in 'hex' format.\n try {\n return hex2b64(this.getKey().sign(str, digestMethod, digestName));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's verify.\n * @param {string} str the string to verify\n * @param {string} signature the signature encoded in base64 to compare the string to\n * @param {function} digestMethod hash method\n * @return {boolean} whether the data and signature match\n * @public\n */\n JSEncrypt.prototype.verify = function (str, signature, digestMethod) {\n // Return the decrypted 'digest' of the signature.\n try {\n return this.getKey().verify(str, b64tohex(signature), digestMethod);\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\n * will be created and returned\n * @param {callback} [cb] the callback to be called if we want the key to be generated\n * in an async fashion\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\n * @public\n */\n JSEncrypt.prototype.getKey = function (cb) {\n // Only create new if it does not exist.\n if (!this.key) {\n // Get a new private key.\n this.key = new JSEncryptRSAKey();\n if (cb && {}.toString.call(cb) === \"[object Function]\") {\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\n return;\n }\n // Generate the key.\n this.key.generate(this.default_key_size, this.default_public_exponent);\n }\n return this.key;\n };\n /**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITH header and footer\n * @public\n */\n JSEncrypt.prototype.getPrivateKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateKey();\n };\n /**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\n * @public\n */\n JSEncrypt.prototype.getPrivateKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateBaseKeyB64();\n };\n /**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITH header and footer\n * @public\n */\n JSEncrypt.prototype.getPublicKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicKey();\n };\n /**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\n * @public\n */\n JSEncrypt.prototype.getPublicKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicBaseKeyB64();\n };\n JSEncrypt.version = version.version;\n return JSEncrypt;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } });\n","var __TEMP__ = require('./util');var int2char = __TEMP__['int2char'];\nvar b64map = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar b64pad = \"=\";\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function hex2b64(h) {\n var i;\n var c;\n var ret = \"\";\n for (i = 0; i + 3 <= h.length; i += 3) {\n c = parseInt(h.substring(i, i + 3), 16);\n ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);\n }\n if (i + 1 == h.length) {\n c = parseInt(h.substring(i, i + 1), 16);\n ret += b64map.charAt(c << 2);\n }\n else if (i + 2 == h.length) {\n c = parseInt(h.substring(i, i + 2), 16);\n ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);\n }\n while ((ret.length & 3) > 0) {\n ret += b64pad;\n }\n return ret;\n};exports.hex2b64 = hex2b64\n// convert a base64 string to hex\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function b64tohex(s) {\n var ret = \"\";\n var i;\n var k = 0; // b64 state, 0-3\n var slop = 0;\n for (i = 0; i < s.length; ++i) {\n if (s.charAt(i) == b64pad) {\n break;\n }\n var v = b64map.indexOf(s.charAt(i));\n if (v < 0) {\n continue;\n }\n if (k == 0) {\n ret += int2char(v >> 2);\n slop = v & 3;\n k = 1;\n }\n else if (k == 1) {\n ret += int2char((slop << 2) | (v >> 4));\n slop = v & 0xf;\n k = 2;\n }\n else if (k == 2) {\n ret += int2char(slop);\n ret += int2char(v >> 2);\n slop = v & 3;\n k = 3;\n }\n else {\n ret += int2char((slop << 2) | (v >> 4));\n ret += int2char(v & 0xf);\n k = 0;\n }\n }\n if (k == 1) {\n ret += int2char(slop << 2);\n }\n return ret;\n};exports.b64tohex = b64tohex\n// convert a base64 string to a byte/number array\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function b64toBA(s) {\n // piggyback on b64tohex for now, optimize later\n var h = b64tohex(s);\n var i;\n var a = [];\n for (i = 0; 2 * i < h.length; ++i) {\n a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);\n }\n return a;\n};exports.b64toBA = b64toBA\n","var BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function int2char(n) {\n return BI_RM.charAt(n);\n};exports.int2char = int2char\n//#region BIT_OPERATIONS\n// (public) this & a\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_and(x, y) {\n return x & y;\n};exports.op_and = op_and\n// (public) this | a\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_or(x, y) {\n return x | y;\n};exports.op_or = op_or\n// (public) this ^ a\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_xor(x, y) {\n return x ^ y;\n};exports.op_xor = op_xor\n// (public) this & ~a\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_andnot(x, y) {\n return x & ~y;\n};exports.op_andnot = op_andnot\n// return index of lowest 1-bit in x, x < 2^31\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function lbit(x) {\n if (x == 0) {\n return -1;\n }\n var r = 0;\n if ((x & 0xffff) == 0) {\n x >>= 16;\n r += 16;\n }\n if ((x & 0xff) == 0) {\n x >>= 8;\n r += 8;\n }\n if ((x & 0xf) == 0) {\n x >>= 4;\n r += 4;\n }\n if ((x & 3) == 0) {\n x >>= 2;\n r += 2;\n }\n if ((x & 1) == 0) {\n ++r;\n }\n return r;\n};exports.lbit = lbit\n// return number of 1 bits in x\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function cbit(x) {\n var r = 0;\n while (x != 0) {\n x &= x - 1;\n ++r;\n }\n return r;\n};exports.cbit = cbit\n//#endregion BIT_OPERATIONS\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __TEMP__ = require('./lib/jsbn/base64');var hex2b64 = __TEMP__['hex2b64'];\nvar __TEMP__ = require('./lib/asn1js/hex');var Hex = __TEMP__['Hex'];\nvar __TEMP__ = require('./lib/asn1js/base64');var Base64 = __TEMP__['Base64'];\nvar __TEMP__ = require('./lib/asn1js/asn1');var ASN1 = __TEMP__['ASN1'];\nvar __TEMP__ = require('./lib/jsbn/rsa');var RSAKey = __TEMP__['RSAKey'];\nvar __TEMP__ = require('./lib/jsbn/jsbn');var parseBigInt = __TEMP__['parseBigInt'];\nvar __TEMP__ = require('./lib/jsrsasign/asn1-1.0');var KJUR = __TEMP__['KJUR'];\n/**\n * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.\n * This object is just a decorator for parsing the key parameter\n * @param {string|Object} key - The key in string format, or an object containing\n * the parameters needed to build a RSAKey object.\n * @constructor\n */\nvar JSEncryptRSAKey = /** @class */ (function (_super) {\n __extends(JSEncryptRSAKey, _super);\n function JSEncryptRSAKey(key) {\n var _this = _super.call(this) || this;\n // Call the super constructor.\n // RSAKey.call(this);\n // If a key key was provided.\n if (key) {\n // If this is a string...\n if (typeof key === \"string\") {\n _this.parseKey(key);\n }\n else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) ||\n JSEncryptRSAKey.hasPublicKeyProperty(key)) {\n // Set the values for the key.\n _this.parsePropertiesFrom(key);\n }\n }\n return _this;\n }\n /**\n * Method to parse a pem encoded string containing both a public or private key.\n * The method will translate the pem encoded string in a der encoded string and\n * will parse private key and public key parameters. This method accepts public key\n * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).\n *\n * @todo Check how many rsa formats use the same format of pkcs #1.\n *\n * The format is defined as:\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * it's possible to examine the structure of the keys obtained from openssl using\n * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/\n * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer\n * @private\n */\n JSEncryptRSAKey.prototype.parseKey = function (pem) {\n try {\n var modulus = 0;\n var public_exponent = 0;\n var reHex = /^\\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\\s*)+$/;\n var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);\n var asn1 = ASN1.decode(der);\n // Fixes a bug with OpenSSL 1.0+ private keys\n if (asn1.sub.length === 3) {\n asn1 = asn1.sub[2].sub[0];\n }\n if (asn1.sub.length === 9) {\n // Parse the private key.\n modulus = asn1.sub[1].getHexStringValue(); // bigint\n this.n = parseBigInt(modulus, 16);\n public_exponent = asn1.sub[2].getHexStringValue(); // int\n this.e = parseInt(public_exponent, 16);\n var private_exponent = asn1.sub[3].getHexStringValue(); // bigint\n this.d = parseBigInt(private_exponent, 16);\n var prime1 = asn1.sub[4].getHexStringValue(); // bigint\n this.p = parseBigInt(prime1, 16);\n var prime2 = asn1.sub[5].getHexStringValue(); // bigint\n this.q = parseBigInt(prime2, 16);\n var exponent1 = asn1.sub[6].getHexStringValue(); // bigint\n this.dmp1 = parseBigInt(exponent1, 16);\n var exponent2 = asn1.sub[7].getHexStringValue(); // bigint\n this.dmq1 = parseBigInt(exponent2, 16);\n var coefficient = asn1.sub[8].getHexStringValue(); // bigint\n this.coeff = parseBigInt(coefficient, 16);\n }\n else if (asn1.sub.length === 2) {\n // Parse the public key.\n var bit_string = asn1.sub[1];\n var sequence = bit_string.sub[0];\n modulus = sequence.sub[0].getHexStringValue();\n this.n = parseBigInt(modulus, 16);\n public_exponent = sequence.sub[1].getHexStringValue();\n this.e = parseInt(public_exponent, 16);\n }\n else {\n return false;\n }\n return true;\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Translate rsa parameters in a hex encoded string representing the rsa key.\n *\n * The translation follow the ASN.1 notation :\n * RSAPrivateKey ::= SEQUENCE {\n * version Version,\n * modulus INTEGER, -- n\n * publicExponent INTEGER, -- e\n * privateExponent INTEGER, -- d\n * prime1 INTEGER, -- p\n * prime2 INTEGER, -- q\n * exponent1 INTEGER, -- d mod (p1)\n * exponent2 INTEGER, -- d mod (q-1)\n * coefficient INTEGER, -- (inverse of q) mod p\n * }\n * @returns {string} DER Encoded String representing the rsa private key\n * @private\n */\n JSEncryptRSAKey.prototype.getPrivateBaseKey = function () {\n var options = {\n array: [\n new KJUR.asn1.DERInteger({ int: 0 }),\n new KJUR.asn1.DERInteger({ bigint: this.n }),\n new KJUR.asn1.DERInteger({ int: this.e }),\n new KJUR.asn1.DERInteger({ bigint: this.d }),\n new KJUR.asn1.DERInteger({ bigint: this.p }),\n new KJUR.asn1.DERInteger({ bigint: this.q }),\n new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),\n new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),\n new KJUR.asn1.DERInteger({ bigint: this.coeff })\n ]\n };\n var seq = new KJUR.asn1.DERSequence(options);\n return seq.getEncodedHex();\n };\n /**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function () {\n return hex2b64(this.getPrivateBaseKey());\n };\n /**\n * Translate rsa parameters in a hex encoded string representing the rsa public key.\n * The representation follow the ASN.1 notation :\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * @returns {string} DER Encoded String representing the rsa public key\n * @private\n */\n JSEncryptRSAKey.prototype.getPublicBaseKey = function () {\n var first_sequence = new KJUR.asn1.DERSequence({\n array: [\n new KJUR.asn1.DERObjectIdentifier({ oid: \"1.2.840.113549.1.1.1\" }),\n new KJUR.asn1.DERNull()\n ]\n });\n var second_sequence = new KJUR.asn1.DERSequence({\n array: [\n new KJUR.asn1.DERInteger({ bigint: this.n }),\n new KJUR.asn1.DERInteger({ int: this.e })\n ]\n });\n var bit_string = new KJUR.asn1.DERBitString({\n hex: \"00\" + second_sequence.getEncodedHex()\n });\n var seq = new KJUR.asn1.DERSequence({\n array: [\n first_sequence,\n bit_string\n ]\n });\n return seq.getEncodedHex();\n };\n /**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function () {\n return hex2b64(this.getPublicBaseKey());\n };\n /**\n * wrap the string in block of width chars. The default value for rsa keys is 64\n * characters.\n * @param {string} str the pem encoded string without header and footer\n * @param {Number} [width=64] - the length the string has to be wrapped at\n * @returns {string}\n * @private\n */\n JSEncryptRSAKey.wordwrap = function (str, width) {\n width = width || 64;\n if (!str) {\n return str;\n }\n var regex = \"(.{1,\" + width + \"})( +|$\\n?)|(.{1,\" + width + \"})\";\n return str.match(RegExp(regex, \"g\")).join(\"\\n\");\n };\n /**\n * Retrieve the pem encoded private key\n * @returns {string} the pem encoded private key with header/footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPrivateKey = function () {\n var key = \"-----BEGIN RSA PRIVATE KEY-----\\n\";\n key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + \"\\n\";\n key += \"-----END RSA PRIVATE KEY-----\";\n return key;\n };\n /**\n * Retrieve the pem encoded public key\n * @returns {string} the pem encoded public key with header/footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPublicKey = function () {\n var key = \"-----BEGIN PUBLIC KEY-----\\n\";\n key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + \"\\n\";\n key += \"-----END PUBLIC KEY-----\";\n return key;\n };\n /**\n * Check if the object contains the necessary parameters to populate the rsa modulus\n * and public exponent parameters.\n * @param {Object} [obj={}] - An object that may contain the two public key\n * parameters\n * @returns {boolean} true if the object contains both the modulus and the public exponent\n * properties (n and e)\n * @todo check for types of n and e. N should be a parseable bigInt object, E should\n * be a parseable integer number\n * @private\n */\n JSEncryptRSAKey.hasPublicKeyProperty = function (obj) {\n obj = obj || {};\n return (obj.hasOwnProperty(\"n\") &&\n obj.hasOwnProperty(\"e\"));\n };\n /**\n * Check if the object contains ALL the parameters of an RSA key.\n * @param {Object} [obj={}] - An object that may contain nine rsa key\n * parameters\n * @returns {boolean} true if the object contains all the parameters needed\n * @todo check for types of the parameters all the parameters but the public exponent\n * should be parseable bigint objects, the public exponent should be a parseable integer number\n * @private\n */\n JSEncryptRSAKey.hasPrivateKeyProperty = function (obj) {\n obj = obj || {};\n return (obj.hasOwnProperty(\"n\") &&\n obj.hasOwnProperty(\"e\") &&\n obj.hasOwnProperty(\"d\") &&\n obj.hasOwnProperty(\"p\") &&\n obj.hasOwnProperty(\"q\") &&\n obj.hasOwnProperty(\"dmp1\") &&\n obj.hasOwnProperty(\"dmq1\") &&\n obj.hasOwnProperty(\"coeff\"));\n };\n /**\n * Parse the properties of obj in the current rsa object. Obj should AT LEAST\n * include the modulus and public exponent (n, e) parameters.\n * @param {Object} obj - the object containing rsa parameters\n * @private\n */\n JSEncryptRSAKey.prototype.parsePropertiesFrom = function (obj) {\n this.n = obj.n;\n this.e = obj.e;\n if (obj.hasOwnProperty(\"d\")) {\n this.d = obj.d;\n this.p = obj.p;\n this.q = obj.q;\n this.dmp1 = obj.dmp1;\n this.dmq1 = obj.dmq1;\n this.coeff = obj.coeff;\n }\n };\n return JSEncryptRSAKey;\n}(RSAKey));\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncryptRSAKey', { enumerable: true, configurable: true, get: function() { return JSEncryptRSAKey; } });\n","// Hex JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var Hex = exports.Hex = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var hex = \"0123456789ABCDEF\";\n var ignore = \" \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = {};\n for (i = 0; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n hex = hex.toLowerCase();\n for (i = 10; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n for (i = 0; i < ignore.length; ++i) {\n decoder[ignore.charAt(i)] = -1;\n }\n }\n var out = [];\n var bits = 0;\n var char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == \"=\") {\n break;\n }\n c = decoder[c];\n if (c == -1) {\n continue;\n }\n if (c === undefined) {\n throw new Error(\"Illegal character at offset \" + i);\n }\n bits |= c;\n if (++char_count >= 2) {\n out[out.length] = bits;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 4;\n }\n }\n if (char_count) {\n throw new Error(\"Hex encoding incomplete: 4 bits missing\");\n }\n return out;\n }\n};\n","// Base64 JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var Base64 = exports.Base64 = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var ignore = \"= \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = Object.create(null);\n for (i = 0; i < 64; ++i) {\n decoder[b64.charAt(i)] = i;\n }\n decoder['-'] = 62; //+\n decoder['_'] = 63; //-\n for (i = 0; i < ignore.length; ++i) {\n decoder[ignore.charAt(i)] = -1;\n }\n }\n var out = [];\n var bits = 0;\n var char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == \"=\") {\n break;\n }\n c = decoder[c];\n if (c == -1) {\n continue;\n }\n if (c === undefined) {\n throw new Error(\"Illegal character at offset \" + i);\n }\n bits |= c;\n if (++char_count >= 4) {\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n out[out.length] = bits & 0xFF;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 6;\n }\n }\n switch (char_count) {\n case 1:\n throw new Error(\"Base64 encoding incomplete: at least 2 bits missing\");\n case 2:\n out[out.length] = (bits >> 10);\n break;\n case 3:\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n break;\n }\n return out;\n },\n re: /-----BEGIN [^-]+-----([A-Za-z0-9+\\/=\\s]+)-----END [^-]+-----|begin-base64[^\\n]+\\n([A-Za-z0-9+\\/=\\s]+)====/,\n unarmor: function (a) {\n var m = Base64.re.exec(a);\n if (m) {\n if (m[1]) {\n a = m[1];\n }\n else if (m[2]) {\n a = m[2];\n }\n else {\n throw new Error(\"RegExp out of sync\");\n }\n }\n return Base64.decode(a);\n }\n};\n","// ASN.1 JavaScript decoder\n// Copyright (c) 2008-2014 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\n/*global oids */\nvar __TEMP__ = require('./int10');var Int10 = __TEMP__['Int10'];\nvar ellipsis = \"\\u2026\";\nvar reTimeS = /^(\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\nvar reTimeL = /^(\\d\\d\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\nfunction stringCut(str, len) {\n if (str.length > len) {\n str = str.substring(0, len) + ellipsis;\n }\n return str;\n}\nvar Stream = /** @class */ (function () {\n function Stream(enc, pos) {\n this.hexDigits = \"0123456789ABCDEF\";\n if (enc instanceof Stream) {\n this.enc = enc.enc;\n this.pos = enc.pos;\n }\n else {\n // enc should be an array or a binary string\n this.enc = enc;\n this.pos = pos;\n }\n }\n Stream.prototype.get = function (pos) {\n if (pos === undefined) {\n pos = this.pos++;\n }\n if (pos >= this.enc.length) {\n throw new Error(\"Requesting byte offset \" + pos + \" on a stream of length \" + this.enc.length);\n }\n return (\"string\" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos];\n };\n Stream.prototype.hexByte = function (b) {\n return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF);\n };\n Stream.prototype.hexDump = function (start, end, raw) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n if (raw !== true) {\n switch (i & 0xF) {\n case 0x7:\n s += \" \";\n break;\n case 0xF:\n s += \"\\n\";\n break;\n default:\n s += \" \";\n }\n }\n }\n return s;\n };\n Stream.prototype.isASCII = function (start, end) {\n for (var i = start; i < end; ++i) {\n var c = this.get(i);\n if (c < 32 || c > 176) {\n return false;\n }\n }\n return true;\n };\n Stream.prototype.parseStringISO = function (start, end) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += String.fromCharCode(this.get(i));\n }\n return s;\n };\n Stream.prototype.parseStringUTF = function (start, end) {\n var s = \"\";\n for (var i = start; i < end;) {\n var c = this.get(i++);\n if (c < 128) {\n s += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F));\n }\n else {\n s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F));\n }\n }\n return s;\n };\n Stream.prototype.parseStringBMP = function (start, end) {\n var str = \"\";\n var hi;\n var lo;\n for (var i = start; i < end;) {\n hi = this.get(i++);\n lo = this.get(i++);\n str += String.fromCharCode((hi << 8) | lo);\n }\n return str;\n };\n Stream.prototype.parseTime = function (start, end, shortYear) {\n var s = this.parseStringISO(start, end);\n var m = (shortYear ? reTimeS : reTimeL).exec(s);\n if (!m) {\n return \"Unrecognized time: \" + s;\n }\n if (shortYear) {\n // to avoid querying the timer, use the fixed range [1970, 2069]\n // it will conform with ITU X.400 [-10, +40] sliding window until 2030\n m[1] = +m[1];\n m[1] += (+m[1] < 70) ? 2000 : 1900;\n }\n s = m[1] + \"-\" + m[2] + \"-\" + m[3] + \" \" + m[4];\n if (m[5]) {\n s += \":\" + m[5];\n if (m[6]) {\n s += \":\" + m[6];\n if (m[7]) {\n s += \".\" + m[7];\n }\n }\n }\n if (m[8]) {\n s += \" UTC\";\n if (m[8] != \"Z\") {\n s += m[8];\n if (m[9]) {\n s += \":\" + m[9];\n }\n }\n }\n return s;\n };\n Stream.prototype.parseInteger = function (start, end) {\n var v = this.get(start);\n var neg = (v > 127);\n var pad = neg ? 255 : 0;\n var len;\n var s = \"\";\n // skip unuseful bits (not allowed in DER)\n while (v == pad && ++start < end) {\n v = this.get(start);\n }\n len = end - start;\n if (len === 0) {\n return neg ? -1 : 0;\n }\n // show bit length of huge integers\n if (len > 4) {\n s = v;\n len <<= 3;\n while (((+s ^ pad) & 0x80) == 0) {\n s = +s << 1;\n --len;\n }\n s = \"(\" + len + \" bit)\\n\";\n }\n // decode the integer\n if (neg) {\n v = v - 256;\n }\n var n = new Int10(v);\n for (var i = start + 1; i < end; ++i) {\n n.mulAdd(256, this.get(i));\n }\n return s + n.toString();\n };\n Stream.prototype.parseBitString = function (start, end, maxLength) {\n var unusedBit = this.get(start);\n var lenBit = ((end - start - 1) << 3) - unusedBit;\n var intro = \"(\" + lenBit + \" bit)\\n\";\n var s = \"\";\n for (var i = start + 1; i < end; ++i) {\n var b = this.get(i);\n var skip = (i == end - 1) ? unusedBit : 0;\n for (var j = 7; j >= skip; --j) {\n s += (b >> j) & 1 ? \"1\" : \"0\";\n }\n if (s.length > maxLength) {\n return intro + stringCut(s, maxLength);\n }\n }\n return intro + s;\n };\n Stream.prototype.parseOctetString = function (start, end, maxLength) {\n if (this.isASCII(start, end)) {\n return stringCut(this.parseStringISO(start, end), maxLength);\n }\n var len = end - start;\n var s = \"(\" + len + \" byte)\\n\";\n maxLength /= 2; // we work in bytes\n if (len > maxLength) {\n end = start + maxLength;\n }\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n }\n if (len > maxLength) {\n s += ellipsis;\n }\n return s;\n };\n Stream.prototype.parseOID = function (start, end, maxLength) {\n var s = \"\";\n var n = new Int10();\n var bits = 0;\n for (var i = start; i < end; ++i) {\n var v = this.get(i);\n n.mulAdd(128, v & 0x7F);\n bits += 7;\n if (!(v & 0x80)) { // finished\n if (s === \"\") {\n n = n.simplify();\n if (n instanceof Int10) {\n n.sub(80);\n s = \"2.\" + n.toString();\n }\n else {\n var m = n < 80 ? n < 40 ? 0 : 1 : 2;\n s = m + \".\" + (n - m * 40);\n }\n }\n else {\n s += \".\" + n.toString();\n }\n if (s.length > maxLength) {\n return stringCut(s, maxLength);\n }\n n = new Int10();\n bits = 0;\n }\n }\n if (bits > 0) {\n s += \".incomplete\";\n }\n return s;\n };\n return Stream;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Stream', { enumerable: true, configurable: true, get: function() { return Stream; } });\nvar ASN1 = /** @class */ (function () {\n function ASN1(stream, header, length, tag, sub) {\n if (!(tag instanceof ASN1Tag)) {\n throw new Error(\"Invalid tag value.\");\n }\n this.stream = stream;\n this.header = header;\n this.length = length;\n this.tag = tag;\n this.sub = sub;\n }\n ASN1.prototype.typeName = function () {\n switch (this.tag.tagClass) {\n case 0: // universal\n switch (this.tag.tagNumber) {\n case 0x00:\n return \"EOC\";\n case 0x01:\n return \"BOOLEAN\";\n case 0x02:\n return \"INTEGER\";\n case 0x03:\n return \"BIT_STRING\";\n case 0x04:\n return \"OCTET_STRING\";\n case 0x05:\n return \"NULL\";\n case 0x06:\n return \"OBJECT_IDENTIFIER\";\n case 0x07:\n return \"ObjectDescriptor\";\n case 0x08:\n return \"EXTERNAL\";\n case 0x09:\n return \"REAL\";\n case 0x0A:\n return \"ENUMERATED\";\n case 0x0B:\n return \"EMBEDDED_PDV\";\n case 0x0C:\n return \"UTF8String\";\n case 0x10:\n return \"SEQUENCE\";\n case 0x11:\n return \"SET\";\n case 0x12:\n return \"NumericString\";\n case 0x13:\n return \"PrintableString\"; // ASCII subset\n case 0x14:\n return \"TeletexString\"; // aka T61String\n case 0x15:\n return \"VideotexString\";\n case 0x16:\n return \"IA5String\"; // ASCII\n case 0x17:\n return \"UTCTime\";\n case 0x18:\n return \"GeneralizedTime\";\n case 0x19:\n return \"GraphicString\";\n case 0x1A:\n return \"VisibleString\"; // ASCII subset\n case 0x1B:\n return \"GeneralString\";\n case 0x1C:\n return \"UniversalString\";\n case 0x1E:\n return \"BMPString\";\n }\n return \"Universal_\" + this.tag.tagNumber.toString();\n case 1:\n return \"Application_\" + this.tag.tagNumber.toString();\n case 2:\n return \"[\" + this.tag.tagNumber.toString() + \"]\"; // Context\n case 3:\n return \"Private_\" + this.tag.tagNumber.toString();\n }\n };\n ASN1.prototype.content = function (maxLength) {\n if (this.tag === undefined) {\n return null;\n }\n if (maxLength === undefined) {\n maxLength = Infinity;\n }\n var content = this.posContent();\n var len = Math.abs(this.length);\n if (!this.tag.isUniversal()) {\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n return this.stream.parseOctetString(content, content + len, maxLength);\n }\n switch (this.tag.tagNumber) {\n case 0x01: // BOOLEAN\n return (this.stream.get(content) === 0) ? \"false\" : \"true\";\n case 0x02: // INTEGER\n return this.stream.parseInteger(content, content + len);\n case 0x03: // BIT_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseBitString(content, content + len, maxLength);\n case 0x04: // OCTET_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseOctetString(content, content + len, maxLength);\n // case 0x05: // NULL\n case 0x06: // OBJECT_IDENTIFIER\n return this.stream.parseOID(content, content + len, maxLength);\n // case 0x07: // ObjectDescriptor\n // case 0x08: // EXTERNAL\n // case 0x09: // REAL\n // case 0x0A: // ENUMERATED\n // case 0x0B: // EMBEDDED_PDV\n case 0x10: // SEQUENCE\n case 0x11: // SET\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n else {\n return \"(no elem)\";\n }\n case 0x0C: // UTF8String\n return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);\n case 0x12: // NumericString\n case 0x13: // PrintableString\n case 0x14: // TeletexString\n case 0x15: // VideotexString\n case 0x16: // IA5String\n // case 0x19: // GraphicString\n case 0x1A: // VisibleString\n // case 0x1B: // GeneralString\n // case 0x1C: // UniversalString\n return stringCut(this.stream.parseStringISO(content, content + len), maxLength);\n case 0x1E: // BMPString\n return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);\n case 0x17: // UTCTime\n case 0x18: // GeneralizedTime\n return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17));\n }\n return null;\n };\n ASN1.prototype.toString = function () {\n return this.typeName() + \"@\" + this.stream.pos + \"[header:\" + this.header + \",length:\" + this.length + \",sub:\" + ((this.sub === null) ? \"null\" : this.sub.length) + \"]\";\n };\n ASN1.prototype.toPrettyString = function (indent) {\n if (indent === undefined) {\n indent = \"\";\n }\n var s = indent + this.typeName() + \" @\" + this.stream.pos;\n if (this.length >= 0) {\n s += \"+\";\n }\n s += this.length;\n if (this.tag.tagConstructed) {\n s += \" (constructed)\";\n }\n else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) {\n s += \" (encapsulates)\";\n }\n s += \"\\n\";\n if (this.sub !== null) {\n indent += \" \";\n for (var i = 0, max = this.sub.length; i < max; ++i) {\n s += this.sub[i].toPrettyString(indent);\n }\n }\n return s;\n };\n ASN1.prototype.posStart = function () {\n return this.stream.pos;\n };\n ASN1.prototype.posContent = function () {\n return this.stream.pos + this.header;\n };\n ASN1.prototype.posEnd = function () {\n return this.stream.pos + this.header + Math.abs(this.length);\n };\n ASN1.prototype.toHexString = function () {\n return this.stream.hexDump(this.posStart(), this.posEnd(), true);\n };\n ASN1.decodeLength = function (stream) {\n var buf = stream.get();\n var len = buf & 0x7F;\n if (len == buf) {\n return len;\n }\n // no reason to use Int10, as it would be a huge buffer anyways\n if (len > 6) {\n throw new Error(\"Length over 48 bits not supported at position \" + (stream.pos - 1));\n }\n if (len === 0) {\n return null;\n } // undefined\n buf = 0;\n for (var i = 0; i < len; ++i) {\n buf = (buf * 256) + stream.get();\n }\n return buf;\n };\n /**\n * Retrieve the hexadecimal value (as a string) of the current ASN.1 element\n * @returns {string}\n * @public\n */\n ASN1.prototype.getHexStringValue = function () {\n var hexString = this.toHexString();\n var offset = this.header * 2;\n var length = this.length * 2;\n return hexString.substr(offset, length);\n };\n ASN1.decode = function (str) {\n var stream;\n if (!(str instanceof Stream)) {\n stream = new Stream(str, 0);\n }\n else {\n stream = str;\n }\n var streamStart = new Stream(stream);\n var tag = new ASN1Tag(stream);\n var len = ASN1.decodeLength(stream);\n var start = stream.pos;\n var header = start - streamStart.pos;\n var sub = null;\n var getSub = function () {\n var ret = [];\n if (len !== null) {\n // definite length\n var end = start + len;\n while (stream.pos < end) {\n ret[ret.length] = ASN1.decode(stream);\n }\n if (stream.pos != end) {\n throw new Error(\"Content size is not correct for container starting at offset \" + start);\n }\n }\n else {\n // undefined length\n try {\n for (;;) {\n var s = ASN1.decode(stream);\n if (s.tag.isEOC()) {\n break;\n }\n ret[ret.length] = s;\n }\n len = start - stream.pos; // undefined lengths are represented as negative values\n }\n catch (e) {\n throw new Error(\"Exception while decoding undefined length content: \" + e);\n }\n }\n return ret;\n };\n if (tag.tagConstructed) {\n // must have valid content\n sub = getSub();\n }\n else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) {\n // sometimes BitString and OctetString are used to encapsulate ASN.1\n try {\n if (tag.tagNumber == 0x03) {\n if (stream.get() != 0) {\n throw new Error(\"BIT STRINGs with unused bits cannot encapsulate.\");\n }\n }\n sub = getSub();\n for (var i = 0; i < sub.length; ++i) {\n if (sub[i].tag.isEOC()) {\n throw new Error(\"EOC is not supposed to be actual content.\");\n }\n }\n }\n catch (e) {\n // but silently ignore when they don't\n sub = null;\n }\n }\n if (sub === null) {\n if (len === null) {\n throw new Error(\"We can't skip over an invalid tag with undefined length at offset \" + start);\n }\n stream.pos = start + Math.abs(len);\n }\n return new ASN1(streamStart, header, len, tag, sub);\n };\n return ASN1;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'ASN1', { enumerable: true, configurable: true, get: function() { return ASN1; } });\nvar ASN1Tag = /** @class */ (function () {\n function ASN1Tag(stream) {\n var buf = stream.get();\n this.tagClass = buf >> 6;\n this.tagConstructed = ((buf & 0x20) !== 0);\n this.tagNumber = buf & 0x1F;\n if (this.tagNumber == 0x1F) { // long tag\n var n = new Int10();\n do {\n buf = stream.get();\n n.mulAdd(128, buf & 0x7F);\n } while (buf & 0x80);\n this.tagNumber = n.simplify();\n }\n }\n ASN1Tag.prototype.isUniversal = function () {\n return this.tagClass === 0x00;\n };\n ASN1Tag.prototype.isEOC = function () {\n return this.tagClass === 0x00 && this.tagNumber === 0x00;\n };\n return ASN1Tag;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'ASN1Tag', { enumerable: true, configurable: true, get: function() { return ASN1Tag; } });\n","// Big integer base-10 printing library\n// Copyright (c) 2014 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256\nvar Int10 = /** @class */ (function () {\n function Int10(value) {\n this.buf = [+value || 0];\n }\n Int10.prototype.mulAdd = function (m, c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] * m + c;\n if (t < max) {\n c = 0;\n }\n else {\n c = 0 | (t / max);\n t -= c * max;\n }\n b[i] = t;\n }\n if (c > 0) {\n b[i] = c;\n }\n };\n Int10.prototype.sub = function (c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] - c;\n if (t < 0) {\n t += max;\n c = 1;\n }\n else {\n c = 0;\n }\n b[i] = t;\n }\n while (b[b.length - 1] === 0) {\n b.pop();\n }\n };\n Int10.prototype.toString = function (base) {\n if ((base || 10) != 10) {\n throw new Error(\"only base 10 is supported\");\n }\n var b = this.buf;\n var s = b[b.length - 1].toString();\n for (var i = b.length - 2; i >= 0; --i) {\n s += (max + b[i]).toString().substring(1);\n }\n return s;\n };\n Int10.prototype.valueOf = function () {\n var b = this.buf;\n var v = 0;\n for (var i = b.length - 1; i >= 0; --i) {\n v = v * max + b[i];\n }\n return v;\n };\n Int10.prototype.simplify = function () {\n var b = this.buf;\n return (b.length == 1) ? b[0] : this;\n };\n return Int10;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Int10', { enumerable: true, configurable: true, get: function() { return Int10; } });\n","// Depends on jsbn.js and rng.js\n// Version 1.1: support utf-8 encoding in pkcs1pad2\n// convert a (hex) string to a bignum object\nvar __TEMP__ = require('./jsbn');var BigInteger = __TEMP__['BigInteger'];var nbi = __TEMP__['nbi'];var parseBigInt = __TEMP__['parseBigInt'];\nvar __TEMP__ = require('./rng');var SecureRandom = __TEMP__['SecureRandom'];\n// function linebrk(s,n) {\n// var ret = \"\";\n// var i = 0;\n// while(i + n < s.length) {\n// ret += s.substring(i,i+n) + \"\\n\";\n// i += n;\n// }\n// return ret + s.substring(i,s.length);\n// }\n// function byte2Hex(b) {\n// if(b < 0x10)\n// return \"0\" + b.toString(16);\n// else\n// return b.toString(16);\n// }\nfunction pkcs1pad1(s, n) {\n if (n < s.length + 22) {\n console.error(\"Message too long for RSA\");\n return null;\n }\n var len = n - s.length - 6;\n var filler = \"\";\n for (var f = 0; f < len; f += 2) {\n filler += \"ff\";\n }\n var m = \"0001\" + filler + \"00\" + s;\n return parseBigInt(m, 16);\n}\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\nfunction pkcs1pad2(s, n) {\n if (n < s.length + 11) { // TODO: fix for utf-8\n console.error(\"Message too long for RSA\");\n return null;\n }\n var ba = [];\n var i = s.length - 1;\n while (i >= 0 && n > 0) {\n var c = s.charCodeAt(i--);\n if (c < 128) { // encode using utf-8\n ba[--n] = c;\n }\n else if ((c > 127) && (c < 2048)) {\n ba[--n] = (c & 63) | 128;\n ba[--n] = (c >> 6) | 192;\n }\n else {\n ba[--n] = (c & 63) | 128;\n ba[--n] = ((c >> 6) & 63) | 128;\n ba[--n] = (c >> 12) | 224;\n }\n }\n ba[--n] = 0;\n var rng = new SecureRandom();\n var x = [];\n while (n > 2) { // random non-zero pad\n x[0] = 0;\n while (x[0] == 0) {\n rng.nextBytes(x);\n }\n ba[--n] = x[0];\n }\n ba[--n] = 2;\n ba[--n] = 0;\n return new BigInteger(ba);\n}\n// \"empty\" RSA key constructor\nvar RSAKey = /** @class */ (function () {\n function RSAKey() {\n this.n = null;\n this.e = 0;\n this.d = null;\n this.p = null;\n this.q = null;\n this.dmp1 = null;\n this.dmq1 = null;\n this.coeff = null;\n }\n //#region PROTECTED\n // protected\n // RSAKey.prototype.doPublic = RSADoPublic;\n // Perform raw public operation on \"x\": return x^e (mod n)\n RSAKey.prototype.doPublic = function (x) {\n return x.modPowInt(this.e, this.n);\n };\n // RSAKey.prototype.doPrivate = RSADoPrivate;\n // Perform raw private operation on \"x\": return x^d (mod n)\n RSAKey.prototype.doPrivate = function (x) {\n if (this.p == null || this.q == null) {\n return x.modPow(this.d, this.n);\n }\n // TODO: re-calculate any missing CRT params\n var xp = x.mod(this.p).modPow(this.dmp1, this.p);\n var xq = x.mod(this.q).modPow(this.dmq1, this.q);\n while (xp.compareTo(xq) < 0) {\n xp = xp.add(this.p);\n }\n return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);\n };\n //#endregion PROTECTED\n //#region PUBLIC\n // RSAKey.prototype.setPublic = RSASetPublic;\n // Set the public key fields N and e from hex strings\n RSAKey.prototype.setPublic = function (N, E) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n }\n else {\n console.error(\"Invalid RSA public key\");\n }\n };\n // RSAKey.prototype.encrypt = RSAEncrypt;\n // Return the PKCS#1 RSA encryption of \"text\" as an even-length hex string\n RSAKey.prototype.encrypt = function (text) {\n var maxLength = (this.n.bitLength() + 7) >> 3;\n var m = pkcs1pad2(text, maxLength);\n if (m == null) {\n return null;\n }\n var c = this.doPublic(m);\n if (c == null) {\n return null;\n }\n var h = c.toString(16);\n var length = h.length;\n // fix zero before result\n for (var i = 0; i < maxLength * 2 - length; i++) {\n h = \"0\" + h;\n }\n return h;\n };\n // RSAKey.prototype.setPrivate = RSASetPrivate;\n // Set the private key fields N, e, and d from hex strings\n RSAKey.prototype.setPrivate = function (N, E, D) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n this.d = parseBigInt(D, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.setPrivateEx = RSASetPrivateEx;\n // Set the private key fields N, e, d and CRT params from hex strings\n RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n this.d = parseBigInt(D, 16);\n this.p = parseBigInt(P, 16);\n this.q = parseBigInt(Q, 16);\n this.dmp1 = parseBigInt(DP, 16);\n this.dmq1 = parseBigInt(DQ, 16);\n this.coeff = parseBigInt(C, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.generate = RSAGenerate;\n // Generate a new random private key B bits long, using public expt E\n RSAKey.prototype.generate = function (B, E) {\n var rng = new SecureRandom();\n var qs = B >> 1;\n this.e = parseInt(E, 16);\n var ee = new BigInteger(E, 16);\n for (;;) {\n for (;;) {\n this.p = new BigInteger(B - qs, 1, rng);\n if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) {\n break;\n }\n }\n for (;;) {\n this.q = new BigInteger(qs, 1, rng);\n if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) {\n break;\n }\n }\n if (this.p.compareTo(this.q) <= 0) {\n var t = this.p;\n this.p = this.q;\n this.q = t;\n }\n var p1 = this.p.subtract(BigInteger.ONE);\n var q1 = this.q.subtract(BigInteger.ONE);\n var phi = p1.multiply(q1);\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\n this.n = this.p.multiply(this.q);\n this.d = ee.modInverse(phi);\n this.dmp1 = this.d.mod(p1);\n this.dmq1 = this.d.mod(q1);\n this.coeff = this.q.modInverse(this.p);\n break;\n }\n }\n };\n // RSAKey.prototype.decrypt = RSADecrypt;\n // Return the PKCS#1 RSA decryption of \"ctext\".\n // \"ctext\" is an even-length hex string and the output is a plain string.\n RSAKey.prototype.decrypt = function (ctext) {\n var c = parseBigInt(ctext, 16);\n var m = this.doPrivate(c);\n if (m == null) {\n return null;\n }\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\n };\n // Generate a new random private key B bits long, using public expt E\n RSAKey.prototype.generateAsync = function (B, E, callback) {\n var rng = new SecureRandom();\n var qs = B >> 1;\n this.e = parseInt(E, 16);\n var ee = new BigInteger(E, 16);\n var rsa = this;\n // These functions have non-descript names because they were originally for(;;) loops.\n // I don't know about cryptography to give them better names than loop1-4.\n var loop1 = function () {\n var loop4 = function () {\n if (rsa.p.compareTo(rsa.q) <= 0) {\n var t = rsa.p;\n rsa.p = rsa.q;\n rsa.q = t;\n }\n var p1 = rsa.p.subtract(BigInteger.ONE);\n var q1 = rsa.q.subtract(BigInteger.ONE);\n var phi = p1.multiply(q1);\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\n rsa.n = rsa.p.multiply(rsa.q);\n rsa.d = ee.modInverse(phi);\n rsa.dmp1 = rsa.d.mod(p1);\n rsa.dmq1 = rsa.d.mod(q1);\n rsa.coeff = rsa.q.modInverse(rsa.p);\n setTimeout(function () { callback(); }, 0); // escape\n }\n else {\n setTimeout(loop1, 0);\n }\n };\n var loop3 = function () {\n rsa.q = nbi();\n rsa.q.fromNumberAsync(qs, 1, rng, function () {\n rsa.q.subtract(BigInteger.ONE).gcda(ee, function (r) {\n if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) {\n setTimeout(loop4, 0);\n }\n else {\n setTimeout(loop3, 0);\n }\n });\n });\n };\n var loop2 = function () {\n rsa.p = nbi();\n rsa.p.fromNumberAsync(B - qs, 1, rng, function () {\n rsa.p.subtract(BigInteger.ONE).gcda(ee, function (r) {\n if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) {\n setTimeout(loop3, 0);\n }\n else {\n setTimeout(loop2, 0);\n }\n });\n });\n };\n setTimeout(loop2, 0);\n };\n setTimeout(loop1, 0);\n };\n RSAKey.prototype.sign = function (text, digestMethod, digestName) {\n var header = getDigestHeader(digestName);\n var digest = header + digestMethod(text).toString();\n var m = pkcs1pad1(digest, this.n.bitLength() / 4);\n if (m == null) {\n return null;\n }\n var c = this.doPrivate(m);\n if (c == null) {\n return null;\n }\n var h = c.toString(16);\n if ((h.length & 1) == 0) {\n return h;\n }\n else {\n return \"0\" + h;\n }\n };\n RSAKey.prototype.verify = function (text, signature, digestMethod) {\n var c = parseBigInt(signature, 16);\n var m = this.doPublic(c);\n if (m == null) {\n return null;\n }\n var unpadded = m.toString(16).replace(/^1f+00/, \"\");\n var digest = removeDigestHeader(unpadded);\n return digest == digestMethod(text).toString();\n };\n RSAKey.prototype.encryptLong = function (text) {\n var _this = this;\n var res = '';\n var maxLen = ((this.n.bitLength() + 7) >> 3) - 11;\n var textArr = this.setSplitChn(text, maxLen);\n textArr.forEach(function (v) {\n res += _this.encrypt(v);\n });\n return res;\n };\n RSAKey.prototype.decryptLong = function (ctext) {\n var res = '';\n var maxLen = (this.n.bitLength() + 7) >> 3;\n var splitMaxLen = maxLen * 2;\n if (ctext.length > splitMaxLen) {\n var ctextArr = ctext.match(new RegExp('.{1,' + splitMaxLen + '}', 'g')) || [];\n var mArr = [];\n for (var i = 0; i < ctextArr.length; i++) {\n var c = parseBigInt(ctextArr[i], 16);\n var m = this.doPrivate(c);\n if (m == null) {\n return null;\n }\n mArr.push(m);\n }\n res = pkcs1unpad2Long(mArr, maxLen);\n }\n else {\n res = this.decrypt(ctext);\n }\n return res;\n };\n RSAKey.prototype.setSplitChn = function (str, maxLen, res) {\n if (res === void 0) { res = []; }\n var arr = str.split('');\n var len = 0;\n for (var i = 0; i < arr.length; i++) {\n var charCode = arr[i].charCodeAt(0);\n if (charCode <= 0x007f) {\n len += 1;\n }\n else if (charCode <= 0x07ff) {\n len += 2;\n }\n else if (charCode <= 0xffff) {\n len += 3;\n }\n else {\n len += 4;\n }\n if (len > maxLen) {\n var currentStr = str.substring(0, i);\n res.push(currentStr);\n return this.setSplitChn(str.substring(i), maxLen, res);\n }\n }\n res.push(str);\n return res;\n };\n return RSAKey;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'RSAKey', { enumerable: true, configurable: true, get: function() { return RSAKey; } });\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\nfunction pkcs1unpad2(d, n) {\n var b = d.toByteArray();\n var i = 0;\n while (i < b.length && b[i] == 0) {\n ++i;\n }\n if (b.length - i != n - 1 || b[i] != 2) {\n return null;\n }\n ++i;\n while (b[i] != 0) {\n if (++i >= b.length) {\n return null;\n }\n }\n var ret = \"\";\n while (++i < b.length) {\n var c = b[i] & 255;\n if (c < 128) { // utf-8 decode\n ret += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\n ++i;\n }\n else {\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\n i += 2;\n }\n }\n return ret;\n}\nfunction pkcs1unpad2Long(dArr, n) {\n var bArr = [];\n for (var j = 0; j < dArr.length; j++) {\n var d = dArr[j];\n var b_1 = d.toByteArray();\n var i_1 = 0;\n while (i_1 < b_1.length && b_1[i_1] == 0) {\n ++i_1;\n }\n if (b_1.length - i_1 != n - 1 || b_1[i_1] != 2) {\n return null;\n }\n ++i_1;\n while (b_1[i_1] != 0) {\n if (++i_1 >= b_1.length) {\n return null;\n }\n }\n bArr = bArr.concat(b_1.slice(i_1 + 1));\n }\n var b = bArr;\n var i = -1;\n var ret = \"\";\n while (++i < b.length) {\n var c = b[i] & 255;\n if (c < 128) { // utf-8 decode\n ret += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\n ++i;\n }\n else {\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\n i += 2;\n }\n }\n return ret;\n}\n// https://tools.ietf.org/html/rfc3447#page-43\nvar DIGEST_HEADERS = {\n md2: \"3020300c06082a864886f70d020205000410\",\n md5: \"3020300c06082a864886f70d020505000410\",\n sha1: \"3021300906052b0e03021a05000414\",\n sha224: \"302d300d06096086480165030402040500041c\",\n sha256: \"3031300d060960864801650304020105000420\",\n sha384: \"3041300d060960864801650304020205000430\",\n sha512: \"3051300d060960864801650304020305000440\",\n ripemd160: \"3021300906052b2403020105000414\"\n};\nfunction getDigestHeader(name) {\n return DIGEST_HEADERS[name] || \"\";\n}\nfunction removeDigestHeader(str) {\n for (var name_1 in DIGEST_HEADERS) {\n if (DIGEST_HEADERS.hasOwnProperty(name_1)) {\n var header = DIGEST_HEADERS[name_1];\n var len = header.length;\n if (str.substr(0, len) == header) {\n return str.substr(len);\n }\n }\n }\n return str;\n}\n// Return the PKCS#1 RSA encryption of \"text\" as a Base64-encoded string\n// function RSAEncryptB64(text) {\n// var h = this.encrypt(text);\n// if(h) return hex2b64(h); else return null;\n// }\n// public\n// RSAKey.prototype.encrypt_b64 = RSAEncryptB64;\n","// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n// Basic JavaScript BN library - subset useful for RSA encryption.\nvar __TEMP__ = require('./util');var cbit = __TEMP__['cbit'];var int2char = __TEMP__['int2char'];var lbit = __TEMP__['lbit'];var op_and = __TEMP__['op_and'];var op_andnot = __TEMP__['op_andnot'];var op_or = __TEMP__['op_or'];var op_xor = __TEMP__['op_xor'];\n// Bits per digit\nvar dbits;\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\n//#region\nvar lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\n//#endregion\n// (public) Constructor\nvar BigInteger = /** @class */ (function () {\n function BigInteger(a, b, c) {\n if (a != null) {\n if (\"number\" == typeof a) {\n this.fromNumber(a, b, c);\n }\n else if (b == null && \"string\" != typeof a) {\n this.fromString(a, 256);\n }\n else {\n this.fromString(a, b);\n }\n }\n }\n //#region PUBLIC\n // BigInteger.prototype.toString = bnToString;\n // (public) return string representation in given radix\n BigInteger.prototype.toString = function (b) {\n if (this.s < 0) {\n return \"-\" + this.negate().toString(b);\n }\n var k;\n if (b == 16) {\n k = 4;\n }\n else if (b == 8) {\n k = 3;\n }\n else if (b == 2) {\n k = 1;\n }\n else if (b == 32) {\n k = 5;\n }\n else if (b == 4) {\n k = 2;\n }\n else {\n return this.toRadix(b);\n }\n var km = (1 << k) - 1;\n var d;\n var m = false;\n var r = \"\";\n var i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) {\n m = true;\n }\n if (m) {\n r += int2char(d);\n }\n }\n }\n return m ? r : \"0\";\n };\n // BigInteger.prototype.negate = bnNegate;\n // (public) -this\n BigInteger.prototype.negate = function () {\n var r = nbi();\n BigInteger.ZERO.subTo(this, r);\n return r;\n };\n // BigInteger.prototype.abs = bnAbs;\n // (public) |this|\n BigInteger.prototype.abs = function () {\n return (this.s < 0) ? this.negate() : this;\n };\n // BigInteger.prototype.compareTo = bnCompareTo;\n // (public) return + if this > a, - if this < a, 0 if equal\n BigInteger.prototype.compareTo = function (a) {\n var r = this.s - a.s;\n if (r != 0) {\n return r;\n }\n var i = this.t;\n r = i - a.t;\n if (r != 0) {\n return (this.s < 0) ? -r : r;\n }\n while (--i >= 0) {\n if ((r = this[i] - a[i]) != 0) {\n return r;\n }\n }\n return 0;\n };\n // BigInteger.prototype.bitLength = bnBitLength;\n // (public) return the number of bits in \"this\"\n BigInteger.prototype.bitLength = function () {\n if (this.t <= 0) {\n return 0;\n }\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\n };\n // BigInteger.prototype.mod = bnMod;\n // (public) this mod a\n BigInteger.prototype.mod = function (a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\n a.subTo(r, r);\n }\n return r;\n };\n // BigInteger.prototype.modPowInt = bnModPowInt;\n // (public) this^e % m, 0 <= e < 2^32\n BigInteger.prototype.modPowInt = function (e, m) {\n var z;\n if (e < 256 || m.isEven()) {\n z = new Classic(m);\n }\n else {\n z = new Montgomery(m);\n }\n return this.exp(e, z);\n };\n // BigInteger.prototype.clone = bnClone;\n // (public)\n BigInteger.prototype.clone = function () {\n var r = nbi();\n this.copyTo(r);\n return r;\n };\n // BigInteger.prototype.intValue = bnIntValue;\n // (public) return value as integer\n BigInteger.prototype.intValue = function () {\n if (this.s < 0) {\n if (this.t == 1) {\n return this[0] - this.DV;\n }\n else if (this.t == 0) {\n return -1;\n }\n }\n else if (this.t == 1) {\n return this[0];\n }\n else if (this.t == 0) {\n return 0;\n }\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n };\n // BigInteger.prototype.byteValue = bnByteValue;\n // (public) return value as byte\n BigInteger.prototype.byteValue = function () {\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24;\n };\n // BigInteger.prototype.shortValue = bnShortValue;\n // (public) return value as short (assumes DB>=16)\n BigInteger.prototype.shortValue = function () {\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16;\n };\n // BigInteger.prototype.signum = bnSigNum;\n // (public) 0 if this == 0, 1 if this > 0\n BigInteger.prototype.signum = function () {\n if (this.s < 0) {\n return -1;\n }\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) {\n return 0;\n }\n else {\n return 1;\n }\n };\n // BigInteger.prototype.toByteArray = bnToByteArray;\n // (public) convert to bigendian byte array\n BigInteger.prototype.toByteArray = function () {\n var i = this.t;\n var r = [];\n r[0] = this.s;\n var p = this.DB - (i * this.DB) % 8;\n var d;\n var k = 0;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) {\n r[k++] = d | (this.s << (this.DB - p));\n }\n while (i >= 0) {\n if (p < 8) {\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\n d |= this[--i] >> (p += this.DB - 8);\n }\n else {\n d = (this[i] >> (p -= 8)) & 0xff;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if ((d & 0x80) != 0) {\n d |= -256;\n }\n if (k == 0 && (this.s & 0x80) != (d & 0x80)) {\n ++k;\n }\n if (k > 0 || d != this.s) {\n r[k++] = d;\n }\n }\n }\n return r;\n };\n // BigInteger.prototype.equals = bnEquals;\n BigInteger.prototype.equals = function (a) {\n return (this.compareTo(a) == 0);\n };\n // BigInteger.prototype.min = bnMin;\n BigInteger.prototype.min = function (a) {\n return (this.compareTo(a) < 0) ? this : a;\n };\n // BigInteger.prototype.max = bnMax;\n BigInteger.prototype.max = function (a) {\n return (this.compareTo(a) > 0) ? this : a;\n };\n // BigInteger.prototype.and = bnAnd;\n BigInteger.prototype.and = function (a) {\n var r = nbi();\n this.bitwiseTo(a, op_and, r);\n return r;\n };\n // BigInteger.prototype.or = bnOr;\n BigInteger.prototype.or = function (a) {\n var r = nbi();\n this.bitwiseTo(a, op_or, r);\n return r;\n };\n // BigInteger.prototype.xor = bnXor;\n BigInteger.prototype.xor = function (a) {\n var r = nbi();\n this.bitwiseTo(a, op_xor, r);\n return r;\n };\n // BigInteger.prototype.andNot = bnAndNot;\n BigInteger.prototype.andNot = function (a) {\n var r = nbi();\n this.bitwiseTo(a, op_andnot, r);\n return r;\n };\n // BigInteger.prototype.not = bnNot;\n // (public) ~this\n BigInteger.prototype.not = function () {\n var r = nbi();\n for (var i = 0; i < this.t; ++i) {\n r[i] = this.DM & ~this[i];\n }\n r.t = this.t;\n r.s = ~this.s;\n return r;\n };\n // BigInteger.prototype.shiftLeft = bnShiftLeft;\n // (public) this << n\n BigInteger.prototype.shiftLeft = function (n) {\n var r = nbi();\n if (n < 0) {\n this.rShiftTo(-n, r);\n }\n else {\n this.lShiftTo(n, r);\n }\n return r;\n };\n // BigInteger.prototype.shiftRight = bnShiftRight;\n // (public) this >> n\n BigInteger.prototype.shiftRight = function (n) {\n var r = nbi();\n if (n < 0) {\n this.lShiftTo(-n, r);\n }\n else {\n this.rShiftTo(n, r);\n }\n return r;\n };\n // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\n // (public) returns index of lowest 1-bit (or -1 if none)\n BigInteger.prototype.getLowestSetBit = function () {\n for (var i = 0; i < this.t; ++i) {\n if (this[i] != 0) {\n return i * this.DB + lbit(this[i]);\n }\n }\n if (this.s < 0) {\n return this.t * this.DB;\n }\n return -1;\n };\n // BigInteger.prototype.bitCount = bnBitCount;\n // (public) return number of set bits\n BigInteger.prototype.bitCount = function () {\n var r = 0;\n var x = this.s & this.DM;\n for (var i = 0; i < this.t; ++i) {\n r += cbit(this[i] ^ x);\n }\n return r;\n };\n // BigInteger.prototype.testBit = bnTestBit;\n // (public) true iff nth bit is set\n BigInteger.prototype.testBit = function (n) {\n var j = Math.floor(n / this.DB);\n if (j >= this.t) {\n return (this.s != 0);\n }\n return ((this[j] & (1 << (n % this.DB))) != 0);\n };\n // BigInteger.prototype.setBit = bnSetBit;\n // (public) this | (1< 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n var j = e.t - 1;\n var w;\n var is1 = true;\n var r2 = nbi();\n var t;\n i = nbits(e[j]) - 1;\n while (j >= 0) {\n if (i >= k1) {\n w = (e[j] >> (i - k1)) & km;\n }\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\n if (j > 0) {\n w |= e[j - 1] >> (this.DB + i - k1);\n }\n }\n n = k;\n while ((w & 1) == 0) {\n w >>= 1;\n --n;\n }\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n if (is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n if (n > 0) {\n z.sqrTo(r, r2);\n }\n else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.modInverse = bnModInverse;\n // (public) 1/this % m (HAC 14.61)\n BigInteger.prototype.modInverse = function (m) {\n var ac = m.isEven();\n if ((this.isEven() && ac) || m.signum() == 0) {\n return BigInteger.ZERO;\n }\n var u = m.clone();\n var v = this.clone();\n var a = nbv(1);\n var b = nbv(0);\n var c = nbv(0);\n var d = nbv(1);\n while (u.signum() != 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u);\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a);\n b.subTo(m, b);\n }\n a.rShiftTo(1, a);\n }\n else if (!b.isEven()) {\n b.subTo(m, b);\n }\n b.rShiftTo(1, b);\n }\n while (v.isEven()) {\n v.rShiftTo(1, v);\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c);\n d.subTo(m, d);\n }\n c.rShiftTo(1, c);\n }\n else if (!d.isEven()) {\n d.subTo(m, d);\n }\n d.rShiftTo(1, d);\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u);\n if (ac) {\n a.subTo(c, a);\n }\n b.subTo(d, b);\n }\n else {\n v.subTo(u, v);\n if (ac) {\n c.subTo(a, c);\n }\n d.subTo(b, d);\n }\n }\n if (v.compareTo(BigInteger.ONE) != 0) {\n return BigInteger.ZERO;\n }\n if (d.compareTo(m) >= 0) {\n return d.subtract(m);\n }\n if (d.signum() < 0) {\n d.addTo(m, d);\n }\n else {\n return d;\n }\n if (d.signum() < 0) {\n return d.add(m);\n }\n else {\n return d;\n }\n };\n // BigInteger.prototype.pow = bnPow;\n // (public) this^e\n BigInteger.prototype.pow = function (e) {\n return this.exp(e, new NullExp());\n };\n // BigInteger.prototype.gcd = bnGCD;\n // (public) gcd(this,a) (HAC 14.54)\n BigInteger.prototype.gcd = function (a) {\n var x = (this.s < 0) ? this.negate() : this.clone();\n var y = (a.s < 0) ? a.negate() : a.clone();\n if (x.compareTo(y) < 0) {\n var t = x;\n x = y;\n y = t;\n }\n var i = x.getLowestSetBit();\n var g = y.getLowestSetBit();\n if (g < 0) {\n return x;\n }\n if (i < g) {\n g = i;\n }\n if (g > 0) {\n x.rShiftTo(g, x);\n y.rShiftTo(g, y);\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0) {\n x.rShiftTo(i, x);\n }\n if ((i = y.getLowestSetBit()) > 0) {\n y.rShiftTo(i, y);\n }\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x);\n x.rShiftTo(1, x);\n }\n else {\n y.subTo(x, y);\n y.rShiftTo(1, y);\n }\n }\n if (g > 0) {\n y.lShiftTo(g, y);\n }\n return y;\n };\n // BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n // (public) test primality with certainty >= 1-.5^t\n BigInteger.prototype.isProbablePrime = function (t) {\n var i;\n var x = this.abs();\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\n for (i = 0; i < lowprimes.length; ++i) {\n if (x[0] == lowprimes[i]) {\n return true;\n }\n }\n return false;\n }\n if (x.isEven()) {\n return false;\n }\n i = 1;\n while (i < lowprimes.length) {\n var m = lowprimes[i];\n var j = i + 1;\n while (j < lowprimes.length && m < lplim) {\n m *= lowprimes[j++];\n }\n m = x.modInt(m);\n while (i < j) {\n if (m % lowprimes[i++] == 0) {\n return false;\n }\n }\n }\n return x.millerRabin(t);\n };\n //#endregion PUBLIC\n //#region PROTECTED\n // BigInteger.prototype.copyTo = bnpCopyTo;\n // (protected) copy this to r\n BigInteger.prototype.copyTo = function (r) {\n for (var i = this.t - 1; i >= 0; --i) {\n r[i] = this[i];\n }\n r.t = this.t;\n r.s = this.s;\n };\n // BigInteger.prototype.fromInt = bnpFromInt;\n // (protected) set from integer value x, -DV <= x < DV\n BigInteger.prototype.fromInt = function (x) {\n this.t = 1;\n this.s = (x < 0) ? -1 : 0;\n if (x > 0) {\n this[0] = x;\n }\n else if (x < -1) {\n this[0] = x + this.DV;\n }\n else {\n this.t = 0;\n }\n };\n // BigInteger.prototype.fromString = bnpFromString;\n // (protected) set from string and radix\n BigInteger.prototype.fromString = function (s, b) {\n var k;\n if (b == 16) {\n k = 4;\n }\n else if (b == 8) {\n k = 3;\n }\n else if (b == 256) {\n k = 8;\n /* byte array */\n }\n else if (b == 2) {\n k = 1;\n }\n else if (b == 32) {\n k = 5;\n }\n else if (b == 4) {\n k = 2;\n }\n else {\n this.fromRadix(s, b);\n return;\n }\n this.t = 0;\n this.s = 0;\n var i = s.length;\n var mi = false;\n var sh = 0;\n while (--i >= 0) {\n var x = (k == 8) ? (+s[i]) & 0xff : intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\") {\n mi = true;\n }\n continue;\n }\n mi = false;\n if (sh == 0) {\n this[this.t++] = x;\n }\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = (x >> (this.DB - sh));\n }\n else {\n this[this.t - 1] |= x << sh;\n }\n sh += k;\n if (sh >= this.DB) {\n sh -= this.DB;\n }\n }\n if (k == 8 && ((+s[0]) & 0x80) != 0) {\n this.s = -1;\n if (sh > 0) {\n this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n }\n this.clamp();\n if (mi) {\n BigInteger.ZERO.subTo(this, this);\n }\n };\n // BigInteger.prototype.clamp = bnpClamp;\n // (protected) clamp off excess high words\n BigInteger.prototype.clamp = function () {\n var c = this.s & this.DM;\n while (this.t > 0 && this[this.t - 1] == c) {\n --this.t;\n }\n };\n // BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n // (protected) r = this << n*DB\n BigInteger.prototype.dlShiftTo = function (n, r) {\n var i;\n for (i = this.t - 1; i >= 0; --i) {\n r[i + n] = this[i];\n }\n for (i = n - 1; i >= 0; --i) {\n r[i] = 0;\n }\n r.t = this.t + n;\n r.s = this.s;\n };\n // BigInteger.prototype.drShiftTo = bnpDRShiftTo;\n // (protected) r = this >> n*DB\n BigInteger.prototype.drShiftTo = function (n, r) {\n for (var i = n; i < this.t; ++i) {\n r[i - n] = this[i];\n }\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n };\n // BigInteger.prototype.lShiftTo = bnpLShiftTo;\n // (protected) r = this << n\n BigInteger.prototype.lShiftTo = function (n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB);\n var c = (this.s << bs) & this.DM;\n for (var i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (this[i] >> cbs) | c;\n c = (this[i] & bm) << bs;\n }\n for (var i = ds - 1; i >= 0; --i) {\n r[i] = 0;\n }\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n };\n // BigInteger.prototype.rShiftTo = bnpRShiftTo;\n // (protected) r = this >> n\n BigInteger.prototype.rShiftTo = function (n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n if (bs > 0) {\n r[this.t - ds - 1] |= (this.s & bm) << cbs;\n }\n r.t = this.t - ds;\n r.clamp();\n };\n // BigInteger.prototype.subTo = bnpSubTo;\n // (protected) r = this - a\n BigInteger.prototype.subTo = function (a, r) {\n var i = 0;\n var c = 0;\n var m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c -= a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c < -1) {\n r[i++] = this.DV + c;\n }\n else if (c > 0) {\n r[i++] = c;\n }\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.multiplyTo = bnpMultiplyTo;\n // (protected) r = this * a, r != this,a (HAC 14.12)\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyTo = function (a, r) {\n var x = this.abs();\n var y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n while (--i >= 0) {\n r[i] = 0;\n }\n for (i = 0; i < y.t; ++i) {\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n }\n r.s = 0;\n r.clamp();\n if (this.s != a.s) {\n BigInteger.ZERO.subTo(r, r);\n }\n };\n // BigInteger.prototype.squareTo = bnpSquareTo;\n // (protected) r = this^2, r != this (HAC 14.16)\n BigInteger.prototype.squareTo = function (r) {\n var x = this.abs();\n var i = r.t = 2 * x.t;\n while (--i >= 0) {\n r[i] = 0;\n }\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n if (r.t > 0) {\n r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n }\n r.s = 0;\n r.clamp();\n };\n // BigInteger.prototype.divRemTo = bnpDivRemTo;\n // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n // r != q, this != m. q or r may be null.\n BigInteger.prototype.divRemTo = function (m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0) {\n return;\n }\n var pt = this.abs();\n if (pt.t < pm.t) {\n if (q != null) {\n q.fromInt(0);\n }\n if (r != null) {\n this.copyTo(r);\n }\n return;\n }\n if (r == null) {\n r = nbi();\n }\n var y = nbi();\n var ts = this.s;\n var ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n }\n else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 == 0) {\n return;\n }\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt;\n var d2 = (1 << this.F1) / yt;\n var e = 1 << this.F2;\n var i = r.t;\n var j = i - ys;\n var t = (q == null) ? nbi() : q;\n y.dlShiftTo(j, t);\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n while (y.t < ys) {\n y[y.t++] = 0;\n }\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n while (r[i] < --qd) {\n r.subTo(t, r);\n }\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms) {\n BigInteger.ZERO.subTo(q, q);\n }\n }\n r.t = ys;\n r.clamp();\n if (nsh > 0) {\n r.rShiftTo(nsh, r);\n } // Denormalize remainder\n if (ts < 0) {\n BigInteger.ZERO.subTo(r, r);\n }\n };\n // BigInteger.prototype.invDigit = bnpInvDigit;\n // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n // justification:\n // xy == 1 (mod m)\n // xy = 1+km\n // xy(2-xy) = (1+km)(1-km)\n // x[y(2-xy)] = 1-k^2m^2\n // x[y(2-xy)] == 1 (mod m^2)\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n // JS multiply \"overflows\" differently from C/C++, so care is needed here.\n BigInteger.prototype.invDigit = function () {\n if (this.t < 1) {\n return 0;\n }\n var x = this[0];\n if ((x & 1) == 0) {\n return 0;\n }\n var y = x & 3; // y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y > 0) ? this.DV - y : -y;\n };\n // BigInteger.prototype.isEven = bnpIsEven;\n // (protected) true iff this is even\n BigInteger.prototype.isEven = function () {\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\n };\n // BigInteger.prototype.exp = bnpExp;\n // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n BigInteger.prototype.exp = function (e, z) {\n if (e > 0xffffffff || e < 1) {\n return BigInteger.ONE;\n }\n var r = nbi();\n var r2 = nbi();\n var g = z.convert(this);\n var i = nbits(e) - 1;\n g.copyTo(r);\n while (--i >= 0) {\n z.sqrTo(r, r2);\n if ((e & (1 << i)) > 0) {\n z.mulTo(r2, g, r);\n }\n else {\n var t = r;\n r = r2;\n r2 = t;\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.chunkSize = bnpChunkSize;\n // (protected) return x s.t. r^x < DV\n BigInteger.prototype.chunkSize = function (r) {\n return Math.floor(Math.LN2 * this.DB / Math.log(r));\n };\n // BigInteger.prototype.toRadix = bnpToRadix;\n // (protected) convert to radix string\n BigInteger.prototype.toRadix = function (b) {\n if (b == null) {\n b = 10;\n }\n if (this.signum() == 0 || b < 2 || b > 36) {\n return \"0\";\n }\n var cs = this.chunkSize(b);\n var a = Math.pow(b, cs);\n var d = nbv(a);\n var y = nbi();\n var z = nbi();\n var r = \"\";\n this.divRemTo(d, y, z);\n while (y.signum() > 0) {\n r = (a + z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d, y, z);\n }\n return z.intValue().toString(b) + r;\n };\n // BigInteger.prototype.fromRadix = bnpFromRadix;\n // (protected) convert from radix string\n BigInteger.prototype.fromRadix = function (s, b) {\n this.fromInt(0);\n if (b == null) {\n b = 10;\n }\n var cs = this.chunkSize(b);\n var d = Math.pow(b, cs);\n var mi = false;\n var j = 0;\n var w = 0;\n for (var i = 0; i < s.length; ++i) {\n var x = intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\" && this.signum() == 0) {\n mi = true;\n }\n continue;\n }\n w = b * w + x;\n if (++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w, 0);\n j = 0;\n w = 0;\n }\n }\n if (j > 0) {\n this.dMultiply(Math.pow(b, j));\n this.dAddOffset(w, 0);\n }\n if (mi) {\n BigInteger.ZERO.subTo(this, this);\n }\n };\n // BigInteger.prototype.fromNumber = bnpFromNumber;\n // (protected) alternate constructor\n BigInteger.prototype.fromNumber = function (a, b, c) {\n if (\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2) {\n this.fromInt(1);\n }\n else {\n this.fromNumber(a, c);\n if (!this.testBit(a - 1)) {\n // force MSB set\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\n }\n if (this.isEven()) {\n this.dAddOffset(1, 0);\n } // force odd\n while (!this.isProbablePrime(b)) {\n this.dAddOffset(2, 0);\n if (this.bitLength() > a) {\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\n }\n }\n }\n }\n else {\n // new BigInteger(int,RNG)\n var x = [];\n var t = a & 7;\n x.length = (a >> 3) + 1;\n b.nextBytes(x);\n if (t > 0) {\n x[0] &= ((1 << t) - 1);\n }\n else {\n x[0] = 0;\n }\n this.fromString(x, 256);\n }\n };\n // BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\n // (protected) r = this op a (bitwise)\n BigInteger.prototype.bitwiseTo = function (a, op, r) {\n var i;\n var f;\n var m = Math.min(a.t, this.t);\n for (i = 0; i < m; ++i) {\n r[i] = op(this[i], a[i]);\n }\n if (a.t < this.t) {\n f = a.s & this.DM;\n for (i = m; i < this.t; ++i) {\n r[i] = op(this[i], f);\n }\n r.t = this.t;\n }\n else {\n f = this.s & this.DM;\n for (i = m; i < a.t; ++i) {\n r[i] = op(f, a[i]);\n }\n r.t = a.t;\n }\n r.s = op(this.s, a.s);\n r.clamp();\n };\n // BigInteger.prototype.changeBit = bnpChangeBit;\n // (protected) this op (1<>= this.DB;\n }\n if (a.t < this.t) {\n c += a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c += a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c > 0) {\n r[i++] = c;\n }\n else if (c < -1) {\n r[i++] = this.DV + c;\n }\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.dMultiply = bnpDMultiply;\n // (protected) this *= n, this >= 0, 1 < n < DV\n BigInteger.prototype.dMultiply = function (n) {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\n ++this.t;\n this.clamp();\n };\n // BigInteger.prototype.dAddOffset = bnpDAddOffset;\n // (protected) this += n << w words, this >= 0\n BigInteger.prototype.dAddOffset = function (n, w) {\n if (n == 0) {\n return;\n }\n while (this.t <= w) {\n this[this.t++] = 0;\n }\n this[w] += n;\n while (this[w] >= this.DV) {\n this[w] -= this.DV;\n if (++w >= this.t) {\n this[this.t++] = 0;\n }\n ++this[w];\n }\n };\n // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\n // (protected) r = lower n words of \"this * a\", a.t <= n\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyLowerTo = function (a, n, r) {\n var i = Math.min(this.t + a.t, n);\n r.s = 0; // assumes a,this >= 0\n r.t = i;\n while (i > 0) {\n r[--i] = 0;\n }\n for (var j = r.t - this.t; i < j; ++i) {\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\n }\n for (var j = Math.min(a.t, n); i < j; ++i) {\n this.am(0, a[i], r, i, 0, n - i);\n }\n r.clamp();\n };\n // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\n // (protected) r = \"this * a\" without lower n words, n > 0\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyUpperTo = function (a, n, r) {\n --n;\n var i = r.t = this.t + a.t - n;\n r.s = 0; // assumes a,this >= 0\n while (--i >= 0) {\n r[i] = 0;\n }\n for (i = Math.max(n - this.t, 0); i < a.t; ++i) {\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\n }\n r.clamp();\n r.drShiftTo(1, r);\n };\n // BigInteger.prototype.modInt = bnpModInt;\n // (protected) this % n, n < 2^26\n BigInteger.prototype.modInt = function (n) {\n if (n <= 0) {\n return 0;\n }\n var d = this.DV % n;\n var r = (this.s < 0) ? n - 1 : 0;\n if (this.t > 0) {\n if (d == 0) {\n r = this[0] % n;\n }\n else {\n for (var i = this.t - 1; i >= 0; --i) {\n r = (d * r + this[i]) % n;\n }\n }\n }\n return r;\n };\n // BigInteger.prototype.millerRabin = bnpMillerRabin;\n // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\n BigInteger.prototype.millerRabin = function (t) {\n var n1 = this.subtract(BigInteger.ONE);\n var k = n1.getLowestSetBit();\n if (k <= 0) {\n return false;\n }\n var r = n1.shiftRight(k);\n t = (t + 1) >> 1;\n if (t > lowprimes.length) {\n t = lowprimes.length;\n }\n var a = nbi();\n for (var i = 0; i < t; ++i) {\n // Pick bases at random, instead of starting at 2\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\n var y = a.modPow(r, this);\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1;\n while (j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2, this);\n if (y.compareTo(BigInteger.ONE) == 0) {\n return false;\n }\n }\n if (y.compareTo(n1) != 0) {\n return false;\n }\n }\n }\n return true;\n };\n // BigInteger.prototype.square = bnSquare;\n // (public) this^2\n BigInteger.prototype.square = function () {\n var r = nbi();\n this.squareTo(r);\n return r;\n };\n //#region ASYNC\n // Public API method\n BigInteger.prototype.gcda = function (a, callback) {\n var x = (this.s < 0) ? this.negate() : this.clone();\n var y = (a.s < 0) ? a.negate() : a.clone();\n if (x.compareTo(y) < 0) {\n var t = x;\n x = y;\n y = t;\n }\n var i = x.getLowestSetBit();\n var g = y.getLowestSetBit();\n if (g < 0) {\n callback(x);\n return;\n }\n if (i < g) {\n g = i;\n }\n if (g > 0) {\n x.rShiftTo(g, x);\n y.rShiftTo(g, y);\n }\n // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen.\n var gcda1 = function () {\n if ((i = x.getLowestSetBit()) > 0) {\n x.rShiftTo(i, x);\n }\n if ((i = y.getLowestSetBit()) > 0) {\n y.rShiftTo(i, y);\n }\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x);\n x.rShiftTo(1, x);\n }\n else {\n y.subTo(x, y);\n y.rShiftTo(1, y);\n }\n if (!(x.signum() > 0)) {\n if (g > 0) {\n y.lShiftTo(g, y);\n }\n setTimeout(function () { callback(y); }, 0); // escape\n }\n else {\n setTimeout(gcda1, 0);\n }\n };\n setTimeout(gcda1, 10);\n };\n // (protected) alternate constructor\n BigInteger.prototype.fromNumberAsync = function (a, b, c, callback) {\n if (\"number\" == typeof b) {\n if (a < 2) {\n this.fromInt(1);\n }\n else {\n this.fromNumber(a, c);\n if (!this.testBit(a - 1)) {\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\n }\n if (this.isEven()) {\n this.dAddOffset(1, 0);\n }\n var bnp_1 = this;\n var bnpfn1_1 = function () {\n bnp_1.dAddOffset(2, 0);\n if (bnp_1.bitLength() > a) {\n bnp_1.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp_1);\n }\n if (bnp_1.isProbablePrime(b)) {\n setTimeout(function () { callback(); }, 0); // escape\n }\n else {\n setTimeout(bnpfn1_1, 0);\n }\n };\n setTimeout(bnpfn1_1, 0);\n }\n }\n else {\n var x = [];\n var t = a & 7;\n x.length = (a >> 3) + 1;\n b.nextBytes(x);\n if (t > 0) {\n x[0] &= ((1 << t) - 1);\n }\n else {\n x[0] = 0;\n }\n this.fromString(x, 256);\n }\n };\n return BigInteger;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'BigInteger', { enumerable: true, configurable: true, get: function() { return BigInteger; } });\n//#region REDUCERS\n//#region NullExp\nvar NullExp = /** @class */ (function () {\n function NullExp() {\n }\n // NullExp.prototype.convert = nNop;\n NullExp.prototype.convert = function (x) {\n return x;\n };\n // NullExp.prototype.revert = nNop;\n NullExp.prototype.revert = function (x) {\n return x;\n };\n // NullExp.prototype.mulTo = nMulTo;\n NullExp.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n };\n // NullExp.prototype.sqrTo = nSqrTo;\n NullExp.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n };\n return NullExp;\n}());\n// Modular reduction using \"classic\" algorithm\nvar Classic = /** @class */ (function () {\n function Classic(m) {\n this.m = m;\n }\n // Classic.prototype.convert = cConvert;\n Classic.prototype.convert = function (x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0) {\n return x.mod(this.m);\n }\n else {\n return x;\n }\n };\n // Classic.prototype.revert = cRevert;\n Classic.prototype.revert = function (x) {\n return x;\n };\n // Classic.prototype.reduce = cReduce;\n Classic.prototype.reduce = function (x) {\n x.divRemTo(this.m, null, x);\n };\n // Classic.prototype.mulTo = cMulTo;\n Classic.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Classic.prototype.sqrTo = cSqrTo;\n Classic.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Classic;\n}());\n//#endregion\n//#region Montgomery\n// Montgomery reduction\nvar Montgomery = /** @class */ (function () {\n function Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << (m.DB - 15)) - 1;\n this.mt2 = 2 * m.t;\n }\n // Montgomery.prototype.convert = montConvert;\n // xR mod m\n Montgomery.prototype.convert = function (x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\n this.m.subTo(r, r);\n }\n return r;\n };\n // Montgomery.prototype.revert = montRevert;\n // x/R mod m\n Montgomery.prototype.revert = function (x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n };\n // Montgomery.prototype.reduce = montReduce;\n // x = x/R mod m (HAC 14.32)\n Montgomery.prototype.reduce = function (x) {\n while (x.t <= this.mt2) {\n // pad x so am has enough room later\n x[x.t++] = 0;\n }\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0) {\n x.subTo(this.m, x);\n }\n };\n // Montgomery.prototype.mulTo = montMulTo;\n // r = \"xy/R mod m\"; x,y != r\n Montgomery.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Montgomery.prototype.sqrTo = montSqrTo;\n // r = \"x^2/R mod m\"; x != r\n Montgomery.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Montgomery;\n}());\n//#endregion Montgomery\n//#region Barrett\n// Barrett modular reduction\nvar Barrett = /** @class */ (function () {\n function Barrett(m) {\n this.m = m;\n // setup Barrett\n this.r2 = nbi();\n this.q3 = nbi();\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\n this.mu = this.r2.divide(m);\n }\n // Barrett.prototype.convert = barrettConvert;\n Barrett.prototype.convert = function (x) {\n if (x.s < 0 || x.t > 2 * this.m.t) {\n return x.mod(this.m);\n }\n else if (x.compareTo(this.m) < 0) {\n return x;\n }\n else {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n }\n };\n // Barrett.prototype.revert = barrettRevert;\n Barrett.prototype.revert = function (x) {\n return x;\n };\n // Barrett.prototype.reduce = barrettReduce;\n // x = x mod m (HAC 14.42)\n Barrett.prototype.reduce = function (x) {\n x.drShiftTo(this.m.t - 1, this.r2);\n if (x.t > this.m.t + 1) {\n x.t = this.m.t + 1;\n x.clamp();\n }\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\n while (x.compareTo(this.r2) < 0) {\n x.dAddOffset(1, this.m.t + 1);\n }\n x.subTo(this.r2, x);\n while (x.compareTo(this.m) >= 0) {\n x.subTo(this.m, x);\n }\n };\n // Barrett.prototype.mulTo = barrettMulTo;\n // r = x*y mod m; x,y != r\n Barrett.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Barrett.prototype.sqrTo = barrettSqrTo;\n // r = x^2 mod m; x != r\n Barrett.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Barrett;\n}());\n//#endregion\n//#endregion REDUCERS\n// return new, unset BigInteger\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbi() { return new BigInteger(null); };exports.nbi = nbi\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function parseBigInt(str, r) {\n return new BigInteger(str, r);\n};exports.parseBigInt = parseBigInt\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\nvar inBrowser = typeof navigator !== \"undefined\";\nif (inBrowser && j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n // am2 avoids a big mult-and-extract completely.\n // Max digit bits should be <= 30 because we do bitwise ops\n // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n BigInteger.prototype.am = function am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff;\n var xh = x >> 15;\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n return c;\n };\n dbits = 30;\n}\nelse if (inBrowser && j_lm && (navigator.appName != \"Netscape\")) {\n // am1: use a single mult and divide to get the high bits,\n // max digit bits should be 26 because\n // max internal value = 2*dvalue^2-2*dvalue (< 2^53)\n BigInteger.prototype.am = function am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n return c;\n };\n dbits = 26;\n}\nelse { // Mozilla/Netscape seems to prefer am3\n // Alternately, set max digit bits to 28 since some\n // browsers slow down when dealing with 32-bit numbers.\n BigInteger.prototype.am = function am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff;\n var xh = x >> 14;\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n return c;\n };\n dbits = 28;\n}\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = ((1 << dbits) - 1);\nBigInteger.prototype.DV = (1 << dbits);\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n// Digit conversions\nvar BI_RC = [];\nvar rr;\nvar vv;\nrr = \"0\".charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv) {\n BI_RC[rr++] = vv;\n}\nrr = \"a\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\nrr = \"A\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return (c == null) ? -1 : c;\n};exports.intAt = intAt\n// return bigint initialized to value\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbv(i) {\n var r = nbi();\n r.fromInt(i);\n return r;\n};exports.nbv = nbv\n// returns bit length of the integer x\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbits(x) {\n var r = 1;\n var t;\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n return r;\n};exports.nbits = nbits\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n","// Random number generator - requires a PRNG backend, e.g. prng4.js\nvar __TEMP__ = require('./prng4');var prng_newstate = __TEMP__['prng_newstate'];var rng_psize = __TEMP__['rng_psize'];\nvar rng_state;\nvar rng_pool = null;\nvar rng_pptr;\n// Initialize the pool with junk if needed.\nif (rng_pool == null) {\n rng_pool = [];\n rng_pptr = 0;\n var t = void 0;\n // Use mouse events for entropy, if we do not have enough entropy by the time\n // we need it, entropy will be generated by Math.random.\n var count = 0;\n var onMouseMoveListener = function (ev) {\n count = count || 0;\n if (count >= 256 || rng_pptr >= rng_psize) {\n return;\n }\n try {\n var mouseCoordinates = ev.x + ev.y;\n rng_pool[rng_pptr++] = mouseCoordinates & 255;\n count += 1;\n }\n catch (e) {\n // Sometimes Firefox will deny permission to access event properties for some reason. Ignore.\n }\n };\n}\nfunction rng_get_byte() {\n if (rng_state == null) {\n rng_state = prng_newstate();\n // At this point, we may not have collected enough entropy. If not, fall back to Math.random\n while (rng_pptr < rng_psize) {\n var random = Math.floor(65536 * Math.random());\n rng_pool[rng_pptr++] = random & 255;\n }\n rng_state.init(rng_pool);\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {\n rng_pool[rng_pptr] = 0;\n }\n rng_pptr = 0;\n }\n // TODO: allow reseeding after first request\n return rng_state.next();\n}\nvar SecureRandom = /** @class */ (function () {\n function SecureRandom() {\n }\n SecureRandom.prototype.nextBytes = function (ba) {\n for (var i = 0; i < ba.length; ++i) {\n ba[i] = rng_get_byte();\n }\n };\n return SecureRandom;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'SecureRandom', { enumerable: true, configurable: true, get: function() { return SecureRandom; } });\n","// prng4.js - uses Arcfour as a PRNG\nvar Arcfour = /** @class */ (function () {\n function Arcfour() {\n this.i = 0;\n this.j = 0;\n this.S = [];\n }\n // Arcfour.prototype.init = ARC4init;\n // Initialize arcfour context from key, an array of ints, each from [0..255]\n Arcfour.prototype.init = function (key) {\n var i;\n var j;\n var t;\n for (i = 0; i < 256; ++i) {\n this.S[i] = i;\n }\n j = 0;\n for (i = 0; i < 256; ++i) {\n j = (j + this.S[i] + key[i % key.length]) & 255;\n t = this.S[i];\n this.S[i] = this.S[j];\n this.S[j] = t;\n }\n this.i = 0;\n this.j = 0;\n };\n // Arcfour.prototype.next = ARC4next;\n Arcfour.prototype.next = function () {\n var t;\n this.i = (this.i + 1) & 255;\n this.j = (this.j + this.S[this.i]) & 255;\n t = this.S[this.i];\n this.S[this.i] = this.S[this.j];\n this.S[this.j] = t;\n return this.S[(t + this.S[this.i]) & 255];\n };\n return Arcfour;\n}());\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Arcfour', { enumerable: true, configurable: true, get: function() { return Arcfour; } });\n// Plug in your RNG constructor here\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function prng_newstate() {\n return new Arcfour();\n};exports.prng_newstate = prng_newstate\n// Pool size must be a multiple of 4 and greater than 32.\n// An array of bytes the size of the pool will be passed to init()\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var rng_psize = exports.rng_psize = 256;\n","/* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license\n */\n/*\n * asn1.js - ASN.1 DER encoder classes\n *\n * Copyright (c) 2013-2017 Kenji Urushima (kenji.urushima@gmail.com)\n *\n * This software is licensed under the terms of the MIT License.\n * https://kjur.github.io/jsrsasign/license\n *\n * The above copyright and license notice shall be\n * included in all copies or substantial portions of the Software.\n */\nvar __TEMP__ = require('../jsbn/jsbn');var BigInteger = __TEMP__['BigInteger'];\nvar __TEMP__ = require('./yahoo');var YAHOO = __TEMP__['YAHOO'];\n/**\n * @fileOverview\n * @name asn1-1.0.js\n * @author Kenji Urushima kenji.urushima@gmail.com\n * @version asn1 1.0.13 (2017-Jun-02)\n * @since jsrsasign 2.1\n * @license MIT License\n */\n/**\n * kjur's class library name space\n *

\n * This name space provides following name spaces:\n *

    \n *
  • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
  • \n *
  • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
  • \n *
  • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature\n * class and utilities
  • \n *
\n *

\n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\n * @name KJUR\n * @namespace kjur's class library name space\n */\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var KJUR = exports.KJUR = {};\n/**\n * kjur's ASN.1 class library name space\n *

\n * This is ITU-T X.690 ASN.1 DER encoder class library and\n * class structure and methods is very similar to\n * org.bouncycastle.asn1 package of\n * well known BouncyCaslte Cryptography Library.\n *

PROVIDING ASN.1 PRIMITIVES

\n * Here are ASN.1 DER primitive classes.\n *
    \n *
  • 0x01 {@link KJUR.asn1.DERBoolean}
  • \n *
  • 0x02 {@link KJUR.asn1.DERInteger}
  • \n *
  • 0x03 {@link KJUR.asn1.DERBitString}
  • \n *
  • 0x04 {@link KJUR.asn1.DEROctetString}
  • \n *
  • 0x05 {@link KJUR.asn1.DERNull}
  • \n *
  • 0x06 {@link KJUR.asn1.DERObjectIdentifier}
  • \n *
  • 0x0a {@link KJUR.asn1.DEREnumerated}
  • \n *
  • 0x0c {@link KJUR.asn1.DERUTF8String}
  • \n *
  • 0x12 {@link KJUR.asn1.DERNumericString}
  • \n *
  • 0x13 {@link KJUR.asn1.DERPrintableString}
  • \n *
  • 0x14 {@link KJUR.asn1.DERTeletexString}
  • \n *
  • 0x16 {@link KJUR.asn1.DERIA5String}
  • \n *
  • 0x17 {@link KJUR.asn1.DERUTCTime}
  • \n *
  • 0x18 {@link KJUR.asn1.DERGeneralizedTime}
  • \n *
  • 0x30 {@link KJUR.asn1.DERSequence}
  • \n *
  • 0x31 {@link KJUR.asn1.DERSet}
  • \n *
\n *

OTHER ASN.1 CLASSES

\n *
    \n *
  • {@link KJUR.asn1.ASN1Object}
  • \n *
  • {@link KJUR.asn1.DERAbstractString}
  • \n *
  • {@link KJUR.asn1.DERAbstractTime}
  • \n *
  • {@link KJUR.asn1.DERAbstractStructured}
  • \n *
  • {@link KJUR.asn1.DERTaggedObject}
  • \n *
\n *

SUB NAME SPACES

\n *
    \n *
  • {@link KJUR.asn1.cades} - CAdES long term signature format
  • \n *
  • {@link KJUR.asn1.cms} - Cryptographic Message Syntax
  • \n *
  • {@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)
  • \n *
  • {@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format
  • \n *
  • {@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL
  • \n *
\n *

\n * NOTE: Please ignore method summary and document of this namespace.\n * This caused by a bug of jsdoc2.\n * @name KJUR.asn1\n * @namespace\n */\nif (typeof KJUR.asn1 == \"undefined\" || !KJUR.asn1)\n KJUR.asn1 = {};\n/**\n * ASN1 utilities class\n * @name KJUR.asn1.ASN1Util\n * @class ASN1 utilities class\n * @since asn1 1.0.2\n */\nKJUR.asn1.ASN1Util = new function () {\n this.integerToByteHex = function (i) {\n var h = i.toString(16);\n if ((h.length % 2) == 1)\n h = '0' + h;\n return h;\n };\n this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) {\n var h = bigIntegerValue.toString(16);\n if (h.substr(0, 1) != '-') {\n if (h.length % 2 == 1) {\n h = '0' + h;\n }\n else {\n if (!h.match(/^[0-7]/)) {\n h = '00' + h;\n }\n }\n }\n else {\n var hPos = h.substr(1);\n var xorLen = hPos.length;\n if (xorLen % 2 == 1) {\n xorLen += 1;\n }\n else {\n if (!h.match(/^[0-7]/)) {\n xorLen += 2;\n }\n }\n var hMask = '';\n for (var i = 0; i < xorLen; i++) {\n hMask += 'f';\n }\n var biMask = new BigInteger(hMask, 16);\n var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);\n h = biNeg.toString(16).replace(/^-/, '');\n }\n return h;\n };\n /**\n * get PEM string from hexadecimal data and header string\n * @name getPEMStringFromHex\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} dataHex hexadecimal string of PEM body\n * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')\n * @return {String} PEM formatted string of input data\n * @description\n * This method converts a hexadecimal string to a PEM string with\n * a specified header. Its line break will be CRLF(\"\\r\\n\").\n * @example\n * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');\n * // value of pem will be:\n * -----BEGIN PRIVATE KEY-----\n * YWFh\n * -----END PRIVATE KEY-----\n */\n this.getPEMStringFromHex = function (dataHex, pemHeader) {\n return hextopem(dataHex, pemHeader);\n };\n /**\n * generate ASN1Object specifed by JSON parameters\n * @name newObject\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {Array} param JSON parameter to generate ASN1Object\n * @return {KJUR.asn1.ASN1Object} generated object\n * @since asn1 1.0.3\n * @description\n * generate any ASN1Object specified by JSON param\n * including ASN.1 primitive or structured.\n * Generally 'param' can be described as follows:\n *
\n * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}\n *
\n * 'TYPE-OF-ASN1OBJ' can be one of following symbols:\n *
    \n *
  • 'bool' - DERBoolean
  • \n *
  • 'int' - DERInteger
  • \n *
  • 'bitstr' - DERBitString
  • \n *
  • 'octstr' - DEROctetString
  • \n *
  • 'null' - DERNull
  • \n *
  • 'oid' - DERObjectIdentifier
  • \n *
  • 'enum' - DEREnumerated
  • \n *
  • 'utf8str' - DERUTF8String
  • \n *
  • 'numstr' - DERNumericString
  • \n *
  • 'prnstr' - DERPrintableString
  • \n *
  • 'telstr' - DERTeletexString
  • \n *
  • 'ia5str' - DERIA5String
  • \n *
  • 'utctime' - DERUTCTime
  • \n *
  • 'gentime' - DERGeneralizedTime
  • \n *
  • 'seq' - DERSequence
  • \n *
  • 'set' - DERSet
  • \n *
  • 'tag' - DERTaggedObject
  • \n *
\n * @example\n * newObject({'prnstr': 'aaa'});\n * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})\n * // ASN.1 Tagged Object\n * newObject({'tag': {'tag': 'a1',\n * 'explicit': true,\n * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});\n * // more simple representation of ASN.1 Tagged Object\n * newObject({'tag': ['a1',\n * true,\n * {'seq': [\n * {'int': 3},\n * {'prnstr': 'aaa'}]}\n * ]});\n */\n this.newObject = function (param) {\n var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject;\n var keys = Object.keys(param);\n if (keys.length != 1)\n throw \"key of param shall be only one.\";\n var key = keys[0];\n if (\":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:\".indexOf(\":\" + key + \":\") == -1)\n throw \"undefined key: \" + key;\n if (key == \"bool\")\n return new _DERBoolean(param[key]);\n if (key == \"int\")\n return new _DERInteger(param[key]);\n if (key == \"bitstr\")\n return new _DERBitString(param[key]);\n if (key == \"octstr\")\n return new _DEROctetString(param[key]);\n if (key == \"null\")\n return new _DERNull(param[key]);\n if (key == \"oid\")\n return new _DERObjectIdentifier(param[key]);\n if (key == \"enum\")\n return new _DEREnumerated(param[key]);\n if (key == \"utf8str\")\n return new _DERUTF8String(param[key]);\n if (key == \"numstr\")\n return new _DERNumericString(param[key]);\n if (key == \"prnstr\")\n return new _DERPrintableString(param[key]);\n if (key == \"telstr\")\n return new _DERTeletexString(param[key]);\n if (key == \"ia5str\")\n return new _DERIA5String(param[key]);\n if (key == \"utctime\")\n return new _DERUTCTime(param[key]);\n if (key == \"gentime\")\n return new _DERGeneralizedTime(param[key]);\n if (key == \"seq\") {\n var paramList = param[key];\n var a = [];\n for (var i = 0; i < paramList.length; i++) {\n var asn1Obj = _newObject(paramList[i]);\n a.push(asn1Obj);\n }\n return new _DERSequence({ 'array': a });\n }\n if (key == \"set\") {\n var paramList = param[key];\n var a = [];\n for (var i = 0; i < paramList.length; i++) {\n var asn1Obj = _newObject(paramList[i]);\n a.push(asn1Obj);\n }\n return new _DERSet({ 'array': a });\n }\n if (key == \"tag\") {\n var tagParam = param[key];\n if (Object.prototype.toString.call(tagParam) === '[object Array]' &&\n tagParam.length == 3) {\n var obj = _newObject(tagParam[2]);\n return new _DERTaggedObject({ tag: tagParam[0],\n explicit: tagParam[1],\n obj: obj });\n }\n else {\n var newParam = {};\n if (tagParam.explicit !== undefined)\n newParam.explicit = tagParam.explicit;\n if (tagParam.tag !== undefined)\n newParam.tag = tagParam.tag;\n if (tagParam.obj === undefined)\n throw \"obj shall be specified for 'tag'.\";\n newParam.obj = _newObject(tagParam.obj);\n return new _DERTaggedObject(newParam);\n }\n }\n };\n /**\n * get encoded hexadecimal string of ASN1Object specifed by JSON parameters\n * @name jsonToASN1HEX\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {Array} param JSON parameter to generate ASN1Object\n * @return hexadecimal string of ASN1Object\n * @since asn1 1.0.4\n * @description\n * As for ASN.1 object representation of JSON object,\n * please see {@link newObject}.\n * @example\n * jsonToASN1HEX({'prnstr': 'aaa'});\n */\n this.jsonToASN1HEX = function (param) {\n var asn1Obj = this.newObject(param);\n return asn1Obj.getEncodedHex();\n };\n};\n/**\n * get dot noted oid number string from hexadecimal value of OID\n * @name oidHexToInt\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} hex hexadecimal value of object identifier\n * @return {String} dot noted string of object identifier\n * @since jsrsasign 4.8.3 asn1 1.0.7\n * @description\n * This static method converts from hexadecimal string representation of\n * ASN.1 value of object identifier to oid number string.\n * @example\n * KJUR.asn1.ASN1Util.oidHexToInt('550406') → \"2.5.4.6\"\n */\nKJUR.asn1.ASN1Util.oidHexToInt = function (hex) {\n var s = \"\";\n var i01 = parseInt(hex.substr(0, 2), 16);\n var i0 = Math.floor(i01 / 40);\n var i1 = i01 % 40;\n var s = i0 + \".\" + i1;\n var binbuf = \"\";\n for (var i = 2; i < hex.length; i += 2) {\n var value = parseInt(hex.substr(i, 2), 16);\n var bin = (\"00000000\" + value.toString(2)).slice(-8);\n binbuf = binbuf + bin.substr(1, 7);\n if (bin.substr(0, 1) == \"0\") {\n var bi = new BigInteger(binbuf, 2);\n s = s + \".\" + bi.toString(10);\n binbuf = \"\";\n }\n }\n ;\n return s;\n};\n/**\n * get hexadecimal value of object identifier from dot noted oid value\n * @name oidIntToHex\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} oidString dot noted string of object identifier\n * @return {String} hexadecimal value of object identifier\n * @since jsrsasign 4.8.3 asn1 1.0.7\n * @description\n * This static method converts from object identifier value string.\n * to hexadecimal string representation of it.\n * @example\n * KJUR.asn1.ASN1Util.oidIntToHex(\"2.5.4.6\") → \"550406\"\n */\nKJUR.asn1.ASN1Util.oidIntToHex = function (oidString) {\n var itox = function (i) {\n var h = i.toString(16);\n if (h.length == 1)\n h = '0' + h;\n return h;\n };\n var roidtox = function (roid) {\n var h = '';\n var bi = new BigInteger(roid, 10);\n var b = bi.toString(2);\n var padLen = 7 - b.length % 7;\n if (padLen == 7)\n padLen = 0;\n var bPad = '';\n for (var i = 0; i < padLen; i++)\n bPad += '0';\n b = bPad + b;\n for (var i = 0; i < b.length - 1; i += 7) {\n var b8 = b.substr(i, 7);\n if (i != b.length - 7)\n b8 = '1' + b8;\n h += itox(parseInt(b8, 2));\n }\n return h;\n };\n if (!oidString.match(/^[0-9.]+$/)) {\n throw \"malformed oid string: \" + oidString;\n }\n var h = '';\n var a = oidString.split('.');\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\n h += itox(i0);\n a.splice(0, 2);\n for (var i = 0; i < a.length; i++) {\n h += roidtox(a[i]);\n }\n return h;\n};\n// ********************************************************************\n// Abstract ASN.1 Classes\n// ********************************************************************\n// ********************************************************************\n/**\n * base class for ASN.1 DER encoder object\n * @name KJUR.asn1.ASN1Object\n * @class base class for ASN.1 DER encoder object\n * @property {Boolean} isModified flag whether internal data was changed\n * @property {String} hTLV hexadecimal string of ASN.1 TLV\n * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)\n * @property {String} hL hexadecimal string of ASN.1 TLV length(L)\n * @property {String} hV hexadecimal string of ASN.1 TLV value(V)\n * @description\n */\nKJUR.asn1.ASN1Object = function () {\n var isModified = true;\n var hTLV = null;\n var hT = '00';\n var hL = '00';\n var hV = '';\n /**\n * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)\n * @name getLengthHexFromValue\n * @memberOf KJUR.asn1.ASN1Object#\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV length(L)\n */\n this.getLengthHexFromValue = function () {\n if (typeof this.hV == \"undefined\" || this.hV == null) {\n throw \"this.hV is null or undefined.\";\n }\n if (this.hV.length % 2 == 1) {\n throw \"value hex must be even length: n=\" + hV.length + \",v=\" + this.hV;\n }\n var n = this.hV.length / 2;\n var hN = n.toString(16);\n if (hN.length % 2 == 1) {\n hN = \"0\" + hN;\n }\n if (n < 128) {\n return hN;\n }\n else {\n var hNlen = hN.length / 2;\n if (hNlen > 15) {\n throw \"ASN.1 length too long to represent by 8x: n = \" + n.toString(16);\n }\n var head = 128 + hNlen;\n return head.toString(16) + hN;\n }\n };\n /**\n * get hexadecimal string of ASN.1 TLV bytes\n * @name getEncodedHex\n * @memberOf KJUR.asn1.ASN1Object#\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV\n */\n this.getEncodedHex = function () {\n if (this.hTLV == null || this.isModified) {\n this.hV = this.getFreshValueHex();\n this.hL = this.getLengthHexFromValue();\n this.hTLV = this.hT + this.hL + this.hV;\n this.isModified = false;\n //alert(\"first time: \" + this.hTLV);\n }\n return this.hTLV;\n };\n /**\n * get hexadecimal string of ASN.1 TLV value(V) bytes\n * @name getValueHex\n * @memberOf KJUR.asn1.ASN1Object#\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes\n */\n this.getValueHex = function () {\n this.getEncodedHex();\n return this.hV;\n };\n this.getFreshValueHex = function () {\n return '';\n };\n};\n// == BEGIN DERAbstractString ================================================\n/**\n * base class for ASN.1 DER string classes\n * @name KJUR.asn1.DERAbstractString\n * @class base class for ASN.1 DER string classes\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @property {String} s internal string of value\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • str - specify initial ASN.1 value(V) by a string
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERAbstractString = function (params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var s = null;\n var hV = null;\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractString#\n * @function\n * @return {String} string value of this string object\n */\n this.getString = function () {\n return this.s;\n };\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractString#\n * @function\n * @param {String} newS value by a string to set\n */\n this.setString = function (newS) {\n this.hTLV = null;\n this.isModified = true;\n this.s = newS;\n this.hV = stohex(this.s);\n };\n /**\n * set value by a hexadecimal string\n * @name setStringHex\n * @memberOf KJUR.asn1.DERAbstractString#\n * @function\n * @param {String} newHexString value by a hexadecimal string to set\n */\n this.setStringHex = function (newHexString) {\n this.hTLV = null;\n this.isModified = true;\n this.s = null;\n this.hV = newHexString;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params == \"string\") {\n this.setString(params);\n }\n else if (typeof params['str'] != \"undefined\") {\n this.setString(params['str']);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setStringHex(params['hex']);\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);\n// == END DERAbstractString ================================================\n// == BEGIN DERAbstractTime ==================================================\n/**\n * base class for ASN.1 DER Generalized/UTCTime class\n * @name KJUR.asn1.DERAbstractTime\n * @class base class for ASN.1 DER Generalized/UTCTime class\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractTime = function (params) {\n KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);\n var s = null;\n var date = null;\n // --- PRIVATE METHODS --------------------\n this.localDateToUTC = function (d) {\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\n var utcDate = new Date(utc);\n return utcDate;\n };\n /*\n * format date string by Data object\n * @name formatDate\n * @memberOf KJUR.asn1.AbstractTime;\n * @param {Date} dateObject\n * @param {string} type 'utc' or 'gen'\n * @param {boolean} withMillis flag for with millisections or not\n * @description\n * 'withMillis' flag is supported from asn1 1.0.6.\n */\n this.formatDate = function (dateObject, type, withMillis) {\n var pad = this.zeroPadding;\n var d = this.localDateToUTC(dateObject);\n var year = String(d.getFullYear());\n if (type == 'utc')\n year = year.substr(2, 2);\n var month = pad(String(d.getMonth() + 1), 2);\n var day = pad(String(d.getDate()), 2);\n var hour = pad(String(d.getHours()), 2);\n var min = pad(String(d.getMinutes()), 2);\n var sec = pad(String(d.getSeconds()), 2);\n var s = year + month + day + hour + min + sec;\n if (withMillis === true) {\n var millis = d.getMilliseconds();\n if (millis != 0) {\n var sMillis = pad(String(millis), 3);\n sMillis = sMillis.replace(/[0]+$/, \"\");\n s = s + \".\" + sMillis;\n }\n }\n return s + \"Z\";\n };\n this.zeroPadding = function (s, len) {\n if (s.length >= len)\n return s;\n return new Array(len - s.length + 1).join('0') + s;\n };\n // --- PUBLIC METHODS --------------------\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractTime#\n * @function\n * @return {String} string value of this time object\n */\n this.getString = function () {\n return this.s;\n };\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractTime#\n * @function\n * @param {String} newS value by a string to set such like \"130430235959Z\"\n */\n this.setString = function (newS) {\n this.hTLV = null;\n this.isModified = true;\n this.s = newS;\n this.hV = stohex(newS);\n };\n /**\n * set value by a Date object\n * @name setByDateValue\n * @memberOf KJUR.asn1.DERAbstractTime#\n * @function\n * @param {Integer} year year of date (ex. 2013)\n * @param {Integer} month month of date between 1 and 12 (ex. 12)\n * @param {Integer} day day of month\n * @param {Integer} hour hours of date\n * @param {Integer} min minutes of date\n * @param {Integer} sec seconds of date\n */\n this.setByDateValue = function (year, month, day, hour, min, sec) {\n var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));\n this.setByDate(dateObject);\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n};\nYAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);\n// == END DERAbstractTime ==================================================\n// == BEGIN DERAbstractStructured ============================================\n/**\n * base class for ASN.1 DER structured class\n * @name KJUR.asn1.DERAbstractStructured\n * @class base class for ASN.1 DER structured class\n * @property {Array} asn1Array internal array of ASN1Object\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractStructured = function (params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var asn1Array = null;\n /**\n * set value by array of ASN1Object\n * @name setByASN1ObjectArray\n * @memberOf KJUR.asn1.DERAbstractStructured#\n * @function\n * @param {array} asn1ObjectArray array of ASN1Object to set\n */\n this.setByASN1ObjectArray = function (asn1ObjectArray) {\n this.hTLV = null;\n this.isModified = true;\n this.asn1Array = asn1ObjectArray;\n };\n /**\n * append an ASN1Object to internal array\n * @name appendASN1Object\n * @memberOf KJUR.asn1.DERAbstractStructured#\n * @function\n * @param {ASN1Object} asn1Object to add\n */\n this.appendASN1Object = function (asn1Object) {\n this.hTLV = null;\n this.isModified = true;\n this.asn1Array.push(asn1Object);\n };\n this.asn1Array = new Array();\n if (typeof params != \"undefined\") {\n if (typeof params['array'] != \"undefined\") {\n this.asn1Array = params['array'];\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);\n// ********************************************************************\n// ASN.1 Object Classes\n// ********************************************************************\n// ********************************************************************\n/**\n * class for ASN.1 DER Boolean\n * @name KJUR.asn1.DERBoolean\n * @class class for ASN.1 DER Boolean\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERBoolean = function () {\n KJUR.asn1.DERBoolean.superclass.constructor.call(this);\n this.hT = \"01\";\n this.hTLV = \"0101ff\";\n};\nYAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER Integer\n * @name KJUR.asn1.DERInteger\n * @class class for ASN.1 DER Integer\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • int - specify initial ASN.1 value(V) by integer value
  • \n *
  • bigint - specify initial ASN.1 value(V) by BigInteger object
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERInteger = function (params) {\n KJUR.asn1.DERInteger.superclass.constructor.call(this);\n this.hT = \"02\";\n /**\n * set value by Tom Wu's BigInteger object\n * @name setByBigInteger\n * @memberOf KJUR.asn1.DERInteger#\n * @function\n * @param {BigInteger} bigIntegerValue to set\n */\n this.setByBigInteger = function (bigIntegerValue) {\n this.hTLV = null;\n this.isModified = true;\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\n };\n /**\n * set value by integer value\n * @name setByInteger\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {Integer} integer value to set\n */\n this.setByInteger = function (intValue) {\n var bi = new BigInteger(String(intValue), 10);\n this.setByBigInteger(bi);\n };\n /**\n * set value by integer value\n * @name setValueHex\n * @memberOf KJUR.asn1.DERInteger#\n * @function\n * @param {String} hexadecimal string of integer value\n * @description\n *
\n * NOTE: Value shall be represented by minimum octet length of\n * two's complement representation.\n * @example\n * new KJUR.asn1.DERInteger(123);\n * new KJUR.asn1.DERInteger({'int': 123});\n * new KJUR.asn1.DERInteger({'hex': '1fad'});\n */\n this.setValueHex = function (newHexString) {\n this.hV = newHexString;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params['bigint'] != \"undefined\") {\n this.setByBigInteger(params['bigint']);\n }\n else if (typeof params['int'] != \"undefined\") {\n this.setByInteger(params['int']);\n }\n else if (typeof params == \"number\") {\n this.setByInteger(params);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setValueHex(params['hex']);\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER encoded BitString primitive\n * @name KJUR.asn1.DERBitString\n * @class class for ASN.1 DER encoded BitString primitive\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • bin - specify binary string (ex. '10111')
  • \n *
  • array - specify array of boolean (ex. [true,false,true,true])
  • \n *
  • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
  • \n *
  • obj - specify {@link KJUR.asn1.ASN1Util.newObject}\n * argument for \"BitString encapsulates\" structure.
  • \n *
\n * NOTE1: 'params' can be omitted.
\n * NOTE2: 'obj' parameter have been supported since\n * asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
\n * @example\n * // default constructor\n * o = new KJUR.asn1.DERBitString();\n * // initialize with binary string\n * o = new KJUR.asn1.DERBitString({bin: \"1011\"});\n * // initialize with boolean array\n * o = new KJUR.asn1.DERBitString({array: [true,false,true,true]});\n * // initialize with hexadecimal string (04 is unused bits)\n * o = new KJUR.asn1.DEROctetString({hex: \"04bac0\"});\n * // initialize with ASN1Util.newObject argument for encapsulated\n * o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\n * // above generates a ASN.1 data like this:\n * // BIT STRING, encapsulates {\n * // SEQUENCE {\n * // INTEGER 3\n * // PrintableString 'aaa'\n * // }\n * // }\n */\nKJUR.asn1.DERBitString = function (params) {\n if (params !== undefined && typeof params.obj !== \"undefined\") {\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\n params.hex = \"00\" + o.getEncodedHex();\n }\n KJUR.asn1.DERBitString.superclass.constructor.call(this);\n this.hT = \"03\";\n /**\n * set ASN.1 value(V) by a hexadecimal string including unused bits\n * @name setHexValueIncludingUnusedBits\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {String} newHexStringIncludingUnusedBits\n */\n this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) {\n this.hTLV = null;\n this.isModified = true;\n this.hV = newHexStringIncludingUnusedBits;\n };\n /**\n * set ASN.1 value(V) by unused bit and hexadecimal string of value\n * @name setUnusedBitsAndHexValue\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {Integer} unusedBits\n * @param {String} hValue\n */\n this.setUnusedBitsAndHexValue = function (unusedBits, hValue) {\n if (unusedBits < 0 || 7 < unusedBits) {\n throw \"unused bits shall be from 0 to 7: u = \" + unusedBits;\n }\n var hUnusedBits = \"0\" + unusedBits;\n this.hTLV = null;\n this.isModified = true;\n this.hV = hUnusedBits + hValue;\n };\n /**\n * set ASN.1 DER BitString by binary string
\n * @name setByBinaryString\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {String} binaryString binary value string (i.e. '10111')\n * @description\n * Its unused bits will be calculated automatically by length of\n * 'binaryValue'.
\n * NOTE: Trailing zeros '0' will be ignored.\n * @example\n * o = new KJUR.asn1.DERBitString();\n * o.setByBooleanArray(\"01011\");\n */\n this.setByBinaryString = function (binaryString) {\n binaryString = binaryString.replace(/0+$/, '');\n var unusedBits = 8 - binaryString.length % 8;\n if (unusedBits == 8)\n unusedBits = 0;\n for (var i = 0; i <= unusedBits; i++) {\n binaryString += '0';\n }\n var h = '';\n for (var i = 0; i < binaryString.length - 1; i += 8) {\n var b = binaryString.substr(i, 8);\n var x = parseInt(b, 2).toString(16);\n if (x.length == 1)\n x = '0' + x;\n h += x;\n }\n this.hTLV = null;\n this.isModified = true;\n this.hV = '0' + unusedBits + h;\n };\n /**\n * set ASN.1 TLV value(V) by an array of boolean
\n * @name setByBooleanArray\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {array} booleanArray array of boolean (ex. [true, false, true])\n * @description\n * NOTE: Trailing falses will be ignored in the ASN.1 DER Object.\n * @example\n * o = new KJUR.asn1.DERBitString();\n * o.setByBooleanArray([false, true, false, true, true]);\n */\n this.setByBooleanArray = function (booleanArray) {\n var s = '';\n for (var i = 0; i < booleanArray.length; i++) {\n if (booleanArray[i] == true) {\n s += '1';\n }\n else {\n s += '0';\n }\n }\n this.setByBinaryString(s);\n };\n /**\n * generate an array of falses with specified length
\n * @name newFalseArray\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {Integer} nLength length of array to generate\n * @return {array} array of boolean falses\n * @description\n * This static method may be useful to initialize boolean array.\n * @example\n * o = new KJUR.asn1.DERBitString();\n * o.newFalseArray(3) → [false, false, false]\n */\n this.newFalseArray = function (nLength) {\n var a = new Array(nLength);\n for (var i = 0; i < nLength; i++) {\n a[i] = false;\n }\n return a;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params == \"string\" && params.toLowerCase().match(/^[0-9a-f]+$/)) {\n this.setHexValueIncludingUnusedBits(params);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setHexValueIncludingUnusedBits(params['hex']);\n }\n else if (typeof params['bin'] != \"undefined\") {\n this.setByBinaryString(params['bin']);\n }\n else if (typeof params['array'] != \"undefined\") {\n this.setByBooleanArray(params['array']);\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER OctetString
\n * @name KJUR.asn1.DEROctetString\n * @class class for ASN.1 DER OctetString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * This class provides ASN.1 OctetString simple type.
\n * Supported \"params\" attributes are:\n *
    \n *
  • str - to set a string as a value
  • \n *
  • hex - to set a hexadecimal string as a value
  • \n *
  • obj - to set a encapsulated ASN.1 value by JSON object\n * which is defined in {@link KJUR.asn1.ASN1Util.newObject}
  • \n *
\n * NOTE: A parameter 'obj' have been supported\n * for \"OCTET STRING, encapsulates\" structure.\n * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).\n * @see KJUR.asn1.DERAbstractString - superclass\n * @example\n * // default constructor\n * o = new KJUR.asn1.DEROctetString();\n * // initialize with string\n * o = new KJUR.asn1.DEROctetString({str: \"aaa\"});\n * // initialize with hexadecimal string\n * o = new KJUR.asn1.DEROctetString({hex: \"616161\"});\n * // initialize with ASN1Util.newObject argument\n * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\n * // above generates a ASN.1 data like this:\n * // OCTET STRING, encapsulates {\n * // SEQUENCE {\n * // INTEGER 3\n * // PrintableString 'aaa'\n * // }\n * // }\n */\nKJUR.asn1.DEROctetString = function (params) {\n if (params !== undefined && typeof params.obj !== \"undefined\") {\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\n params.hex = o.getEncodedHex();\n }\n KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);\n this.hT = \"04\";\n};\nYAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER Null\n * @name KJUR.asn1.DERNull\n * @class class for ASN.1 DER Null\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERNull = function () {\n KJUR.asn1.DERNull.superclass.constructor.call(this);\n this.hT = \"05\";\n this.hTLV = \"0500\";\n};\nYAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER ObjectIdentifier\n * @name KJUR.asn1.DERObjectIdentifier\n * @class class for ASN.1 DER ObjectIdentifier\n * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERObjectIdentifier = function (params) {\n var itox = function (i) {\n var h = i.toString(16);\n if (h.length == 1)\n h = '0' + h;\n return h;\n };\n var roidtox = function (roid) {\n var h = '';\n var bi = new BigInteger(roid, 10);\n var b = bi.toString(2);\n var padLen = 7 - b.length % 7;\n if (padLen == 7)\n padLen = 0;\n var bPad = '';\n for (var i = 0; i < padLen; i++)\n bPad += '0';\n b = bPad + b;\n for (var i = 0; i < b.length - 1; i += 7) {\n var b8 = b.substr(i, 7);\n if (i != b.length - 7)\n b8 = '1' + b8;\n h += itox(parseInt(b8, 2));\n }\n return h;\n };\n KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);\n this.hT = \"06\";\n /**\n * set value by a hexadecimal string\n * @name setValueHex\n * @memberOf KJUR.asn1.DERObjectIdentifier#\n * @function\n * @param {String} newHexString hexadecimal value of OID bytes\n */\n this.setValueHex = function (newHexString) {\n this.hTLV = null;\n this.isModified = true;\n this.s = null;\n this.hV = newHexString;\n };\n /**\n * set value by a OID string
\n * @name setValueOidString\n * @memberOf KJUR.asn1.DERObjectIdentifier#\n * @function\n * @param {String} oidString OID string (ex. 2.5.4.13)\n * @example\n * o = new KJUR.asn1.DERObjectIdentifier();\n * o.setValueOidString(\"2.5.4.13\");\n */\n this.setValueOidString = function (oidString) {\n if (!oidString.match(/^[0-9.]+$/)) {\n throw \"malformed oid string: \" + oidString;\n }\n var h = '';\n var a = oidString.split('.');\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\n h += itox(i0);\n a.splice(0, 2);\n for (var i = 0; i < a.length; i++) {\n h += roidtox(a[i]);\n }\n this.hTLV = null;\n this.isModified = true;\n this.s = null;\n this.hV = h;\n };\n /**\n * set value by a OID name\n * @name setValueName\n * @memberOf KJUR.asn1.DERObjectIdentifier#\n * @function\n * @param {String} oidName OID name (ex. 'serverAuth')\n * @since 1.0.1\n * @description\n * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.\n * Otherwise raise error.\n * @example\n * o = new KJUR.asn1.DERObjectIdentifier();\n * o.setValueName(\"serverAuth\");\n */\n this.setValueName = function (oidName) {\n var oid = KJUR.asn1.x509.OID.name2oid(oidName);\n if (oid !== '') {\n this.setValueOidString(oid);\n }\n else {\n throw \"DERObjectIdentifier oidName undefined: \" + oidName;\n }\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (params !== undefined) {\n if (typeof params === \"string\") {\n if (params.match(/^[0-2].[0-9.]+$/)) {\n this.setValueOidString(params);\n }\n else {\n this.setValueName(params);\n }\n }\n else if (params.oid !== undefined) {\n this.setValueOidString(params.oid);\n }\n else if (params.hex !== undefined) {\n this.setValueHex(params.hex);\n }\n else if (params.name !== undefined) {\n this.setValueName(params.name);\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER Enumerated\n * @name KJUR.asn1.DEREnumerated\n * @class class for ASN.1 DER Enumerated\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • int - specify initial ASN.1 value(V) by integer value
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n * @example\n * new KJUR.asn1.DEREnumerated(123);\n * new KJUR.asn1.DEREnumerated({int: 123});\n * new KJUR.asn1.DEREnumerated({hex: '1fad'});\n */\nKJUR.asn1.DEREnumerated = function (params) {\n KJUR.asn1.DEREnumerated.superclass.constructor.call(this);\n this.hT = \"0a\";\n /**\n * set value by Tom Wu's BigInteger object\n * @name setByBigInteger\n * @memberOf KJUR.asn1.DEREnumerated#\n * @function\n * @param {BigInteger} bigIntegerValue to set\n */\n this.setByBigInteger = function (bigIntegerValue) {\n this.hTLV = null;\n this.isModified = true;\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\n };\n /**\n * set value by integer value\n * @name setByInteger\n * @memberOf KJUR.asn1.DEREnumerated#\n * @function\n * @param {Integer} integer value to set\n */\n this.setByInteger = function (intValue) {\n var bi = new BigInteger(String(intValue), 10);\n this.setByBigInteger(bi);\n };\n /**\n * set value by integer value\n * @name setValueHex\n * @memberOf KJUR.asn1.DEREnumerated#\n * @function\n * @param {String} hexadecimal string of integer value\n * @description\n *
\n * NOTE: Value shall be represented by minimum octet length of\n * two's complement representation.\n */\n this.setValueHex = function (newHexString) {\n this.hV = newHexString;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params['int'] != \"undefined\") {\n this.setByInteger(params['int']);\n }\n else if (typeof params == \"number\") {\n this.setByInteger(params);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setValueHex(params['hex']);\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER UTF8String\n * @name KJUR.asn1.DERUTF8String\n * @class class for ASN.1 DER UTF8String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERUTF8String = function (params) {\n KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);\n this.hT = \"0c\";\n};\nYAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER NumericString\n * @name KJUR.asn1.DERNumericString\n * @class class for ASN.1 DER NumericString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERNumericString = function (params) {\n KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);\n this.hT = \"12\";\n};\nYAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER PrintableString\n * @name KJUR.asn1.DERPrintableString\n * @class class for ASN.1 DER PrintableString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERPrintableString = function (params) {\n KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);\n this.hT = \"13\";\n};\nYAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER TeletexString\n * @name KJUR.asn1.DERTeletexString\n * @class class for ASN.1 DER TeletexString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERTeletexString = function (params) {\n KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);\n this.hT = \"14\";\n};\nYAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER IA5String\n * @name KJUR.asn1.DERIA5String\n * @class class for ASN.1 DER IA5String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERIA5String = function (params) {\n KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);\n this.hT = \"16\";\n};\nYAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER UTCTime\n * @name KJUR.asn1.DERUTCTime\n * @class class for ASN.1 DER UTCTime\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
  • date - specify Date object.
  • \n *
\n * NOTE: 'params' can be omitted.\n *

EXAMPLES

\n * @example\n * d1 = new KJUR.asn1.DERUTCTime();\n * d1.setString('130430125959Z');\n *\n * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});\n * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});\n * d4 = new KJUR.asn1.DERUTCTime('130430125959Z');\n */\nKJUR.asn1.DERUTCTime = function (params) {\n KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);\n this.hT = \"17\";\n /**\n * set value by a Date object
\n * @name setByDate\n * @memberOf KJUR.asn1.DERUTCTime#\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n * @example\n * o = new KJUR.asn1.DERUTCTime();\n * o.setByDate(new Date(\"2016/12/31\"));\n */\n this.setByDate = function (dateObject) {\n this.hTLV = null;\n this.isModified = true;\n this.date = dateObject;\n this.s = this.formatDate(this.date, 'utc');\n this.hV = stohex(this.s);\n };\n this.getFreshValueHex = function () {\n if (typeof this.date == \"undefined\" && typeof this.s == \"undefined\") {\n this.date = new Date();\n this.s = this.formatDate(this.date, 'utc');\n this.hV = stohex(this.s);\n }\n return this.hV;\n };\n if (params !== undefined) {\n if (params.str !== undefined) {\n this.setString(params.str);\n }\n else if (typeof params == \"string\" && params.match(/^[0-9]{12}Z$/)) {\n this.setString(params);\n }\n else if (params.hex !== undefined) {\n this.setStringHex(params.hex);\n }\n else if (params.date !== undefined) {\n this.setByDate(params.date);\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);\n// ********************************************************************\n/**\n * class for ASN.1 DER GeneralizedTime\n * @name KJUR.asn1.DERGeneralizedTime\n * @class class for ASN.1 DER GeneralizedTime\n * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})\n * @property {Boolean} withMillis flag to show milliseconds or not\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
  • date - specify Date object.
  • \n *
  • millis - specify flag to show milliseconds (from 1.0.6)
  • \n *
\n * NOTE1: 'params' can be omitted.\n * NOTE2: 'withMillis' property is supported from asn1 1.0.6.\n */\nKJUR.asn1.DERGeneralizedTime = function (params) {\n KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);\n this.hT = \"18\";\n this.withMillis = false;\n /**\n * set value by a Date object\n * @name setByDate\n * @memberOf KJUR.asn1.DERGeneralizedTime#\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n * @example\n * When you specify UTC time, use 'Date.UTC' method like this:
\n * o1 = new DERUTCTime();\n * o1.setByDate(date);\n *\n * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59\n */\n this.setByDate = function (dateObject) {\n this.hTLV = null;\n this.isModified = true;\n this.date = dateObject;\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\n this.hV = stohex(this.s);\n };\n this.getFreshValueHex = function () {\n if (this.date === undefined && this.s === undefined) {\n this.date = new Date();\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\n this.hV = stohex(this.s);\n }\n return this.hV;\n };\n if (params !== undefined) {\n if (params.str !== undefined) {\n this.setString(params.str);\n }\n else if (typeof params == \"string\" && params.match(/^[0-9]{14}Z$/)) {\n this.setString(params);\n }\n else if (params.hex !== undefined) {\n this.setStringHex(params.hex);\n }\n else if (params.date !== undefined) {\n this.setByDate(params.date);\n }\n if (params.millis === true) {\n this.withMillis = true;\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);\n// ********************************************************************\n/**\n * class for ASN.1 DER Sequence\n * @name KJUR.asn1.DERSequence\n * @class class for ASN.1 DER Sequence\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • array - specify array of ASN1Object to set elements of content
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERSequence = function (params) {\n KJUR.asn1.DERSequence.superclass.constructor.call(this, params);\n this.hT = \"30\";\n this.getFreshValueHex = function () {\n var h = '';\n for (var i = 0; i < this.asn1Array.length; i++) {\n var asn1Obj = this.asn1Array[i];\n h += asn1Obj.getEncodedHex();\n }\n this.hV = h;\n return this.hV;\n };\n};\nYAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);\n// ********************************************************************\n/**\n * class for ASN.1 DER Set\n * @name KJUR.asn1.DERSet\n * @class class for ASN.1 DER Set\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • array - specify array of ASN1Object to set elements of content
  • \n *
  • sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
  • \n *
\n * NOTE1: 'params' can be omitted.
\n * NOTE2: sortflag is supported since 1.0.5.\n */\nKJUR.asn1.DERSet = function (params) {\n KJUR.asn1.DERSet.superclass.constructor.call(this, params);\n this.hT = \"31\";\n this.sortFlag = true; // item shall be sorted only in ASN.1 DER\n this.getFreshValueHex = function () {\n var a = new Array();\n for (var i = 0; i < this.asn1Array.length; i++) {\n var asn1Obj = this.asn1Array[i];\n a.push(asn1Obj.getEncodedHex());\n }\n if (this.sortFlag == true)\n a.sort();\n this.hV = a.join('');\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params.sortflag != \"undefined\" &&\n params.sortflag == false)\n this.sortFlag = false;\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);\n// ********************************************************************\n/**\n * class for ASN.1 DER TaggedObject\n * @name KJUR.asn1.DERTaggedObject\n * @class class for ASN.1 DER TaggedObject\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.\n * For example, if you find '[1]' tag in a ASN.1 dump,\n * 'tagNoHex' will be 'a1'.\n *
\n * As for optional argument 'params' for constructor, you can specify *ANY* of\n * following properties:\n *
    \n *
  • explicit - specify true if this is explicit tag otherwise false\n * (default is 'true').
  • \n *
  • tag - specify tag (default is 'a0' which means [0])
  • \n *
  • obj - specify ASN1Object which is tagged
  • \n *
\n * @example\n * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});\n * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});\n * hex = d2.getEncodedHex();\n */\nKJUR.asn1.DERTaggedObject = function (params) {\n KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);\n this.hT = \"a0\";\n this.hV = '';\n this.isExplicit = true;\n this.asn1Object = null;\n /**\n * set value by an ASN1Object\n * @name setString\n * @memberOf KJUR.asn1.DERTaggedObject#\n * @function\n * @param {Boolean} isExplicitFlag flag for explicit/implicit tag\n * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag\n * @param {ASN1Object} asn1Object ASN.1 to encapsulate\n */\n this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) {\n this.hT = tagNoHex;\n this.isExplicit = isExplicitFlag;\n this.asn1Object = asn1Object;\n if (this.isExplicit) {\n this.hV = this.asn1Object.getEncodedHex();\n this.hTLV = null;\n this.isModified = true;\n }\n else {\n this.hV = null;\n this.hTLV = asn1Object.getEncodedHex();\n this.hTLV = this.hTLV.replace(/^../, tagNoHex);\n this.isModified = false;\n }\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params['tag'] != \"undefined\") {\n this.hT = params['tag'];\n }\n if (typeof params['explicit'] != \"undefined\") {\n this.isExplicit = params['explicit'];\n }\n if (typeof params['obj'] != \"undefined\") {\n this.asn1Object = params['obj'];\n this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);\n }\n }\n};\nYAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);\n","/*!\nCopyright (c) 2011, Yahoo! Inc. All rights reserved.\nCode licensed under the BSD License:\nhttp://developer.yahoo.com/yui/license.html\nversion: 2.9.0\n*/\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var YAHOO = exports.YAHOO = {};\nYAHOO.lang = {\n /**\n * Utility to set up the prototype, constructor and superclass properties to\n * support an inheritance strategy that can chain constructors and methods.\n * Static members will not be inherited.\n *\n * @method extend\n * @static\n * @param {Function} subc the object to modify\n * @param {Function} superc the object to inherit\n * @param {Object} overrides additional properties/methods to add to the\n * subclass prototype. These will override the\n * matching items obtained from the superclass\n * if present.\n */\n extend: function (subc, superc, overrides) {\n if (!superc || !subc) {\n throw new Error(\"YAHOO.lang.extend failed, please check that \" +\n \"all dependencies are included.\");\n }\n var F = function () { };\n F.prototype = superc.prototype;\n subc.prototype = new F();\n subc.prototype.constructor = subc;\n subc.superclass = superc.prototype;\n if (superc.prototype.constructor == Object.prototype.constructor) {\n superc.prototype.constructor = superc;\n }\n if (overrides) {\n var i;\n for (i in overrides) {\n subc.prototype[i] = overrides[i];\n }\n /*\n * IE will not enumerate native functions in a derived object even if the\n * function was overridden. This is a workaround for specific functions\n * we care about on the Object prototype.\n * @property _IEEnumFix\n * @param {Function} r the object to receive the augmentation\n * @param {Function} s the object that supplies the properties to augment\n * @static\n * @private\n */\n var _IEEnumFix = function () { }, ADD = [\"toString\", \"valueOf\"];\n try {\n if (/MSIE/.test(navigator.userAgent)) {\n _IEEnumFix = function (r, s) {\n for (i = 0; i < ADD.length; i = i + 1) {\n var fname = ADD[i], f = s[fname];\n if (typeof f === 'function' && f != Object.prototype[fname]) {\n r[fname] = f;\n }\n }\n };\n }\n }\n catch (ex) { }\n ;\n _IEEnumFix(subc.prototype, overrides);\n }\n }\n};\n","module.exports = {\n \"version\": \"3.2.1\"\n}\n"]} \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 809ec4c..5544fe6 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -22,6 +22,11 @@ "resolved": "https://registry.npmjs.org/weapp-qrcode-canvas-2d/-/weapp-qrcode-canvas-2d-1.1.2.tgz", "integrity": "sha512-HQef+xpZiiWDcq8aLZdXnVdNljoYsEWiEKiBYnAnfgqXTeYfC8ApzoB9pMI5mnPFbhtu5xCi8oId1g/86uUl8Q==" }, + "node_modules/wxml2canvas": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wxml2canvas/-/wxml2canvas-1.0.1.tgz", + "integrity": "sha512-AdWvxgTjJtW/m6Cki1cwGO0HOERKU8O9V3RcCz8UyqJbrPF7e8Nv27/epYiIs64HlbPTKWTLl7ECjQi6UVducA==" + }, "node_modules/wxmp-rsa": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wxmp-rsa/-/wxmp-rsa-2.1.0.tgz", diff --git a/node_modules/wxml2canvas/README.md b/node_modules/wxml2canvas/README.md new file mode 100755 index 0000000..85b60be --- /dev/null +++ b/node_modules/wxml2canvas/README.md @@ -0,0 +1,330 @@ +## v1.3.0 + +优化图片清晰度控制。 + +`new Wxml2Canvas`时增加`destZoom`属性,默认3,(建议取值范围2-5),取消`destWidth`,`destHeight`属性的作用。destZoom值越大,图片越大,建议不传,使用小程序默认值。 + +## v1.2.0 + +支持base64图片的转换和绘制,基于sdk1.9.9+,将图片存储到本地再绘制。 +使用时src或background-image传入base64编码的值,然后声明`data-base64="1"`。下图绿框部分为base64图片: + +![base64图片](https://mmocgame.qpic.cn/wechatgame/duc2TvpEgSSC0vZndxlmTVUYjVzXDV2G25rkpWlH63BOWc5iaUHI39GBcsd4pjjiaJ/0) + +## v1.1.0 + +支持图片的缩放和裁剪,使用时声明如:`data-mode="aspectFill"`,mode的13种模式完全支持。效果如下: + +![图片裁剪和缩放](https://mmocgame.qpic.cn/wechatgame/duc2TvpEgSQCtBianicxcWObMNDWVImPRKIAHSGu9TwQkCslPUZXMmyuwibdzcKtsUl/0) + +注意:目前开发者工具图片裁剪显示有bug,以真机效果为准。 + +# Wml2Canvas 介绍 + +## 特性 +> * 配置数据绘制基础图形、文字 +> * wxml元素转换成canvas元素 + +## 示例 +直接在小程序开发工具里运行项目,可看到两种使用方式。真机预览时,建议填入有权限的appid,然后打开调试,否则无法看到网络图片。 + + +## 使用方式 + +安装: + +``` + npm install wxml2canvas +``` + +wxml: + +```html + + +``` +js: + +```javascript +import Wxml2Canvas from 'wxml2canvas'; // 根据具体路径修改,node_modules会被忽略 +Page({ + drawImage1 () { + let self = this; + this.drawImage1 = new Wxml2Canvas({ + width: 340, // 宽, 以iphone6为基准,传具体数值,其他机型自动适配 + height: 210, // 高 + element: 'canvas1', + background: '#f0f0f0', + progress (percent) { + }, + finish(url) { + let imgs = self.data.imgs; + imgs.push(url); + + self.setData({ + imgs + }) + }, + error (res) { + } + }); + + let data = { + list: [{ + type: 'wxml', + class: '.share__canvas1 .draw_canvas', // draw_canvas指定待绘制的元素 + limit: '.share__canvas1', // 限定绘制元素的范围,取指定元素与它的相对位置 + x: 0, + y: 0 + }] + } + + this.drawImage1.draw(data); + }, +}) +``` + +## 属性 + +### 初始化属性 + +`new Wxml2Canvas(options)` 时传入的`options`属性如下: + +| 属性名 | 类型 | 默认值 | 是否必填 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| element | String | '' | 是 | 画布的id | +| width | Number | 0 | 是 | 画布的宽,以iphone6的375为基准,其他机型按比例自动设置实际宽度 | +| height | Number | 0 | 是 | 画布的高,同上 | +| destZoom | Number | 3 | 否 | 输出的图片的像素密度,不建议传值,如果需要控制图片大小,可以适当减小 | +| zoom | Number | 1 | 否 | 画布整体缩放比例,不建议传值,会覆盖各种机型的适配 | +| translateX | Number | 0 | 否 | 画布整体横向位移 | +| translateY | Number | 0 | 否 | 画布整体纵向位移 | +| height | Number | height * 2 | 否 | 输出的图片的高度 | +| background | String | #ffffff | 否 | 画布的整体背景色 | +| gradientBackground | Object | null | 否 | 画布整体的渐变背景色 | +| finish | Function | null | 否 | 绘制成功后回调函数, 返回值url,绘制图片的本地路径 | +| progress | Function | null | 否 | 绘制进度,返回值percent,0-100 | +| error | Function | null | 否 | 绘制失败后回调函数,返回值object,包含具体原因 | + +绘制失败的原因如下: + +| 错误码 | 原因 | 说明 | +| -------- | ----- | ---- | +| errcode | errmsg | e | +| 1000 | save canvas error | 保存图片失败 | +| 1001 | download pic error | 预下载图片失败 | +| 1002 | drawRect error | 绘制矩形失败 | +| 1003 | drawImage error | 绘制图片失败 | +| 1004 | drawText error | 绘制文本失败 | +| 1005 | drawCircle error | 绘制圆形图片失败 | +| 1006 | drawCircleImage error | 绘制圆形失败 | +| 1007 | drawLine error | 绘制线条失败 | +| 1008 | drawWxml error | 绘制Wxml失败 | +| 1009 | drawWxml preLoadImage error | 预下载Wxml图片失败 | + +## 数据配置方式支持的格式 + +代码示例: + +```javascript +let data = { + list: [{ + type: 'rect', + x: 10, + y: 10, + style: { + width: 150, + height: 80, + fill: '#3762ab', + border: '10px solid #aaaaaa', + } + } +} +``` +上述是一个矩形的创建方式,可看代码里的示例。下面是支持的属性: + +### 矩形 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| type | String | 是 | 'rect',声明为绘制矩形 | +| x | Number | 是 | 坐标x | +| y | Number | 是 | 坐标y | +| style | +| width | Number | 是 | 宽 | +| height | Number | 是 | 高 | +| fill | String 或 Object | 否 | 填充颜色,支持渐变色 | +| border | String | 否 | 边框,需要严格遵循 __'10px dashed #540821'__ 格式 | +| boxShadow | String | 否 | 阴影,需要严格遵循 __'10 20 20 rgba(0, 0, 0, 0.4)'__ 格式 | +| dash | Array | 否 | 虚线边框的间距和偏移 | + +### 圆形 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| type | String | 是 | 'circle',声明为绘制圆形 | +| x | Number | 是 | 坐标x | +| y | Number | 是 | 坐标y | +| style | +| r | Number | 是 | 半径 | +| fill | String 或 Object | 否 | 填充颜色,支持渐变色 | +| border | String | 否 | 边框,需要严格遵循 __'10px dashed #540821'__ 格式 | +| boxShadow | String | 否 | 阴影,需要严格遵循 __'10 20 20 rgba(0, 0, 0, 0.4)'__ 格式 | +| dash | Array | 否 | 虚线边框的间距和偏移 | + +### 线条 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| type | String | 是 | 'line',声明为绘制线条 | +| x | Number | 是 | 起始坐标x | +| y | Number | 是 | 起始坐标y | +| x2 | Number | 是 | 终止坐标x | +| y2 | Number | 是 | 终止坐标y | +| style | +| width | Number | 是 | 线条宽度 | +| stroke | String 或 Object | 否 | 填充颜色,支持渐变色 | +| boxShadow | String | 否 | 阴影,需要严格遵循 __'10 20 20 rgba(0, 0, 0, 0.4)'__ 格式 | +| dash | Array | 否 | 有此属性则绘制虚线,传入值为虚线边框的间距和偏移 | + +### 图片 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| type | String | 是 | 'image',声明为绘制图片 | +| x | Number | 是 | 坐标x | +| y | Number | 是 | 坐标y | +| url | String | 是 | 图片链接,支持 http/https 及本地图片,域名需要在mp平台加入白名单 | +| style | +| width | Number | 是 | 宽 | +| height | Number | 是 | 高 | +| border | String | 否 | 边框,需要严格遵循 __'10px dashed #540821'__ 格式 | +| boxShadow | String | 否 | 阴影,需要严格遵循 __'10 20 20 rgba(0, 0, 0, 0.4)'__ 格式 | +| dash | Array | 否 | 虚线边框的间距和偏移 | + +### 圆形图片 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| type | String | 是 | 'radius-image',声明为绘制圆形图片 | +| x | Number | 是 | 坐标x | +| y | Number | 是 | 坐标y | +| url | String | 是 | 图片链接,支持 http/https 及本地图片,域名需要在mp平台加入白名单 | +| style | +| r | Number | 是 | 半径 | +| border | String | 否 | 边框,需要严格遵循 __'10px dashed #540821'__ 格式 | +| boxShadow | String | 否 | 阴影,需要严格遵循 __'10 20 20 rgba(0, 0, 0, 0.4)'__ 格式 | +| dash | Array | 否 | 虚线边框的间距和偏移 | + +### 文本 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| type | String | 是 | 'text',声明为绘制文本 | +| x | Number | 是 | 坐标x | +| y | Number | 是 | 坐标y | +| text | String | 否 | 文本内容 | +| style | +| width | Number | 否 | 文本最大宽,超过则换行 | +| height | Number | 否 | 文本高度 | +| color | String | 否 | 字体颜色 | +| fontSize | Number | 否 | 字体大小,默认14 | +| fontFamily | String | 否 | 字体样式 | +| lineHeight | Number | 否 | 字体行高,默认14 * 1.2 | +| fontWeight | String | 否 | 字体粗细,默认normal | +| lineClamp | Number | 否 | 文字的最大行数,超出则用 ... 截取 | +| whiteSpace | String | 否 | 是否换行,默认wrap,如果传入nowrap,则不换行 | +| textAlign | String | 否 | 文本的水平对齐方式,默认left | +| border | String | 否 | 边框,需要严格遵循 __'10px dashed #540821'__ 格式 | +| background | String | 否 | 字体背景色 | +| boxShadow | String | 否 | 阴影,需要严格遵循 __'10 20 20 rgba(0, 0, 0, 0.4)'__ 格式 | +| dash | Array | 否 | 虚线边框的间距和偏移 | +| padding | String | 否 | 内边距,'10 10 10 10', 与css有区别,依次为左、上、右、下,可以不带单位 | + +此外,上述所有的元素都可以增加 __delay:true__ 属性,来实现延迟绘制。 + +## wxml转换的方式 + +如上面的使用示例,声明type为wxml时,会查询绘制元素节点的样式并绘制。下表是对应属性: + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| type | String | 是 | 'wxml',声明转换wxml | +| x | Number | 是 | 坐标x,用于修正位置 | +| y | Number | 是 | 坐标y,用于修正位置 | +| class | String | 是 | 待查询绘制的节点类名,会查询所有相同的类名 | +| limit | String | 是 | 限定节点的外围容器,在取坐标时,取与它的相对位置 | + +目前支持的wxml类型如下,需要声明在节点上: + +### 图片 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| data-type | String | 是 | 'image',矩形图片 | +| data-url | String | 是 | 图片链接 | +| data-left | Number | 否 | 修正横坐标位置 | +| data-top | Number | 否 | 修正纵坐标位置 | + +### 圆形图片 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| data-type | String | 是 | 'radius-image',圆形图片 | +| data-url | String | 是 | 图片链接 | +| data-left | Number | 否 | 修正横坐标位置 | +| data-top | Number | 否 | 修正纵坐标位置 | + +### 背景图片 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| data-type | String | 是 | 'background-image',背景图片 | +| data-left | Number | 否 | 修正横坐标位置 | +| data-top | Number | 否 | 修正纵坐标位置 | + +### 文本 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| data-type | String | 是 | 'text',文本 | +| data-text | String | 是 | 文本内容 | +| data-left | Number | 否 | 修正横坐标位置 | +| data-top | Number | 否 | 修正纵坐标位置 | +| data-padding | String | 否 | 内边距,与style叠加 | +| data-background | String | 否 | 背景色 | + +### 行内文本 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| data-type | String | 是 | 'inline-text',行内文本 | +| data-text | String | 是 | 文本内容 | +| data-left | Number | 否 | 修正横坐标位置 | +| data-top | Number | 否 | 修正纵坐标位置 | +| data-padding | String | 否 | 内边距,与style叠加 | +| data-background | String | 否 | 背景色 | + +### 行内图片 + +| 属性 | 类型 | 是否必填 | 说明 | +| -------- | ----- | ---- | --- | +| data-type | String | 是 | 'inline-image',矩形图片 | +| data-url | String | 是 | 图片链接 | +| data-left | Number | 否 | 修正横坐标位置 | +| data-top | Number | 否 | 修正纵坐标位置 | + +行内文本与图片有特殊处理逻辑,当top值相同时,按照从左到右顺序排列,可能会与展现有差异。 + +此外,上述所有的元素都可以增加 __delay:Number__ 属性,来实现延迟绘制, number范围:1-100,间接实现层级控制。 + + +## Todo + +> * 支持更多文本样式 +> * 支持任意角度圆角 diff --git a/node_modules/wxml2canvas/app.js b/node_modules/wxml2canvas/app.js new file mode 100755 index 0000000..f79b5a0 --- /dev/null +++ b/node_modules/wxml2canvas/app.js @@ -0,0 +1,5 @@ +App({ + onLaunch () { + + } +}) \ No newline at end of file diff --git a/node_modules/wxml2canvas/app.json b/node_modules/wxml2canvas/app.json new file mode 100755 index 0000000..4c1a482 --- /dev/null +++ b/node_modules/wxml2canvas/app.json @@ -0,0 +1,27 @@ +{ + "pages":[ + "pages/wxml/index", + "pages/index/index" + ], + "window":{ + "backgroundTextStyle":"light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "Wxml2Canvas", + "navigationBarTextStyle":"black" + }, + + "tabBar": { + "color": "#444444", + "selectedColor": "#000000", + "backgroundColor": "#ffffff", + "borderStyle": "black", + "position": "top", + "list": [{ + "text": "wxml转canvas", + "pagePath": "pages/wxml/index" + }, { + "text": "配置生成", + "pagePath": "pages/index/index" + }] + } +} \ No newline at end of file diff --git a/node_modules/wxml2canvas/app.wxss b/node_modules/wxml2canvas/app.wxss new file mode 100755 index 0000000..e69de29 diff --git a/node_modules/wxml2canvas/index.js b/node_modules/wxml2canvas/index.js new file mode 100755 index 0000000..a64e64a --- /dev/null +++ b/node_modules/wxml2canvas/index.js @@ -0,0 +1,3 @@ +import Wxml2Canvas from './src/index'; + +export default Wxml2Canvas; \ No newline at end of file diff --git a/node_modules/wxml2canvas/package.json b/node_modules/wxml2canvas/package.json new file mode 100644 index 0000000..f8d1134 --- /dev/null +++ b/node_modules/wxml2canvas/package.json @@ -0,0 +1,16 @@ +{ + "name": "wxml2canvas", + "version": "1.0.1", + "description": "将wxml指定节点转换成canvas元素", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "wxml2canvas", + "wxml", + "canvas" + ], + "author": "wg", + "license": "ISC" +} diff --git a/node_modules/wxml2canvas/pages/index/img/demo.png b/node_modules/wxml2canvas/pages/index/img/demo.png new file mode 100755 index 0000000..145e1a6 Binary files /dev/null and b/node_modules/wxml2canvas/pages/index/img/demo.png differ diff --git a/node_modules/wxml2canvas/pages/index/index.js b/node_modules/wxml2canvas/pages/index/index.js new file mode 100755 index 0000000..b4f0a59 --- /dev/null +++ b/node_modules/wxml2canvas/pages/index/index.js @@ -0,0 +1,411 @@ +import Wxml2Canvas from '../../src/index'; + +Page({ + data: { + + }, + + onLoad (res) { + this.drawImage1(); + this.drawImage2(); + this.drawImage3(); + this.drawImage4(); + this.drawImage5(); + this.drawImage6(); + this.drawImage7(); + this.drawImage8(); + }, + + drawImage1 () { + this.drawImage1 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas1', + gradientBackground: { + color: ['#27326b', '#540821'], + line: [0, 0, 0, 210] + }, + finish(url) { + }, + error (res) { + } + }); + }, + + drawImage2 () { + this.drawImage2 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas2', + background: '#f0f0f0', + finish(url) { + }, + error (res) { + } + }); + + let data2 = { + list: [{ + type: 'rect', + x: 10, + y: 10, + style: { + width: 150, + height: 80, + fill: { + color: ['#27326b', '#540821'], + line: [0, 0, 0, 110] + }, + border: '10px solid #aaaaaa', + } + },{ + type: 'rect', + x: 170, + y: 100, + style: { + width: 150, + height: 80, + fill: '#3762ab', + border: '10px dashed #540821', + boxShadow: '10 20 20 rgba(0, 0, 0, 0.4)', + // dash: [10, 20, 10] + } + }] + } + + this.drawImage2.draw(data2); + }, + + drawImage3 () { + this.drawImage3 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas3', + background: '#f0f0f0', + finish(url) { + }, + error (res) { + } + }); + + let text = '一行很长很长很长很长很长很长很长很长很长很长的文字'; + + let data3 = { + list: [{ + type: 'text', + text, + x: 0, + y: 0, + style: { + textAlign: 'left', + width: 130, + height: 80, + fontSize: 14, + lineHeight: 16, + fontWeight: 'bold', + boxShadow: '5 5 20 rgba(255, 0, 0, 0.5)', + } + }, { + type: 'text', + text, + x: 170, + y: 0, + style: { + textAlign: 'center', + width: 130, + fontSize: 14, + lineHeight: 16, + color: '#888888', + } + }, { + type: 'text', + text, + x: 0, + y: 70, + style: { + textAlign: 'right', + width: 130, + fontSize: 14, + lineHeight: 16, + fontFamily: 'Serif' + } + }, { + type: 'text', + text, + x: 170, + y: 70, + style: { + textAlign: 'center', + width: 130, + lineClamp: 2, + fontSize: 14, + lineHeight: 16, + } + }, { + type: 'text', + text, + x: 0, + y: 140, + style: { + textAlign: 'left', + width: 130, + fontSize: 14, + lineHeight: 16, + height: 60, + background: 'rgba(0, 111, 255, 0.5)', + color: '#ffffff' + } + }, { + type: 'text', + text, + x: 170, + y: 140, + style: { + textAlign: 'left', + width: 130, + background: 'rgba(255, 0, 0, 0.3)', + fontSize: 14, + lineHeight: 16, + height: 60, + border: '2px solid #000000', + padding: '5 10 0 10' + } + }] + } + + this.drawImage3.draw(data3); + }, + + drawImage4 () { + this.drawImage4 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas4', + background: '#f0f0f0', + finish(url) { + }, + error (res) { + } + }); + + let data4 = { + list: [{ + type: 'circle', + x: 30, + y: 30, + style: { + r: 40, + fill: { + color: ['#27326b', '#540821'], + line: [0, 0, 0, 110] + }, + border: '10px solid #aaaaaa', + boxShadow: '10 10 20 rgba(0, 0, 0, 0.6)', + } + },{ + type: 'circle', + x: 200, + y: 100, + style: { + r: 40, + fill: '#3762ab', + border: '10px dashed #540821', + // dash: [10, 20, 10] + } + }] + } + + this.drawImage4.draw(data4); + }, + + drawImage5 () { + this.drawImage5 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas5', + background: '#f0f0f0', + finish(url) { + }, + error (res) { + } + }); + + let data5 = { + list: [{ + type: 'line', + x: 30, + y: 30, + x2: 200, + y2: 30, + style: { + width: 10, + // stroke: '#3762ab', + stroke: { + color: ['#27326b', '#540821'], + line: [0, 0, 200, 10] + }, + } + },{ + type: 'line', + x: 30, + y: 100, + x2: 200, + y2: 100, + style: { + r: 40, + width: 10, + stroke: '#3762ab', + dash: [10, 10, 0], + boxShadow: '20 20 20 rgba(0, 0, 0, 0.3)', + } + }] + } + + this.drawImage5.draw(data5); + }, + + drawImage6 () { + this.drawImage6 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas6', + background: '#f0f0f0', + finish(url) { + }, + error (res) { + } + }); + + let data6 = { + list: [{ + type: 'image', + x: 10, + y: 10, + url: 'https://mmocgame.qpic.cn/wechatgame/duc2TvpEgSQCEa0WicosqlEgJiacYLaTLEDFB8Kq9Hr7LjAVhM8wu8TT77KqNezQnH/0', + style: { + width: 150, + height: 80, + border: '10px solid #aaaaaa', + boxShadow: '10 20 20 rgba(0, 0, 0, 0.4)', + } + },{ + type: 'image', + x: 170, + y: 100, + url: './img/demo.png', + style: { + width: 150, + height: 80, + border: '10px dashed #540821', + // dash: [10, 20, 10] + } + }] + } + + this.drawImage6.draw(data6); + }, + + drawImage7 () { + this.drawImage7 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas7', + background: '#f0f0f0', + finish(url) { + }, + error (res) { + } + }); + + let data7 = { + list: [{ + type: 'radius-image', + x: 10, + y: 10, + url: './img/demo.png', + style: { + r: 40, + border: '10px solid #aaaaaa', + boxShadow: '10 10 20 rgba(0, 0, 0, 0.6)', + } + },{ + type: 'radius-image', + x: 170, + y: 100, + url: './img/demo.png', + style: { + r: 40, + border: '10px dashed #540821', + // dash: [10, 20, 10] + } + }] + } + + this.drawImage7.draw(data7); + }, + + drawImage8 () { + this.drawImage8 = new Wxml2Canvas({ + width: 340, + height: 400, + element: 'canvas8', + background: '#f0f0f0', + finish(url) { + }, + error (res) { + } + }); + + let style = { + text: { + textAlign: 'left', + width: 320, + fontSize: 16, + lineHeight: 25, + } + } + + let text = [ + 'Wxml2Cavnas库,是一个生成小程序分享图的通用方案,提供了两种绘制方式:', + '封装基础图形的绘制接口,包括矩形、圆形、线条、图片、圆角图片、纯文本等,使用时只需要声明元素类型并提供关键数据即可,不需要再关注canvas的具体绘制过程;', + 'wxml直接转换成canvas元素,使用时传入待绘制的wxml节点的class类名,并且声明绘制此节点的类型(图片、文字等),会自动读取此节点的computedStyle,利用这些数据完成元素的绘制。', + ] + + let height1 = 20 + Math.ceil(this.drawImage8.measureWidth(text[0], '16px pingfang') / style.text.width) * style.text.lineHeight; + let height2 = height1 + 10 + Math.ceil(this.drawImage8.measureWidth(text[1], '16px pingfang') / style.text.width) * style.text.lineHeight; + let data8 = { + list: [ + { + type: 'text', + text: text[0], + x: 10, + y: 10, + style: style.text + }, { + type: 'text', + text: text[1], + x: 10, + y: height1, + style: style.text + }, { + type: 'image', + x: 10, + y: height2, + url: './img/demo.png', + style: { + width: 100, + height: 60, + } + }, { + type: 'text', + text: text[2], + x: 15, + y: height2 + 80, + style: style.text + } + ] + } + + this.drawImage8.draw(data8); + } +}); \ No newline at end of file diff --git a/node_modules/wxml2canvas/pages/index/index.json b/node_modules/wxml2canvas/pages/index/index.json new file mode 100755 index 0000000..9e26dfe --- /dev/null +++ b/node_modules/wxml2canvas/pages/index/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/node_modules/wxml2canvas/pages/index/index.wxml b/node_modules/wxml2canvas/pages/index/index.wxml new file mode 100755 index 0000000..f845feb --- /dev/null +++ b/node_modules/wxml2canvas/pages/index/index.wxml @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/node_modules/wxml2canvas/pages/index/index.wxss b/node_modules/wxml2canvas/pages/index/index.wxss new file mode 100755 index 0000000..edba1b9 --- /dev/null +++ b/node_modules/wxml2canvas/pages/index/index.wxss @@ -0,0 +1,18 @@ +.share{ + width: 100vw; + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; +} + +.share__canvas { + width: 680rpx; + height: 420rpx; + background: #f0f0f0; + margin-bottom: 60rpx; +} + +.share__canvas-long { + height: 800rpx; +} \ No newline at end of file diff --git a/node_modules/wxml2canvas/pages/wxml/img/demo.png b/node_modules/wxml2canvas/pages/wxml/img/demo.png new file mode 100755 index 0000000..145e1a6 Binary files /dev/null and b/node_modules/wxml2canvas/pages/wxml/img/demo.png differ diff --git a/node_modules/wxml2canvas/pages/wxml/img/emoji.png b/node_modules/wxml2canvas/pages/wxml/img/emoji.png new file mode 100755 index 0000000..02de382 Binary files /dev/null and b/node_modules/wxml2canvas/pages/wxml/img/emoji.png differ diff --git a/node_modules/wxml2canvas/pages/wxml/index.js b/node_modules/wxml2canvas/pages/wxml/index.js new file mode 100755 index 0000000..853e47c --- /dev/null +++ b/node_modules/wxml2canvas/pages/wxml/index.js @@ -0,0 +1,260 @@ +import Wxml2Canvas from '../../src/index'; + +Page({ + data: { + imgs: [] + }, + + onLoad (res) { + this.drawImage1(); + + setTimeout(() => { + this.drawImage2(); + }, 300); + + setTimeout(() => { + this.drawImage3(); + }, 600) + + setTimeout(() => { + this.drawImage4(); + }, 900) + + setTimeout(() => { + this.drawImage5(); + }, 1200) + + setTimeout(() => { + this.drawImage6(); + }, 1500) + }, + + saveImage (evt) { + let index = evt.target.dataset.index; + + wx.saveImageToPhotosAlbum({ + filePath: this.data.imgs[index], + success(res) { + wx.showToast({ + title: '保存成功', + icon: 'success' + }) + }, + fail () { + wx.showToast({ + title: '保存失败', + icon: 'none' + }) + } + }) + }, + + drawImage1 () { + let self = this; + this.drawImage1 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas1', + background: '#f0f0f0', + progress (percent) { + }, + finish(url) { + let imgs = self.data.imgs; + imgs.push(url); + + self.setData({ + imgs + }) + }, + error (res) { + } + }); + + let data = { + list: [{ + type: 'wxml', + class: '.share__canvas1 .draw_canvas', + limit: '.share__canvas1', + x: 0, + y: 0 + }] + } + + this.drawImage1.draw(data); + }, + + drawImage2 () { + let self = this; + this.drawImage2 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas2', + background: '#f0f0f0', + progress (percent) { + }, + finish(url) { + console.log(url) + let imgs = self.data.imgs; + imgs.push(url); + + self.setData({ + imgs + }) + }, + error (res) { + } + }); + + let data = { + list: [{ + type: 'wxml', + class: '.share__canvas2 .draw_canvas', + limit: '.share__canvas2', + x: 0, + y: 0 + }] + } + + this.drawImage2.draw(data); + }, + + drawImage3 () { + let self = this; + this.drawImage3 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas3', + background: '#f0f0f0', + progress (percent) { + // console.log(percent) + }, + finish(url) { + let imgs = self.data.imgs; + imgs.push(url); + + self.setData({ + imgs + }) + }, + error (res) { + } + }); + + let data = { + list: [{ + type: 'wxml', + class: '.share__canvas3 .draw_canvas', + limit: '.share__canvas3', + x: 0, + y: 0 + }] + } + + this.drawImage3.draw(data); + }, + + drawImage4 () { + let self = this; + this.drawImage4 = new Wxml2Canvas({ + width: 340, + height: 400, + element: 'canvas4', + background: '#f0f0f0', + progress (percent) { + // console.log(percent) + }, + finish(url) { + let imgs = self.data.imgs; + imgs.push(url); + + self.setData({ + imgs + }) + }, + error (res) { + } + }); + + let data = { + list: [{ + type: 'wxml', + class: '.share__canvas4 .draw_canvas', + limit: '.share__canvas4', + x: 0, + y: 0 + }] + } + + this.drawImage4.draw(data); + }, + + drawImage5 () { + let self = this; + this.drawImage5 = new Wxml2Canvas({ + width: 340, + height: 210, + element: 'canvas5', + background: '#f0f0f0', + progress (percent) { + // console.log(percent) + }, + finish(url) { + let imgs = self.data.imgs; + imgs.push(url); + + self.setData({ + imgs + }) + }, + error (res) { + } + }); + + let data = { + list: [{ + type: 'wxml', + class: '.share__canvas5 .draw_canvas', + limit: '.share__canvas5', + x: 0, + y: 0 + }] + } + + this.drawImage5.draw(data); + }, + + drawImage6 () { + let self = this; + this.drawImage6 = new Wxml2Canvas({ + width: 340, + height: 450, + element: 'canvas6', + background: '#f0f0f0', + progress (percent) { + // console.log(percent) + }, + finish(url) { + let imgs = self.data.imgs; + imgs.push(url); + + self.setData({ + imgs + }) + }, + error (res) { + } + }); + + let data = { + list: [{ + type: 'wxml', + class: '.share__canvas6 .draw_canvas', + limit: '.share__canvas6', + x: 0, + y: 0 + }] + } + + this.drawImage6.draw(data); + } +}); \ No newline at end of file diff --git a/node_modules/wxml2canvas/pages/wxml/index.json b/node_modules/wxml2canvas/pages/wxml/index.json new file mode 100755 index 0000000..9e26dfe --- /dev/null +++ b/node_modules/wxml2canvas/pages/wxml/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/node_modules/wxml2canvas/pages/wxml/index.wxml b/node_modules/wxml2canvas/pages/wxml/index.wxml new file mode 100755 index 0000000..bbe77ca --- /dev/null +++ b/node_modules/wxml2canvas/pages/wxml/index.wxml @@ -0,0 +1,84 @@ + \ No newline at end of file diff --git a/node_modules/wxml2canvas/pages/wxml/index.wxss b/node_modules/wxml2canvas/pages/wxml/index.wxss new file mode 100755 index 0000000..f364aa2 --- /dev/null +++ b/node_modules/wxml2canvas/pages/wxml/index.wxss @@ -0,0 +1,193 @@ +.share{ + width: 100vw; + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; + padding-top: 40rpx; + overflow: hidden; +} + +.share__canvas { + width: 700rpx; + height: 420rpx; + background: #f0f0f0; + margin-bottom: 40rpx; + font-size: 32rpx; +} + +.share__title { + width:100%; + margin-left: 80rpx; + margin-bottom: 40rpx; +} + +.share__canvas1-text { + color: #000000; +} + +.share__canvas1-text-2 { + color: #ff0000; + font-size: 36rpx; + margin-left: 20rpx; + margin-top: 20rpx; +} +.share__canvas1-text-3 { + color: #00ff00; + padding-left: 40rpx; + padding-top: 20rpx; +} +.share__canvas1-text-4 { + color: #0000ff; + margin-left: 20rpx; + margin-top: 20rpx; + width: 600rpx; + text-align: center; + background: rgba(255, 0, 0, 0.4); + padding: 20rpx; +} + +.share__canvas1-text-5 { + color: #0000ff; + margin-left: 20rpx; + margin-top: 20rpx; + width: 600rpx; + background: rgba(255, 0, 0, 0.4); + padding: 20rpx; +} + +.share__canvas2 { + position: relative; +} +.share__canvas2-image { + width: 200rpx; + height: 120rpx; + border: 2px solid #ff0000; + margin: 10rpx 20rpx; + box-shadow: 20rpx 20rpx 10rpx #cccccc; +} +.share__canvas2-image-2 { + width: 120rpx; + height: 120rpx; + border: 2px solid #ff0000; + margin: 10rpx 20rpx; + box-shadow: 20rpx 20rpx 10rpx #cccccc; + border-radius: 100%; +} + +.share__canvas2-image-3 { + width: 200rpx; + height: 120rpx; + border: 2px solid #ff0000; + margin: 10rpx 20rpx; + background-size: 200rpx 120rpx; +} + +.share__canvas2-image-4 { + width: 200rpx; + height: 60rpx; + position: absolute; + right: 20rpx; + top: 100rpx; + background-size: 200rpx 60rpx; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIkAAAApCAYAAAABOAonAAAEGWlDQ1BrQ0dDb2xvclN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0VasW3hz3bJ6oZG4XRfRnaTrAeBiWoygNygV0yKGrsZ46WDfBCwzO95qrTFQ/9IfuwfpwpjrJ34h8nM2cBAm6sw8c74yPPOuhC0AGmIALecaiA87HVpwO6cOOzhaMJ8DYI0U9e8SONMYQ8diQ/VInMg4510hzrM3cNMAGEBkDO5GemI/f1IEHDx5SNjxrtSR2Qz+Cq6RWIkhKGvhHeIaTiouuP8L+3R5LhpCT+oN+/xKAAKyy1gKQlLJHfwmwSlmFUp8uAEmpm7TsTRiApOz5tNR3FICk1E1a9iYMQFL2fFrqOwpAUuomLXsTBiApez4t9R0FICl1k5a9Cf8HOwekO+S1S2IAAAAASUVORK5CYII=) +} + +.share__canvas3 { + padding: 30rpx; + box-sizing: border-box; +} +.share__canvas3-inline { + display: inline; + vertical-align: middle; + line-height: 50rpx; +} + +.share__canvas3-inline_bold { + font-weight: bold; +} + +.share__canvas-emoji { + width: 42rpx; + height: 42rpx; + vertical-align: top; + padding: 4rpx 0rpx; +} + +.share__canvas4 { + padding: 30rpx; + box-sizing: border-box; + height: 800rpx; +} + +.share__canvas4-block { + line-height: 50rpx; + margin-bottom: 30rpx; +} + +.share__canvas4-image { + width: 200rpx; + height: 120rpx; + padding: 0 0 20rpx; +} + +.share__result-img { + width: 700rpx; + height: 420rpx; + margin-bottom: 30rpx; +} + +.share__result-img-4 { + height: 800rpx; +} + +.share__canvas5 { + position: relative; +} + +.share__canvas5-image { + width: 600rpx; + height: 360rpx; + margin-left: 30rpx +} + +.share__canvas5-text { + position: absolute; + bottom: 0; + width: 400rpx; + margin-left: 100rpx; + height: 60rpx; + line-height: 60rpx; + text-align: center; +} + +.share__canvas5-text-2 { + position: absolute; + top: 100rpx; + right: 100rpx; +} + +.share__button { + margin-bottom: 30rpx; + width: 240rpx; +} + +.share__canvas6-image { + width: 216rpx; + height: 116rpx; + margin: 0 5rpx; +} + +.share__canvas6-image-2 { + width: 240rpx; + height: 216rpx; + margin: 20rpx 5rpx 0; +} + +.share__canvas6 { + height: 900rpx; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + flex-wrap: wrap; +} diff --git a/node_modules/wxml2canvas/project.config.json b/node_modules/wxml2canvas/project.config.json new file mode 100755 index 0000000..3fd15ab --- /dev/null +++ b/node_modules/wxml2canvas/project.config.json @@ -0,0 +1,40 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "urlCheck": false, + "es6": true, + "postcss": true, + "minified": true, + "newFeature": true, + "autoAudits": false + }, + "compileType": "miniprogram", + "libVersion": "2.6.2", + "appid": "", + "projectname": "wxml2canvas", + "debugOptions": { + "hidedInDevtools": [] + }, + "isGameTourist": false, + "condition": { + "search": { + "current": -1, + "list": [] + }, + "conversation": { + "current": -1, + "list": [] + }, + "game": { + "currentL": -1, + "list": [] + }, + "miniprogram": { + "current": -1, + "list": [] + } + } +} \ No newline at end of file diff --git a/node_modules/wxml2canvas/src/index.js b/node_modules/wxml2canvas/src/index.js new file mode 100755 index 0000000..293923f --- /dev/null +++ b/node_modules/wxml2canvas/src/index.js @@ -0,0 +1,1392 @@ +import Util from './util'; + +const imageMode = ['scaleToFill', 'aspectFit', 'aspectFill', 'widthFix', 'top', 'bottom', 'center', 'left', 'right', 'top left', 'top right', 'bottom left', 'bottom right'] + +class Wxml2Canvas { + constructor (options = {}) { + this.device = wx.getSystemInfoSync && wx.getSystemInfoSync() || {}; + + if (!options.zoom) { + this.zoom = this.device.windowWidth / 375; + } else { + this.zoom = options.zoom || 1; + } + + this.element = options.element; + this.object = options.obj; + this.width = options.width * this.zoom || 0; + this.height = options.height * this.zoom || 0; + this.destZoom = options.destZoom || 3; + this.destWidth = this.width * this.destZoom; + this.destHeight = this.height * this.destZoom; + this.translateX = options.translateX * this.zoom || 0; + this.translateY = options.translateY * this.zoom || 0; + this.gradientBackground = options.gradientBackground || null; + this.background = options.background || '#ffffff'; + this.finishDraw = options.finish || function finish(params) {} + this.errorHandler = options.error || function error(params) {} + this.progress = options.progress || function progress(params) {} + this.textAlign = options.textAlign || 'left'; + this.fullText = options.fullText || false; + this.font = options.font || '14px PingFang SC'; + + this._init(); + } + + draw (data = {}, that) { + let self = this; + this.data = data; + this.fef = that; + + this.progress(10); + this._preloadImage(data.list).then((result) => { + this.progress(30); + self._draw(); + }).catch((res) => { + self.errorHandler(res); + }) + } + + measureWidth (text, font) { + if(font) { + this.ctx.font = font; + } + let res = this.ctx.measureText(text) || {}; + return res.width || 0; + } + + _init () { + this.progressPercent = 0; // 绘制进度百分比 + this.data = null; + this.ref = null; + this.allPic = []; + this.screenList = []; + this.asyncList = []; + this.imgUrl = ''; + this.progressPercent = 0; + this.distance = 0; + this.progress(0); + + this.ctx = wx.createCanvasContext(this.element, this.obj); + this.ctx.font = this.font; + this.ctx.setTextBaseline('top'); + this.ctx.setStrokeStyle('white'); + + this.debug = this.device.platform === 'devtools' ? true : false; + + this._drawBakcground(); + } + + _drawBakcground () { + if (this.gradientBackground) { + let line = this.gradientBackground.line || [0, 0, 0, this.height]; + let color = this.gradientBackground.color || ['#fff', '#fff']; + let style = { fill: { line, color } } + this._drawRectToCanvas(0, 0, this.width, this.height, style); + } else { + let style = { fill: this.background } + this._drawRectToCanvas(0, 0, this.width, this.height, style); + } + } + + _draw () { + let self = this; + let list = this.data.list || []; + let index = 0; + let all = []; + let count = 0; + + list.forEach(item => { + if(item.type === 'wxml') { + count += 3; + } else { + count += 1; + } + }) + + this.distance = 60 / (count || 1); // 进度条的间距 + this.progressPercent = 30; + this.asyncList = list.filter( item => item.delay == true ); + list = list.filter( item => item.delay != true ); + drawList(list); + + Promise.all(all).then(results => { + index = 0; + drawList(self.asyncList, true); + + Promise.all(all).then(results => { + self.progress(90); + self._saveCanvasToImage(); + }); + }).catch (e => { + console.log(e) + self.errorHandler(e); + }); + + function drawList(list = [], noDelay) { + list.forEach((item, i) => { + all[index++] = new Promise((resolve, reject) => { + let attr = item.style; + item.progress = self.distance; + if (noDelay) { + item.delay = 0; + } + if (item.type === 'radius-image') { + self._drawCircle(item, attr, resolve, reject, 'image'); + } else if (item.type === 'text') { + self._drawText(item, attr, resolve, reject); + } else if (item.type === 'line') { + self._drawLine(item, attr, resolve, reject); + } else if (item.type === 'circle') { + self._drawCircle(item, attr, resolve, reject); + } else if (item.type === 'rect') { + self._drawRect(item, attr, resolve, reject); + } else if (item.type === 'image') { + self._drawRect(item, attr, resolve, reject, 'image'); + } else if (item.type === 'wxml') { + self._drawWxml(item, attr, resolve, reject); + }else { + resolve(); + } + }); + }); + } + } + + _saveCanvasToImage () { + let self = this; + + // 延时保存有两个原因,一个是等待绘制delay的元素,另一个是安卓上样式会错乱 + setTimeout(() => { + self.progress(95); + + let obj = { + x: 0, + y: 0, + width: self.width, + height: self.height, + canvasId: self.element, + success: function (res) { + + self.progress(100); + self.imgUrl = res.tempFilePath; + self.finishDraw(self.imgUrl); + }, + fail: function (res) { + + self.errorHandler({errcode: 1000, errmsg: 'save canvas error', e: res}); + } + } + + if(self.destZoom !== 3) { + obj.destWidth = self.destWidth; + obj.destHeight = self.destHeight; + } + + wx.canvasToTempFilePath(obj, self.object); + }, self.device.system.indexOf('iOS') === -1 ? 300 : 100); + } + + _preloadImage (list = []) { + let self = this; + let all = []; + let count = 0; + + list.forEach((item, i) => { + if (item.url && self._findPicIndex(item.url) === -1) { + + // 避免重复下载同一图片 + self.allPic.push({ + url: item.url, + local: '' + }); + all[count++] = new Promise((resolve, reject) => { + // 非http(s)域名的就不下载了 + if (!/^http/.test(item.url) || /^http:\/\/(tmp)|(usr)\//.test(item.url) || /^http:\/\/127\.0\.0\.1/.test(item.url)) { + if(item.isBase64) { + let fileManager = wx.getFileSystemManager(); + + fileManager.writeFile({ + filePath: item.url, + data: item.isBase64.replace(/data:image\/(.*);base64,/, ''), + encoding: 'base64', + success (res) { + imageInfo(item.url); + }, + fail (res) { + reject(res); + }, + }) + + }else { + imageInfo(item.url); + } + + function imageInfo (url) { + wx.getImageInfo({ + src: url, + success (res) { + let index = self._findPicIndex(url); + if(index > -1) { + self.allPic[index].local = url; + self.allPic[index].width = res.width; + self.allPic[index].height = res.height; + } + resolve({ tempFilePath: url }); + }, + fail (res) { + reject(res); + } + }) + } + } else { + wx.downloadFile({ + url: item.url.replace(/^https?/, 'https'), + success: function (res) { + wx.getImageInfo({ + src: res.tempFilePath, + success (img) { + let index = self._findPicIndex(item.url); + if (index > -1) { + self.allPic[index].local = res.tempFilePath; + self.allPic[index].width = img.width; + self.allPic[index].height = img.height; + } + resolve(res); + }, + fail (res) { + reject(res); + } + }) + }, + fail: (res) => { + reject({errcode: 1001, errmsg: 'download pic error'}); + } + }) + } + }) + } + }); + + return Promise.all(all).then(results => { + return new Promise(resolve => { resolve() }) + }).catch((results) => { + return new Promise((resolve, reject) => { reject(results) }) + }) + } + + _findPicIndex (url) { + let index = this.allPic.findIndex(pic => pic.url === url); + return index; + } + + _drawRect (item, style, resolve, reject, isImage, isWxml) { + let zoom = this.zoom; + let leftOffset = 0; + let topOffset = 0; + let width = style.width; + let height = style.height; + let imgWidth = style.width; + let imgHeight = style.height; + let mode = null; + + try { + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style); + + let url; + if(isImage) { + let index = this._findPicIndex(item.url); + if(index > -1) { + url = this.allPic[index].local + imgWidth = this.allPic[index].width + imgHeight = this.allPic[index].height + }else { + url = item.url; + } + } + + style.padding = style.padding || []; + if(isWxml === 'inline-wxml') { + item.x = item.x + (style.padding[3] && style.padding[3] || 0) + item.y = item.y + (style.padding[0] && style.padding[0] || 0) + } + + leftOffset = item.x + style.width + (style.padding[1] && style.padding[1] || 0); + + if(!isWxml) { + width = width * zoom; + height = height * zoom; + } + + if(style.dataset && style.dataset.mode && imageMode.indexOf(style.dataset.mode) > -1) { + mode = { + type: style.dataset.mode, + width: imgWidth, + height: imgHeight + }; + } + + this._drawRectToCanvas(item.x, item.y, width, height, style, url, mode); + this._updateProgress(item.progress); + + if(resolve) { + resolve(); + }else { + return { + leftOffset, + topOffset + } + } + } catch (e) { + reject && reject({ errcode: (isImage ? 1003 : 1002), errmsg: (isImage ? 'drawImage error' : 'drawRect error'), e }); + } + } + + _drawRectToCanvas (x, y, width, height, style, url, mode) { + let { fill, border, boxShadow } = style; + this.ctx.save(); + this._drawBoxShadow(boxShadow, (res) => { + // 真机上填充渐变色时,没有阴影,先画个相等大小的纯色矩形来实现阴影 + if(fill && typeof fill !== 'string' && !this.debug) { + this.ctx.setFillStyle(res.color || '#ffffff'); + this.ctx.fillRect(x, y, width, height); + } + }); + + if(url) { + // 开发者工具有bug,先不裁剪 + if(mode) { + this._resetImageByMode(url, x, y, width, height, mode); + }else { + this.ctx.drawImage(url, x, y, width, height) + } + }else { + this._setFill(fill, () => { + this.ctx.fillRect(x, y, width, height); + }); + } + + this._drawBorder(border, style, (border) => { + let fixBorder = border.width; + this.ctx.strokeRect(x - fixBorder / 2, y - fixBorder / 2, width + fixBorder, height + fixBorder); + }); + + this.ctx.draw(true); + this.ctx.restore(); + } + + _resetImageByMode (url, x, y, width, height, mode) { + let self = this; + let offsetX = 0; + let offsetY = 0; + let imgWidth = mode.width; + let imgHeight = mode.height; + + switch (mode.type) { + case 'scaleToFill': + imgWidth = width; + imgHeight = height; + self.ctx.drawImage(url, x, y, width, height) + break; + case 'widthFix': + height = width / ((imgWidth || 1) / (imgHeight || 1)) + self.ctx.drawImage(url, x, y, width, height) + break; + case 'aspectFit': + if(imgWidth > imgHeight) { + let realHeight = width / ((imgWidth || 1) / (imgHeight || 1)) + offsetY = -(height - realHeight) / 2 + imgWidth = width; + imgHeight = realHeight; + }else { + let realWidth = height / ((imgHeight || 1) / (imgWidth || 1)) + offsetX = -(width - realWidth) / 2 + imgWidth = realWidth; + imgHeight = height; + } + + _clip(); + break; + case 'aspectFill': + if(imgWidth > imgHeight) { + let realWidth = imgWidth / ((imgHeight || 1) / (height || 1)) + offsetX = (realWidth - width) / 2 + imgWidth = realWidth; + imgHeight = height; + }else { + let realHeight = imgHeight / ((imgWidth || 1) / (width || 1)) + offsetY = (realHeight - height) / 2 + imgWidth = width; + imgHeight = realHeight; + } + + _clip(); + break; + case 'top left': + _clip(); + break; + case 'top': + offsetX = (mode.width - width) / 2; + _clip(); + break; + case 'top right': + offsetX = (mode.width - width); + _clip(); + break; + case 'left': + offsetY = (mode.height - height) / 2; + _clip(); + break; + case 'center': + offsetX = (mode.width - width) / 2; + offsetY = (mode.height - height) / 2; + _clip(); + break; + case 'right': + offsetX = (mode.width - width); + offsetY = (mode.height - height) / 2; + _clip(); + break; + case 'bottom left': + offsetY = (mode.height - height) + _clip(); + break; + case 'bottom': + offsetX = (mode.width - width) / 2; + offsetY = (mode.height - height) + _clip(); + break; + case 'bottom right': + offsetX = (mode.width - width); + offsetY = (mode.height - height) + _clip(); + break; + default: + imgWidth = width; + imgHeight = height; + break; + } + + function _clip () { + self.ctx.save(); + self.ctx.beginPath() + self.ctx.rect(x, y, width, height) + self.ctx.clip(); + self.ctx.drawImage(url, x - offsetX, y - offsetY, imgWidth, imgHeight) + self.ctx.closePath(); + self.ctx.restore(); + } + } + + _drawText (item, style, resolve, reject, type, isWxml) { + let zoom = this.zoom; + let leftOffset = 0; + let topOffset = 0; + + try { + style.fontSize = this._parseNumber(style.fontSize); + let fontSize = Math.ceil((style.fontSize || 14) * zoom) + this.ctx.setTextBaseline('top'); + this.ctx.font = (`${style.fontWeight ? (style.fontWeight) : 'normal'} ${ fontSize }px ${ style.fontFamily || 'PingFang SC' }`); + this.ctx.setFillStyle(style.color || '#454545'); + + let text = item.text || ''; + let textWidth = Math.floor(this.measureWidth(text, style.font || this.ctx.font)); + let lineHeight = this._getLineHeight(style); + let textHeight = Math.ceil(textWidth / (style.width || textWidth)) * lineHeight; + let width = Math.ceil((style.width || textWidth) * (!isWxml ? zoom : 1)); + let whiteSpace = style.whiteSpace || 'wrap'; + let x = 0; + let y = 0; + + if(typeof style.padding === 'string') { + style.padding = Util.transferPadding(style.padding); + } + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style, textHeight); + this._drawBoxShadow(style.boxShadow); + + if(style.background || style.border) { + this._drawTextBackgroud(item, style, textWidth, textHeight, isWxml); + } + + // 行内文本 + if(type === 'inline-text') { + width = item.maxWidth; + if(item.leftOffset + textWidth > width) { + // 如果上一个行内元素换行了,这个元素要继续在后面补足一行 + let lineNum = Math.max(Math.floor(textWidth / width), 1); + let length = text.length; + let singleLength = Math.floor(length / lineNum); + let widthOffset = item.leftOffset ? item.leftOffset - item.originX : 0; + let { endIndex: currentIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, 0, widthOffset) + x = this._resetTextPositionX(item, style, singleWidth); + y = this._resetTextPositionY(item, style); + this.ctx.fillText(single, x, y); + leftOffset = x + singleWidth; + topOffset = y; + + // 去除第一行补的内容,然后重置 + text = text.substring(currentIndex, text.length); + currentIndex = 0; + lineNum = Math.max(Math.floor(textWidth / width), 1); + textWidth = Math.floor(this.measureWidth(text, style.font || this.ctx.font)); + item.x = item.originX; // 还原换行后的x + for (let i = 0; i < lineNum; i++) { + let { endIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, currentIndex); + currentIndex = endIndex; + if(single) { + x = this._resetTextPositionX(item, style, singleWidth, width); + y = this._resetTextPositionY(item, style, i + 1); + this.ctx.fillText(single, x, y); + if(i === lineNum - 1) { + leftOffset = x + singleWidth; + topOffset = lineHeight * lineNum; + } + } + } + + let last = text.substring(currentIndex, length); + let lastWidth = this.measureWidth(last); + + if(last) { + x = this._resetTextPositionX(item, style, lastWidth, width); + y = this._resetTextPositionY(item, style, lineNum + 1); + this.ctx.fillText(last, x, y); + leftOffset = x + lastWidth; + topOffset = lineHeight * (lineNum + 1); + } + }else { + x = this._resetTextPositionX(item, style, textWidth, width); + y = this._resetTextPositionY(item, style); + this.ctx.fillText(item.text, x, y); + leftOffset = x + textWidth; + topOffset = lineHeight; + } + }else { + // block文本,如果文本长度超过宽度换行 + if (width && textWidth > width && whiteSpace !== 'nowrap') { + let lineNum = Math.max(Math.floor(textWidth / width), 1); + let length = text.length; + let singleLength = Math.floor(length / lineNum); + let currentIndex = 0; + + // lineClamp参数限制最多行数 + if (style.lineClamp && lineNum + 1 > style.lineClamp) { + lineNum = style.lineClamp - 1; + } + + for (let i = 0; i < lineNum; i++) { + let { endIndex, single, singleWidth } = this._getTextSingleLine(text, width, singleLength, currentIndex); + currentIndex = endIndex; + x = this._resetTextPositionX(item, style, singleWidth, width); + y = this._resetTextPositionY(item, style, i); + this.ctx.fillText(single, x, y); + + } + + // 换行后剩余的文字,超过一行则截断增加省略号 + let last = text.substring(currentIndex, length); + let lastWidth = this.measureWidth(last); + if(lastWidth > width) { + let { single, singleWidth } = this._getTextSingleLine(last, width, singleLength); + lastWidth = singleWidth; + last = single.substring(0, single.length - 1) + '...'; + } + + x = this._resetTextPositionX(item, style, lastWidth, width); + y = this._resetTextPositionY(item, style, lineNum); + this.ctx.fillText(last, x, y); + + }else { + x = this._resetTextPositionX(item, style, textWidth, width); + y = this._resetTextPositionY(item, style); + this.ctx.fillText(item.text, x, y); + } + } + + this.ctx.draw(true); + + this._updateProgress(item.progress); + + if(resolve) { + resolve(); + }else { + return { + leftOffset, + topOffset + } + } + } catch(e) { + reject && reject({ errcode: 1004, errmsg: 'drawText error', e: e }); + } + } + + _drawTextBackgroud (item, style, textWidth, textHeight, isWxml) { + if(!style.width) return; + let zoom = isWxml ? 1 : this.zoom; + let width = style.width || textWidth; + let height = style.height || textHeight; + let rectStyle = { + fill: style.background, + border: style.border + } + style.padding = style.padding || [0, 0, 0, 0]; + width += (style.padding[1] || 0) + (style.padding[3] || 0); + height += (style.padding[0] || 0) + (style.padding[2] || 0); + width = width * zoom + height = height * zoom + this._drawRectToCanvas(item.x, item.y, width, height, rectStyle); + } + + _drawCircle (item, style, resolve, reject, isImage, isWxml) { + let zoom = this.zoom; + let r = style.r; + try { + + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style); + + let url; + if(isImage) { + let index = this._findPicIndex(item.url); + if (index > -1) { + url = this.allPic[index].local; + } else { + url = item.url; + } + } + + if(!isWxml) { + r = r * zoom; + } + + this._drawCircleToCanvas(item.x, item.y, r, style, url); + + this._updateProgress(item.progress); + resolve && resolve(); + } catch (e) { + reject && reject({ errcode: (isImage ? 1006 : 1005), errmsg: (isImage ? 'drawCircleImage error' : 'drawCircle error'), e }); + } + } + + _drawCircleToCanvas (x, y, r, style, url) { + let { fill, border, boxShadow } = style; + + this.ctx.save(); + + this._drawBoxShadow(boxShadow, (res) => { + // 真机上填充渐变色时,没有阴影,先画个相等大小的纯色矩形来实现阴影 + if((fill && typeof fill !== 'string') || (url && res.color)) { + this.ctx.setFillStyle(res.color || '#ffffff'); + this.ctx.beginPath(); + this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI); + this.ctx.closePath(); + this.ctx.fill(); + } + }); + + if(url) { + this.ctx.save(); + this.ctx.beginPath(); + this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI); + this.ctx.clip(); + this.ctx.drawImage(url, x, y, r * 2, r * 2); + this.ctx.closePath(); + this.ctx.restore(); + }else { + this._setFill(fill, () => { + this.ctx.beginPath(); + this.ctx.arc(x + r, y + r, r, 0, 2 * Math.PI); + this.ctx.closePath(); + this.ctx.fill(); + }); + } + + this._drawBorder(border, style, (border) => { + this.ctx.beginPath() + this.ctx.arc(x + r, y + r, r + border.width / 2, 0, 2 * Math.PI) + this.ctx.stroke() + this.ctx.closePath(); + }); + + this.ctx.draw(true); + this.ctx.restore(); + } + + _drawLine (item, style, resolve, reject, isWxml) { + let zoom = this.zoom; + try { + let x1 = item.x * zoom + this.translateX; + let y1 = item.y * zoom + this.translateY; + let x2 = item.x2 * zoom + this.translateX; + let y2 = item.y2 * zoom + this.translateY; + this._drawLineToCanvas(x1, y1, x2, y2, style); + + this._updateProgress(item.progress); + resolve && resolve(); + } catch (e) { + reject && reject({ errcode: 1007, errmsg: 'drawLine error', e }); + } + } + + _drawLineToCanvas (x1, y1, x2, y2, style) { + let { stroke, dash, boxShadow } = style; + + this.ctx.save(); + if(stroke) { + this._setStroke(stroke); + } + + this._drawBoxShadow(boxShadow); + + if(dash) { + let dash = [style.dash[0] || 5, style.dash[1] || 5]; + let offset = style.dash[2] || 0; + this.ctx.setLineDash(dash, offset || 0); + } + + this.ctx.moveTo(x1, y1); + this.ctx.setLineWidth((style.width || 1) * this.zoom); + this.ctx.lineTo(x2, y2); + this.ctx.stroke(); + this.ctx.draw(true); + this.ctx.restore(); + } + + // 废弃,合并到_drawRect + _drawImage (item, style, resolve, reject, isWxml) { + let zoom = this.zoom; + try { + + item.x = this._resetPositionX(item, style); + item.y = this._resetPositionY(item, style); + item.x = item.x + (style.padding[3] || 0); + item.y = item.y + (style.padding[0] || 0); + + let index = this._findPicIndex(item.url); + let url = index > -1 ? this.allPic[index].local : item.url; + this._drawImageToCanvas(url, item.x, item.y, style.width * zoom, style.height * zoom, style); + + this._updateProgress(item.progress); + resolve && resolve(); + } catch (e) { + reject && reject({ errcode: 1012, errmsg: 'drawRect error', e }); + } + } + + // 废弃,合并到_drawRect + _drawImageToCanvas (url, x, y, width, height, style) { + let { fill, border, boxShadow } = style; + this.ctx.save(); + + this._drawBoxShadow(boxShadow); + this.ctx.drawImage(url, x, y, width, height); + + this._drawBorder(border, style, (border) => { + let fixBorder = border.width; + this.ctx.strokeRect(x - fixBorder / 2, y - fixBorder / 2, width + fixBorder, height + fixBorder); + }); + this.ctx.draw(true); + this.ctx.restore(); + } + + _drawWxml (item, style, resolve, reject) { + let self = this; + let all = []; + try { + this._getWxml(item, style).then((results) => { + + // 上 -> 下 + let sorted = self._sortListByTop(results[0]); + let count = 0; + let progress = 0; + Object.keys(sorted).forEach(item => { + count += sorted[item].length; + }) + progress = this.distance * 3 / (count || 1); + + all = this._drawWxmlBlock(item, sorted, all, progress, results[1]); + all = this._drawWxmlInline(item, sorted, all, progress, results[1]); + + Promise.all(all).then(results => { + resolve && resolve(); + }).catch (e => { + reject && reject(e); + }); + }); + } catch (e) { + reject && reject({ errcode: 1008, errmsg: 'drawWxml error' }); + } + } + + _drawWxmlBlock (item, sorted, all, progress, results) { + let self = this; + // 用来限定位置范围,取相对位置 + let limitLeft = (results ? results.left : 0); + let limitTop = (results ? results.top : 0); + Object.keys(sorted).forEach((top, topIndex) => { + // 左 -> 右 + let list = sorted[top].sort((a, b) => { + return (a.left - b.left); + }); + + list = list.filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') === -1); + + list.forEach((sub, index) => { + all[index] = new Promise((resolve2, reject2) => { + sub = self._transferWxmlStyle(sub, item, limitLeft, limitTop); + sub.progress = progress; + let type = sub.dataset.type; + if(sub.dataset.delay) { + setTimeout(() => { + drawWxmlItem(); + }, sub.dataset.delay) + } else { + drawWxmlItem(); + } + function drawWxmlItem () { + if (type === 'text') { + self._drawWxmlText(sub, resolve2, reject2); + } else if (type === 'image') { + self._drawWxmlImage(sub, resolve2, reject2); + } else if (type === 'radius-image') { + self._drawWxmlCircleImage(sub, resolve2, reject2); + } else if (type === 'background-image') { + self._drawWxmlBackgroundImage(sub, resolve2, reject2); + } + } + }); + }); + }); + + return all; + + } + + _drawWxmlInline (item, sorted, all, progress, results) { + let self = this; + let topOffset = 0; + let leftOffset = 0; + let lastTop = 0; + let limitLeft = (results ? results.left : 0); + let limitTop = (results ? results.top : 0); + let p = new Promise((resolve2, reject2) => { + let maxWidth = 0; + let minLeft = Infinity; + let maxRight = 0; + + // 找出同一top下的最小left和最大right,得到最大的宽度,用于换行 + Object.keys(sorted).forEach(top => { + let inlineList = sorted[top].filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') > -1); + inlineList.forEach(sub => { + if(sub.left < minLeft) { + minLeft = sub.left + } + if(sub.right > maxRight) { + maxRight = sub.right; + } + }) + }); + maxWidth = Math.ceil((maxRight - minLeft) || self.width); + + Object.keys(sorted).forEach((top, topIndex) => { + // 左 -> 右 + let list = sorted[top].sort((a, b) => { + return (a.left - b.left); + }); + + // 换行的行内元素left放到后面,version2.0.6后无法获取高度,改用bottom值来判断是否换行了 + let position = -1; + for(let i = 0, len = list.length; i < len; i++) { + if(list[i] && list[i + 1]) { + if(list[i].bottom > list[i + 1].bottom) { + position = i; + break; + } + } + } + + if(position > -1) { + list.push(list.splice(position, 1)[0]); + } + + let inlineList = list.filter(sub => sub.dataset.type && sub.dataset.type.indexOf('inline') > -1); + let originLeft = (inlineList[0] ? inlineList[0].left : 0); + // 换行后和top不相等时,认为是换行了,要清除左边距;当左偏移量大于最大宽度时,也要清除左边距; 当左偏移小于左边距时,也要清除 + if (Math.abs(topOffset + lastTop - top) > 2 || leftOffset - originLeft - limitLeft >= maxWidth || leftOffset <= originLeft - limitLeft - 2) { + leftOffset = 0; + } + + lastTop = +top; + topOffset = 0; + + inlineList.forEach((sub, index) => { + sub = self._transferWxmlStyle(sub, item, limitLeft, limitTop); + sub.progress = progress; + let type = sub.dataset.type; + if (type === 'inline-text') { + let drawRes = self._drawWxmlInlineText(sub, leftOffset, maxWidth); + leftOffset = drawRes.leftOffset; + topOffset = drawRes.topOffset; + } else if (type === 'inline-image') { + let drawRes = self._drawWxmlImage(sub) || {}; + leftOffset = drawRes.leftOffset || 0; + topOffset = drawRes.topOffset || 0; + } + }); + }); + resolve2(); + }) + + all.push(p); + return all; + } + + _drawWxmlInlineText (sub, leftOffset = 0, maxWidth) { + let text = sub.dataset.text || ''; + if(sub.dataset.maxlength && text.length > sub.dataset.maxlength) { + text = text.substring(0, sub.dataset.maxlength) + '...'; + } + + let textData = { + text, + originX: sub.left, + x: leftOffset ? leftOffset : sub.left, + y: sub.top, + progress: sub.progress, + leftOffset: leftOffset, + maxWidth: maxWidth // 行内元素的最大宽度,取决于limit的宽度 + } + + if (sub.backgroundColor !== 'rgba(0, 0, 0, 0)') { + sub.background = sub.backgroundColor; + }else { + sub.background = 'rgba(0, 0, 0, 0)'; + } + + if(sub.dataset.background) { + sub.background = sub.dataset.background; + } + + let res = this._drawText(textData, sub, null, null, 'inline-text', 'wxml'); + + return res + } + + _drawWxmlText (sub, resolve, reject) { + let text = sub.dataset.text || ''; + if(sub.dataset.maxlength && text.length > sub.dataset.maxlength) { + text = text.substring(0, sub.dataset.maxlength) + '...'; + } + + let textData = { + text, + x: sub.left, + y: sub.top, + progress: sub.progress + } + if (sub.backgroundColor !== 'rgba(0, 0, 0, 0)') { + sub.background = sub.backgroundColor; + }else { + sub.background = 'rgba(0, 0, 0, 0)'; + } + + if(sub.dataset.background) { + sub.background = sub.dataset.background; + } + + this._drawText(textData, sub, resolve, reject, 'text', 'wxml'); + } + + _drawWxmlImage (sub, resolve, reject) { + let imageData = { + url: sub.dataset.url, + x: sub.left, + y: sub.top, + progress: sub.progress + } + + let res = this._drawRect(imageData, sub, resolve, reject, 'image', 'inline-wxml'); + + return res + } + + _drawWxmlCircleImage (sub, resolve, reject) { + let imageData = { + url: sub.dataset.url, + x: sub.left, + y: sub.top, + progress: sub.progress + } + sub.r = sub.width / 2; + + this._drawCircle(imageData, sub, resolve, reject, true, 'wxml'); + } + + _drawWxmlBackgroundImage (sub, resolve, reject) { + let url = sub.dataset.url; + let index = this._findPicIndex(url); + url = index > -1 ? this.allPic[index].local : url; + let size = sub.backgroundSize.replace(/px/g, '').split(' '); + + let imageData = { + url: url, + x: sub.left, + y: sub.top, + progress: sub.progress + } + + this._drawRect(imageData, sub, resolve, reject, 'image', 'wxml'); + } + + _getWxml (item, style) { + let self = this; + let query; + if(this.obj) { + query = wx.createSelectorQuery().in(this.obj); + }else { + query = wx.createSelectorQuery(); + } + + let p1 = new Promise((resolve, reject) => { + // 会触发两次,要限制 + let count = 0; + query.selectAll(`${item.class}`).fields({ + dataset: true, + size: true, + rect: true, + computedStyle: ['width', 'height', 'font', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'textAlign', + 'color', 'lineHeight', 'border', 'borderColor', 'borderStyle', 'borderWidth', 'verticalAlign', 'boxShadow', + 'background', 'backgroundColor', 'backgroundImage', 'backgroundPosition', 'backgroundSize', 'paddingLeft', 'paddingTop', + 'paddingRight', 'paddingBottom' + ] + }, (res) => { + if(count++ === 0) { + let formated = self._formatImage(res); + let list = formated.list; + res = formated.res; + + self._preloadImage(list).then(result => { + resolve(res); + }).catch((res) => { + reject && reject({ errcode: 1009, errmsg: 'drawWxml preLoadImage error' }); + }); + } + }).exec(); + }); + + let p2 = new Promise((resolve, reject) => { + if (!item.limit) { + resolve({ top: 0, width: self.width / self.zoom }); + } + + query.select(`${item.limit}`).fields({ + dataset: true, + size: true, + rect: true, + }, (res) => { + resolve(res); + }).exec(); + }); + + return Promise.all([p1, p2]); + } + + _getLineHeight (style) { + let zoom = this.zoom; + if(style.dataset && style.dataset.type) { + zoom = 1; + } + let lineHeight; + if(!isNaN(style.lineHeight) && style.lineHeight > style.fontSize) { + lineHeight = style.lineHeight; + }else { + style.lineHeight = (style.lineHeight || '') + ''; + lineHeight = +style.lineHeight.replace('px', ''); + lineHeight = lineHeight ? lineHeight : (style.fontSize || 14) * 1.2; + } + return lineHeight * zoom; + } + + _formatImage (res = []) { + let list = []; + res.forEach((item, index) => { + let dataset = item.dataset; + let uid = Util.getUid(); + let filename = `${wx.env.USER_DATA_PATH}/${uid}.png`; + if ((dataset.type === "image" || dataset.type === "radius-image") && dataset.url) { + let sub = { + url: dataset.base64 ? filename : dataset.url, + isBase64: dataset.base64 ? dataset.url : false + } + + res[index].dataset = Object.assign(res[index].dataset, sub); + list.push(sub) + } else if (dataset.type === 'background-image' && item.backgroundImage.indexOf('url') > -1) { + let url = item.backgroundImage.replace(/url\((\"|\')?/, '').replace(/(\"|\')?\)$/, ''); + let sub = { + url: dataset.base64 ? filename : url, + isBase64: dataset.base64 ? url : false + } + res[index].dataset = Object.assign(res[index].dataset, sub); + list.push(sub) + } + }); + + return { list, res }; + } + + _updateProgress (distance) { + this.progressPercent += distance; + this.progress(this.progressPercent); + } + + _sortListByTop (list = []) { + let sorted = {}; + + // 粗略地认为2px相差的元素在同一行 + list.forEach((item, index) => { + let top = item.top; + if (!sorted[top]) { + if (sorted[top - 2]) { + top = top - 2; + }else if (sorted[top - 1]) { + top = top - 1; + } else if (sorted[top + 1]) { + top = top + 1; + } else if (sorted[top + 2]) { + top = top + 2; + } else { + sorted[top] = []; + } + } + sorted[top].push(item); + }); + + return sorted; + } + + _parseNumber (number) { + return isNaN(number) ? +(number || '').replace('px', '') : number; + } + + _transferWxmlStyle (sub, item, limitLeft, limitTop) { + let leftFix = (+sub.dataset.left || 0); + let topFix = (+sub.dataset.top || 0); + + sub.width = this._parseNumber(sub.width); + sub.height = this._parseNumber(sub.height); + sub.left = this._parseNumber(sub.left) - limitLeft + (leftFix + (item.x || 0)) * this.zoom; + sub.top = this._parseNumber(sub.top) - limitTop + (topFix + (item.y || 0)) * this.zoom; + + let padding = sub.dataset.padding || '0 0 0 0'; + if (typeof padding === 'string') { + padding = Util.transferPadding(padding); + } + let paddingTop = Number(sub.paddingTop.replace('px', '')) + Number(padding[0]); + let paddingRight = Number(sub.paddingRight.replace('px', '')) + Number(padding[1]); + let paddingBottom = Number(sub.paddingBottom.replace('px', '')) + Number(padding[2]); + let paddingLeft = Number(sub.paddingLeft.replace('px', '')) + Number(padding[3]); + sub.padding = [paddingTop, paddingRight, paddingBottom, paddingLeft]; + + return sub; + } + + /** + * 支持负值绘制,从右边计算 + * @param {*} item + * @param {*} style + */ + _resetPositionX (item, style) { + let zoom = this.zoom; + let x = 0; + + if(style.dataset && style.dataset.type) { + zoom = 1; + } + + // 通过wxml获取的不需要重置坐标 + if (item.x < 0 && item.type) { + x = this.width + item.x * zoom - style.width * zoom; + } else { + x = item.x * zoom; + } + + if (parseInt(style.borderWidth)) { + x += parseInt(style.borderWidth) + } + + return x + this.translateX; + } + + /** + * 支持负值绘制,从底部计算 + * @param {*} item + * @param {*} style + */ + _resetPositionY (item, style, textHeight) { + let zoom = this.zoom; + let y = 0; + + if(style.dataset && style.dataset.type) { + zoom = 1; + } + + if (item.y < 0) { + y = this.height + item.y * zoom - (textHeight ? textHeight : style.height * zoom) + } else { + y = item.y * zoom; + } + + if (parseInt(style.borderWidth)) { + y += parseInt(style.borderWidth) + } + + return y + this.translateY; + } + + /** + * 文字的padding、text-align + * @param {*} item + * @param {*} style + * @param {*} textWidth + */ + _resetTextPositionX (item, style, textWidth, width) { + let textAlign = style.textAlign || 'left'; + let x = item.x; + if (textAlign === 'center') { + x = (width - textWidth) / 2 + item.x; + } else if (textAlign === 'right') { + x = width - textWidth + item.x; + } + + let left = style.padding ? (style.padding[3] || 0) : 0; + + return x + left + this.translateX; + } + + /** + * 文字的padding、text-align + * @param {*} item + * @param {*} style + * @param {*} textWidth + */ + _resetTextPositionY (item, style, lineNum = 0) { + let zoom = this.zoom; + if(style.dataset && style.dataset.type) { + zoom = 1; + } + + let lineHeight = this._getLineHeight(style); + let fontSize = Math.ceil((style.fontSize || 14) * zoom) + + let blockLineHeightFix = (style.dataset && style.dataset.type || '').indexOf('inline') > -1 ? 0 : (lineHeight - fontSize) / 2 + + let top = style.padding ? (style.padding[0] || 0) : 0; + + // y + lineheight偏移 + 行数 + paddingTop + 整体画布位移 + return item.y + blockLineHeightFix + lineNum * lineHeight + top + this.translateY; + } + + /** + * 当文本超过宽度时,计算每一行应该绘制的文本 + * @param {*} text + * @param {*} width + * @param {*} singleLength + * @param {*} currentIndex + * @param {*} widthOffset + */ + _getTextSingleLine(text, width, singleLength, currentIndex = 0, widthOffset = 0) { + let offset = 0; + let endIndex = currentIndex + singleLength + offset; + let single = text.substring(currentIndex, endIndex); + let singleWidth = this.measureWidth(single); + + while (Math.round(widthOffset + singleWidth) > width) { + offset--; + endIndex = currentIndex + singleLength + offset; + single = text.substring(currentIndex, endIndex); + singleWidth = this.measureWidth(single); + } + + return { + endIndex, + single, + singleWidth + } + } + + _drawBorder (border, style, callback) { + let zoom = this.zoom; + if(style.dataset && style.dataset.type) { + zoom = 1; + } + border = Util.transferBorder(border); + + if (border && border.width) { + // 空白阴影,清空掉边框的阴影 + this._drawBoxShadow(); + if (border) { + + this.ctx.setLineWidth(border.width * zoom); + + if (border.style === 'dashed') { + let dash = style.dash || [5, 5, 0]; + let offset = dash[2] || 0; + let array = [dash[0] || 5, dash[1] || 5]; + this.ctx.setLineDash(array, offset); + } + this.ctx.setStrokeStyle(border.color); + } + callback && callback(border); + } + } + + _drawBoxShadow (boxShadow, callback) { + boxShadow = Util.transferBoxShadow(boxShadow); + if (boxShadow) { + this.ctx.setShadow(boxShadow.offsetX, boxShadow.offsetY, boxShadow.blur, boxShadow.color); + }else { + this.ctx.setShadow(0, 0, 0, '#ffffff'); + } + + callback && callback(boxShadow || {}); + } + + _setFill (fill, callback) { + if(fill) { + if (typeof fill === 'string') { + this.ctx.setFillStyle(fill); + } else { + let line = fill.line; + let color = fill.color; + let grd = this.ctx.createLinearGradient(line[0], line[1], line[2], line[3]); + grd.addColorStop(0, color[0]); + grd.addColorStop(1, color[1]); + this.ctx.setFillStyle(grd); + } + callback && callback(); + } + } + + _setStroke (stroke, callback) { + if(stroke) { + if (typeof stroke === 'string') { + this.ctx.setStrokeStyle(stroke); + } else { + let line = stroke.line; + let color = stroke.color; + let grd = this.ctx.createLinearGradient(line[0], line[1], line[2], line[3]); + grd.addColorStop(0, color[0]); + grd.addColorStop(1, color[1]); + this.ctx.setStrokeStyle(grd); + } + + callback && callback(); + } + } +} + +export default Wxml2Canvas; \ No newline at end of file diff --git a/node_modules/wxml2canvas/src/util.js b/node_modules/wxml2canvas/src/util.js new file mode 100755 index 0000000..9aef416 --- /dev/null +++ b/node_modules/wxml2canvas/src/util.js @@ -0,0 +1,122 @@ +/** + * 获取字符的长度,full为true时,一个汉字算两个长度 + * @param {String} str + * @param {Boolean} full + */ + +function getTextLength (str, full) { + let len = 0; + for (let i = 0; i < str.length; i++) { + let c = str.charCodeAt(i); + //单字节加1 + if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) { + len++; + } + else { + len += (full ? 2 : 1); + } + } + return len; +} + +/** + * rgba(255, 255, 255, 1) => #ffffff + * @param {String} color + */ +function transferColor (color = '') { + let res = '#'; + color = color.replace(/^rgba?\(/, '').replace(/\)$/, ''); + color = color.split(', '); + + color.length > 3 ? color.length = 3 : ''; + for(let item of color) { + item = parseInt(item || 0); + if(item < 10) { + res += ('0' + item) + }else { + res += (item.toString(16)) + } + } + + return res; +} + +function transferBorder (border = '') { + let res = border.match(/(\w+)px\s(\w+)\s(.*)/); + let obj = {}; + + if(res) { + obj = { + width: +res[1], + style: res[2], + color: res[3] + } + } + + return res ? obj : null; +} + + +/** + * 内边距,依次为上右下左 + * @param {*} padding + */ +function transferPadding (padding = '0 0 0 0') { + padding = padding.split(' '); + for(let i = 0, len = padding.length; i < len; i++) { + padding[i] = +padding[i].replace('px', ''); + } + + return padding; +} +/** + * type1: 0, 25, 17, rgba(0, 0, 0, 0.3) + * type2: rgba(0, 0, 0, 0.3) 0px 25px 17px 0px => (0, 25, 17, rgba(0, 0, 0, 0.3)) + * @param {*} shadow + */ +function transferBoxShadow(shadow = '', type) { + if(!shadow || shadow === 'none') return; + let color; + let split; + + split = shadow.match(/(\w+)\s(\w+)\s(\w+)\s(rgb.*)/); + + if (split) { + split.shift(); + shadow = split; + color = split[3] || '#ffffff'; + } else { + split = shadow.split(') '); + color = split[0] + ')' + shadow = split[1].split('px '); + } + + return { + offsetX: +shadow[0] || 0, + offsetY: +shadow[1] || 0, + blur: +shadow[2] || 0, + color + } +} + +function getUid(prefix) { + prefix = prefix || ''; + + return ( + prefix + + 'xxyxxyxx'.replace(/[xy]/g, c => { + let r = (Math.random() * 16) | 0; + let v = c === 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }) + ); +} + +export default { + getTextLength, + transferBorder, + transferColor, + transferPadding, + transferBoxShadow, + getUid +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0892a72..6391b56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "tdesign-miniprogram": "^1.1.1", "weapp-qrcode-canvas-2d": "^1.1.2", + "wxml2canvas": "^1.0.1", "wxmp-rsa": "^2.1.0" } }, @@ -32,6 +33,11 @@ "resolved": "https://registry.npmjs.org/weapp-qrcode-canvas-2d/-/weapp-qrcode-canvas-2d-1.1.2.tgz", "integrity": "sha512-HQef+xpZiiWDcq8aLZdXnVdNljoYsEWiEKiBYnAnfgqXTeYfC8ApzoB9pMI5mnPFbhtu5xCi8oId1g/86uUl8Q==" }, + "node_modules/wxml2canvas": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wxml2canvas/-/wxml2canvas-1.0.1.tgz", + "integrity": "sha512-AdWvxgTjJtW/m6Cki1cwGO0HOERKU8O9V3RcCz8UyqJbrPF7e8Nv27/epYiIs64HlbPTKWTLl7ECjQi6UVducA==" + }, "node_modules/wxmp-rsa": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wxmp-rsa/-/wxmp-rsa-2.1.0.tgz", diff --git a/package.json b/package.json index 1f23865..d9c5d4c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "tdesign-miniprogram": "^1.1.1", "weapp-qrcode-canvas-2d": "^1.1.2", + "wxml2canvas": "^1.0.1", "wxmp-rsa": "^2.1.0" } } diff --git a/pages/home/jl/index.wxss b/pages/home/jl/index.wxss index 4ec1473..4c809e2 100644 --- a/pages/home/jl/index.wxss +++ b/pages/home/jl/index.wxss @@ -11,7 +11,7 @@ page { margin-left:249.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/tx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/tx.png); } .txtext{ @@ -80,7 +80,7 @@ page { margin-top: 14rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/wjx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/wjx.png); } .dchx{ @@ -110,7 +110,7 @@ page { margin-left: 29.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bs.png); } .gh{ @@ -120,7 +120,7 @@ page { margin-top:1070.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/gh.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/gh.png); } .call{ @@ -163,7 +163,7 @@ page { margin-left: 32.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/rbs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/rbs.png); } .lovepic{ @@ -174,7 +174,7 @@ page { margin-left:235.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/pulse.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/pulse.png); } .dchxtxtql{ @@ -196,7 +196,7 @@ page { margin-left:218rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/tx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/tx.png); } .txl-qd { @@ -213,7 +213,7 @@ page { margin-left:400.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/tx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/tx.png); } .txr-qd { @@ -267,7 +267,7 @@ page { margin-left: 322.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/jiuchan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jiuchan.png); } @@ -290,7 +290,7 @@ page { margin-left: 322.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bkg3.png); } .xxt{ @@ -319,7 +319,7 @@ page { background-size:100% 100%; margin-top: 837.33rpx; margin-left:118.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yan2{ position: absolute; @@ -332,7 +332,7 @@ page { background-size:100% 100%; margin-top: 837.33rpx; margin-left:318rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yan3{ position: absolute; @@ -345,7 +345,7 @@ page { justify-content: center; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .bkg1{ @@ -356,7 +356,7 @@ page { margin-left:46rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bkg1.png); } .bkg3{ @@ -367,7 +367,7 @@ page { margin-left:42rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bkg3.png); } .yan11{ @@ -376,7 +376,7 @@ page { height:46rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/paw.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/paw.png); } .yan12{ @@ -385,7 +385,7 @@ page { height:46rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/male.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/male.png); } .yan13{ @@ -394,7 +394,7 @@ page { background-repeat: no-repeat; background-size:100% 100%; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/female.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/female.png); } .xxtl{ @@ -438,7 +438,7 @@ page { background-size:100% 100%; margin-top: 492rpx; margin-left:86.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yanql2{ @@ -452,7 +452,7 @@ page { background-size:100% 100%; margin-top: 663.33rpx; margin-left:38.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yanql4{ @@ -466,7 +466,7 @@ page { background-size:100% 100%; margin-top: 492rpx; margin-left:550.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yanql5{ @@ -480,7 +480,7 @@ page { background-size:100% 100%; margin-top: 663.33rpx; margin-left:598rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .xxtq{ @@ -508,7 +508,7 @@ page { margin-left: 114.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/circle.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/circle.png); color: rgba(248, 99, 42, 1); @@ -525,7 +525,7 @@ font-family: SourceHanSansSC-regular; margin-left: 318rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } @@ -539,7 +539,7 @@ font-family: SourceHanSansSC-regular; margin-left: 520.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/circle.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/circle.png); color: rgba(108, 108, 108, 1); font-size: 16px; @@ -553,7 +553,7 @@ font-size: 16px; margin-left: 36rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yst.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yst.png); } @@ -622,7 +622,7 @@ font-size: 16px; background-size:100% 100%; margin-left:97.33rpx; margin-top: 589.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/jkzs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jkzs.png); } .aqzs{ @@ -635,7 +635,7 @@ font-size: 16px; background-size:100% 100%; margin-left:97.33rpx; margin-top: 653.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/aqzs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/aqzs.png); } .cyzs{ @@ -648,7 +648,7 @@ font-size: 16px; background-size:100% 100%; margin-left:97.33rpx; margin-top: 717.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/cyzs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/cyzs.png); } .rjkzs{ @@ -726,7 +726,7 @@ width: 240px; height: 11px; background-repeat: no-repeat; background-size:100% 100%; -background-image: url(https://oss.wish.ydxxkj.top/xy/ysfgx.png); +background-image: url(https://wish-assets.windymuse.com.cn/xy/ysfgx.png); } /* 弹层 */ diff --git a/pages/home/jl/jlai/jlai.wxml b/pages/home/jl/jlai/jlai.wxml index fa053a8..229c2b2 100644 --- a/pages/home/jl/jlai/jlai.wxml +++ b/pages/home/jl/jlai/jlai.wxml @@ -11,7 +11,7 @@ 我和Ta未来会怎样 文字冒险游戏 帮我写一封情书 - + 你好,我是你的星座守护精灵。除此之外,我还可以帮你解答更多问题。快来跟我聊聊吧! @@ -24,7 +24,7 @@ 我和Ta未来会怎样 文字冒险游戏 帮我写一封情书 - + 你好,我是你的星座守护精灵。除此之外,我还可以帮你解答更多问题。快来跟我聊聊吧! 开通会员 @@ -34,7 +34,7 @@ - + {{item.value}} diff --git a/pages/home/jl/jlai/jlai.wxss b/pages/home/jl/jlai/jlai.wxss index 6441db6..6a5b0e8 100644 --- a/pages/home/jl/jlai/jlai.wxss +++ b/pages/home/jl/jlai/jlai.wxss @@ -13,7 +13,7 @@ page { height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -203,7 +203,7 @@ page { height: 54rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/chatbtn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/chatbtn.png); } .addbtn{ @@ -214,7 +214,7 @@ page { height: 54rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/addbtn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/addbtn.png); } .chatbox{ @@ -292,7 +292,7 @@ page { height: 127rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/hyhg.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/hyhg.png); } .ltk112{ position: absolute; diff --git a/pages/home/me/grzl/grzl.js b/pages/home/me/grzl/grzl.js index d7e4a3a..ad09ad7 100644 --- a/pages/home/me/grzl/grzl.js +++ b/pages/home/me/grzl/grzl.js @@ -8,15 +8,15 @@ Page({ */ data: { avatars:[ - 'https://oss.wish.ydxxkj.top/xy/tx1.png', - 'https://oss.wish.ydxxkj.top/xy/tx2.png', - 'https://oss.wish.ydxxkj.top/xy/tx3.png', - 'https://oss.wish.ydxxkj.top/xy/tx4.png', - 'https://oss.wish.ydxxkj.top/xy/tx5.png', - 'https://oss.wish.ydxxkj.top/xy/tx6.png', - 'https://oss.wish.ydxxkj.top/xy/tx1.png', - 'https://oss.wish.ydxxkj.top/xy/tx2.png', - 'https://oss.wish.ydxxkj.top/xy/tx3.png', + 'https://wish-assets.windymuse.com.cn/xy/tx1.png', + 'https://wish-assets.windymuse.com.cn/xy/tx2.png', + 'https://wish-assets.windymuse.com.cn/xy/tx3.png', + 'https://wish-assets.windymuse.com.cn/xy/tx4.png', + 'https://wish-assets.windymuse.com.cn/xy/tx5.png', + 'https://wish-assets.windymuse.com.cn/xy/tx6.png', + 'https://wish-assets.windymuse.com.cn/xy/tx1.png', + 'https://wish-assets.windymuse.com.cn/xy/tx2.png', + 'https://wish-assets.windymuse.com.cn/xy/tx3.png', ], sexs:[{label:'男生',value:'male'},{label:'女生',value:'female'}], sexVisible:false, diff --git a/pages/home/me/grzl/grzl.wxss b/pages/home/me/grzl/grzl.wxss index d17d5c0..a756942 100644 --- a/pages/home/me/grzl/grzl.wxss +++ b/pages/home/me/grzl/grzl.wxss @@ -17,7 +17,7 @@ height:48rpx; margin-left: 20rpx; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -87,7 +87,7 @@ height: 26rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/camera.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/camera.png); } .txcheck-box { diff --git a/pages/home/me/indexx.js b/pages/home/me/indexx.js index f383eb7..e14c452 100644 --- a/pages/home/me/indexx.js +++ b/pages/home/me/indexx.js @@ -273,6 +273,7 @@ Page({ .then(() => { req.deleteRequest('/api/user/logout',{}).then((res)=>{ if(res.data.code===200){ + wx.setStorageSync('token', '') wx.navigateTo({ url: '/pages/index/index' }) @@ -293,7 +294,6 @@ Page({ }) .catch(() => console.log('点击了取消')) .finally(() => { - wx.setStorageSync('token', '') Dialog.close()}); }, }) \ No newline at end of file diff --git a/pages/home/me/indexx.wxml b/pages/home/me/indexx.wxml index 2c49c35..756a857 100644 --- a/pages/home/me/indexx.wxml +++ b/pages/home/me/indexx.wxml @@ -26,41 +26,41 @@ - + 绑定手机号 {{userInfo.phone}} - + 意见反馈 - + 小程序版本 V1.0 - + 解除羁绊 - + 退出登录 diff --git a/pages/home/me/indexx.wxss b/pages/home/me/indexx.wxss index 9760f03..5d5325f 100644 --- a/pages/home/me/indexx.wxss +++ b/pages/home/me/indexx.wxss @@ -7,7 +7,7 @@ flex-direction: column; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/xxt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xxt.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -59,7 +59,7 @@ height: 100rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/hy.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/hy.png); } .unhybs{ position: absolute; @@ -69,7 +69,7 @@ height: 100rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/unhy.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/unhy.png); } .hydqr{ @@ -137,7 +137,7 @@ margin: 18rpx 18rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/sms.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/sms.png); } .sq{ @@ -147,7 +147,7 @@ margin: 18rpx 18rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/sq.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/sq.png); } .sb{ @@ -157,7 +157,7 @@ margin: 14rpx 30rpx ; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/sb.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/sb.png); } .smst{ diff --git a/pages/home/me/jcjb/jcjb.wxml b/pages/home/me/jcjb/jcjb.wxml index 8dee773..b645a54 100644 --- a/pages/home/me/jcjb/jcjb.wxml +++ b/pages/home/me/jcjb/jcjb.wxml @@ -4,7 +4,7 @@ 解除羁绊 - + {{ timeout }} @@ -14,7 +14,7 @@ - + diff --git a/pages/home/me/jcjb/jcjb.wxss b/pages/home/me/jcjb/jcjb.wxss index 0a5a641..5fb0420 100644 --- a/pages/home/me/jcjb/jcjb.wxss +++ b/pages/home/me/jcjb/jcjb.wxss @@ -7,7 +7,7 @@ height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ diff --git a/pages/home/me/member/member.wxss b/pages/home/me/member/member.wxss index e9e5285..3595347 100644 --- a/pages/home/me/member/member.wxss +++ b/pages/home/me/member/member.wxss @@ -6,7 +6,7 @@ height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -29,7 +29,7 @@ height: 230rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/hybt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/hybt.png); } .sftp{ @@ -40,7 +40,7 @@ height: 115px; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/sftp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/sftp.png); } .hgpng{ @@ -51,7 +51,7 @@ width: 157px; height: 174px; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/hgpng.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/hgpng.png); } .question{ @@ -61,7 +61,7 @@ background-repeat: no-repeat; width: 30px; height: 30px; z-index: 999; - background-image: url(https://oss.wish.ydxxkj.top/xy/qqest.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/qqest.png); } .hybtn{ position: absolute; diff --git a/pages/home/me/member2/member.wxss b/pages/home/me/member2/member.wxss index f07876a..f5e4f31 100644 --- a/pages/home/me/member2/member.wxss +++ b/pages/home/me/member2/member.wxss @@ -6,7 +6,7 @@ height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -29,7 +29,7 @@ height: 230rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/hybt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/hybt.png); } .sftp{ @@ -40,7 +40,7 @@ height: 115px; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/sftp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/sftp.png); } .hgpng{ @@ -51,7 +51,7 @@ width: 157px; height: 174px; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/hgpng.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/hgpng.png); } .question{ @@ -60,7 +60,7 @@ background-repeat: no-repeat; top: 124px; width: 30px; height: 30px; - background-image: url(https://oss.wish.ydxxkj.top/xy/qqest.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/qqest.png); } .hybtn{ position: absolute; diff --git a/pages/home/me/mydevice/device.wxss b/pages/home/me/mydevice/device.wxss index 9a60266..d41faad 100644 --- a/pages/home/me/mydevice/device.wxss +++ b/pages/home/me/mydevice/device.wxss @@ -7,7 +7,7 @@ height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -58,7 +58,7 @@ margin-left: 32.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/rbs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/rbs.png); } .lovepic{ @@ -69,7 +69,7 @@ margin-left:235.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/pulse.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/pulse.png); } .dchxtxtql{ @@ -92,7 +92,7 @@ margin-left:218rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/tx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/tx.png); } .txr{ @@ -103,7 +103,7 @@ margin-left:400.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/tx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/tx.png); } .txtextl{ @@ -124,7 +124,7 @@ margin-left: 322.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/jiuchan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jiuchan.png); } @@ -147,7 +147,7 @@ margin-left: 322.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bkg3.png); } .xxt{ @@ -158,7 +158,7 @@ margin-left: 212rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/szn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/szn.png); } .yan1{ @@ -169,7 +169,7 @@ background-size:100% 100%; margin-top: 837.33rpx; margin-left:118.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yan2{ position: absolute; @@ -179,7 +179,7 @@ background-size:100% 100%; margin-top: 837.33rpx; margin-left:318rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yan3{ position: absolute; @@ -189,7 +189,7 @@ margin-left:517.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .bkg1{ @@ -200,7 +200,7 @@ margin-left:46rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bkg1.png); } .bkg3{ @@ -211,7 +211,7 @@ margin-left:42rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bkg3.png); } .yan11{ @@ -222,7 +222,7 @@ background-size:100% 100%; margin-top: 33.33rpx; margin-left:34.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/paw.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/paw.png); } .yan12{ @@ -233,7 +233,7 @@ background-size:100% 100%; margin-top: 33.33rpx; margin-left:34.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/male.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/male.png); } .yan13{ @@ -244,7 +244,7 @@ background-size:100% 100%; margin-top: 33.33rpx; margin-left:34.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/female.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/female.png); } .xxtl{ @@ -255,7 +255,7 @@ margin-left: 88rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/szn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/szn.png); } .xxtr{ @@ -266,7 +266,7 @@ margin-left: 355.33rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/xxtr.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xxtr.png); } .yanql1{ @@ -277,7 +277,7 @@ background-size:100% 100%; margin-top: 492rpx; margin-left:86.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yanql2{ @@ -288,7 +288,7 @@ background-size:100% 100%; margin-top: 663.33rpx; margin-left:38.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yanql4{ @@ -299,7 +299,7 @@ background-size:100% 100%; margin-top: 492rpx; margin-left:550.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .yanql5{ @@ -310,7 +310,7 @@ background-size:100% 100%; margin-top: 663.33rpx; margin-left:598rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } .xxtq{ @@ -321,7 +321,7 @@ margin-left: 212rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/xxtr.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xxtr.png); } .k1{ @@ -334,7 +334,7 @@ margin-left: 114.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/circle.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/circle.png); } @@ -346,7 +346,7 @@ margin-left: 318rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yan.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yan.png); } @@ -360,7 +360,7 @@ margin-left: 520.67rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/circle.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/circle.png); } @@ -372,7 +372,7 @@ margin-left: 36rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yst.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yst.png); } @@ -427,7 +427,7 @@ left: 0; right: 0; margin: 84rpx auto; - background-image: url(https://oss.wish.ydxxkj.top/xy/ztys.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/ztys.png); } .jkzs{ @@ -440,7 +440,7 @@ background-size:100% 100%; margin-left:97.33rpx; margin-top: 589.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/jkzs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jkzs.png); } .aqzs{ @@ -453,7 +453,7 @@ background-size:100% 100%; margin-left:97.33rpx; margin-top: 653.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/aqzs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/aqzs.png); } .cyzs{ @@ -466,7 +466,7 @@ background-size:100% 100%; margin-left:97.33rpx; margin-top: 717.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/cyzs.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/cyzs.png); } .rjkzs{ @@ -531,7 +531,7 @@ height: 226rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/shimg.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/shimg.png); } .shmz{ @@ -648,7 +648,7 @@ height: 40rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/copy.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/copy.png); } .tbl{ @@ -659,7 +659,7 @@ height: 75px; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/tbl.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/tbl.png); } .tbr{ @@ -670,5 +670,5 @@ height: 75px; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/tbr.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/tbr.png); } \ No newline at end of file diff --git a/pages/home/me/yjfk/yjfk.wxss b/pages/home/me/yjfk/yjfk.wxss index cf0e687..f5f0ace 100644 --- a/pages/home/me/yjfk/yjfk.wxss +++ b/pages/home/me/yjfk/yjfk.wxss @@ -7,7 +7,7 @@ height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -30,7 +30,7 @@ height: 230rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/hybt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/hybt.png); } .fkt1{ position: absolute; diff --git a/pages/home/xx/hy/hx/hx.wxss b/pages/home/xx/hy/hx/hx.wxss index de135ff..2c3eeff 100644 --- a/pages/home/xx/hy/hx/hx.wxss +++ b/pages/home/xx/hy/hx/hx.wxss @@ -8,7 +8,7 @@ z-index: 2; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -98,7 +98,7 @@ display: flex; align-items: center; justify-content: center; - background-image: url(https://oss.wish.ydxxkj.top/xy/ltqp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqp.png); } .viewer { diff --git a/pages/home/xx/hy/index.wxss b/pages/home/xx/hy/index.wxss index f992c43..3dcbfb7 100644 --- a/pages/home/xx/hy/index.wxss +++ b/pages/home/xx/hy/index.wxss @@ -8,7 +8,7 @@ background-repeat: no-repeat; background-size:100% 100%; z-index: 1; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -64,7 +64,7 @@ top: 334rpx; width: 100%; height: 1000rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E6%9C%AD%E8%83%8C%E6%99%AF.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E6%9C%AD%E8%83%8C%E6%99%AF.png); } .main-item { @@ -93,7 +93,7 @@ width: 148rpx; height: 102rpx; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E5%B0%81.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E5%B0%81.png); } .item-text-name { diff --git a/pages/home/xx/hy/yx/yx.wxss b/pages/home/xx/hy/yx/yx.wxss index 302e8e1..c97ff36 100644 --- a/pages/home/xx/hy/yx/yx.wxss +++ b/pages/home/xx/hy/yx/yx.wxss @@ -8,7 +8,7 @@ background-repeat: no-repeat; background-size:100% 100%; z-index: 1; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -64,7 +64,7 @@ top: 334rpx; width: 100%; height: 1000rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E6%9C%AD%E8%83%8C%E6%99%AF.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E6%9C%AD%E8%83%8C%E6%99%AF.png); } .main-item { @@ -109,7 +109,7 @@ width: 60rpx; height: 60rpx; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/iconPark-voicemail%20Copy%401x.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/iconPark-voicemail%20Copy%401x.png); } .item-text-name { diff --git a/pages/home/xx/hy/zt/zt.wxss b/pages/home/xx/hy/zt/zt.wxss index 8c6282d..5cca5db 100644 --- a/pages/home/xx/hy/zt/zt.wxss +++ b/pages/home/xx/hy/zt/zt.wxss @@ -8,7 +8,7 @@ background-repeat: no-repeat; background-size:100% 100%; z-index: 1; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -64,7 +64,7 @@ top: 334rpx; width: 100%; height: 1000rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E6%9C%AD%E8%83%8C%E6%99%AF.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E6%9C%AD%E8%83%8C%E6%99%AF.png); } .main-item { @@ -101,7 +101,7 @@ justify-content: center; align-items: center; overflow: hidden; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E7%BA%B8%E6%9D%A1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E7%BA%B8%E6%9D%A1.png); } .item-text-name { diff --git a/pages/home/xx/index.wxss b/pages/home/xx/index.wxss index 37a7683..a163b34 100644 --- a/pages/home/xx/index.wxss +++ b/pages/home/xx/index.wxss @@ -8,7 +8,7 @@ height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ @@ -44,7 +44,7 @@ text-align: center; background-size:100% 100%; margin-left:29.33rpx; margin-top: 98rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bkg.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -59,7 +59,7 @@ text-align: center; background-size:100% 100%; margin-left:146.67rpx; margin-top: 234rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzt.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -75,7 +75,7 @@ text-align: center; background-size:100% 100%; margin-left:146.67rpx; margin-top: 702rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/fgx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/fgx.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -91,7 +91,7 @@ text-align: center; background-size:100% 100%; margin-left:228.67rpx; margin-top: 558.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzbtn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzbtn.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -107,7 +107,7 @@ text-align: center; background-size:100% 100%; margin-left:228.67rpx; margin-top: 1108.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/jbbtn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jbbtn.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -123,7 +123,7 @@ text-align: center; background-size:100% 100%; margin-left:146.67rpx; margin-top: 784rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/jbt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jbt.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -195,7 +195,7 @@ text-align: center; top: 50rpx; width: 30px; height: 16px; - background-image: url(https://oss.wish.ydxxkj.top/xy/qlzjt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/qlzjt.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -283,7 +283,7 @@ font-family: SourceHanSansSC-medium; top: 287px; width: 93px; height: 65px; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E5%B0%81.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E5%B0%81.png); } .tt{ display: inline-block; @@ -307,7 +307,7 @@ font-family: SourceHanSansSC-medium; width: 180px; height: 60px; line-height: 60px; - background-image: url(https://oss.wish.ydxxkj.top/xy/textpic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/textpic.png); color: rgba(51, 51, 51, 1); font-size: 14px; text-align: left; @@ -357,7 +357,7 @@ font-family: SourceHanSansSC-medium; top: 6px; width: 30px; height: 30px; - background-image: url(https://oss.wish.ydxxkj.top/xy/yppic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yppic.png); } .dfaudiologotxt{ @@ -387,7 +387,7 @@ font-family: SourceHanSansSC-medium; margin-left: 215px; width: 93px; height: 65px; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E5%B0%81.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E5%B0%81.png); } .zjydwd1{ position: absolute; @@ -425,7 +425,7 @@ font-family: SourceHanSansSC-medium; top: 6px; width: 30px; height: 30px; - background-image: url(https://oss.wish.ydxxkj.top/xy/yppic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yppic.png); } .zjypwz1{ position: absolute; @@ -462,7 +462,7 @@ font-family: SourceHanSansSC-regular; width: 180px; height: 60px; line-height: 60px; - background-image: url(https://oss.wish.ydxxkj.top/xy/textpic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/textpic.png); color: rgba(51, 51, 51, 1); font-size: 14px; text-align: left; @@ -536,14 +536,14 @@ font-family: SourceHanSansSC-regular; padding-top: 110rpx ; box-sizing: border-box; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E7%BB%91%E5%AE%9A%E6%83%85%E4%BE%A3%E8%83%8C%E6%99%AF.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E7%BB%91%E5%AE%9A%E6%83%85%E4%BE%A3%E8%83%8C%E6%99%AF.png); } .openSend-main-img { width: 404rpx; height: 404rpx; margin: 0 auto; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E9%92%BB%E7%9F%B3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E9%92%BB%E7%9F%B3.png); background-size: contain; } diff --git a/pages/home/xx/lindex/lindex.js b/pages/home/xx/lindex/lindex.js index dc3858f..e0d9bd6 100644 --- a/pages/home/xx/lindex/lindex.js +++ b/pages/home/xx/lindex/lindex.js @@ -40,6 +40,15 @@ Page({ userInfo:{} }, doLuYINBoF(e){ + // 判断点击的是否为对方的语音 + if(e.currentTarget.dataset.item){ + const id = e.currentTarget.dataset.item.id + console.log(id); + // 改变语音状态 + req.patchRequest(`/api/user/curt/message/${id}/read`,{}).then(res => { + console.log(res); + }) + } //先判断是开是关 if(!e.currentTarget.dataset.bf){//此时点击为关闭 //设置当前状态为关闭,并关闭 @@ -380,6 +389,10 @@ Page({ this.setData({dkTpVisible:true}) console.log(e.currentTarget.dataset.tp) console.log('查看图片详情') + const id = e.currentTarget.dataset.id + req.patchRequest(`/api/user/curt/message/${id}/read`,{}).then(res => { + console.log(res); + }) }, //bindtap="dKztDetial" data-xq="{{item}}" dKztDetial(e){/**查看详情 */ @@ -446,6 +459,21 @@ Page({ const minutes = date.getMinutes() item.createdAt = `${year}年${month}月${day}日 ${hours}:${minutes}` }) + + // 塞选出对方的消息 + const noSelfList = list.filter(item => { + return !item.isSelf + }) + // 文本和图片消息全都改为已读 + noSelfList.forEach(item => { + if (item.type === 'text' && item.status === 'unread') { + console.log('发送请求'); + req.patchRequest(`/api/user/curt/message/${item.id}/read`,{}).then(res => { + console.log(res); + }) + } + }) + this.setData({messages:list.reverse()}) } }).catch((err)=>{ @@ -572,6 +600,12 @@ Page({ onReady() { this.doQueryInit() this.doMessageInfo() + + const time = setInterval(() => { + this.doMessageInfo() + console.log('1111'); + }, 2000); + this.setData({time: time}) }, /** @@ -586,6 +620,7 @@ Page({ */ onHide() { this.data.innerAudioContext.stop() + clearInterval(this.data.time) }, /** diff --git a/pages/home/xx/lindex/lindex.wxml b/pages/home/xx/lindex/lindex.wxml index c121451..a971d61 100644 --- a/pages/home/xx/lindex/lindex.wxml +++ b/pages/home/xx/lindex/lindex.wxml @@ -1,20 +1,31 @@ - + + + + + 回忆 + + 星讯 + + + + + + + + + + - 欢迎来到你们的专属情侣树洞 - 在这里,你可以将你的心意传递给ta - 所有美好的回忆都将被精灵记录 + 欢迎来到你们的专属情侣树洞 + 在这里,你可以将你的心意传递给ta + 所有美好的回忆都将被精灵记录 - - - - - @@ -64,7 +75,7 @@ + src="https://wish-assets.windymuse.com.cn/xy/yppic.png" mode=""/> {{item.extra.ssec}} @@ -101,55 +112,77 @@ bindlongpress="changAn" src="{{'https://xzjl-api.windymuse.cn/api/resource/'+item.resourceId+'?k='+userInfo.id}}" class="zjxftp3" mode="heightFix" - bindtap="go2SeeHxDetail" + bindtap="go2SeeHxDetail" + data-id="{{item.id}}" data-tp="{{'https://xzjl-api.windymuse.cn/api/resource/'+item.resourceId+'?k='+userInfo.id}}" > {{item.status=='unread'?'未读':'已读'}} + + + + + + {{item.content}} + + {{item.status=='unread'?'未读':'已读'}} + + - - - - - - {{item.status=='unread'?'未读':'已读'}} - - - {{item.content}} + + + + + + + {{item.extra.ssec}} + + + + + + + + {{item.extra.ssec}} + + {{item.status=='unread'?'未读':'已读'}} + - {{item.status=='unread'?'未读':'已读'}} - - - - - 2222 - {{item.status=='unread'?'未读':'已读'}} - - + + + + + + + {{item.status=='unread'?'未读':'已读'}} + {{item.status=='unread'?'未读':'已读'}} + + + + -回忆 - - - -星讯 - @@ -175,13 +208,14 @@ - - - - + + 画像 - 保存 + + + + 保存 @@ -204,7 +238,7 @@ - + diff --git a/pages/home/xx/lindex/lindex.wxss b/pages/home/xx/lindex/lindex.wxss index fbc0dc7..9c8d92c 100644 --- a/pages/home/xx/lindex/lindex.wxss +++ b/pages/home/xx/lindex/lindex.wxss @@ -1,55 +1,150 @@ /* pages/home/xx/lindex/lindex.wxss */ /* pages/home/xx/index.wxss */ /* pages/home/xyc/wdyw/wdyw.wxss */ -.reback{ + +.allTap { + position: relative; + width: 100%; + height: 100%; +} + +.allTap-header { position: fixed; - margin-left: 20rpx; - margin-top:108rpx; + top: 0; + width: 100%; + height: 166rpx; + padding-bottom: 20rpx; + box-sizing: border-box; + display: flex; + align-items: flex-end; + justify-content: center; + z-index: 1; + background-color: #fff; +} + +.reback{ width:48rpx; height:48rpx; + position: absolute; + left: 20rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } .title{ - position: fixed; - left: 278rpx; - top: 108rpx; width: 196rpx; height: 48rpx; color: rgba(108, 108, 108, 1); font-size: 32rpx; text-align: center; - font-family: SourceHanSansSC-regular; } + +.hybtn{ + position: fixed; + left: 0; + top: 210rpx; + width: 166rpx; + height: 70rpx; + line-height: 70rpx; + opacity: 0.7; + border-radius: 0px 20rpx 20rpx 0px; + background: linear-gradient(222.54deg, rgba(248,99,42,1) 14.03%,rgba(249,135,89,1) 85.21%); + text-align: center; + box-shadow: 0px 4rpx 12rpx 0px rgba(0, 0, 0, 0.4); + color: rgba(255, 255, 255, 1); + font-size: 28rpx; + text-align: center; +} + +.ltinfo{ + width: 100%; + margin-top: 224rpx; +} + .bkgfs{ - position: absolute; - left: 96rpx; - top: 70rpx; - width: 558rpx; - height: 256rpx; + position: relative; + width: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; line-height: 40rpx; border-radius: 30rpx; - background-color: rgba(253, 190, 196, 1); text-align: center; } -.bkg{ +.bkgfs-img { position: absolute; - width: 691.33rpx; - height: 1326rpx; + top: 28rpx; + width: 100%; display: flex; - flex-direction: column; - background-repeat: no-repeat; - background-size:100% 100%; - margin-left:29.33rpx; - margin-top: 98rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bkg.png); - color:#9A9A9A; + justify-content: center; + align-items: center; +} + +.bkgfs-img-middle { + width: 60rpx; + height: 32rpx; + margin: 0 30rpx; + background-size: contain; + background-image: url(https://wish-assets.windymuse.com.cn/xy/qlzjt.png); +} + +.bkgfstxt{ + width: 560rpx; + height: 256rpx; + margin-top: 56rpx; + line-height: 20px; + border-radius: 30rpx; + color: #fff; + font-size: 28rpx; + text-align: center; + padding: 74rpx 56rpx 0 56rpx; + box-sizing: border-box; + background-color: rgba(253, 190, 196, 1); +} + +.bkgfstxt .txt { + margin-bottom: 14rpx; +} + +.txl{ + width: 80rpx; + height: 80rpx; + box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4); +} + +.txr{ + width: 80rpx; + height: 80rpx; + box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4); +} + + + +.ltxinxi{ + width: 100%; +} + +.wchatfor{ + width: 100%; + padding: 0 64rpx; + box-sizing: border-box; +} + +.wchattime{ + width: 100%; + margin-top: 32rpx; + color: rgba(153, 153, 153, 1); + font-size: 24rpx; text-align: center; - font-size: 27rpx; } + + + + + .xzt{ position: absolute; width: 398rpx; @@ -60,7 +155,7 @@ background-size:100% 100%; margin-left:146.67rpx; margin-top: 234rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzt.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -76,7 +171,7 @@ background-size:100% 100%; margin-left:146.67rpx; margin-top: 702rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/fgx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/fgx.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -92,7 +187,7 @@ background-size:100% 100%; margin-left:228.67rpx; margin-top: 558.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzbtn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzbtn.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -108,7 +203,7 @@ background-size:100% 100%; margin-left:228.67rpx; margin-top: 1108.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/jbbtn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jbbtn.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -124,30 +219,12 @@ background-size:100% 100%; margin-left:146.67rpx; margin-top: 784rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/jbt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jbt.png); color:#9A9A9A; text-align: center; font-size: 27rpx; } -.hybtn{ - position: fixed; - left: 0px; -top: 104px; -width: 83px; -height: 35px; -line-height: 70rpx; -opacity: 0.7; -border-radius: 0px 10px 10px 0px; -background: linear-gradient(222.54deg, rgba(248,99,42,1) 14.03%,rgba(249,135,89,1) 85.21%); -text-align: center; -box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4); -color: rgba(255, 255, 255, 1); -font-size: 14px; -text-align: center; -font-family: SourceHanSansSC-regular; -} - .xfgjl{ position: fixed; bottom: 30rpx; @@ -158,58 +235,6 @@ font-family: SourceHanSansSC-regular; justify-content: space-evenly; } -.ltinfo{ - position: absolute; - width: 750rpx; - height: 2000rpx; - margin-top:200rpx; -} -.h1{ - position: fixed; - left: 0px; -width: 375px; -height: 88px; -line-height: 20px; -background-color: rgba(255, 255, 255, 1); -text-align: center; -} - -.txl{ - position: absolute; - left: 244rpx; - top: 30rpx; - width: 72rpx; - height: 72rpx; -} -.txr{ - position: absolute; - top: 30rpx; - left:434rpx; - width: 72rpx; - height: 72rpx; -} -.qlzjt{ - position: absolute; - left: 346rpx; - top: 50rpx; - width: 60rpx; - height: 32rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/qlzjt.png); - color:#9A9A9A; - text-align: center; - font-size: 27rpx; -} -.bkgfstxt{ - position: absolute; - left: 56rpx; - top: 74rpx; - width: 446rpx; - height: 146rpx; - color: rgba(255, 255, 255, 1); - font-size: 28rpx; - text-align: center; - font-family: SourceHanSansSC-regular; -} .xxqlcd{ /* position: absolute; */ /* top: 32rpx; */ @@ -241,23 +266,7 @@ text-align: center; left: 299px; } -.ltxinxi{ - position: absolute; - margin-top:360rpx; - width: 750rpx; -} -.wchatfor{ - width: 750rpx; - padding: 0 64rpx; - box-sizing: border-box; -} -.wchattime{ - width: 750rpx; - margin-top: 32rpx; - color: rgba(153, 153, 153, 1); - font-size: 24rpx; - text-align: center; -} + .wchattxk{ display: inline-block; margin-left: 317px; @@ -279,7 +288,7 @@ text-align: center; top: 287px; width: 93px; height: 65px; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E5%B0%81.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E5%B0%81.png); } .tt{ display: inline-block; @@ -303,7 +312,7 @@ text-align: center; width: 180px; height: 60px; line-height: 60px; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E7%BA%B8%E6%9D%A1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E7%BA%B8%E6%9D%A1.png); color: rgba(51, 51, 51, 1); font-size: 14px; text-align: left; @@ -353,7 +362,7 @@ text-align: center; top: 6px; width: 30px; height: 30px; - background-image: url(https://oss.wish.ydxxkj.top/xy/yppic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yppic.png); } .dfaudiologotxt{ @@ -382,7 +391,7 @@ text-align: center; margin-left: 215px; width: 93px; height: 65px; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E4%BF%A1%E5%B0%81.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E4%BF%A1%E5%B0%81.png); } .zjydwd1{ position: absolute; @@ -420,7 +429,7 @@ text-align: center; height: 60rpx; margin-right: 20rpx; background-size: cover; - background-image: url(https://oss.wish.ydxxkj.top/xy/yppic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yppic.png); } .zjypt11{ width: 60rpx; @@ -456,7 +465,7 @@ text-align: center; height: 120rpx; line-height: 60px; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E7%BA%B8%E6%9D%A1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E7%BA%B8%E6%9D%A1.png); color: rgba(51, 51, 51, 1); font-size: 14px; text-align: left; @@ -499,7 +508,7 @@ text-align: center; top: 111px; width: 298px; height: 542px; -background-image: url(https://oss.wish.ydxxkj.top/xy/ztbkg11.png); +background-image: url(https://wish-assets.windymuse.com.cn/xy/ztbkg11.png); } .btn1{ @@ -574,7 +583,7 @@ border: 3px solid rgba(255, 255, 255, 1); top: 562px; width: 30px; height: 30px; -background-image: url(https://oss.wish.ydxxkj.top/xy/xtreturn.png); +background-image: url(https://wish-assets.windymuse.com.cn/xy/xtreturn.png); } .t-textarea{ background-color: transparent!important; @@ -591,7 +600,7 @@ background-image: url(https://oss.wish.ydxxkj.top/xy/xtreturn.png); .zjtableatp2{ width: 100%; - height: 220rpx; + height: 150rpx; box-sizing: border-box; display: flex; align-items: center; @@ -645,7 +654,8 @@ background-image: url(https://oss.wish.ydxxkj.top/xy/xtreturn.png); } .zttp12{ - height: 200rpx; + width: 100%; + height: 100%; display: flex; align-items: center; } @@ -655,14 +665,17 @@ background-image: url(https://oss.wish.ydxxkj.top/xy/xtreturn.png); align-items: flex-end; color: rgba(206, 206, 206, 1); font-size: 24rpx; + margin: 0 0 60rpx 10rpx; } .zjxftp3{ height: 200rpx; max-width: 480rpx; } .wchattxk11{ - width: 72rpx; - height: 72rpx; + width: 84rpx; + height: 84rpx; + margin-right: 24rpx; + box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4); } .tppp1{ @@ -673,28 +686,39 @@ background-image: url(https://oss.wish.ydxxkj.top/xy/xtreturn.png); margin-top: 300rpx; } .ztPop1{ - position: absolute; - width:750rpx ; + position: relative; + width: 750rpx ; height: 1624rpx; margin: 0!important; padding: 0!important; display: table-cell; vertical-align: middle; } + +.ztPop1-header { + width: 100%; + margin-top: 88rpx; + padding: 20rpx; + box-sizing: border-box; + display: flex; + justify-content: center; +} + + .tpBcan1{ position: absolute; - left: 304px; -top: 727px; - width: 55px; - height: 35px; + top: 1400rpx; + right: 32rpx; + width: 110rpx; + height: 70rpx; line-height: 70rpx; - border-radius: 10px; + border-radius: 20rpx; background: linear-gradient(222.54deg, rgba(248,99,42,1) 14.03%,rgba(249,135,89,1) 85.21%); text-align: center; box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4); border: 3px solid rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1); - font-size: 14px; + font-size: 28rpx; text-align: center; font-family: SourceHanSansSC-medium; } @@ -721,13 +745,6 @@ top: 727px; height: 116rpx; } - .title { - flex: 1; - text-align: center; - font-weight: 600; - font-size: 36rpx; - } - .btn { font-size: 32rpx; padding: 32rpx; @@ -884,7 +901,7 @@ top: 727px; border-left: 60rpx solid rgba(248,99,42,1); border-bottom: 35rpx solid transparent; */ background-size: cover; - background-image: url(https://oss.wish.ydxxkj.top/xy/if-ui-play%20Copy%401x.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/if-ui-play%20Copy%401x.png); } .luyinlbt1{ position: absolute; @@ -892,7 +909,7 @@ top: 727px; height: 50rpx; top:198rpx; overflow: hidden; - background-image: url(https://oss.wish.ydxxkj.top/xy/lylbt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/lylbt.png); } .xiexinzha{ @@ -941,7 +958,7 @@ border: 3px solid rgba(255, 255, 255, 1); top: 52px; width: 345px; height: 115px; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzhlpic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzhlpic.png); } .xfxfhl{ @@ -951,7 +968,7 @@ border: 3px solid rgba(255, 255, 255, 1); top: 331px; width: 375px; height: 462px; - background-image: url(https://oss.wish.ydxxkj.top/xy/xfxfhlpic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xfxfhlpic.png); } .xzxfnr{ position: absolute; @@ -960,7 +977,7 @@ border: 3px solid rgba(255, 255, 255, 1); width: 315px; height: 657px; overflow: auto; - background-image: url(https://oss.wish.ydxxkj.top/xy/xznrpic.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xznrpic.png); } .xfzjhz{ position: absolute; @@ -968,7 +985,7 @@ border: 3px solid rgba(255, 255, 255, 1); top: 482rpx; width: 73px; height: 71px; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E5%8D%B0%E7%AB%A0.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E5%8D%B0%E7%AB%A0.png); } .xzfhan{ @@ -1009,7 +1026,7 @@ border: 3px solid rgba(255, 255, 255, 1); top: 24rpx; width: 30px; height: 30px; -background-image: url(https://oss.wish.ydxxkj.top/xy/xtreturn.png); +background-image: url(https://wish-assets.windymuse.com.cn/xy/xtreturn.png); } .xzxjto{ margin-left: 50rpx; diff --git a/pages/home/xx/lindex/lxz/lxz.js b/pages/home/xx/lindex/lxz/lxz.js index 82693cf..a28c6c5 100644 --- a/pages/home/xx/lindex/lxz/lxz.js +++ b/pages/home/xx/lindex/lxz/lxz.js @@ -32,7 +32,8 @@ Page({ btn2:false, btn3:false, btn4:false, - showSoundImg:true + showSoundImg:true, + isPlaying: false, // 是否正在播放语音 }, already(){ console.log('确定寄出'); @@ -309,6 +310,9 @@ Page({ }, // 点击音频试听 listen(e){ + if (this.data.isPlaying) { + return; // 如果正在播放语音,则不触发事件 + } const id = e.currentTarget.dataset.url.resourceId const videoSrc = this.data.audioList.find(item => { return item.resourceId === id @@ -317,6 +321,10 @@ Page({ const innerAudioContext = wx.createInnerAudioContext() innerAudioContext.src = videoSrc innerAudioContext.play() // 播放 + this.setData({ isPlaying: true }); // 设置为正在播放语音 + innerAudioContext.onEnded(() => { + this.setData({ isPlaying: false }); // 播放完毕后设置为非播放状态 + }); }, getUserInfo(){ req.getRequest('/api/user/curt',{}).then(res => { diff --git a/pages/home/xx/lindex/lxz/lxz.wxml b/pages/home/xx/lindex/lxz/lxz.wxml index ce053f6..906886a 100644 --- a/pages/home/xx/lindex/lxz/lxz.wxml +++ b/pages/home/xx/lindex/lxz/lxz.wxml @@ -21,7 +21,7 @@ - + {{item.extra.duration}} @@ -42,7 +42,7 @@ - + 音讯 画像 @@ -68,7 +68,7 @@ {{soundTime}} - + diff --git a/pages/home/xx/lindex/lxz/lxz.wxss b/pages/home/xx/lindex/lxz/lxz.wxss index dbb6e47..301a116 100644 --- a/pages/home/xx/lindex/lxz/lxz.wxss +++ b/pages/home/xx/lindex/lxz/lxz.wxss @@ -14,7 +14,7 @@ page { background-size:100% 100%; margin-left:30rpx; margin-top: 104.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt1.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -29,7 +29,7 @@ page { background-repeat: no-repeat; background-size:100% 100%; margin-top: 608.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt2.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt2.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -157,7 +157,7 @@ textarea { display: flex; align-items: center; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/ltqpp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); } .xinfo-ltqp-yl { @@ -168,7 +168,7 @@ textarea { display: flex; align-items: center; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/ltqpp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); } .xinfo-ltqp-yl image { @@ -329,7 +329,7 @@ textarea { left: 310rpx; width: 146rpx; height: 146rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E5%8D%B0%E7%AB%A0.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E5%8D%B0%E7%AB%A0.png); background-size: cover; pointer-events: auto; } @@ -405,7 +405,7 @@ textarea { width: 100%; height: 50rpx; margin-top: 40rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/iconPark-acoustic%20Copy%203%401x%20%281%29.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/iconPark-acoustic%20Copy%203%401x%20%281%29.png); } .sound-box-img2 { @@ -465,14 +465,14 @@ textarea { .btn-over { width: 60rpx; height: 60rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/if-ui-play%20Copy%401x.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/if-ui-play%20Copy%401x.png); background-size: contain; } .btn-video { width: 60rpx; height: 60rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/semiDesign.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/semiDesign.png); background-size: contain; } @@ -530,7 +530,7 @@ textarea { width: 100%; height: 230rpx; margin-top: 104rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt1.png); background-size: contain; } @@ -547,7 +547,7 @@ textarea { width: 660rpx; height: 522rpx; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzt.png); } .already-text { diff --git a/pages/home/xx/xz/xz.js b/pages/home/xx/xz/xz.js index 82693cf..379a19c 100644 --- a/pages/home/xx/xz/xz.js +++ b/pages/home/xx/xz/xz.js @@ -32,7 +32,8 @@ Page({ btn2:false, btn3:false, btn4:false, - showSoundImg:true + showSoundImg:true, + isPlaying: false, // 是否正在播放语音 }, already(){ console.log('确定寄出'); @@ -309,6 +310,9 @@ Page({ }, // 点击音频试听 listen(e){ + if (this.data.isPlaying) { + return; // 如果正在播放语音,则不触发事件 + } const id = e.currentTarget.dataset.url.resourceId const videoSrc = this.data.audioList.find(item => { return item.resourceId === id @@ -317,6 +321,11 @@ Page({ const innerAudioContext = wx.createInnerAudioContext() innerAudioContext.src = videoSrc innerAudioContext.play() // 播放 + console.log('播放'); + this.setData({ isPlaying: true }); // 设置为正在播放语音 + innerAudioContext.onEnded(() => { + this.setData({ isPlaying: false }); // 播放完毕后设置为非播放状态 + }); }, getUserInfo(){ req.getRequest('/api/user/curt',{}).then(res => { diff --git a/pages/home/xx/xz/xz.wxml b/pages/home/xx/xz/xz.wxml index ce053f6..906886a 100644 --- a/pages/home/xx/xz/xz.wxml +++ b/pages/home/xx/xz/xz.wxml @@ -21,7 +21,7 @@ - + {{item.extra.duration}} @@ -42,7 +42,7 @@ - + 音讯 画像 @@ -68,7 +68,7 @@ {{soundTime}} - + diff --git a/pages/home/xx/xz/xz.wxss b/pages/home/xx/xz/xz.wxss index dbb6e47..301a116 100644 --- a/pages/home/xx/xz/xz.wxss +++ b/pages/home/xx/xz/xz.wxss @@ -14,7 +14,7 @@ page { background-size:100% 100%; margin-left:30rpx; margin-top: 104.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt1.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -29,7 +29,7 @@ page { background-repeat: no-repeat; background-size:100% 100%; margin-top: 608.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt2.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt2.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -157,7 +157,7 @@ textarea { display: flex; align-items: center; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/ltqpp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); } .xinfo-ltqp-yl { @@ -168,7 +168,7 @@ textarea { display: flex; align-items: center; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/ltqpp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); } .xinfo-ltqp-yl image { @@ -329,7 +329,7 @@ textarea { left: 310rpx; width: 146rpx; height: 146rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E5%8D%B0%E7%AB%A0.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E5%8D%B0%E7%AB%A0.png); background-size: cover; pointer-events: auto; } @@ -405,7 +405,7 @@ textarea { width: 100%; height: 50rpx; margin-top: 40rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/iconPark-acoustic%20Copy%203%401x%20%281%29.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/iconPark-acoustic%20Copy%203%401x%20%281%29.png); } .sound-box-img2 { @@ -465,14 +465,14 @@ textarea { .btn-over { width: 60rpx; height: 60rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/if-ui-play%20Copy%401x.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/if-ui-play%20Copy%401x.png); background-size: contain; } .btn-video { width: 60rpx; height: 60rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/semiDesign.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/semiDesign.png); background-size: contain; } @@ -530,7 +530,7 @@ textarea { width: 100%; height: 230rpx; margin-top: 104rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt1.png); background-size: contain; } @@ -547,7 +547,7 @@ textarea { width: 660rpx; height: 522rpx; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzt.png); } .already-text { diff --git a/pages/home/xy/index.wxss b/pages/home/xy/index.wxss index 0d51320..ee8ae24 100644 --- a/pages/home/xy/index.wxss +++ b/pages/home/xy/index.wxss @@ -9,7 +9,7 @@ background-size:100% 100%; margin-top:136rpx; margin-left: 304rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/jrys.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jrys.png); } .gold{ @@ -21,7 +21,7 @@ background-repeat: no-repeat; background-size:100% 100%; margin-top:240.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/gold.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/gold.png); } .gold1{ @@ -37,7 +37,7 @@ top: 0; bottom: 0; margin: auto; - background-image: url(https://oss.wish.ydxxkj.top/xy/gold1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/gold1.png); } .gold111{ position: absolute; @@ -45,7 +45,7 @@ top: 179px; width: 240px; height: 240px; - background-image: url(https://oss.wish.ydxxkj.top/xy/gold1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/gold1.png); } .gold2{ position: absolute; @@ -60,7 +60,7 @@ top: 0; bottom: 0; margin: auto; - background-image: url(https://oss.wish.ydxxkj.top/xy/gold22.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/gold22.png); } .gold3{ @@ -73,7 +73,7 @@ flex-direction: column; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/gold3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/gold3.png); } .book{ @@ -85,7 +85,7 @@ background-repeat: no-repeat; background-size:100% 100%; margin-top: 797.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/book.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/book.png); } .gold2{ @@ -101,7 +101,7 @@ top: -12rpx; bottom: 0; margin: auto; - background-image: url(https://oss.wish.ydxxkj.top/xy/gold22.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/gold22.png); } .star{ @@ -115,7 +115,7 @@ left: 0; right: 0; margin: 802.67rpx auto; - background-image: url(https://oss.wish.ydxxkj.top/xy/star.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/star.png); } .xyszy{ @@ -129,7 +129,7 @@ background-size:100% 100%; margin-top:1232rpx; margin-left:114rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xyszy.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xyszy.png); text-align: center; font-size: 90rpx; color: #6C6C6C; @@ -145,7 +145,7 @@ background-size:100% 100%; margin-top:1232rpx; margin-left:316.67rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/byz.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/byz.png); } .xyysy{ @@ -162,7 +162,7 @@ font-size: 32rpx; margin-top:1232rpx; margin-left:520rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xyszy.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xyszy.png); } .text1{ position: absolute; @@ -234,7 +234,7 @@ height: 22rpx; margin: 70rpx auto; background-size: cover; - background-image: url(https://oss.wish.ydxxkj.top/xy/xy-toast.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xy-toast.png); } .ztys{ @@ -295,7 +295,7 @@ background-size:100% 100%; margin-left:71.33rpx; margin-top: 206.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/btn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/btn.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -312,7 +312,7 @@ background-size:100% 100%; margin-left:452rpx; margin-top: 206.33rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/btn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/btn.png); color:#9A9A9A; text-align: center; font-size: 27rpx; diff --git a/pages/home/xyc/index.js b/pages/home/xyc/index.js index 81bde32..105893f 100644 --- a/pages/home/xyc/index.js +++ b/pages/home/xyc/index.js @@ -1,6 +1,7 @@ // pages/home/xyc/index.js import FormData from './../../../utils/formdata/index' import Toast from 'tdesign-miniprogram/toast/index'; +import Wxml2Canvas from 'wxml2canvas'; const app = getApp();//新建页面时 默认引入 const req = app.xzjlReq();//初始化一个的request() 实例 Page({ @@ -32,7 +33,8 @@ Page({ showXyz:false, //显示许愿中弹层 showDetail:false, //许愿成功回显弹层 shareVisible:false, //显示分享页面 - showToast:false //显示提示弹层 + showToast:false, //显示提示弹层 + showCanvas:false }, handleAdd(e){/**添加图片 */ const { fileList } = this.data; @@ -68,13 +70,9 @@ Page({ }, success: async res => { let data = JSON.parse(res.data); - console.log(data, '111111'); if (data.code == 200) { - this.setData({imgUrl:data.data.abUrl}) - console.log('打印1111') - console.log(this.data.imgUrl) + this.setData({imgUrl:data.data.abUrl}) res.data = JSON.parse(res.data); - console.log(res.data); if (res.data.code == 1) { console.log(res.data.data.url); this.img = this.baseUrl + res.data.data.url; @@ -102,7 +100,6 @@ Page({ }, doXzTime(){ this.setData({ cvisible: true }); - console.log('执行选择时间') }, // 显示提示 showToast(){ @@ -183,6 +180,7 @@ Page({ showDetail:true, item:res.data.data }) + wx.hideTabBar() },2000) }else{ console.log('额外情况') @@ -224,14 +222,17 @@ Page({ // 关闭回显 closeDetail(){ this.setData({ - showDetail: false + showDetail: false, + showCanvas: false }) + wx.showTabBar() }, // 分享 - openShare(){ + openShare(event){ this.setData({ shareVisible:!this.data.shareVisible }) + wx.hideTabBar() }, shareQQ(){ console.log('分享到qq') @@ -247,15 +248,135 @@ Page({ } }) }, + + gitImg(){ + console.log('获取图片'); + this.drawMyCanvas() + this.setData({showCanvas: true,shareVisible: false}) + }, + + + drawMyCanvas() { + wx.showLoading({ + title: '图片生成中' + }) + const that = this + const query = wx.createSelectorQuery().in(this); + query.select('#my-canvas').fields({ // 选择需要生成canvas的范围 + size: true, + scrollOffset: true + }, data => { + let width = data.width; + let height = data.height; + that.setData({ + width, + height + }) + setTimeout(() => { + that.startDraw() + }, 1500); + }).exec() +}, +startDraw() { + let that = this + + // 创建wxml2canvas对象 + let drawMyImage = new Wxml2Canvas({ + element: 'myCanvas', // canvas的id, + obj: that, // 传入当前组件的this + width: that.data.width , + height: that.data.height, + background: '#fff', // 生成图片的背景色 + progress(percent) { // 进度 + // console.log(percent); + }, + finish(url) { // 生成的图片 + wx.hideLoading() + console.log(url); + that.savePoster(url) + }, + error(res) { // 失败原因 + console.log(res); + wx.hideLoading() + } + }, this); + let data = { + // 获取wxml数据 + list: [{ + type: 'wxml', + class: '.my_canvas .my_draw_canvas', // my_canvas要绘制的wxml元素根类名, my_draw_canvas单个元素的类名(所有要绘制的单个元素都要添加该类名) + limit: '.my_canvas', // 要绘制的wxml元素根类名 + x: 0, + y: 0 + }] + } + // 绘制canvas + drawMyImage.draw(data, this); + }, + savePoster(url) { + const that = this + wx.saveImageToPhotosAlbum({ + filePath: url, + success: function() { + wx.showToast({ + title: '保存成功', + icon: 'none', + duration: 1500 + }); + }, + fail(err) { + if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg === "saveImageToPhotosAlbum:fail authorize no response") { + wx.showModal({ + title: '提示', + content: '需要您授权保存相册', + showCancel: false, + success: modalSuccess => { + wx.openSetting({ + success(settingdata) { + if (settingdata.authSetting['scope.writePhotosAlbum']) { + wx.saveImageToPhotosAlbum({ + filePath: url, + success: function () { + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000 + }) + }, + }) + } else { + wx.showToast({ + title: '授权失败,请稍后重新获取', + icon: 'none', + duration: 1500 + }); + } + } + }) + } + }) + } + } + }) + }, + + // 获取我的许愿 getMyWish(){ - req.getRequest('/api/user/curt/wish',{}).then((res)=>{ + req.getRequest('/api/user/curt/wish',{limit: '-1'}).then((res)=>{ if(res.data.code==200){ this.setData({wishes:res.data.data.records}) } }).catch((err)=>{ console.log(err); }) + req.getRequest('/api/user/curt/lover/wish',{limit: '-1'}).then((res)=>{ + if(res.data.code==200){ + this.setData({LoveWishes:res.data.data.records}) + } + }).catch((err)=>{ + console.log(err); + }) }, /** diff --git a/pages/home/xyc/index.wxml b/pages/home/xyc/index.wxml index 1641f74..6b6c6db 100644 --- a/pages/home/xyc/index.wxml +++ b/pages/home/xyc/index.wxml @@ -5,7 +5,7 @@ 银币{{userInfo.silverCoin}}枚 -Ta的愿望 +Ta的愿望{{LoveWishes.length}} 我的愿望{{wishes.length}} @@ -22,7 +22,6 @@ 许愿链接 许愿图片 - - - - - - - 愿望 - {{item.content}} - 期望时间 - {{item.deadline}} - - - + + + + + + + + + + 愿望 + {{item.content}} + 期望时间 + {{item.deadline}} - 分享 - - - - - - - - 分享到 - - - - - - 微信 - - - - - - 朋友圈 - - - - - - 微博 + + + - - - - - QQ - - - - - - QQ空间 + 分享 + + + + + + + + + + 分享到 + - - - - - 生成图片 + + + + 微信 + + + + + + 朋友圈 + + + + + + 微博 + + + + + + QQ + + + + + + QQ空间 + + + + + + 生成图片 + - - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/home/xyc/index.wxss b/pages/home/xyc/index.wxss index 1b1af83..98b36e7 100644 --- a/pages/home/xyc/index.wxss +++ b/pages/home/xyc/index.wxss @@ -10,7 +10,7 @@ background-size:100% 100%; margin-left:30rpx; margin-top: 1194rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xyk.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xyk.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -27,7 +27,7 @@ background-size:100% 100%; margin-left:258rpx; margin-top: 1228rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/xybtn.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xybtn.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -150,7 +150,7 @@ background-size:100% 100%; margin-left:46rpx; margin-top: 242rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt3.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -167,7 +167,7 @@ background-size:100% 100%; margin-left:48rpx; margin-top: 280rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E8%AE%B8%E6%84%BF%E6%B1%A0%402x.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E8%AE%B8%E6%84%BF%E6%B1%A0%402x.png); color:#9A9A9A; text-align: center; font-size: 27rpx; @@ -203,7 +203,7 @@ margin-top:30rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/xybjta.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xybjta.png); } .xynr{ @@ -404,82 +404,97 @@ font-family: SourceHanSansSC-medium; } /* 许愿成功回显 */ -.wishdetail{ +.wishdetail-box { position: absolute; - width:100%; - height:100%; - background-color: rgba(255, 255, 255, 0.7); + width: 100%; + height: 100%; + background-color: #fff; } -.popbox{ + +.wishdetail{ position: absolute; left: 66rpx; - top: 206rpx; + top: 166rpx; width: 620rpx; height: 1080rpx; +} +.popbox{ + width: 620rpx; + height: 1080rpx; + display: flex; + align-items: center; + flex-direction: column; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/detailbkg.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/detailbkg.png); +} + +.popbox .t-image { + width: 70rpx; + height: 70rpx; + margin-top: 20rpx; } .yximg{ position: absolute; - left: 146rpx; - top: 330rpx; + left: 80rpx; + top: 164rpx; width: 460rpx; height: 308rpx; border-radius: 10px; background-color: #767686; } + +.yximg .t-image { + width: 100%; + height: 100%; + margin: 0; +} + .ywwz2{ position: absolute; - left: 328rpx; - top: 706rpx; - /* width: 96rpx; */ + top: 540rpx; + width: 100%; height: 66rpx; + text-align: center; color: rgba(248, 99, 42, 1); - font-size: 24px; - text-align: left; - font-family: SourceHanSansSC-bold; + font-size: 48rpx; + font-weight: 700; } .ywxq2{ position: absolute; - left: 182rpx; - top: 798rpx; - width: 388rpx; + top: 632rpx; + width: 100%; height: 150rpx; color: rgba(108, 108, 108, 1); - font-size: 18px; + font-size: 36rpx; text-align: center; font-family: SourceHanSansSC-regular; } .qwsj2{ position: absolute; - left: 280rpx; - top: 980rpx; - /* width: 192rpx; */ + top: 814rpx; + width: 100%; height: 66rpx; color: rgba(248, 99, 42, 1); - font-size: 24px; + font-size: 48rpx; text-align: center; - font-family: SourceHanSansSC-regular; } .qwsjtxt2{ position: absolute; - left: 250rpx; - top: 1072rpx; - width: 254rpx; + top: 906rpx; + width: 100%; height: 50rpx; color: rgba(108, 108, 108, 1); - font-size: 18px; + font-size: 36rpx; text-align: center; - font-family: SourceHanSansSC-regular; } .anwz1 { position: absolute; - bottom: 0; - margin-left: 315rpx; + top: 1140rpx; + width: 100%; } .anwz1 .anwz1-tb { @@ -506,8 +521,8 @@ font-family: SourceHanSansSC-medium; } .anwz1 .anzmlogo1 { - width: 100rpx; - height: 100rpx; + width: 80rpx; + height: 80rpx; } .xyctoast { @@ -530,6 +545,9 @@ font-family: SourceHanSansSC-medium; } .popup-main { + position: absolute; + bottom: 0; + width: 100%; height: 462rpx; margin-bottom: 68rpx; background-color: #fff; @@ -556,7 +574,7 @@ font-family: SourceHanSansSC-medium; .popup-main .main-box { height: 100%; - padding-top:70rpx; + padding-top:56rpx; box-sizing: border-box; display: flex; flex-wrap: wrap; @@ -606,4 +624,27 @@ font-family: SourceHanSansSC-medium; } .cyan { background-color: #A8E450 !important; +} + + + +.logosta { + position: absolute; + top: 20rpx; + left: 270rpx; + width: 50px; + height: 50px; + z-index: 1; +} + +.myCanvas { + width: 620rpx; + height: 1080rpx; +} + +.my_canvas { + width: 620rpx; + height: 1080rpx; + position: absolute; + top: 0; } \ No newline at end of file diff --git a/pages/home/xyc/tdyw/tdyw.js b/pages/home/xyc/tdyw/tdyw.js index 1bda042..a12163b 100644 --- a/pages/home/xyc/tdyw/tdyw.js +++ b/pages/home/xyc/tdyw/tdyw.js @@ -1,6 +1,7 @@ // pages/home/xyc/wdyw/wdyw.js const app = getApp();//新建页面时 默认引入 const req = app.xzjlReq();//初始化一个的request() 实例 +import Wxml2Canvas from 'wxml2canvas'; Page({ /** @@ -11,12 +12,126 @@ Page({ detail:{}, visible:false, shareVisible:false, //分享弹层 - wishes:[] + wishes:[], + showCanvas: true }, // 分享微信 shareWx(){ console.log('分享微信') }, + + getImg(){ + console.log('获取图片'); + this.setData({shareVisible: false, showCanvas:true}) + this.drawMyCanvas() + }, + + drawMyCanvas() { + wx.showLoading({ + title: '图片生成中' + }) + const that = this + const query = wx.createSelectorQuery().in(this); + query.select('#my-canvas').fields({ // 选择需要生成canvas的范围 + size: true, + scrollOffset: true + }, data => { + let width = data.width; + let height = data.height; + that.setData({ + width, + height + }) + setTimeout(() => { + that.startDraw() + }, 1500); + }).exec() +}, +startDraw() { + let that = this + + // 创建wxml2canvas对象 + let drawMyImage = new Wxml2Canvas({ + element: 'myCanvas', // canvas的id, + obj: that, // 传入当前组件的this + width: that.data.width , + height: that.data.height, + background: '#fff', // 生成图片的背景色 + progress(percent) { // 进度 + // console.log(percent); + }, + finish(url) { // 生成的图片 + wx.hideLoading() + console.log(url); + that.savePoster(url) + }, + error(res) { // 失败原因 + console.log(res); + wx.hideLoading() + } + }, this); + let data = { + // 获取wxml数据 + list: [{ + type: 'wxml', + class: '.my_canvas .my_draw_canvas', // my_canvas要绘制的wxml元素根类名, my_draw_canvas单个元素的类名(所有要绘制的单个元素都要添加该类名) + limit: '.my_canvas', // 要绘制的wxml元素根类名 + x: 0, + y: 0 + }] + } + // 绘制canvas + drawMyImage.draw(data, this); + }, + savePoster(url) { + const that = this + wx.saveImageToPhotosAlbum({ + filePath: url, + success: function() { + wx.showToast({ + title: '保存成功', + icon: 'none', + duration: 1500 + }); + }, + fail(err) { + if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg === "saveImageToPhotosAlbum:fail authorize no response") { + wx.showModal({ + title: '提示', + content: '需要您授权保存相册', + showCancel: false, + success: modalSuccess => { + wx.openSetting({ + success(settingdata) { + if (settingdata.authSetting['scope.writePhotosAlbum']) { + wx.saveImageToPhotosAlbum({ + filePath: url, + success: function () { + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000 + }) + }, + }) + } else { + wx.showToast({ + title: '授权失败,请稍后重新获取', + icon: 'none', + duration: 1500 + }); + } + } + }) + } + }) + } + } + }) + }, + + + showShare(){ this.setData({ shareVisible:!this.data.shareVisible @@ -86,18 +201,18 @@ Page({ }); }, changeVisible(){ - this.setData({visible:false}) + this.setData({visible:false, showCanvas:false}) }, go2Reback(){ wx.navigateBack({ changed: true }); }, getMyWish(){ - req.getRequest('/api/user/curt/lover/wish',{}).then((res)=>{ + req.getRequest('/api/user/curt/lover/wish',{limit: '-1'}).then((res)=>{ console.log(res,'11111111') if(res.data.code==200){ this.setData({wishes:res.data.data.records}) } - }).catch((err)=>{ + }).catch((err)=>{ console.log(err); }) }, @@ -120,14 +235,12 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { - }, /** * 生命周期函数--监听页面隐藏 */ onHide() { - }, /** diff --git a/pages/home/xyc/tdyw/tdyw.wxml b/pages/home/xyc/tdyw/tdyw.wxml index 80d0ea0..0bb0b80 100644 --- a/pages/home/xyc/tdyw/tdyw.wxml +++ b/pages/home/xyc/tdyw/tdyw.wxml @@ -1,87 +1,111 @@ - -ta的愿望 + + + 我的愿望 + - - - + + + + + + + + + + + + + {{item.content}} + 期望时间:{{item.deadline}} + + + + + 进行中 + - - - - - - {{item.content}} - 期望时间:{{item.deadline}} - - - - 进行中 - 已完成 - 已过期 - - - + + + 已完成 + + + + + 已过期 + + + + + + - - - - - - 愿望 - {{detail.content}} - 期望时间 - {{detail.deadline}} + + + + + + + + + + + 愿望 + {{detail.content}} + 期望时间 + {{detail.deadline}} + + - + 删除 - + - + 修改 - + - + 已达成 - + - + 分享 - + - + 删除 - + - + 分享 - + - + 删除 - + - + 修改 - + @@ -100,4 +124,51 @@ data-del="{{detail.id}}" bind:cancel="closeDelDialog" /> - + + + + + + 分享到 + + + + + + 微信 + + + + + + 朋友圈 + + + + + + 微博 + + + + + + QQ + + + + + + QQ空间 + + + + + + 生成图片 + + + + diff --git a/pages/home/xyc/tdyw/tdyw.wxss b/pages/home/xyc/tdyw/tdyw.wxss index 88781d5..a10bf79 100644 --- a/pages/home/xyc/tdyw/tdyw.wxss +++ b/pages/home/xyc/tdyw/tdyw.wxss @@ -1,144 +1,137 @@ /* pages/home/xyc/wdyw/wdyw.wxss */ -.reback{ + +.top-header { + position: fixed; + top: 0; + width: 100%; + height: 176rpx; + padding-bottom: 20rpx; + box-sizing: border-box; + display: flex; + align-items: flex-end; + justify-content: center; + background-color: #fff; + z-index: 1; +} + +.header-reback{ position: absolute; - margin-left: 20rpx; - margin-top:108rpx; + left: 20rpx; width:48rpx; height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } -.title{ - position: absolute; - left: 278rpx; - top: 108rpx; +.header-title{ width: 196rpx; height: 48rpx; color: rgba(108, 108, 108, 1); font-size: 32rpx; text-align: center; - font-family: SourceHanSansSC-regular; } -.ywbjt1{ +.body { position: absolute; - left: -44rpx; - top: 280rpx; - width: 842rpx; + top: 190rpx; + width: 100%; +} + +.ywbjt1{ + width: 100%; height: 1168rpx; + margin-top: 280rpx; + padding-top: 404rpx; + box-sizing: border-box; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bg111.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bg111.png); } .xycbg2{ - position: absolute; - left: -28rpx; - top: 684rpx; - width: 798rpx; + width: 100%; height: 682rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/xycbg2.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xycbg2.png); } .wishbox{ position: absolute; - width:750rpx; - top:190rpx; - height:1300rpx; -} - -.xycbg3{ - position: absolute; - left: -48rpx; - top: 232rpx; - width: 880rpx; - height: 1370rpx; - background-repeat: no-repeat; - background-size:100% 100%; + top: 0; + width:100%; + height:1428rpx; + padding-top: 10rpx; + box-sizing: border-box; + display: flex; + align-items: center; + flex-direction: column; + overflow-y: auto; } .boxitem{ - margin: 0 auto; - top: 104px; - width: 343px; - height: 94px; - line-height: 20px; - border-radius: 10px; + width: 686rpx; + height: 188rpx; + padding: 40rpx 32rpx; + box-sizing: border-box; + border-radius: 20rpx; background-color: rgba(255, 255, 255, 1); - text-align: center; - box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.4); + box-shadow: 0px 2rpx 6rpx 0px rgba(0, 0, 0, 0.4); margin-bottom: 30rpx; + display: flex; + align-items: center; + justify-content: space-between; } .boximg{ - float: left; - margin-left: 32rpx; - padding-top: 39rpx; - width: 55px; - height: 55px; + width: 110rpx; + height: 110rpx; +} + +.wishbox-text { + width: 320rpx; + height: 100%; + display: flex; + justify-content: center; + flex-direction: column; } .boxtitle{ - float:initial; - margin-left: 174rpx; - padding-top: 58rpx; - width: 180px; - height: 20px; color: rgba(108, 108, 108, 1); - font-size: 30rpx; - text-align: left; + font-size: 28rpx; font-weight: 700; - overflow:hidden; - white-space: nowrap; - text-overflow: ellipsis; - -o-text-overflow:ellipsis; + width: 320rpx; } .qwsjbox{ - float:initial; - margin-left: 174rpx; - top: 306rpx; - width: 286rpx; - height: 34rpx; color: rgba(108, 108, 108, 1); - font-size: 12px; - text-align: left; - font-family: SourceHanSansSC-regular; + font-size: 28rpx; + width: 320rpx; } -.wczt{ - float:initial; - margin-left: 295px; - margin-top: -75rpx; - width: 36px; - height: 17px; - color: rgba(108, 108, 108, 1); - font-size: 12px; - text-align: left; - font-family: SourceHanSansSC-regular; +.xy-icon { + width: 110rpx; + height: 110rpx; + display: flex; + align-items: center; + justify-content: space-between; + flex-direction: column; } -.logosta{ - float:initial; - margin-left: 289px; - margin-top: -100rpx; - width: 34px; - height: 34px; +.xy-icon .icon { + width: 70rpx; + height: 70rpx; } -.logostajxz{ - float:initial; - margin-left: 283px; - margin-top: -130rpx; - width: 60px; - height: 60px; +.xy-icon .text { + font-size: 24rpx; + color: rgba(108, 108, 108, 1); } + + .all{ width:750rpx; height:1624rpx; @@ -150,19 +143,16 @@ } .popbox{ position: absolute; - left: 66rpx; - top: 166rpx; + left: 0; + top: 0; width: 620rpx; height: 1080rpx; - background-repeat: no-repeat; - background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/detailbkg.png); } .yximg{ position: absolute; - left: 146rpx; - top: 330rpx; + left: 80rpx; + top: 164rpx; width: 460rpx; height: 308rpx; border-radius: 10px; @@ -170,21 +160,19 @@ } .ywwz{ position: absolute; - left: 328rpx; - top: 706rpx; - /* width: 96rpx; */ + top: 540rpx; + width: 100%; height: 66rpx; + text-align: center; color: rgba(248, 99, 42, 1); font-size: 48rpx; - text-align: left; - font-family: SourceHanSansSC-bold; + font-weight: 700; } .ywxq{ position: absolute; - left: 182rpx; - top: 798rpx; - width: 388rpx; + top: 632rpx; + width: 100%; height: 150rpx; color: rgba(108, 108, 108, 1); font-size: 36rpx; @@ -193,25 +181,21 @@ } .qwsj{ position: absolute; - left: 280rpx; - top: 980rpx; - /* width: 192rpx; */ + top: 814rpx; + width: 100%; height: 66rpx; color: rgba(248, 99, 42, 1); font-size: 48rpx; text-align: center; - font-family: SourceHanSansSC-regular; } .qwsjtxt{ position: absolute; - left: 250rpx; - top: 1072rpx; - width: 254rpx; + top: 906rpx; + width: 100%; height: 50rpx; color: rgba(108, 108, 108, 1); font-size: 36rpx; text-align: center; - font-family: SourceHanSansSC-regular; } .yqq{/*圆圈*/ @@ -373,6 +357,46 @@ top: 192rpx; left: 336rpx; width: 80rpx; - height: 64rpx; + height: 80rpx; + z-index: 1; +} + + +.myCanvas-popup { + height: 100vh; + background-color: rgba(255, 255, 255, 0) !important; +} + +.myCanvas-popup .t-popup__content{ + height: 100%; + background-color: rgba(255, 255, 255, 1); +} + +.my_canvas { + width: 620rpx; + height: 1080rpx; + position: absolute; + top: 0; +} + +.myCanvas { + width: 620rpx; + height: 1080rpx; +} + +.logosta { + position: absolute; + top: 20rpx; + left: 270rpx; + width: 50px; + height: 50px; z-index: 1; +} + +.box-canvas { + position: absolute; + left: 66rpx; + top: 166rpx; + width: 620rpx; + height: 1080rpx; } \ No newline at end of file diff --git a/pages/home/xyc/wdyw/wdyw.js b/pages/home/xyc/wdyw/wdyw.js index 9d0e38f..6e041fe 100644 --- a/pages/home/xyc/wdyw/wdyw.js +++ b/pages/home/xyc/wdyw/wdyw.js @@ -1,6 +1,7 @@ // pages/home/xyc/wdyw/wdyw.js const app = getApp();//新建页面时 默认引入 const req = app.xzjlReq();//初始化一个的request() 实例 +import Wxml2Canvas from 'wxml2canvas'; Page({ /** @@ -11,12 +12,126 @@ Page({ detail:{}, visible:false, shareVisible:false, //分享弹层 - wishes:[] + wishes:[], + showCanvas: true }, // 分享微信 shareWx(){ console.log('分享微信') }, + + getImg(){ + console.log('获取图片'); + this.setData({shareVisible: false, showCanvas:true}) + this.drawMyCanvas() + }, + + drawMyCanvas() { + wx.showLoading({ + title: '图片生成中' + }) + const that = this + const query = wx.createSelectorQuery().in(this); + query.select('#my-canvas').fields({ // 选择需要生成canvas的范围 + size: true, + scrollOffset: true + }, data => { + let width = data.width; + let height = data.height; + that.setData({ + width, + height + }) + setTimeout(() => { + that.startDraw() + }, 1500); + }).exec() +}, +startDraw() { + let that = this + + // 创建wxml2canvas对象 + let drawMyImage = new Wxml2Canvas({ + element: 'myCanvas', // canvas的id, + obj: that, // 传入当前组件的this + width: that.data.width , + height: that.data.height, + background: '#fff', // 生成图片的背景色 + progress(percent) { // 进度 + // console.log(percent); + }, + finish(url) { // 生成的图片 + wx.hideLoading() + console.log(url); + that.savePoster(url) + }, + error(res) { // 失败原因 + console.log(res); + wx.hideLoading() + } + }, this); + let data = { + // 获取wxml数据 + list: [{ + type: 'wxml', + class: '.my_canvas .my_draw_canvas', // my_canvas要绘制的wxml元素根类名, my_draw_canvas单个元素的类名(所有要绘制的单个元素都要添加该类名) + limit: '.my_canvas', // 要绘制的wxml元素根类名 + x: 0, + y: 0 + }] + } + // 绘制canvas + drawMyImage.draw(data, this); + }, + savePoster(url) { + const that = this + wx.saveImageToPhotosAlbum({ + filePath: url, + success: function() { + wx.showToast({ + title: '保存成功', + icon: 'none', + duration: 1500 + }); + }, + fail(err) { + if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg === "saveImageToPhotosAlbum:fail authorize no response") { + wx.showModal({ + title: '提示', + content: '需要您授权保存相册', + showCancel: false, + success: modalSuccess => { + wx.openSetting({ + success(settingdata) { + if (settingdata.authSetting['scope.writePhotosAlbum']) { + wx.saveImageToPhotosAlbum({ + filePath: url, + success: function () { + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000 + }) + }, + }) + } else { + wx.showToast({ + title: '授权失败,请稍后重新获取', + icon: 'none', + duration: 1500 + }); + } + } + }) + } + }) + } + } + }) + }, + + + showShare(){ this.setData({ shareVisible:!this.data.shareVisible @@ -86,18 +201,18 @@ Page({ }); }, changeVisible(){ - this.setData({visible:false}) + this.setData({visible:false, showCanvas:false}) }, go2Reback(){ wx.navigateBack({ changed: true }); }, getMyWish(){ - req.getRequest('/api/user/curt/wish',{}).then((res)=>{ + req.getRequest('/api/user/curt/wish',{limit: '-1'}).then((res)=>{ console.log(res,'11111111') if(res.data.code==200){ this.setData({wishes:res.data.data.records}) } - }).catch((err)=>{ + }).catch((err)=>{ console.log(err); }) }, @@ -120,14 +235,12 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { - }, /** * 生命周期函数--监听页面隐藏 */ onHide() { - }, /** diff --git a/pages/home/xyc/wdyw/wdyw.wxml b/pages/home/xyc/wdyw/wdyw.wxml index 46fe62a..0bb0b80 100644 --- a/pages/home/xyc/wdyw/wdyw.wxml +++ b/pages/home/xyc/wdyw/wdyw.wxml @@ -1,88 +1,111 @@ - -我的愿望 + + + 我的愿望 + - - - + + + + + + + + + + + + + {{item.content}} + 期望时间:{{item.deadline}} + + + + + 进行中 + - - - - - {{item.content}} - 期望时间:{{item.deadline}} - - - - 进行中 - 已完成 - 已过期 - - + + + 已完成 + + + + + 已过期 + + + + + + - - - - - - - - - 愿望 - {{detail.content}} - 期望时间 - {{detail.deadline}} + + + + + + + + + + + 愿望 + {{detail.content}} + 期望时间 + {{detail.deadline}} + + 删除 - + 修改 - + 已达成 - + 分享 - + 删除 - + 分享 - + 删除 - + 修改 - + @@ -112,37 +135,37 @@ data-del="{{detail.id}}" 微信 - + 朋友圈 - + 微博 - + QQ - + QQ空间 - - + + 生成图片 diff --git a/pages/home/xyc/wdyw/wdyw.wxss b/pages/home/xyc/wdyw/wdyw.wxss index 88781d5..a10bf79 100644 --- a/pages/home/xyc/wdyw/wdyw.wxss +++ b/pages/home/xyc/wdyw/wdyw.wxss @@ -1,144 +1,137 @@ /* pages/home/xyc/wdyw/wdyw.wxss */ -.reback{ + +.top-header { + position: fixed; + top: 0; + width: 100%; + height: 176rpx; + padding-bottom: 20rpx; + box-sizing: border-box; + display: flex; + align-items: flex-end; + justify-content: center; + background-color: #fff; + z-index: 1; +} + +.header-reback{ position: absolute; - margin-left: 20rpx; - margin-top:108rpx; + left: 20rpx; width:48rpx; height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/reback.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } -.title{ - position: absolute; - left: 278rpx; - top: 108rpx; +.header-title{ width: 196rpx; height: 48rpx; color: rgba(108, 108, 108, 1); font-size: 32rpx; text-align: center; - font-family: SourceHanSansSC-regular; } -.ywbjt1{ +.body { position: absolute; - left: -44rpx; - top: 280rpx; - width: 842rpx; + top: 190rpx; + width: 100%; +} + +.ywbjt1{ + width: 100%; height: 1168rpx; + margin-top: 280rpx; + padding-top: 404rpx; + box-sizing: border-box; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/bg111.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bg111.png); } .xycbg2{ - position: absolute; - left: -28rpx; - top: 684rpx; - width: 798rpx; + width: 100%; height: 682rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/xycbg2.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xycbg2.png); } .wishbox{ position: absolute; - width:750rpx; - top:190rpx; - height:1300rpx; -} - -.xycbg3{ - position: absolute; - left: -48rpx; - top: 232rpx; - width: 880rpx; - height: 1370rpx; - background-repeat: no-repeat; - background-size:100% 100%; + top: 0; + width:100%; + height:1428rpx; + padding-top: 10rpx; + box-sizing: border-box; + display: flex; + align-items: center; + flex-direction: column; + overflow-y: auto; } .boxitem{ - margin: 0 auto; - top: 104px; - width: 343px; - height: 94px; - line-height: 20px; - border-radius: 10px; + width: 686rpx; + height: 188rpx; + padding: 40rpx 32rpx; + box-sizing: border-box; + border-radius: 20rpx; background-color: rgba(255, 255, 255, 1); - text-align: center; - box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.4); + box-shadow: 0px 2rpx 6rpx 0px rgba(0, 0, 0, 0.4); margin-bottom: 30rpx; + display: flex; + align-items: center; + justify-content: space-between; } .boximg{ - float: left; - margin-left: 32rpx; - padding-top: 39rpx; - width: 55px; - height: 55px; + width: 110rpx; + height: 110rpx; +} + +.wishbox-text { + width: 320rpx; + height: 100%; + display: flex; + justify-content: center; + flex-direction: column; } .boxtitle{ - float:initial; - margin-left: 174rpx; - padding-top: 58rpx; - width: 180px; - height: 20px; color: rgba(108, 108, 108, 1); - font-size: 30rpx; - text-align: left; + font-size: 28rpx; font-weight: 700; - overflow:hidden; - white-space: nowrap; - text-overflow: ellipsis; - -o-text-overflow:ellipsis; + width: 320rpx; } .qwsjbox{ - float:initial; - margin-left: 174rpx; - top: 306rpx; - width: 286rpx; - height: 34rpx; color: rgba(108, 108, 108, 1); - font-size: 12px; - text-align: left; - font-family: SourceHanSansSC-regular; + font-size: 28rpx; + width: 320rpx; } -.wczt{ - float:initial; - margin-left: 295px; - margin-top: -75rpx; - width: 36px; - height: 17px; - color: rgba(108, 108, 108, 1); - font-size: 12px; - text-align: left; - font-family: SourceHanSansSC-regular; +.xy-icon { + width: 110rpx; + height: 110rpx; + display: flex; + align-items: center; + justify-content: space-between; + flex-direction: column; } -.logosta{ - float:initial; - margin-left: 289px; - margin-top: -100rpx; - width: 34px; - height: 34px; +.xy-icon .icon { + width: 70rpx; + height: 70rpx; } -.logostajxz{ - float:initial; - margin-left: 283px; - margin-top: -130rpx; - width: 60px; - height: 60px; +.xy-icon .text { + font-size: 24rpx; + color: rgba(108, 108, 108, 1); } + + .all{ width:750rpx; height:1624rpx; @@ -150,19 +143,16 @@ } .popbox{ position: absolute; - left: 66rpx; - top: 166rpx; + left: 0; + top: 0; width: 620rpx; height: 1080rpx; - background-repeat: no-repeat; - background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/detailbkg.png); } .yximg{ position: absolute; - left: 146rpx; - top: 330rpx; + left: 80rpx; + top: 164rpx; width: 460rpx; height: 308rpx; border-radius: 10px; @@ -170,21 +160,19 @@ } .ywwz{ position: absolute; - left: 328rpx; - top: 706rpx; - /* width: 96rpx; */ + top: 540rpx; + width: 100%; height: 66rpx; + text-align: center; color: rgba(248, 99, 42, 1); font-size: 48rpx; - text-align: left; - font-family: SourceHanSansSC-bold; + font-weight: 700; } .ywxq{ position: absolute; - left: 182rpx; - top: 798rpx; - width: 388rpx; + top: 632rpx; + width: 100%; height: 150rpx; color: rgba(108, 108, 108, 1); font-size: 36rpx; @@ -193,25 +181,21 @@ } .qwsj{ position: absolute; - left: 280rpx; - top: 980rpx; - /* width: 192rpx; */ + top: 814rpx; + width: 100%; height: 66rpx; color: rgba(248, 99, 42, 1); font-size: 48rpx; text-align: center; - font-family: SourceHanSansSC-regular; } .qwsjtxt{ position: absolute; - left: 250rpx; - top: 1072rpx; - width: 254rpx; + top: 906rpx; + width: 100%; height: 50rpx; color: rgba(108, 108, 108, 1); font-size: 36rpx; text-align: center; - font-family: SourceHanSansSC-regular; } .yqq{/*圆圈*/ @@ -373,6 +357,46 @@ top: 192rpx; left: 336rpx; width: 80rpx; - height: 64rpx; + height: 80rpx; + z-index: 1; +} + + +.myCanvas-popup { + height: 100vh; + background-color: rgba(255, 255, 255, 0) !important; +} + +.myCanvas-popup .t-popup__content{ + height: 100%; + background-color: rgba(255, 255, 255, 1); +} + +.my_canvas { + width: 620rpx; + height: 1080rpx; + position: absolute; + top: 0; +} + +.myCanvas { + width: 620rpx; + height: 1080rpx; +} + +.logosta { + position: absolute; + top: 20rpx; + left: 270rpx; + width: 50px; + height: 50px; z-index: 1; +} + +.box-canvas { + position: absolute; + left: 66rpx; + top: 166rpx; + width: 620rpx; + height: 1080rpx; } \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 896797a..2f6ce62 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -14,7 +14,7 @@ display: flex; flex-direction: column; align-items: center; - background-image: url(https://oss.wish.ydxxkj.top/xy/index-bgc.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/index-bgc.png); background-repeat: no-repeat; background-size: contain; } @@ -26,7 +26,7 @@ flex-direction: column; background-repeat: no-repeat; background-size: 50rpx 50rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/question.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/question.png); } .alb{ @@ -35,7 +35,7 @@ margin-top: 258rpx; background-repeat: no-repeat; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/alb.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/alb.png); } .qr{ @@ -46,14 +46,14 @@ align-items: center; justify-content: center; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/qr.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/qr.png); } .js{ width: 114rpx; height: 172rpx; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/js.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/js.png); } .yw{ @@ -64,14 +64,14 @@ align-items: center; justify-content: center; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yw.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yw.png); } .shadow { width: 150rpx; height: 62rpx; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/shadow.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/shadow.png); } .jstext{ @@ -79,7 +79,7 @@ height: 242rpx; margin-top: 118rpx; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/jstext.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/jstext.png); } .yx{ @@ -93,5 +93,5 @@ font-size: 40rpx; font-weight: bold; background-size:100% 100%; - background-image: url(https://oss.wish.ydxxkj.top/xy/yx.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/yx.png); } diff --git a/pages/xz/index.wxml b/pages/xz/index.wxml index 8ffca6a..c794eaf 100644 --- a/pages/xz/index.wxml +++ b/pages/xz/index.wxml @@ -40,10 +40,10 @@ - + - + 销毁 diff --git a/pages/xz/index.wxss b/pages/xz/index.wxss index 636e3cd..ea28f8a 100644 --- a/pages/xz/index.wxss +++ b/pages/xz/index.wxss @@ -16,7 +16,7 @@ page { width: 100%; height: 230rpx; margin-top: 104rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt1.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt1.png); background-size: cover; } @@ -25,7 +25,7 @@ page { width: 660rpx; height: 522rpx; background-size: contain; - background-image: url(https://oss.wish.ydxxkj.top/xy/xzt.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/xzt.png); } .already-text { @@ -124,7 +124,7 @@ page { padding-left: 48rpx; box-sizing: border-box; background-size: cover; - background-image: url(https://oss.wish.ydxxkj.top/xy/ltqpp.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); } .xinfo-icon { @@ -132,7 +132,7 @@ page { height: 60rpx; background-size: cover; margin-right: 20rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E8%AF%AD%E9%9F%B3.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E8%AF%AD%E9%9F%B3.png); } .xinfo-img { @@ -172,7 +172,7 @@ page { height: 900rpx; background-size: cover; pointer-events: none; - background-image: url(https://oss.wish.ydxxkj.top/xy/bgt2.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt2.png); } .btm-img-icon { @@ -181,7 +181,7 @@ page { left: 308rpx; width: 146rpx; height: 146rpx; - background-image: url(https://oss.wish.ydxxkj.top/xy/%E5%8D%B0%E7%AB%A0.png); + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E5%8D%B0%E7%AB%A0.png); background-size: cover; } diff --git a/project.private.config.json b/project.private.config.json index afcc415..cda0b4e 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -3,21 +3,14 @@ "projectname": "xzjl-ui", "setting": { "compileHotReLoad": true, - "urlCheck": false + "urlCheck": true }, "condition": { "miniprogram": { "list": [ { "name": "", - "pathName": "pages/home/jl/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "", - "pathName": "pages/home/xx/lindex/lindex", + "pathName": "pages/home/xyc/index", "query": "", "launchMode": "default", "scene": null