UNPKG

molstar

Version:

A comprehensive macromolecular library.

2 lines 4.62 MB
/*! For license information please see molstar.js.LICENSE.txt */ !function(e,A){"object"==typeof exports&&"object"==typeof module?module.exports=A():"function"==typeof define&&define.amd?define([],A):"object"==typeof exports?exports.molstar=A():e.molstar=A()}(self,(()=>(()=>{var e={1944:()=>{"use strict";var e,A,t,r,n,i,a,o;"undefined"!=typeof window&&function(){window.console=window.console||{};for(var e,A,t=window.console,r={},n=function(){},i="memory".split(","),a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=i.pop();)t[e]||(t[e]=r);for(;A=a.pop();)t[A]||(t[A]=n)}(),void 0===window.HTMLCanvasElement||window.HTMLCanvasElement.prototype.toBlob||Object.defineProperty(window.HTMLCanvasElement.prototype,"toBlob",{value:function(e,A,t){for(var r=window.atob(this.toDataURL(A,t).split(",")[1]),n=r.length,i=n>>2,a=new Uint8Array(n),o=new Uint32Array(a.buffer,0,i),s=0,u=0;u<i;u++)o[u]=r.charCodeAt(s++)|r.charCodeAt(s++)<<8|r.charCodeAt(s++)<<16|r.charCodeAt(s++)<<24;for(var c=3&n;c--;)a[s]=r.charCodeAt(s++);e(new window.Blob([a],{type:A||"image/png"}))}}),Math.cbrt=Math.cbrt||function(e){var A=Math.pow(Math.abs(e),1/3);return e<0?-A:A},Math.sign||(Math.sign=function(e){return 0==(e=+e)||isNaN(e)?Number(e):e>0?1:-1}),Number.isInteger||(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&e>-9007199254740992&&e<9007199254740992&&Math.floor(e)===e}),Number.isNaN||(Number.isNaN=function(e){return e!=e}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var A,t=Object(e),r=!1,n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i){for(var a=Object.keys(Object(i)),o=0,s=a.length;o<s;o++){var u=a[o];try{var c=Object.getOwnPropertyDescriptor(i,u);void 0!==c&&c.enumerable&&(t[u]=i[u])}catch(e){r||(r=!0,A=e)}}if(r)throw A}}return t}}),String.prototype.startsWith||(e=function(){var e;try{var A={},t=Object.defineProperty;e=t(A,A,A)&&t}catch(e){}return e}(),A={}.toString,t=function(e){if(null===this)throw TypeError();var t=String(this);if(e&&"[object RegExp]"===A.call(e))throw TypeError();var r=t.length,n=String(e),i=n.length,a=arguments.length>1?arguments[1]:void 0,o=a?Number(a):0;Number.isNaN(o)&&(o=0);var s=Math.min(Math.max(o,0),r);if(i+s>r)return!1;for(var u=-1;++u<i;)if(t.charCodeAt(s+u)!==n.charCodeAt(u))return!1;return!0},e?e(String.prototype,"startsWith",{value:t,configurable:!0,writable:!0}):String.prototype.startsWith=t),String.prototype.endsWith||(String.prototype.endsWith=function(e,A){var t=this.toString();("number"!=typeof A||!isFinite(A)||Math.floor(A)!==A||A>t.length)&&(A=t.length),A-=e.length;var r=t.indexOf(e,A);return-1!==r&&r===A}),String.prototype.repeat||(String.prototype.repeat=function(e){if(null===this)throw new TypeError("can't convert "+this+" to object");var A=""+this;if(e=+e,Number.isNaN(e)&&(e=0),e<0)throw new RangeError("repeat count must be non-negative");if(e===1/0)throw new RangeError("repeat count must be less than infinity");if(e=Math.floor(e),0===A.length||0===e)return"";if(A.length*e>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var t="";1==(1&e)&&(t+=A),0!=(e>>>=1);)A+=A;return t}),String.prototype.includes||(String.prototype.includes=function(e,A){return"number"!=typeof A&&(A=0),!(A+e.length>this.length)&&-1!==this.indexOf(e,A)}),Array.prototype.includes||(Array.prototype.includes=function(e){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var A=Object(this),t=parseInt(A.length,10)||0;if(0===t)return!1;var r,n,i=parseInt(arguments[1],10)||0;for(i>=0?r=i:(r=t+i)<0&&(r=0);r<t;){if(e===(n=A[r])||Number.isNaN(e)&&Number.isNaN(n))return!0;r++}return!1}),Array.from||(Array.from=(r=Object.prototype.toString,n=function(e){return"function"==typeof e||"[object Function]"===r.call(e)},i=Math.pow(2,53)-1,a=function(e){var A=function(e){var A=Number(e);return isNaN(A)?0:0!==A&&isFinite(A)?(A>0?1:-1)*Math.floor(Math.abs(A)):A}(e);return Math.min(Math.max(A,0),i)},function(e){var A=this,t=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var r,i=arguments.length>1?arguments[1]:void 0;if(void 0!==i){if(!n(i))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}for(var o,s=a(t.length),u=n(A)?Object(new A(s)):new Array(s),c=0;c<s;)o=t[c],u[c]=i?void 0===r?i(o,c):i.call(r,o,c):o,c+=1;return u.length=s,u})),"undefined"!=typeof window&&function(){for(var e=0,A=["ms","moz","webkit","o"],t=0;t<A.length&&!window.requestAnimationFrame;++t)window.requestAnimationFrame=window[A[t]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[A[t]+"CancelAnimationFrame"]||window[A[t]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(A){var t=(new Date).getTime(),r=Math.max(0,16-(t-e)),n=window.setTimeout((function(){A(t+r)}),r);return e=t+r,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),"undefined"!=typeof window&&(void 0===window.performance&&(window.performance={}),void 0===window.performance.now&&(o=Date.now(),window.performance.now=function(){return Date.now()-o})),void 0!==Object.defineProperty&&(void 0===Number.MAX_SAFE_INTEGER&&Object.defineProperty(Number,"MAX_SAFE_INTEGER",{enumerable:!1,configurable:!1,writable:!1,value:Math.pow(2,53)-1}),void 0===Number.MIN_SAFE_INTEGER&&Object.defineProperty(Number,"MIN_SAFE_INTEGER",{enumerable:!1,configurable:!1,writable:!1,value:-(Math.pow(2,53)-1)})),Object.entries||(Object.entries=function(e){for(var A=Object.keys(e),t=A.length,r=new Array(t);t--;)r[t]=[A[t],e[A[t]]];return r}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw TypeError('"this" is null or not defined');var A=Object(this),t=A.length>>>0;if("function"!=typeof e)throw TypeError("predicate must be a function");for(var r=arguments[1],n=0;n<t;){var i=A[n];if(e.call(r,i,n,A))return i;n++}},configurable:!0,writable:!0}),Array.prototype.fill||Object.defineProperty(Array.prototype,"fill",{value:function(e){if(null==this)throw new TypeError("this is null or not defined");for(var A=Object(this),t=A.length>>>0,r=arguments[1],n=r>>0,i=n<0?Math.max(t+n,0):Math.min(n,t),a=arguments[2],o=void 0===a?t:a>>0,s=o<0?Math.max(t+o,0):Math.min(o,t);i<s;)A[i]=e,i++;return A}}),Array.prototype.copyWithin||Object.defineProperty(Array.prototype,"copyWithin",{value:function(e,A){if(null==this)throw new TypeError("this is null or not defined");var t=Object(this),r=t.length>>>0,n=e>>0,i=n<0?Math.max(r+n,0):Math.min(n,r),a=A>>0,o=a<0?Math.max(r+a,0):Math.min(a,r),s=arguments[2],u=void 0===s?r:s>>0,c=u<0?Math.max(r+u,0):Math.min(u,r),g=Math.min(c-o,r-i),l=1;for(o<i&&i<o+g&&(l=-1,o+=g-1,i+=g-1);g>0;)o in t?t[i]=t[o]:delete t[i],o+=l,i+=l,g--;return t},configurable:!0,writable:!0}),Int8Array.prototype.copyWithin||Object.defineProperty(Int8Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Int16Array.prototype.copyWithin||Object.defineProperty(Int16Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Int32Array.prototype.copyWithin||Object.defineProperty(Int32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint8Array.prototype.copyWithin||Object.defineProperty(Uint8Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint16Array.prototype.copyWithin||Object.defineProperty(Uint16Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint32Array.prototype.copyWithin||Object.defineProperty(Uint32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Float32Array.prototype.copyWithin||Object.defineProperty(Float32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Float64Array.prototype.copyWithin||Object.defineProperty(Float64Array.prototype,"copyWithin",{value:Array.prototype.copyWithin})},9809:(e,A,t)=>{"use strict";const r=A;r.bignum=t(4590),r.define=t(2500).define,r.base=t(1979),r.constants=t(6826),r.decoders=t(8307),r.encoders=t(6579)},2500:(e,A,t)=>{"use strict";const r=t(6579),n=t(8307),i=t(5717);function a(e,A){this.name=e,this.body=A,this.decoders={},this.encoders={}}A.define=function(e,A){return new a(e,A)},a.prototype._createNamed=function(e){const A=this.name;function t(e){this._initNamed(e,A)}return i(t,e),t.prototype._initNamed=function(A,t){e.call(this,A,t)},new t(this)},a.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n[e])),this.decoders[e]},a.prototype.decode=function(e,A,t){return this._getDecoder(A).decode(e,t)},a.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(r[e])),this.encoders[e]},a.prototype.encode=function(e,A,t){return this._getEncoder(A).encode(e,t)}},6625:(e,A,t)=>{"use strict";const r=t(5717),n=t(8465).b,i=t(2399).Buffer;function a(e,A){n.call(this,A),i.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function o(e,A){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return o.isEncoderBuffer(e)||(e=new o(e,A)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return A.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=i.byteLength(e);else{if(!i.isBuffer(e))return A.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}r(a,n),A.C=a,a.isDecoderBuffer=function(e){return e instanceof a||"object"==typeof e&&i.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},a.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},a.prototype.restore=function(e){const A=new a(this.base);return A.offset=e.offset,A.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),A},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,A){if(!(this.offset+e<=this.length))return this.error(A||"DecoderBuffer overrun");const t=new a(this.base);return t._reporterState=this._reporterState,t.offset=this.offset,t.length=this.offset+e,this.offset+=e,t},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},A.R=o,o.isEncoderBuffer=function(e){return e instanceof o||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},o.prototype.join=function(e,A){return e||(e=i.alloc(this.length)),A||(A=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(t){t.join(e,A),A+=t.length})):("number"==typeof this.value?e[A]=this.value:"string"==typeof this.value?e.write(this.value,A):i.isBuffer(this.value)&&this.value.copy(e,A),A+=this.length)),e}},1979:(e,A,t)=>{"use strict";const r=A;r.Reporter=t(8465).b,r.DecoderBuffer=t(6625).C,r.EncoderBuffer=t(6625).R,r.Node=t(1949)},1949:(e,A,t)=>{"use strict";const r=t(8465).b,n=t(6625).R,i=t(6625).C,a=t(9746),o=["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"],s=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(o);function u(e,A,t){const r={};this._baseState=r,r.name=t,r.enc=e,r.parent=A||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=u;const c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];u.prototype.clone=function(){const e=this._baseState,A={};c.forEach((function(t){A[t]=e[t]}));const t=new this.constructor(A.parent);return t._baseState=A,t},u.prototype._wrap=function(){const e=this._baseState;s.forEach((function(A){this[A]=function(){const t=new this.constructor(this);return e.children.push(t),t[A].apply(t,arguments)}}),this)},u.prototype._init=function(e){const A=this._baseState;a(null===A.parent),e.call(this),A.children=A.children.filter((function(e){return e._baseState.parent===this}),this),a.equal(A.children.length,1,"Root node can have only one child")},u.prototype._useArgs=function(e){const A=this._baseState,t=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==t.length&&(a(null===A.children),A.children=t,t.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(a(null===A.args),A.args=e,A.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const A={};return Object.keys(e).forEach((function(t){t==(0|t)&&(t|=0);const r=e[t];A[r]=t})),A})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){u.prototype[e]=function(){const A=this._baseState;throw new Error(e+" not implemented for encoding: "+A.enc)}})),o.forEach((function(e){u.prototype[e]=function(){const A=this._baseState,t=Array.prototype.slice.call(arguments);return a(null===A.tag),A.tag=e,this._useArgs(t),this}})),u.prototype.use=function(e){a(e);const A=this._baseState;return a(null===A.use),A.use=e,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(e){const A=this._baseState;return a(null===A.default),A.default=e,A.optional=!0,this},u.prototype.explicit=function(e){const A=this._baseState;return a(null===A.explicit&&null===A.implicit),A.explicit=e,this},u.prototype.implicit=function(e){const A=this._baseState;return a(null===A.explicit&&null===A.implicit),A.implicit=e,this},u.prototype.obj=function(){const e=this._baseState,A=Array.prototype.slice.call(arguments);return e.obj=!0,0!==A.length&&this._useArgs(A),this},u.prototype.key=function(e){const A=this._baseState;return a(null===A.key),A.key=e,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(e){const A=this._baseState;return a(null===A.choice),A.choice=e,this._useArgs(Object.keys(e).map((function(A){return e[A]}))),this},u.prototype.contains=function(e){const A=this._baseState;return a(null===A.use),A.contains=e,this},u.prototype._decode=function(e,A){const t=this._baseState;if(null===t.parent)return e.wrapResult(t.children[0]._decode(e,A));let r,n=t.default,a=!0,o=null;if(null!==t.key&&(o=e.enterKey(t.key)),t.optional){let r=null;if(null!==t.explicit?r=t.explicit:null!==t.implicit?r=t.implicit:null!==t.tag&&(r=t.tag),null!==r||t.any){if(a=this._peekTag(e,r,t.any),e.isError(a))return a}else{const r=e.save();try{null===t.choice?this._decodeGeneric(t.tag,e,A):this._decodeChoice(e,A),a=!0}catch(e){a=!1}e.restore(r)}}if(t.obj&&a&&(r=e.enterObject()),a){if(null!==t.explicit){const A=this._decodeTag(e,t.explicit);if(e.isError(A))return A;e=A}const r=e.offset;if(null===t.use&&null===t.choice){let A;t.any&&(A=e.save());const r=this._decodeTag(e,null!==t.implicit?t.implicit:t.tag,t.any);if(e.isError(r))return r;t.any?n=e.raw(A):e=r}if(A&&A.track&&null!==t.tag&&A.track(e.path(),r,e.length,"tagged"),A&&A.track&&null!==t.tag&&A.track(e.path(),e.offset,e.length,"content"),t.any||(n=null===t.choice?this._decodeGeneric(t.tag,e,A):this._decodeChoice(e,A)),e.isError(n))return n;if(t.any||null!==t.choice||null===t.children||t.children.forEach((function(t){t._decode(e,A)})),t.contains&&("octstr"===t.tag||"bitstr"===t.tag)){const r=new i(n);n=this._getUse(t.contains,e._reporterState.obj)._decode(r,A)}}return t.obj&&a&&(n=e.leaveObject(r)),null===t.key||null===n&&!0!==a?null!==o&&e.exitKey(o):e.leaveKey(o,t.key,n),n},u.prototype._decodeGeneric=function(e,A,t){const r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(A,e,r.args[0],t):/str$/.test(e)?this._decodeStr(A,e,t):"objid"===e&&r.args?this._decodeObjid(A,r.args[0],r.args[1],t):"objid"===e?this._decodeObjid(A,null,null,t):"gentime"===e||"utctime"===e?this._decodeTime(A,e,t):"null_"===e?this._decodeNull(A,t):"bool"===e?this._decodeBool(A,t):"objDesc"===e?this._decodeStr(A,e,t):"int"===e||"enum"===e?this._decodeInt(A,r.args&&r.args[0],t):null!==r.use?this._getUse(r.use,A._reporterState.obj)._decode(A,t):A.error("unknown tag: "+e)},u.prototype._getUse=function(e,A){const t=this._baseState;return t.useDecoder=this._use(e,A),a(null===t.useDecoder._baseState.parent),t.useDecoder=t.useDecoder._baseState.children[0],t.implicit!==t.useDecoder._baseState.implicit&&(t.useDecoder=t.useDecoder.clone(),t.useDecoder._baseState.implicit=t.implicit),t.useDecoder},u.prototype._decodeChoice=function(e,A){const t=this._baseState;let r=null,n=!1;return Object.keys(t.choice).some((function(i){const a=e.save(),o=t.choice[i];try{const t=o._decode(e,A);if(e.isError(t))return!1;r={type:i,value:t},n=!0}catch(A){return e.restore(a),!1}return!0}),this),n?r:e.error("Choice not matched")},u.prototype._createEncoderBuffer=function(e){return new n(e,this.reporter)},u.prototype._encode=function(e,A,t){const r=this._baseState;if(null!==r.default&&r.default===e)return;const n=this._encodeValue(e,A,t);return void 0===n||this._skipDefault(n,A,t)?void 0:n},u.prototype._encodeValue=function(e,A,t){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,A||new r);let i=null;if(this.reporter=A,n.optional&&void 0===e){if(null===n.default)return;e=n.default}let a=null,o=!1;if(n.any)i=this._createEncoderBuffer(e);else if(n.choice)i=this._encodeChoice(e,A);else if(n.contains)a=this._getUse(n.contains,t)._encode(e,A),o=!0;else if(n.children)a=n.children.map((function(t){if("null_"===t._baseState.tag)return t._encode(null,A,e);if(null===t._baseState.key)return A.error("Child should have a key");const r=A.enterKey(t._baseState.key);if("object"!=typeof e)return A.error("Child expected, but input is not object");const n=t._encode(e[t._baseState.key],A,e);return A.leaveKey(r),n}),this).filter((function(e){return e})),a=this._createEncoderBuffer(a);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return A.error("Too many args for : "+n.tag);if(!Array.isArray(e))return A.error("seqof/setof, but data is not Array");const t=this.clone();t._baseState.implicit=null,a=this._createEncoderBuffer(e.map((function(t){const r=this._baseState;return this._getUse(r.args[0],e)._encode(t,A)}),t))}else null!==n.use?i=this._getUse(n.use,t)._encode(e,A):(a=this._encodePrimitive(n.tag,e),o=!0);if(!n.any&&null===n.choice){const e=null!==n.implicit?n.implicit:n.tag,t=null===n.implicit?"universal":"context";null===e?null===n.use&&A.error("Tag could be omitted only for .use()"):null===n.use&&(i=this._encodeComposite(e,o,t,a))}return null!==n.explicit&&(i=this._encodeComposite(n.explicit,!1,"context",i)),i},u.prototype._encodeChoice=function(e,A){const t=this._baseState,r=t.choice[e.type];return r||a(!1,e.type+" not found in "+JSON.stringify(Object.keys(t.choice))),r._encode(e.value,A)},u.prototype._encodePrimitive=function(e,A){const t=this._baseState;if(/str$/.test(e))return this._encodeStr(A,e);if("objid"===e&&t.args)return this._encodeObjid(A,t.reverseArgs[0],t.args[1]);if("objid"===e)return this._encodeObjid(A,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(A,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(A,t.args&&t.reverseArgs[0]);if("bool"===e)return this._encodeBool(A);if("objDesc"===e)return this._encodeStr(A,e);throw new Error("Unsupported tag: "+e)},u.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},u.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},8465:(e,A,t)=>{"use strict";const r=t(5717);function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function i(e,A){this.path=e,this.rethrow(A)}A.b=n,n.prototype.isError=function(e){return e instanceof i},n.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){const A=this._reporterState;A.obj=e.obj,A.path=A.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){const A=this._reporterState;A.path=A.path.slice(0,e-1)},n.prototype.leaveKey=function(e,A,t){const r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[A]=t)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){const e=this._reporterState,A=e.obj;return e.obj={},A},n.prototype.leaveObject=function(e){const A=this._reporterState,t=A.obj;return A.obj=e,t},n.prototype.error=function(e){let A;const t=this._reporterState,r=e instanceof i;if(A=r?e:new i(t.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!t.options.partial)throw A;return r||t.errors.push(A),A},n.prototype.wrapResult=function(e){const A=this._reporterState;return A.options.partial?{result:this.isError(e)?null:e,errors:A.errors}:e},r(i,Error),i.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},160:(e,A)=>{"use strict";function t(e){const A={};return Object.keys(e).forEach((function(t){(0|t)==t&&(t|=0);const r=e[t];A[r]=t})),A}A.tagClass={0:"universal",1:"application",2:"context",3:"private"},A.tagClassByName=t(A.tagClass),A.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"},A.tagByName=t(A.tag)},6826:(e,A,t)=>{"use strict";const r=A;r._reverse=function(e){const A={};return Object.keys(e).forEach((function(t){(0|t)==t&&(t|=0);const r=e[t];A[r]=t})),A},r.der=t(160)},1671:(e,A,t)=>{"use strict";const r=t(5717),n=t(4590),i=t(6625).C,a=t(1949),o=t(160);function s(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new u,this.tree._init(e.body)}function u(e){a.call(this,"der",e)}function c(e,A){let t=e.readUInt8(A);if(e.isError(t))return t;const r=o.tagClass[t>>6],n=0==(32&t);if(31==(31&t)){let r=t;for(t=0;128==(128&r);){if(r=e.readUInt8(A),e.isError(r))return r;t<<=7,t|=127&r}}else t&=31;return{cls:r,primitive:n,tag:t,tagStr:o.tag[t]}}function g(e,A,t){let r=e.readUInt8(t);if(e.isError(r))return r;if(!A&&128===r)return null;if(0==(128&r))return r;const n=127&r;if(n>4)return e.error("length octect is too long");r=0;for(let A=0;A<n;A++){r<<=8;const A=e.readUInt8(t);if(e.isError(A))return A;r|=A}return r}e.exports=s,s.prototype.decode=function(e,A){return i.isDecoderBuffer(e)||(e=new i(e,A)),this.tree._decode(e,A)},r(u,a),u.prototype._peekTag=function(e,A,t){if(e.isEmpty())return!1;const r=e.save(),n=c(e,'Failed to peek tag: "'+A+'"');return e.isError(n)?n:(e.restore(r),n.tag===A||n.tagStr===A||n.tagStr+"of"===A||t)},u.prototype._decodeTag=function(e,A,t){const r=c(e,'Failed to decode tag of "'+A+'"');if(e.isError(r))return r;let n=g(e,r.primitive,'Failed to get length of "'+A+'"');if(e.isError(n))return n;if(!t&&r.tag!==A&&r.tagStr!==A&&r.tagStr+"of"!==A)return e.error('Failed to match tag: "'+A+'"');if(r.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+A+'"');const i=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(n=e.offset-i.offset,e.restore(i),e.skip(n,'Failed to match body of: "'+A+'"'))},u.prototype._skipUntilEnd=function(e,A){for(;;){const t=c(e,A);if(e.isError(t))return t;const r=g(e,t.primitive,A);if(e.isError(r))return r;let n;if(n=t.primitive||null!==r?e.skip(r):this._skipUntilEnd(e,A),e.isError(n))return n;if("end"===t.tagStr)break}},u.prototype._decodeList=function(e,A,t,r){const n=[];for(;!e.isEmpty();){const A=this._peekTag(e,"end");if(e.isError(A))return A;const i=t.decode(e,"der",r);if(e.isError(i)&&A)break;n.push(i)}return n},u.prototype._decodeStr=function(e,A){if("bitstr"===A){const A=e.readUInt8();return e.isError(A)?A:{unused:A,data:e.raw()}}if("bmpstr"===A){const A=e.raw();if(A.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let t="";for(let e=0;e<A.length/2;e++)t+=String.fromCharCode(A.readUInt16BE(2*e));return t}if("numstr"===A){const A=e.raw().toString("ascii");return this._isNumstr(A)?A:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===A)return e.raw();if("objDesc"===A)return e.raw();if("printstr"===A){const A=e.raw().toString("ascii");return this._isPrintstr(A)?A:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(A)?e.raw().toString():e.error("Decoding of string type: "+A+" unsupported")},u.prototype._decodeObjid=function(e,A,t){let r;const n=[];let i=0,a=0;for(;!e.isEmpty();)a=e.readUInt8(),i<<=7,i|=127&a,0==(128&a)&&(n.push(i),i=0);128&a&&n.push(i);const o=n[0]/40|0,s=n[0]%40;if(r=t?n:[o,s].concat(n.slice(1)),A){let e=A[r.join(" ")];void 0===e&&(e=A[r.join(".")]),void 0!==e&&(r=e)}return r},u.prototype._decodeTime=function(e,A){const t=e.raw().toString();let r,n,i,a,o,s;if("gentime"===A)r=0|t.slice(0,4),n=0|t.slice(4,6),i=0|t.slice(6,8),a=0|t.slice(8,10),o=0|t.slice(10,12),s=0|t.slice(12,14);else{if("utctime"!==A)return e.error("Decoding "+A+" time is not supported yet");r=0|t.slice(0,2),n=0|t.slice(2,4),i=0|t.slice(4,6),a=0|t.slice(6,8),o=0|t.slice(8,10),s=0|t.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,n-1,i,a,o,s,0)},u.prototype._decodeNull=function(){return null},u.prototype._decodeBool=function(e){const A=e.readUInt8();return e.isError(A)?A:0!==A},u.prototype._decodeInt=function(e,A){const t=e.raw();let r=new n(t);return A&&(r=A[r.toString(10)]||r),r},u.prototype._use=function(e,A){return"function"==typeof e&&(e=e(A)),e._getDecoder("der").tree}},8307:(e,A,t)=>{"use strict";const r=A;r.der=t(1671),r.pem=t(9631)},9631:(e,A,t)=>{"use strict";const r=t(5717),n=t(2399).Buffer,i=t(1671);function a(e){i.call(this,e),this.enc="pem"}r(a,i),e.exports=a,a.prototype.decode=function(e,A){const t=e.toString().split(/[\r\n]+/g),r=A.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let o=-1,s=-1;for(let e=0;e<t.length;e++){const A=t[e].match(a);if(null!==A&&A[2]===r){if(-1!==o){if("END"!==A[1])break;s=e;break}if("BEGIN"!==A[1])break;o=e}}if(-1===o||-1===s)throw new Error("PEM section not found for: "+r);const u=t.slice(o+1,s).join("");u.replace(/[^a-z0-9+/=]+/gi,"");const c=n.from(u,"base64");return i.prototype.decode.call(this,c,A)}},6984:(e,A,t)=>{"use strict";const r=t(5717),n=t(2399).Buffer,i=t(1949),a=t(160);function o(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new s,this.tree._init(e.body)}function s(e){i.call(this,"der",e)}function u(e){return e<10?"0"+e:e}e.exports=o,o.prototype.encode=function(e,A){return this.tree._encode(e,A).join()},r(s,i),s.prototype._encodeComposite=function(e,A,t,r){const i=function(e,A,t,r){let n;if("seqof"===e?e="seq":"setof"===e&&(e="set"),a.tagByName.hasOwnProperty(e))n=a.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);n=e}return n>=31?r.error("Multi-octet tag encoding unsupported"):(A||(n|=32),n|=a.tagClassByName[t||"universal"]<<6,n)}(e,A,t,this.reporter);if(r.length<128){const e=n.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;const s=n.alloc(2+o);s[0]=i,s[1]=128|o;for(let e=1+o,A=r.length;A>0;e--,A>>=8)s[e]=255&A;return this._createEncoderBuffer([s,r])},s.prototype._encodeStr=function(e,A){if("bitstr"===A)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===A){const A=n.alloc(2*e.length);for(let t=0;t<e.length;t++)A.writeUInt16BE(e.charCodeAt(t),2*t);return this._createEncoderBuffer(A)}return"numstr"===A?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===A?this._isPrintstr(e)?this._createEncoderBuffer(e):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"):/str$/.test(A)||"objDesc"===A?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+A+" unsupported")},s.prototype._encodeObjid=function(e,A,t){if("string"==typeof e){if(!A)return this.reporter.error("string objid given, but no values map found");if(!A.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=A[e].split(/[\s.]+/g);for(let A=0;A<e.length;A++)e[A]|=0}else if(Array.isArray(e)){e=e.slice();for(let A=0;A<e.length;A++)e[A]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!t){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let A=0;A<e.length;A++){let t=e[A];for(r++;t>=128;t>>=7)r++}const i=n.alloc(r);let a=i.length-1;for(let A=e.length-1;A>=0;A--){let t=e[A];for(i[a--]=127&t;(t>>=7)>0;)i[a--]=128|127&t}return this._createEncoderBuffer(i)},s.prototype._encodeTime=function(e,A){let t;const r=new Date(e);return"gentime"===A?t=[u(r.getUTCFullYear()),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),"Z"].join(""):"utctime"===A?t=[u(r.getUTCFullYear()%100),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+A+" time is not supported yet"),this._encodeStr(t,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(e,A){if("string"==typeof e){if(!A)return this.reporter.error("String int or enum given, but no values map");if(!A.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=A[e]}if("number"!=typeof e&&!n.isBuffer(e)){const A=e.toArray();!e.sign&&128&A[0]&&A.unshift(0),e=n.from(A)}if(n.isBuffer(e)){let A=e.length;0===e.length&&A++;const t=n.alloc(A);return e.copy(t),0===e.length&&(t[0]=0),this._createEncoderBuffer(t)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let t=1;for(let A=e;A>=256;A>>=8)t++;const r=new Array(t);for(let A=r.length-1;A>=0;A--)r[A]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(n.from(r))},s.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},s.prototype._use=function(e,A){return"function"==typeof e&&(e=e(A)),e._getEncoder("der").tree},s.prototype._skipDefault=function(e,A,t){const r=this._baseState;let n;if(null===r.default)return!1;const i=e.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,A,t).join()),i.length!==r.defaultBuffer.length)return!1;for(n=0;n<i.length;n++)if(i[n]!==r.defaultBuffer[n])return!1;return!0}},6579:(e,A,t)=>{"use strict";const r=A;r.der=t(6984),r.pem=t(2883)},2883:(e,A,t)=>{"use strict";const r=t(5717),n=t(6984);function i(e){n.call(this,e),this.enc="pem"}r(i,n),e.exports=i,i.prototype.encode=function(e,A){const t=n.prototype.encode.call(this,e).toString("base64"),r=["-----BEGIN "+A.label+"-----"];for(let e=0;e<t.length;e+=64)r.push(t.slice(e,e+64));return r.push("-----END "+A.label+"-----"),r.join("\n")}},4590:function(e,A,t){!function(e,A){"use strict";function r(e,A){if(!e)throw new Error(A||"Assertion failed")}function n(e,A){e.super_=A;var t=function(){};t.prototype=A.prototype,e.prototype=new t,e.prototype.constructor=e}function i(e,A,t){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==A&&"be"!==A||(t=A,A=10),this._init(e||0,A||10,t||"be"))}var a;"object"==typeof e?e.exports=i:A.BN=i,i.BN=i,i.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(950).Buffer}catch(e){}function o(e,A){var t=e.charCodeAt(A);return t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function s(e,A,t){var r=o(e,t);return t-1>=A&&(r|=o(e,t-1)<<4),r}function u(e,A,t,r){for(var n=0,i=Math.min(e.length,t),a=A;a<i;a++){var o=e.charCodeAt(a)-48;n*=r,n+=o>=49?o-49+10:o>=17?o-17+10:o}return n}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,A){return e.cmp(A)>0?e:A},i.min=function(e,A){return e.cmp(A)<0?e:A},i.prototype._init=function(e,A,t){if("number"==typeof e)return this._initNumber(e,A,t);if("object"==typeof e)return this._initArray(e,A,t);"hex"===A&&(A=16),r(A===(0|A)&&A>=2&&A<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===A?this._parseHex(e,n,t):(this._parseBase(e,A,n),"le"===t&&this._initArray(this.toArray(),A,t)))},i.prototype._initNumber=function(e,A,t){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===t&&this._initArray(this.toArray(),A,t)},i.prototype._initArray=function(e,A,t){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,a,o=0;if("be"===t)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<o&67108863,this.words[i+1]=a>>>26-o&67108863,(o+=24)>=26&&(o-=26,i++);else if("le"===t)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<o&67108863,this.words[i+1]=a>>>26-o&67108863,(o+=24)>=26&&(o-=26,i++);return this.strip()},i.prototype._parseHex=function(e,A,t){this.length=Math.ceil((e.length-A)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i=0,a=0;if("be"===t)for(r=e.length-1;r>=A;r-=2)n=s(e,A,r)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(r=(e.length-A)%2==0?A+1:A;r<e.length;r+=2)n=s(e,A,r)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},i.prototype._parseBase=function(e,A,t){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=A)r++;r--,n=n/A|0;for(var i=e.length-t,a=i%r,o=Math.min(i,i-a)+t,s=0,c=t;c<o;c+=r)s=u(e,c,c+r,A),this.imuln(n),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(0!==a){var g=1;for(s=u(e,c,e.length,A),c=0;c<a;c++)g*=A;this.imuln(g),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}this.strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var A=0;A<this.length;A++)e.words[A]=this.words[A];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],g=[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],l=[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];function B(e,A,t){t.negative=A.negative^e.negative;var r=e.length+A.length|0;t.length=r,r=r-1|0;var n=0|e.words[0],i=0|A.words[0],a=n*i,o=67108863&a,s=a/67108864|0;t.words[0]=o;for(var u=1;u<r;u++){for(var c=s>>>26,g=67108863&s,l=Math.min(u,A.length-1),B=Math.max(0,u-e.length+1);B<=l;B++){var d=u-B|0;c+=(a=(n=0|e.words[d])*(i=0|A.words[B])+g)/67108864|0,g=67108863&a}t.words[u]=0|g,s=0|c}return 0!==s?t.words[u]=0|s:t.length--,t.strip()}i.prototype.toString=function(e,A){var t;if(A=0|A||1,16===(e=e||10)||"hex"===e){t="";for(var n=0,i=0,a=0;a<this.length;a++){var o=this.words[a],s=(16777215&(o<<n|i)).toString(16);t=0!=(i=o>>>24-n&16777215)||a!==this.length-1?c[6-s.length]+s+t:s+t,(n+=2)>=26&&(n-=26,a--)}for(0!==i&&(t=i.toString(16)+t);t.length%A!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(e===(0|e)&&e>=2&&e<=36){var u=g[e],B=l[e];t="";var d=this.clone();for(d.negative=0;!d.isZero();){var Q=d.modn(B).toString(e);t=(d=d.idivn(B)).isZero()?Q+t:c[u-Q.length]+Q+t}for(this.isZero()&&(t="0"+t);t.length%A!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,A){return r(void 0!==a),this.toArrayLike(a,e,A)},i.prototype.toArray=function(e,A){return this.toArrayLike(Array,e,A)},i.prototype.toArrayLike=function(e,A,t){var n=this.byteLength(),i=t||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,o,s="le"===A,u=new e(i),c=this.clone();if(s){for(o=0;!c.isZero();o++)a=c.andln(255),c.iushrn(8),u[o]=a;for(;o<i;o++)u[o]=0}else{for(o=0;o<i-n;o++)u[o]=0;for(o=0;!c.isZero();o++)a=c.andln(255),c.iushrn(8),u[i-o-1]=a}return u},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var A=e,t=0;return A>=4096&&(t+=13,A>>>=13),A>=64&&(t+=7,A>>>=7),A>=8&&(t+=4,A>>>=4),A>=2&&(t+=2,A>>>=2),t+A},i.prototype._zeroBits=function(e){if(0===e)return 26;var A=e,t=0;return 0==(8191&A)&&(t+=13,A>>>=13),0==(127&A)&&(t+=7,A>>>=7),0==(15&A)&&(t+=4,A>>>=4),0==(3&A)&&(t+=2,A>>>=2),0==(1&A)&&t++,t},i.prototype.bitLength=function(){var e=this.words[this.length-1],A=this._countBits(e);return 26*(this.length-1)+A},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,A=0;A<this.length;A++){var t=this._zeroBits(this.words[A]);if(e+=t,26!==t)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var A=0;A<e.length;A++)this.words[A]=this.words[A]|e.words[A];return this.strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var A;A=this.length>e.length?e:this;for(var t=0;t<A.length;t++)this.words[t]=this.words[t]&e.words[t];return this.length=A.length,this.strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var A,t;this.length>e.length?(A=this,t=e):(A=e,t=this);for(var r=0;r<t.length;r++)this.words[r]=A.words[r]^t.words[r];if(this!==A)for(;r<A.length;r++)this.words[r]=A.words[r];return this.length=A.length,this.strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var A=0|Math.ceil(e/26),t=e%26;this._expand(A),t>0&&A--;for(var n=0;n<A;n++)this.words[n]=67108863&~this.words[n];return t>0&&(this.words[n]=~this.words[n]&67108863>>26-t),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,A){r("number"==typeof e&&e>=0);var t=e/26|0,n=e%26;return this._expand(t+1),this.words[t]=A?this.words[t]|1<<n:this.words[t]&~(1<<n),this.strip()},i.prototype.iadd=function(e){var A,t,r;if(0!==this.negative&&0===e.negative)return this.negative=0,A=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,A=this.isub(e),e.negative=1,A._normSign();this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0,i=0;i<r.length;i++)A=(0|t.words[i])+(0|r.words[i])+n,this.words[i]=67108863&A,n=A>>>26;for(;0!==n&&i<t.length;i++)A=(0|t.words[i])+n,this.words[i]=67108863&A,n=A>>>26;if(this.length=t.length,0!==n)this.words[this.length]=n,this.length++;else if(t!==this)for(;i<t.length;i++)this.words[i]=t.words[i];return this},i.prototype.add=function(e){var A;return 0!==e.negative&&0===this.negative?(e.negative=0,A=this.sub(e),e.negative^=1,A):0===e.negative&&0!==this.negative?(this.negative=0,A=e.sub(this),this.negative=1,A):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var A=this.iadd(e);return e.negative=1,A._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var t,r,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=e):(t=e,r=this);for(var i=0,a=0;a<r.length;a++)i=(A=(0|t.words[a])-(0|r.words[a])+i)>>26,this.words[a]=67108863&A;for(;0!==i&&a<t.length;a++)i=(A=(0|t.words[a])+i)>>26,this.words[a]=67108863&A;if(0===i&&a<t.length&&t!==this)for(;a<t.length;a++)this.words[a]=t.words[a];return this.length=Math.max(this.length,a),t!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var d=function(e,A,t){var r,n,i,a=e.words,o=A.words,s=t.words,u=0,c=0|a[0],g=8191&c,l=c>>>13,B=0|a[1],d=8191&B,Q=B>>>13,I=0|a[2],h=8191&I,f=I>>>13,E=0|a[3],p=8191&E,C=E>>>13,m=0|a[4],y=8191&m,v=m>>>13,b=0|a[5],D=8191&b,w=b>>>13,F=0|a[6],S=8191&F,U=F>>>13,N=0|a[7],x=8191&N,R=N>>>13,G=0|a[8],L=8191&G,M=G>>>13,H=0|a[9],k=8191&H,Y=H>>>13,_=0|o[0],V=8191&_,T=_>>>13,P=0|o[1],O=8191&P,J=P>>>13,K=0|o[2],j=8191&K,q=K>>>13,z=0|o[3],Z=8191&z,W=z>>>13,X=0|o[4],$=8191&X,ee=X>>>13,Ae=0|o[5],te=8191&Ae,re=Ae>>>13,ne=0|o[6],ie=8191&ne,ae=ne>>>13,oe=0|o[7],se=8191&oe,ue=oe>>>13,ce=0|o[8],ge=8191&ce,le=ce>>>13,Be=0|o[9],de=8191&Be,Qe=Be>>>13;t.negative=e.negative^A.negative,t.length=19;var Ie=(u+(r=Math.imul(g,V))|0)+((8191&(n=(n=Math.imul(g,T))+Math.imul(l,V)|0))<<13)|0;u=((i=Math.imul(l,T))+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(d,V),n=(n=Math.imul(d,T))+Math.imul(Q,V)|0,i=Math.imul(Q,T);var he=(u+(r=r+Math.imul(g,O)|0)|0)+((8191&(n=(n=n+Math.imul(g,J)|0)+Math.imul(l,O)|0))<<13)|0;u=((i=i+Math.imul(l,J)|0)+(n>>>13)|0)+(he>>>26)|0,he&=67108863,r=Math.imul(h,V),n=(n=Math.imul(h,T))+Math.imul(f,V)|0,i=Math.imul(f,T),r=r+Math.imul(d,O)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(Q,O)|0,i=i+Math.imul(Q,J)|0;var fe=(u+(r=r+Math.imul(g,j)|0)|0)+((8191&(n=(n=n+Math.imul(g,q)|0)+Math.imul(l,j)|0))<<13)|0;u=((i=i+Math.imul(l,q)|0)+(n>>>13)|0)+(fe>>>26)|0,fe&=67108863,r=Math.imul(p,V),n=(n=Math.imul(p,T))+Math.imul(C,V)|0,i=Math.imul(C,T),r=r+Math.imul(h,O)|0,n=(n=n+Math.imul(h,J)|0)+Math.imul(f,O)|0,i=i+Math.imul(f,J)|0,r=r+Math.imul(d,j)|0,n=(n=n+Math.imul(d,q)|0)+Math.imul(Q,j)|0,i=i+Math.imul(Q,q)|0;var Ee=(u+(r=r+Math.imul(g,Z)|0)|0)+((8191&(n=(n=n+Math.imul(g,W)|0)+Math.imul(l,Z)|0))<<13)|0;u=((i=i+Math.imul(l,W)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(y,V),n=(n=Math.imul(y,T))+Math.imul(v,V)|0,i=Math.imul(v,T),r=r+Math.imul(p,O)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(C,O)|0,i=i+Math.imul(C,J)|0,r=r+Math.imul(h,j)|0,n=(n=n+Math.imul(h,q)|0)+Math.imul(f,j)|0,i=i+Math.imul(f,q)|0,r=r+Math.imul(d,Z)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(Q,Z)|0,i=i+Math.imul(Q,W)|0;var pe=(u+(r=r+Math.imul(g,$)|0)|0)+((8191&(n=(n=n+Math.imul(g,ee)|0)+Math.imul(l,$)|0))<<13)|0;u=((i=i+Math.imul(l,ee)|0)+(n>>>13)|0)+(pe>>>26)|0,pe&=67108863,r=Math.imul(D,V),n=(n=Math.imul(D,T))+Math.imul(w,V)|0,i=Math.imul(w,T),r=r+Math.imul(y,O)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(v,O)|0,i=i+Math.imul(v,J)|0,r=r+Math.imul(p,j)|0,n=(n=n+Math.imul(p,q)|0)+Math.imul(C,j)|0,i=i+Math.imul(C,q)|0,r=r+Math.imul(h,Z)|0,n=(n=n+Math.imul(h,W)|0)+Math.imul(f,Z)|0,i=i+Math.imul(f,W)|0,r=r+Math.imul(d,$)|0,n=(n=n+Math.imul(d,ee)|0)+Math.imul(Q,$)|0,i=i+Math.imul(Q,ee)|0;var Ce=(u+(r=r+Math.imul(g,te)|0)|0)+((8191&(n=(n=n+Math.imul(g,re)|0)+Math.imul(l,te)|0))<<13)|0;u=((i=i+Math.imul(l,re)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(S,V),n=(n=Math.imul(S,T))+Math.imul(U,V)|0,i=Math.imul(U,T),r=r+Math.imul(D,O)|0,n=(n=n+Math.imul(D,J)|0)+Math.imul(w,O)|0,i=i+Math.imul(w,J)|0,r=r+Math.imul(y,j)|0,n=(n=n+Math.imul(y,q)|0)+Math.imul(v,j)|0,i=i+Math.imul(v,q)|0,r=r+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(C,Z)|0,i=i+Math.imul(C,W)|0,r=r+Math.imul(h,$)|0,n=(n=n+Math.imul(h,ee)|0)+Math.imul(f,$)|0,i=i+Math.imul(f,ee)|0,r=r+Math.imul(d,te)|0,n=(n=n+Math.imul(d,re)|0)+Math.imul(Q,te)|0,i=i+Math.imul(Q,re)|0;var me=(u+(r=r+Math.imul(g,ie)|0)|0)+((8191&(n=(n=n+Math.imul(g,ae)|0)+Math.imul(l,ie)|0))<<13)|0;u=((i=i+Math.imul(l,ae)|0)+(n>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(x,V),n=(n=Math.imul(x,T))+Math.imul(R,V)|0,i=Math.imul(R,T),r=r+Math.imul(S,O)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(U,O)|0,i=i+Math.imul(U,J)|0,r=r+Math.imul(D,j)|0,n=(n=n+Math.imul(D,q)|0)+Math.imul(w,j)|0,i=i+Math.imul(w,q)|0,r=r+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Z)|0,i=i+Math.imul(v,W)|0,r=r+Math.imul(p,$)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(C,$)|0,i=i+Math.imul(C,ee)|0,r=r+Math.imul(h,te)|0,n=(n=n+Math.imul(h,re)|0)+Math.imul(f,te)|0,i=i+Math.imul(f,re)|0,r=r+Math.imul(d,ie)|0,n=(n=n+Math.imul(d,ae)|0)+Math.imul(Q,ie)|0,i=i+Math.imul(Q,ae)|0;var ye=(u+(r=r+Math.imul(g,se)|0)|0)+((8191&(n=(n=n+Math.imul(g,ue)|0)+Math.imul(l,se)|0))<<13)|0;u=((i=i+Math.imul(l,ue)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(L,V),n=(n=Math.imul(L,T))+Math.imul(M,V)|0,i=Math.imul(M,T),r=r+Math.imul(x,O)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(R,O)|0,i=i+Math.imul(R,J)|0,r=r+Math.imul(S,j)|0,n=(n=n+Math.imul(S,q)|0)+Math.imul(U,j)|0,i=i+Math.imul(U,q)|0,r=r+Math.imul(D,Z)|0,n=(n=n+Math.imul(D,W)|0)+Math.imul(w,Z)|0,i=i+Math.imul(w,W)|0,r=r+Math.imul(y,$)|0,n=(n=n+Math.imul(y,ee)|0)+Math.imul(v,$)|0,i=i+Math.imul(v,ee)|0,r=r+Math.imul(p,te)|0,n=(n=n+Math.imul(p,re)|0)+Math.imul(C,te)|0,i=i+Math.imul(C,re)|0,r=r+Math.imul(h,ie)|0,n=(n=n+Math.imul(h,ae)|0)+Math.imul(f,ie)|0,i=i+Math.imul(f,ae)|0,r=r+Math.imul(d,se)|0,n=(n=n+Math.imul(d,ue)|0)+Math.imul(Q,se)|0,i=i+Math.imul(Q,ue)|0;var ve=(u+(r=r+Math.imul(g,ge)|0)|0)+((8191&(n=(n=n+Math.imul(g,le)|0)+Math.imul(l,ge)|0))<<13)|0;u=((i=i+Math.imul(l,le)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(k,V),n=(n=Math.imul(k,T))+Math.imul(Y,V)|0,i=Math.imul(Y,T),r=r+Math.imul(L,O)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(M,O)|0,i=i+Math.imul(M,J)|0,r=r+Math.imul(x,j)|0,n=(n=n+Math.imul(x,q)|0)+Math.imul(R,j)|0,i=i+Math.imul(R,q)|0,r=r+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(U,Z)|0,i=i+Math.imul(U,W)|0,r=r+Math.imul(D,$)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(w,$)|0,i=i+Math.imul(w,ee)|0,r=r+Math.imul(y,te)|0,n=(n=n+Math.imul(y,re)|0)+Math.imul(v,te)|0,i=i+Math.imul(v,re)|0,r=r+Math.imul(p,ie)|0,n=(n=n+Math.imul(p,ae)|0)+Math.imul(C,ie)|0,i=i+Math.imul(C,ae)|0,r=r+Math.imul(h,se)|0,n=(n=n+Math.imul(h,ue)|0)+Math.imul(f,se)|0,i=i+Math.imul(f,ue)|0,r=r+Math.imul(d,ge)|0,n=(n=n+Math.imul(d,le)|0)+Math.imul(Q,ge)|0,i=i+Math.imul(Q,le)|0;var be=(u+(r=r+Math.imul(g,de)|0)|0)+((8191&(n=(n=n+Math.imul(g,Qe)|0)+Math.imul(l,de)|0))<<13)|0;u=((i=i+Math.imul(l,Qe)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,r=M