UNPKG

@digital-blueprint/esign-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/esign-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/esign-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/esign-app/) | [Esign Bundle](https://gitlab.tugraz.

57 lines 1.09 MB
/*! * License: LGPL-2.1-or-later * Dependencies: * * @webcomponents/scoped-custom-element-registry: BSD-3-Clause * @dbp-toolkit/app-shell: LGPL-2.1-or-later * @dbp-toolkit/language-select: LGPL-2.1-or-later * @dbp-toolkit/auth: LGPL-2.1-or-later * @dbp-toolkit/notification: LGPL-2.1-or-later * @dbp-toolkit/theme-switcher: LGPL-2.1-or-later * universal-router: MIT * @dbp-toolkit/matomo: LGPL-2.1-or-later * @tugraz/web-components: LGPL-2.1-or-later * exceljs: MIT * fabric: MIT * jspdf-autotable: MIT * keycloak-js: Apache-2.0 * jszip: (MIT OR GPL-3.0-or-later) * pdfjs-dist: Apache-2.0 * path2d: MIT * fflate: MIT * @babel/runtime: MIT * iobuffer: MIT * pako: (MIT AND Zlib) * fast-png: MIT * jspdf: MIT * core-js: MIT * performance-now: MIT * raf: MIT * rgbcolor: MIT OR SEE LICENSE IN FEEL-FREE.md * svg-pathdata: MIT * stackblur-canvas: MIT * canvg: MIT * dompurify: (MPL-2.0 OR Apache-2.0) * html2canvas: MIT * i18next: MIT * @dbp-toolkit/common: LGPL-2.1-or-later * @lit/reactive-element: BSD-3-Clause * lit-html: BSD-3-Clause * lit-element: BSD-3-Clause * @open-wc/dedupe-mixin: MIT * @open-wc/scoped-elements: MIT * dialog-polyfill: BSD * @digital-blueprint/annotpdf: MIT * @dbp-toolkit/pdf-viewer: LGPL-2.1-or-later * @popperjs/core: MIT * tippy.js: MIT * @dbp-toolkit/tooltip: LGPL-2.1-or-later * jquery: MIT * select2: MIT * @dbp-toolkit/resource-select: LGPL-2.1-or-later * @dbp-toolkit/tabulator-table: LGPL-2.1-or-later */ import{i as __toESM,r as __toDynamicImportESM,t as __commonJSMin}from"./chunk.RTniY5sO.js";import{A as ScopedElementsMixin,E as getSelect2CSS,F as asyncObjectForEach,G as E,J as x,K as T,M as Icon,N as getIconSVGURL,Q as humanFileSize,R as getAbsoluteURL,T as getRadioAndCheckboxCss,U as makeId,X as r,Y as i,Z as createInstance$2,b as getButtonCSS,c as LangMixin,d as e,f as e$1,g as AdapterLitElement,h as DBPLitElement,j as MiniSpinner,k as getThemeCSS,m as t,p as i$1,q as Z,v as IconButton,w as getNotificationCSS,x as getGeneralCSS,z as getAssetURL}from"./dbp-lit-element.D0c52m5A.js";import{t as send}from"./notification.DW4NLT-r.js";import{n as createInstance}from"./activity.CTWe4Y15.js";import{c as getTabulatorStyles,s as TabulatorFull$1}from"./dbp-file-handling-lit-element.JMERQ6PV.js";var import_pdfAnnotate=__toESM(__commonJSMin((exports,module)=>{(function(root,factory){typeof exports==`object`&&typeof module==`object`?module.exports=factory():typeof define==`function`&&define.amd?define(`pdfAnnotate`,[],factory):typeof exports==`object`?exports.pdfAnnotate=factory():root.pdfAnnotate=factory()})(window,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module$1=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module$1.exports,module$1,module$1.exports,__webpack_require__),module$1.l=!0,module$1.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports$1,name$3,getter){__webpack_require__.o(exports$1,name$3)||Object.defineProperty(exports$1,name$3,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports$1){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(exports$1,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(exports$1,`__esModule`,{value:!0})},__webpack_require__.t=function(value,mode){if(mode&1&&(value=__webpack_require__(value)),mode&8||mode&4&&typeof value==`object`&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,`default`,{enumerable:!0,value}),mode&2&&typeof value!=`string`)for(var key in value)__webpack_require__.d(ns,key,function(key$1){return value[key$1]}.bind(null,key));return ns},__webpack_require__.n=function(module$1){var getter=module$1&&module$1.__esModule?function(){return module$1.default}:function(){return module$1};return __webpack_require__.d(getter,`a`,getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p=``,__webpack_require__(__webpack_require__.s=`./src/index.ts`)}({"./node_modules/asn1.js/lib/asn1.js":function(module$1,exports$1,__webpack_require__){var asn1=exports$1;asn1.bignum=__webpack_require__(`./node_modules/bn.js/lib/bn.js`),asn1.define=__webpack_require__(`./node_modules/asn1.js/lib/asn1/api.js`).define,asn1.base=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/index.js`),asn1.constants=__webpack_require__(`./node_modules/asn1.js/lib/asn1/constants/index.js`),asn1.decoders=__webpack_require__(`./node_modules/asn1.js/lib/asn1/decoders/index.js`),asn1.encoders=__webpack_require__(`./node_modules/asn1.js/lib/asn1/encoders/index.js`)},"./node_modules/asn1.js/lib/asn1/api.js":function(module$1,exports$1,__webpack_require__){var asn1=__webpack_require__(`./node_modules/asn1.js/lib/asn1.js`),inherits=__webpack_require__(`./node_modules/inherits/inherits_browser.js`),api=exports$1;api.define=function(name$3,body){return new Entity(name$3,body)};function Entity(name$3,body){this.name=name$3,this.body=body,this.decoders={},this.encoders={}}Entity.prototype._createNamed=function(base){var named;try{named=__webpack_require__(`./node_modules/vm-browserify/index.js`).runInThisContext(`(function `+this.name+`(entity) { this._initNamed(entity); })`)}catch{named=function(entity){this._initNamed(entity)}}return inherits(named,base),named.prototype._initNamed=function(entity){base.call(this,entity)},new named(this)},Entity.prototype._getDecoder=function(enc){return enc||=`der`,this.decoders.hasOwnProperty(enc)||(this.decoders[enc]=this._createNamed(asn1.decoders[enc])),this.decoders[enc]},Entity.prototype.decode=function(data,enc,options){return this._getDecoder(enc).decode(data,options)},Entity.prototype._getEncoder=function(enc){return enc||=`der`,this.encoders.hasOwnProperty(enc)||(this.encoders[enc]=this._createNamed(asn1.encoders[enc])),this.encoders[enc]},Entity.prototype.encode=function(data,enc,reporter){return this._getEncoder(enc).encode(data,reporter)}},"./node_modules/asn1.js/lib/asn1/base/buffer.js":function(module$1,exports$1,__webpack_require__){var inherits=__webpack_require__(`./node_modules/inherits/inherits_browser.js`),Reporter=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/index.js`).Reporter,Buffer=__webpack_require__(`./node_modules/buffer/index.js`).Buffer;function DecoderBuffer(base,options){if(Reporter.call(this,options),!Buffer.isBuffer(base)){this.error(`Input not Buffer`);return}this.base=base,this.offset=0,this.length=base.length}inherits(DecoderBuffer,Reporter),exports$1.DecoderBuffer=DecoderBuffer,DecoderBuffer.prototype.save=function(){return{offset:this.offset,reporter:Reporter.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function(save){var res=new DecoderBuffer(this.base);return res.offset=save.offset,res.length=this.offset,this.offset=save.offset,Reporter.prototype.restore.call(this,save.reporter),res},DecoderBuffer.prototype.isEmpty=function(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function(fail){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(fail||`DecoderBuffer overrun`)},DecoderBuffer.prototype.skip=function(bytes,fail){if(!(this.offset+bytes<=this.length))return this.error(fail||`DecoderBuffer overrun`);var res=new DecoderBuffer(this.base);return res._reporterState=this._reporterState,res.offset=this.offset,res.length=this.offset+bytes,this.offset+=bytes,res},DecoderBuffer.prototype.raw=function(save){return this.base.slice(save?save.offset:this.offset,this.length)};function EncoderBuffer(value,reporter){if(Array.isArray(value))this.length=0,this.value=value.map(function(item){return item instanceof EncoderBuffer||(item=new EncoderBuffer(item,reporter)),this.length+=item.length,item},this);else if(typeof value==`number`){if(!(0<=value&&value<=255))return reporter.error(`non-byte EncoderBuffer value`);this.value=value,this.length=1}else if(typeof value==`string`)this.value=value,this.length=Buffer.byteLength(value);else if(Buffer.isBuffer(value))this.value=value,this.length=value.length;else return reporter.error(`Unsupported type: `+typeof value)}exports$1.EncoderBuffer=EncoderBuffer,EncoderBuffer.prototype.join=function(out,offset$1){return out||=new Buffer(this.length),offset$1||=0,this.length===0||(Array.isArray(this.value)?this.value.forEach(function(item){item.join(out,offset$1),offset$1+=item.length}):(typeof this.value==`number`?out[offset$1]=this.value:typeof this.value==`string`?out.write(this.value,offset$1):Buffer.isBuffer(this.value)&&this.value.copy(out,offset$1),offset$1+=this.length)),out}},"./node_modules/asn1.js/lib/asn1/base/index.js":function(module$1,exports$1,__webpack_require__){var base=exports$1;base.Reporter=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/reporter.js`).Reporter,base.DecoderBuffer=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/buffer.js`).DecoderBuffer,base.EncoderBuffer=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/buffer.js`).EncoderBuffer,base.Node=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/node.js`)},"./node_modules/asn1.js/lib/asn1/base/node.js":function(module$1,exports$1,__webpack_require__){var Reporter=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/index.js`).Reporter,EncoderBuffer=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/index.js`).EncoderBuffer,DecoderBuffer=__webpack_require__(`./node_modules/asn1.js/lib/asn1/base/index.js`).DecoderBuffer,assert=__webpack_require__(`./node_modules/minimalistic-assert/index.js`),tags=`seq.seqof.set.setof.objid.bool.gentime.utctime.null_.enum.int.objDesc.bitstr.bmpstr.charstr.genstr.graphstr.ia5str.iso646str.numstr.octstr.printstr.t61str.unistr.utf8str.videostr`.split(`.`),methods=[`key`,`obj`,`use`,`optional`,`explicit`,`implicit`,`def`,`choice`,`any`,`contains`].concat(tags),overrided=[`_peekTag`,`_decodeTag`,`_use`,`_decodeStr`,`_decodeObjid`,`_decodeTime`,`_decodeNull`,`_decodeInt`,`_decodeBool`,`_decodeList`,`_encodeComposite`,`_encodeStr`,`_encodeObjid`,`_encodeTime`,`_encodeNull`,`_encodeInt`,`_encodeBool`];function Node(enc,parent){var state={};this._baseState=state,state.enc=enc,state.parent=parent||null,state.children=null,state.tag=null,state.args=null,state.reverseArgs=null,state.choice=null,state.optional=!1,state.any=!1,state.obj=!1,state.use=null,state.useDecoder=null,state.key=null,state.default=null,state.explicit=null,state.implicit=null,state.contains=null,state.parent||(state.children=[],this._wrap())}module$1.exports=Node;var stateProps=[`enc`,`parent`,`children`,`tag`,`args`,`reverseArgs`,`choice`,`optional`,`any`,`obj`,`use`,`alteredUse`,`key`,`default`,`explicit`,`implicit`,`contains`];Node.prototype.clone=function(){var state=this._baseState,cstate={};stateProps.forEach(function(prop){cstate[prop]=state[prop]});var res=new this.constructor(cstate.parent);return res._baseState=cstate,res},Node.prototype._wrap=function(){var state=this._baseState;methods.forEach(function(method){this[method]=function(){var clone=new this.constructor(this);return state.children.push(clone),clone[method].apply(clone,arguments)}},this)},Node.prototype._init=function(body){var state=this._baseState;assert(state.parent===null),body.call(this),state.children=state.children.filter(function(child){return child._baseState.parent===this},this),assert.equal(state.children.length,1,`Root node can have only one child`)},Node.prototype._useArgs=function(args){var state=this._baseState,children=args.filter(function(arg){return arg instanceof this.constructor},this);args=args.filter(function(arg){return!(arg instanceof this.constructor)},this),children.length!==0&&(assert(state.children===null),state.children=children,children.forEach(function(child){child._baseState.parent=this},this)),args.length!==0&&(assert(state.args===null),state.args=args,state.reverseArgs=args.map(function(arg){if(typeof arg!=`object`||arg.constructor!==Object)return arg;var res={};return Object.keys(arg).forEach(function(key){key==(key|0)&&(key|=0);var value=arg[key];res[value]=key}),res}))},overrided.forEach(function(method){Node.prototype[method]=function(){var state=this._baseState;throw Error(method+` not implemented for encoding: `+state.enc)}}),tags.forEach(function(tag){Node.prototype[tag]=function(){var state=this._baseState,args=Array.prototype.slice.call(arguments);return assert(state.tag===null),state.tag=tag,this._useArgs(args),this}}),Node.prototype.use=function(item){assert(item);var state=this._baseState;return assert(state.use===null),state.use=item,this},Node.prototype.optional=function(){var state=this._baseState;return state.optional=!0,this},Node.prototype.def=function(val){var state=this._baseState;return assert(state.default===null),state.default=val,state.optional=!0,this},Node.prototype.explicit=function(num){var state=this._baseState;return assert(state.explicit===null&&state.implicit===null),state.explicit=num,this},Node.prototype.implicit=function(num){var state=this._baseState;return assert(state.explicit===null&&state.implicit===null),state.implicit=num,this},Node.prototype.obj=function(){var state=this._baseState,args=Array.prototype.slice.call(arguments);return state.obj=!0,args.length!==0&&this._useArgs(args),this},Node.prototype.key=function(newKey){var state=this._baseState;return assert(state.key===null),state.key=newKey,this},Node.prototype.any=function(){var state=this._baseState;return state.any=!0,this},Node.prototype.choice=function(obj){var state=this._baseState;return assert(state.choice===null),state.choice=obj,this._useArgs(Object.keys(obj).map(function(key){return obj[key]})),this},Node.prototype.contains=function(item){var state=this._baseState;return assert(state.use===null),state.contains=item,this},Node.prototype._decode=function(input,options){var state=this._baseState;if(state.parent===null)return input.wrapResult(state.children[0]._decode(input,options));var result=state.default,present=!0,prevKey=null;if(state.key!==null&&(prevKey=input.enterKey(state.key)),state.optional){var tag=null;if(state.explicit===null?state.implicit===null?state.tag!==null&&(tag=state.tag):tag=state.implicit:tag=state.explicit,tag===null&&!state.any){var save=input.save();try{state.choice===null?this._decodeGeneric(state.tag,input,options):this._decodeChoice(input,options),present=!0}catch{present=!1}input.restore(save)}else if(present=this._peekTag(input,tag,state.any),input.isError(present))return present}var prevObj;if(state.obj&&present&&(prevObj=input.enterObject()),present){if(state.explicit!==null){var explicit=this._decodeTag(input,state.explicit);if(input.isError(explicit))return explicit;input=explicit}var start$1=input.offset;if(state.use===null&&state.choice===null){if(state.any)var save=input.save();var body=this._decodeTag(input,state.implicit===null?state.tag:state.implicit,state.any);if(input.isError(body))return body;state.any?result=input.raw(save):input=body}if(options&&options.track&&state.tag!==null&&options.track(input.path(),start$1,input.length,`tagged`),options&&options.track&&state.tag!==null&&options.track(input.path(),input.offset,input.length,`content`),result=state.any?result:state.choice===null?this._decodeGeneric(state.tag,input,options):this._decodeChoice(input,options),input.isError(result))return result;if(!state.any&&state.choice===null&&state.children!==null&&state.children.forEach(function(child){child._decode(input,options)}),state.contains&&(state.tag===`octstr`||state.tag===`bitstr`)){var data=new DecoderBuffer(result);result=this._getUse(state.contains,input._reporterState.obj)._decode(data,options)}}return state.obj&&present&&(result=input.leaveObject(prevObj)),state.key!==null&&(result!==null||present===!0)?input.leaveKey(prevKey,state.key,result):prevKey!==null&&input.exitKey(prevKey),result},Node.prototype._decodeGeneric=function(tag,input,options){var state=this._baseState;return tag===`seq`||tag===`set`?null:tag===`seqof`||tag===`setof`?this._decodeList(input,tag,state.args[0],options):/str$/.test(tag)?this._decodeStr(input,tag,options):tag===`objid`&&state.args?this._decodeObjid(input,state.args[0],state.args[1],options):tag===`objid`?this._decodeObjid(input,null,null,options):tag===`gentime`||tag===`utctime`?this._decodeTime(input,tag,options):tag===`null_`?this._decodeNull(input,options):tag===`bool`?this._decodeBool(input,options):tag===`objDesc`?this._decodeStr(input,tag,options):tag===`int`||tag===`enum`?this._decodeInt(input,state.args&&state.args[0],options):state.use===null?input.error(`unknown tag: `+tag):this._getUse(state.use,input._reporterState.obj)._decode(input,options)},Node.prototype._getUse=function(entity,obj){var state=this._baseState;return state.useDecoder=this._use(entity,obj),assert(state.useDecoder._baseState.parent===null),state.useDecoder=state.useDecoder._baseState.children[0],state.implicit!==state.useDecoder._baseState.implicit&&(state.useDecoder=state.useDecoder.clone(),state.useDecoder._baseState.implicit=state.implicit),state.useDecoder},Node.prototype._decodeChoice=function(input,options){var state=this._baseState,result=null,match=!1;return Object.keys(state.choice).some(function(key){var save=input.save(),node=state.choice[key];try{var value=node._decode(input,options);if(input.isError(value))return!1;result={type:key,value},match=!0}catch{return input.restore(save),!1}return!0},this),match?result:input.error(`Choice not matched`)},Node.prototype._createEncoderBuffer=function(data){return new EncoderBuffer(data,this.reporter)},Node.prototype._encode=function(data,reporter,parent){var state=this._baseState;if(!(state.default!==null&&state.default===data)){var result=this._encodeValue(data,reporter,parent);if(result!==void 0&&!this._skipDefault(result,reporter,parent))return result}},Node.prototype._encodeValue=function(data,reporter,parent){var state=this._baseState;if(state.parent===null)return state.children[0]._encode(data,reporter||new Reporter);var result=null;if(this.reporter=reporter,state.optional&&data===void 0)if(state.default!==null)data=state.default;else return;var content=null,primitive=!1;if(state.any)result=this._createEncoderBuffer(data);else if(state.choice)result=this._encodeChoice(data,reporter);else if(state.contains)content=this._getUse(state.contains,parent)._encode(data,reporter),primitive=!0;else if(state.children)content=state.children.map(function(child$1){if(child$1._baseState.tag===`null_`)return child$1._encode(null,reporter,data);if(child$1._baseState.key===null)return reporter.error(`Child should have a key`);var prevKey=reporter.enterKey(child$1._baseState.key);if(typeof data!=`object`)return reporter.error(`Child expected, but input is not object`);var res=child$1._encode(data[child$1._baseState.key],reporter,data);return reporter.leaveKey(prevKey),res},this).filter(function(child$1){return child$1}),content=this._createEncoderBuffer(content);else if(state.tag===`seqof`||state.tag===`setof`){if(!(state.args&&state.args.length===1))return reporter.error(`Too many args for : `+state.tag);if(!Array.isArray(data))return reporter.error(`seqof/setof, but data is not Array`);var child=this.clone();child._baseState.implicit=null,content=this._createEncoderBuffer(data.map(function(item){var state$1=this._baseState;return this._getUse(state$1.args[0],data)._encode(item,reporter)},child))}else state.use===null?(content=this._encodePrimitive(state.tag,data),primitive=!0):result=this._getUse(state.use,parent)._encode(data,reporter);var result;if(!state.any&&state.choice===null){var tag=state.implicit===null?state.tag:state.implicit,cls=state.implicit===null?`universal`:`context`;tag===null?state.use===null&&reporter.error(`Tag could be omitted only for .use()`):state.use===null&&(result=this._encodeComposite(tag,primitive,cls,content))}return state.explicit!==null&&(result=this._encodeComposite(state.explicit,!1,`context`,result)),result},Node.prototype._encodeChoice=function(data,reporter){var state=this._baseState,node=state.choice[data.type];return node||assert(!1,data.type+` not found in `+JSON.stringify(Object.keys(state.choice))),node._encode(data.value,reporter)},Node.prototype._encodePrimitive=function(tag,data){var state=this._baseState;if(/str$/.test(tag))return this._encodeStr(data,tag);if(tag===`objid`&&state.args)return this._encodeObjid(data,state.reverseArgs[0],state.args[1]);if(tag===`objid`)return this._encodeObjid(data,null,null);if(tag===`gentime`||tag===`utctime`)return this._encodeTime(data,tag);if(tag===`null_`)return this._encodeNull();if(tag===`int`||tag===`enum`)return this._encodeInt(data,state.args&&state.reverseArgs[0]);if(tag===`bool`)return this._encodeBool(data);if(tag===`objDesc`)return this._encodeStr(data,tag);throw Error(`Unsupported tag: `+tag)},Node.prototype._isNumstr=function(str){return/^[0-9 ]*$/.test(str)},Node.prototype._isPrintstr=function(str){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str)}},"./node_modules/asn1.js/lib/asn1/base/reporter.js":function(module$1,exports$1,__webpack_require__){var inherits=__webpack_require__(`./node_modules/inherits/inherits_browser.js`);function Reporter(options){this._reporterState={obj:null,path:[],options:options||{},errors:[]}}exports$1.Reporter=Reporter,Reporter.prototype.isError=function(obj){return obj instanceof ReporterError},Reporter.prototype.save=function(){var state=this._reporterState;return{obj:state.obj,pathLen:state.path.length}},Reporter.prototype.restore=function(data){var state=this._reporterState;state.obj=data.obj,state.path=state.path.slice(0,data.pathLen)},Reporter.prototype.enterKey=function(key){return this._reporterState.path.push(key)},Reporter.prototype.exitKey=function(index){var state=this._reporterState;state.path=state.path.slice(0,index-1)},Reporter.prototype.leaveKey=function(index,key,value){var state=this._reporterState;this.exitKey(index),state.obj!==null&&(state.obj[key]=value)},Reporter.prototype.path=function(){return this._reporterState.path.join(`/`)},Reporter.prototype.enterObject=function(){var state=this._reporterState,prev=state.obj;return state.obj={},prev},Reporter.prototype.leaveObject=function(prev){var state=this._reporterState,now=state.obj;return state.obj=prev,now},Reporter.prototype.error=function(msg){var err,state=this._reporterState,inherited=msg instanceof ReporterError;if(err=inherited?msg:new ReporterError(state.path.map(function(elem){return`[`+JSON.stringify(elem)+`]`}).join(``),msg.message||msg,msg.stack),!state.options.partial)throw err;return inherited||state.errors.push(err),err},Reporter.prototype.wrapResult=function(result){var state=this._reporterState;return state.options.partial?{result:this.isError(result)?null:result,errors:state.errors}:result};function ReporterError(path,msg){this.path=path,this.rethrow(msg)}inherits(ReporterError,Error),ReporterError.prototype.rethrow=function(msg){if(this.message=msg+` at: `+(this.path||`(shallow)`),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw Error(this.message)}catch(e$3){this.stack=e$3.stack}return this}},"./node_modules/asn1.js/lib/asn1/constants/der.js":function(module$1,exports$1,__webpack_require__){var constants=__webpack_require__(`./node_modules/asn1.js/lib/asn1/constants/index.js`);exports$1.tagClass={0:`universal`,1:`application`,2:`context`,3:`private`},exports$1.tagClassByName=constants._reverse(exports$1.tagClass),exports$1.tag={0:`end`,1:`bool`,2:`int`,3:`bitstr`,4:`octstr`,5:`null_`,6:`objid`,7:`objDesc`,8:`external`,9:`real`,10:`enum`,11:`embed`,12:`utf8str`,13:`relativeOid`,16:`seq`,17:`set`,18:`numstr`,19:`printstr`,20:`t61str`,21:`videostr`,22:`ia5str`,23:`utctime`,24:`gentime`,25:`graphstr`,26:`iso646str`,27:`genstr`,28:`unistr`,29:`charstr`,30:`bmpstr`},exports$1.tagByName=constants._reverse(exports$1.tag)},"./node_modules/asn1.js/lib/asn1/constants/index.js":function(module$1,exports$1,__webpack_require__){var constants=exports$1;constants._reverse=function(map){var res={};return Object.keys(map).forEach(function(key){(key|0)==key&&(key|=0);var value=map[key];res[value]=key}),res},constants.der=__webpack_require__(`./node_modules/asn1.js/lib/asn1/constants/der.js`)},"./node_modules/asn1.js/lib/asn1/decoders/der.js":function(module$1,exports$1,__webpack_require__){var inherits=__webpack_require__(`./node_modules/inherits/inherits_browser.js`),asn1=__webpack_require__(`./node_modules/asn1.js/lib/asn1.js`),base=asn1.base,bignum=asn1.bignum,der=asn1.constants.der;function DERDecoder(entity){this.enc=`der`,this.name=entity.name,this.entity=entity,this.tree=new DERNode,this.tree._init(entity.body)}module$1.exports=DERDecoder,DERDecoder.prototype.decode=function(data,options){return data instanceof base.DecoderBuffer||(data=new base.DecoderBuffer(data,options)),this.tree._decode(data,options)};function DERNode(parent){base.Node.call(this,`der`,parent)}inherits(DERNode,base.Node),DERNode.prototype._peekTag=function(buffer,tag,any){if(buffer.isEmpty())return!1;var state=buffer.save(),decodedTag=derDecodeTag(buffer,`Failed to peek tag: "`+tag+`"`);return buffer.isError(decodedTag)?decodedTag:(buffer.restore(state),decodedTag.tag===tag||decodedTag.tagStr===tag||decodedTag.tagStr+`of`===tag||any)},DERNode.prototype._decodeTag=function(buffer,tag,any){var decodedTag=derDecodeTag(buffer,`Failed to decode tag of "`+tag+`"`);if(buffer.isError(decodedTag))return decodedTag;var len=derDecodeLen(buffer,decodedTag.primitive,`Failed to get length of "`+tag+`"`);if(buffer.isError(len))return len;if(!any&&decodedTag.tag!==tag&&decodedTag.tagStr!==tag&&decodedTag.tagStr+`of`!==tag)return buffer.error(`Failed to match tag: "`+tag+`"`);if(decodedTag.primitive||len!==null)return buffer.skip(len,`Failed to match body of: "`+tag+`"`);var state=buffer.save(),res=this._skipUntilEnd(buffer,`Failed to skip indefinite length body: "`+this.tag+`"`);return buffer.isError(res)?res:(len=buffer.offset-state.offset,buffer.restore(state),buffer.skip(len,`Failed to match body of: "`+tag+`"`))},DERNode.prototype._skipUntilEnd=function(buffer,fail){for(;;){var tag=derDecodeTag(buffer,fail);if(buffer.isError(tag))return tag;var len=derDecodeLen(buffer,tag.primitive,fail);if(buffer.isError(len))return len;var res=tag.primitive||len!==null?buffer.skip(len):this._skipUntilEnd(buffer,fail);if(buffer.isError(res))return res;if(tag.tagStr===`end`)break}},DERNode.prototype._decodeList=function(buffer,tag,decoder,options){for(var result=[];!buffer.isEmpty();){var possibleEnd=this._peekTag(buffer,`end`);if(buffer.isError(possibleEnd))return possibleEnd;var res=decoder.decode(buffer,`der`,options);if(buffer.isError(res)&&possibleEnd)break;result.push(res)}return result},DERNode.prototype._decodeStr=function(buffer,tag){if(tag===`bitstr`){var unused=buffer.readUInt8();return buffer.isError(unused)?unused:{unused,data:buffer.raw()}}else if(tag===`bmpstr`){var raw=buffer.raw();if(raw.length%2==1)return buffer.error(`Decoding of string type: bmpstr length mismatch`);for(var str=``,i$3=0;i$3<raw.length/2;i$3++)str+=String.fromCharCode(raw.readUInt16BE(i$3*2));return str}else if(tag===`numstr`){var numstr=buffer.raw().toString(`ascii`);return this._isNumstr(numstr)?numstr:buffer.error(`Decoding of string type: numstr unsupported characters`)}else if(tag===`octstr`)return buffer.raw();else if(tag===`objDesc`)return buffer.raw();else if(tag===`printstr`){var printstr=buffer.raw().toString(`ascii`);return this._isPrintstr(printstr)?printstr:buffer.error(`Decoding of string type: printstr unsupported characters`)}else if(/str$/.test(tag))return buffer.raw().toString();else return buffer.error(`Decoding of string type: `+tag+` unsupported`)},DERNode.prototype._decodeObjid=function(buffer,values,relative){for(var result,identifiers=[],ident=0;!buffer.isEmpty();){var subident=buffer.readUInt8();ident<<=7,ident|=subident&127,subident&128||(identifiers.push(ident),ident=0)}subident&128&&identifiers.push(ident);var first=identifiers[0]/40|0,second=identifiers[0]%40;if(result=relative?identifiers:[first,second].concat(identifiers.slice(1)),values){var tmp=values[result.join(` `)];tmp===void 0&&(tmp=values[result.join(`.`)]),tmp!==void 0&&(result=tmp)}return result},DERNode.prototype._decodeTime=function(buffer,tag){var str=buffer.raw().toString();if(tag===`gentime`)var year=str.slice(0,4)|0,mon=str.slice(4,6)|0,day=str.slice(6,8)|0,hour=str.slice(8,10)|0,min$1=str.slice(10,12)|0,sec=str.slice(12,14)|0;else if(tag===`utctime`){var year=str.slice(0,2)|0,mon=str.slice(2,4)|0,day=str.slice(4,6)|0,hour=str.slice(6,8)|0,min$1=str.slice(8,10)|0,sec=str.slice(10,12)|0;year=year<70?2e3+year:1900+year}else return buffer.error(`Decoding `+tag+` time is not supported yet`);return Date.UTC(year,mon-1,day,hour,min$1,sec,0)},DERNode.prototype._decodeNull=function(buffer){return null},DERNode.prototype._decodeBool=function(buffer){var res=buffer.readUInt8();return buffer.isError(res)?res:res!==0},DERNode.prototype._decodeInt=function(buffer,values){var res=new bignum(buffer.raw());return values&&(res=values[res.toString(10)]||res),res},DERNode.prototype._use=function(entity,obj){return typeof entity==`function`&&(entity=entity(obj)),entity._getDecoder(`der`).tree};function derDecodeTag(buf,fail){var tag=buf.readUInt8(fail);if(buf.isError(tag))return tag;var cls=der.tagClass[tag>>6],primitive=(tag&32)==0;if((tag&31)==31){var oct=tag;for(tag=0;(oct&128)==128;){if(oct=buf.readUInt8(fail),buf.isError(oct))return oct;tag<<=7,tag|=oct&127}}else tag&=31;var tagStr=der.tag[tag];return{cls,primitive,tag,tagStr}}function derDecodeLen(buf,primitive,fail){var len=buf.readUInt8(fail);if(buf.isError(len))return len;if(!primitive&&len===128)return null;if(!(len&128))return len;var num=len&127;if(num>4)return buf.error(`length octect is too long`);len=0;for(var i$3=0;i$3<num;i$3++){len<<=8;var j=buf.readUInt8(fail);if(buf.isError(j))return j;len|=j}return len}},"./node_modules/asn1.js/lib/asn1/decoders/index.js":function(module$1,exports$1,__webpack_require__){var decoders=exports$1;decoders.der=__webpack_require__(`./node_modules/asn1.js/lib/asn1/decoders/der.js`),decoders.pem=__webpack_require__(`./node_modules/asn1.js/lib/asn1/decoders/pem.js`)},"./node_modules/asn1.js/lib/asn1/decoders/pem.js":function(module$1,exports$1,__webpack_require__){var inherits=__webpack_require__(`./node_modules/inherits/inherits_browser.js`),Buffer=__webpack_require__(`./node_modules/buffer/index.js`).Buffer,DERDecoder=__webpack_require__(`./node_modules/asn1.js/lib/asn1/decoders/der.js`);function PEMDecoder(entity){DERDecoder.call(this,entity),this.enc=`pem`}inherits(PEMDecoder,DERDecoder),module$1.exports=PEMDecoder,PEMDecoder.prototype.decode=function(data,options){for(var lines=data.toString().split(/[\r\n]+/g),label=options.label.toUpperCase(),re=/^-----(BEGIN|END) ([^-]+)-----$/,start$1=-1,end$1=-1,i$3=0;i$3<lines.length;i$3++){var match=lines[i$3].match(re);if(match!==null&&match[2]===label)if(start$1===-1){if(match[1]!==`BEGIN`)break;start$1=i$3}else{if(match[1]!==`END`)break;end$1=i$3;break}}if(start$1===-1||end$1===-1)throw Error(`PEM section not found for: `+label);var base64=lines.slice(start$1+1,end$1).join(``);base64.replace(/[^a-z0-9\+\/=]+/gi,``);var input=new Buffer(base64,`base64`);return DERDecoder.prototype.decode.call(this,input,options)}},"./node_modules/asn1.js/lib/asn1/encoders/der.js":function(module$1,exports$1,__webpack_require__){var inherits=__webpack_require__(`./node_modules/inherits/inherits_browser.js`),Buffer=__webpack_require__(`./node_modules/buffer/index.js`).Buffer,asn1=__webpack_require__(`./node_modules/asn1.js/lib/asn1.js`),base=asn1.base,der=asn1.constants.der;function DEREncoder(entity){this.enc=`der`,this.name=entity.name,this.entity=entity,this.tree=new DERNode,this.tree._init(entity.body)}module$1.exports=DEREncoder,DEREncoder.prototype.encode=function(data,reporter){return this.tree._encode(data,reporter).join()};function DERNode(parent){base.Node.call(this,`der`,parent)}inherits(DERNode,base.Node),DERNode.prototype._encodeComposite=function(tag,primitive,cls,content){var encodedTag=encodeTag(tag,primitive,cls,this.reporter);if(content.length<128){var header=new Buffer(2);return header[0]=encodedTag,header[1]=content.length,this._createEncoderBuffer([header,content])}for(var lenOctets=1,i$3=content.length;i$3>=256;i$3>>=8)lenOctets++;var header=new Buffer(2+lenOctets);header[0]=encodedTag,header[1]=128|lenOctets;for(var i$3=1+lenOctets,j=content.length;j>0;i$3--,j>>=8)header[i$3]=j&255;return this._createEncoderBuffer([header,content])},DERNode.prototype._encodeStr=function(str,tag){if(tag===`bitstr`)return this._createEncoderBuffer([str.unused|0,str.data]);if(tag===`bmpstr`){for(var buf=new Buffer(str.length*2),i$3=0;i$3<str.length;i$3++)buf.writeUInt16BE(str.charCodeAt(i$3),i$3*2);return this._createEncoderBuffer(buf)}else if(tag===`numstr`)return this._isNumstr(str)?this._createEncoderBuffer(str):this.reporter.error(`Encoding of string type: numstr supports only digits and space`);else if(tag===`printstr`)return this._isPrintstr(str)?this._createEncoderBuffer(str):this.reporter.error(`Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark`);else if(/str$/.test(tag))return this._createEncoderBuffer(str);else if(tag===`objDesc`)return this._createEncoderBuffer(str);else return this.reporter.error(`Encoding of string type: `+tag+` unsupported`)},DERNode.prototype._encodeObjid=function(id,values,relative){if(typeof id==`string`){if(!values)return this.reporter.error(`string objid given, but no values map found`);if(!values.hasOwnProperty(id))return this.reporter.error(`objid not found in values map`);id=values[id].split(/[\s\.]+/g);for(var i$3=0;i$3<id.length;i$3++)id[i$3]|=0}else if(Array.isArray(id)){id=id.slice();for(var i$3=0;i$3<id.length;i$3++)id[i$3]|=0}if(!Array.isArray(id))return this.reporter.error(`objid() should be either array or string, got: `+JSON.stringify(id));if(!relative){if(id[1]>=40)return this.reporter.error(`Second objid identifier OOB`);id.splice(0,2,id[0]*40+id[1])}for(var size=0,i$3=0;i$3<id.length;i$3++){var ident=id[i$3];for(size++;ident>=128;ident>>=7)size++}for(var objid=new Buffer(size),offset$1=objid.length-1,i$3=id.length-1;i$3>=0;i$3--){var ident=id[i$3];for(objid[offset$1--]=ident&127;(ident>>=7)>0;)objid[offset$1--]=128|ident&127}return this._createEncoderBuffer(objid)};function two(num){return num<10?`0`+num:num}DERNode.prototype._encodeTime=function(time,tag){var str,date=new Date(time);return tag===`gentime`?str=[two(date.getFullYear()),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),`Z`].join(``):tag===`utctime`?str=[two(date.getFullYear()%100),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),`Z`].join(``):this.reporter.error(`Encoding `+tag+` time is not supported yet`),this._encodeStr(str,`octstr`)},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer(``)},DERNode.prototype._encodeInt=function(num,values){if(typeof num==`string`){if(!values)return this.reporter.error(`String int or enum given, but no values map`);if(!values.hasOwnProperty(num))return this.reporter.error(`Values map doesn't contain: `+JSON.stringify(num));num=values[num]}if(typeof num!=`number`&&!Buffer.isBuffer(num)){var numArray=num.toArray();!num.sign&&numArray[0]&128&&numArray.unshift(0),num=new Buffer(numArray)}if(Buffer.isBuffer(num)){var size=num.length;num.length===0&&size++;var out=new Buffer(size);return num.copy(out),num.length===0&&(out[0]=0),this._createEncoderBuffer(out)}if(num<128)return this._createEncoderBuffer(num);if(num<256)return this._createEncoderBuffer([0,num]);for(var size=1,i$3=num;i$3>=256;i$3>>=8)size++;for(var out=Array(size),i$3=out.length-1;i$3>=0;i$3--)out[i$3]=num&255,num>>=8;return out[0]&128&&out.unshift(0),this._createEncoderBuffer(new Buffer(out))},DERNode.prototype._encodeBool=function(value){return this._createEncoderBuffer(value?255:0)},DERNode.prototype._use=function(entity,obj){return typeof entity==`function`&&(entity=entity(obj)),entity._getEncoder(`der`).tree},DERNode.prototype._skipDefault=function(dataBuffer,reporter,parent){var state=this._baseState,i$3;if(state.default===null)return!1;var data=dataBuffer.join();if(state.defaultBuffer===void 0&&(state.defaultBuffer=this._encodeValue(state.default,reporter,parent).join()),data.length!==state.defaultBuffer.length)return!1;for(i$3=0;i$3<data.length;i$3++)if(data[i$3]!==state.defaultBuffer[i$3])return!1;return!0};function encodeTag(tag,primitive,cls,reporter){var res;if(tag===`seqof`?tag=`seq`:tag===`setof`&&(tag=`set`),der.tagByName.hasOwnProperty(tag))res=der.tagByName[tag];else if(typeof tag==`number`&&(tag|0)===tag)res=tag;else return reporter.error(`Unknown tag: `+tag);return res>=31?reporter.error(`Multi-octet tag encoding unsupported`):(primitive||(res|=32),res|=der.tagClassByName[cls||`universal`]<<6,res)}},"./node_modules/asn1.js/lib/asn1/encoders/index.js":function(module$1,exports$1,__webpack_require__){var encoders=exports$1;encoders.der=__webpack_require__(`./node_modules/asn1.js/lib/asn1/encoders/der.js`),encoders.pem=__webpack_require__(`./node_modules/asn1.js/lib/asn1/encoders/pem.js`)},"./node_modules/asn1.js/lib/asn1/encoders/pem.js":function(module$1,exports$1,__webpack_require__){var inherits=__webpack_require__(`./node_modules/inherits/inherits_browser.js`),DEREncoder=__webpack_require__(`./node_modules/asn1.js/lib/asn1/encoders/der.js`);function PEMEncoder(entity){DEREncoder.call(this,entity),this.enc=`pem`}inherits(PEMEncoder,DEREncoder),module$1.exports=PEMEncoder,PEMEncoder.prototype.encode=function(data,options){for(var p$1=DEREncoder.prototype.encode.call(this,data).toString(`base64`),out=[`-----BEGIN `+options.label+`-----`],i$3=0;i$3<p$1.length;i$3+=64)out.push(p$1.slice(i$3,i$3+64));return out.push(`-----END `+options.label+`-----`),out.join(` `)}},"./node_modules/base64-js/index.js":function(module$1,exports$1,__webpack_require__){exports$1.byteLength=byteLength,exports$1.toByteArray=toByteArray,exports$1.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr=typeof Uint8Array<`u`?Uint8Array:Array,code=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,i$3=0,len=code.length;i$3<len;++i$3)lookup[i$3]=code[i$3],revLookup[code.charCodeAt(i$3)]=i$3;revLookup[45]=62,revLookup[95]=63;function getLens(b64){var len$1=b64.length;if(len$1%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var validLen=b64.indexOf(`=`);validLen===-1&&(validLen=len$1);var placeHoldersLen=validLen===len$1?0:4-validLen%4;return[validLen,placeHoldersLen]}function byteLength(b64){var lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp,lens=getLens(b64),validLen=lens[0],placeHoldersLen=lens[1],arr=new Arr(_byteLength(b64,validLen,placeHoldersLen)),curByte=0,len$1=placeHoldersLen>0?validLen-4:validLen,i$4;for(i$4=0;i$4<len$1;i$4+=4)tmp=revLookup[b64.charCodeAt(i$4)]<<18|revLookup[b64.charCodeAt(i$4+1)]<<12|revLookup[b64.charCodeAt(i$4+2)]<<6|revLookup[b64.charCodeAt(i$4+3)],arr[curByte++]=tmp>>16&255,arr[curByte++]=tmp>>8&255,arr[curByte++]=tmp&255;return placeHoldersLen===2&&(tmp=revLookup[b64.charCodeAt(i$4)]<<2|revLookup[b64.charCodeAt(i$4+1)]>>4,arr[curByte++]=tmp&255),placeHoldersLen===1&&(tmp=revLookup[b64.charCodeAt(i$4)]<<10|revLookup[b64.charCodeAt(i$4+1)]<<4|revLookup[b64.charCodeAt(i$4+2)]>>2,arr[curByte++]=tmp>>8&255,arr[curByte++]=tmp&255),arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start$1,end$1){for(var tmp,output=[],i$4=start$1;i$4<end$1;i$4+=3)tmp=(uint8[i$4]<<16&16711680)+(uint8[i$4+1]<<8&65280)+(uint8[i$4+2]&255),output.push(tripletToBase64(tmp));return output.join(``)}function fromByteArray(uint8){for(var tmp,len$1=uint8.length,extraBytes=len$1%3,parts=[],maxChunkLength=16383,i$4=0,len2=len$1-extraBytes;i$4<len2;i$4+=maxChunkLength)parts.push(encodeChunk(uint8,i$4,i$4+maxChunkLength>len2?len2:i$4+maxChunkLength));return extraBytes===1?(tmp=uint8[len$1-1],parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+`==`)):extraBytes===2&&(tmp=(uint8[len$1-2]<<8)+uint8[len$1-1],parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+`=`)),parts.join(``)}},"./node_modules/bn.js/lib/bn.js":function(module$1,exports$1,__webpack_require__){(function(module$2){(function(module$3,exports$2){function assert(val,msg){if(!val)throw Error(msg||`Assertion failed`)}function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number))return number;this.negative=0,this.words=null,this.length=0,this.red=null,number!==null&&((base===`le`||base===`be`)&&(endian=base,base=10),this._init(number||0,base||10,endian||`be`))}typeof module$3==`object`?module$3.exports=BN:exports$2.BN=BN,BN.BN=BN,BN.wordSize=26;var Buffer;try{Buffer=__webpack_require__(2).Buffer}catch{}BN.isBN=function(num){return num instanceof BN?!0:typeof num==`object`&&!!num&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)},BN.max=function(left$1,right$1){return left$1.cmp(right$1)>0?left$1:right$1},BN.min=function(left$1,right$1){return left$1.cmp(right$1)<0?left$1:right$1},BN.prototype._init=function(number,base,endian){if(typeof number==`number`)return this._initNumber(number,base,endian);if(typeof number==`object`)return this._initArray(number,base,endian);base===`hex`&&(base=16),assert(base===(base|0)&&base>=2&&base<=36),number=number.toString().replace(/\s+/g,``);var start$1=0;number[0]===`-`&&start$1++,base===16?this._parseHex(number,start$1):this._parseBase(number,base,start$1),number[0]===`-`&&(this.negative=1),this.strip(),endian===`le`&&this._initArray(this.toArray(),base,endian)},BN.prototype._initNumber=function(number,base,endian){number<0&&(this.negative=1,number=-number),number<67108864?(this.words=[number&67108863],this.length=1):number<4503599627370496?(this.words=[number&67108863,number/67108864&67108863],this.length=2):(assert(number<9007199254740992),this.words=[number&67108863,number/67108864&67108863,1],this.length=3),endian===`le`&&this._initArray(this.toArray(),base,endian)},BN.prototype._initArray=function(number,base,endian){if(assert(typeof number.length==`number`),number.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(number.length/3),this.words=Array(this.length);for(var i$3=0;i$3<this.length;i$3++)this.words[i$3]=0;var j,w,off=0;if(endian===`be`)for(i$3=number.length-1,j=0;i$3>=0;i$3-=3)w=number[i$3]|number[i$3-1]<<8|number[i$3-2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26&&(off-=26,j++);else if(endian===`le`)for(i$3=0,j=0;i$3<number.length;i$3+=3)w=number[i$3]|number[i$3+1]<<8|number[i$3+2]<<16,this.words[j]|=w<<off&67108863,this.words[j+1]=w>>>26-off&67108863,off+=24,off>=26&&(off-=26,j++);return this.strip()};function parseHex(str,start$1,end$1){for(var r$2=0,len=Math.min(str.length,end$1),i$3=start$1;i$3<len;i$3++){var c$1=str.charCodeAt(i$3)-48;r$2<<=4,c$1>=49&&c$1<=54?r$2|=c$1-49+10:c$1>=17&&c$1<=22?r$2|=c$1-17+10:r$2|=c$1&15}return r$2}BN.prototype._parseHex=function(number,start$1){this.length=Math.ceil((number.length-start$1)/6),this.words=Array(this.length);for(var i$3=0;i$3<this.length;i$3++)this.words[i$3]=0;var j,w,off=0;for(i$3=number.length-6,j=0;i$3>=start$1;i$3-=6)w=parseHex(number,i$3,i$3+6),this.words[j]|=w<<off&67108863,this.words[j+1]|=w>>>26-off&4194303,off+=24,off>=26&&(off-=26,j++);i$3+6!==start$1&&(w=parseHex(number,start$1,i$3+6),this.words[j]|=w<<off&67108863,this.words[j+1]|=w>>>26-off&4194303),this.strip()};function parseBase(str,start$1,end$1,mul){for(var r$2=0,len=Math.min(str.length,end$1),i$3=start$1;i$3<len;i$3++){var c$1=str.charCodeAt(i$3)-48;r$2*=mul,c$1>=49?r$2+=c$1-49+10:c$1>=17?r$2+=c$1-17+10:r$2+=c$1}return r$2}BN.prototype._parseBase=function(number,base,start$1){this.words=[0],this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base)limbLen++;limbLen--,limbPow=limbPow/base|0;for(var total=number.length-start$1,mod=total%limbLen,end$1=Math.min(total,total-mod)+start$1,word=0,i$3=start$1;i$3<end$1;i$3+=limbLen)word=parseBase(number,i$3,i$3+limbLen,base),this.imuln(limbPow),this.words[0]+word<67108864?this.words[0]+=word:this._iaddn(word);if(mod!==0){var pow=1;for(word=parseBase(number,i$3,number.length,base),i$3=0;i$3<mod;i$3++)pow*=base;this.imuln(pow),this.words[0]+word<67108864?this.words[0]+=word:this._iaddn(word)}},BN.prototype.copy=function(dest){dest.words=Array(this.length);for(var i$3=0;i$3<this.length;i$3++)dest.words[i$3]=this.words[i$3];dest.length=this.length,dest.negative=this.negative,dest.red=this.red},BN.prototype.clone=function(){var r$2=new BN(null);return this.copy(r$2),r$2},BN.prototype._expand=function(size){for(;this.length<size;)this.words[this.length++]=0;return this},BN.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},BN.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},BN.prototype.inspect=function(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`};var zeros=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`),groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function(base,padding){base||=10,padding=padding|0||1;var out;if(base===16||base===`hex`){out=``;for(var off=0,carry=0,i$3=0;i$3<this.length;i$3++){var w=this.words[i$3],word=((w<<off|carry)&16777215).toString(16);carry=w>>>24-off&16777215,out=carry!==0||i$3!==this.length-1?zeros[6-word.length]+word+out:word+out,off+=2,off>=26&&(off-=26,i$3--)}for(carry!==0&&(out=carry.toString(16)+out);out.length%padding!==0;)out=`0`+out;return this.negative!==0&&(out=`-`+out),out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base],groupBase=groupBases[base];out=``;var c$1=this.clone();for(c$1.negative=0;!c$1.isZero();){var r$2=c$1.modn(groupBase).toString(base);c$1=c$1.idivn(groupBase),out=c$1.isZero()?r$2+out:zeros[groupSize-r$2.length]+r$2+out}for(this.isZero()&&(out=`0`+out);out.length%padding!==0;)out=`0`+out;return this.negative!==0&&(out=`-`+out),out}assert(!1,`Base should be between 2 and 36`)},BN.prototype.toNumber=function(){var ret=this.words[0];return this.length===2?ret+=this.words[1]*67108864:this.length===3&&this.words[2]===1?ret+=4503599627370496+this.words[1]*67108864:this.length>2&&assert(!1,`Number can only safely store up to 53 bits`),this.negative===0?ret:-ret},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toBuffer=function(endian,length){return assert(Buffer!==void 0),this.toArrayLike(Buffer,endian,length)},BN.prototype.toArray=function(endian,length){return this.toArrayLike(Array,endian,length)},BN.prototype.toArrayLike=function(ArrayType,endian,length){var byteLength=this.byteLength(),reqLength=length||Math.max(1,byteLength);assert(byteLength<=reqLength,`byte array longer than desired length`),assert(reqLength>0,`Requested array length <= 0`),this.strip();var littleEndian=endian===`le`,res=new ArrayType(reqLength),b,i$3,q=this.clone();if(littleEndian){for(i$3=0;!q.isZero();i$3++)b=q.andln(255),q.iushrn(8),res[i$3]=b;for(;i$3<reqLength;i$3++)res[i$3]=0}else{for(i$3=0;i$3<reqLength-byteLength;i$3++)res[i$3]=0;for(i$3=0;!q.isZero();i$3++)b=q.andln(255),q.iushrn(8),res[reqLength-i$3-1]=b}return res},Math.clz32?BN.prototype._countBits=function(w){return 32-Math.clz32(w)}:BN.prototype._countBits=function(w){var t$2=w,r$2=0;return t$2>=4096&&(r$2+=13,t$2>>>=13),t$2>=64&&(r$2+=7,t$2>>>=7),t$2>=8&&(r$2+=4,t$2>>>=4),t$2>=2&&(r$2+=2,t$2>>>=2),r$2+t$2},BN.prototype._zeroBits=function(w){if(w===0)return 26;var t$2=w,r$2=0;return t$2&8191||(r$2+=13,t$2>>>=13),t$2&127||(r$2+=7,t$2>>>=7),t$2&15||(r$2+=4,t$2>>>=4),t$2&3||(r$2+=2,t$2>>>=2),t$2&1||r$2++,r$2},BN.prototype.bitLength=function(){var w=this.words[this.length-1],hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){for(var w=Array(num.bitLength()),bit=0;bit<w.length;bit++){var off=bit/26|0,wbit=bit%26;w[bit]=(num.words[off]&1<<wbit)>>>wbit}return w}BN.prototype.zeroBits=function(){if(this.isZero())return 0;for(var r$2=0,i$3=0;i$3<this.length;i$3++){var b=this._zeroBits(this.words[i$3]);if(r$2+=b,b!==26)break}return r$2},BN.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function(width){return this.negative===0?this.clone():this.abs().inotn(width).iaddn(1)},BN.prototype.fromTwos=function(width){return this.testn(width-1)?this.notn(width).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function(){return this.negative!==0},BN.prototype.