@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.
56 lines • 813 kB
JavaScript
/*!
* 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
* lit-html: BSD-3-Clause
* @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
* pdfjs-dist: Apache-2.0
* jszip: (MIT OR GPL-3.0-or-later)
* 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-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,t as __commonJSMin}from"./chunk.CW_MUgs7.js";import{A as ScopedElementsMixin,E as getSelect2CSS,F as asyncObjectForEach,G as A,K as E,M as Icon,N as getIconSVGURL,Q as humanFileSize,R as getAbsoluteURL,T as getRadioAndCheckboxCss,U as makeId,X as r$1,Y as i$1,Z as createInstance$2,b as getButtonCSS,c as LangMixin,d as e$1,f as e,g as AdapterLitElement,h as DBPLitElement,j as MiniSpinner,k as getThemeCSS,m as t,p as i,q as b,t as sendNotification,v as IconButton,w as getNotificationCSS,x as getGeneralCSS,z as getAssetURL}from"./dbp-lit-element.BQ5UQue-.js";import{i as r$2,r as p}from"./directive-helpers.BcbjX-8e.js";import{t as createInstance$3}from"./i18n.CFAuR9R5.js";import{c as getTabulatorStyles,s as TabulatorFull$1}from"./dbp-file-handling-lit-element.FiLZbGlJ.js";var require_pdfAnnotate=__commonJSMin((exports,module)=>{(function(a,u){typeof exports==`object`&&typeof module==`object`?module.exports=u():typeof define==`function`&&define.amd?define(`pdfAnnotate`,[],u):typeof exports==`object`?exports.pdfAnnotate=u():a.pdfAnnotate=u()})(window,function(){return function(a){var u={};function d(m){if(u[m])return u[m].exports;var g=u[m]={i:m,l:!1,exports:{}};return a[m].call(g.exports,g,g.exports,d),g.l=!0,g.exports}return d.m=a,d.c=u,d.d=function(a,u,m){d.o(a,u)||Object.defineProperty(a,u,{enumerable:!0,get:m})},d.r=function(a){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(a,`__esModule`,{value:!0})},d.t=function(a,u){if(u&1&&(a=d(a)),u&8||u&4&&typeof a==`object`&&a&&a.__esModule)return a;var m=Object.create(null);if(d.r(m),Object.defineProperty(m,`default`,{enumerable:!0,value:a}),u&2&&typeof a!=`string`)for(var g in a)d.d(m,g,function(u){return a[u]}.bind(null,g));return m},d.n=function(a){var u=a&&a.__esModule?function(){return a.default}:function(){return a};return d.d(u,`a`,u),u},d.o=function(a,u){return Object.prototype.hasOwnProperty.call(a,u)},d.p=``,d(d.s=`./src/index.ts`)}({"./node_modules/asn1.js/lib/asn1.js":function(a,u,d){var m=u;m.bignum=d(`./node_modules/bn.js/lib/bn.js`),m.define=d(`./node_modules/asn1.js/lib/asn1/api.js`).define,m.base=d(`./node_modules/asn1.js/lib/asn1/base/index.js`),m.constants=d(`./node_modules/asn1.js/lib/asn1/constants/index.js`),m.decoders=d(`./node_modules/asn1.js/lib/asn1/decoders/index.js`),m.encoders=d(`./node_modules/asn1.js/lib/asn1/encoders/index.js`)},"./node_modules/asn1.js/lib/asn1/api.js":function(a,u,d){var m=d(`./node_modules/asn1.js/lib/asn1.js`),g=d(`./node_modules/inherits/inherits_browser.js`),_=u;_.define=function(a,u){return new v(a,u)};function v(a,u){this.name=a,this.body=u,this.decoders={},this.encoders={}}v.prototype._createNamed=function(a){var u;try{u=d(`./node_modules/vm-browserify/index.js`).runInThisContext(`(function `+this.name+`(entity) {
this._initNamed(entity);
})`)}catch{u=function(a){this._initNamed(a)}}return g(u,a),u.prototype._initNamed=function(u){a.call(this,u)},new u(this)},v.prototype._getDecoder=function(a){return a||=`der`,this.decoders.hasOwnProperty(a)||(this.decoders[a]=this._createNamed(m.decoders[a])),this.decoders[a]},v.prototype.decode=function(a,u,d){return this._getDecoder(u).decode(a,d)},v.prototype._getEncoder=function(a){return a||=`der`,this.encoders.hasOwnProperty(a)||(this.encoders[a]=this._createNamed(m.encoders[a])),this.encoders[a]},v.prototype.encode=function(a,u,d){return this._getEncoder(u).encode(a,d)}},"./node_modules/asn1.js/lib/asn1/base/buffer.js":function(a,u,d){var m=d(`./node_modules/inherits/inherits_browser.js`),g=d(`./node_modules/asn1.js/lib/asn1/base/index.js`).Reporter,_=d(`./node_modules/buffer/index.js`).Buffer;function v(a,u){if(g.call(this,u),!_.isBuffer(a)){this.error(`Input not Buffer`);return}this.base=a,this.offset=0,this.length=a.length}m(v,g),u.DecoderBuffer=v,v.prototype.save=function(){return{offset:this.offset,reporter:g.prototype.save.call(this)}},v.prototype.restore=function(a){var u=new v(this.base);return u.offset=a.offset,u.length=this.offset,this.offset=a.offset,g.prototype.restore.call(this,a.reporter),u},v.prototype.isEmpty=function(){return this.offset===this.length},v.prototype.readUInt8=function(a){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(a||`DecoderBuffer overrun`)},v.prototype.skip=function(a,u){if(!(this.offset+a<=this.length))return this.error(u||`DecoderBuffer overrun`);var d=new v(this.base);return d._reporterState=this._reporterState,d.offset=this.offset,d.length=this.offset+a,this.offset+=a,d},v.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)};function y(a,u){if(Array.isArray(a))this.length=0,this.value=a.map(function(a){return a instanceof y||(a=new y(a,u)),this.length+=a.length,a},this);else if(typeof a==`number`){if(!(0<=a&&a<=255))return u.error(`non-byte EncoderBuffer value`);this.value=a,this.length=1}else if(typeof a==`string`)this.value=a,this.length=_.byteLength(a);else if(_.isBuffer(a))this.value=a,this.length=a.length;else return u.error(`Unsupported type: `+typeof a)}u.EncoderBuffer=y,y.prototype.join=function(a,u){return a||=new _(this.length),u||=0,this.length===0||(Array.isArray(this.value)?this.value.forEach(function(d){d.join(a,u),u+=d.length}):(typeof this.value==`number`?a[u]=this.value:typeof this.value==`string`?a.write(this.value,u):_.isBuffer(this.value)&&this.value.copy(a,u),u+=this.length)),a}},"./node_modules/asn1.js/lib/asn1/base/index.js":function(a,u,d){var m=u;m.Reporter=d(`./node_modules/asn1.js/lib/asn1/base/reporter.js`).Reporter,m.DecoderBuffer=d(`./node_modules/asn1.js/lib/asn1/base/buffer.js`).DecoderBuffer,m.EncoderBuffer=d(`./node_modules/asn1.js/lib/asn1/base/buffer.js`).EncoderBuffer,m.Node=d(`./node_modules/asn1.js/lib/asn1/base/node.js`)},"./node_modules/asn1.js/lib/asn1/base/node.js":function(a,u,d){var m=d(`./node_modules/asn1.js/lib/asn1/base/index.js`).Reporter,g=d(`./node_modules/asn1.js/lib/asn1/base/index.js`).EncoderBuffer,_=d(`./node_modules/asn1.js/lib/asn1/base/index.js`).DecoderBuffer,v=d(`./node_modules/minimalistic-assert/index.js`),y=`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(`.`),x=[`key`,`obj`,`use`,`optional`,`explicit`,`implicit`,`def`,`choice`,`any`,`contains`].concat(y),S=[`_peekTag`,`_decodeTag`,`_use`,`_decodeStr`,`_decodeObjid`,`_decodeTime`,`_decodeNull`,`_decodeInt`,`_decodeBool`,`_decodeList`,`_encodeComposite`,`_encodeStr`,`_encodeObjid`,`_encodeTime`,`_encodeNull`,`_encodeInt`,`_encodeBool`];function C(a,u){var d={};this._baseState=d,d.enc=a,d.parent=u||null,d.children=null,d.tag=null,d.args=null,d.reverseArgs=null,d.choice=null,d.optional=!1,d.any=!1,d.obj=!1,d.use=null,d.useDecoder=null,d.key=null,d.default=null,d.explicit=null,d.implicit=null,d.contains=null,d.parent||(d.children=[],this._wrap())}a.exports=C;var w=[`enc`,`parent`,`children`,`tag`,`args`,`reverseArgs`,`choice`,`optional`,`any`,`obj`,`use`,`alteredUse`,`key`,`default`,`explicit`,`implicit`,`contains`];C.prototype.clone=function(){var a=this._baseState,u={};w.forEach(function(d){u[d]=a[d]});var d=new this.constructor(u.parent);return d._baseState=u,d},C.prototype._wrap=function(){var a=this._baseState;x.forEach(function(u){this[u]=function(){var d=new this.constructor(this);return a.children.push(d),d[u].apply(d,arguments)}},this)},C.prototype._init=function(a){var u=this._baseState;v(u.parent===null),a.call(this),u.children=u.children.filter(function(a){return a._baseState.parent===this},this),v.equal(u.children.length,1,`Root node can have only one child`)},C.prototype._useArgs=function(a){var u=this._baseState,d=a.filter(function(a){return a instanceof this.constructor},this);a=a.filter(function(a){return!(a instanceof this.constructor)},this),d.length!==0&&(v(u.children===null),u.children=d,d.forEach(function(a){a._baseState.parent=this},this)),a.length!==0&&(v(u.args===null),u.args=a,u.reverseArgs=a.map(function(a){if(typeof a!=`object`||a.constructor!==Object)return a;var u={};return Object.keys(a).forEach(function(d){d==(d|0)&&(d|=0);var m=a[d];u[m]=d}),u}))},S.forEach(function(a){C.prototype[a]=function(){var u=this._baseState;throw Error(a+` not implemented for encoding: `+u.enc)}}),y.forEach(function(a){C.prototype[a]=function(){var u=this._baseState,d=Array.prototype.slice.call(arguments);return v(u.tag===null),u.tag=a,this._useArgs(d),this}}),C.prototype.use=function(a){v(a);var u=this._baseState;return v(u.use===null),u.use=a,this},C.prototype.optional=function(){var a=this._baseState;return a.optional=!0,this},C.prototype.def=function(a){var u=this._baseState;return v(u.default===null),u.default=a,u.optional=!0,this},C.prototype.explicit=function(a){var u=this._baseState;return v(u.explicit===null&&u.implicit===null),u.explicit=a,this},C.prototype.implicit=function(a){var u=this._baseState;return v(u.explicit===null&&u.implicit===null),u.implicit=a,this},C.prototype.obj=function(){var a=this._baseState,u=Array.prototype.slice.call(arguments);return a.obj=!0,u.length!==0&&this._useArgs(u),this},C.prototype.key=function(a){var u=this._baseState;return v(u.key===null),u.key=a,this},C.prototype.any=function(){var a=this._baseState;return a.any=!0,this},C.prototype.choice=function(a){var u=this._baseState;return v(u.choice===null),u.choice=a,this._useArgs(Object.keys(a).map(function(u){return a[u]})),this},C.prototype.contains=function(a){var u=this._baseState;return v(u.use===null),u.contains=a,this},C.prototype._decode=function(a,u){var d=this._baseState;if(d.parent===null)return a.wrapResult(d.children[0]._decode(a,u));var m=d.default,g=!0,v=null;if(d.key!==null&&(v=a.enterKey(d.key)),d.optional){var y=null;if(d.explicit===null?d.implicit===null?d.tag!==null&&(y=d.tag):y=d.implicit:y=d.explicit,y===null&&!d.any){var x=a.save();try{d.choice===null?this._decodeGeneric(d.tag,a,u):this._decodeChoice(a,u),g=!0}catch{g=!1}a.restore(x)}else if(g=this._peekTag(a,y,d.any),a.isError(g))return g}var S;if(d.obj&&g&&(S=a.enterObject()),g){if(d.explicit!==null){var C=this._decodeTag(a,d.explicit);if(a.isError(C))return C;a=C}var w=a.offset;if(d.use===null&&d.choice===null){if(d.any)var x=a.save();var T=this._decodeTag(a,d.implicit===null?d.tag:d.implicit,d.any);if(a.isError(T))return T;d.any?m=a.raw(x):a=T}if(u&&u.track&&d.tag!==null&&u.track(a.path(),w,a.length,`tagged`),u&&u.track&&d.tag!==null&&u.track(a.path(),a.offset,a.length,`content`),m=d.any?m:d.choice===null?this._decodeGeneric(d.tag,a,u):this._decodeChoice(a,u),a.isError(m))return m;if(!d.any&&d.choice===null&&d.children!==null&&d.children.forEach(function(d){d._decode(a,u)}),d.contains&&(d.tag===`octstr`||d.tag===`bitstr`)){var D=new _(m);m=this._getUse(d.contains,a._reporterState.obj)._decode(D,u)}}return d.obj&&g&&(m=a.leaveObject(S)),d.key!==null&&(m!==null||g===!0)?a.leaveKey(v,d.key,m):v!==null&&a.exitKey(v),m},C.prototype._decodeGeneric=function(a,u,d){var m=this._baseState;return a===`seq`||a===`set`?null:a===`seqof`||a===`setof`?this._decodeList(u,a,m.args[0],d):/str$/.test(a)?this._decodeStr(u,a,d):a===`objid`&&m.args?this._decodeObjid(u,m.args[0],m.args[1],d):a===`objid`?this._decodeObjid(u,null,null,d):a===`gentime`||a===`utctime`?this._decodeTime(u,a,d):a===`null_`?this._decodeNull(u,d):a===`bool`?this._decodeBool(u,d):a===`objDesc`?this._decodeStr(u,a,d):a===`int`||a===`enum`?this._decodeInt(u,m.args&&m.args[0],d):m.use===null?u.error(`unknown tag: `+a):this._getUse(m.use,u._reporterState.obj)._decode(u,d)},C.prototype._getUse=function(a,u){var d=this._baseState;return d.useDecoder=this._use(a,u),v(d.useDecoder._baseState.parent===null),d.useDecoder=d.useDecoder._baseState.children[0],d.implicit!==d.useDecoder._baseState.implicit&&(d.useDecoder=d.useDecoder.clone(),d.useDecoder._baseState.implicit=d.implicit),d.useDecoder},C.prototype._decodeChoice=function(a,u){var d=this._baseState,m=null,g=!1;return Object.keys(d.choice).some(function(_){var v=a.save(),y=d.choice[_];try{var x=y._decode(a,u);if(a.isError(x))return!1;m={type:_,value:x},g=!0}catch{return a.restore(v),!1}return!0},this),g?m:a.error(`Choice not matched`)},C.prototype._createEncoderBuffer=function(a){return new g(a,this.reporter)},C.prototype._encode=function(a,u,d){var m=this._baseState;if(!(m.default!==null&&m.default===a)){var g=this._encodeValue(a,u,d);if(g!==void 0&&!this._skipDefault(g,u,d))return g}},C.prototype._encodeValue=function(a,u,d){var g=this._baseState;if(g.parent===null)return g.children[0]._encode(a,u||new m);var _=null;if(this.reporter=u,g.optional&&a===void 0)if(g.default!==null)a=g.default;else return;var v=null,y=!1;if(g.any)_=this._createEncoderBuffer(a);else if(g.choice)_=this._encodeChoice(a,u);else if(g.contains)v=this._getUse(g.contains,d)._encode(a,u),y=!0;else if(g.children)v=g.children.map(function(d){if(d._baseState.tag===`null_`)return d._encode(null,u,a);if(d._baseState.key===null)return u.error(`Child should have a key`);var m=u.enterKey(d._baseState.key);if(typeof a!=`object`)return u.error(`Child expected, but input is not object`);var g=d._encode(a[d._baseState.key],u,a);return u.leaveKey(m),g},this).filter(function(a){return a}),v=this._createEncoderBuffer(v);else if(g.tag===`seqof`||g.tag===`setof`){if(!(g.args&&g.args.length===1))return u.error(`Too many args for : `+g.tag);if(!Array.isArray(a))return u.error(`seqof/setof, but data is not Array`);var x=this.clone();x._baseState.implicit=null,v=this._createEncoderBuffer(a.map(function(d){var m=this._baseState;return this._getUse(m.args[0],a)._encode(d,u)},x))}else g.use===null?(v=this._encodePrimitive(g.tag,a),y=!0):_=this._getUse(g.use,d)._encode(a,u);var _;if(!g.any&&g.choice===null){var S=g.implicit===null?g.tag:g.implicit,C=g.implicit===null?`universal`:`context`;S===null?g.use===null&&u.error(`Tag could be omitted only for .use()`):g.use===null&&(_=this._encodeComposite(S,y,C,v))}return g.explicit!==null&&(_=this._encodeComposite(g.explicit,!1,`context`,_)),_},C.prototype._encodeChoice=function(a,u){var d=this._baseState,m=d.choice[a.type];return m||v(!1,a.type+` not found in `+JSON.stringify(Object.keys(d.choice))),m._encode(a.value,u)},C.prototype._encodePrimitive=function(a,u){var d=this._baseState;if(/str$/.test(a))return this._encodeStr(u,a);if(a===`objid`&&d.args)return this._encodeObjid(u,d.reverseArgs[0],d.args[1]);if(a===`objid`)return this._encodeObjid(u,null,null);if(a===`gentime`||a===`utctime`)return this._encodeTime(u,a);if(a===`null_`)return this._encodeNull();if(a===`int`||a===`enum`)return this._encodeInt(u,d.args&&d.reverseArgs[0]);if(a===`bool`)return this._encodeBool(u);if(a===`objDesc`)return this._encodeStr(u,a);throw Error(`Unsupported tag: `+a)},C.prototype._isNumstr=function(a){return/^[0-9 ]*$/.test(a)},C.prototype._isPrintstr=function(a){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(a)}},"./node_modules/asn1.js/lib/asn1/base/reporter.js":function(a,u,d){var m=d(`./node_modules/inherits/inherits_browser.js`);function g(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}u.Reporter=g,g.prototype.isError=function(a){return a instanceof _},g.prototype.save=function(){var a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},g.prototype.restore=function(a){var u=this._reporterState;u.obj=a.obj,u.path=u.path.slice(0,a.pathLen)},g.prototype.enterKey=function(a){return this._reporterState.path.push(a)},g.prototype.exitKey=function(a){var u=this._reporterState;u.path=u.path.slice(0,a-1)},g.prototype.leaveKey=function(a,u,d){var m=this._reporterState;this.exitKey(a),m.obj!==null&&(m.obj[u]=d)},g.prototype.path=function(){return this._reporterState.path.join(`/`)},g.prototype.enterObject=function(){var a=this._reporterState,u=a.obj;return a.obj={},u},g.prototype.leaveObject=function(a){var u=this._reporterState,d=u.obj;return u.obj=a,d},g.prototype.error=function(a){var u,d=this._reporterState,m=a instanceof _;if(u=m?a:new _(d.path.map(function(a){return`[`+JSON.stringify(a)+`]`}).join(``),a.message||a,a.stack),!d.options.partial)throw u;return m||d.errors.push(u),u},g.prototype.wrapResult=function(a){var u=this._reporterState;return u.options.partial?{result:this.isError(a)?null:a,errors:u.errors}:a};function _(a,u){this.path=a,this.rethrow(u)}m(_,Error),_.prototype.rethrow=function(a){if(this.message=a+` at: `+(this.path||`(shallow)`),Error.captureStackTrace&&Error.captureStackTrace(this,_),!this.stack)try{throw Error(this.message)}catch(a){this.stack=a.stack}return this}},"./node_modules/asn1.js/lib/asn1/constants/der.js":function(a,u,d){var m=d(`./node_modules/asn1.js/lib/asn1/constants/index.js`);u.tagClass={0:`universal`,1:`application`,2:`context`,3:`private`},u.tagClassByName=m._reverse(u.tagClass),u.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`},u.tagByName=m._reverse(u.tag)},"./node_modules/asn1.js/lib/asn1/constants/index.js":function(a,u,d){var m=u;m._reverse=function(a){var u={};return Object.keys(a).forEach(function(d){(d|0)==d&&(d|=0);var m=a[d];u[m]=d}),u},m.der=d(`./node_modules/asn1.js/lib/asn1/constants/der.js`)},"./node_modules/asn1.js/lib/asn1/decoders/der.js":function(a,u,d){var m=d(`./node_modules/inherits/inherits_browser.js`),g=d(`./node_modules/asn1.js/lib/asn1.js`),_=g.base,v=g.bignum,y=g.constants.der;function x(a){this.enc=`der`,this.name=a.name,this.entity=a,this.tree=new S,this.tree._init(a.body)}a.exports=x,x.prototype.decode=function(a,u){return a instanceof _.DecoderBuffer||(a=new _.DecoderBuffer(a,u)),this.tree._decode(a,u)};function S(a){_.Node.call(this,`der`,a)}m(S,_.Node),S.prototype._peekTag=function(a,u,d){if(a.isEmpty())return!1;var m=a.save(),g=C(a,`Failed to peek tag: "`+u+`"`);return a.isError(g)?g:(a.restore(m),g.tag===u||g.tagStr===u||g.tagStr+`of`===u||d)},S.prototype._decodeTag=function(a,u,d){var m=C(a,`Failed to decode tag of "`+u+`"`);if(a.isError(m))return m;var g=w(a,m.primitive,`Failed to get length of "`+u+`"`);if(a.isError(g))return g;if(!d&&m.tag!==u&&m.tagStr!==u&&m.tagStr+`of`!==u)return a.error(`Failed to match tag: "`+u+`"`);if(m.primitive||g!==null)return a.skip(g,`Failed to match body of: "`+u+`"`);var _=a.save(),v=this._skipUntilEnd(a,`Failed to skip indefinite length body: "`+this.tag+`"`);return a.isError(v)?v:(g=a.offset-_.offset,a.restore(_),a.skip(g,`Failed to match body of: "`+u+`"`))},S.prototype._skipUntilEnd=function(a,u){for(;;){var d=C(a,u);if(a.isError(d))return d;var m=w(a,d.primitive,u);if(a.isError(m))return m;var g=d.primitive||m!==null?a.skip(m):this._skipUntilEnd(a,u);if(a.isError(g))return g;if(d.tagStr===`end`)break}},S.prototype._decodeList=function(a,u,d,m){for(var g=[];!a.isEmpty();){var _=this._peekTag(a,`end`);if(a.isError(_))return _;var v=d.decode(a,`der`,m);if(a.isError(v)&&_)break;g.push(v)}return g},S.prototype._decodeStr=function(a,u){if(u===`bitstr`){var d=a.readUInt8();return a.isError(d)?d:{unused:d,data:a.raw()}}else if(u===`bmpstr`){var m=a.raw();if(m.length%2==1)return a.error(`Decoding of string type: bmpstr length mismatch`);for(var g=``,_=0;_<m.length/2;_++)g+=String.fromCharCode(m.readUInt16BE(_*2));return g}else if(u===`numstr`){var v=a.raw().toString(`ascii`);return this._isNumstr(v)?v:a.error(`Decoding of string type: numstr unsupported characters`)}else if(u===`octstr`)return a.raw();else if(u===`objDesc`)return a.raw();else if(u===`printstr`){var y=a.raw().toString(`ascii`);return this._isPrintstr(y)?y:a.error(`Decoding of string type: printstr unsupported characters`)}else if(/str$/.test(u))return a.raw().toString();else return a.error(`Decoding of string type: `+u+` unsupported`)},S.prototype._decodeObjid=function(a,u,d){for(var m,g=[],_=0;!a.isEmpty();){var v=a.readUInt8();_<<=7,_|=v&127,v&128||(g.push(_),_=0)}v&128&&g.push(_);var y=g[0]/40|0,x=g[0]%40;if(m=d?g:[y,x].concat(g.slice(1)),u){var S=u[m.join(` `)];S===void 0&&(S=u[m.join(`.`)]),S!==void 0&&(m=S)}return m},S.prototype._decodeTime=function(a,u){var d=a.raw().toString();if(u===`gentime`)var m=d.slice(0,4)|0,g=d.slice(4,6)|0,_=d.slice(6,8)|0,v=d.slice(8,10)|0,y=d.slice(10,12)|0,x=d.slice(12,14)|0;else if(u===`utctime`){var m=d.slice(0,2)|0,g=d.slice(2,4)|0,_=d.slice(4,6)|0,v=d.slice(6,8)|0,y=d.slice(8,10)|0,x=d.slice(10,12)|0;m=m<70?2e3+m:1900+m}else return a.error(`Decoding `+u+` time is not supported yet`);return Date.UTC(m,g-1,_,v,y,x,0)},S.prototype._decodeNull=function(a){return null},S.prototype._decodeBool=function(a){var u=a.readUInt8();return a.isError(u)?u:u!==0},S.prototype._decodeInt=function(a,u){var d=new v(a.raw());return u&&(d=u[d.toString(10)]||d),d},S.prototype._use=function(a,u){return typeof a==`function`&&(a=a(u)),a._getDecoder(`der`).tree};function C(a,u){var d=a.readUInt8(u);if(a.isError(d))return d;var m=y.tagClass[d>>6],g=(d&32)==0;if((d&31)==31){var _=d;for(d=0;(_&128)==128;){if(_=a.readUInt8(u),a.isError(_))return _;d<<=7,d|=_&127}}else d&=31;var v=y.tag[d];return{cls:m,primitive:g,tag:d,tagStr:v}}function w(a,u,d){var m=a.readUInt8(d);if(a.isError(m))return m;if(!u&&m===128)return null;if(!(m&128))return m;var g=m&127;if(g>4)return a.error(`length octect is too long`);m=0;for(var _=0;_<g;_++){m<<=8;var v=a.readUInt8(d);if(a.isError(v))return v;m|=v}return m}},"./node_modules/asn1.js/lib/asn1/decoders/index.js":function(a,u,d){var m=u;m.der=d(`./node_modules/asn1.js/lib/asn1/decoders/der.js`),m.pem=d(`./node_modules/asn1.js/lib/asn1/decoders/pem.js`)},"./node_modules/asn1.js/lib/asn1/decoders/pem.js":function(a,u,d){var m=d(`./node_modules/inherits/inherits_browser.js`),g=d(`./node_modules/buffer/index.js`).Buffer,_=d(`./node_modules/asn1.js/lib/asn1/decoders/der.js`);function v(a){_.call(this,a),this.enc=`pem`}m(v,_),a.exports=v,v.prototype.decode=function(a,u){for(var d=a.toString().split(/[\r\n]+/g),m=u.label.toUpperCase(),v=/^-----(BEGIN|END) ([^-]+)-----$/,y=-1,x=-1,S=0;S<d.length;S++){var C=d[S].match(v);if(C!==null&&C[2]===m)if(y===-1){if(C[1]!==`BEGIN`)break;y=S}else{if(C[1]!==`END`)break;x=S;break}}if(y===-1||x===-1)throw Error(`PEM section not found for: `+m);var w=d.slice(y+1,x).join(``);w.replace(/[^a-z0-9\+\/=]+/gi,``);var T=new g(w,`base64`);return _.prototype.decode.call(this,T,u)}},"./node_modules/asn1.js/lib/asn1/encoders/der.js":function(a,u,d){var m=d(`./node_modules/inherits/inherits_browser.js`),g=d(`./node_modules/buffer/index.js`).Buffer,_=d(`./node_modules/asn1.js/lib/asn1.js`),v=_.base,y=_.constants.der;function x(a){this.enc=`der`,this.name=a.name,this.entity=a,this.tree=new S,this.tree._init(a.body)}a.exports=x,x.prototype.encode=function(a,u){return this.tree._encode(a,u).join()};function S(a){v.Node.call(this,`der`,a)}m(S,v.Node),S.prototype._encodeComposite=function(a,u,d,m){var _=w(a,u,d,this.reporter);if(m.length<128){var v=new g(2);return v[0]=_,v[1]=m.length,this._createEncoderBuffer([v,m])}for(var y=1,x=m.length;x>=256;x>>=8)y++;var v=new g(2+y);v[0]=_,v[1]=128|y;for(var x=1+y,S=m.length;S>0;x--,S>>=8)v[x]=S&255;return this._createEncoderBuffer([v,m])},S.prototype._encodeStr=function(a,u){if(u===`bitstr`)return this._createEncoderBuffer([a.unused|0,a.data]);if(u===`bmpstr`){for(var d=new g(a.length*2),m=0;m<a.length;m++)d.writeUInt16BE(a.charCodeAt(m),m*2);return this._createEncoderBuffer(d)}else if(u===`numstr`)return this._isNumstr(a)?this._createEncoderBuffer(a):this.reporter.error(`Encoding of string type: numstr supports only digits and space`);else if(u===`printstr`)return this._isPrintstr(a)?this._createEncoderBuffer(a):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(u))return this._createEncoderBuffer(a);else if(u===`objDesc`)return this._createEncoderBuffer(a);else return this.reporter.error(`Encoding of string type: `+u+` unsupported`)},S.prototype._encodeObjid=function(a,u,d){if(typeof a==`string`){if(!u)return this.reporter.error(`string objid given, but no values map found`);if(!u.hasOwnProperty(a))return this.reporter.error(`objid not found in values map`);a=u[a].split(/[\s\.]+/g);for(var m=0;m<a.length;m++)a[m]|=0}else if(Array.isArray(a)){a=a.slice();for(var m=0;m<a.length;m++)a[m]|=0}if(!Array.isArray(a))return this.reporter.error(`objid() should be either array or string, got: `+JSON.stringify(a));if(!d){if(a[1]>=40)return this.reporter.error(`Second objid identifier OOB`);a.splice(0,2,a[0]*40+a[1])}for(var _=0,m=0;m<a.length;m++){var v=a[m];for(_++;v>=128;v>>=7)_++}for(var y=new g(_),x=y.length-1,m=a.length-1;m>=0;m--){var v=a[m];for(y[x--]=v&127;(v>>=7)>0;)y[x--]=128|v&127}return this._createEncoderBuffer(y)};function C(a){return a<10?`0`+a:a}S.prototype._encodeTime=function(a,u){var d,m=new Date(a);return u===`gentime`?d=[C(m.getFullYear()),C(m.getUTCMonth()+1),C(m.getUTCDate()),C(m.getUTCHours()),C(m.getUTCMinutes()),C(m.getUTCSeconds()),`Z`].join(``):u===`utctime`?d=[C(m.getFullYear()%100),C(m.getUTCMonth()+1),C(m.getUTCDate()),C(m.getUTCHours()),C(m.getUTCMinutes()),C(m.getUTCSeconds()),`Z`].join(``):this.reporter.error(`Encoding `+u+` time is not supported yet`),this._encodeStr(d,`octstr`)},S.prototype._encodeNull=function(){return this._createEncoderBuffer(``)},S.prototype._encodeInt=function(a,u){if(typeof a==`string`){if(!u)return this.reporter.error(`String int or enum given, but no values map`);if(!u.hasOwnProperty(a))return this.reporter.error(`Values map doesn't contain: `+JSON.stringify(a));a=u[a]}if(typeof a!=`number`&&!g.isBuffer(a)){var d=a.toArray();!a.sign&&d[0]&128&&d.unshift(0),a=new g(d)}if(g.isBuffer(a)){var m=a.length;a.length===0&&m++;var _=new g(m);return a.copy(_),a.length===0&&(_[0]=0),this._createEncoderBuffer(_)}if(a<128)return this._createEncoderBuffer(a);if(a<256)return this._createEncoderBuffer([0,a]);for(var m=1,v=a;v>=256;v>>=8)m++;for(var _=Array(m),v=_.length-1;v>=0;v--)_[v]=a&255,a>>=8;return _[0]&128&&_.unshift(0),this._createEncoderBuffer(new g(_))},S.prototype._encodeBool=function(a){return this._createEncoderBuffer(a?255:0)},S.prototype._use=function(a,u){return typeof a==`function`&&(a=a(u)),a._getEncoder(`der`).tree},S.prototype._skipDefault=function(a,u,d){var m=this._baseState,g;if(m.default===null)return!1;var _=a.join();if(m.defaultBuffer===void 0&&(m.defaultBuffer=this._encodeValue(m.default,u,d).join()),_.length!==m.defaultBuffer.length)return!1;for(g=0;g<_.length;g++)if(_[g]!==m.defaultBuffer[g])return!1;return!0};function w(a,u,d,m){var g;if(a===`seqof`?a=`seq`:a===`setof`&&(a=`set`),y.tagByName.hasOwnProperty(a))g=y.tagByName[a];else if(typeof a==`number`&&(a|0)===a)g=a;else return m.error(`Unknown tag: `+a);return g>=31?m.error(`Multi-octet tag encoding unsupported`):(u||(g|=32),g|=y.tagClassByName[d||`universal`]<<6,g)}},"./node_modules/asn1.js/lib/asn1/encoders/index.js":function(a,u,d){var m=u;m.der=d(`./node_modules/asn1.js/lib/asn1/encoders/der.js`),m.pem=d(`./node_modules/asn1.js/lib/asn1/encoders/pem.js`)},"./node_modules/asn1.js/lib/asn1/encoders/pem.js":function(a,u,d){var m=d(`./node_modules/inherits/inherits_browser.js`),g=d(`./node_modules/asn1.js/lib/asn1/encoders/der.js`);function _(a){g.call(this,a),this.enc=`pem`}m(_,g),a.exports=_,_.prototype.encode=function(a,u){for(var d=g.prototype.encode.call(this,a).toString(`base64`),m=[`-----BEGIN `+u.label+`-----`],_=0;_<d.length;_+=64)m.push(d.slice(_,_+64));return m.push(`-----END `+u.label+`-----`),m.join(`
`)}},"./node_modules/base64-js/index.js":function(a,u,d){u.byteLength=C,u.toByteArray=T,u.fromByteArray=k;for(var m=[],g=[],_=typeof Uint8Array<`u`?Uint8Array:Array,v=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,y=0,x=v.length;y<x;++y)m[y]=v[y],g[v.charCodeAt(y)]=y;g[45]=62,g[95]=63;function S(a){var u=a.length;if(u%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var d=a.indexOf(`=`);d===-1&&(d=u);var m=d===u?0:4-d%4;return[d,m]}function C(a){var u=S(a),d=u[0],m=u[1];return(d+m)*3/4-m}function w(a,u,d){return(u+d)*3/4-d}function T(a){var u,d=S(a),m=d[0],v=d[1],y=new _(w(a,m,v)),x=0,C=v>0?m-4:m,T;for(T=0;T<C;T+=4)u=g[a.charCodeAt(T)]<<18|g[a.charCodeAt(T+1)]<<12|g[a.charCodeAt(T+2)]<<6|g[a.charCodeAt(T+3)],y[x++]=u>>16&255,y[x++]=u>>8&255,y[x++]=u&255;return v===2&&(u=g[a.charCodeAt(T)]<<2|g[a.charCodeAt(T+1)]>>4,y[x++]=u&255),v===1&&(u=g[a.charCodeAt(T)]<<10|g[a.charCodeAt(T+1)]<<4|g[a.charCodeAt(T+2)]>>2,y[x++]=u>>8&255,y[x++]=u&255),y}function D(a){return m[a>>18&63]+m[a>>12&63]+m[a>>6&63]+m[a&63]}function O(a,u,d){for(var m,g=[],_=u;_<d;_+=3)m=(a[_]<<16&16711680)+(a[_+1]<<8&65280)+(a[_+2]&255),g.push(D(m));return g.join(``)}function k(a){for(var u,d=a.length,g=d%3,_=[],v=16383,y=0,x=d-g;y<x;y+=v)_.push(O(a,y,y+v>x?x:y+v));return g===1?(u=a[d-1],_.push(m[u>>2]+m[u<<4&63]+`==`)):g===2&&(u=(a[d-2]<<8)+a[d-1],_.push(m[u>>10]+m[u>>4&63]+m[u<<2&63]+`=`)),_.join(``)}},"./node_modules/bn.js/lib/bn.js":function(a,u,d){(function(a){(function(a,u){function m(a,u){if(!a)throw Error(u||`Assertion failed`)}function g(a,u){a.super_=u;var d=function(){};d.prototype=u.prototype,a.prototype=new d,a.prototype.constructor=a}function _(a,u,d){if(_.isBN(a))return a;this.negative=0,this.words=null,this.length=0,this.red=null,a!==null&&((u===`le`||u===`be`)&&(d=u,u=10),this._init(a||0,u||10,d||`be`))}typeof a==`object`?a.exports=_:u.BN=_,_.BN=_,_.wordSize=26;var v;try{v=d(2).Buffer}catch{}_.isBN=function(a){return a instanceof _?!0:typeof a==`object`&&!!a&&a.constructor.wordSize===_.wordSize&&Array.isArray(a.words)},_.max=function(a,u){return a.cmp(u)>0?a:u},_.min=function(a,u){return a.cmp(u)<0?a:u},_.prototype._init=function(a,u,d){if(typeof a==`number`)return this._initNumber(a,u,d);if(typeof a==`object`)return this._initArray(a,u,d);u===`hex`&&(u=16),m(u===(u|0)&&u>=2&&u<=36),a=a.toString().replace(/\s+/g,``);var g=0;a[0]===`-`&&g++,u===16?this._parseHex(a,g):this._parseBase(a,u,g),a[0]===`-`&&(this.negative=1),this.strip(),d===`le`&&this._initArray(this.toArray(),u,d)},_.prototype._initNumber=function(a,u,d){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(m(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),d===`le`&&this._initArray(this.toArray(),u,d)},_.prototype._initArray=function(a,u,d){if(m(typeof a.length==`number`),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=Array(this.length);for(var g=0;g<this.length;g++)this.words[g]=0;var _,v,y=0;if(d===`be`)for(g=a.length-1,_=0;g>=0;g-=3)v=a[g]|a[g-1]<<8|a[g-2]<<16,this.words[_]|=v<<y&67108863,this.words[_+1]=v>>>26-y&67108863,y+=24,y>=26&&(y-=26,_++);else if(d===`le`)for(g=0,_=0;g<a.length;g+=3)v=a[g]|a[g+1]<<8|a[g+2]<<16,this.words[_]|=v<<y&67108863,this.words[_+1]=v>>>26-y&67108863,y+=24,y>=26&&(y-=26,_++);return this.strip()};function y(a,u,d){for(var m=0,g=Math.min(a.length,d),_=u;_<g;_++){var v=a.charCodeAt(_)-48;m<<=4,v>=49&&v<=54?m|=v-49+10:v>=17&&v<=22?m|=v-17+10:m|=v&15}return m}_.prototype._parseHex=function(a,u){this.length=Math.ceil((a.length-u)/6),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var m,g,_=0;for(d=a.length-6,m=0;d>=u;d-=6)g=y(a,d,d+6),this.words[m]|=g<<_&67108863,this.words[m+1]|=g>>>26-_&4194303,_+=24,_>=26&&(_-=26,m++);d+6!==u&&(g=y(a,u,d+6),this.words[m]|=g<<_&67108863,this.words[m+1]|=g>>>26-_&4194303),this.strip()};function x(a,u,d,m){for(var g=0,_=Math.min(a.length,d),v=u;v<_;v++){var y=a.charCodeAt(v)-48;g*=m,y>=49?g+=y-49+10:y>=17?g+=y-17+10:g+=y}return g}_.prototype._parseBase=function(a,u,d){this.words=[0],this.length=1;for(var m=0,g=1;g<=67108863;g*=u)m++;m--,g=g/u|0;for(var _=a.length-d,v=_%m,y=Math.min(_,_-v)+d,S=0,C=d;C<y;C+=m)S=x(a,C,C+m,u),this.imuln(g),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S);if(v!==0){var w=1;for(S=x(a,C,a.length,u),C=0;C<v;C++)w*=u;this.imuln(w),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S)}},_.prototype.copy=function(a){a.words=Array(this.length);for(var u=0;u<this.length;u++)a.words[u]=this.words[u];a.length=this.length,a.negative=this.negative,a.red=this.red},_.prototype.clone=function(){var a=new _(null);return this.copy(a),a},_.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},_.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},_.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},_.prototype.inspect=function(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`};var S=`.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(`.`),C=[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],w=[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];_.prototype.toString=function(a,u){a||=10,u=u|0||1;var d;if(a===16||a===`hex`){d=``;for(var g=0,_=0,v=0;v<this.length;v++){var y=this.words[v],x=((y<<g|_)&16777215).toString(16);_=y>>>24-g&16777215,d=_!==0||v!==this.length-1?S[6-x.length]+x+d:x+d,g+=2,g>=26&&(g-=26,v--)}for(_!==0&&(d=_.toString(16)+d);d.length%u!==0;)d=`0`+d;return this.negative!==0&&(d=`-`+d),d}if(a===(a|0)&&a>=2&&a<=36){var T=C[a],D=w[a];d=``;var O=this.clone();for(O.negative=0;!O.isZero();){var k=O.modn(D).toString(a);O=O.idivn(D),d=O.isZero()?k+d:S[T-k.length]+k+d}for(this.isZero()&&(d=`0`+d);d.length%u!==0;)d=`0`+d;return this.negative!==0&&(d=`-`+d),d}m(!1,`Base should be between 2 and 36`)},_.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&m(!1,`Number can only safely store up to 53 bits`),this.negative===0?a:-a},_.prototype.toJSON=function(){return this.toString(16)},_.prototype.toBuffer=function(a,u){return m(v!==void 0),this.toArrayLike(v,a,u)},_.prototype.toArray=function(a,u){return this.toArrayLike(Array,a,u)},_.prototype.toArrayLike=function(a,u,d){var g=this.byteLength(),_=d||Math.max(1,g);m(g<=_,`byte array longer than desired length`),m(_>0,`Requested array length <= 0`),this.strip();var v=u===`le`,y=new a(_),x,S,C=this.clone();if(v){for(S=0;!C.isZero();S++)x=C.andln(255),C.iushrn(8),y[S]=x;for(;S<_;S++)y[S]=0}else{for(S=0;S<_-g;S++)y[S]=0;for(S=0;!C.isZero();S++)x=C.andln(255),C.iushrn(8),y[_-S-1]=x}return y},Math.clz32?_.prototype._countBits=function(a){return 32-Math.clz32(a)}:_.prototype._countBits=function(a){var u=a,d=0;return u>=4096&&(d+=13,u>>>=13),u>=64&&(d+=7,u>>>=7),u>=8&&(d+=4,u>>>=4),u>=2&&(d+=2,u>>>=2),d+u},_.prototype._zeroBits=function(a){if(a===0)return 26;var u=a,d=0;return u&8191||(d+=13,u>>>=13),u&127||(d+=7,u>>>=7),u&15||(d+=4,u>>>=4),u&3||(d+=2,u>>>=2),u&1||d++,d},_.prototype.bitLength=function(){var a=this.words[this.length-1],u=this._countBits(a);return(this.length-1)*26+u};function T(a){for(var u=Array(a.bitLength()),d=0;d<u.length;d++){var m=d/26|0,g=d%26;u[d]=(a.words[m]&1<<g)>>>g}return u}_.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,u=0;u<this.length;u++){var d=this._zeroBits(this.words[u]);if(a+=d,d!==26)break}return a},_.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},_.prototype.toTwos=function(a){return this.negative===0?this.clone():this.abs().inotn(a).iaddn(1)},_.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},_.prototype.isNeg=function(){return this.negative!==0},_.prototype.neg=function(){return this.clone().ineg()},_.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},_.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var u=0;u<a.length;u++)this.words[u]=this.words[u]|a.words[u];return this.strip()},_.prototype.ior=function(a){return m((this.negative|a.negative)===0),this.iuor(a)},_.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},_.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},_.prototype.iuand=function(a){for(var u=this.length>a.length?a:this,d=0;d<u.length;d++)this.words[d]=this.words[d]&a.words[d];return this.length=u.length,this.strip()},_.prototype.iand=function(a){return m((this.negative|a.negative)===0),this.iuand(a)},_.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},_.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},_.prototype.iuxor=function(a){var u,d;this.length>a.length?(u=this,d=a):(u=a,d=this);for(var m=0;m<d.length;m++)this.words[m]=u.words[m]^d.words[m];if(this!==u)for(;m<u.length;m++)this.words[m]=u.words[m];return this.length=u.length,this.strip()},_.prototype.ixor=function(a){return m((this.negative|a.negative)===0),this.iuxor(a)},_.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},_.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},_.prototype.inotn=function(a){m(typeof a==`number`&&a>=0);var u=Math.ceil(a/26)|0,d=a%26;this._expand(u),d>0&&u--;for(var g=0;g<u;g++)this.words[g]=~this.words[g]&67108863;return d>0&&(this.words[g]=~this.words[g]&67108863>>26-d),this.strip()},_.prototype.notn=function(a){return this.clone().inotn(a)},_.prototype.setn=function(a,u){m(typeof a==`number`&&a>=0);var d=a/26|0,g=a%26;return this._expand(d+1),u?this.words[d]=this.words[d]|1<<g:this.words[d]=this.words[d]&~(1<<g),this.strip()},_.prototype.iadd=function(a){var u;if(this.negative!==0&&a.negative===0)return this.negative=0,u=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,u=this.isub(a),a.negative=1,u._normSign();var d,m;this.length>a.length?(d=this,m=a):(d=a,m=this);for(var g=0,_=0;_<m.length;_++)u=(d.words[_]|0)+(m.words[_]|0)+g,this.words[_]=u&67108863,g=u>>>26;for(;g!==0&&_<d.length;_++)u=(d.words[_]|0)+g,this.words[_]=u&67108863,g=u>>>26;if(this.length=d.length,g!==0)this.words[this.length]=g,this.length++;else if(d!==this)for(;_<d.length;_++)this.words[_]=d.words[_];return this},_.prototype.add=function(a){var u;return a.negative!==0&&this.negative===0?(a.negative=0,u=this.sub(a),a.negative^=1,u):a.negative===0&&this.negative!==0?(this.negative=0,u=a.sub(this),this.negative=1,u):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},_.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var u=this.iadd(a);return a.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var d=this.cmp(a);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,g;d>0?(m=this,g=a):(m=a,g=this);for(var _=0,v=0;v<g.length;v++)u=(m.words[v]|0)-(g.words[v]|0)+_,_=u>>26,this.words[v]=u&67108863;for(;_!==0&&v<m.length;v++)u=(m.words[v]|0)+_,_=u>>26,this.words[v]=u&67108863;if(_===0&&v<m.length&&m!==this)for(;v<m.length;v++)this.words[v]=m.words[v];return this.length=Math.max(this.length,v),m!==this&&(this.negative=1),this.strip()},_.prototype.sub=function(a){return this.clone().isub(a)};function D(a,u,d){d.negative=u.negative^a.negative;var m=a.length+u.length|0;d.length=m,m=m-1|0;var g=a.words[0]|0,_=u.words[0]|0,v=g*_,y=v&67108863,x=v/67108864|0;d.words[0]=y;for(var S=1;S<m;S++){for(var C=x>>>26,w=x&67108863,T=Math.min(S,u.length-1),D=Math.max(0,S-a.length+1);D<=T;D++){var O=S-D|0;g=a.words[O]|0,_=u.words[D]|0,v=g*_+w,C+=v/67108864|0,w=v&67108863}d.words[S]=w|0,x=C|0}return x===0?d.length--:d.words[S]=x|0,d.strip()}var O=function(a,u,d){var m=a.words,g=u.words,_=d.words,v=0,y,x,S,C=m[0]|0,w=C&8191,T=C>>>13,D=m[1]|0,O=D&8191,k=D>>>13,j=m[2]|0,M=j&8191,N=j>>>13,P=m[3]|0,F=P&8191,I=P>>>13,L=m[4]|0,R=L&8191,z=L>>>13,B=m[5]|0,V=B&8191,H=B>>>13,U=m[6]|0,W=U&8191,G=U>>>13,ee=m[7]|0,te=ee&8191,ne=ee>>>13,K=m[8]|0,re=K&8191,ie=K>>>13,ae=m[9]|0,oe=ae&8191,se=ae>>>13,ce=g[0]|0,le=ce&8191,ue=ce>>>13,de=g[1]|0,fe=de&8191,pe=de>>>13,me=g[2]|0,he=me&8191,ge=me>>>13,_e=g[3]|0,ve=_e&8191,ye=_e>>>13,be=g[4]|0,xe=be&8191,q=be>>>13,Se=g[5]|0,Ce=Se&8191,we=Se>>>13,Te=g[6]|0,J=Te&8191,Y=Te>>>13,X=g[7]|0,Z=X&8191,Ee=X>>>13,De=g[8]|0,Q=De&8191,Oe=De>>>13,ke=g[9]|0,Ae=ke&8191,je=ke>>>13;d.negative=a.negative^u.negative,d.length=19,y=Math.imul(w,le),x=Math.imul(w,ue),x=x+Math.imul(T,le)|0,S=Math.imul(T,ue);var Me=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Me>>>26)|0,Me&=67108863,y=Math.imul(O,le),x=Math.imul(O,ue),x=x+Math.imul(k,le)|0,S=Math.imul(k,ue),y=y+Math.imul(w,fe)|0,x=x+Math.imul(w,pe)|0,x=x+Math.imul(T,fe)|0,S=S+Math.imul(T,pe)|0;var Ne=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,y=Math.imul(M,le),x=Math.imul(M,ue),x=x+Math.imul(N,le)|0,S=Math.imul(N,ue),y=y+Math.imul(O,fe)|0,x=x+Math.imul(O,pe)|0,x=x+Math.imul(k,fe)|0,S=S+Math.imul(k,pe)|0,y=y+Math.imul(w,he)|0,x=x+Math.imul(w,ge)|0,x=x+Math.imul(T,he)|0,S=S+Math.imul(T,ge)|0;var Pe=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,y=Math.imul(F,le),x=Math.imul(F,ue),x=x+Math.imul(I,le)|0,S=Math.imul(I,ue),y=y+Math.imul(M,fe)|0,x=x+Math.imul(M,pe)|0,x=x+Math.imul(N,fe)|0,S=S+Math.imul(N,pe)|0,y=y+Math.imul(O,he)|0,x=x+Math.imul(O,ge)|0,x=x+Math.imul(k,he)|0,S=S+Math.imul(k,ge)|0,y=y+Math.imul(w,ve)|0,x=x+Math.imul(w,ye)|0,x=x+Math.imul(T,ve)|0,S=S+Math.imul(T,ye)|0;var Fe=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,y=Math.imul(R,le),x=Math.imul(R,ue),x=x+Math.imul(z,le)|0,S=Math.imul(z,ue),y=y+Math.imul(F,fe)|0,x=x+Math.imul(F,pe)|0,x=x+Math.imul(I,fe)|0,S=S+Math.imul(I,pe)|0,y=y+Math.imul(M,he)|0,x=x+Math.imul(M,ge)|0,x=x+Math.imul(N,he)|0,S=S+Math.imul(N,ge)|0,y=y+Math.imul(O,ve)|0,x=x+Math.imul(O,ye)|0,x=x+Math.imul(k,ve)|0,S=S+Math.imul(k,ye)|0,y=y+Math.imul(w,xe)|0,x=x+Math.imul(w,q)|0,x=x+Math.imul(T,xe)|0,S=S+Math.imul(T,q)|0;var Ie=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,y=Math.imul(V,le),x=Math.imul(V,ue),x=x+Math.imul(H,le)|0,S=Math.imul(H,ue),y=y+Math.imul(R,fe)|0,x=x+Math.imul(R,pe)|0,x=x+Math.imul(z,fe)|0,S=S+Math.imul(z,pe)|0,y=y+Math.imul(F,he)|0,x=x+Math.imul(F,ge)|0,x=x+Math.imul(I,he)|0,S=S+Math.imul(I,ge)|0,y=y+Math.imul(M,ve)|0,x=x+Math.imul(M,ye)|0,x=x+Math.imul(N,ve)|0,S=S+Math.imul(N,ye)|0,y=y+Math.imul(O,xe)|0,x=x+Math.imul(O,q)|0,x=x+Math.imul(k,xe)|0,S=S+Math.imul(k,q)|0,y=y+Math.imul(w,Ce)|0,x=x+Math.imul(w,we)|0,x=x+Math.imul(T,Ce)|0,S=S+Math.imul(T,we)|0;var Le=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Le>>>26)|0,Le&=67108863,y=Math.imul(W,le),x=Math.imul(W,ue),x=x+Math.imul(G,le)|0,S=Math.imul(G,ue),y=y+Math.imul(V,fe)|0,x=x+Math.imul(V,pe)|0,x=x+Math.imul(H,fe)|0,S=S+Math.imul(H,pe)|0,y=y+Math.imul(R,he)|0,x=x+Math.imul(R,ge)|0,x=x+Math.imul(z,he)|0,S=S+Math.imul(z,ge)|0,y=y+Math.imul(F,ve)|0,x=x+Math.imul(F,ye)|0,x=x+Math.imul(I,ve)|0,S=S+Math.imul(I,ye)|0,y=y+Math.imul(M,xe)|0,x=x+Math.imul(M,q)|0,x=x+Math.imul(N,xe)|0,S=S+Math.imul(N,q)|0,y=y+Math.imul(O,Ce)|0,x=x+Math.imul(O,we)|0,x=x+Math.imul(k,Ce)|0,S=S+Math.imul(k,we)|0,y=y+Math.imul(w,J)|0,x=x+Math.imul(w,Y)|0,x=x+Math.imul(T,J)|0,S=S+Math.imul(T,Y)|0;var Re=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Re>>>26)|0,Re&=67108863,y=Math.imul(te,le),x=Math.imul(te,ue),x=x+Math.imul(ne,le)|0,S=Math.imul(ne,ue),y=y+Math.imul(W,fe)|0,x=x+Math.imul(W,pe)|0,x=x+Math.imul(G,fe)|0,S=S+Math.imul(G,pe)|0,y=y+Math.imul(V,he)|0,x=x+Math.imul(V,ge)|0,x=x+Math.imul(H,he)|0,S=S+Math.imul(H,ge)|0,y=y+Math.imul(R,ve)|0,x=x+Math.imul(R,ye)|0,x=x+Math.imul(z,ve)|0,S=S+Math.imul(z,ye)|0,y=y+Math.imul(F,xe)|0,x=x+Math.imul(F,q)|0,x=x+Math.imul(I,xe)|0,S=S+Math.imul(I,q)|0,y=y+Math.imul(M,Ce)|0,x=x+Math.imul(M,we)|0,x=x+Math.imul(N,Ce)|0,S=S+Math.imul(N,we)|0,y=y+Math.imul(O,J)|0,x=x+Math.imul(O,Y)|0,x=x+Math.imul(k,J)|0,S=S+Math.imul(k,Y)|0,y=y+Math.imul(w,Z)|0,x=x+Math.imul(w,Ee)|0,x=x+Math.imul(T,Z)|0,S=S+Math.imul(T,Ee)|0;var ze=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(ze>>>26)|0,ze&=67108863,y=Math.imul(re,le),x=Math.imul(re,ue),x=x+Math.imul(ie,le)|0,S=Math.imul(ie,ue),y=y+Math.imul(te,fe)|0,x=x+Math.imul(te,pe)|0,x=x+Math.imul(ne,fe)|0,S=S+Math.imul(ne,pe)|0,y=y+Math.imul(W,he)|0,x=x+Math.imul(W,ge)|0,x=x+Math.imul(G,he)|0,S=S+Math.imul(G,ge)|0,y=y+Math.imul(V,ve)|0,x=x+Math.imul(V,ye)|0,x=x+Math.imul(H,ve)|0,S=S+Math.imul(H,ye)|0,y=y+Math.imul(R,xe)|0,x=x+Math.imul(R,q)|0,x=x+Math.imul(z,xe)|0,S=S+Math.imul(z,q)|0,y=y+Math.imul(F,Ce)|0,x=x+Math.imul(F,we)|0,x=x+Math.imul(I,Ce)|0,S=S+Math.imul(I,we)|0,y=y+Math.imul(M,J)|0,x=x+Math.imul(M,Y)|0,x=x+Math.imul(N,J)|0,S=S+Math.imul(N,Y)|0,y=y+Math.imul(O,Z)|0,x=x+Math.imul(O,Ee)|0,x=x+Math.imul(k,Z)|0,S=S+Math.imul(k,Ee)|0,y=y+Math.imul(w,Q)|0,x=x+Math.imul(w,Oe)|0,x=x+Math.imul(T,Q)|0,S=S+Math.imul(T,Oe)|0;var Be=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Be>>>26)|0,Be&=67108863,y=Math.imul(oe,le),x=Math.imul(oe,ue),x=x+Math.imul(se,le)|0,S=Math.imul(se,ue),y=y+Math.imul(re,fe)|0,x=x+Math.imul(re,pe)|0,x=x+Math.imul(ie,fe)|0,S=S+Math.imul(ie,pe)|0,y=y+Math.imul(te,he)|0,x=x+Math.imul(te,ge)|0,x=x+Math.imul(ne,he)|0,S=S+Math.imul(ne,ge)|0,y=y+Math.imul(W,ve)|0,x=x+Math.imul(W,ye)|0,x=x+Math.imul(G,ve)|0,S=S+Math.imul(G,ye)|0,y=y+Math.imul(V,xe)|0,x=x+Math.imul(V,q)|0,x=x+Math.imul(H,xe)|0,S=S+Math.imul(H,q)|0,y=y+Math.imul(R,Ce)|0,x=x+Math.imul(R,we)|0,x=x+Math.imul(z,Ce)|0,S=S+Math.imul(z,we)|0,y=y+Math.imul(F,J)|0,x=x+Math.imul(F,Y)|0,x=x+Math.imul(I,J)|0,S=S+Math.imul(I,Y)|0,y=y+Math.imul(M,Z)|0,x=x+Math.imul(M,Ee)|0,x=x+Math.imul(N,Z)|0,S=S+Math.imul(N,Ee)|0,y=y+Math.imul(O,Q)|0,x=x+Math.imul(O,Oe)|0,x=x+Math.imul(k,Q)|0,S=S+Math.imul(k,Oe)|0,y=y+Math.imul(w,Ae)|0,x=x+Math.imul(w,je)|0,x=x+Math.imul(T,Ae)|0,S=S+Math.imul(T,je)|0;var Ve=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,y=Math.imul(oe,fe),x=Math.imul(oe,pe),x=x+Math.imul(se,fe)|0,S=Math.imul(se,pe),y=y+Math.imul(re,he)|0,x=x+Math.imul(re,ge)|0,x=x+Math.imul(ie,he)|0,S=S+Math.imul(ie,ge)|0,y=y+Math.imul(te,ve)|0,x=x+Math.imul(te,ye)|0,x=x+Math.imul(ne,ve)|0,S=S+Math.imul(ne,ye)|0,y=y+Math.imul(W,xe)|0,x=x+Math.imul(W,q)|0,x=x+Math.imul(G,xe)|0,S=S+Math.imul(G,q)|0,y=y+Math.imul(V,Ce)|0,x=x+Math.imul(V,we)|0,x=x+Math.imul(H,Ce)|0,S=S+Math.imul(H,we)|0,y=y+Math.imul(R,J)|0,x=x+Math.imul(R,Y)|0,x=x+Math.imul(z,J)|0,S=S+Math.imul(z,Y)|0,y=y+Math.imul(F,Z)|0,x=x+Math.imul(F,Ee)|0,x=x+Math.imul(I,Z)|0,S=S+Math.imul(I,Ee)|0,y=y+Math.imul(M,Q)|0,x=x+Math.imul(M,Oe)|0,x=x+Math.imul(N,Q)|0,S=S+Math.imul(N,Oe)|0,y=y+Math.imul(O,Ae)|0,x=x+Math.imul(O,je)|0,x=x+Math.imul(k,Ae)|0,S=S+Math.imul(k,je)|0;var He=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(He>>>26)|0,He&=67108863,y=Math.imul(oe,he),x=Math.imul(oe,ge),x=x+Math.imul(se,he)|0,S=Math.imul(se,ge),y=y+Math.imul(re,ve)|0,x=x+Math.imul(re,ye)|0,x=x+Math.imul(ie,ve)|0,S=S+Math.imul(ie,ye)|0,y=y+Math.imul(te,xe)|0,x=x+Math.imul(te,q)|0,x=x+Math.imul(ne,xe)|0,S=S+Math.imul(ne,q)|0,y=y+Math.imul(W,Ce)|0,x=x+Math.imul(W,we)|0,x=x+Math.imul(G,Ce)|0,S=S+Math.imul(G,we)|0,y=y+Math.imul(V,J)|0,x=x+Math.imul(V,Y)|0,x=x+Math.imul(H,J)|0,S=S+Math.imul(H,Y)|0,y=y+Math.imul(R,Z)|0,x=x+Math.imul(R,Ee)|0,x=x+Math.imul(z,Z)|0,S=S+Math.imul(z,Ee)|0,y=y+Math.imul(F,Q)|0,x=x+Math.imul(F,Oe)|0,x=x+Math.imul(I,Q)|0,S=S+Math.imul(I,Oe)|0,y=y+Math.imul(M,Ae)|0,x=x+Math.imul(M,je)|0,x=x+Math.imul(N,Ae)|0,S=S+Math.imul(N,je)|0;var Ue=(v+y|0)+((x&8191)<<13)|0;v=(S+(x>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,y=Math.imul(oe,ve),x=Math.imul(oe,ye),x=x+Math.imul(se,ve)|0,S=Math.imul(se,ye),y=y+Math.imul(re,xe)|0,x=x+Math.imul(re,q)|0,x=x+Math.imul(ie,xe)|0,S=S+Math.imul(ie,q)|0,y=y+Math.imul(te,Ce)|0,x=x+Math.imul(te,we)|0,x=x+Math.imul(ne,Ce)|0,S=S+Math.imul(ne,we)|0,y=y+Math.imul(W,J)|0,x=x+Math