0&&(f+="\n");for(var d="",m=0;m1?"0x"+e.util.bytesToHex(a.value.slice(1)):"(none)",a.value.length>0){var T=a.value.charCodeAt(0);1==T?f+=" (1 unused bit shown)":T>1&&(f+=" ("+T+" unused bits shown)")}}else a.type===r.Type.OCTETSTRING?(i.test(a.value)||(f+="("+a.value+") "),f+="0x"+e.util.bytesToHex(a.value)):a.type===r.Type.UTF8?f+=e.util.decodeUtf8(a.value):a.type===r.Type.PRINTABLESTRING||a.type===r.Type.IA5String?f+=a.value:i.test(a.value)?f+="0x"+e.util.bytesToHex(a.value):f+=0===a.value.length?"[null]":a.value}return f}},function(L,C,t){"use strict";function e(r){return null!==r&&"object"==typeof r}t.d(C,"a",function(){return e})},function(L,C,t){"use strict";t.d(C,"a",function(){return e});var e=function(r){return function(u){for(var n=0,o=r.length;n!(!e.isObject(u)||"@value"in u||"@set"in u||"@list"in u)&&(Object.keys(u).length>1||!("@id"in u)),r.isSubjectReference=u=>e.isObject(u)&&1===Object.keys(u).length&&"@id"in u,r.isValue=u=>e.isObject(u)&&"@value"in u,r.isList=u=>e.isObject(u)&&"@list"in u,r.isGraph=u=>e.isObject(u)&&"@graph"in u&&1===Object.keys(u).filter(n=>"@id"!==n&&"@index"!==n).length,r.isSimpleGraph=u=>r.isGraph(u)&&!("@id"in u),r.isBlankNode=u=>!!e.isObject(u)&&("@id"in u?0===u["@id"].indexOf("_:"):0===Object.keys(u).length||!("@value"in u||"@set"in u||"@list"in u))},,function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(45),r=function(){function u(n){this._binding=n}return u.prototype.onActivation=function(n){return this._binding.onActivation=n,new e.BindingWhenSyntax(this._binding)},u}();C.BindingOnSyntax=r},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(44),r=t(62),u=function(){function n(o){this._binding=o}return n.prototype.when=function(o){return this._binding.constraint=o,new e.BindingOnSyntax(this._binding)},n.prototype.whenTargetNamed=function(o){return this._binding.constraint=r.namedConstraint(o),new e.BindingOnSyntax(this._binding)},n.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(o){return null!==o.target&&!o.target.isNamed()&&!o.target.isTagged()},new e.BindingOnSyntax(this._binding)},n.prototype.whenTargetTagged=function(o,i){return this._binding.constraint=r.taggedConstraint(o)(i),new e.BindingOnSyntax(this._binding)},n.prototype.whenInjectedInto=function(o){return this._binding.constraint=function(i){return r.typeConstraint(o)(i.parentRequest)},new e.BindingOnSyntax(this._binding)},n.prototype.whenParentNamed=function(o){return this._binding.constraint=function(i){return r.namedConstraint(o)(i.parentRequest)},new e.BindingOnSyntax(this._binding)},n.prototype.whenParentTagged=function(o,i){return this._binding.constraint=function(a){return r.taggedConstraint(o)(i)(a.parentRequest)},new e.BindingOnSyntax(this._binding)},n.prototype.whenAnyAncestorIs=function(o){return this._binding.constraint=function(i){return r.traverseAncerstors(i,r.typeConstraint(o))},new e.BindingOnSyntax(this._binding)},n.prototype.whenNoAncestorIs=function(o){return this._binding.constraint=function(i){return!r.traverseAncerstors(i,r.typeConstraint(o))},new e.BindingOnSyntax(this._binding)},n.prototype.whenAnyAncestorNamed=function(o){return this._binding.constraint=function(i){return r.traverseAncerstors(i,r.namedConstraint(o))},new e.BindingOnSyntax(this._binding)},n.prototype.whenNoAncestorNamed=function(o){return this._binding.constraint=function(i){return!r.traverseAncerstors(i,r.namedConstraint(o))},new e.BindingOnSyntax(this._binding)},n.prototype.whenAnyAncestorTagged=function(o,i){return this._binding.constraint=function(a){return r.traverseAncerstors(a,r.taggedConstraint(o)(i))},new e.BindingOnSyntax(this._binding)},n.prototype.whenNoAncestorTagged=function(o,i){return this._binding.constraint=function(a){return!r.traverseAncerstors(a,r.taggedConstraint(o)(i))},new e.BindingOnSyntax(this._binding)},n.prototype.whenAnyAncestorMatches=function(o){return this._binding.constraint=function(i){return r.traverseAncerstors(i,o)},new e.BindingOnSyntax(this._binding)},n.prototype.whenNoAncestorMatches=function(o){return this._binding.constraint=function(i){return!r.traverseAncerstors(i,o)},new e.BindingOnSyntax(this._binding)},n}();C.BindingWhenSyntax=u},function(L,C,t){"use strict";(function(e,r){const u={};L.exports=u;const n="function"==typeof e&&e,o=n?a=>n(a):a=>setTimeout(a,0);function i(a,p,c){try{return a(p,c)}catch(f){r.nextTick(()=>{throw f})}}u.nextTick="object"==typeof r&&"function"==typeof r.nextTick?r.nextTick:o,u.setImmediate=n?o:u.nextTick,u.clone=function(a){if(a&&"object"==typeof a){let p;if(Array.isArray(a)){p=[];for(let c=0;c"[object Object]"===Object.prototype.toString.call(a),u.isUndefined=a=>void 0===a,u.callbackify=a=>async function(...p){const c=p[p.length-1];let f;"function"==typeof c&&p.pop();try{f=await a.apply(null,p)}catch(d){if("function"==typeof c)return i(c,d);throw d}return"function"==typeof c?i(c,null,f):f}}).call(this,t(107).setImmediate,t(27))},function(L,C,t){"use strict";const e=t(31),r=t(32),{isArray:u,isObject:n,isString:o,isUndefined:i}=t(28),{isAbsolute:a,isRelative:p,prependBase:c,parse:f}=t(53),{asArray:d,compareShortestLeast:m}=t(31),y=new Map,b={};function T(O,w,g,S,I,h){if(null===w||!o(w)||b.isKeyword(w))return w;if(S&&S.hasOwnProperty(w)&&!0!==I.get(w)&&b.createTermDefinition({activeCtx:O,localCtx:S,term:w,defined:I,options:h}),(g=g||{}).vocab){const x=O.mappings.get(w);if(null===x)return null;if(x)return x["@id"]}const E=w.indexOf(":");if(E>0){const x=w.substr(0,E),A=w.substr(E+1);if("_"===x||0===A.indexOf("//"))return w;S&&S.hasOwnProperty(x)&&b.createTermDefinition({activeCtx:O,localCtx:S,term:x,defined:I,options:h});const D=O.mappings.get(x);if(D&&D._prefix)return D["@id"]+A;if(a(w))return w}return g.vocab&&"@vocab"in O?O["@vocab"]+w:g.base?c(O["@base"],w):w}function M(O,w){if(!O||"object"!=typeof O||!w||"object"!=typeof w)return O===w;const g=Array.isArray(O);if(g!==Array.isArray(w))return!1;if(g){if(O.length!==w.length)return!1;for(let h=0;h{if(n(w)&&"@context"in w&&u(w["@context"])&&(w=w["@context"]),0===d(w).length)return O;const E=await g.contextResolver.resolve({context:w,documentLoader:g.documentLoader,base:g.base});n(E[0].document)&&"boolean"==typeof E[0].document["@propagate"]&&(S=E[0].document["@propagate"]);let x=O;S||x.previousContext||(x=x.clone(),x.previousContext=O);for(const A of E){let{document:D}=A;if(O=x,null===D){if(!I&&0!==Object.keys(O.protected).length){const U=g&&g.protectedMode||"error";if("error"===U)throw new r("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});if("warn"===U){console.warn("WARNING: invalid context nullification");const Z=O;x=O=b.getInitialContext(g).clone();for(const[ee,Ee]of Object.entries(Z.protected))Ee&&(O.mappings[ee]=e.clone(Z.mappings[ee]));O.protected=e.clone(Z.protected),A.setProcessed(Z,x);continue}throw new r("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:w,protectedMode:U})}x=O=b.getInitialContext(g).clone();continue}const B=A.getProcessed(O);if(B){x=O=B;continue}if(n(D)&&"@context"in D&&(D=D["@context"]),!n(D))throw new r("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:D});x=x.clone();const N=new Map;if("@version"in D){if(1.1!==D["@version"])throw new r("Unsupported JSON-LD version: "+D["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:D});if(O.processingMode&&"json-ld-1.0"===O.processingMode)throw new r("@version: "+D["@version"]+" not compatible with "+O.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:D});x.processingMode="json-ld-1.1",x["@version"]=D["@version"],N.set("@version",!0)}if(x.processingMode=x.processingMode||O.processingMode,"@base"in D){let U=D["@base"];if(null!==U)if(a(U))U=f(U);else{if(!p(U))throw new r('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:D});U=f(c(x["@base"].href,U))}x["@base"]=U,N.set("@base",!0)}if("@vocab"in D){const U=D["@vocab"];if(null===U)delete x["@vocab"];else{if(!o(U))throw new r('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:D});if(!a(U)&&b.processingMode(x,1))throw new r('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:D});x["@vocab"]=T(x,U,{vocab:!0,base:!0},void 0,void 0,g)}N.set("@vocab",!0)}if("@language"in D){const U=D["@language"];if(null===U)delete x["@language"];else{if(!o(U))throw new r('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:D});x["@language"]=U.toLowerCase()}N.set("@language",!0)}if("@propagate"in D){const U=D["@propagate"];if("json-ld-1.0"===O.processingMode)throw new r("Invalid JSON-LD syntax; @propagate not compatible with "+O.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:D});if("boolean"!=typeof U)throw new r("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:w});N.set("@propagate",!0)}N.set("@protected",D["@protected"]||!1);for(const U in D)b.createTermDefinition({activeCtx:x,localCtx:D,term:U,defined:N,options:g,overrideProtected:I});A.setProcessed(O,x)}return x},b.createTermDefinition=({activeCtx:O,localCtx:w,term:g,defined:S,options:I,overrideProtected:h=!1})=>{if(S.has(g)){if(S.get(g))return;throw new r("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:w,term:g})}let E;if(S.set(g,!1),w.hasOwnProperty(g)&&(E=w[g]),"@type"===g&&n(E)&&"@set"===E["@container"]&&b.processingMode(O,1.1)){const Z=["@container","@id","@protected"];if(Object.keys(E).some(ee=>!Z.includes(ee)))throw new r("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:w,term:g})}else{if(b.isKeyword(g))throw new r("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:w,term:g});if(""===g)throw new r("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:w})}const x=O.mappings.get(g);if(O.mappings.has(g)&&O.mappings.delete(g),null===E||n(E)&&null===E["@id"])return O.mappings.set(g,null),void S.set(g,!0);let A=!1;if(o(E)&&(A=!0,E={"@id":E}),!n(E))throw new r("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:w});const D={};O.mappings.set(g,D),D.reverse=!1;const B=["@container","@id","@language","@reverse","@type"];b.processingMode(O,1.1)&&B.push("@context","@index","@nest","@prefix","@protected");for(const Z in E)if(!B.includes(Z))throw new r("Invalid JSON-LD syntax; a term definition must not contain "+Z,"jsonld.SyntaxError",{code:"invalid term definition",context:w});const N=g.indexOf(":");if(D._termHasColon=N>0,"@reverse"in E){if("@id"in E)throw new r("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:w});if("@nest"in E)throw new r("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:w});const Z=E["@reverse"];if(!o(Z))throw new r("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:w});const ee=T(O,Z,{vocab:!0,base:!1},w,S,I);if(!a(ee))throw new r("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:w});D["@id"]=ee,D.reverse=!0}else if("@id"in E){let Z=E["@id"];if(!o(Z))throw new r("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:w});if(Z!==g){if(Z=T(O,Z,{vocab:!0,base:!1},w,S,I),!a(Z)&&!b.isKeyword(Z))throw new r("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:w});D["@id"]=Z,D._prefix=A&&!D._termHasColon&&Z.match(/[:\/\?#\[\]@]$/)}}if(!("@id"in D))if(D._termHasColon){const Z=g.substr(0,N);if(w.hasOwnProperty(Z)&&b.createTermDefinition({activeCtx:O,localCtx:w,term:Z,defined:S,options:I}),O.mappings.has(Z)){const ee=g.substr(N+1);D["@id"]=O.mappings.get(Z)["@id"]+ee}else D["@id"]=g}else if("@type"==g)D["@id"]=g;else{if(!("@vocab"in O))throw new r("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:w,term:g});D["@id"]=O["@vocab"]+g}if((!0===E["@protected"]||!0===S.get("@protected")&&!1!==E["@protected"])&&(O.protected[g]=!0,D.protected=!0),S.set(g,!0),"@type"in E){let Z=E["@type"];if(!o(Z))throw new r("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:w});if("@json"===Z||"@none"===Z){if(b.processingMode(O,1))throw new r(`Invalid JSON-LD syntax; an @context @type value must not be "${Z}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:w})}else if("@id"!==Z&&"@vocab"!==Z){if(Z=T(O,Z,{vocab:!0,base:!1},w,S,I),!a(Z))throw new r("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:w});if(0===Z.indexOf("_:"))throw new r("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:w})}D["@type"]=Z}if("@container"in E){const Z=o(E["@container"])?[E["@container"]]:E["@container"]||[],ee=["@list","@set","@index","@language"];let Ee=!0;const K=Z.includes("@set");if(b.processingMode(O,1.1)){if(ee.push("@graph","@id","@type"),Z.includes("@list")){if(1!==Z.length)throw new r("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:w})}else if(Z.includes("@graph")){if(Z.some(Le=>"@graph"!==Le&&"@id"!==Le&&"@index"!==Le&&"@set"!==Le))throw new r("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:w})}else Ee&=Z.length<=(K?2:1);if(Z.includes("@type")&&(D["@type"]=D["@type"]||"@id",!["@id","@vocab"].includes(D["@type"])))throw new r("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:w})}else Ee&=!u(E["@container"]),Ee&=Z.length<=1;if(Ee&=Z.every(Le=>ee.includes(Le)),Ee&=!(K&&Z.includes("@list")),!Ee)throw new r("Invalid JSON-LD syntax; @context @container value must be one of the following: "+ee.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:w});if(D.reverse&&!Z.every(Le=>["@index","@set"].includes(Le)))throw new r("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:w});D["@container"]=Z}if("@index"in E){if(!("@container"in E)||!D["@container"].includes("@index"))throw new r(`Invalid JSON-LD syntax; @index without @index in @container: "${E["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:w});if(!o(E["@index"])||0===E["@index"].indexOf("@"))throw new r(`Invalid JSON-LD syntax; @index must expand to an IRI: "${E["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:w});D["@index"]=E["@index"]}if("@context"in E&&(D["@context"]=E["@context"]),"@language"in E&&!("@type"in E)){let Z=E["@language"];if(null!==Z&&!o(Z))throw new r("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:w});null!==Z&&(Z=Z.toLowerCase()),D["@language"]=Z}if("@prefix"in E){if(D._termHasColon)throw new r("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:w});if("boolean"!=typeof E["@prefix"])throw new r("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:w});D._prefix=!0===E["@prefix"]}if("@nest"in E){const Z=E["@nest"];if(!o(Z)||"@nest"!==Z&&0===Z.indexOf("@"))throw new r("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:w});D["@nest"]=Z}const U=D["@id"];if("@context"===U||"@preserve"===U)throw new r("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:w});if(x&&x.protected&&!h&&(O.protected[g]=!0,D.protected=!0,!M(x,D))){const Z=I&&I.protectedMode||"error";if("error"===Z)throw new r("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:w,term:g});if("warn"===Z)return void console.warn("WARNING: protected term redefinition",{term:g});throw new r("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:w,term:g,protectedMode:Z})}},b.expandIri=(O,w,g,S)=>T(O,w,g,void 0,void 0,S),b.getInitialContext=O=>{const w=f(O.base||""),g=JSON.stringify({base:w,processingMode:O.processingMode}),S=y.get(g);if(S)return S;const I={"@base":w,processingMode:O.processingMode,mappings:new Map,inverse:null,getInverse:function h(){const B=this;if(B.inverse)return B.inverse;const N=B.inverse={},U=B.fastCurieMap={},Z={},ee=B["@language"]||"@none",Ee=B.mappings,K=[...Ee.keys()].sort(m);for(const Le of K){const Q=Ee.get(Le);if(null===Q)continue;let j=Q["@container"]||"@none";j=[].concat(j).sort().join("");const F=d(Q["@id"]);for(const q of F){let ge=N[q];const we=b.isKeyword(q);if(ge)we||Q._termHasColon||Z[q].push(Le);else if(N[q]=ge={},!we&&!Q._termHasColon){Z[q]=[Le];const he={iri:q,terms:Z[q]};q[0]in U?U[q[0]].push(he):U[q[0]]=[he]}ge[j]||(ge[j]={"@language":{},"@type":{},"@any":{}}),ge=ge[j],x(Le,ge["@any"],"@none"),Q.reverse?x(Le,ge["@type"],"@reverse"):"@none"===Q["@type"]?(x(Le,ge["@any"],"@none"),x(Le,ge["@language"],"@none"),x(Le,ge["@type"],"@none")):"@type"in Q?x(Le,ge["@type"],Q["@type"]):"@language"in Q?x(Le,ge["@language"],Q["@language"]||"@null"):(x(Le,ge["@language"],ee),x(Le,ge["@type"],"@none"),x(Le,ge["@language"],"@none"))}}for(const Le in U)E(U,Le,1);return N},clone:function A(){const B={};return B["@base"]=this["@base"],B.mappings=e.clone(this.mappings),B.clone=this.clone,B.inverse=null,B.getInverse=this.getInverse,B.protected=e.clone(this.protected),this.previousContext&&(B.previousContext=this.previousContext.clone()),B.revertToPreviousContext=this.revertToPreviousContext,"@language"in this&&(B["@language"]=this["@language"]),"@vocab"in this&&(B["@vocab"]=this["@vocab"]),B},revertToPreviousContext:function D(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===y.size&&y.clear(),y.set(g,I),I;function E(B,N,U){const Z=B[N],ee=B[N]={};let Ee,K;for(const Le of Z)Ee=Le.iri,K=U>=Ee.length?"":Ee[U],K in ee?ee[K].push(Le):ee[K]=[Le];for(const Le in ee)""!==Le&&E(ee,Le,U+1)}function x(B,N,U){N.hasOwnProperty(U)||(N[U]=B)}},b.getContextValue=(O,w,g)=>{if(null===w)return"@context"===g?void 0:null;if(O.mappings.has(w)){const S=O.mappings.get(w);if(i(g))return S;if(S.hasOwnProperty(g))return S[g]}return"@language"===g&&O.hasOwnProperty(g)?O[g]:"@context"!==g?null:void 0},b.processingMode=(O,w)=>w.toString()>="1.1"?!O.processingMode||O.processingMode>="json-ld-"+w.toString():"json-ld-1.0"===O.processingMode,b.isKeyword=O=>{if(!o(O)||"@"!==O[0])return!1;switch(O){case"@base":case"@container":case"@context":case"@default":case"@embed":case"@explicit":case"@graph":case"@id":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}},function(L,C,t){L.exports=t(4),t(49),t(199),t(38),t(112),t(148),t(74),t(201),t(66),t(203),t(150),t(204),t(147),t(114),t(54),t(143),t(145),t(205),t(139),t(144),t(141),t(117),t(33),t(142),t(206),t(207),t(138),t(8)},function(L,C,t){var e=t(4);function r(v,b){e.cipher.registerAlgorithm(v,function(){return new e.aes.Algorithm(v,b)})}t(112),t(137),t(8),L.exports=e.aes=e.aes||{},e.aes.startEncrypting=function(v,b,T,M){var O=y({key:v,output:T,decrypt:!1,mode:M});return O.start(b),O},e.aes.createEncryptionCipher=function(v,b){return y({key:v,output:null,decrypt:!1,mode:b})},e.aes.startDecrypting=function(v,b,T,M){var O=y({key:v,output:T,decrypt:!0,mode:M});return O.start(b),O},e.aes.createDecryptionCipher=function(v,b){return y({key:v,output:null,decrypt:!0,mode:b})},e.aes.Algorithm=function(v,b){u||f();var T=this;T.name=v,T.mode=new b({blockSize:16,cipher:{encrypt:function(M,O){return m(T._w,M,O,!1)},decrypt:function(M,O){return m(T._w,M,O,!0)}}}),T._init=!1},e.aes.Algorithm.prototype.initialize=function(v){if(!this._init){var T,b=v.key;if("string"!=typeof b||16!==b.length&&24!==b.length&&32!==b.length){if(e.util.isArray(b)&&(16===b.length||24===b.length||32===b.length)){T=b,b=e.util.createBuffer();for(var M=0;M>>=2,M=0;M>8^255&S^99,o[T]=S,i[S]=T,h=(I=v[S])<<24^S<<16^S<<8^S^I,E=((O=v[T])^(w=v[O])^(g=v[w]))<<24^(T^g)<<16^(T^w^g)<<8^T^O^g;for(var x=0;x<4;++x)p[x][T]=h,c[x][S]=E,h=h<<24|h>>>8,E=E<<24|E>>>8;0===T?T=M=1:(T=O^v[v[v[O^g]]],M^=v[v[M]])}}function d(v,b){for(var M,T=v.slice(0),O=1,w=T.length,S=4*(w+6+1),I=w;I>>16&255]<<24^o[M>>>8&255]<<16^o[255&M]<<8^o[M>>>24]^a[O]<<24,O++):w>6&&I%w==4&&(M=o[M>>>24]<<24^o[M>>>16&255]<<16^o[M>>>8&255]<<8^o[255&M]),T[I]=T[I-w]^M;if(b){for(var h,E=c[0],x=c[1],A=c[2],D=c[3],B=T.slice(0),N=(I=0,(S=T.length)-4);I>>24]]^x[o[h>>>16&255]]^A[o[h>>>8&255]]^D[o[255&h]];T=B}return T}function m(v,b,T,M){var w,g,S,I,h,E,x,A,D,B,N,U,O=v.length/4-1;M?(w=c[0],g=c[1],S=c[2],I=c[3],h=i):(w=p[0],g=p[1],S=p[2],I=p[3],h=o),E=b[0]^v[0],x=b[M?3:1]^v[1],A=b[2]^v[2],D=b[M?1:3]^v[3];for(var Z=3,ee=1;ee>>24]^g[x>>>16&255]^S[A>>>8&255]^I[255&D]^v[++Z],N=w[x>>>24]^g[A>>>16&255]^S[D>>>8&255]^I[255&E]^v[++Z],U=w[A>>>24]^g[D>>>16&255]^S[E>>>8&255]^I[255&x]^v[++Z],D=w[D>>>24]^g[E>>>16&255]^S[x>>>8&255]^I[255&A]^v[++Z],E=B,x=N,A=U;T[0]=h[E>>>24]<<24^h[x>>>16&255]<<16^h[A>>>8&255]<<8^h[255&D]^v[++Z],T[M?3:1]=h[x>>>24]<<24^h[A>>>16&255]<<16^h[D>>>8&255]<<8^h[255&E]^v[++Z],T[2]=h[A>>>24]<<24^h[D>>>16&255]<<16^h[E>>>8&255]<<8^h[255&x]^v[++Z],T[M?1:3]=h[D>>>24]<<24^h[E>>>16&255]<<16^h[x>>>8&255]<<8^h[255&A]^v[++Z]}function y(v){var M,T="AES-"+((v=v||{}).mode||"CBC").toUpperCase(),O=(M=v.decrypt?e.cipher.createDecipher(T,v.key):e.cipher.createCipher(T,v.key)).start;return M.start=function(w,g){var S=null;g instanceof e.util.ByteBuffer&&(S=g,g={}),(g=g||{}).output=S,g.iv=w,O.call(M,g)},M}},function(L,C,t){var e=t(4);e.pki=e.pki||{};var r=L.exports=e.pki.oids=e.oids=e.oids||{};function u(o,i){r[o]=i,r[i]=o}function n(o,i){r[o]=i}u("1.2.840.113549.1.1.1","rsaEncryption"),u("1.2.840.113549.1.1.4","md5WithRSAEncryption"),u("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),u("1.2.840.113549.1.1.7","RSAES-OAEP"),u("1.2.840.113549.1.1.8","mgf1"),u("1.2.840.113549.1.1.9","pSpecified"),u("1.2.840.113549.1.1.10","RSASSA-PSS"),u("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),u("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),u("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),u("1.3.101.112","EdDSA25519"),u("1.2.840.10040.4.3","dsa-with-sha1"),u("1.3.14.3.2.7","desCBC"),u("1.3.14.3.2.26","sha1"),u("2.16.840.1.101.3.4.2.1","sha256"),u("2.16.840.1.101.3.4.2.2","sha384"),u("2.16.840.1.101.3.4.2.3","sha512"),u("1.2.840.113549.2.5","md5"),u("1.2.840.113549.1.7.1","data"),u("1.2.840.113549.1.7.2","signedData"),u("1.2.840.113549.1.7.3","envelopedData"),u("1.2.840.113549.1.7.4","signedAndEnvelopedData"),u("1.2.840.113549.1.7.5","digestedData"),u("1.2.840.113549.1.7.6","encryptedData"),u("1.2.840.113549.1.9.1","emailAddress"),u("1.2.840.113549.1.9.2","unstructuredName"),u("1.2.840.113549.1.9.3","contentType"),u("1.2.840.113549.1.9.4","messageDigest"),u("1.2.840.113549.1.9.5","signingTime"),u("1.2.840.113549.1.9.6","counterSignature"),u("1.2.840.113549.1.9.7","challengePassword"),u("1.2.840.113549.1.9.8","unstructuredAddress"),u("1.2.840.113549.1.9.14","extensionRequest"),u("1.2.840.113549.1.9.20","friendlyName"),u("1.2.840.113549.1.9.21","localKeyId"),u("1.2.840.113549.1.9.22.1","x509Certificate"),u("1.2.840.113549.1.12.10.1.1","keyBag"),u("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),u("1.2.840.113549.1.12.10.1.3","certBag"),u("1.2.840.113549.1.12.10.1.4","crlBag"),u("1.2.840.113549.1.12.10.1.5","secretBag"),u("1.2.840.113549.1.12.10.1.6","safeContentsBag"),u("1.2.840.113549.1.5.13","pkcs5PBES2"),u("1.2.840.113549.1.5.12","pkcs5PBKDF2"),u("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),u("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),u("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),u("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),u("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),u("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),u("1.2.840.113549.2.7","hmacWithSHA1"),u("1.2.840.113549.2.8","hmacWithSHA224"),u("1.2.840.113549.2.9","hmacWithSHA256"),u("1.2.840.113549.2.10","hmacWithSHA384"),u("1.2.840.113549.2.11","hmacWithSHA512"),u("1.2.840.113549.3.7","des-EDE3-CBC"),u("2.16.840.1.101.3.4.1.2","aes128-CBC"),u("2.16.840.1.101.3.4.1.22","aes192-CBC"),u("2.16.840.1.101.3.4.1.42","aes256-CBC"),u("2.5.4.3","commonName"),u("2.5.4.5","serialName"),u("2.5.4.6","countryName"),u("2.5.4.7","localityName"),u("2.5.4.8","stateOrProvinceName"),u("2.5.4.9","streetAddress"),u("2.5.4.10","organizationName"),u("2.5.4.11","organizationalUnitName"),u("2.5.4.13","description"),u("2.5.4.15","businessCategory"),u("2.5.4.17","postalCode"),u("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),u("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),u("2.16.840.1.113730.1.1","nsCertType"),u("2.16.840.1.113730.1.13","nsComment"),n("2.5.29.1","authorityKeyIdentifier"),n("2.5.29.2","keyAttributes"),n("2.5.29.3","certificatePolicies"),n("2.5.29.4","keyUsageRestriction"),n("2.5.29.5","policyMapping"),n("2.5.29.6","subtreesConstraint"),n("2.5.29.7","subjectAltName"),n("2.5.29.8","issuerAltName"),n("2.5.29.9","subjectDirectoryAttributes"),n("2.5.29.10","basicConstraints"),n("2.5.29.11","nameConstraints"),n("2.5.29.12","policyConstraints"),n("2.5.29.13","basicConstraints"),u("2.5.29.14","subjectKeyIdentifier"),u("2.5.29.15","keyUsage"),n("2.5.29.16","privateKeyUsagePeriod"),u("2.5.29.17","subjectAltName"),u("2.5.29.18","issuerAltName"),u("2.5.29.19","basicConstraints"),n("2.5.29.20","cRLNumber"),n("2.5.29.21","cRLReason"),n("2.5.29.22","expirationDate"),n("2.5.29.23","instructionCode"),n("2.5.29.24","invalidityDate"),n("2.5.29.25","cRLDistributionPoints"),n("2.5.29.26","issuingDistributionPoint"),n("2.5.29.27","deltaCRLIndicator"),n("2.5.29.28","issuingDistributionPoint"),n("2.5.29.29","certificateIssuer"),n("2.5.29.30","nameConstraints"),u("2.5.29.31","cRLDistributionPoints"),u("2.5.29.32","certificatePolicies"),n("2.5.29.33","policyMappings"),n("2.5.29.34","policyConstraints"),u("2.5.29.35","authorityKeyIdentifier"),n("2.5.29.36","policyConstraints"),u("2.5.29.37","extKeyUsage"),n("2.5.29.46","freshestCRL"),n("2.5.29.54","inhibitAnyPolicy"),u("1.3.6.1.4.1.11129.2.4.2","timestampList"),u("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),u("1.3.6.1.5.5.7.3.1","serverAuth"),u("1.3.6.1.5.5.7.3.2","clientAuth"),u("1.3.6.1.5.5.7.3.3","codeSigning"),u("1.3.6.1.5.5.7.3.4","emailProtection"),u("1.3.6.1.5.5.7.3.8","timeStamping")},function(L,C,t){"use strict";t.d(C,"a",function(){return e});var e=function(){function r(){}return r.TRACE_ID="trace_id",r}()},function(L,C,t){var e=t(4);t(36),t(8);var r=L.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=r,r.create=function(){n||function o(){u=String.fromCharCode(128),u+=e.util.fillString(String.fromCharCode(0),64),n=!0}();var a=null,p=e.util.createBuffer(),c=new Array(80),f={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength64=[];for(var d=f.messageLengthSize/4,m=0;m>>0,y>>>0];for(var v=f.fullMessageLength.length-1;v>=0;--v)f.fullMessageLength[v]+=y[1],y[1]=y[0]+(f.fullMessageLength[v]/4294967296>>>0),f.fullMessageLength[v]=f.fullMessageLength[v]>>>0,y[0]=y[1]/4294967296>>>0;return p.putBytes(d),i(a,c,p),(p.read>2048||0===p.length())&&p.compact(),f},f.digest=function(){var v,d=e.util.createBuffer();d.putBytes(p.bytes()),d.putBytes(u.substr(0,f.blockLength-(f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1)));for(var T=8*f.fullMessageLength[0],M=0;M>>0,d.putInt32(T>>>0),T=v>>>0;d.putInt32(T);var O={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4};i(O,c,d);var w=e.util.createBuffer();return w.putInt32(O.h0),w.putInt32(O.h1),w.putInt32(O.h2),w.putInt32(O.h3),w.putInt32(O.h4),w},f};var u=null,n=!1;function i(a,p,c){for(var f,d,m,y,v,b,M,O=c.length();O>=64;){for(d=a.h0,m=a.h1,y=a.h2,v=a.h3,b=a.h4,M=0;M<16;++M)f=c.getInt32(),p[M]=f,f=(d<<5|d>>>27)+(v^m&(y^v))+b+1518500249+f,b=v,v=y,y=(m<<30|m>>>2)>>>0,m=d,d=f;for(;M<20;++M)f=(f=p[M-3]^p[M-8]^p[M-14]^p[M-16])<<1|f>>>31,p[M]=f,f=(d<<5|d>>>27)+(v^m&(y^v))+b+1518500249+f,b=v,v=y,y=(m<<30|m>>>2)>>>0,m=d,d=f;for(;M<32;++M)f=(f=p[M-3]^p[M-8]^p[M-14]^p[M-16])<<1|f>>>31,p[M]=f,f=(d<<5|d>>>27)+(m^y^v)+b+1859775393+f,b=v,v=y,y=(m<<30|m>>>2)>>>0,m=d,d=f;for(;M<40;++M)f=(f=p[M-6]^p[M-16]^p[M-28]^p[M-32])<<2|f>>>30,p[M]=f,f=(d<<5|d>>>27)+(m^y^v)+b+1859775393+f,b=v,v=y,y=(m<<30|m>>>2)>>>0,m=d,d=f;for(;M<60;++M)f=(f=p[M-6]^p[M-16]^p[M-28]^p[M-32])<<2|f>>>30,p[M]=f,f=(d<<5|d>>>27)+(m&y|v&(m^y))+b+2400959708+f,b=v,v=y,y=(m<<30|m>>>2)>>>0,m=d,d=f;for(;M<80;++M)f=(f=p[M-6]^p[M-16]^p[M-28]^p[M-32])<<2|f>>>30,p[M]=f,f=(d<<5|d>>>27)+(m^y^v)+b+3395469782+f,b=v,v=y,y=(m<<30|m>>>2)>>>0,m=d,d=f;a.h0=a.h0+d|0,a.h1=a.h1+m|0,a.h2=a.h2+y|0,a.h3=a.h3+v|0,a.h4=a.h4+b|0,O-=64}}},function(L,C,t){"use strict";const e=t(28),r={};L.exports=r,r.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(n,o)=>{const i={},a=r.parsers[o||"full"],p=a.regex.exec(n);let c=a.keys.length;for(;c--;)i[a.keys[c]]=void 0===p[c]?null:p[c];return("https"===i.scheme&&"443"===i.port||"http"===i.scheme&&"80"===i.port)&&(i.href=i.href.replace(":"+i.port,""),i.authority=i.authority.replace(":"+i.port,""),i.port=null),i.normalizedPath=r.removeDotSegments(i.path),i},r.prependBase=(n,o)=>{if(null===n||r.isAbsolute(o))return o;e.isString(n)&&(n=r.parse(n||""));const i=r.parse(o),a={protocol:n.protocol||""};if(null!==i.authority)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=n.authority,""===i.path)a.path=n.path,a.query=null!==i.query?i.query:n.query;else{if(0===i.path.indexOf("/"))a.path=i.path;else{let c=n.path;c=c.substr(0,c.lastIndexOf("/")+1),c.length>0&&"/"!==c.substr(-1)&&(c+="/"),c+=i.path,a.path=c}a.query=i.query}""!==i.path&&(a.path=r.removeDotSegments(a.path));let p=a.protocol;return null!==a.authority&&(p+="//"+a.authority),p+=a.path,null!==a.query&&(p+="?"+a.query),null!==i.fragment&&(p+="#"+i.fragment),""===p&&(p="./"),p},r.removeBase=(n,o)=>{if(null===n)return o;e.isString(n)&&(n=r.parse(n||""));let i="";if(""!==n.href?i+=(n.protocol||"")+"//"+(n.authority||""):o.indexOf("//")&&(i+="//"),0!==o.indexOf(i))return o;const a=r.parse(o.substr(i.length)),p=n.normalizedPath.split("/"),c=a.normalizedPath.split("/"),f=a.fragment||a.query?0:1;for(;p.length>0&&c.length>f&&p[0]===c[0];)p.shift(),c.shift();let d="";if(p.length>0){p.pop();for(let m=0;m{if(0===n.length)return"";const o=n.split("/"),i=[];for(;o.length>0;){const a=o.shift(),p=0===o.length;"."!==a?".."!==a?i.push(a):(i.pop(),p&&i.push("")):p&&i.push("")}return i.length>0&&""!==i[0]&&i.unshift(""),1===i.length&&""===i[0]?"/":i.join("/")};const u=/^([A-Za-z][A-Za-z0-9+-.]*|_):/;r.isAbsolute=n=>e.isString(n)&&u.test(n),r.isRelative=n=>e.isString(n)},function(L,C,t){var e=t(4);t(8);var r=L.exports=e.pem=e.pem||{};function u(o){for(var i=o.name+": ",a=[],p=function(y,v){return" "+v},c=0;c65&&-1!==d){var m=i[d];","===m?(++d,i=i.substr(0,d)+"\r\n "+i.substr(d)):i=i.substr(0,d)+"\r\n"+m+i.substr(d+1),f=c-d-1,d=-1,++c}else" "!==i[c]&&"\t"!==i[c]&&","!==i[c]||(d=c);return i}function n(o){return o.replace(/^\s+/,"")}r.encode=function(o,i){i=i||{};var p,a="-----BEGIN "+o.type+"-----\r\n";if(o.procType&&(a+=u(p={name:"Proc-Type",values:[String(o.procType.version),o.procType.type]})),o.contentDomain&&(a+=u(p={name:"Content-Domain",values:[o.contentDomain]})),o.dekInfo&&(p={name:"DEK-Info",values:[o.dekInfo.algorithm]},o.dekInfo.parameters&&p.values.push(o.dekInfo.parameters),a+=u(p)),o.headers)for(var c=0;c0)&&F.push(xe[Ne]);const Ke=F.length>0;if(1===F.length&&(F=F[0]),T(he)){const Ne=h({activeCtx:we,iri:"@graph",relativeTo:{vocab:!0}}),$e=he;he={},Ke&&(he["@context"]=F),he[Ne]=$e}else if(M(he)&&Ke){const Ne=he;he={"@context":F};for(const $e in Ne)he[$e]=Ne[$e]}if(q.framing){const Ne=h({activeCtx:we,iri:"@graph",relativeTo:{vocab:!0}});q.link={},he[Ne]=E(we,he[Ne],q)}return he},ee.expand=async function(j,F){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(F=Q(F,{keepFreeFloatingNodes:!1,contextResolver:new o({sharedCache:Le})})).expansionMap&&(F.expansionMap=void 0);const q={},ge=[];if("expandContext"in F){const Ke=n.clone(F.expandContext);q.expandContext=M(Ke)&&"@context"in Ke?Ke:{"@context":Ke},ge.push(q.expandContext)}let we;if(O(j)){const Ke=await ee.get(j,F);we=Ke.documentUrl,q.input=Ke.document,Ke.contextUrl&&(q.remoteContext={"@context":Ke.contextUrl},ge.push(q.remoteContext))}else q.input=n.clone(j);"base"in F||(F.base=we||"");let he=g(F);for(const Ke of ge)he=await S({activeCtx:he,localCtx:Ke,options:F});let xe=await d({activeCtx:he,element:q.input,options:F,expansionMap:F.expansionMap});return M(xe)&&"@graph"in xe&&1===Object.keys(xe).length?xe=xe["@graph"]:null===xe&&(xe=[]),T(xe)||(xe=[xe]),xe},ee.flatten=async function(j,F,q){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");F="function"==typeof F?null:F||null,q=Q(q,{base:O(j)?j:"",contextResolver:new o({sharedCache:Le})});const ge=await ee.expand(j,q),we=m(ge);return null===F?we:(q.graph=!0,q.skipExpansion=!0,await ee.compact(we,F,q))},ee.frame=async function(j,F,q){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(q=Q(q,{base:O(j)?j:"",embed:"@last",explicit:!1,requireAll:!0,omitDefault:!1,pruneBlankNodeIdentifiers:!0,bnodesToClear:[],contextResolver:new o({sharedCache:Le})}),O(F)){const $e=await ee.get(F,q);if(F=$e.document,$e.contextUrl){let G=F["@context"];G?T(G)?G.push($e.contextUrl):G=[G,$e.contextUrl]:G=$e.contextUrl,F["@context"]=G}}const ge=F&&F["@context"]||{},we=await ee.expand(j,q),he={...q};he.isFrame=!0,he.keepFreeFloatingNodes=!0;const xe=await ee.expand(F,he);he.merged=!("@graph"in F);const Ke=b(we,xe,he);return he.graph=!0,he.skipExpansion=!0,he.link={},he.framing=!0,await ee.compact(Ke,ge,he)},ee.link=async function(j,F,q){const ge={};return F&&(ge["@context"]=F),ge["@embed"]="@link",ee.frame(j,ge,q)},ee.normalize=ee.canonize=async function(j,F){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(F=Q(F,{base:O(j)?j:"",algorithm:"URDNA2015",skipExpansion:!1,contextResolver:new o({sharedCache:Le})}))){if("application/n-quads"!==F.inputFormat&&"application/nquads"!==F.inputFormat)throw new a("Unknown canonicalization input format.","jsonld.CanonizeError");const we=c.parse(j);return u.canonize(we,F)}const q={...F};delete q.format,q.produceGeneralizedRdf=!1;const ge=await ee.toRDF(j,q);return u.canonize(ge,F)},ee.fromRDF=async function(j,F){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");F=Q(F,{format:O(j)?"application/n-quads":void 0});const{format:q}=F;let{rdfParser:ge}=F;if(q){if(ge=ge||Ee[q],!ge)throw new a("Unknown input format.","jsonld.UnknownFormat",{format:q})}else ge=()=>j;const we=await ge(j);return y(we,F)},ee.toRDF=async function(j,F){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let q;q=(F=Q(F,{base:O(j)?j:"",skipExpansion:!1,contextResolver:new o({sharedCache:Le})})).skipExpansion?j:await ee.expand(j,F);const ge=v(q,F);if(F.format){if("application/n-quads"===F.format||"application/nquads"===F.format)return await c.serialize(ge);throw new a("Unknown output format.","jsonld.UnknownFormat",{format:F.format})}return ge},ee.createNodeMap=async function(j,F){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");F=Q(F,{base:O(j)?j:"",contextResolver:new o({sharedCache:Le})});const q=await ee.expand(j,F);return A(q,F)},ee.merge=async function(j,F,q){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!T(j))throw new TypeError('Could not merge, "docs" must be an array.');F="function"==typeof F?null:F||null,q=Q(q,{contextResolver:new o({sharedCache:Le})});const ge=await Promise.all(j.map(k=>{const se={...q};return ee.expand(k,se)}));let we=!0;"mergeNodes"in q&&(we=q.mergeNodes);const he=q.issuer||new i("_:b"),xe={"@default":{}};for(let k=0;kee._documentLoader,set:j=>ee._documentLoader=j}),ee.documentLoader=async j=>{throw new a("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:j})},ee.get=async function(j,F){let q;q="function"==typeof F.documentLoader?F.documentLoader:ee.documentLoader;const ge=await q(j);try{if(!ge.document)throw new a("No remote document found at the given URL.","jsonld.NullRemoteDocument");O(ge.document)&&(ge.document=JSON.parse(ge.document))}catch(we){throw new a("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:we,remoteDoc:ge})}return ge},ee.processContext=async function(j,F,q){return q=Q(q,{base:"",contextResolver:new o({sharedCache:Le})}),null===F?g(q):(F=n.clone(F),M(F)&&"@context"in F||(F={"@context":F}),S({activeCtx:j,localCtx:F,options:q}))},ee.getContextValue=t(47).getContextValue,ee.documentLoaders={},ee.documentLoaders.node=t(185),ee.documentLoaders.xhr=t(188),ee.useDocumentLoader=function(j){if(!(j in ee.documentLoaders))throw new a('Unknown document loader type: "'+j+'"',"jsonld.UnknownDocumentLoader",{type:j});ee.documentLoader=ee.documentLoaders[j].apply(ee,Array.prototype.slice.call(arguments,1))},ee.registerRDFParser=function(j,F){Ee[j]=F},ee.unregisterRDFParser=function(j){delete Ee[j]},ee.registerRDFParser("application/n-quads",c.parse),ee.registerRDFParser("application/nquads",c.parse),ee.registerRDFParser("rdfa-api",f.parse),ee.url=t(53),ee.util=n,Object.assign(ee,n),ee.promises=ee,ee.RequestQueue=t(111),ee.JsonLdProcessor=t(189)(ee),N&&void 0===r.JsonLdProcessor&&Object.defineProperty(r,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:ee.JsonLdProcessor}),B?ee.useDocumentLoader("node"):typeof XMLHttpRequest<"u"&&ee.useDocumentLoader("xhr"),ee},Z=function(){return U(function(){return Z()})};U(Z),L.exports=Z}).call(this,t(27),t(41))},function(L,C,t){"use strict";const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#",r="http://www.w3.org/2001/XMLSchema#";L.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",RDF:e,RDF_LIST:e+"List",RDF_FIRST:e+"first",RDF_REST:e+"rest",RDF_NIL:e+"nil",RDF_TYPE:e+"type",RDF_PLAIN_LITERAL:e+"PlainLiteral",RDF_XML_LITERAL:e+"XMLLiteral",RDF_JSON_LITERAL:e+"JSON",RDF_OBJECT:e+"object",RDF_LANGSTRING:e+"langString",XSD:r,XSD_BOOLEAN:r+"boolean",XSD_DOUBLE:r+"double",XSD_INTEGER:r+"integer",XSD_STRING:r+"string"}},function(L,C,t){var e=t(4);t(36),t(8),(L.exports=e.hmac=e.hmac||{}).create=function(){var u=null,n=null,o=null,i=null,a={start:function(p,c){if(null!==p)if("string"==typeof p){if(!((p=p.toLowerCase())in e.md.algorithms))throw new Error('Unknown hash algorithm "'+p+'"');n=e.md.algorithms[p].create()}else n=p;if(null===c)c=u;else{if("string"==typeof c)c=e.util.createBuffer(c);else if(e.util.isArray(c)){var f=c;c=e.util.createBuffer();for(var d=0;dn.blockLength&&(n.start(),n.update(c.bytes()),c=n.digest()),o=e.util.createBuffer(),i=e.util.createBuffer(),m=c.length(),d=0;d{const c=(p=p||{}).issuer||new n.IdentifierIssuer("_:b"),f={"@default":{}};return i.createNodeMap(a,f,"@default",c),i.mergeNodeMaps(f)},i.createNodeMap=(a,p,c,f,d,m)=>{if(u.isArray(a)){for(const T of a)i.createNodeMap(T,p,c,f,void 0,m);return}if(!u.isObject(a))return void(m&&m.push(a));if(r.isValue(a)){if("@type"in a){let T=a["@type"];0===T.indexOf("_:")&&(a["@type"]=T=f.getId(T))}return void(m&&m.push(a))}if(m&&r.isList(a)){const T=[];return i.createNodeMap(a["@list"],p,c,f,d,T),void m.push({"@list":T})}if("@type"in a){const T=a["@type"];for(const M of T)0===M.indexOf("_:")&&f.getId(M)}u.isUndefined(d)&&(d=r.isBlankNode(a)?f.getId(a["@id"]):a["@id"]),m&&m.push({"@id":d});const y=p[c],v=y[d]=y[d]||{};v["@id"]=d;const b=Object.keys(a).sort();for(let T of b){if("@id"===T)continue;if("@reverse"===T){const O={"@id":d},w=a["@reverse"];for(const g in w){const S=w[g];for(const I of S){let h=I["@id"];r.isBlankNode(I)&&(h=f.getId(h)),i.createNodeMap(I,p,c,f,h),n.addValue(y[h],g,O,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===T){d in p||(p[d]={}),i.createNodeMap(a[T],p,d,f);continue}if("@type"!==T&&e(T)){if("@index"===T&&T in v&&(a[T]!==v[T]||a[T]["@id"]!==v[T]["@id"]))throw new o("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:v});v[T]=a[T];continue}const M=a[T];if(0===T.indexOf("_:")&&(T=f.getId(T)),0!==M.length)for(let O of M)if("@type"===T&&(O=0===O.indexOf("_:")?f.getId(O):O),r.isSubject(O)||r.isSubjectReference(O)){const w=r.isBlankNode(O)?f.getId(O["@id"]):O["@id"];n.addValue(v,T,{"@id":w},{propertyIsArray:!0,allowDuplicate:!1}),i.createNodeMap(O,p,c,f,w)}else if(r.isValue(O))n.addValue(v,T,O,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(O)){const w=[];i.createNodeMap(O["@list"],p,c,f,d,w),O={"@list":w},n.addValue(v,T,O,{propertyIsArray:!0,allowDuplicate:!1})}else i.createNodeMap(O,p,c,f,d),n.addValue(v,T,O,{propertyIsArray:!0,allowDuplicate:!1});else n.addValue(v,T,[],{propertyIsArray:!0})}},i.mergeNodeMapGraphs=a=>{const p={};for(const c of Object.keys(a).sort())for(const f of Object.keys(a[c]).sort()){const d=a[c][f];f in p||(p[f]={"@id":f});const m=p[f];for(const y of Object.keys(d).sort())if(e(y))m[y]=n.clone(d[y]);else for(const v of d[y])n.addValue(m,y,n.clone(v),{propertyIsArray:!0,allowDuplicate:!1})}return p},i.mergeNodeMaps=a=>{const p=a["@default"],c=Object.keys(a).sort();for(const f of c){if("@default"===f)continue;const d=a[f];let m=p[f];m?"@graph"in m||(m["@graph"]=[]):p[f]=m={"@id":f,"@graph":[]};const y=m["@graph"];for(const v of Object.keys(d).sort()){const b=d[v];r.isSubjectReference(b)||y.push(b)}}return p}},function(L,C,t){"use strict";const e=t(63),r=t(64),u=t(135);L.exports=class extends u{constructor({term:o,controller:i,date:a,maxTimestampDelta:p=1/0}={}){if(super({term:o,date:a,maxTimestampDelta:p}),void 0!==i){if("object"!=typeof i)throw new TypeError('"controller" must be an object.');this.controller=i}}async validate(o,{verificationMethod:i,documentLoader:a,expansionMap:p}){try{const c=await super.validate(o,{verificationMethod:i,documentLoader:a,expansionMap:p});if(!c.valid)throw c.error;const{id:f}=i;if(this.controller)c.controller=this.controller;else{const{controller:m,owner:y}=i;let v;if(m)if("object"==typeof m)v=m.id;else{if("string"!=typeof m)throw new TypeError('"controller" must be a string representing a URL.');v=m}else if(y)if("object"==typeof y)v=y.id;else{if("string"!=typeof y)throw new TypeError('"owner" must be a string representing a URL.');v=y}const{"@graph":[b={}]}=await r.frame(v,{"@context":e.SECURITY_CONTEXT_URL,id:v,[this.term]:{"@embed":"@never",id:f}},{documentLoader:a,compactToRelative:!1});c.controller=b}const d=r.getValues(c.controller,this.term);if(c.valid=d.some(m=>m===f||"object"==typeof m&&m.id===f),!c.valid)throw new Error(`Verification method "${i.id}" not authorized by controller for proof purpose "${this.term}".`);return c}catch(c){return{valid:!1,error:c}}}}},function(L,C,t){"use strict";(function(e,r){const u=t(136),n=t(48),o=t(208),{pki:{ed25519:i},util:{binary:{base58:a}}}=n,p=t(210),c=t(118);class f extends c{constructor(v={}){super(v),this.type="Ed25519VerificationKey2018",this.privateKeyBase58=v.privateKeyBase58,this.publicKeyBase58=v.publicKeyBase58}get publicKey(){return this.publicKeyBase58}get privateKey(){return this.privateKeyBase58}static async generate(v={}){if(u.nodejs&&t(120).gte(e.version,"12.0.0")){const O=t(55),{asn1:w,ed25519:{privateKeyFromAsn1:g,publicKeyFromAsn1:S},util:{ByteBuffer:I}}=n,{promisify:h}=t(211),{createPublicKey:E,generateKeyPair:x}=t(67),A={format:"der",type:"spki"},D={format:"der",type:"pkcs8"};if(!("seed"in v)){const Le=h(x),{publicKey:Q,privateKey:j}=await Le("ed25519",{publicKeyEncoding:A,privateKeyEncoding:D}),F=S(w.fromDer(new I(Q))),{privateKeyBytes:q}=g(w.fromDer(new I(j)));return new f({publicKeyBase58:O.encode(F),privateKeyBase58:O.encode(r.concat([q,F])),...v})}const{seed:B}=v;let N;if((B instanceof Uint8Array||r.isBuffer(B))&&(N=r.from(B)),!r.isBuffer(N)||32!==N.length)throw new TypeError("`seed` must be a 32 byte Buffer or Uint8Array.");const Z=t(151).create({seedBytes:N}),ee=E(Z),Ee=S(w.fromDer(new I(ee.export(A)))),{privateKeyBytes:K}=g(w.fromDer(new I(Z.export(D))));return new f({publicKeyBase58:O.encode(Ee),privateKeyBase58:O.encode(r.concat([K,Ee])),...v})}if(u.nodejs){const O=t(121),w=t(55),g=new r.alloc(O.crypto_sign_PUBLICKEYBYTES),S=new r.alloc(O.crypto_sign_SECRETKEYBYTES);return"seed"in v?O.crypto_sign_seed_keypair(g,S,v.seed):O.crypto_sign_keypair(g,S),new f({publicKeyBase58:w.encode(g),privateKeyBase58:w.encode(S),...v})}const b={};"seed"in v&&(b.seed=v.seed);const{publicKey:T,privateKey:M}=i.generateKeyPair(b);return new f({publicKeyBase58:a.encode(T),privateKeyBase58:a.encode(M),...v})}static async from(v){return new f({privateKeyBase58:v.privateKeyBase58||v.privateKey&&v.privateKey.privateKeyBase58,type:v.type||v.keyType,...v})}signer(){return function d(y){if(!y.privateKeyBase58)return{async sign(){throw new Error("No private key to sign with.")}};if(u.nodejs&&t(120).gte(e.version,"12.0.0")){const b=t(55),T=p.base58Decode({decode:b.decode,keyMaterial:y.privateKeyBase58,type:"private"}),O=t(151).create({privateKeyBytes:T}),{sign:w}=t(67);return{sign:async({data:g})=>w(null,r.from(g.buffer,g.byteOffset,g.length),O)}}if(u.nodejs){const b=t(121),T=t(55),M=p.base58Decode({decode:T.decode,keyMaterial:y.privateKeyBase58,type:"private"});return{async sign({data:O}){const w=r.alloc(b.crypto_sign_BYTES);return await b.crypto_sign_detached(w,r.from(O.buffer,O.byteOffset,O.length),M),w}}}const v=p.base58Decode({decode:a.decode,keyMaterial:y.privateKeyBase58,type:"private"});return{sign:async({data:b})=>i.sign({message:b,privateKey:v})}}(this)}verifier(){return function m(y){if(u.nodejs&&t(120).gte(e.version,"12.0.0")){const b=t(55),T=p.base58Decode({decode:b.decode,keyMaterial:y.publicKeyBase58,type:"public"}),O=t(212).create({publicKeyBytes:T}),{verify:w}=t(67);return{verify:async({data:g,signature:S})=>w(null,r.from(g.buffer,g.byteOffset,g.length),O,S)}}if(u.nodejs){const b=t(121),T=t(55),M=p.base58Decode({decode:T.decode,keyMaterial:y.publicKeyBase58,type:"public"});return{verify:async({data:O,signature:w})=>b.crypto_sign_verify_detached(r.from(w.buffer,w.byteOffset,w.length),r.from(O.buffer,O.byteOffset,O.length),M)}}const v=p.base58Decode({decode:a.decode,keyMaterial:y.publicKeyBase58,type:"public"});return{verify:async({data:b,signature:T})=>i.verify({message:b,signature:T,publicKey:v})}}(this)}addEncodedPublicKey(v){return v.publicKeyBase58=this.publicKeyBase58,v}async addEncryptedPrivateKey(v){return null!==this.passphrase?v.privateKeyJwe=await this.encrypt({privateKeyBase58:this.privateKeyBase58},this.passphrase):v.privateKeyBase58=this.privateKeyBase58,v}async encrypt(v,b){const M=n.random.getBytesSync(32),w=await c.pbkdf2(b,M,4096,32),g={alg:"PBES2-A128GCMKW",enc:"A128GCMKW",jwk:{kty:"PBKDF2",s:o.encode(M),c:4096}},S=n.random.getBytesSync(12),I=n.cipher.createCipher("AES-GCM",w);I.start({iv:S}),I.update(n.util.createBuffer(JSON.stringify(v))),I.finish();const h=I.output.getBytes(),E=I.mode.tag.getBytes();return{unprotected:g,iv:o.encode(S),ciphertext:o.encode(h),tag:o.encode(E)}}async decrypt(v,b){const{c:M}=v.unprotected.jwk;let{s:O}=v.unprotected.jwk;O=o.encode(O);const w=await c.pbkdf2(b,O,M,32),g=o.encode(v.iv),S=o.encode(v.tag),I=n.cipher.createDecipher("AES-GCM",w);if(I.start({iv:g,tag:S}),I.update(o.encode(v.ciphertext)),!I.finish())throw new Error("Invalid password.");return JSON.parse(I.output.getBytes())}static fingerprintFromPublicKey({publicKeyBase58:v}){const b=p.base58Decode({decode:a.decode,keyMaterial:v,type:"public"}),T=new Uint8Array(2+b.length);return T[0]=237,T[1]=1,T.set(b,2),"z"+a.encode(T)}fingerprint(){const{publicKeyBase58:v}=this;return f.fingerprintFromPublicKey({publicKeyBase58:v})}verifyFingerprint(v){if("string"!=typeof v||"z"!==v[0])return{error:new Error("`fingerprint` must be a multibase encoded string."),valid:!1};let b,T;try{b=p.base58Decode({decode:a.decode,keyMaterial:v.slice(1),type:"fingerprint's"})}catch(O){return{error:O,valid:!1}}try{T=p.base58Decode({decode:a.decode,keyMaterial:this.publicKeyBase58,type:"public"})}catch(O){return{error:O,valid:!1}}const M="ed01"===b.slice(0,2).toString("hex")&&T.equals(b.slice(2));return M?{valid:M}:{error:new Error("The fingerprint does not match the public key."),valid:!1}}}L.exports=f}).call(this,t(27),t(37).Buffer)},function(L,C,t){var e=t(4);function r(v,b){e.cipher.registerAlgorithm(v,function(){return new e.des.Algorithm(v,b)})}t(112),t(137),t(8),L.exports=e.des=e.des||{},e.des.startEncrypting=function(v,b,T,M){var O=y({key:v,output:T,decrypt:!1,mode:M||(null===b?"ECB":"CBC")});return O.start(b),O},e.des.createEncryptionCipher=function(v,b){return y({key:v,output:null,decrypt:!1,mode:b})},e.des.startDecrypting=function(v,b,T,M){var O=y({key:v,output:T,decrypt:!0,mode:M||(null===b?"ECB":"CBC")});return O.start(b),O},e.des.createDecryptionCipher=function(v,b){return y({key:v,output:null,decrypt:!0,mode:b})},e.des.Algorithm=function(v,b){var T=this;T.name=v,T.mode=new b({blockSize:8,cipher:{encrypt:function(M,O){return m(T._keys,M,O,!1)},decrypt:function(M,O){return m(T._keys,M,O,!0)}}}),T._init=!1},e.des.Algorithm.prototype.initialize=function(v){if(!this._init){var b=e.util.createBuffer(v.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw new Error("Invalid Triple-DES key size: "+8*b.length());this._keys=function d(v){for(var Ee,b=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],T=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],M=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],O=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],w=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],g=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],S=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],I=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],h=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],E=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],x=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],A=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],D=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],B=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],N=v.length()>8?3:1,U=[],Z=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],ee=0,K=0;K>>4^Q))<<4,Le^=Ee=65535&((Q^=Ee)>>>-16^Le),Le^=(Ee=858993459&(Le>>>2^(Q^=Ee<<-16)))<<2,Le^=Ee=65535&((Q^=Ee)>>>-16^Le),Le^=(Ee=1431655765&(Le>>>1^(Q^=Ee<<-16)))<<1,Le^=Ee=16711935&((Q^=Ee)>>>8^Le),Ee=(Le^=(Ee=1431655765&(Le>>>1^(Q^=Ee<<8)))<<1)<<8|(Q^=Ee)>>>20&240,Le=Q<<24|Q<<8&16711680|Q>>>8&65280|Q>>>24&240,Q=Ee;for(var j=0;j>>26,Q=Q<<2|Q>>>26):(Le=Le<<1|Le>>>27,Q=Q<<1|Q>>>27);var F=b[(Le&=-15)>>>28]|T[Le>>>24&15]|M[Le>>>20&15]|O[Le>>>16&15]|w[Le>>>12&15]|g[Le>>>8&15]|S[Le>>>4&15],q=I[(Q&=-15)>>>28]|h[Q>>>24&15]|E[Q>>>20&15]|x[Q>>>16&15]|A[Q>>>12&15]|D[Q>>>8&15]|B[Q>>>4&15];U[ee++]=F^(Ee=65535&(q>>>16^F)),U[ee++]=q^Ee<<16}}return U}(b),this._init=!0}},r("DES-ECB",e.cipher.modes.ecb),r("DES-CBC",e.cipher.modes.cbc),r("DES-CFB",e.cipher.modes.cfb),r("DES-OFB",e.cipher.modes.ofb),r("DES-CTR",e.cipher.modes.ctr),r("3DES-ECB",e.cipher.modes.ecb),r("3DES-CBC",e.cipher.modes.cbc),r("3DES-CFB",e.cipher.modes.cfb),r("3DES-OFB",e.cipher.modes.ofb),r("3DES-CTR",e.cipher.modes.ctr);var u=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],n=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],i=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],a=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],p=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],c=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function m(v,b,T,M){var w,g,O=32===v.length?3:9;w=3===O?M?[30,-2,-2]:[0,32,2]:M?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var S=b[0],I=b[1];S^=(g=252645135&(S>>>4^I))<<4,S^=(g=65535&(S>>>16^(I^=g)))<<16,S^=g=858993459&((I^=g)>>>2^S),S^=g=16711935&((I^=g<<2)>>>8^S),S=(S^=(g=1431655765&(S>>>1^(I^=g<<8)))<<1)<<1|S>>>31,I=(I^=g)<<1|I>>>31;for(var h=0;h>>4|I<<28)^v[A+1];g=S,S=I,I=g^(n[D>>>24&63]|i[D>>>16&63]|p[D>>>8&63]|f[63&D]|u[B>>>24&63]|o[B>>>16&63]|a[B>>>8&63]|c[63&B])}g=S,S=I,I=g}I=I>>>1|I<<31,I^=g=1431655765&((S=S>>>1|S<<31)>>>1^I),I^=(g=16711935&(I>>>8^(S^=g<<1)))<<8,I^=(g=858993459&(I>>>2^(S^=g)))<<2,I^=g=65535&((S^=g)>>>16^I),I^=g=252645135&((S^=g<<16)>>>4^I),T[0]=S^=g<<4,T[1]=I}function y(v){var M,T="DES-"+((v=v||{}).mode||"CBC").toUpperCase(),O=(M=v.decrypt?e.cipher.createDecipher(T,v.key):e.cipher.createCipher(T,v.key)).start;return M.start=function(w,g){var S=null;g instanceof e.util.ByteBuffer&&(S=g,g={}),(g=g||{}).output=S,g.iv=w,O.call(M,g)},M}},function(L,C,t){var e=t(4);if(t(38),t(76),t(50),t(143),t(144),t(33),t(8),void 0===r)var r=e.jsbn.BigInteger;var u=e.util.isNodejs?t(115):null,n=e.asn1,o=e.util;e.pki=e.pki||{},L.exports=e.pki.rsa=e.rsa=e.rsa||{};var i=e.pki,a=[6,4,2,4,2,4,6,2],p={name:"PrivateKeyInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},c={name:"RSAPrivateKey",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},d=e.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},m=function(A){if(!(A.algorithm in i.oids)){var B=new Error("Unknown message digest algorithm.");throw B.algorithm=A.algorithm,B}var N=n.oidToDer(i.oids[A.algorithm]).getBytes(),U=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),Z=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);Z.value.push(n.create(n.Class.UNIVERSAL,n.Type.OID,!1,N)),Z.value.push(n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,""));var ee=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,A.digest().getBytes());return U.value.push(Z),U.value.push(ee),n.toDer(U).getBytes()},y=function(A,D,B){if(B)return A.modPow(D.e,D.n);if(!D.p||!D.q)return A.modPow(D.d,D.n);var N;D.dP||(D.dP=D.d.mod(D.p.subtract(r.ONE))),D.dQ||(D.dQ=D.d.mod(D.q.subtract(r.ONE))),D.qInv||(D.qInv=D.q.modInverse(D.p));do{N=new r(e.util.bytesToHex(e.random.getBytes(D.n.bitLength()/8)),16)}while(N.compareTo(D.n)>=0||!N.gcd(D.n).equals(r.ONE));for(var U=(A=A.multiply(N.modPow(D.e,D.n)).mod(D.n)).mod(D.p).modPow(D.dP,D.p),Z=A.mod(D.q).modPow(D.dQ,D.q);U.compareTo(Z)<0;)U=U.add(D.p);return U.subtract(Z).multiply(D.qInv).mod(D.p).multiply(D.q).add(Z).multiply(N.modInverse(D.n)).mod(D.n)};function v(A,D,B){var N=e.util.createBuffer(),U=Math.ceil(D.n.bitLength()/8);if(A.length>U-11){var Z=new Error("Message is too long for PKCS#1 v1.5 padding.");throw Z.length=A.length,Z.max=U-11,Z}N.putByte(0),N.putByte(B);var Ee,ee=U-3-A.length;if(0===B||1===B){Ee=0===B?0:255;for(var K=0;K0;){var Le=0,Q=e.random.getBytes(ee);for(K=0;K1;){if(255!==Z.getByte()){--Z.read;break}++K}else if(2===Ee)for(K=0;Z.length()>1;){if(0===Z.getByte()){--Z.read;break}++K}if(0!==Z.getByte()||K!==U-3-Z.length())throw new Error("Encryption block is invalid.");return Z.getBytes()}function M(A){var D=A.toString(16);D[0]>="8"&&(D="00"+D);var B=e.util.hexToBytes(D);return B.length>1&&(0===B.charCodeAt(0)&&!(128&B.charCodeAt(1))||255===B.charCodeAt(0)&&128==(128&B.charCodeAt(1)))?B.substr(1):B}function O(A){return A<=100?27:A<=150?18:A<=200?15:A<=250?12:A<=300?9:A<=350?8:A<=400?7:A<=500?6:A<=600?5:A<=800?4:A<=1250?3:2}function w(A){return e.util.isNodejs&&"function"==typeof u[A]}function g(A){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[A]}function S(A){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[A]}function I(A){for(var D=e.util.hexToBytes(A.toString(16)),B=new Uint8Array(D.length),N=0;N0;)Le.putByte(0),--Q;return Le.putBytes(e.util.hexToBytes(K)),Le.getBytes()},i.rsa.decrypt=function(A,D,B,N){var U=Math.ceil(D.n.bitLength()/8);if(A.length!==U){var Z=new Error("Encrypted message length is invalid.");throw Z.length=A.length,Z.expected=U,Z}var ee=new r(e.util.createBuffer(A).toHex(),16);if(ee.compareTo(D.n)>=0)throw new Error("Encrypted message is invalid.");for(var K=y(ee,D,B).toString(16),Le=e.util.createBuffer(),Q=U-Math.ceil(K.length/2);Q>0;)Le.putByte(0),--Q;return Le.putBytes(e.util.hexToBytes(K)),!1!==N?b(Le.getBytes(),D,B):Le.getBytes()},i.rsa.createKeyPairGenerationState=function(A,D,B){"string"==typeof A&&(A=parseInt(A,10)),A=A||2048;var ee,N=(B=B||{}).prng||e.random,U={nextBytes:function(Ee){for(var K=N.getBytesSync(Ee.length),Le=0;Le>1,pBits:A-(A>>1),pqState:0,num:null,keys:null}).e.fromInt(ee.eInt),ee},i.rsa.stepKeyPairGenerationState=function(A,D){"algorithm"in A||(A.algorithm="PRIMEINC");var B=new r(null);B.fromInt(30);for(var ee,N=0,U=function(j,F){return j|F},Z=+new Date,Ee=0;null===A.keys&&(D<=0||EeK?A.pqState=0:A.num.isProbablePrime(O(A.num.bitLength()))?++A.pqState:A.num.dAddOffset(a[N++%8],0):2===A.pqState?A.pqState=0===A.num.subtract(r.ONE).gcd(A.e).compareTo(r.ONE)?3:0:3===A.pqState&&(A.pqState=0,null===A.p?A.p=A.num:A.q=A.num,null!==A.p&&null!==A.q&&++A.state,A.num=null)}else if(1===A.state)A.p.compareTo(A.q)<0&&(A.num=A.p,A.p=A.q,A.q=A.num),++A.state;else if(2===A.state)A.p1=A.p.subtract(r.ONE),A.q1=A.q.subtract(r.ONE),A.phi=A.p1.multiply(A.q1),++A.state;else if(3===A.state)0===A.phi.gcd(A.e).compareTo(r.ONE)?++A.state:(A.p=null,A.q=null,A.state=0);else if(4===A.state)A.n=A.p.multiply(A.q),A.n.bitLength()===A.bits?++A.state:(A.q=null,A.state=0);else if(5===A.state){var Q=A.e.modInverse(A.phi);A.keys={privateKey:i.rsa.setPrivateKey(A.n,A.e,Q,A.p,A.q,Q.mod(A.p1),Q.mod(A.q1),A.q.modInverse(A.p)),publicKey:i.rsa.setPublicKey(A.n,A.e)}}Ee+=(ee=+new Date)-Z,Z=ee}return null!==A.keys},i.rsa.generateKeyPair=function(A,D,B,N){if(1===arguments.length?"object"==typeof A?(B=A,A=void 0):"function"==typeof A&&(N=A,A=void 0):2===arguments.length?"number"==typeof A?"function"==typeof D?(N=D,D=void 0):"number"!=typeof D&&(B=D,D=void 0):(B=A,N=D,A=void 0,D=void 0):3===arguments.length&&("number"==typeof D?"function"==typeof B&&(N=B,B=void 0):(N=B,B=D,D=void 0)),B=B||{},void 0===A&&(A=B.bits||2048),void 0===D&&(D=B.e||65537),!e.options.usePureJavaScript&&!B.prng&&A>=256&&A<=16384&&(65537===D||3===D))if(N){if(w("generateKeyPair"))return u.generateKeyPair("rsa",{modulusLength:A,publicExponent:D,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(Ee,K,Le){if(Ee)return N(Ee);N(null,{privateKey:i.privateKeyFromPem(Le),publicKey:i.publicKeyFromPem(K)})});if(g("generateKey")&&g("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:A,publicExponent:I(D),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(Ee){return o.globalScope.crypto.subtle.exportKey("pkcs8",Ee.privateKey)}).then(void 0,function(Ee){N(Ee)}).then(function(Ee){if(Ee){var K=i.privateKeyFromAsn1(n.fromDer(e.util.createBuffer(Ee)));N(null,{privateKey:K,publicKey:i.setRsaPublicKey(K.n,K.e)})}});if(S("generateKey")&&S("exportKey")){var U=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:A,publicExponent:I(D),hash:{name:"SHA-256"}},!0,["sign","verify"]);return U.oncomplete=function(Ee){var Le=o.globalScope.msCrypto.subtle.exportKey("pkcs8",Ee.target.result.privateKey);Le.oncomplete=function(Q){var F=i.privateKeyFromAsn1(n.fromDer(e.util.createBuffer(Q.target.result)));N(null,{privateKey:F,publicKey:i.setRsaPublicKey(F.n,F.e)})},Le.onerror=function(Q){N(Q)}},void(U.onerror=function(Ee){N(Ee)})}}else if(w("generateKeyPairSync")){var Z=u.generateKeyPairSync("rsa",{modulusLength:A,publicExponent:D,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:i.privateKeyFromPem(Z.privateKey),publicKey:i.publicKeyFromPem(Z.publicKey)}}var ee=i.rsa.createKeyPairGenerationState(A,D,B);if(!N)return i.rsa.stepKeyPairGenerationState(ee,0),ee.keys;!function T(A,D,B){"function"==typeof D&&(B=D,D={});var N={algorithm:{name:(D=D||{}).algorithm||"PRIMEINC",options:{workers:D.workers||2,workLoad:D.workLoad||100,workerScript:D.workerScript}}};function U(){Z(A.pBits,function(Ee,K){return Ee?B(Ee):(A.p=K,null!==A.q?ee(Ee,A.q):void Z(A.qBits,ee))})}function Z(Ee,K){e.prime.generateProbablePrime(Ee,N,K)}function ee(Ee,K){if(Ee)return B(Ee);if(A.q=K,A.p.compareTo(A.q)<0){var Le=A.p;A.p=A.q,A.q=Le}if(0!==A.p.subtract(r.ONE).gcd(A.e).compareTo(r.ONE))return A.p=null,void U();if(0!==A.q.subtract(r.ONE).gcd(A.e).compareTo(r.ONE))return A.q=null,void Z(A.qBits,ee);if(A.p1=A.p.subtract(r.ONE),A.q1=A.q.subtract(r.ONE),A.phi=A.p1.multiply(A.q1),0!==A.phi.gcd(A.e).compareTo(r.ONE))return A.p=A.q=null,void U();if(A.n=A.p.multiply(A.q),A.n.bitLength()!==A.bits)return A.q=null,void Z(A.qBits,ee);var Q=A.e.modInverse(A.phi);A.keys={privateKey:i.rsa.setPrivateKey(A.n,A.e,Q,A.p,A.q,Q.mod(A.p1),Q.mod(A.q1),A.q.modInverse(A.p)),publicKey:i.rsa.setPublicKey(A.n,A.e)},B(null,A.keys)}"prng"in D&&(N.prng=D.prng),U()}(ee,B,N)},i.setRsaPublicKey=i.rsa.setPublicKey=function(A,D){var B={n:A,e:D,encrypt:function(N,U,Z){if("string"==typeof U?U=U.toUpperCase():void 0===U&&(U="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===U)U={encode:function(Ee,K,Le){return v(Ee,K,2).getBytes()}};else if("RSA-OAEP"===U||"RSAES-OAEP"===U)U={encode:function(Ee,K){return e.pkcs1.encode_rsa_oaep(K,Ee,Z)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(U))U={encode:function(Ee){return Ee}};else if("string"==typeof U)throw new Error('Unsupported encryption scheme: "'+U+'".');var ee=U.encode(N,B,!0);return i.rsa.encrypt(ee,B,!0)},verify:function(N,U,Z){"string"==typeof Z?Z=Z.toUpperCase():void 0===Z&&(Z="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===Z?Z={verify:function(Ee,K){return K=b(K,B,!0),Ee===n.fromDer(K).value[1].value}}:"NONE"!==Z&&"NULL"!==Z&&null!==Z||(Z={verify:function(Ee,K){return Ee===b(K,B,!0)}});var ee=i.rsa.decrypt(U,B,!0,!1);return Z.verify(N,ee,B.n.bitLength())}};return B},i.setRsaPrivateKey=i.rsa.setPrivateKey=function(A,D,B,N,U,Z,ee,Ee){var K={n:A,e:D,d:B,p:N,q:U,dP:Z,dQ:ee,qInv:Ee,decrypt:function(Le,Q,j){"string"==typeof Q?Q=Q.toUpperCase():void 0===Q&&(Q="RSAES-PKCS1-V1_5");var F=i.rsa.decrypt(Le,K,!1,!1);if("RSAES-PKCS1-V1_5"===Q)Q={decode:b};else if("RSA-OAEP"===Q||"RSAES-OAEP"===Q)Q={decode:function(q,ge){return e.pkcs1.decode_rsa_oaep(ge,q,j)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(Q))throw new Error('Unsupported encryption scheme: "'+Q+'".');Q={decode:function(q){return q}}}return Q.decode(F,K,!1)},sign:function(Le,Q){var j=!1;"string"==typeof Q&&(Q=Q.toUpperCase()),void 0===Q||"RSASSA-PKCS1-V1_5"===Q?(Q={encode:m},j=1):"NONE"!==Q&&"NULL"!==Q&&null!==Q||(Q={encode:function(){return Le}},j=1);var F=Q.encode(Le,K.n.bitLength());return i.rsa.encrypt(F,K,j)}};return K},i.wrapRsaPrivateKey=function(A){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(0).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.rsaEncryption).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(A).getBytes())])},i.privateKeyFromAsn1=function(A){var N,U,Z,ee,Ee,K,Le,Q,D={},B=[];if(n.validate(A,p,D,B)&&(A=n.fromDer(e.util.createBuffer(D.privateKey))),!n.validate(A,c,D={},B=[])){var j=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw j.errors=B,j}return N=e.util.createBuffer(D.privateKeyModulus).toHex(),U=e.util.createBuffer(D.privateKeyPublicExponent).toHex(),Z=e.util.createBuffer(D.privateKeyPrivateExponent).toHex(),ee=e.util.createBuffer(D.privateKeyPrime1).toHex(),Ee=e.util.createBuffer(D.privateKeyPrime2).toHex(),K=e.util.createBuffer(D.privateKeyExponent1).toHex(),Le=e.util.createBuffer(D.privateKeyExponent2).toHex(),Q=e.util.createBuffer(D.privateKeyCoefficient).toHex(),i.setRsaPrivateKey(new r(N,16),new r(U,16),new r(Z,16),new r(ee,16),new r(Ee,16),new r(K,16),new r(Le,16),new r(Q,16))},i.privateKeyToAsn1=i.privateKeyToRSAPrivateKey=function(A){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(0).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.n)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.e)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.d)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.p)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.q)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.dP)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.dQ)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.qInv))])},i.publicKeyFromAsn1=function(A){var D={},B=[];if(n.validate(A,d,D,B)){var N,U=n.derToOid(D.publicKeyOid);if(U!==i.oids.rsaEncryption)throw(N=new Error("Cannot read public key. Unknown OID.")).oid=U,N;A=D.rsaPublicKey}if(!n.validate(A,f,D,B=[]))throw(N=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=B,N;var Z=e.util.createBuffer(D.publicKeyModulus).toHex(),ee=e.util.createBuffer(D.publicKeyExponent).toHex();return i.setRsaPublicKey(new r(Z,16),new r(ee,16))},i.publicKeyToAsn1=i.publicKeyToSubjectPublicKeyInfo=function(A){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.rsaEncryption).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,[i.publicKeyToRSAPublicKey(A)])])},i.publicKeyToRSAPublicKey=function(A){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.n)),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,M(A.e))])}},function(L,C,t){var r,e=t(4);function o(Xe,it,_t){this.data=[],null!=Xe&&("number"==typeof Xe?this.fromNumber(Xe,it,_t):this.fromString(Xe,null==it&&"string"!=typeof Xe?256:it))}function i(){return new o(null)}function c(Xe,it,_t,St,un,mn){for(var Ft=16383&it,In=it>>14;--mn>=0;){var Yn=16383&this.data[Xe],cr=this.data[Xe++]>>14,ar=In*Yn+cr*Ft;un=((Yn=Ft*Yn+((16383&ar)<<14)+_t.data[St]+un)>>28)+(ar>>14)+In*cr,_t.data[St++]=268435455&Yn}return un}L.exports=e.jsbn=e.jsbn||{},e.jsbn.BigInteger=o,typeof navigator>"u"?(o.prototype.am=c,r=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function p(Xe,it,_t,St,un,mn){for(var Ft=32767&it,In=it>>15;--mn>=0;){var Yn=32767&this.data[Xe],cr=this.data[Xe++]>>15,ar=In*Yn+cr*Ft;un=((Yn=Ft*Yn+((32767&ar)<<15)+_t.data[St]+(1073741823&un))>>>30)+(ar>>>15)+In*cr+(un>>>30),_t.data[St++]=1073741823&Yn}return un},r=30):"Netscape"!=navigator.appName?(o.prototype.am=function a(Xe,it,_t,St,un,mn){for(;--mn>=0;){var Ft=it*this.data[Xe++]+_t.data[St]+un;un=Math.floor(Ft/67108864),_t.data[St++]=67108863&Ft}return un},r=26):(o.prototype.am=c,r=28),o.prototype.DB=r,o.prototype.DM=(1<>>16)&&(Xe=_t,it+=16),0!=(_t=Xe>>8)&&(Xe=_t,it+=8),0!=(_t=Xe>>4)&&(Xe=_t,it+=4),0!=(_t=Xe>>2)&&(Xe=_t,it+=2),0!=(_t=Xe>>1)&&(Xe=_t,it+=1),it}function j(Xe){this.m=Xe}function Ke(Xe){this.m=Xe,this.mp=Xe.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,it+=16),!(255&Xe)&&(Xe>>=8,it+=8),!(15&Xe)&&(Xe>>=4,it+=4),!(3&Xe)&&(Xe>>=2,it+=2),!(1&Xe)&&++it,it}function yt(Xe){for(var it=0;0!=Xe;)Xe&=Xe-1,++it;return it}function vt(){}function bt(Xe){return Xe}function nn(Xe){this.r2=i(),this.q3=i(),o.ONE.dlShiftTo(2*Xe.t,this.r2),this.mu=this.r2.divide(Xe),this.m=Xe}j.prototype.convert=function F(Xe){return Xe.s<0||Xe.compareTo(this.m)>=0?Xe.mod(this.m):Xe},j.prototype.revert=function q(Xe){return Xe},j.prototype.reduce=function ge(Xe){Xe.divRemTo(this.m,null,Xe)},j.prototype.mulTo=function we(Xe,it,_t){Xe.multiplyTo(it,_t),this.reduce(_t)},j.prototype.sqrTo=function he(Xe,it){Xe.squareTo(it),this.reduce(it)},Ke.prototype.convert=function Ne(Xe){var it=i();return Xe.abs().dlShiftTo(this.m.t,it),it.divRemTo(this.m,null,it),Xe.s<0&&it.compareTo(o.ZERO)>0&&this.m.subTo(it,it),it},Ke.prototype.revert=function $e(Xe){var it=i();return Xe.copyTo(it),this.reduce(it),it},Ke.prototype.reduce=function G(Xe){for(;Xe.t<=this.mt2;)Xe.data[Xe.t++]=0;for(var it=0;it>15)*this.mpl&this.um)<<15)&Xe.DM;for(Xe.data[_t=it+this.m.t]+=this.m.am(0,St,Xe,it,0,this.m.t);Xe.data[_t]>=Xe.DV;)Xe.data[_t]-=Xe.DV,Xe.data[++_t]++}Xe.clamp(),Xe.drShiftTo(this.m.t,Xe),Xe.compareTo(this.m)>=0&&Xe.subTo(this.m,Xe)},Ke.prototype.mulTo=function se(Xe,it,_t){Xe.multiplyTo(it,_t),this.reduce(_t)},Ke.prototype.sqrTo=function k(Xe,it){Xe.squareTo(it),this.reduce(it)},o.prototype.copyTo=function M(Xe){for(var it=this.t-1;it>=0;--it)Xe.data[it]=this.data[it];Xe.t=this.t,Xe.s=this.s},o.prototype.fromInt=function O(Xe){this.t=1,this.s=Xe<0?-1:0,Xe>0?this.data[0]=Xe:Xe<-1?this.data[0]=Xe+this.DV:this.t=0},o.prototype.fromString=function g(Xe,it){var _t;if(16==it)_t=4;else if(8==it)_t=3;else if(256==it)_t=8;else if(2==it)_t=1;else if(32==it)_t=5;else{if(4!=it)return void this.fromRadix(Xe,it);_t=2}this.t=0,this.s=0;for(var St=Xe.length,un=!1,mn=0;--St>=0;){var Ft=8==_t?255&Xe[St]:T(Xe,St);Ft<0?"-"==Xe.charAt(St)&&(un=!0):(un=!1,0==mn?this.data[this.t++]=Ft:mn+_t>this.DB?(this.data[this.t-1]|=(Ft&(1<>this.DB-mn):this.data[this.t-1]|=Ft<=this.DB&&(mn-=this.DB))}8==_t&&128&Xe[0]&&(this.s=-1,mn>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==Xe;)--this.t},o.prototype.dlShiftTo=function B(Xe,it){var _t;for(_t=this.t-1;_t>=0;--_t)it.data[_t+Xe]=this.data[_t];for(_t=Xe-1;_t>=0;--_t)it.data[_t]=0;it.t=this.t+Xe,it.s=this.s},o.prototype.drShiftTo=function N(Xe,it){for(var _t=Xe;_t=0;--In)it.data[In+mn+1]=this.data[In]>>St|Ft,Ft=(this.data[In]&un)<<_t;for(In=mn-1;In>=0;--In)it.data[In]=0;it.data[mn]=Ft,it.t=this.t+mn+1,it.s=this.s,it.clamp()},o.prototype.rShiftTo=function Z(Xe,it){it.s=this.s;var _t=Math.floor(Xe/this.DB);if(_t>=this.t)it.t=0;else{var St=Xe%this.DB,un=this.DB-St,mn=(1<>St;for(var Ft=_t+1;Ft>St;St>0&&(it.data[this.t-_t-1]|=(this.s&mn)<>=this.DB;if(Xe.t>=this.DB;St+=this.s}else{for(St+=this.s;_t>=this.DB;St-=Xe.s}it.s=St<0?-1:0,St<-1?it.data[_t++]=this.DV+St:St>0&&(it.data[_t++]=St),it.t=_t,it.clamp()},o.prototype.multiplyTo=function Ee(Xe,it){var _t=this.abs(),St=Xe.abs(),un=_t.t;for(it.t=un+St.t;--un>=0;)it.data[un]=0;for(un=0;un=0;)Xe.data[_t]=0;for(_t=0;_t=it.DV&&(Xe.data[_t+it.t]-=it.DV,Xe.data[_t+it.t+1]=1)}Xe.t>0&&(Xe.data[Xe.t-1]+=it.am(_t,it.data[_t],Xe,2*_t,0,1)),Xe.s=0,Xe.clamp()},o.prototype.divRemTo=function Le(Xe,it,_t){var St=Xe.abs();if(!(St.t<=0)){var un=this.abs();if(un.t0?(St.lShiftTo(Yn,mn),un.lShiftTo(Yn,_t)):(St.copyTo(mn),un.copyTo(_t));var cr=mn.t,ar=mn.data[cr-1];if(0!=ar){var er=ar*(1<1?mn.data[cr-2]>>this.F2:0),rr=this.FV/er,Lr=(1<=0&&(_t.data[_t.t++]=1,_t.subTo(pr,_t)),o.ONE.dlShiftTo(cr,pr),pr.subTo(mn,mn);mn.t=0;){var Yr=_t.data[--kr]==ar?this.DM:Math.floor(_t.data[kr]*rr+(_t.data[kr-1]+Ir)*Lr);if((_t.data[kr]+=mn.am(0,Yr,_t,Wr,0,cr))0&&_t.rShiftTo(Yn,_t),Ft<0&&o.ZERO.subTo(_t,_t)}}},o.prototype.invDigit=function xe(){if(this.t<1)return 0;var Xe=this.data[0];if(!(1&Xe))return 0;var it=3&Xe;return(it=(it=(it=(it=it*(2-(15&Xe)*it)&15)*(2-(255&Xe)*it)&255)*(2-((65535&Xe)*it&65535))&65535)*(2-Xe*it%this.DV)%this.DV)>0?this.DV-it:-it},o.prototype.isEven=function ne(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function Se(Xe,it){if(Xe>4294967295||Xe<1)return o.ONE;var _t=i(),St=i(),un=it.convert(this),mn=A(Xe)-1;for(un.copyTo(_t);--mn>=0;)if(it.sqrTo(_t,St),(Xe&1<0)it.mulTo(St,un,_t);else{var Ft=_t;_t=St,St=Ft}return it.revert(_t)},o.prototype.toString=function I(Xe){if(this.s<0)return"-"+this.negate().toString(Xe);var it;if(16==Xe)it=4;else if(8==Xe)it=3;else if(2==Xe)it=1;else if(32==Xe)it=5;else{if(4!=Xe)return this.toRadix(Xe);it=2}var St,_t=(1<0)for(In>In)>0&&(un=!0,mn=b(St));Ft>=0;)In>(In+=this.DB-it)):(St=this.data[Ft]>>(In-=it)&_t,In<=0&&(In+=this.DB,--Ft)),St>0&&(un=!0),un&&(mn+=b(St));return un?mn:"0"},o.prototype.negate=function h(){var Xe=i();return o.ZERO.subTo(this,Xe),Xe},o.prototype.abs=function E(){return this.s<0?this.negate():this},o.prototype.compareTo=function x(Xe){var it=this.s-Xe.s;if(0!=it)return it;var _t=this.t;if(0!=(it=_t-Xe.t))return this.s<0?-it:it;for(;--_t>=0;)if(0!=(it=this.data[_t]-Xe.data[_t]))return it;return 0},o.prototype.bitLength=function D(){return this.t<=0?0:this.DB*(this.t-1)+A(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function Q(Xe){var it=i();return this.abs().divRemTo(Xe,null,it),this.s<0&&it.compareTo(o.ZERO)>0&&Xe.subTo(it,it),it},o.prototype.modPowInt=function tt(Xe,it){var _t;return _t=Xe<256||it.isEven()?new j(it):new Ke(it),this.exp(Xe,_t)},o.ZERO=w(0),o.ONE=w(1),vt.prototype.convert=bt,vt.prototype.revert=bt,vt.prototype.mulTo=function an(Xe,it,_t){Xe.multiplyTo(it,_t)},vt.prototype.sqrTo=function ln(Xe,it){Xe.squareTo(it)},nn.prototype.convert=function Sn(Xe){if(Xe.s<0||Xe.t>2*this.m.t)return Xe.mod(this.m);if(Xe.compareTo(this.m)<0)return Xe;var it=i();return Xe.copyTo(it),this.reduce(it),it},nn.prototype.revert=function Jt(Xe){return Xe},nn.prototype.reduce=function Pn(Xe){for(Xe.drShiftTo(this.m.t-1,this.r2),Xe.t>this.m.t+1&&(Xe.t=this.m.t+1,Xe.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);Xe.compareTo(this.r2)<0;)Xe.dAddOffset(1,this.m.t+1);for(Xe.subTo(this.r2,Xe);Xe.compareTo(this.m)>=0;)Xe.subTo(this.m,Xe)},nn.prototype.mulTo=function Un(Xe,it,_t){Xe.multiplyTo(it,_t),this.reduce(_t)},nn.prototype.sqrTo=function Bn(Xe,it){Xe.squareTo(it),this.reduce(it)};var Bt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],Vt=(1<<26)/Bt[Bt.length-1];o.prototype.chunkSize=function X(Xe){return Math.floor(Math.LN2*this.DB/Math.log(Xe))},o.prototype.toRadix=function be(Xe){if(null==Xe&&(Xe=10),0==this.signum()||Xe<2||Xe>36)return"0";var it=this.chunkSize(Xe),_t=Math.pow(Xe,it),St=w(_t),un=i(),mn=i(),Ft="";for(this.divRemTo(St,un,mn);un.signum()>0;)Ft=(_t+mn.intValue()).toString(Xe).substr(1)+Ft,un.divRemTo(St,un,mn);return mn.intValue().toString(Xe)+Ft},o.prototype.fromRadix=function ke(Xe,it){this.fromInt(0),null==it&&(it=10);for(var _t=this.chunkSize(it),St=Math.pow(it,_t),un=!1,mn=0,Ft=0,In=0;In=_t&&(this.dMultiply(St),this.dAddOffset(Ft,0),mn=0,Ft=0))}mn>0&&(this.dMultiply(Math.pow(it,mn)),this.dAddOffset(Ft,0)),un&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function Qe(Xe,it,_t){if("number"==typeof it)if(Xe<2)this.fromInt(1);else for(this.fromNumber(Xe,_t),this.testBit(Xe-1)||this.bitwiseTo(o.ONE.shiftLeft(Xe-1),At,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(it);)this.dAddOffset(2,0),this.bitLength()>Xe&&this.subTo(o.ONE.shiftLeft(Xe-1),this);else{var St=new Array,un=7&Xe;St.length=1+(Xe>>3),it.nextBytes(St),un>0?St[0]&=(1<>=this.DB;if(Xe.t>=this.DB;St+=this.s}else{for(St+=this.s;_t>=this.DB;St+=Xe.s}it.s=St<0?-1:0,St>0?it.data[_t++]=St:St<-1&&(it.data[_t++]=this.DV+St),it.t=_t,it.clamp()},o.prototype.dMultiply=function Je(Xe){this.data[this.t]=this.am(0,Xe-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function lt(Xe,it){if(0!=Xe){for(;this.t<=it;)this.data[this.t++]=0;for(this.data[it]+=Xe;this.data[it]>=this.DV;)this.data[it]-=this.DV,++it>=this.t&&(this.data[this.t++]=0),++this.data[it]}},o.prototype.multiplyLowerTo=function sn(Xe,it,_t){var un,St=Math.min(this.t+Xe.t,it);for(_t.s=0,_t.t=St;St>0;)_t.data[--St]=0;for(un=_t.t-this.t;St=0;)_t.data[St]=0;for(St=Math.max(it-this.t,0);St0)if(0==it)_t=this.data[0]%Xe;else for(var St=this.t-1;St>=0;--St)_t=(it*_t+this.data[St])%Xe;return _t},o.prototype.millerRabin=function En(Xe){var it=this.subtract(o.ONE),_t=it.getLowestSetBit();if(_t<=0)return!1;for(var mn,St=it.shiftRight(_t),un=function Ln(){return{nextBytes:function(Xe){for(var it=0;it=0);var In=mn.modPow(St,this);if(0!=In.compareTo(o.ONE)&&0!=In.compareTo(it)){for(var Yn=1;Yn++<_t&&0!=In.compareTo(it);)if(0==(In=In.modPowInt(2,this)).compareTo(o.ONE))return!1;if(0!=In.compareTo(it))return!1}}return!0},o.prototype.clone=function Re(){var Xe=i();return this.copyTo(Xe),Xe},o.prototype.intValue=function pe(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24},o.prototype.shortValue=function Y(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function re(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function ie(){var Xe=this.t,it=new Array;it[0]=this.s;var St,_t=this.DB-Xe*this.DB%8,un=0;if(Xe-- >0)for(_t>_t)!=(this.s&this.DM)>>_t&&(it[un++]=St|this.s<=0;)_t<8?(St=(this.data[Xe]&(1<<_t)-1)<<8-_t,St|=this.data[--Xe]>>(_t+=this.DB-8)):(St=this.data[Xe]>>(_t-=8)&255,_t<=0&&(_t+=this.DB,--Xe)),128&St&&(St|=-256),0==un&&(128&this.s)!=(128&St)&&++un,(un>0||St!=this.s)&&(it[un++]=St);return it},o.prototype.equals=function Ce(Xe){return 0==this.compareTo(Xe)},o.prototype.min=function me(Xe){return this.compareTo(Xe)<0?this:Xe},o.prototype.max=function _e(Xe){return this.compareTo(Xe)>0?this:Xe},o.prototype.and=function ft(Xe){var it=i();return this.bitwiseTo(Xe,Ge,it),it},o.prototype.or=function kt(Xe){var it=i();return this.bitwiseTo(Xe,At,it),it},o.prototype.xor=function Lt(Xe){var it=i();return this.bitwiseTo(Xe,ht,it),it},o.prototype.andNot=function je(Xe){var it=i();return this.bitwiseTo(Xe,te,it),it},o.prototype.not=function We(){for(var Xe=i(),it=0;it=this.t?0!=this.s:0!=(this.data[it]&1<1){var ar=i();for(mn.sqrTo(Ft[1],ar);In<=cr;)Ft[In]=i(),mn.mulTo(ar,Ft[In-2],Ft[In]),In+=2}var rr,kr,er=Xe.t-1,Lr=!0,Ir=i();for(_t=A(Xe.data[er])-1;er>=0;){for(_t>=Yn?rr=Xe.data[er]>>_t-Yn&cr:(rr=(Xe.data[er]&(1<<_t+1)-1)<0&&(rr|=Xe.data[er-1]>>this.DB+_t-Yn)),In=St;!(1&rr);)rr>>=1,--In;if((_t-=In)<0&&(_t+=this.DB,--er),Lr)Ft[rr].copyTo(un),Lr=!1;else{for(;In>1;)mn.sqrTo(un,Ir),mn.sqrTo(Ir,un),In-=2;In>0?mn.sqrTo(un,Ir):(kr=un,un=Ir,Ir=kr),mn.mulTo(Ir,Ft[rr],un)}for(;er>=0&&!(Xe.data[er]&1<<_t);)mn.sqrTo(un,Ir),kr=un,un=Ir,Ir=kr,--_t<0&&(_t=this.DB-1,--er)}return mn.revert(un)},o.prototype.modInverse=function Tr(Xe){var it=Xe.isEven();if(this.isEven()&&it||0==Xe.signum())return o.ZERO;for(var _t=Xe.clone(),St=this.clone(),un=w(1),mn=w(0),Ft=w(0),In=w(1);0!=_t.signum();){for(;_t.isEven();)_t.rShiftTo(1,_t),it?(un.isEven()&&mn.isEven()||(un.addTo(this,un),mn.subTo(Xe,mn)),un.rShiftTo(1,un)):mn.isEven()||mn.subTo(Xe,mn),mn.rShiftTo(1,mn);for(;St.isEven();)St.rShiftTo(1,St),it?(Ft.isEven()&&In.isEven()||(Ft.addTo(this,Ft),In.subTo(Xe,In)),Ft.rShiftTo(1,Ft)):In.isEven()||In.subTo(Xe,In),In.rShiftTo(1,In);_t.compareTo(St)>=0?(_t.subTo(St,_t),it&&un.subTo(Ft,un),mn.subTo(In,mn)):(St.subTo(_t,St),it&&Ft.subTo(un,Ft),In.subTo(mn,In))}return 0!=St.compareTo(o.ONE)?o.ZERO:In.compareTo(Xe)>=0?In.subtract(Xe):In.signum()<0?(In.addTo(Xe,In),In.signum()<0?In.add(Xe):In):In},o.prototype.pow=function en(Xe){return this.exp(Xe,new vt)},o.prototype.gcd=function or(Xe){var it=this.s<0?this.negate():this.clone(),_t=Xe.s<0?Xe.negate():Xe.clone();if(it.compareTo(_t)<0){var St=it;it=_t,_t=St}var un=it.getLowestSetBit(),mn=_t.getLowestSetBit();if(mn<0)return it;for(un0&&(it.rShiftTo(mn,it),_t.rShiftTo(mn,_t));it.signum()>0;)(un=it.getLowestSetBit())>0&&it.rShiftTo(un,it),(un=_t.getLowestSetBit())>0&&_t.rShiftTo(un,_t),it.compareTo(_t)>=0?(it.subTo(_t,it),it.rShiftTo(1,it)):(_t.subTo(it,_t),_t.rShiftTo(1,_t));return mn>0&&_t.lShiftTo(mn,_t),_t},o.prototype.isProbablePrime=function rn(Xe){var it,_t=this.abs();if(1==_t.t&&_t.data[0]<=Bt[Bt.length-1]){for(it=0;it=0&&ht=this._keys.length?(this._index=-1,this._keys=_e,this._values=_e):this._index++,{value:Lt,done:!1}}return{value:void 0,done:!0}},kt.prototype.throw=function(ht){throw this._index>=0&&(this._index=-1,this._keys=_e,this._values=_e),ht},kt.prototype.return=function(ht){return this._index>=0&&(this._index=-1,this._keys=_e,this._values=_e),{value:ht,done:!0}},kt}();return function(){function kt(){this._keys=[],this._values=[],this._cacheKey=me,this._cacheIndex=-2}return Object.defineProperty(kt.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),kt.prototype.has=function(ht){return this._find(ht,!1)>=0},kt.prototype.get=function(ht){var Lt=this._find(ht,!1);return Lt>=0?this._values[Lt]:void 0},kt.prototype.set=function(ht,Lt){var te=this._find(ht,!0);return this._values[te]=Lt,this},kt.prototype.delete=function(ht){var Lt=this._find(ht,!1);if(Lt>=0){for(var te=this._keys.length,je=Lt+1;je=0;--Te){var ft=(0,me[Te])(_e);if(!we(ft)&&!he(ft)){if(!tt(ft))throw new TypeError;_e=ft}}return _e}(me,_e)}if(!ne(me))throw new TypeError;if(!Ke(_e))throw new TypeError;if(!Ke(Ge)&&!we(Ge)&&!he(Ge))throw new TypeError;return he(Ge)&&(Ge=void 0),function Z(me,_e,Te,Ge){for(var ft=me.length-1;ft>=0;--ft){var kt=(0,me[ft])(_e,Te,Ge);if(!we(kt)&&!he(kt)){if(!Ke(kt))throw new TypeError;Ge=kt}}return Ge}(me,_e,Te=se(Te),Ge)}),o("metadata",function S(me,_e){return function Te(Ge,ft){if(!Ke(Ge))throw new TypeError;if(!we(ft)&&!function Re(me){switch(ge(me)){case 3:case 4:return!0;default:return!1}}(ft))throw new TypeError;j(me,_e,Ge,ft)}}),o("defineMetadata",function I(me,_e,Te,Ge){if(!Ke(Te))throw new TypeError;return we(Ge)||(Ge=se(Ge)),j(me,_e,Te,Ge)}),o("hasMetadata",function h(me,_e,Te){if(!Ke(_e))throw new TypeError;return we(Te)||(Te=se(Te)),Ee(me,_e,Te)}),o("hasOwnMetadata",function E(me,_e,Te){if(!Ke(_e))throw new TypeError;return we(Te)||(Te=se(Te)),K(me,_e,Te)}),o("getMetadata",function x(me,_e,Te){if(!Ke(_e))throw new TypeError;return we(Te)||(Te=se(Te)),Le(me,_e,Te)}),o("getOwnMetadata",function A(me,_e,Te){if(!Ke(_e))throw new TypeError;return we(Te)||(Te=se(Te)),Q(me,_e,Te)}),o("getMetadataKeys",function D(me,_e){if(!Ke(me))throw new TypeError;return we(_e)||(_e=se(_e)),F(me,_e)}),o("getOwnMetadataKeys",function B(me,_e){if(!Ke(me))throw new TypeError;return we(_e)||(_e=se(_e)),q(me,_e)}),o("deleteMetadata",function N(me,_e,Te){if(!Ke(_e))throw new TypeError;we(Te)||(Te=se(Te));var Ge=ee(_e,Te,!1);if(we(Ge)||!Ge.delete(me))return!1;if(Ge.size>0)return!0;var ft=w.get(_e);return ft.delete(Te),ft.size>0||w.delete(_e),!0})}(a)}()}).call(this,t(27),t(41))},function(L,C,t){"use strict";var e=this&&this.__awaiter||function(T,M,O,w){return new(O||(O=Promise))(function(g,S){function I(x){try{E(w.next(x))}catch(A){S(A)}}function h(x){try{E(w.throw(x))}catch(A){S(A)}}function E(x){x.done?g(x.value):new O(function(A){A(x.value)}).then(I,h)}E((w=w.apply(T,M||[])).next())})},r=this&&this.__generator||function(T,M){var w,g,S,I,O={label:0,sent:function(){if(1&S[0])throw S[1];return S[1]},trys:[],ops:[]};return I={next:h(0),throw:h(1),return:h(2)},"function"==typeof Symbol&&(I[Symbol.iterator]=function(){return this}),I;function h(x){return function(A){return function E(x){if(w)throw new TypeError("Generator is already executing.");for(;O;)try{if(w=1,g&&(S=g[2&x[0]?"return":x[0]?"throw":"next"])&&!(S=S.call(g,x[1])).done)return S;switch(g=0,S&&(x=[0,S.value]),x[0]){case 0:case 1:S=x;break;case 4:return O.label++,{value:x[1],done:!1};case 5:O.label++,g=x[1],x=[0];continue;case 7:x=O.ops.pop(),O.trys.pop();continue;default:if(!((S=(S=O.trys).length>0&&S[S.length-1])||6!==x[0]&&2!==x[0])){O=0;continue}if(3===x[0]&&(!S||x[1]>S[0]&&x[1]0?I.length:T.length),A=d(v,T);return x.concat(A)}function c(v,b,T,M,O){var w=O[v.toString()]||[],g=y(w),S=!0!==g.unmanaged,I=M[v];if((I=g.inject||g.multiInject||I)instanceof e.LazyServiceIdentifer&&(I=I.unwrap()),S){if(!b&&(I===Object||I===Function||void 0===I))throw new Error(r.MISSING_INJECT_ANNOTATION+" argument "+v+" in class "+T+".");var N=new i.Target(u.TargetTypeEnum.ConstructorArgument,g.targetName,I);return N.metadata=w,N}return null}function d(v,b){for(var T=v.getPropertiesMetadata(b),M=[],w=0,g=Object.keys(T);w0?S:m(v,T)}return 0}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=function(){function r(u){this.str=u}return r.prototype.startsWith=function(u){return 0===this.str.indexOf(u)},r.prototype.endsWith=function(u){var n,o=u.split("").reverse().join("");return n=this.str.split("").reverse().join(""),this.startsWith.call({str:n},o)},r.prototype.contains=function(u){return-1!==this.str.indexOf(u)},r.prototype.equals=function(u){return this.str===u},r.prototype.value=function(){return this.str},r}();C.QueryableString=e},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(24),r=function(){function u(n,o,i,a,p){this.id=e.id(),this.serviceIdentifier=n,this.parentContext=o,this.parentRequest=i,this.target=p,this.childRequests=[],this.bindings=Array.isArray(a)?a:[a],this.requestScope=null===i?new Map:null}return u.prototype.addChildRequest=function(n,o,i){var a=new u(n,this.parentContext,this,o,i);return this.childRequests.push(a),a},u}();C.Request=r},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(11),r=t(18),u=t(58),n=t(30),o=t(89),i=function(c,f,d){try{return d()}catch(m){throw u.isStackOverflowExeption(m)?new Error(e.CIRCULAR_DEPENDENCY_IN_FACTORY(c,f.toString())):m}},a=function(c){return function(f){f.parentContext.setCurrentRequest(f);var d=f.bindings,m=f.childRequests,y=f.target&&f.target.isArray(),v=!(f.parentRequest&&f.parentRequest.target&&f.target&&f.parentRequest.target.matchesArray(f.target.serviceIdentifier));if(y&&v)return m.map(function(g){return a(c)(g)});var b=null;if(!f.target.isOptional()||0!==d.length){var T=d[0],M=T.scope===r.BindingScopeEnum.Singleton,O=T.scope===r.BindingScopeEnum.Request;if(M&&T.activated)return T.cache;if(O&&null!==c&&c.has(T.id))return c.get(T.id);if(T.type===r.BindingTypeEnum.ConstantValue)b=T.cache;else if(T.type===r.BindingTypeEnum.Function)b=T.cache;else if(T.type===r.BindingTypeEnum.Constructor)b=T.implementationType;else if(T.type===r.BindingTypeEnum.DynamicValue&&null!==T.dynamicValue)b=i("toDynamicValue",T.serviceIdentifier,function(){return T.dynamicValue(f.parentContext)});else if(T.type===r.BindingTypeEnum.Factory&&null!==T.factory)b=i("toFactory",T.serviceIdentifier,function(){return T.factory(f.parentContext)});else if(T.type===r.BindingTypeEnum.Provider&&null!==T.provider)b=i("toProvider",T.serviceIdentifier,function(){return T.provider(f.parentContext)});else{if(T.type!==r.BindingTypeEnum.Instance||null===T.implementationType){var w=n.getServiceIdentifierAsString(f.serviceIdentifier);throw new Error(e.INVALID_BINDING_TYPE+" "+w)}b=o.resolveInstance(T.implementationType,m,a(c))}return"function"==typeof T.onActivation&&(b=T.onActivation(f.parentContext,b)),M&&(T.cache=b,T.activated=!0),O&&null!==c&&!c.has(T.id)&&c.set(T.id,b),b}}};C.resolve=function p(c){return a(c.plan.rootRequest.requestScope)(c.plan.rootRequest)}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(11),r=t(18),u=t(6);C.resolveInstance=function a(p,c,f){var d=null;return d=c.length>0?function n(p,c,f){var d=c.filter(function(y){return null!==y.target&&y.target.type===r.TargetTypeEnum.ClassProperty}),m=d.map(f);return d.forEach(function(y,v){var b;b=y.target.name.value(),p[b]=m[v]}),p}(d=function o(p,c){return new(p.bind.apply(p,[void 0].concat(c)))}(p,c.filter(function(v){return null!==v.target&&v.target.type===r.TargetTypeEnum.ConstructorArgument}).map(f)),c,f):new p,function i(p,c){if(Reflect.hasMetadata(u.POST_CONSTRUCT,p)){var f=Reflect.getMetadata(u.POST_CONSTRUCT,p);try{c[f.value]()}catch(d){throw new Error(e.POST_CONSTRUCT_ERROR(p.name,d.message))}}}(p,d),d}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(11),r=t(18),u=t(91),n=t(61),o=function(){function i(a){this._binding=a}return i.prototype.to=function(a){return this._binding.type=r.BindingTypeEnum.Instance,this._binding.implementationType=a,new u.BindingInWhenOnSyntax(this._binding)},i.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+e.INVALID_TO_SELF_VALUE);return this.to(this._binding.serviceIdentifier)},i.prototype.toConstantValue=function(a){return this._binding.type=r.BindingTypeEnum.ConstantValue,this._binding.cache=a,this._binding.dynamicValue=null,this._binding.implementationType=null,new n.BindingWhenOnSyntax(this._binding)},i.prototype.toDynamicValue=function(a){return this._binding.type=r.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=a,this._binding.implementationType=null,new u.BindingInWhenOnSyntax(this._binding)},i.prototype.toConstructor=function(a){return this._binding.type=r.BindingTypeEnum.Constructor,this._binding.implementationType=a,new n.BindingWhenOnSyntax(this._binding)},i.prototype.toFactory=function(a){return this._binding.type=r.BindingTypeEnum.Factory,this._binding.factory=a,new n.BindingWhenOnSyntax(this._binding)},i.prototype.toFunction=function(a){if("function"!=typeof a)throw new Error(e.INVALID_FUNCTION_BINDING);var p=this.toConstantValue(a);return this._binding.type=r.BindingTypeEnum.Function,p},i.prototype.toAutoFactory=function(a){return this._binding.type=r.BindingTypeEnum.Factory,this._binding.factory=function(p){return function(){return p.container.get(a)}},new n.BindingWhenOnSyntax(this._binding)},i.prototype.toProvider=function(a){return this._binding.type=r.BindingTypeEnum.Provider,this._binding.provider=a,new n.BindingWhenOnSyntax(this._binding)},i.prototype.toService=function(a){this.toDynamicValue(function(p){return p.container.get(a)})},i}();C.BindingToSyntax=o},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(92),r=t(44),u=t(45),n=function(){function o(i){this._binding=i,this._bindingWhenSyntax=new u.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new r.BindingOnSyntax(this._binding),this._bindingInSyntax=new e.BindingInSyntax(i)}return o.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},o.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},o.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},o.prototype.when=function(i){return this._bindingWhenSyntax.when(i)},o.prototype.whenTargetNamed=function(i){return this._bindingWhenSyntax.whenTargetNamed(i)},o.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},o.prototype.whenTargetTagged=function(i,a){return this._bindingWhenSyntax.whenTargetTagged(i,a)},o.prototype.whenInjectedInto=function(i){return this._bindingWhenSyntax.whenInjectedInto(i)},o.prototype.whenParentNamed=function(i){return this._bindingWhenSyntax.whenParentNamed(i)},o.prototype.whenParentTagged=function(i,a){return this._bindingWhenSyntax.whenParentTagged(i,a)},o.prototype.whenAnyAncestorIs=function(i){return this._bindingWhenSyntax.whenAnyAncestorIs(i)},o.prototype.whenNoAncestorIs=function(i){return this._bindingWhenSyntax.whenNoAncestorIs(i)},o.prototype.whenAnyAncestorNamed=function(i){return this._bindingWhenSyntax.whenAnyAncestorNamed(i)},o.prototype.whenAnyAncestorTagged=function(i,a){return this._bindingWhenSyntax.whenAnyAncestorTagged(i,a)},o.prototype.whenNoAncestorNamed=function(i){return this._bindingWhenSyntax.whenNoAncestorNamed(i)},o.prototype.whenNoAncestorTagged=function(i,a){return this._bindingWhenSyntax.whenNoAncestorTagged(i,a)},o.prototype.whenAnyAncestorMatches=function(i){return this._bindingWhenSyntax.whenAnyAncestorMatches(i)},o.prototype.whenNoAncestorMatches=function(i){return this._bindingWhenSyntax.whenNoAncestorMatches(i)},o.prototype.onActivation=function(i){return this._bindingOnSyntax.onActivation(i)},o}();C.BindingInWhenOnSyntax=n},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(18),r=t(61),u=function(){function n(o){this._binding=o}return n.prototype.inRequestScope=function(){return this._binding.scope=e.BindingScopeEnum.Request,new r.BindingWhenOnSyntax(this._binding)},n.prototype.inSingletonScope=function(){return this._binding.scope=e.BindingScopeEnum.Singleton,new r.BindingWhenOnSyntax(this._binding)},n.prototype.inTransientScope=function(){return this._binding.scope=e.BindingScopeEnum.Transient,new r.BindingWhenOnSyntax(this._binding)},n}();C.BindingInSyntax=u},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=function(){function r(){}return r.of=function(u,n){var o=new r;return o.bindings=u,o.middleware=n,o},r}();C.ContainerSnapshot=e},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(11),r=function(){function u(){this._map=new Map}return u.prototype.getMap=function(){return this._map},u.prototype.add=function(n,o){if(null==n)throw new Error(e.NULL_ARGUMENT);if(null==o)throw new Error(e.NULL_ARGUMENT);var i=this._map.get(n);void 0!==i?(i.push(o),this._map.set(n,i)):this._map.set(n,[o])},u.prototype.get=function(n){if(null==n)throw new Error(e.NULL_ARGUMENT);var o=this._map.get(n);if(void 0!==o)return o;throw new Error(e.KEY_NOT_FOUND)},u.prototype.remove=function(n){if(null==n)throw new Error(e.NULL_ARGUMENT);if(!this._map.delete(n))throw new Error(e.KEY_NOT_FOUND)},u.prototype.removeByCondition=function(n){var o=this;this._map.forEach(function(i,a){var p=i.filter(function(c){return!n(c)});p.length>0?o._map.set(a,p):o._map.delete(a)})},u.prototype.hasKey=function(n){if(null==n)throw new Error(e.NULL_ARGUMENT);return this._map.has(n)},u.prototype.clone=function(){var n=new u;return this._map.forEach(function(o,i){o.forEach(function(a){return n.add(i,a.clone())})}),n},u.prototype.traverse=function(n){this._map.forEach(function(o,i){n(i,o)})},u}();C.Lookup=r},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(24);C.ContainerModule=function n(o){this.id=e.id(),this.registry=o},C.AsyncContainerModule=function n(o){this.id=e.id(),this.registry=o}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(11),r=t(6);C.injectable=function u(){return function(n){if(Reflect.hasOwnMetadata(r.PARAM_TYPES,n))throw new Error(e.DUPLICATED_INJECTABLE_DECORATOR);var o=Reflect.getMetadata(r.DESIGN_PARAM_TYPES,n)||[];return Reflect.defineMetadata(r.PARAM_TYPES,o,n),n}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(14),r=t(19);C.tagged=function u(n,o){return function(i,a,p){var c=new e.Metadata(n,o);"number"==typeof p?r.tagParameter(i,a,p,c):r.tagProperty(i,a,c)}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(6),r=t(14),u=t(19);C.named=function n(o){return function(i,a,p){var c=new r.Metadata(e.NAMED_TAG,o);"number"==typeof p?u.tagParameter(i,a,p,c):u.tagProperty(i,a,c)}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(6),r=t(14),u=t(19);C.optional=function n(){return function(o,i,a){var p=new r.Metadata(e.OPTIONAL_TAG,!0);"number"==typeof a?u.tagParameter(o,i,a,p):u.tagProperty(o,i,p)}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(6),r=t(14),u=t(19);C.unmanaged=function n(){return function(o,i,a){var p=new r.Metadata(e.UNMANAGED_TAG,!0);u.tagParameter(o,i,a,p)}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(6),r=t(14),u=t(19);C.multiInject=function n(o){return function(i,a,p){var c=new r.Metadata(e.MULTI_INJECT_TAG,o);"number"==typeof p?u.tagParameter(i,a,p,c):u.tagProperty(i,a,c)}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(6),r=t(14),u=t(19);C.targetName=function n(o){return function(i,a,p){var c=new r.Metadata(e.NAME_TAG,o);u.tagParameter(i,a,p,c)}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0});var e=t(11),r=t(6),u=t(14);C.postConstruct=function n(){return function(o,i,a){var p=new u.Metadata(r.POST_CONSTRUCT,i);if(Reflect.hasOwnMetadata(r.POST_CONSTRUCT,o.constructor))throw new Error(e.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(r.POST_CONSTRUCT,p,o.constructor)}}},function(L,C,t){"use strict";Object.defineProperty(C,"__esModule",{value:!0}),C.multiBindToService=function(e){return function(r){return function(){for(var u=[],n=0;n1;){var M=T.pop(),O=M.obj[M.prop];if(r(O)){for(var w=[],g=0;g=48&&I<=57||I>=65&&I<=90||I>=97&&I<=122?g+=w.charAt(S):I<128?g+=u[I]:I<2048?g+=u[192|I>>6]+u[128|63&I]:I<55296||I>=57344?g+=u[224|I>>12]+u[128|I>>6&63]+u[128|63&I]:(I=65536+((1023&I)<<10|1023&w.charCodeAt(S+=1)),g+=u[240|I>>18]+u[128|I>>12&63]+u[128|I>>6&63]+u[128|63&I])}return g},isBuffer:function(T){return!(!T||"object"!=typeof T||!(T.constructor&&T.constructor.isBuffer&&T.constructor.isBuffer(T)))},isRegExp:function(T){return"[object RegExp]"===Object.prototype.toString.call(T)},maybeMap:function(T,M){if(r(T)){for(var O=[],w=0;w{f=(v,b)=>{if(v)return y(v);m(b)}});if(Array.isArray(p)||(p=a.NQuads.legacyDatasetToQuads(p)),c.useNative){if(!i)throw new Error("rdf-canonize-native not available");i.canonize(p,c,f)}else if("URDNA2015"===c.algorithm)new r(c).main(p,f);else{if("URGNA2012"!==c.algorithm)throw"algorithm"in c?new Error("Invalid RDF Dataset Canonicalization algorithm: "+c.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.");new u(c).main(p,f)}return d}),a.canonizeSync=function(p,c){if(Array.isArray(p)||(p=a.NQuads.legacyDatasetToQuads(p)),c.useNative){if(i)return i.canonizeSync(p,c);throw new Error("rdf-canonize-native not available")}if("URDNA2015"===c.algorithm)return new n(c).main(p);if("URGNA2012"===c.algorithm)return new o(c).main(p);throw"algorithm"in c?new Error("Invalid RDF Dataset Canonicalization algorithm: "+c.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}},function(L,C,t){(function(e){var r=void 0!==e&&e||typeof self<"u"&&self||window,u=Function.prototype.apply;function n(o,i){this._id=o,this._clearFn=i}C.setTimeout=function(){return new n(u.call(setTimeout,r,arguments),clearTimeout)},C.setInterval=function(){return new n(u.call(setInterval,r,arguments),clearInterval)},C.clearTimeout=C.clearInterval=function(o){o&&o.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(r,this._id)},C.enroll=function(o,i){clearTimeout(o._idleTimeoutId),o._idleTimeout=i},C.unenroll=function(o){clearTimeout(o._idleTimeoutId),o._idleTimeout=-1},C._unrefActive=C.active=function(o){clearTimeout(o._idleTimeoutId);var i=o._idleTimeout;i>=0&&(o._idleTimeoutId=setTimeout(function(){o._onTimeout&&o._onTimeout()},i))},t(162),C.setImmediate=typeof self<"u"&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,C.clearImmediate=typeof self<"u"&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,t(41))},function(L,C,t){"use strict";const e=t(46);L.exports=class Yh{constructor(u){this.prefix=u,this.counter=0,this.existing={}}clone(){const u=new Yh(this.prefix);return u.counter=this.counter,u.existing=e.clone(this.existing),u}getId(u){if(u&&u in this.existing)return this.existing[u];const n=this.prefix+this.counter;return this.counter+=1,u&&(this.existing[u]=n),n}hasId(u){return u in this.existing}}},function(L,C,t){var e=t(4);t(36),t(8);var r=L.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=r,r.create=function(){n||function i(){u=String.fromCharCode(128),u+=e.util.fillString(String.fromCharCode(0),64),o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=!0}();var p=null,c=e.util.createBuffer(),f=new Array(64),d={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){d.messageLength=0,d.fullMessageLength=d.messageLength64=[];for(var m=d.messageLengthSize/4,y=0;y>>0,v>>>0];for(var b=d.fullMessageLength.length-1;b>=0;--b)d.fullMessageLength[b]+=v[1],v[1]=v[0]+(d.fullMessageLength[b]/4294967296>>>0),d.fullMessageLength[b]=d.fullMessageLength[b]>>>0,v[0]=v[1]/4294967296>>>0;return c.putBytes(m),a(p,f,c),(c.read>2048||0===c.length())&&c.compact(),d},d.digest=function(){var b,m=e.util.createBuffer();m.putBytes(c.bytes()),m.putBytes(u.substr(0,d.blockLength-(d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize&d.blockLength-1)));for(var M=8*d.fullMessageLength[0],O=0;O>>0,m.putInt32(M>>>0),M=b>>>0;m.putInt32(M);var w={h0:p.h0,h1:p.h1,h2:p.h2,h3:p.h3,h4:p.h4,h5:p.h5,h6:p.h6,h7:p.h7};a(w,f,m);var g=e.util.createBuffer();return g.putInt32(w.h0),g.putInt32(w.h1),g.putInt32(w.h2),g.putInt32(w.h3),g.putInt32(w.h4),g.putInt32(w.h5),g.putInt32(w.h6),g.putInt32(w.h7),g},d};var u=null,n=!1,o=null;function a(p,c,f){for(var d,m,T,M,O,w,g,S,I,h,E,x,A=f.length();A>=64;){for(M=0;M<16;++M)c[M]=f.getInt32();for(;M<64;++M)d=((d=c[M-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,m=((m=c[M-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,c[M]=d+c[M-7]+m+c[M-16]|0;for(O=p.h0,w=p.h1,g=p.h2,S=p.h3,I=p.h4,h=p.h5,E=p.h6,x=p.h7,M=0;M<64;++M)T=O&w|g&(O^w),d=x+((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(E^I&(h^E))+o[M]+c[M],x=E,E=h,h=I,I=S+d>>>0,S=g,g=w,w=O,O=d+(m=((O>>>2|O<<30)^(O>>>13|O<<19)^(O>>>22|O<<10))+T)>>>0;p.h0=p.h0+O|0,p.h1=p.h1+w|0,p.h2=p.h2+g|0,p.h3=p.h3+S|0,p.h4=p.h4+I|0,p.h5=p.h5+h|0,p.h6=p.h6+E|0,p.h7=p.h7+x|0,A-=64}}},function(L,C,t){"use strict";const u="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",n="http://www.w3.org/2001/XMLSchema#string",o={};function i(d,m){for(const y in d)if(d[y].termType!==m[y].termType||d[y].value!==m[y].value)return!1;return"Literal"!==d.object.termType||d.object.datatype.termType===m.object.datatype.termType&&d.object.datatype.value===m.object.datatype.value&&d.object.language===m.object.language}(()=>{const d="(?:<([^:]+:[^>]*)>)",y="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd_",v=y+"0-9-\xb7\u0300-\u036f\u203f-\u2040",b="(_:(?:["+y+"0-9])(?:(?:["+v+".])*(?:["+v+"]))?)",S="[ \\t]+",I="[ \\t]*",h="(?:"+d+"|"+b+")"+S,E=d+S,x="(?:"+d+"|"+b+'|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^'+d+")|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))"+I,A="(?:\\.|(?:(?:"+d+"|"+b+")"+I+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^[ \\t]*$"),o.quad=new RegExp("^"+I+h+E+x+A+I+"$")})(),L.exports=class rd{static parse(m){const y=[],v={},b=m.split(o.eoln);let T=0;for(const M of b){if(T++,o.empty.test(M))continue;const O=M.match(o.quad);if(null===O)throw new Error("N-Quads parse error on line "+T+".");const w={};if(w.subject=void 0!==O[1]?{termType:"NamedNode",value:O[1]}:{termType:"BlankNode",value:O[2]},w.predicate={termType:"NamedNode",value:O[3]},void 0!==O[4]?w.object={termType:"NamedNode",value:O[4]}:void 0!==O[5]?w.object={termType:"BlankNode",value:O[5]}:(w.object={termType:"Literal",value:void 0,datatype:{termType:"NamedNode"}},void 0!==O[7]?w.object.datatype.value=O[7]:void 0!==O[8]?(w.object.datatype.value=u,w.object.language=O[8]):w.object.datatype.value=n,w.object.value=O[6].replace(c,function(m,y,v,b){if(y)switch(y){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(v)return String.fromCharCode(parseInt(v,16));if(b)throw new Error("Unsupported U escape")})),w.graph=void 0!==O[9]?{termType:"NamedNode",value:O[9]}:void 0!==O[10]?{termType:"BlankNode",value:O[10]}:{termType:"DefaultGraph",value:""},w.graph.value in v){let g=!0;const S=v[w.graph.value];for(const I of S)if(i(I,w)){g=!1;break}g&&(S.push(w),y.push(w))}else v[w.graph.value]=[w],y.push(w)}return y}static serialize(m){Array.isArray(m)||(m=rd.legacyDatasetToQuads(m));const y=[];for(const v of m)y.push(rd.serializeQuad(v));return y.sort().join("")}static serializeQuad(m){const b=m.object,T=m.graph;let M="";return[m.subject,m.predicate].forEach(O=>{M+="NamedNode"===O.termType?"<"+O.value+">":O.value,M+=" "}),"NamedNode"===b.termType?M+="<"+b.value+">":"BlankNode"===b.termType?M+=b.value:(M+='"'+function p(d){return d.replace(a,function(m){switch(m){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}})}(b.value)+'"',b.datatype.value===u?b.language&&(M+="@"+b.language):b.datatype.value!==n&&(M+="^^<"+b.datatype.value+">")),"NamedNode"===T.termType?M+=" <"+T.value+">":"BlankNode"===T.termType&&(M+=" "+T.value),M+=" .\n",M}static legacyDatasetToQuads(m){const y=[],v={"blank node":"BlankNode",IRI:"NamedNode",literal:"Literal"};for(const b in m)m[b].forEach(M=>{const O={};for(const w in M){const g=M[w],S={termType:v[g.type],value:g.value};"Literal"===S.termType&&(S.datatype={termType:"NamedNode"},"datatype"in g&&(S.datatype.value=g.datatype),"language"in g?("datatype"in g||(S.datatype.value=u),S.language=g.language):"datatype"in g||(S.datatype.value=n)),O[w]=S}O.graph="@default"===b?{termType:"DefaultGraph",value:""}:{termType:b.startsWith("_:")?"BlankNode":"NamedNode",value:b},y.push(O)});return y}};const a=/["\\\n\r]/g,c=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g},function(L,C,t){"use strict";L.exports=class{constructor(){this._requests={}}wrapLoader(r){const u=this;return u._loader=r,function(){return u.add.apply(u,arguments)}}async add(r){let u=this._requests[r];if(u)return Promise.resolve(u);u=this._requests[r]=this._loader(r);try{return await u}finally{delete this._requests[r]}}}},function(L,C,t){var e=t(4);t(8),L.exports=e.cipher=e.cipher||{},e.cipher.algorithms=e.cipher.algorithms||{},e.cipher.createCipher=function(u,n){var o=u;if("string"==typeof o&&(o=e.cipher.getAlgorithm(o))&&(o=o()),!o)throw new Error("Unsupported algorithm: "+u);return new e.cipher.BlockCipher({algorithm:o,key:n,decrypt:!1})},e.cipher.createDecipher=function(u,n){var o=u;if("string"==typeof o&&(o=e.cipher.getAlgorithm(o))&&(o=o()),!o)throw new Error("Unsupported algorithm: "+u);return new e.cipher.BlockCipher({algorithm:o,key:n,decrypt:!0})},e.cipher.registerAlgorithm=function(u,n){u=u.toUpperCase(),e.cipher.algorithms[u]=n},e.cipher.getAlgorithm=function(u){return(u=u.toUpperCase())in e.cipher.algorithms?e.cipher.algorithms[u]:null};var r=e.cipher.BlockCipher=function(u){this.algorithm=u.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=u.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=u.decrypt,this.algorithm.initialize(u)};r.prototype.start=function(u){u=u||{};var n={};for(var o in u)n[o]=u[o];n.decrypt=this._decrypt,this._finish=!1,this._input=e.util.createBuffer(),this.output=u.output||e.util.createBuffer(),this.mode.start(n)},r.prototype.update=function(u){for(u&&this._input.putBuffer(u);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},r.prototype.finish=function(u){!u||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(o){return u(this.blockSize,o,!1)},this.mode.unpad=function(o){return u(this.blockSize,o,!0)});var n={};return n.decrypt=this._decrypt,n.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,n)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,n)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,n)))}},function(L,C,t){var e=t(4);t(36),t(8);var r=L.exports=e.md5=e.md5||{};e.md.md5=e.md.algorithms.md5=r,r.create=function(){a||function p(){u=String.fromCharCode(128),u+=e.util.fillString(String.fromCharCode(0),64),n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],o=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],i=new Array(64);for(var f=0;f<64;++f)i[f]=Math.floor(4294967296*Math.abs(Math.sin(f+1)));a=!0}();var f=null,d=e.util.createBuffer(),m=new Array(16),y={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){y.messageLength=0,y.fullMessageLength=y.messageLength64=[];for(var v=y.messageLengthSize/4,b=0;b>>0,T>>>0];for(var M=y.fullMessageLength.length-1;M>=0;--M)y.fullMessageLength[M]+=T[1],T[1]=T[0]+(y.fullMessageLength[M]/4294967296>>>0),y.fullMessageLength[M]=y.fullMessageLength[M]>>>0,T[0]=T[1]/4294967296>>>0;return d.putBytes(v),c(f,m,d),(d.read>2048||0===d.length())&&d.compact(),y},y.digest=function(){var v=e.util.createBuffer();v.putBytes(d.bytes()),v.putBytes(u.substr(0,y.blockLength-(y.fullMessageLength[y.fullMessageLength.length-1]+y.messageLengthSize&y.blockLength-1)));for(var M,O=0,w=y.fullMessageLength.length-1;w>=0;--w)O=(M=8*y.fullMessageLength[w]+O)/4294967296>>>0,v.putInt32Le(M>>>0);var g={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3};c(g,m,v);var S=e.util.createBuffer();return S.putInt32Le(g.h0),S.putInt32Le(g.h1),S.putInt32Le(g.h2),S.putInt32Le(g.h3),S},y};var u=null,n=null,o=null,i=null,a=!1;function c(f,d,m){for(var y,v,b,T,M,w,g,S=m.length();S>=64;){for(v=f.h0,b=f.h1,T=f.h2,M=f.h3,g=0;g<16;++g)d[g]=m.getInt32Le(),y=v+(M^b&(T^M))+i[g]+d[g],v=M,M=T,T=b,b+=y<<(w=o[g])|y>>>32-w;for(;g<32;++g)y=v+(T^M&(b^T))+i[g]+d[n[g]],v=M,M=T,T=b,b+=y<<(w=o[g])|y>>>32-w;for(;g<48;++g)y=v+(b^T^M)+i[g]+d[n[g]],v=M,M=T,T=b,b+=y<<(w=o[g])|y>>>32-w;for(;g<64;++g)y=v+(T^(b|~M))+i[g]+d[n[g]],v=M,M=T,T=b,b+=y<<(w=o[g])|y>>>32-w;f.h0=f.h0+v|0,f.h1=f.h1+b|0,f.h2=f.h2+T|0,f.h3=f.h3+M|0,S-=64}}},function(L,C,t){(function(e){var r=t(4);t(66),t(36),t(8);var n,u=r.pkcs5=r.pkcs5||{};r.util.isNodejs&&!r.options.usePureJavaScript&&(n=t(115)),L.exports=r.pbkdf2=u.pbkdf2=function(o,i,a,p,c,f){if("function"==typeof c&&(f=c,c=null),r.util.isNodejs&&!r.options.usePureJavaScript&&n.pbkdf2&&(null===c||"object"!=typeof c)&&(n.pbkdf2Sync.length>4||!c||"sha1"===c))return"string"!=typeof c&&(c="sha1"),o=e.from(o,"binary"),i=e.from(i,"binary"),f?4===n.pbkdf2Sync.length?n.pbkdf2(o,i,a,p,function(E,x){if(E)return f(E);f(null,x.toString("binary"))}):n.pbkdf2(o,i,a,p,c,function(E,x){if(E)return f(E);f(null,x.toString("binary"))}):4===n.pbkdf2Sync.length?n.pbkdf2Sync(o,i,a,p).toString("binary"):n.pbkdf2Sync(o,i,a,p,c).toString("binary");if(null==c&&(c="sha1"),"string"==typeof c){if(!(c in r.md.algorithms))throw new Error("Unknown hash algorithm: "+c);c=r.md[c].create()}var d=c.digestLength;if(p>4294967295*d){var m=new Error("Derived key is too long.");if(f)return f(m);throw m}var y=Math.ceil(p/d),v=p-(y-1)*d,b=r.hmac.create();b.start(c,o);var M,O,w,T="";if(!f){for(var g=1;g<=y;++g){b.start(null,null),b.update(i),b.update(r.util.int32ToBytes(g)),M=w=b.digest().getBytes();for(var S=2;S<=a;++S)b.start(null,null),b.update(w),O=b.digest().getBytes(),M=r.util.xorBytes(M,O,d),w=O;T+=gy)return f(null,T);b.start(null,null),b.update(i),b.update(r.util.int32ToBytes(g)),M=w=b.digest().getBytes(),S=2,h()}function h(){if(S<=a)return b.start(null,null),b.update(w),O=b.digest().getBytes(),M=r.util.xorBytes(M,O,d),w=O,++S,r.util.setImmediate(h);T+=g128)throw new Error('Invalid "nsComment" content.');I.value=r.create(r.Class.UNIVERSAL,r.Type.IA5STRING,!1,I.comment)}else if("subjectKeyIdentifier"===I.name&&h.cert){var ee=h.cert.generateSubjectKeyIdentifier();I.subjectKeyIdentifier=ee.toHex(),I.value=r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,ee.getBytes())}else if("authorityKeyIdentifier"===I.name&&h.cert){if(I.value=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]),B=I.value.value,I.keyIdentifier){var Ee=!0===I.keyIdentifier?h.cert.generateSubjectKeyIdentifier().getBytes():I.keyIdentifier;B.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!1,Ee))}if(I.authorityCertIssuer){var K=[r.create(r.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===I.authorityCertIssuer?h.cert.issuer:I.authorityCertIssuer)])];B.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,K))}if(I.serialNumber){var Le=e.util.hexToBytes(!0===I.serialNumber?h.cert.serialNumber:I.serialNumber);B.push(r.create(r.Class.CONTEXT_SPECIFIC,2,!1,Le))}}else if("cRLDistributionPoints"===I.name){I.value=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]),B=I.value.value;var U,Q=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]),j=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[]);for(Z=0;Z2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(U.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(B.validity.notBefore=U[0],B.validity.notAfter=U[1],B.tbsCertificate=E.tbsCertificate,h){var A;if(B.md=null,B.signatureOid in n)switch(n[B.signatureOid]){case"sha1WithRSAEncryption":B.md=e.md.sha1.create();break;case"md5WithRSAEncryption":B.md=e.md.md5.create();break;case"sha256WithRSAEncryption":case"RSASSA-PSS":B.md=e.md.sha256.create();break;case"sha384WithRSAEncryption":B.md=e.md.sha384.create();break;case"sha512WithRSAEncryption":B.md=e.md.sha512.create()}if(null===B.md)throw(A=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=B.signatureOid,A;var Z=r.toDer(B.tbsCertificate);B.md.update(Z.getBytes())}var ee=e.md.sha1.create();B.issuer.getField=function(K){return d(B.issuer,K)},B.issuer.addField=function(K){b([K]),B.issuer.attributes.push(K)},B.issuer.attributes=u.RDNAttributesAsArray(E.certIssuer,ee),E.certIssuerUniqueId&&(B.issuer.uniqueId=E.certIssuerUniqueId),B.issuer.hash=ee.digest().toHex();var Ee=e.md.sha1.create();return B.subject.getField=function(K){return d(B.subject,K)},B.subject.addField=function(K){b([K]),B.subject.attributes.push(K)},B.subject.attributes=u.RDNAttributesAsArray(E.certSubject,Ee),E.certSubjectUniqueId&&(B.subject.uniqueId=E.certSubjectUniqueId),B.subject.hash=Ee.digest().toHex(),B.extensions=E.certExtensions?u.certificateExtensionsFromAsn1(E.certExtensions):[],B.publicKey=u.publicKeyFromAsn1(E.subjectPublicKeyInfo),B},u.certificateExtensionsFromAsn1=function(I){for(var h=[],E=0;E1&&(x=E.value.charCodeAt(1),A=E.value.length>2?E.value.charCodeAt(2):0),h.digitalSignature=128==(128&x),h.nonRepudiation=64==(64&x),h.keyEncipherment=32==(32&x),h.dataEncipherment=16==(16&x),h.keyAgreement=8==(8&x),h.keyCertSign=4==(4&x),h.cRLSign=2==(2&x),h.encipherOnly=1==(1&x),h.decipherOnly=128==(128&A)}else if("basicConstraints"===h.name){h.cA=(E=r.fromDer(h.value)).value.length>0&&E.value[0].type===r.Type.BOOLEAN&&0!==E.value[0].value.charCodeAt(0);var D=null;E.value.length>0&&E.value[0].type===r.Type.INTEGER?D=E.value[0].value:E.value.length>1&&(D=E.value[1].value),null!==D&&(h.pathLenConstraint=r.derToInteger(D))}else if("extKeyUsage"===h.name)for(var E=r.fromDer(h.value),B=0;B1&&(x=E.value.charCodeAt(1)),h.client=128==(128&x),h.server=64==(64&x),h.email=32==(32&x),h.objsign=16==(16&x),h.reserved=8==(8&x),h.sslCA=4==(4&x),h.emailCA=2==(2&x),h.objCA=1==(1&x);else if("subjectAltName"===h.name||"issuerAltName"===h.name){var U;h.altNames=[],E=r.fromDer(h.value);for(var Z=0;Z=w&&I0&&x.value.push(u.certificateExtensionsToAsn1(I.extensions)),x},u.getCertificationRequestInfo=function(I){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(I.version).getBytes()),y(I.subject),u.publicKeyToAsn1(I.publicKey),O(I)])},u.distinguishedNameToAsn1=function(I){return y(I)},u.certificateToAsn1=function(I){var h=I.tbsCertificate||u.getTBSCertificate(I);return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[h,r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(I.signatureOid).getBytes()),M(I.signatureOid,I.signatureParameters)]),r.create(r.Class.UNIVERSAL,r.Type.BITSTRING,!1,String.fromCharCode(0)+I.signature)])},u.certificateExtensionsToAsn1=function(I){var h=r.create(r.Class.CONTEXT_SPECIFIC,3,!0,[]),E=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]);h.value.push(E);for(var x=0;xU.validity.notAfter)&&(B={message:"Certificate is not valid yet or has expired.",error:u.certificateError.certificate_expired,notBefore:U.validity.notBefore,notAfter:U.validity.notAfter,now:A}),null===B){if(null===(Z=h[0]||I.getIssuer(U))&&U.isIssuer(U)&&(ee=!0,Z=U),Z){var Ee=Z;e.util.isArray(Ee)||(Ee=[Ee]);for(var K=!1;!K&&Ee.length>0;){Z=Ee.shift();try{K=Z.verify(U)}catch{}}K||(B={message:"Certificate signature is invalid.",error:u.certificateError.bad_certificate})}null!==B||Z&&!ee||I.hasCertificate(U)||(B={message:"Certificate is not trusted.",error:u.certificateError.unknown_ca})}if(null===B&&Z&&!U.isIssuer(Z)&&(B={message:"Certificate issuer is invalid.",error:u.certificateError.bad_certificate}),null===B)for(var Le={keyUsage:!0,basicConstraints:!0},Q=0;null===B&&QF.pathLenConstraint&&(B={message:"Certificate basicConstraints pathLenConstraint violated.",error:u.certificateError.bad_certificate})}var we=null===B||B.error,he=E.verify?E.verify(we,N,x):we;if(!0!==he)throw!0===we&&(B={message:"The application rejected the certificate.",error:u.certificateError.bad_certificate}),(he||0===he)&&("object"!=typeof he||e.util.isArray(he)?"string"==typeof he&&(B.error=he):(he.message&&(B.message=he.message),he.error&&(B.error=he.error))),B;B=null,D=!1,++N}while(h.length>0);return!0}},function(L,C,t){var e=t(4);t(33),t(8),(L.exports=e.pss=e.pss||{}).create=function(u){3===arguments.length&&(u={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var p,n=u.md,o=u.mgf,i=n.digestLength,a=u.salt||null;if("string"==typeof a&&(a=e.util.createBuffer(a)),"saltLength"in u)p=u.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");p=a.length()}if(null!==a&&a.length()!==p)throw new Error("Given salt length does not match length of given salt.");var c=u.prng||e.random;return{encode:function(d,m){var y,M,v=m-1,b=Math.ceil(v/8),T=d.digest().getBytes();if(b>8*b-v&255;return(E=String.fromCharCode(E.charCodeAt(0)&~x)+E.substr(1))+w+String.fromCharCode(188)},verify:function(d,m,y){var v,b=y-1,T=Math.ceil(b/8);if(m=m.substr(-T),T>8*T-b&255;if(O.charCodeAt(0)&g)throw new Error("Bits beyond keysize not zero as expected.");var S=o.generate(w,M),I="";for(v=0;v{e.pkcs5.pbkdf2(o,i,a,p,(d,m)=>d?f(d):c(m))})}publicNode({controller:o=this.controller,owner:i=this.owner}={}){const a={id:this.id,type:this.type};return o&&(a.controller=o),i&&(a.owner=i),this.addEncodedPublicKey(a),a}async export(){const o=this.publicNode();return this.addEncryptedPrivateKey(o)}}},function(L,C,t){"use strict";(function(e){const r=t(136),u=t(48),{md:{sha256:n},pki:{getPublicKeyFingerprint:o,publicKeyFromPem:i},util:{binary:{base58:a,raw:p}}}=u,c=t(118),f=2048;class m extends c{constructor(M={}){super(M),this.type="RsaVerificationKey2018",this.privateKeyPem=M.privateKeyPem,this.publicKeyPem=M.publicKeyPem,this.validateKeyParams()}get publicKey(){return this.publicKeyPem}get privateKey(){return this.privateKeyPem}static async generate(M={}){return new Promise((O,w)=>{u.pki.rsa.generateKeyPair({bits:f,e:65537,workers:-1},(g,S)=>{if(g)return w(g);O(new m({publicKeyPem:u.pki.publicKeyToPem(S.publicKey),privateKeyPem:u.pki.privateKeyToPem(S.privateKey),...M}))})})}static async from(M){return new m({publicKey:M.publicKeyPem,privateKeyPem:M.privateKeyPem||M.privateKeyPem&&M.privateKey.privateKeyPem,type:M.type||M.keyType,...M})}validateKeyParams(){if(this.publicKeyPem){const M=u.pki.publicKeyFromPem(this.publicKeyPem),O=M.n.bitLength();if(O!==f)throw new Error("Invalid RSA keyBit length "+JSON.stringify(O)+" required value is 2048");if("65537"!==M.e.toString(10))throw new Error("Invalid RSA exponent "+JSON.stringify(M.e.toString(10))+" required value is 65537}")}if(this.privateKeyPem){const M=u.pki.privateKeyFromPem(this.privateKeyPem),O=M.n.bitLength();if(O!==f)throw new Error("Invalid RSA keyBit length "+JSON.stringify(O)+" required value is 2048");if("65537"!==M.e.toString(10))throw new Error("Invalid RSA exponent "+JSON.stringify(M.e.toString(10))+" required value is 65537}")}}addEncodedPublicKey(M){return M.publicKeyPem=this.publicKeyPem,M}async addEncryptedPrivateKey(M){return M.privateKeyPem=null!==this.passphrase?u.pki.encryptRsaPrivateKey(u.pki.privateKeyFromPem(this.privateKeyPem),this.passphrase,{algorithm:"aes256"}):this.privateKeyPem,M}fingerprint(){const M=u.util.createBuffer(),O=u.pki.getPublicKeyFingerprint(u.pki.publicKeyFromPem(this.publicKeyPem),{md:n.create()});return M.putBytes(u.util.hexToBytes("5d1220")),M.putBytes(O.bytes()),"z"+a.encode(M)}verifyFingerprint(M){if("string"!=typeof M||"z"!==M[0])return{error:new Error("`fingerprint` must be a multibase encoded string."),valid:!1};const O=a.decode(M.slice(1)),w=o(i(this.publicKeyPem),{md:n.create()}),g="5d1220"===O.slice(0,3).toString("hex")&&w.toHex()===O.slice(3).toString("hex");return g?{valid:g}:{error:new Error("The fingerprint does not match the public key."),valid:!1}}signer(){return function y(T){if(!T.privateKeyPem)return{async sign(){throw new Error("No private key to sign with.")}};if(r.nodejs){const O=t(67);if("RSA_PKCS1_PSS_PADDING"in O.constants)return{async sign({data:w}){const g=O.createSign("RSA-SHA256");g.update(e.from(w.buffer,w.byteOffset,w.length));const S=g.sign({key:T.privateKeyPem,padding:O.constants.RSA_PKCS1_PSS_PADDING,saltLength:O.constants.RSA_PSS_SALTLEN_DIGEST});return new Uint8Array(S.buffer,S.byteOffset,S.length)}}}const M=u.pki.privateKeyFromPem(T.privateKeyPem);return{async sign({data:O}){const w=b(),g=n.create();g.update(p.encode(O),"binary");const S=M.sign(g,w);return p.decode(S)}}}(this)}verifier(){return function v(T){if(r.nodejs){const O=t(67);if("RSA_PKCS1_PSS_PADDING"in O.constants)return{async verify({data:w,signature:g}){const S=O.createVerify("RSA-SHA256");return S.update(e.from(w.buffer,w.byteOffset,w.length)),S.verify({key:T.publicKeyPem,padding:O.constants.RSA_PKCS1_PSS_PADDING,saltLength:O.constants.RSA_PSS_SALTLEN_DIGEST},e.from(g.buffer,g.byteOffset,g.length))}}}const M=i(T.publicKeyPem);return{async verify({data:O,signature:w}){const g=b(),S=n.create();S.update(p.encode(O),"binary");try{return M.verify(S.digest().bytes(),p.encode(w),g)}catch{return!1}}}}(this)}}function b(){const T=n.create();return u.pss.create({md:T,mgf:u.mgf.mgf1.create(n.create()),saltLength:T.digestLength})}L.exports=m}).call(this,t(37).Buffer)},function(L,C){},function(L,C){},function(L,C,t){"use strict";const e=t(123),r=t(64),u=t(152);L.exports=class extends e{constructor({type:o,alg:i,LDKeyClass:a,creator:p,verificationMethod:c,signer:f,key:d,proof:m,date:y,useNativeCanonize:v}={}){if(super({type:o,creator:p,verificationMethod:c,proof:m,date:y,useNativeCanonize:v}),this.alg=i,this.LDKeyClass=a,this.signer=f,d){if(void 0===c&&void 0===p){const b=d.publicNode();b.owner?this.creator=b.id:this.verificationMethod=b.id}this.key=d,"function"==typeof d.signer&&(this.signer=d.signer()),"function"==typeof d.verifier&&(this.verifier=d.verifier())}}async sign({verifyData:o,proof:i}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");const p=u.encodeBase64Url(JSON.stringify({alg:this.alg,b64:!1,crit:["b64"]})),c=u.createJws({encodedHeader:p,verifyData:o}),f=await this.signer.sign({data:c}),d=u.encodeBase64Url(f);return i.jws=p+".."+d,i}async verifySignature({verifyData:o,verificationMethod:i,proof:a}){if(!a.jws||"string"!=typeof a.jws||!a.jws.includes("."))throw new TypeError('The proof does not include a valid "jws" property.');const[p,,c]=a.jws.split(".");let f;try{f=JSON.parse(u.decodeBase64UrlToString(p))}catch(v){throw new Error("Could not parse JWS header; "+v)}if(!f||"object"!=typeof f)throw new Error("Invalid JWS header.");if((f.alg!==this.alg||!1!==f.b64||!Array.isArray(f.crit)||1!==f.crit.length||"b64"!==f.crit[0])&&3===Object.keys(f).length)throw new Error(`Invalid JWS header parameters for ${this.type}.`);const d=u.decodeBase64Url(c),m=u.createJws({encodedHeader:p,verifyData:o});let{verifier:y}=this;return y||(y=(await this.LDKeyClass.from(i)).verifier()),y.verify({data:m,signature:d})}async assertVerificationMethod({verificationMethod:o}){if(!r.hasValue(o,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`)}async getVerificationMethod({proof:o,documentLoader:i}){if(this.key)return this.key.publicNode();const a=await super.getVerificationMethod({proof:o,documentLoader:i});return await this.assertVerificationMethod({verificationMethod:a}),a}async matchProof({proof:o,document:i,purpose:a,documentLoader:p,expansionMap:c}){if(!await super.matchProof({proof:o,document:i,purpose:a,documentLoader:p,expansionMap:c}))return!1;if(!this.key)return!0;let{verificationMethod:f}=o;return f||(f=o.creator),"object"==typeof f?f.id===this.key.id:f===this.key.id}}},function(L,C,t){"use strict";const e=t(63),r=t(64),u=t(152),n=t(154);L.exports=class extends n{constructor({type:i,creator:a,verificationMethod:p,proof:c,date:f,useNativeCanonize:d}={}){if(void 0!==p&&"string"!=typeof p)throw new TypeError('"verificationMethod" must be a URL string.');if(super({type:i}),this.creator=a,this.verificationMethod=p,this.proof=c,void 0!==f&&(this.date=new Date(f),isNaN(this.date)))throw TypeError(`"date" "${f}" is not a valid date.`);this.useNativeCanonize=d}async createProof({document:i,purpose:a,documentLoader:p,expansionMap:c,compactProof:f}){let d;d=this.proof?await r.compact(this.proof,e.SECURITY_CONTEXT_URL,{documentLoader:p,expansionMap:c,compactToRelative:!1}):{"@context":e.SECURITY_CONTEXT_URL},d.type=this.type;let m=this.date;void 0===d.created&&void 0===m&&(m=new Date),void 0!==m&&"string"!=typeof m&&(m=u.w3cDate(m)),void 0!==m&&(d.created=m),void 0!==this.verificationMethod&&(d.verificationMethod=this.verificationMethod),void 0!==this.creator&&(d.creator=this.creator),d=await this.updateProof({document:i,proof:d,purpose:a,documentLoader:p,expansionMap:c,compactProof:f}),d=await a.update(d,{document:i,suite:this,documentLoader:p,expansionMap:c});const y=await this.createVerifyData({document:i,proof:d,documentLoader:p,expansionMap:c,compactProof:f});return d=await this.sign({verifyData:y,document:i,proof:d,documentLoader:p,expansionMap:c}),d}async updateProof({proof:i}){return i}async verifyProof({proof:i,document:a,purpose:p,documentLoader:c,expansionMap:f,compactProof:d}){try{const m=await this.createVerifyData({document:a,proof:i,documentLoader:c,expansionMap:f,compactProof:d}),y=await this.getVerificationMethod({proof:i,document:a,documentLoader:c,expansionMap:f});if(!await this.verifySignature({verifyData:m,verificationMethod:y,document:a,proof:i,documentLoader:c,expansionMap:f}))throw new Error("Invalid signature.");const b=await p.validate(i,{document:a,suite:this,verificationMethod:y,documentLoader:c,expansionMap:f});if(!b.valid)throw b.error;return{verified:!0,purposeResult:b}}catch(m){return{verified:!1,error:m}}}async canonize(i,{documentLoader:a,expansionMap:p,skipExpansion:c}){return r.canonize(i,{algorithm:"URDNA2015",format:"application/n-quads",documentLoader:a,expansionMap:p,skipExpansion:c,useNative:this.useNativeCanonize})}async canonizeProof(i,{documentLoader:a,expansionMap:p}){return delete(i={...i}).jws,delete i.signatureValue,delete i.proofValue,this.canonize(i,{documentLoader:a,expansionMap:p,skipExpansion:!1})}async createVerifyData({document:i,proof:a,documentLoader:p,expansionMap:c}){const f=await this.canonizeProof(a,{documentLoader:p,expansionMap:c}),d=await this.canonize(i,{documentLoader:p,expansionMap:c});return u.concat(u.sha256(f),u.sha256(d))}async getVerificationMethod({proof:i,documentLoader:a}){let{verificationMethod:p}=i;if(!p){const{creator:f}=i;p=f}if("object"==typeof p&&(p=p.id),!p)throw new Error('No "verificationMethod" or "creator" found in proof.');const{"@graph":[c]}=await r.frame(p,{"@context":e.SECURITY_CONTEXT_URL,"@embed":"@always",id:p},{documentLoader:a,compactToRelative:!1});if(!c)throw new Error(`Verification method ${p} not found.`);if(void 0!==c.revoked)throw new Error("The verification method has been revoked.");return c}async sign(){throw new Error("Must be implemented by a derived class.")}async verifySignature(){throw new Error("Must be implemented by a derived class.")}}},function(L,C){},function(L,C,t){"use strict";var e=t(7),r=t(5),u=t(10),n=t(9),o=t(25),i=function(d){function m(y,v){var b=d.call(this)||this;return b.subject=y,b.subscriber=v,b.closed=!1,b}return e.a(m,d),m.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var y=this.subject,v=y.observers;if(this.subject=null,v&&0!==v.length&&!y.isStopped&&!y.closed){var b=v.indexOf(this.subscriber);-1!==b&&v.splice(b,1)}}},m}(n.a),a=t(15);t.d(C,"a",function(){return c});var p=function(d){function m(y){var v=d.call(this,y)||this;return v.destination=y,v}return e.a(m,d),m}(u.a),c=function(d){function m(){var y=d.call(this)||this;return y.observers=[],y.closed=!1,y.isStopped=!1,y.hasError=!1,y.thrownError=null,y}return e.a(m,d),m.prototype[a.a]=function(){return new p(this)},m.prototype.lift=function(y){var v=new f(this,this);return v.operator=y,v},m.prototype.next=function(y){if(this.closed)throw new o.a;if(!this.isStopped)for(var v=this.observers,b=v.length,T=v.slice(),M=0;M{d.forEach(c,(b,T,M)=>{d.forEachComponent(b,O=>{if("BlankNode"!==O.termType)return;const w=O.value;w in d.blankNodeInfo?d.blankNodeInfo[w].quads.push(b):(y[w]=!0,d.blankNodeInfo[w]={quads:[b]})}),M()},v)},v=>{let b=!0;d.whilst(()=>b,T=>{b=!1,d.hashToBlankNodes={},d.waterfall([M=>{d.forEach(y,(O,w,g)=>{d.hashFirstDegreeQuads(w,(S,I)=>{if(S)return g(S);I in d.hashToBlankNodes?d.hashToBlankNodes[I].push(w):d.hashToBlankNodes[I]=[w],g()})},M)},M=>{const O=Object.keys(d.hashToBlankNodes).sort();d.forEach(O,(w,g,S)=>{const I=d.hashToBlankNodes[w];if(I.length>1)return S();const h=I[0];d.canonicalIssuer.getId(h),delete y[h],delete d.hashToBlankNodes[w],b=!0,S()},M)}],T)},v)},v=>{const b=Object.keys(d.hashToBlankNodes).sort();d.forEach(b,(T,M,O)=>{const w=[],g=d.hashToBlankNodes[T];d.waterfall([S=>{d.forEach(g,(I,h,E)=>{if(d.canonicalIssuer.hasId(I))return E();const x=new r("_:b");x.getId(I),d.hashNDegreeQuads(I,x,(A,D)=>{if(A)return E(A);w.push(D),E()})},S)},S=>{w.sort((I,h)=>I.hashh.hash?1:0),d.forEach(w,(I,h,E)=>{for(const x in I.issuer.existing)d.canonicalIssuer.getId(x);E()},S)}],O)},v)},v=>{const b=[];d.waterfall([T=>{d.forEach(d.quads,(M,O,w)=>{d.forEachComponent(M,g=>{"BlankNode"!==g.termType||g.value.startsWith(d.canonicalIssuer.prefix)||(g.value=d.canonicalIssuer.getId(g.value))}),b.push(o.serializeQuad(M)),w()},T)},T=>(b.sort(),m=b.join(""),T())],v)}],v=>f(v,m))}hashFirstDegreeQuads(c,f){const d=this,m=d.blankNodeInfo[c];if("hash"in m)return f(null,m.hash);const y=[];d.forEach(m.quads,(b,T,M)=>{const O={predicate:b.predicate};d.forEachComponent(b,(w,g)=>{O[g]=d.modifyFirstDegreeComponent(c,w,g)}),y.push(o.serializeQuad(O)),M()},b=>{if(b)return f(b);y.sort();const T=new u(d.hashAlgorithm);for(let M=0;Mv.canonicalIssuer.hasId(c)?(b=v.canonicalIssuer.getId(c),T()):d.hasId(c)?(b=d.getId(c),T()):void v.hashFirstDegreeQuads(c,(M,O)=>{if(M)return T(M);b=O,T()})],T=>{if(T)return y(T);const M=new u(v.hashAlgorithm);return M.update(m),"g"!==m&&M.update(v.getRelatedPredicate(f)),M.update(b),y(null,M.digest())})}hashNDegreeQuads(c,f,d){const m=this;let y;const v=new u(m.hashAlgorithm);m.waterfall([b=>m.createHashToRelated(c,f,(T,M)=>{if(T)return b(T);y=M,b()}),b=>{const T=Object.keys(y).sort();m.forEach(T,(M,O,w)=>{v.update(M);let S,g="";const I=new n(y[M]);m.whilst(()=>I.hasNext(),h=>{const E=I.next();let x=f.clone(),A="";const D=[];m.waterfall([B=>{m.forEach(E,(N,U,Z)=>{if(m.canonicalIssuer.hasId(N)?A+=m.canonicalIssuer.getId(N):(x.hasId(N)||D.push(N),A+=x.getId(N)),0!==g.length&&A>g)return h();Z()},B)},B=>{m.forEach(D,(N,U,Z)=>{m.hashNDegreeQuads(N,x,(ee,Ee)=>ee?Z(ee):(A+=x.getId(N),A+="<"+Ee.hash+">",x=Ee.issuer,0!==g.length&&A>g?h():void Z()))},B)},B=>{(0===g.length||A{if(h)return w(h);v.update(g),f=S,w()})},b)}],b=>{d(b,{hash:v.digest(),issuer:f})})}modifyFirstDegreeComponent(c,f){return"BlankNode"!==f.termType||((f=i.clone(f)).value=f.value===c?"_:a":"_:z"),f}getRelatedPredicate(c){return"<"+c.predicate.value+">"}createHashToRelated(c,f,d){const m=this,y={};m.forEach(m.blankNodeInfo[c].quads,(b,T,M)=>{m.forEach(b,(O,w,g)=>{if("predicate"===w||"BlankNode"!==O.termType||O.value===c)return g();const S=O.value;m.hashRelatedBlankNode(S,b,f,a[w],(h,E)=>{if(h)return g(h);E in y?y[E].push(S):y[E]=[S],g()})},M)},b=>d(b,y))}forEachComponent(c,f){for(const d in c)"predicate"!==d&&f(c[d],d,c)}}},function(L,C,t){"use strict";const e=t(4);t(36),t(52),t(109),L.exports=class{constructor(u){this.md=e.md[u].create()}update(u){this.md.update(u,"utf8")}digest(){return this.md.digest().toHex()}}},function(L,C,t){"use strict";L.exports=class{constructor(r){this.list=r.sort(),this.done=!1,this.left={};for(let u=0;uu)&&(p&&i>0&&a>this.list[i-1]||!p&&ithis.list[i+1])&&(u=a,n=i)}if(null===u)this.done=!0;else{const i=this.left[u]?n-1:n+1;this.list[n]=this.list[i],this.list[i]=u;for(let a=0;au&&(this.left[this.list[a]]=!this.left[this.list[a]])}return r}}},function(L,C,t){"use strict";const e=t(108),r=t(129),u=t(130),n=t(110),o=t(46),i={subject:"s",object:"o",graph:"g"};L.exports=class{constructor(){this.name="URDNA2015",this.blankNodeInfo={},this.hashToBlankNodes={},this.canonicalIssuer=new e("_:c14n"),this.hashAlgorithm="sha256"}main(p){const c=this;c.quads=p;const f={};for(const v of p)c.forEachComponent(v,b=>{if("BlankNode"!==b.termType)return;const T=b.value;T in c.blankNodeInfo?c.blankNodeInfo[T].quads.push(v):(f[T]=!0,c.blankNodeInfo[T]={quads:[v]})});let d=!0;for(;d;){d=!1,c.hashToBlankNodes={};for(const b in f){const T=c.hashFirstDegreeQuads(b);T in c.hashToBlankNodes?c.hashToBlankNodes[T].push(b):c.hashToBlankNodes[T]=[b]}const v=Object.keys(c.hashToBlankNodes).sort();for(let b=0;b1)continue;const O=M[0];c.canonicalIssuer.getId(O),delete f[O],delete c.hashToBlankNodes[T],d=!0}}const m=Object.keys(c.hashToBlankNodes).sort();for(let v=0;vO.hashw.hash?1:0);for(let O=0;O{"BlankNode"!==T.termType||T.value.startsWith(c.canonicalIssuer.prefix)||(T.value=c.canonicalIssuer.getId(T.value))}),y.push(n.serializeQuad(b))}return y.sort(),y.join("")}hashFirstDegreeQuads(p){const c=this,f=c.blankNodeInfo[p];if("hash"in f)return f.hash;const d=[],m=f.quads;for(let v=0;v{T[O]=c.modifyFirstDegreeComponent(p,M,O)}),d.push(n.serializeQuad(T))}d.sort();const y=new r(c.hashAlgorithm);for(let v=0;vT){h=!0;break}}if(!h){for(let E=0;E",g=A.issuer,0!==T.length&&S>T){h=!0;break}}h||(0===T.length||S"}createHashToRelated(p,c){const f=this,d={},m=f.blankNodeInfo[p].quads;for(let y=0;y1,v=(g,S,I)=>{const h=g[f].get(S);if(h){const E=h.value;if(b(g,E)){if(M(g,h),!g[o])return}else I&&(g[d]&&(h.value.now=Date.now()),g[c].unshiftNode(h));return E.value}},b=(g,S)=>{if(!S||!S.maxAge&&!g[i])return!1;const I=Date.now()-S.now;return S.maxAge?I>S.maxAge:g[i]&&I>g[i]},T=g=>{if(g[u]>g[r])for(let S=g[c].tail;g[u]>g[r]&&null!==S;){const I=S.prev;M(g,S),S=I}},M=(g,S)=>{if(S){const I=S.value;g[a]&&g[a](I.key,I.value),g[u]-=I.length,g[f].delete(I.key),g[c].removeNode(S)}};class O{constructor(S,I,h,E,x){this.key=S,this.value=I,this.length=h,this.now=E,this.maxAge=x||0}}const w=(g,S,I,h)=>{let E=I.value;b(g,E)&&(M(g,I),g[o]||(E=void 0)),E&&S.call(h,E.value,E.key,g)};L.exports=class y{constructor(S){if("number"==typeof S&&(S={max:S}),S||(S={}),S.max&&("number"!=typeof S.max||S.max<0))throw new TypeError("max must be a non-negative number");this[r]=S.max||1/0;const h=S.length||m;if(this[n]="function"!=typeof h?m:h,this[o]=S.stale||!1,S.maxAge&&"number"!=typeof S.maxAge)throw new TypeError("maxAge must be a number");this[i]=S.maxAge||0,this[a]=S.dispose,this[p]=S.noDisposeOnSet||!1,this[d]=S.updateAgeOnGet||!1,this.reset()}set max(S){if("number"!=typeof S||S<0)throw new TypeError("max must be a non-negative number");this[r]=S||1/0,T(this)}get max(){return this[r]}set allowStale(S){this[o]=!!S}get allowStale(){return this[o]}set maxAge(S){if("number"!=typeof S)throw new TypeError("maxAge must be a non-negative number");this[i]=S,T(this)}get maxAge(){return this[i]}set lengthCalculator(S){"function"!=typeof S&&(S=m),S!==this[n]&&(this[n]=S,this[u]=0,this[c].forEach(I=>{I.length=this[n](I.value,I.key),this[u]+=I.length})),T(this)}get lengthCalculator(){return this[n]}get length(){return this[u]}get itemCount(){return this[c].length}rforEach(S,I){I=I||this;for(let h=this[c].tail;null!==h;){const E=h.prev;w(this,S,h,I),h=E}}forEach(S,I){I=I||this;for(let h=this[c].head;null!==h;){const E=h.next;w(this,S,h,I),h=E}}keys(){return this[c].toArray().map(S=>S.key)}values(){return this[c].toArray().map(S=>S.value)}reset(){this[a]&&this[c]&&this[c].length&&this[c].forEach(S=>this[a](S.key,S.value)),this[f]=new Map,this[c]=new e,this[u]=0}dump(){return this[c].map(S=>!b(this,S)&&{k:S.key,v:S.value,e:S.now+(S.maxAge||0)}).toArray().filter(S=>S)}dumpLru(){return this[c]}set(S,I,h){if((h=h||this[i])&&"number"!=typeof h)throw new TypeError("maxAge must be a number");const E=h?Date.now():0,x=this[n](I,S);if(this[f].has(S)){if(x>this[r])return M(this,this[f].get(S)),!1;const B=this[f].get(S).value;return this[a]&&(this[p]||this[a](S,B.value)),B.now=E,B.maxAge=h,B.value=I,this[u]+=x-B.length,B.length=x,this.get(S),T(this),!0}const A=new O(S,I,x,E,h);return A.length>this[r]?(this[a]&&this[a](S,I),!1):(this[u]+=A.length,this[c].unshift(A),this[f].set(S,this[c].head),T(this),!0)}has(S){if(!this[f].has(S))return!1;const I=this[f].get(S).value;return!b(this,I)}get(S){return v(this,S,!0)}peek(S){return v(this,S,!1)}pop(){const S=this[c].tail;return S?(M(this,S),S.value):null}del(S){M(this,this[f].get(S))}load(S){this.reset();const I=Date.now();for(let h=S.length-1;h>=0;h--){const E=S[h],x=E.e||0;if(0===x)this.set(E.k,E.v);else{const A=x-I;A>0&&this.set(E.k,E.v,A)}}}prune(){this[f].forEach((S,I)=>v(this,I,!1))}}},function(L,C,t){"use strict";const e=t(190),r={};L.exports=r,r.extendContextLoader=u=>async n=>{const o=e[n];return void 0!==o?{contextUrl:null,documentUrl:n,document:o}:u(n)},r.strictDocumentLoader=r.extendContextLoader(u=>{throw new Error(u+" not found.")})},function(L,C,t){"use strict";const e=t(72);L.exports=class extends e{constructor({controller:u,date:n,maxTimestampDelta:o=1/0}={}){super({term:"publicKey",controller:u,date:n,maxTimestampDelta:o})}async update(u){return u}async match(u){return void 0===u.proofPurpose}}},function(L,C,t){"use strict";L.exports=class{constructor({term:r,date:u,maxTimestampDelta:n=1/0}={}){if(void 0===r)throw new Error('"term" is required.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxTimestampDelta" must be a number.');if(this.term=r,void 0!==u&&(this.date=new Date(u),isNaN(this.date)))throw TypeError(`"date" "${u}" is not a valid date.`);this.maxTimestampDelta=n}async validate(r,{}){try{if(this.maxTimestampDelta!==1/0){const p=(this.date||new Date).getTime(),c=1e3*this.maxTimestampDelta,f=new Date(r.created).getTime();if(!(f>=p-c&&f<=p+c))throw new Error("The proof's created timestamp is out of range.")}return{valid:!0}}catch(p){return{valid:!1,error:p}}}async update(r,{}){return r.proofPurpose=this.term,r}async match(r,{}){return r.proofPurpose===this.term}}},function(L,C,t){"use strict";(function(e){const r=void 0!==e&&e.versions&&e.versions.node,u=!r&&(typeof window<"u"||typeof self<"u");L.exports={nodejs:r,browser:u}}).call(this,t(27))},function(L,C,t){var e=t(4);t(8),e.cipher=e.cipher||{};var r=L.exports=e.cipher.modes=e.cipher.modes||{};function u(i,a){if("string"==typeof i&&(i=e.util.createBuffer(i)),e.util.isArray(i)&&i.length>4){var p=i;i=e.util.createBuffer();for(var c=0;c0))return!0;for(var c=0;c0))return!0;for(var c=0;c0)return!1;var p=i.length(),c=i.at(p-1);return!(c>this.blockSize<<2||(i.truncate(c),0))},r.cbc=function(i){i=i||{},this.name="CBC",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},r.cbc.prototype.start=function(i){if(null===i.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in i))throw new Error("Invalid IV parameter.");this._iv=u(i.iv,this.blockSize),this._prev=this._iv.slice(0)}},r.cbc.prototype.encrypt=function(i,a,p){if(i.length()0))return!0;for(var c=0;c0))return!0;for(var c=0;c0)return!1;var p=i.length(),c=i.at(p-1);return!(c>this.blockSize<<2||(i.truncate(c),0))},r.cfb=function(i){i=i||{},this.name="CFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},r.cfb.prototype.start=function(i){if(!("iv"in i))throw new Error("Invalid IV parameter.");this._iv=u(i.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},r.cfb.prototype.encrypt=function(i,a,p){var c=i.length();if(0===c)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&c>=this.blockSize)for(var f=0;f0&&(d=this.blockSize-d),this._partialOutput.clear(),f=0;f0)i.read-=this.blockSize;else for(f=0;f0&&this._partialOutput.getBytes(this._partialBytes),d>0&&!p)return a.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=d,!0;a.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}},r.cfb.prototype.decrypt=function(i,a,p){var c=i.length();if(0===c)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&c>=this.blockSize)for(var f=0;f0&&(d=this.blockSize-d),this._partialOutput.clear(),f=0;f0)i.read-=this.blockSize;else for(f=0;f0&&this._partialOutput.getBytes(this._partialBytes),d>0&&!p)return a.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=d,!0;a.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}},r.ofb=function(i){i=i||{},this.name="OFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},r.ofb.prototype.start=function(i){if(!("iv"in i))throw new Error("Invalid IV parameter.");this._iv=u(i.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},r.ofb.prototype.encrypt=function(i,a,p){var c=i.length();if(0===i.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&c>=this.blockSize)for(var f=0;f0&&(d=this.blockSize-d),this._partialOutput.clear(),f=0;f0)i.read-=this.blockSize;else for(f=0;f0&&this._partialOutput.getBytes(this._partialBytes),d>0&&!p)return a.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=d,!0;a.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}},r.ofb.prototype.decrypt=r.ofb.prototype.encrypt,r.ctr=function(i){i=i||{},this.name="CTR",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},r.ctr.prototype.start=function(i){if(!("iv"in i))throw new Error("Invalid IV parameter.");this._iv=u(i.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},r.ctr.prototype.encrypt=function(i,a,p){var c=i.length();if(0===c)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&c>=this.blockSize)for(var f=0;f0&&(d=this.blockSize-d),this._partialOutput.clear(),f=0;f0&&(i.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),d>0&&!p)return a.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=d,!0;a.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}n(this._inBlock)},r.ctr.prototype.decrypt=r.ctr.prototype.encrypt,r.gcm=function(i){i=i||{},this.name="GCM",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0,this._R=3774873600},r.gcm.prototype.start=function(i){if(!("iv"in i))throw new Error("Invalid IV parameter.");var p,a=e.util.createBuffer(i.iv);if(this._cipherLength=0,p="additionalData"in i?e.util.createBuffer(i.additionalData):e.util.createBuffer(),this._tagLength="tagLength"in i?i.tagLength:128,this._tag=null,i.decrypt&&(this._tag=e.util.createBuffer(i.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var c=a.length();if(12===c)this._j0=[a.getInt32(),a.getInt32(),a.getInt32(),1];else{for(this._j0=[0,0,0,0];a.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*c)))}this._inBlock=this._j0.slice(0),n(this._inBlock),this._partialBytes=0,p=e.util.createBuffer(p),this._aDataLength=o(8*p.length());var f=p.length()%this.blockSize;for(f&&p.fillWithByte(0,this.blockSize-f),this._s=[0,0,0,0];p.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[p.getInt32(),p.getInt32(),p.getInt32(),p.getInt32()])},r.gcm.prototype.encrypt=function(i,a,p){var c=i.length();if(0===c)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&c>=this.blockSize){for(var f=0;f0&&(d=this.blockSize-d),this._partialOutput.clear(),f=0;f0&&this._partialOutput.getBytes(this._partialBytes),d>0&&!p)return i.read-=this.blockSize,a.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=d,!0;a.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),n(this._inBlock)},r.gcm.prototype.decrypt=function(i,a,p){var c=i.length();if(c0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock),this._hashBlock[0]=i.getInt32(),this._hashBlock[1]=i.getInt32(),this._hashBlock[2]=i.getInt32(),this._hashBlock[3]=i.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var f=0;f0;--c)a[c]=i[c]>>>1|(1&i[c-1])<<31;a[0]=i[0]>>>1,p&&(a[0]^=this._R)},r.gcm.prototype.tableMultiply=function(i){for(var a=[0,0,0,0],p=0;p<32;++p){var d=this._m[p][i[p/8|0]>>>4*(7-p%8)&15];a[0]^=d[0],a[1]^=d[1],a[2]^=d[2],a[3]^=d[3]}return a},r.gcm.prototype.ghash=function(i,a,p){return a[0]^=p[0],a[1]^=p[1],a[2]^=p[2],a[3]^=p[3],this.tableMultiply(a)},r.gcm.prototype.generateHashTable=function(i,a){for(var p=8/a,c=4*p,f=16*p,d=new Array(f),m=0;m>>1,f=new Array(p);f[c]=i.slice(0);for(var d=c>>>1;d>0;)this.pow(f[2*d],f[d]=[]),d>>=1;for(d=2;d>1,pe=Re+(1&k.length),ve=k.substr(0,pe),Y=k.substr(Re,pe),X=e.util.createBuffer(),re=e.hmac.create();ne=se+ne;var be=Math.ceil(Se/16),ke=Math.ceil(Se/20);re.start("MD5",ve);var Qe=e.util.createBuffer();X.putBytes(ne);for(var ie=0;ie0&&(c.queue(k,c.createAlert(k,{level:c.Alert.Level.warning,description:c.Alert.Description.no_renegotiation})),c.flush(k)),k.process()},c.parseHelloMessage=function(k,se,ne){var Se=null,tt=k.entity===c.ConnectionEnd.client;if(ne<38)k.error(k,{message:tt?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});else{var Re=se.fragment,pe=Re.length();if(Se={version:{major:Re.getByte(),minor:Re.getByte()},random:e.util.createBuffer(Re.getBytes(32)),session_id:a(Re,1),extensions:[]},tt?(Se.cipher_suite=Re.getBytes(2),Se.compression_method=Re.getByte()):(Se.cipher_suites=a(Re,2),Se.compression_methods=a(Re,1)),(pe=ne-(pe-Re.length()))>0){for(var ve=a(Re,2);ve.length()>0;)Se.extensions.push({type:[ve.getByte(),ve.getByte()],data:a(ve,2)});if(!tt)for(var Y=0;Y