!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DIVOC=t():e.DIVOC=t()}(window,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=143)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,i,n,a){var s=r(0),o=r(92),c=e.exports=s.util=s.util||{};function u(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function l(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(c.isArrayBuffer(e)||c.isArrayBufferView(e))if(void 0!==a&&e instanceof a)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(n=Date.now(),o(e)):(r.push(e),1===r.length&&s.setAttribute("a",a=!a))}}c.nextTick=c.setImmediate}(),c.isNodejs=void 0!==t&&t.versions&&t.versions.node,c.globalScope=c.isNodejs?n:"undefined"==typeof self?window:self,c.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},c.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},c.isArrayBufferView=function(e){return e&&c.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},c.ByteBuffer=l,c.ByteStringBuffer=l;c.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},c.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},c.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},c.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},c.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},c.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},c.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(c.encodeUtf8(e))},c.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},c.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},c.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},c.ByteStringBuffer.prototype.putInt=function(e,t){u(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},c.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},c.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},c.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},c.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},c.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},c.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},c.ByteStringBuffer.prototype.copy=function(){var e=c.createBuffer(this.data);return e.read=this.read,e},c.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},c.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},c.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},c.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+t);return i.set(r),this.data=new DataView(i.buffer),this},c.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},c.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},c.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},c.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},c.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},c.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},c.DataBuffer.prototype.putInt=function(e,t){u(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},c.DataBuffer.prototype.putSignedInt=function(e,t){return u(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},c.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},c.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},c.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},c.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},c.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},c.DataBuffer.prototype.copy=function(){return new c.DataBuffer(this)},c.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},c.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},c.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},c.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},c.xorBytes=function(e,t,r){for(var i="",n="",a="",s=0,o=0;r>0;--r,++s)n=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(i+=a,a="",o=0),a+=String.fromCharCode(n),++o;return i+=a},c.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],h="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";c.encode64=function(e,t){for(var r,i,n,a="",s="",o=0;o>2),a+=d.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=d.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":d.charAt(63&n)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},c.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,i,n,a="",s=0;s>4),64!==i&&(a+=String.fromCharCode((15&r)<<4|i>>2),64!==n&&(a+=String.fromCharCode((3&i)<<6|n)));return a},c.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},c.decodeUtf8=function(e){return decodeURIComponent(escape(e))},c.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},c.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},c.binary.raw.decode=function(e,t,r){var i=t;i||(i=new Uint8Array(e.length));for(var n=r=r||0,a=0;a>2),a+=d.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=d.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":d.charAt(63&n)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},c.binary.base64.decode=function(e,t,r){var i,n,a,s,o=t;o||(o=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c>4,64!==a&&(o[u++]=(15&n)<<4|a>>2,64!==s&&(o[u++]=(3&a)<<6|s));return t?u-r:o.subarray(0,u)},c.binary.base58.encode=function(e,t){return c.binary.baseN.encode(e,h,t)},c.binary.base58.decode=function(e,t){return c.binary.baseN.decode(e,h,t)},c.text={utf8:{},utf16:{}},c.text.utf8.encode=function(e,t,r){e=c.encodeUtf8(e);var i=t;i||(i=new Uint8Array(e.length));for(var n=r=r||0,a=0;a0?(n=r[i].substring(0,s),a=r[i].substring(s+1)):(n=r[i],a=null),n in t||(t[n]=[]),n in Object.prototype||null===a||t[n].push(unescape(a))}return t};return void 0===e?(null===C&&(C="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=C):t=r(e),t},c.parseFragment=function(e){var t=e,r="",i=e.indexOf("?");i>0&&(t=e.substring(0,i),r=e.substring(i+1));var n=t.split("/");return n.length>0&&""===n[0]&&n.shift(),{pathString:t,queryString:r,path:n,query:""===r?{}:c.getQueryVariables(r)}},c.makeRequest=function(e){var t=c.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var i;return void 0===e?i=t.query:(i=t.query[e])&&void 0!==r&&(i=i[r]),i},getQueryLast:function(e,t){var i=r.getQuery(e);return i?i[i.length-1]:t}};return r},c.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var i=jQuery.param(t||{});return r=r||"",e+(i.length>0?"?"+i:"")+(r.length>0?"#"+r:"")},c.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},c.format=function(e){for(var t,r,i=/%./g,n=0,a=[],s=0;t=i.exec(e);){(r=e.substring(s,i.lastIndex-2)).length>0&&a.push(r),s=i.lastIndex;var o=t[0][1];switch(o){case"s":case"o":n");break;case"%":a.push("%");break;default:a.push("<%"+o+"?>")}}return a.push(e.substring(s)),a.join("")},c.formatNumber=function(e,t,r,i){var n=e,a=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===i?".":i,c=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(a),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(a?s+Math.abs(n-u).toFixed(a).slice(2):"")},c.formatSize=function(e){return e=e>=1073741824?c.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?c.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?c.formatNumber(e/1024,0)+" KiB":c.formatNumber(e,0)+" bytes"},c.bytesFromIP=function(e){return-1!==e.indexOf(".")?c.bytesFromIPv4(e):-1!==e.indexOf(":")?c.bytesFromIPv6(e):null},c.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=c.createBuffer(),r=0;rr[i].end-r[i].start&&(i=r.length-1)):r.push({start:o,end:o})}t.push(a)}if(r.length>0){var u=r[i];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},c.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in c&&!e.update)return t(null,c.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return c.cores=navigator.hardwareConcurrency,t(null,c.cores);if("undefined"==typeof Worker)return c.cores=1,t(null,c.cores);if("undefined"==typeof Blob)return c.cores=2,t(null,c.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()o.st&&n.stn.st&&o.st"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e),i.isDouble=e=>i.isNumber(e)&&-1!==String(e).indexOf("."),i.isEmptyObject=e=>i.isObject(e)&&0===Object.keys(e).length,i.isNumber=e=>"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e),i.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),i.isObject=e=>"[object Object]"===Object.prototype.toString.call(e),i.isString=e=>"string"==typeof e||"[object String]"===Object.prototype.toString.call(e),i.isUndefined=e=>void 0===e},function(e,t,r){var i=r(0);r(12),r(39),r(61),r(1),i.random&&i.random.getBytes?e.exports=i.random:function(t){var r={},n=new Array(4),a=i.util.createBuffer();function s(){var e=i.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=i.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),i.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=i.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return i.aes._updateBlock(e,t,n,!1),a.putInt32(n[0]),a.putInt32(n[1]),a.putInt32(n[2]),a.putInt32(n[3]),a.getBytes()},r.increment=function(e){return++e[3],e},r.md=i.md.sha256;var o=s(),c=null,u=i.util.globalScope,l=u.crypto||u.msCrypto;if(l&&l.getRandomValues&&(c=function(e){return l.getRandomValues(e)}),i.options.usePureJavaScript||!i.util.isNodejs&&!c){if("undefined"==typeof window||window.document,o.collectInt(+new Date,32),"undefined"!=typeof navigator){var d="";for(var p in navigator)try{"string"==typeof navigator[p]&&(d+=navigator[p])}catch(e){}o.collect(d),d=null}t&&(t().mousemove((function(e){o.collectInt(e.clientX,16),o.collectInt(e.clientY,16)})),t().keypress((function(e){o.collectInt(e.charCode,8)})))}if(i.random)for(var p in o)i.random[p]=o[p];else i.random=o;i.random.createInstance=s,e.exports=i.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,r){"use strict";const i=r(9),n=r(2),a=r(46).IdentifierIssuer,s=r(5),o=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,u=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,l={accept:"application/ld+json, application/json"},d={};e.exports=d,d.IdentifierIssuer=a,d.clone=function(e){if(e&&"object"==typeof e){let t;if(n.isArray(e)){t=[];for(let r=0;r{if(Object.keys(e).some(e=>"accept"===e.toLowerCase()))throw new RangeError('Accept header may not be specified; only "'+l.accept+'" is supported.');return Object.assign({Accept:l.accept},e)},d.parseLinkHeader=e=>{const t={},r=e.match(o);for(let e=0;e{if(n.isString(e)||n.isEmptyObject(e))return;let t=!1;if(n.isArray(e)){t=!0;for(let r=0;r{if(e.hasOwnProperty(t)){const r=e[t];return!n.isArray(r)||r.length>0}return!1},d.hasValue=(e,t,r)=>{if(d.hasProperty(e,t)){let a=e[t];const s=i.isList(a);if(n.isArray(a)||s){s&&(a=a["@list"]);for(let e=0;e{if("propertyIsArray"in(i=i||{})||(i.propertyIsArray=!1),"valueIsArray"in i||(i.valueIsArray=!1),"allowDuplicate"in i||(i.allowDuplicate=!0),"prependValue"in i||(i.prependValue=!1),i.valueIsArray)e[t]=r;else if(n.isArray(r)){0===r.length&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(r=r.concat(e[t]),e[t]=[]);for(let n=0;n[].concat(e[t]||[]),d.removeProperty=(e,t)=>{delete e[t]},d.removeValue=(e,t,r,i)=>{"propertyIsArray"in(i=i||{})||(i.propertyIsArray=!1);const n=d.getValues(e,t).filter(e=>!d.compareValues(e,r));0===n.length?d.removeProperty(e,t):1!==n.length||i.propertyIsArray?e[t]=n:e[t]=n[0]},d.relabelBlankNodes=(e,t)=>function e(t,r){if(n.isArray(r))for(let i=0;ie===t||(!(!i.isValue(e)||!i.isValue(t)||e["@value"]!==t["@value"]||e["@type"]!==t["@type"]||e["@language"]!==t["@language"]||e["@index"]!==t["@index"])||!!(n.isObject(e)&&"@id"in e&&n.isObject(t)&&"@id"in t)&&e["@id"]===t["@id"]),d.compareShortestLeast=(e,t)=>e.length * @license MIT */ var i=r(88),n=r(89),a=r(90);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return K(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return _(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function y(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function m(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,n);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,i,n){var a,s=1,o=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,o/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var l=-1;for(a=r;ao&&(r=o-c),a=r;a>=0;a--){for(var d=!0,p=0;pn&&(i=n):i=n;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var s=0;s>8,n=r%256,a.push(n),a.push(i);return a}(t,e.length-r),e,r,i)}function I(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n239?4:u>223?3:u>191?2:1;if(n+d<=r)switch(d){case 1:u<128&&(l=u);break;case 2:128==(192&(a=e[n+1]))&&(c=(31&u)<<6|63&a)>127&&(l=c);break;case 3:a=e[n+1],s=e[n+2],128==(192&a)&&128==(192&s)&&(c=(15&u)<<12|(63&a)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:a=e[n+1],s=e[n+2],o=e[n+3],128==(192&a)&&128==(192&s)&&128==(192&o)&&(c=(15&u)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},c.prototype.compare=function(e,t,r,i,n){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(t>>>=0),o=Math.min(a,s),u=this.slice(i,n),l=e.slice(t,r),d=0;dn)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return C(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;ni)&&(r=i);for(var n="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,i,n,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function L(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-r,2);n>>8*(i?n:1-n)}function D(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-r,4);n>>8*(i?n:3-n)&255}function O(e,t,r,i,n,a){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(e,t,r,i,a){return a||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function U(e,t,r,i,a){return a||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}c.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},c.prototype.readUInt8=function(e,t){return t||N(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||N(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||N(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var i=this[e],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},c.prototype.readInt8=function(e,t){return t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||N(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||N(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||N(e,4,this.length),n.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||N(e,4,this.length),n.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||N(e,8,this.length),n.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||N(e,8,this.length),n.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||R(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+n]=e/a&255;return t+r},c.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=0,s=1,o=0;for(this[t]=255&e;++a>0)-o&255;return t+r},c.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=r-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(a<1e3||!c.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function j(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(16))},function(e,t,r){var i=r(0);r(1),r(13);var n=e.exports=i.asn1=i.asn1||{};function a(e,t,r){if(r>t){var i=new Error("Too few bytes to parse DER.");throw i.available=e.length(),i.remaining=t,i.requested=r,i}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(e,t,r,a,s){if(i.util.isArray(a)){for(var o=[],c=0;cr){if(s.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=t.length(),f.remaining=r,f.requested=h,f}h=r}var g=32==(32&c);if(g)if(d=[],void 0===h)for(;;){if(a(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}o=t.length(),d.push(e(t,r,i+1,s)),r-=o-t.length()}else for(;h>0;)o=t.length(),d.push(e(t,h,i+1,s)),r-=o-t.length(),h-=o-t.length();void 0===d&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&(p=t.bytes(h));if(void 0===d&&s.decodeBitStrings&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&h>1){var y=t.read,m=r,v=0;if(l===n.Type.BITSTRING&&(a(t,r,1),v=t.getByte(),r--),0===v)try{o=t.length();var b={verbose:s.verbose,strict:!0,decodeBitStrings:!0},w=e(t,r,i+1,b),C=o-t.length();r-=C,l==n.Type.BITSTRING&&C++;var E=w.tagClass;C!==h||E!==n.Class.UNIVERSAL&&E!==n.Class.CONTEXT_SPECIFIC||(d=[w])}catch(e){}void 0===d&&(t.read=y,r=m)}if(void 0===d){if(void 0===h){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=r}if(l===n.Type.BMPSTRING)for(d="";h>0;h-=2)a(t,r,2),d+=String.fromCharCode(t.getInt16()),r-=2;else d=t.getBytes(h)}var S=void 0===p?null:{bitStringContents:p};return n.create(u,l,g,d,S)}(e,e.length(),0,t)},n.toDer=function(e){var t=i.util.createBuffer(),r=e.tagClass|e.type,a=i.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=n.equals(e,e.original))),s)a.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:a.putByte(0);for(var o=0;o1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?a.putBytes(e.value.substr(1)):a.putBytes(e.value);if(t.putByte(r),a.length()<=127)t.putByte(127&a.length());else{var c=a.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(o=u.length-1;o>=0;--o)t.putByte(u.charCodeAt(o))}return t.putBuffer(a),t},n.oidToDer=function(e){var t,r,n,a,s=e.split("."),o=i.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c>>=7,t||(a|=128),r.push(a),t=!1}while(n>0);for(var u=r.length-1;u>=0;--u)o.putByte(r[u])}return o},n.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},n.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,i,n),t.setUTCHours(a,s,o,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},n.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),i=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var d=e.length-5,p=e.charAt(d);"+"!==p&&"-"!==p||(u=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),u*=6e4,"+"===p&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,i,n),t.setUTCHours(a,s,o,c),t.setTime(+t+u)):(t.setFullYear(r,i,n),t.setHours(a,s,o,c)),t},n.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var i=0;i=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},n.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},n.validate=function(e,t,r,a){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)a&&(e.tagClass!==t.tagClass&&a.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&a.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&i.util.isArray(t.value))for(var o=0,c=0;s&&c0&&(a+="\n");for(var o="",c=0;c1?a+="0x"+i.util.bytesToHex(e.value.slice(1)):a+="(none)",e.value.length>0){var p=e.value.charCodeAt(0);1==p?a+=" (1 unused bit shown)":p>1&&(a+=" ("+p+" unused bits shown)")}}else e.type===n.Type.OCTETSTRING?(s.test(e.value)||(a+="("+e.value+") "),a+="0x"+i.util.bytesToHex(e.value)):e.type===n.Type.UTF8?a+=i.util.decodeUtf8(e.value):e.type===n.Type.PRINTABLESTRING||e.type===n.Type.IA5String?a+=e.value:s.test(e.value)?a+="0x"+i.util.bytesToHex(e.value):0===e.value.length?a+="[null]":a+=e.value}return a}},function(e,t,r){var i=r(0);e.exports=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{}},function(e,t,r){"use strict";const i=r(2),n={};e.exports=n,n.isSubject=e=>{if(i.isObject(e)&&!("@value"in e||"@set"in e||"@list"in e)){return Object.keys(e).length>1||!("@id"in e)}return!1},n.isSubjectReference=e=>i.isObject(e)&&1===Object.keys(e).length&&"@id"in e,n.isValue=e=>i.isObject(e)&&"@value"in e,n.isList=e=>i.isObject(e)&&"@list"in e,n.isGraph=e=>i.isObject(e)&&"@graph"in e&&1===Object.keys(e).filter(e=>"@id"!==e&&"@index"!==e).length,n.isSimpleGraph=e=>n.isGraph(e)&&!("@id"in e),n.isBlankNode=e=>!!i.isObject(e)&&("@id"in e?0===e["@id"].indexOf("_:"):0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e))},function(e,t,r){"use strict"; /*! * Copyright (c) 2010-2018 Digital Bazaar, Inc. All rights reserved. */const i={};e.exports=i;const n=r(27);Object.assign(i,n);const a=r(130),s=r(134);i.sign=async function(e,{suite:t,purpose:r,documentLoader:i,expansionMap:n,compactProof:s}={}){try{return await(new a).add(e,{suite:t,purpose:r,documentLoader:i,expansionMap:n,compactProof:s})}catch(e){if(!i&&"jsonld.InvalidUrl"===e.name){const{details:{url:t}}=e,r=new Error(`A URL "${t}" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling "sign".`);throw r.cause=e,r}throw e}},i.verify=async function(e,{suite:t,purpose:r,documentLoader:i,expansionMap:n,compactProof:o}={}){const c=await(new a).verify(e,{suite:t,purpose:r,documentLoader:i,expansionMap:n,compactProof:o}),{error:u}=c;if(u)if(i||"jsonld.InvalidUrl"!==u.name)c.error=new s(u);else{const{details:{url:e}}=u,t=new Error(`A URL "${e}" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling "verify".`);c.error=new s(t)}return c},i.suites=r(135).suites,i.purposes=r(140).purposes,Object.assign(i,r(22)),Object.assign(i,r(77))},function(e,t){var r,i,n=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c,u=[],l=!1,d=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&h())}function h(){if(!l){var e=o(p);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d1)for(var r=1;r>>=2;for(n=0;n>8^255&d^99,a[g]=d,s[d]=g,h=(p=e[d])<<24^d<<16^d<<8^d^p,f=((r=e[g])^(i=e[r])^(n=e[i]))<<24^(g^n)<<16^(g^i^n)<<8^g^r^n;for(var m=0;m<4;++m)c[m][g]=h,u[m][d]=f,h=h<<24|h>>>8,f=f<<24|f>>>8;0===g?g=y=1:(g=r^e[e[e[r^n]]],y^=e[e[y]])}}function p(e,t){for(var r,i=e.slice(0),n=1,s=i.length,c=4*(s+6+1),l=s;l>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^o[n]<<24,n++):s>6&&l%s==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),i[l]=i[l-s]^r;if(t){for(var d,p=u[0],h=u[1],f=u[2],g=u[3],y=i.slice(0),m=(l=0,(c=i.length)-4);l>>24]]^h[a[d>>>16&255]]^f[a[d>>>8&255]]^g[a[255&d]];i=y}return i}function h(e,t,r,i){var n,o,l,d,p,h,f,g,y,m,v,b,w=e.length/4-1;i?(n=u[0],o=u[1],l=u[2],d=u[3],p=s):(n=c[0],o=c[1],l=c[2],d=c[3],p=a),h=t[0]^e[0],f=t[i?3:1]^e[1],g=t[2]^e[2],y=t[i?1:3]^e[3];for(var C=3,E=1;E>>24]^o[f>>>16&255]^l[g>>>8&255]^d[255&y]^e[++C],v=n[f>>>24]^o[g>>>16&255]^l[y>>>8&255]^d[255&h]^e[++C],b=n[g>>>24]^o[y>>>16&255]^l[h>>>8&255]^d[255&f]^e[++C],y=n[y>>>24]^o[h>>>16&255]^l[f>>>8&255]^d[255&g]^e[++C],h=m,f=v,g=b;r[0]=p[h>>>24]<<24^p[f>>>16&255]<<16^p[g>>>8&255]<<8^p[255&y]^e[++C],r[i?3:1]=p[f>>>24]<<24^p[g>>>16&255]<<16^p[y>>>8&255]<<8^p[255&h]^e[++C],r[2]=p[g>>>24]<<24^p[y>>>16&255]<<16^p[h>>>8&255]<<8^p[255&f]^e[++C],r[i?1:3]=p[y>>>24]<<24^p[h>>>16&255]<<16^p[f>>>8&255]<<8^p[255&g]^e[++C]}function f(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?i.cipher.createDecipher(r,e.key):i.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,n.call(t,r)},t}},function(e,t,r){var i=r(0);i.pki=i.pki||{};var n=e.exports=i.pki.oids=i.oids=i.oids||{};function a(e,t){n[e]=t,n[t]=e}function s(e,t){n[e]=t}a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.3.101.112","EdDSA25519"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.5","serialName"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.9","streetAddress"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.13","description"),a("2.5.4.15","businessCategory"),a("2.5.4.17","postalCode"),a("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),a("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){"use strict";(function(t,r){const i={};e.exports=i;const n="function"==typeof t&&t,a=n?e=>n(e):e=>setTimeout(e,0);function s(e,t,i){try{return e(t,i)}catch(e){r.nextTick(()=>{throw e})}}"object"==typeof r&&"function"==typeof r.nextTick?i.nextTick=r.nextTick:i.nextTick=a,i.setImmediate=n?a:i.nextTick,i.clone=function(e){if(e&&"object"==typeof e){let t;if(Array.isArray(e)){t=[];for(let r=0;r"[object Object]"===Object.prototype.toString.call(e),i.isUndefined=e=>void 0===e,i.callbackify=e=>async function(...t){const r=t[t.length-1];let i;"function"==typeof r&&t.pop();try{i=await e.apply(null,t)}catch(e){if("function"==typeof r)return s(r,e);throw e}return"function"==typeof r?s(r,null,i):i}}).call(this,r(35).setImmediate,r(11))},function(e,t,r){"use strict";const i=r(4),n=r(5),{isArray:a,isObject:s,isString:o,isUndefined:c}=r(2),{isAbsolute:u,isRelative:l,prependBase:d,parse:p}=r(20),{asArray:h,compareShortestLeast:f}=r(4),g=new Map,y={};function m(e,t,r,i,n,a){if(null===t||!o(t)||y.isKeyword(t))return t;if(i&&i.hasOwnProperty(t)&&!0!==n.get(t)&&y.createTermDefinition({activeCtx:e,localCtx:i,term:t,defined:n,options:a}),(r=r||{}).vocab){const r=e.mappings.get(t);if(null===r)return null;if(r)return r["@id"]}const s=t.indexOf(":");if(s>0){const r=t.substr(0,s),o=t.substr(s+1);if("_"===r||0===o.indexOf("//"))return t;i&&i.hasOwnProperty(r)&&y.createTermDefinition({activeCtx:e,localCtx:i,term:r,defined:n,options:a});const c=e.mappings.get(r);if(c&&c._prefix)return c["@id"]+o;if(u(t))return t}return r.vocab&&"@vocab"in e?e["@vocab"]+t:r.base?d(e["@base"],t):t}e.exports=y,y.process=async({activeCtx:e,localCtx:t,options:r,propagate:c=!0,overrideProtected:f=!1})=>{s(t)&&"@context"in t&&a(t["@context"])&&(t=t["@context"]);if(0===h(t).length)return e;const g=await r.contextResolver.resolve({context:t,documentLoader:r.documentLoader,base:r.base});s(g[0].document)&&"boolean"==typeof g[0].document["@propagate"]&&(c=g[0].document["@propagate"]);let v=e;c||v.previousContext||(v=v.clone(),v.previousContext=e);for(const a of g){let{document:c}=a;if(e=v,null===c){if(!f&&0!==Object.keys(e.protected).length){const s=r&&r.protectedMode||"error";if("error"===s)throw new n("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});if("warn"===s){console.warn("WARNING: invalid context nullification");const t=e;v=e=y.getInitialContext(r).clone();for(const[r,n]of Object.entries(t.protected))n&&(e.mappings[r]=i.clone(t.mappings[r]));e.protected=i.clone(t.protected),a.setProcessed(t,v);continue}throw new n("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:t,protectedMode:s})}v=e=y.getInitialContext(r).clone();continue}const h=a.getProcessed(e);if(h){v=e=h;continue}if(s(c)&&"@context"in c&&(c=c["@context"]),!s(c))throw new n("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:c});v=v.clone();const g=new Map;if("@version"in c){if(1.1!==c["@version"])throw new n("Unsupported JSON-LD version: "+c["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:c});if(e.processingMode&&"json-ld-1.0"===e.processingMode)throw new n("@version: "+c["@version"]+" not compatible with "+e.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:c});v.processingMode="json-ld-1.1",v["@version"]=c["@version"],g.set("@version",!0)}if(v.processingMode=v.processingMode||e.processingMode,"@base"in c){let e=c["@base"];if(null===e);else if(u(e))e=p(e);else{if(!l(e))throw new n('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:c});e=p(d(v["@base"].href,e))}v["@base"]=e,g.set("@base",!0)}if("@vocab"in c){const e=c["@vocab"];if(null===e)delete v["@vocab"];else{if(!o(e))throw new n('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:c});if(!u(e)&&y.processingMode(v,1))throw new n('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:c});v["@vocab"]=m(v,e,{vocab:!0,base:!0},void 0,void 0,r)}g.set("@vocab",!0)}if("@language"in c){const e=c["@language"];if(null===e)delete v["@language"];else{if(!o(e))throw new n('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:c});v["@language"]=e.toLowerCase()}g.set("@language",!0)}if("@propagate"in c){const r=c["@propagate"];if("json-ld-1.0"===e.processingMode)throw new n("Invalid JSON-LD syntax; @propagate not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:c});if("boolean"!=typeof r)throw new n("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:t});g.set("@propagate",!0)}g.set("@protected",c["@protected"]||!1);for(const e in c)y.createTermDefinition({activeCtx:v,localCtx:c,term:e,defined:g,options:r,overrideProtected:f});a.setProcessed(e,v)}return v},y.createTermDefinition=({activeCtx:e,localCtx:t,term:r,defined:i,options:c,overrideProtected:l=!1})=>{if(i.has(r)){if(i.get(r))return;throw new n("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:r})}let d;if(i.set(r,!1),t.hasOwnProperty(r)&&(d=t[r]),"@type"===r&&s(d)&&"@set"===d["@container"]&&y.processingMode(e,1.1)){const e=["@container","@id","@protected"];if(Object.keys(d).some(t=>!e.includes(t)))throw new n("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:r})}else{if(y.isKeyword(r))throw new n("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:r});if(""===r)throw new n("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t})}const p=e.mappings.get(r);if(e.mappings.has(r)&&e.mappings.delete(r),null===d||s(d)&&null===d["@id"])return e.mappings.set(r,null),void i.set(r,!0);let h=!1;if(o(d)&&(h=!0,d={"@id":d}),!s(d))throw new n("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const f={};e.mappings.set(r,f),f.reverse=!1;const g=["@container","@id","@language","@reverse","@type"];y.processingMode(e,1.1)&&g.push("@context","@index","@nest","@prefix","@protected");for(const e in d)if(!g.includes(e))throw new n("Invalid JSON-LD syntax; a term definition must not contain "+e,"jsonld.SyntaxError",{code:"invalid term definition",context:t});const v=r.indexOf(":");if(f._termHasColon=v>0,"@reverse"in d){if("@id"in d)throw new n("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});if("@nest"in d)throw new n("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});const r=d["@reverse"];if(!o(r))throw new n("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});const a=m(e,r,{vocab:!0,base:!1},t,i,c);if(!u(a))throw new n("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:t});f["@id"]=a,f.reverse=!0}else if("@id"in d){let a=d["@id"];if(!o(a))throw new n("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(a!==r){if(a=m(e,a,{vocab:!0,base:!1},t,i,c),!u(a)&&!y.isKeyword(a))throw new n("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:t});f["@id"]=a,f._prefix=h&&!f._termHasColon&&a.match(/[:\/\?#\[\]@]$/)}}if(!("@id"in f))if(f._termHasColon){const n=r.substr(0,v);if(t.hasOwnProperty(n)&&y.createTermDefinition({activeCtx:e,localCtx:t,term:n,defined:i,options:c}),e.mappings.has(n)){const t=r.substr(v+1);f["@id"]=e.mappings.get(n)["@id"]+t}else f["@id"]=r}else if("@type"==r)f["@id"]=r;else{if(!("@vocab"in e))throw new n("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:r});f["@id"]=e["@vocab"]+r}if((!0===d["@protected"]||!0===i.get("@protected")&&!1!==d["@protected"])&&(e.protected[r]=!0,f.protected=!0),i.set(r,!0),"@type"in d){let r=d["@type"];if(!o(r))throw new n("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@json"===r||"@none"===r){if(y.processingMode(e,1))throw new n(`Invalid JSON-LD syntax; an @context @type value must not be "${r}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else if("@id"!==r&&"@vocab"!==r){if(r=m(e,r,{vocab:!0,base:!1},t,i,c),!u(r))throw new n("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===r.indexOf("_:"))throw new n("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}f["@type"]=r}if("@container"in d){const r=o(d["@container"])?[d["@container"]]:d["@container"]||[],i=["@list","@set","@index","@language"];let s=!0;const c=r.includes("@set");if(y.processingMode(e,1.1)){if(i.push("@graph","@id","@type"),r.includes("@list")){if(1!==r.length)throw new n("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else if(r.includes("@graph")){if(r.some(e=>"@graph"!==e&&"@id"!==e&&"@index"!==e&&"@set"!==e))throw new n("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:t})}else s&=r.length<=(c?2:1);if(r.includes("@type")&&(f["@type"]=f["@type"]||"@id",!["@id","@vocab"].includes(f["@type"])))throw new n("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else s&=!a(d["@container"]),s&=r.length<=1;if(s&=r.every(e=>i.includes(e)),s&=!(c&&r.includes("@list")),!s)throw new n("Invalid JSON-LD syntax; @context @container value must be one of the following: "+i.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(f.reverse&&!r.every(e=>["@index","@set"].includes(e)))throw new n("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});f["@container"]=r}if("@index"in d){if(!("@container"in d)||!f["@container"].includes("@index"))throw new n(`Invalid JSON-LD syntax; @index without @index in @container: "${d["@index"]}" on term "${r}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});if(!o(d["@index"])||0===d["@index"].indexOf("@"))throw new n(`Invalid JSON-LD syntax; @index must expand to an IRI: "${d["@index"]}" on term "${r}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});f["@index"]=d["@index"]}if("@context"in d&&(f["@context"]=d["@context"]),"@language"in d&&!("@type"in d)){let e=d["@language"];if(null!==e&&!o(e))throw new n("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==e&&(e=e.toLowerCase()),f["@language"]=e}if("@prefix"in d){if(f._termHasColon)throw new n("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:t});if("boolean"!=typeof d["@prefix"])throw new n("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:t});f._prefix=!0===d["@prefix"]}if("@nest"in d){const e=d["@nest"];if(!o(e)||"@nest"!==e&&0===e.indexOf("@"))throw new n("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:t});f["@nest"]=e} // disallow aliasing @context and @preserve const b=f["@id"];if("@context"===b||"@preserve"===b)throw new n("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t});if(p&&p.protected&&!l&&(e.protected[r]=!0,f.protected=!0,!function e(t,r){if(!t||"object"!=typeof t||!r||"object"!=typeof r)return t===r;const i=Array.isArray(t);if(i!==Array.isArray(r))return!1;if(i){if(t.length!==r.length)return!1;for(let i=0;im(e,t,r,void 0,void 0,i),y.getInitialContext=e=>{const t=p(e.base||""),r=JSON.stringify({base:t,processingMode:e.processingMode}),n=g.get(r);if(n)return n;const a={"@base":t,processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:function(){const e=this;if(e.inverse)return e.inverse;const t=e.inverse={},r=e.fastCurieMap={},i={},n=e["@language"]||"@none",a=e.mappings,c=[...a.keys()].sort(f);for(const e of c){const s=a.get(e);if(null===s)continue;let c=s["@container"]||"@none";c=[].concat(c).sort().join("");const u=h(s["@id"]);for(const a of u){let u=t[a];const l=y.isKeyword(a);if(u)l||s._termHasColon||i[a].push(e);else if(t[a]=u={},!l&&!s._termHasColon){i[a]=[e];const t={iri:a,terms:i[a]};a[0]in r?r[a[0]].push(t):r[a[0]]=[t]}if(u[c]||(u[c]={"@language":{},"@type":{},"@any":{}}),u=u[c],o(e,u["@any"],"@none"),s.reverse)o(e,u["@type"],"@reverse");else if("@none"===s["@type"])o(e,u["@any"],"@none"),o(e,u["@language"],"@none"),o(e,u["@type"],"@none");else if("@type"in s)o(e,u["@type"],s["@type"]);else if("@language"in s){const t=s["@language"]||"@null";o(e,u["@language"],t)}else o(e,u["@language"],n),o(e,u["@type"],"@none"),o(e,u["@language"],"@none")}}for(const e in r)s(r,e,1);return t},clone:function(){const e={};e["@base"]=this["@base"],e.mappings=i.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=i.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone());e.revertToPreviousContext=this.revertToPreviousContext,"@language"in this&&(e["@language"]=this["@language"]);"@vocab"in this&&(e["@vocab"]=this["@vocab"]);return e},revertToPreviousContext:function(){if(!this.previousContext)return this;return this.previousContext.clone()},protected:{}};return 1e4===g.size&&g.clear(),g.set(r,a),a;function s(e,t,r){const i=e[t],n=e[t]={};let a,o;for(const e of i)a=e.iri,o=r>=a.length?"":a[r],o in n?n[o].push(e):n[o]=[e];for(const e in n)""!==e&&s(n,e,r+1)}function o(e,t,r){t.hasOwnProperty(r)||(t[r]=e)}},y.getContextValue=(e,t,r)=>{if(null===t){if("@context"===r)return;return null}if(e.mappings.has(t)){const i=e.mappings.get(t);if(c(r))return i;if(i.hasOwnProperty(r))return i[r]}return"@language"===r&&e.hasOwnProperty(r)?e[r]:"@context"!==r?null:void 0},y.processingMode=(e,t)=>t.toString()>="1.1"?!e.processingMode||e.processingMode>="json-ld-"+t.toString():"json-ld-1.0"===e.processingMode,y.isKeyword=e=>{if(!o(e)||"@"!==e[0])return!1;switch(e){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(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var i=r(0);r(1);var n=e.exports=i.pem=i.pem||{};function a(e){for(var t=e.name+": ",r=[],i=function(e,t){return" "+t},n=0;n65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),a=n-s-1,s=-1,++n}else" "!==t[n]&&"\t"!==t[n]&&","!==t[n]||(s=n);return t}function s(e){return e.replace(/^\s+/,"")}n.encode=function(e,t){t=t||{};var r,n="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(n+=a(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(n+=a(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),n+=a(r)),e.headers)for(var s=0;s>>0,c>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=c[1],c[1]=c[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(a),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=i.util.createBuffer();s.putBytes(t.bytes());var c,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(a.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],d=0;d>>0,s.putInt32(l>>>0),l=c>>>0;s.putInt32(l);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(p,r,s);var h=i.util.createBuffer();return h.putInt32(p.h0),h.putInt32(p.h1),h.putInt32(p.h2),h.putInt32(p.h3),h.putInt32(p.h4),h},n};var a=null,s=!1;function o(e,t,r){for(var i,n,a,s,o,c,u,l=r.length();l>=64;){for(n=e.h0,a=e.h1,s=e.h2,o=e.h3,c=e.h4,u=0;u<16;++u)i=r.getInt32(),t[u]=i,i=(n<<5|n>>>27)+(o^a&(s^o))+c+1518500249+i,c=o,o=s,s=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<20;++u)i=(i=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|i>>>31,t[u]=i,i=(n<<5|n>>>27)+(o^a&(s^o))+c+1518500249+i,c=o,o=s,s=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<32;++u)i=(i=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|i>>>31,t[u]=i,i=(n<<5|n>>>27)+(a^s^o)+c+1859775393+i,c=o,o=s,s=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<40;++u)i=(i=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|i>>>30,t[u]=i,i=(n<<5|n>>>27)+(a^s^o)+c+1859775393+i,c=o,o=s,s=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<60;++u)i=(i=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|i>>>30,t[u]=i,i=(n<<5|n>>>27)+(a&s|o&(a^s))+c+2400959708+i,c=o,o=s,s=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<80;++u)i=(i=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|i>>>30,t[u]=i,i=(n<<5|n>>>27)+(a^s^o)+c+3395469782+i,c=o,o=s,s=(a<<30|a>>>2)>>>0,a=n,n=i;e.h0=e.h0+n|0,e.h1=e.h1+a|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+c|0,l-=64}}},function(e,t){},function(e,t,r){"use strict";const i=r(2),n={};e.exports=n,n.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*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},n.parse=(e,t)=>{const r={},i=n.parsers[t||"full"],a=i.regex.exec(e);let s=i.keys.length;for(;s--;)r[i.keys[s]]=void 0===a[s]?null:a[s];return("https"===r.scheme&&"443"===r.port||"http"===r.scheme&&"80"===r.port)&&(r.href=r.href.replace(":"+r.port,""),r.authority=r.authority.replace(":"+r.port,""),r.port=null),r.normalizedPath=n.removeDotSegments(r.path),r},n.prependBase=(e,t)=>{if(null===e)return t;if(n.isAbsolute(t))return t;i.isString(e)&&(e=n.parse(e||""));const r=n.parse(t),a={protocol:e.protocol||""};if(null!==r.authority)a.authority=r.authority,a.path=r.path,a.query=r.query;else if(a.authority=e.authority,""===r.path)a.path=e.path,null!==r.query?a.query=r.query:a.query=e.query;else{if(0===r.path.indexOf("/"))a.path=r.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf("/")+1),t.length>0&&"/"!==t.substr(-1)&&(t+="/"),t+=r.path,a.path=t}a.query=r.query}""!==r.path&&(a.path=n.removeDotSegments(a.path));let s=a.protocol;return null!==a.authority&&(s+="//"+a.authority),s+=a.path,null!==a.query&&(s+="?"+a.query),null!==r.fragment&&(s+="#"+r.fragment),""===s&&(s="./"),s},n.removeBase=(e,t)=>{if(null===e)return t;i.isString(e)&&(e=n.parse(e||""));let r="";if(""!==e.href?r+=(e.protocol||"")+"//"+(e.authority||""):t.indexOf("//")&&(r+="//"),0!==t.indexOf(r))return t;const a=n.parse(t.substr(r.length)),s=e.normalizedPath.split("/"),o=a.normalizedPath.split("/"),c=a.fragment||a.query?0:1;for(;s.length>0&&o.length>c&&s[0]===o[0];)s.shift(),o.shift();let u="";if(s.length>0){s.pop();for(let e=0;e{if(0===e.length)return"";const t=e.split("/"),r=[];for(;t.length>0;){const e=t.shift(),i=0===t.length;"."!==e?".."!==e?r.push(e):(r.pop(),i&&r.push("")):i&&r.push("")}return r.length>0&&""!==r[0]&&r.unshift(""),1===r.length&&""===r[0]?"/":r.join("/")};const a=/^([A-Za-z][A-Za-z0-9+-.]*|_):/;n.isAbsolute=e=>i.isString(e)&&a.test(e),n.isRelative=e=>i.isString(e)},function(e,t,r){(function(t,i){ /** * A JavaScript implementation of the JSON-LD API. * * @author Dave Longley * * @license BSD 3-Clause License * Copyright (c) 2011-2019 Digital Bazaar, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Digital Bazaar, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ const n=r(46),a=r(4),s=r(111),o=a.IdentifierIssuer,c=r(5),u=r(76),l=r(115),d=r(116),{expand:p}=r(118),{flatten:h}=r(119),{fromRDF:f}=r(120),{toRDF:g}=r(121),{frameMergedOrDefault:y}=r(123),{isArray:m,isObject:v,isString:b}=r(2),{isSubjectReference:w}=r(9),{getInitialContext:C,process:E}=r(15),{compact:S,compactIri:T,removePreserve:I}=r(124),{createNodeMap:A,createMergedNodeMap:_,mergeNodeMaps:x}=r(32),k=void 0!==t&&t.versions&&t.versions.node,B=!k&&("undefined"!=typeof window||"undefined"!=typeof self),N=function(e){const t={},N=new u({max:100});function R(t,{documentLoader:r=e.documentLoader,...i}){return Object.assign({},{documentLoader:r},i,t)}return e.compact=async function(t,r,i){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===r)throw new c("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let n;(i=R(i,{base:b(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o("_:b"),contextResolver:new s({sharedCache:N})})).link&&(i.skipExpansion=!0),i.compactToRelative||delete i.base,n=i.skipExpansion?t:await e.expand(t,i);const u=await e.processContext(C(i),r,i);let l=await S({activeCtx:u,element:n,options:i,compactionMap:i.compactionMap});i.compactArrays&&!i.graph&&m(l)?1===l.length?l=l[0]:0===l.length&&(l={}):i.graph&&v(l)&&(l=[l]),v(r)&&"@context"in r&&(r=r["@context"]),r=a.clone(r),m(r)||(r=[r]);const d=r;r=[];for(let e=0;e0)&&r.push(d[e]);const p=r.length>0;if(1===r.length&&(r=r[0]),m(l)){const e=T({activeCtx:u,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},p&&(l["@context"]=r),l[e]=t}else if(v(l)&&p){const e=l;l={"@context":r};for(const t in e)l[t]=e[t]}if(i.framing){const e=T({activeCtx:u,iri:"@graph",relativeTo:{vocab:!0}}); // remove @preserve from results i.link={},l[e]=I(u,l[e],i)}return l},e.expand=async function(t,r){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(r=R(r,{keepFreeFloatingNodes:!1,contextResolver:new s({sharedCache:N})})).expansionMap&&(r.expansionMap=void 0);const i={},n=[];if("expandContext"in r){const e=a.clone(r.expandContext);v(e)&&"@context"in e?i.expandContext=e:i.expandContext={"@context":e},n.push(i.expandContext)}let o;if(b(t)){const a=await e.get(t,r);o=a.documentUrl,i.input=a.document,a.contextUrl&&(i.remoteContext={"@context":a.contextUrl},n.push(i.remoteContext))}else i.input=a.clone(t);"base"in r||(r.base=o||"");let c=C(r);for(const e of n)c=await E({activeCtx:c,localCtx:e,options:r});let u=await p({activeCtx:c,element:i.input,options:r,expansionMap:r.expansionMap});return v(u)&&"@graph"in u&&1===Object.keys(u).length?u=u["@graph"]:null===u&&(u=[]),m(u)||(u=[u]),u},e.flatten=async function(t,r,i){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");r="function"==typeof r?null:r||null,i=R(i,{base:b(t)?t:"",contextResolver:new s({sharedCache:N})});const n=await e.expand(t,i),a=h(n);if(null===r)return a;i.graph=!0,i.skipExpansion=!0;const o=await e.compact(a,r,i);return o},e.frame=async function(t,r,i){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(i=R(i,{base:b(t)?t:"",embed:"@last",explicit:!1,requireAll:!0,omitDefault:!1,pruneBlankNodeIdentifiers:!0,bnodesToClear:[],contextResolver:new s({sharedCache:N})}),b(r)){const t=await e.get(r,i);if(r=t.document,t.contextUrl){let e=r["@context"];e?m(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,r["@context"]=e}}const n=r&&r["@context"]||{},a=await e.expand(t,i),o={...i};o.isFrame=!0,o.keepFreeFloatingNodes=!0;const c=await e.expand(r,o);o.merged=!("@graph"in r);const u=y(a,c,o);o.graph=!0,o.skipExpansion=!0,o.link={},o.framing=!0;const l=await e.compact(u,n,o);return l},e.link=async function(t,r,i){const n={};return r&&(n["@context"]=r),n["@embed"]="@link",e.frame(t,n,i)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(r=R(r,{base:b(t)?t:"",algorithm:"URDNA2015",skipExpansion:!1,contextResolver:new s({sharedCache:N})}))){if("application/n-quads"!==r.inputFormat&&"application/nquads"!==r.inputFormat)throw new c("Unknown canonicalization input format.","jsonld.CanonizeError");const e=l.parse(t);return n.canonize(e,r)}const i={...r};delete i.format,i.produceGeneralizedRdf=!1;const a=await e.toRDF(t,i);return n.canonize(a,r)},e.fromRDF=async function(e,r){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");r=R(r,{format:b(e)?"application/n-quads":void 0});const{format:i}=r;let{rdfParser:n}=r;if(i){if(n=n||t[i],!n)throw new c("Unknown input format.","jsonld.UnknownFormat",{format:i})}else n=()=>e;const a=await n(e);return f(a,r)},e.toRDF=async function(t,r){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let i;i=(r=R(r,{base:b(t)?t:"",skipExpansion:!1,contextResolver:new s({sharedCache:N})})).skipExpansion?t:await e.expand(t,r);const n=g(i,r);if(r.format){if("application/n-quads"===r.format||"application/nquads"===r.format)return await l.serialize(n);throw new c("Unknown output format.","jsonld.UnknownFormat",{format:r.format})}return n},e.createNodeMap=async function(t,r){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");r=R(r,{base:b(t)?t:"",contextResolver:new s({sharedCache:N})});const i=await e.expand(t,r);return _(i,r)},e.merge=async function(t,r,i){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!m(t))throw new TypeError('Could not merge, "docs" must be an array.');r="function"==typeof r?null:r||null,i=R(i,{contextResolver:new s({sharedCache:N})});const n=await Promise.all(t.map(t=>{const r={...i};return e.expand(t,r)}));let c=!0;"mergeNodes"in i&&(c=i.mergeNodes);const u=i.issuer||new o("_:b"),l={"@default":{}};for(let e=0;ee._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new c("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.get=async function(t,r){let i;i="function"==typeof r.documentLoader?r.documentLoader:e.documentLoader;const n=await i(t);try{if(!n.document)throw new c("No remote document found at the given URL.","jsonld.NullRemoteDocument");b(n.document)&&(n.document=JSON.parse(n.document))}catch(e){throw new c("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:n})}return n},e.processContext=async function(e,t,r){return r=R(r,{base:"",contextResolver:new s({sharedCache:N})}),null===t?C(r):(t=a.clone(t),v(t)&&"@context"in t||(t={"@context":t}),E({activeCtx:e,localCtx:t,options:r}))},e.getContextValue=r(15).getContextValue,e.documentLoaders={},e.documentLoaders.node=r(125),e.documentLoaders.xhr=r(128),e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new c('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,r){t[e]=r},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser("application/n-quads",l.parse),e.registerRDFParser("application/nquads",l.parse),e.registerRDFParser("rdfa-api",d.parse),e.url=r(20),e.util=a,Object.assign(e,a),e.promises=e,e.RequestQueue=r(49),e.JsonLdProcessor=r(129)(e),B&&void 0===i.JsonLdProcessor&&Object.defineProperty(i,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor}),k?e.useDocumentLoader("node"):"undefined"!=typeof XMLHttpRequest&&e.useDocumentLoader("xhr"),e},R=function(){return N((function(){return R()}))};N(R),e.exports=R}).call(this,r(11),r(16))},function(e,t,r){"use strict";e.exports={Ed25519KeyPair:r(28),LDKeyPair:r(42),RSAKeyPair:r(43)}},function(e,t,r){e.exports=r(0),r(12),r(93),r(7),r(34),r(68),r(29),r(95),r(24),r(97),r(70),r(98),r(67),r(37),r(17),r(63),r(65),r(99),r(59),r(64),r(61),r(41),r(3),r(62),r(100),r(101),r(58),r(1)},function(e,t,r){var i=r(0);r(8),r(1),(e.exports=i.hmac=i.hmac||{}).create=function(){var e=null,t=null,r=null,n=null,a={start:function(a,s){if(null!==a)if("string"==typeof a){if(!((a=a.toLowerCase())in i.md.algorithms))throw new Error('Unknown hash algorithm "'+a+'"');t=i.md.algorithms[a].create()}else t=a;if(null===s)s=e;else{if("string"==typeof s)s=i.util.createBuffer(s);else if(i.util.isArray(s)){var o=s;s=i.util.createBuffer();for(var c=0;ct.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=i.util.createBuffer(),n=i.util.createBuffer(),u=s.length();for(c=0;cs(null,i.from(e.buffer,e.byteOffset,e.length),a)}}if(n.nodejs){const t=r(45),n=r(19),a=u.base58Decode({decode:n.decode,keyMaterial:e.privateKeyBase58,type:"private"});return{async sign({data:e}){const r=i.alloc(t.crypto_sign_BYTES);return await t.crypto_sign_detached(r,i.from(e.buffer,e.byteOffset,e.length),a),r}}}const a=u.base58Decode({decode:c.decode,keyMaterial:e.privateKeyBase58,type:"private"});return{sign:async({data:e})=>o.sign({message:e,privateKey:a})}}(this)}verifier(){return function(e){if(n.nodejs&&r(44).gte(t.version,"12.0.0")){const t=r(19),n=u.base58Decode({decode:t.decode,keyMaterial:e.publicKeyBase58,type:"public"}),a=r(106).create({publicKeyBytes:n}),{verify:s}=r(25);return{verify:async({data:e,signature:t})=>s(null,i.from(e.buffer,e.byteOffset,e.length),a,t)}}if(n.nodejs){const t=r(45),n=r(19),a=u.base58Decode({decode:n.decode,keyMaterial:e.publicKeyBase58,type:"public"});return{verify:async({data:e,signature:r})=>t.crypto_sign_verify_detached(i.from(r.buffer,r.byteOffset,r.length),i.from(e.buffer,e.byteOffset,e.length),a)}}const a=u.base58Decode({decode:c.decode,keyMaterial:e.publicKeyBase58,type:"public"});return{verify:async({data:e,signature:t})=>o.verify({message:e,signature:t,publicKey:a})}}(this)}addEncodedPublicKey(e){return e.publicKeyBase58=this.publicKeyBase58,e}async addEncryptedPrivateKey(e){return null!==this.passphrase?e.privateKeyJwe=await this.encrypt({privateKeyBase58:this.privateKeyBase58},this.passphrase):e.privateKeyBase58=this.privateKeyBase58,e}async encrypt(e,t){const r=a.random.getBytesSync(32),i=await l.pbkdf2(t,r,4096,32),n={alg:"PBES2-A128GCMKW",enc:"A128GCMKW",jwk:{kty:"PBKDF2",s:s.encode(r),c:4096}},o=a.random.getBytesSync(12),c=a.cipher.createCipher("AES-GCM",i);c.start({iv:o}),c.update(a.util.createBuffer(JSON.stringify(e))),c.finish();const u=c.output.getBytes(),d=c.mode.tag.getBytes();return{unprotected:n,iv:s.encode(o),ciphertext:s.encode(u),tag:s.encode(d)}}async decrypt(e,t){const{c:r}=e.unprotected.jwk;let{s:i}=e.unprotected.jwk;i=s.encode(i);const n=await l.pbkdf2(t,i,r,32),o=s.encode(e.iv),c=s.encode(e.tag),u=a.cipher.createDecipher("AES-GCM",n);u.start({iv:o,tag:c}),u.update(s.encode(e.ciphertext));if(!u.finish())throw new Error("Invalid password.");return JSON.parse(u.output.getBytes())}static fingerprintFromPublicKey({publicKeyBase58:e}){const t=u.base58Decode({decode:c.decode,keyMaterial:e,type:"public"}),r=new Uint8Array(2+t.length);return r[0]=237,r[1]=1,r.set(t,2),"z"+c.encode(r)}fingerprint(){const{publicKeyBase58:e}=this;return d.fingerprintFromPublicKey({publicKeyBase58:e})}verifyFingerprint(e){if("string"!=typeof e||"z"!==e[0])return{error:new Error("`fingerprint` must be a multibase encoded string."),valid:!1};let t,r;try{t=u.base58Decode({decode:c.decode,keyMaterial:e.slice(1),type:"fingerprint's"})}catch(e){return{error:e,valid:!1}}try{r=u.base58Decode({decode:c.decode,keyMaterial:this.publicKeyBase58,type:"public"})}catch(e){return{error:e,valid:!1}}const i="ed01"===t.slice(0,2).toString("hex")&&r.equals(t.slice(2));return i?{valid:i}:{error:new Error("The fingerprint does not match the public key."),valid:!1}}}e.exports=d}).call(this,r(11),r(6).Buffer)},function(e,t,r){var i=r(0);function n(e,t){i.cipher.registerAlgorithm(e,(function(){return new i.des.Algorithm(e,t)}))}r(34),r(57),r(1),e.exports=i.des=i.des||{},i.des.startEncrypting=function(e,t,r,i){var n=f({key:e,output:r,decrypt:!1,mode:i||(null===t?"ECB":"CBC")});return n.start(t),n},i.des.createEncryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!1,mode:t})},i.des.startDecrypting=function(e,t,r,i){var n=f({key:e,output:r,decrypt:!0,mode:i||(null===t?"ECB":"CBC")});return n.start(t),n},i.des.createDecryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!0,mode:t})},i.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return h(r._keys,e,t,!1)},decrypt:function(e,t){return h(r._keys,e,t,!0)}}}),r._init=!1},i.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=i.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],i=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],p=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],f=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w>>4^E))<<4,C^=t=65535&((E^=t)>>>-16^C),C^=(t=858993459&(C>>>2^(E^=t<<-16)))<<2,C^=t=65535&((E^=t)>>>-16^C),C^=(t=1431655765&(C>>>1^(E^=t<<-16)))<<1,C^=t=16711935&((E^=t)>>>8^C),t=(C^=(t=1431655765&(C>>>1^(E^=t<<8)))<<1)<<8|(E^=t)>>>20&240,C=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var S=0;S>>26,E=E<<2|E>>>26):(C=C<<1|C>>>27,E=E<<1|E>>>27);var T=r[(C&=-15)>>>28]|i[C>>>24&15]|n[C>>>20&15]|a[C>>>16&15]|s[C>>>12&15]|o[C>>>8&15]|c[C>>>4&15],I=u[(E&=-15)>>>28]|l[E>>>24&15]|d[E>>>20&15]|p[E>>>16&15]|h[E>>>12&15]|f[E>>>8&15]|g[E>>>4&15];t=65535&(I>>>16^T),m[b++]=T^t,m[b++]=I^t<<16}}return m}(t),this._init=!0}},n("DES-ECB",i.cipher.modes.ecb),n("DES-CBC",i.cipher.modes.cbc),n("DES-CFB",i.cipher.modes.cfb),n("DES-OFB",i.cipher.modes.ofb),n("DES-CTR",i.cipher.modes.ctr),n("3DES-ECB",i.cipher.modes.ecb),n("3DES-CBC",i.cipher.modes.cbc),n("3DES-CFB",i.cipher.modes.cfb),n("3DES-OFB",i.cipher.modes.ofb),n("3DES-CTR",i.cipher.modes.ctr);var a=[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],s=[-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],c=[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],u=[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],l=[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],d=[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],p=[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 h(e,t,r,i){var n,h,f=32===e.length?3:9;n=3===f?i?[30,-2,-2]:[0,32,2]:i?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=t[0],y=t[1];g^=(h=252645135&(g>>>4^y))<<4,g^=(h=65535&(g>>>16^(y^=h)))<<16,g^=h=858993459&((y^=h)>>>2^g),g^=h=16711935&((y^=h<<2)>>>8^g),g=(g^=(h=1431655765&(g>>>1^(y^=h<<8)))<<1)<<1|g>>>31,y=(y^=h)<<1|y>>>31;for(var m=0;m>>4|y<<28)^e[w+1];h=g,g=y,y=h^(s[C>>>24&63]|c[C>>>16&63]|l[C>>>8&63]|p[63&C]|a[E>>>24&63]|o[E>>>16&63]|u[E>>>8&63]|d[63&E])}h=g,g=y,y=h}y=y>>>1|y<<31,y^=h=1431655765&((g=g>>>1|g<<31)>>>1^y),y^=(h=16711935&(y>>>8^(g^=h<<1)))<<8,y^=(h=858993459&(y>>>2^(g^=h)))<<2,y^=h=65535&((g^=h)>>>16^y),y^=h=252645135&((g^=h<<16)>>>4^y),g^=h<<4,r[0]=g,r[1]=y}function f(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?i.cipher.createDecipher(r,e.key):i.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,n.call(t,r)},t}},function(e,t,r){var i=r(0);if(r(7),r(31),r(13),r(63),r(64),r(3),r(1),void 0===n)var n=i.jsbn.BigInteger;var a=i.util.isNodejs?r(38):null,s=i.asn1,o=i.util;i.pki=i.pki||{},e.exports=i.pki.rsa=i.rsa=i.rsa||{};var c=i.pki,u=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},d={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},p={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},h=i.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},f=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var i=s.oidToDer(t).getBytes(),n=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);a.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,i)),a.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(a),n.value.push(o),s.toDer(n).getBytes()},g=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var a;t.dP||(t.dP=t.d.mod(t.p.subtract(n.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(n.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{a=new n(i.util.bytesToHex(i.random.getBytes(t.n.bitLength()/8)),16)}while(a.compareTo(t.n)>=0||!a.gcd(t.n).equals(n.ONE));for(var s=(e=e.multiply(a.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var c=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return c=c.multiply(a.modInverse(t.n)).mod(t.n)};function y(e,t,r){var n=i.util.createBuffer(),a=Math.ceil(t.n.bitLength()/8);if(e.length>a-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=a-11,s}n.putByte(0),n.putByte(r);var o,c=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var u=0;u0;){var l=0,d=i.random.getBytes(c);for(u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==a-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function v(e,t,r){"function"==typeof t&&(r=t,t={});var a={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,i){return t?r(t):(e.p=i,null!==e.q?u(t,e.q):void o(e.qBits,u))}))}function o(e,t){i.prime.generateProbablePrime(e,a,t)}function u(t,i){if(t)return r(t);if(e.q=i,e.p.compareTo(e.q)<0){var a=e.p;e.p=e.q,e.q=a}if(0!==e.p.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.p=null,void s();if(0!==e.q.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.q=null,void o(e.qBits,u);if(e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(n.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(a.prng=t.prng),s()}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=i.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function w(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function C(e){return i.util.isNodejs&&"function"==typeof a[e]}function E(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function S(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function T(e){for(var t=i.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n0;)l.putByte(0),--d;return l.putBytes(i.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,a){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o}var c=new n(i.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=g(c,t,r).toString(16),l=i.util.createBuffer(),d=s-Math.ceil(u.length/2);d>0;)l.putByte(0),--d;return l.putBytes(i.util.hexToBytes(u)),!1!==a?m(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var a,s=(r=r||{}).prng||i.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(a.eInt),a},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new n(null);r.fromInt(30);for(var i,a=0,s=function(e,t){return e|t},o=+new Date,l=0;null===e.keys&&(t<=0||ld?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(n.ONE).gcd(e.e).compareTo(n.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(n.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}l+=(i=+new Date)-o,o=i}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!i.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(C("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(E("generateKey")&&E("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:T(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(i.util.createBuffer(e)));n(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(S("generateKey")&&S("exportKey")){var u=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:T(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(i.util.createBuffer(t)));n(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(u.onerror=function(e){n(e)})}}else if(C("generateKeyPairSync")){var l=a.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var d=c.rsa.createKeyPairGenerationState(e,t,r);if(!n)return c.rsa.stepKeyPairGenerationState(d,0),d.keys;v(d,r,n)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return y(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return i.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var a=t.encode(e,r,!0);return c.rsa.encrypt(a,r,!0)},verify:function(e,t,i){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){return t=m(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=m(t,r,!0))}});var n=c.rsa.decrypt(t,r,!0,!1);return i.verify(e,n,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,n,a,s,o,u){var l={n:e,e:t,d:r,p:n,q:a,dP:s,dQ:o,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return i.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:f},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var i=t.encode(e,l.n.bitLength());return c.rsa.encrypt(i,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,a,o,u,p,h,f,g={},y=[];if(s.validate(e,l,g,y)&&(e=s.fromDer(i.util.createBuffer(g.privateKey))),g={},y=[],!s.validate(e,d,g,y)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=y,m}return t=i.util.createBuffer(g.privateKeyModulus).toHex(),r=i.util.createBuffer(g.privateKeyPublicExponent).toHex(),a=i.util.createBuffer(g.privateKeyPrivateExponent).toHex(),o=i.util.createBuffer(g.privateKeyPrime1).toHex(),u=i.util.createBuffer(g.privateKeyPrime2).toHex(),p=i.util.createBuffer(g.privateKeyExponent1).toHex(),h=i.util.createBuffer(g.privateKeyExponent2).toHex(),f=i.util.createBuffer(g.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new n(t,16),new n(r,16),new n(a,16),new n(o,16),new n(u,16),new n(p,16),new n(h,16),new n(f,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,h,t,r)){var a,o=s.derToOid(t.publicKeyOid);if(o!==c.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=o,a;e=t.rsaPublicKey}if(r=[],!s.validate(e,p,t,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;var u=i.util.createBuffer(t.publicKeyModulus).toHex(),l=i.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new n(u,16),new n(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e))])}},function(e,t,r){var i,n=r(0);e.exports=n.jsbn=n.jsbn||{};function a(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new a(null)}function o(e,t,r,i,n,a){for(var s=16383&t,o=t>>14;--a>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=o*c+u*s;n=((c=s*c+((16383&l)<<14)+r.data[i]+n)>>28)+(l>>14)+o*u,r.data[i++]=268435455&c}return n}n.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=o,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(e,t,r,i,n,a){for(var s=32767&t,o=t>>15;--a>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=o*c+u*s;n=((c=s*c+((32767&l)<<15)+r.data[i]+(1073741823&n))>>>30)+(l>>>15)+o*u+(n>>>30),r.data[i++]=1073741823&c}return n},i=30):"Netscape"!=navigator.appName?(a.prototype.am=function(e,t,r,i,n,a){for(;--a>=0;){var s=t*this.data[e++]+r.data[i]+n;n=Math.floor(s/67108864),r.data[i++]=67108863&s}return n},i=26):(a.prototype.am=o,i=28),a.prototype.DB=i,a.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function g(e){this.m=e}function y(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function E(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function T(e){return e}function I(e){this.r2=s(),this.q3=s(),a.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}g.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},g.prototype.revert=function(e){return e},g.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},y.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(a.ZERO)>0&&this.m.subTo(t,t),t},y.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},y.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,i,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},a.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},a.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},a.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var i=e.length,n=!1,s=0;--i>=0;){var o=8==r?255&e[i]:p(e,i);o<0?"-"==e.charAt(i)&&(n=!0):(n=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<>this.DB-s):this.data[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},a.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},a.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>n|o,o=(this.data[r]&a)<=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},a.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var i=e%this.DB,n=this.DB-i,a=(1<>i;for(var s=r+1;s>i;i>0&&(t.data[this.t-r-1]|=(this.s&a)<>=this.DB;if(e.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t.data[r++]=this.DV+i:i>0&&(t.data[r++]=i),t.t=r,t.clamp()},a.prototype.multiplyTo=function(e,t){var r=this.abs(),i=e.abs(),n=r.t;for(t.t=n+i.t;--n>=0;)t.data[n]=0;for(n=0;n=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},a.prototype.divRemTo=function(e,t,r){var i=e.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(l,o),n.lShiftTo(l,r)):(i.copyTo(o),n.copyTo(r));var d=o.t,p=o.data[d-1];if(0!=p){var h=p*(1<1?o.data[d-2]>>this.F2:0),g=this.FV/h,y=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),a.ONE.dlShiftTo(d,w),w.subTo(o,o);o.t=0;){var C=r.data[--v]==p?this.DM:Math.floor(r.data[v]*g+(r.data[v-1]+m)*y);if((r.data[v]+=o.am(0,C,r,b,0,d))0&&r.rShiftTo(l,r),c<0&&a.ZERO.subTo(r,r)}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},a.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},a.prototype.exp=function(e,t){if(e>4294967295||e<1)return a.ONE;var r=s(),i=s(),n=t.convert(this),o=f(e)-1;for(n.copyTo(r);--o>=0;)if(t.sqrTo(r,i),(e&1<0)t.mulTo(i,n,r);else{var c=r;r=i,i=c}return t.revert(r)},a.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,i=(1<0)for(o>o)>0&&(n=!0,a=d(r));s>=0;)o>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&i,o<=0&&(o+=this.DB,--s)),r>0&&(n=!0),n&&(a+=d(r));return n?a:"0"},a.prototype.negate=function(){var e=s();return a.ZERO.subTo(this,e),e},a.prototype.abs=function(){return this.s<0?this.negate():this},a.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this.data[this.t-1]^this.s&this.DM)},a.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t},a.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new g(t):new y(t),this.exp(e,r)},a.ZERO=h(0),a.ONE=h(1),S.prototype.convert=T,S.prototype.revert=T,S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},I.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},I.prototype.revert=function(e){return e},I.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},I.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var A=[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],_=(1<<26)/A[A.length-1];a.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},a.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=h(r),n=s(),a=s(),o="";for(this.divRemTo(i,n,a);n.signum()>0;)o=(r+a.intValue()).toString(e).substr(1)+o,n.divRemTo(i,n,a);return a.intValue().toString(e)+o},a.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),i=Math.pow(t,r),n=!1,s=0,o=0,c=0;c=r&&(this.dMultiply(i),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),n&&a.ZERO.subTo(this,this)},a.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var i=new Array,n=7&e;i.length=1+(e>>3),t.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(e.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t.data[r++]=i:i<-1&&(t.data[r++]=this.DV+i),t.t=r,t.clamp()},a.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},a.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},a.prototype.multiplyLowerTo=function(e,t,r){var i,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(i=r.t-this.t;n=0;)r.data[i]=0;for(i=Math.max(t-this.t,0);i0)if(0==t)r=this.data[0]%e;else for(var i=this.t-1;i>=0;--i)r=(t*r+this.data[i])%e;return r},a.prototype.millerRabin=function(e){var t=this.subtract(a.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var i,n=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var c=i.modPow(n,this);if(0!=c.compareTo(a.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},a.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,i=this.DB-e*this.DB%8,n=0;if(e-- >0)for(i>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<=0;)i<8?(r=(this.data[e]&(1<>(i+=this.DB-8)):(r=this.data[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},a.prototype.equals=function(e){return 0==this.compareTo(e)},a.prototype.min=function(e){return this.compareTo(e)<0?this:e},a.prototype.max=function(e){return this.compareTo(e)>0?this:e},a.prototype.and=function(e){var t=s();return this.bitwiseTo(e,m,t),t},a.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t},a.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,b,t),t},a.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,w,t),t},a.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var d=s();for(i.sqrTo(o[1],d);c<=l;)o[c]=s(),i.mulTo(d,o[c-2],o[c]),c+=2}var p,m,v=e.t-1,b=!0,w=s();for(n=f(e.data[v])-1;v>=0;){for(n>=u?p=e.data[v]>>n-u&l:(p=(e.data[v]&(1<0&&(p|=e.data[v-1]>>this.DB+n-u)),c=r;0==(1&p);)p>>=1,--c;if((n-=c)<0&&(n+=this.DB,--v),b)o[p].copyTo(a),b=!1;else{for(;c>1;)i.sqrTo(a,w),i.sqrTo(w,a),c-=2;c>0?i.sqrTo(a,w):(m=a,a=w,w=m),i.mulTo(w,o[p],a)}for(;v>=0&&0==(e.data[v]&1<=0?(r.subTo(i,r),t&&n.subTo(o,n),s.subTo(c,s)):(i.subTo(r,i),t&&o.subTo(n,o),c.subTo(s,c))}return 0!=i.compareTo(a.ONE)?a.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},a.prototype.pow=function(e){return this.exp(e,new S)},a.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var i=t;t=r,r=i}var n=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(n0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},a.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=A[A.length-1]){for(t=0;t{const r=(t=t||{}).issuer||new s.IdentifierIssuer("_:b"),i={"@default":{}};return c.createNodeMap(e,i,"@default",r),c.mergeNodeMaps(i)},c.createNodeMap=(e,t,r,u,l,d)=>{if(a.isArray(e)){for(const i of e)c.createNodeMap(i,t,r,u,void 0,d);return}if(!a.isObject(e))return void(d&&d.push(e));if(n.isValue(e)){if("@type"in e){let t=e["@type"];0===t.indexOf("_:")&&(e["@type"]=t=u.getId(t))}return void(d&&d.push(e))}if(d&&n.isList(e)){const i=[];return c.createNodeMap(e["@list"],t,r,u,l,i),void d.push({"@list":i})}if("@type"in e){const t=e["@type"];for(const e of t)0===e.indexOf("_:")&&u.getId(e)}a.isUndefined(l)&&(l=n.isBlankNode(e)?u.getId(e["@id"]):e["@id"]),d&&d.push({"@id":l});const p=t[r],h=p[l]=p[l]||{};h["@id"]=l;const f=Object.keys(e).sort();for(let a of f){if("@id"===a)continue;if("@reverse"===a){const i={"@id":l},a=e["@reverse"];for(const e in a){const o=a[e];for(const a of o){let o=a["@id"];n.isBlankNode(a)&&(o=u.getId(o)),c.createNodeMap(a,t,r,u,o),s.addValue(p[o],e,i,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===a){l in t||(t[l]={}),c.createNodeMap(e[a],t,l,u);continue}if("@type"!==a&&i(a)){if("@index"===a&&a in h&&(e[a]!==h[a]||e[a]["@id"]!==h[a]["@id"]))throw new o("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:h});h[a]=e[a];continue}const d=e[a];if(0===a.indexOf("_:")&&(a=u.getId(a)),0!==d.length)for(let e of d)if("@type"===a&&(e=0===e.indexOf("_:")?u.getId(e):e),n.isSubject(e)||n.isSubjectReference(e)){const i=n.isBlankNode(e)?u.getId(e["@id"]):e["@id"];s.addValue(h,a,{"@id":i},{propertyIsArray:!0,allowDuplicate:!1}),c.createNodeMap(e,t,r,u,i)}else if(n.isValue(e))s.addValue(h,a,e,{propertyIsArray:!0,allowDuplicate:!1});else if(n.isList(e)){const i=[];c.createNodeMap(e["@list"],t,r,u,l,i),e={"@list":i},s.addValue(h,a,e,{propertyIsArray:!0,allowDuplicate:!1})}else c.createNodeMap(e,t,r,u,l),s.addValue(h,a,e,{propertyIsArray:!0,allowDuplicate:!1});else s.addValue(h,a,[],{propertyIsArray:!0})}},c.mergeNodeMapGraphs=e=>{const t={};for(const r of Object.keys(e).sort())for(const n of Object.keys(e[r]).sort()){const a=e[r][n];n in t||(t[n]={"@id":n});const o=t[n];for(const e of Object.keys(a).sort())if(i(e))o[e]=s.clone(a[e]);else for(const t of a[e])s.addValue(o,e,s.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},c.mergeNodeMaps=e=>{const t=e["@default"],r=Object.keys(e).sort();for(const i of r){if("@default"===i)continue;const r=e[i];let a=t[i];a?"@graph"in a||(a["@graph"]=[]):t[i]=a={"@id":i,"@graph":[]};const s=a["@graph"];for(const e of Object.keys(r).sort()){const t=r[e];n.isSubjectReference(t)||s.push(t)}}return t}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i=r(27),n=r(21),a=r(79);e.exports=class extends a{constructor({term:e,controller:t,date:r,maxTimestampDelta:i=1/0}={}){if(super({term:e,date:r,maxTimestampDelta:i}),void 0!==t){if("object"!=typeof t)throw new TypeError('"controller" must be an object.');this.controller=t}}async validate(e,{verificationMethod:t,documentLoader:r,expansionMap:a}){try{const s=await super.validate(e,{verificationMethod:t,documentLoader:r,expansionMap:a});if(!s.valid)throw s.error;const{id:o}=t;if(this.controller)s.controller=this.controller;else{const{controller:e,owner:a}=t;let c;if(e)if("object"==typeof e)c=e.id;else{if("string"!=typeof e)throw new TypeError('"controller" must be a string representing a URL.');c=e}else if(a)if("object"==typeof a)c=a.id;else{if("string"!=typeof a)throw new TypeError('"owner" must be a string representing a URL.');c=a}const{"@graph":[u={}]}=await n.frame(c,{"@context":i.SECURITY_CONTEXT_URL,id:c,[this.term]:{"@embed":"@never",id:o}},{documentLoader:r,compactToRelative:!1});s.controller=u}const c=n.getValues(s.controller,this.term);if(s.valid=c.some(e=>e===o||"object"==typeof e&&e.id===o),!s.valid)throw new Error(`Verification method "${t.id}" not authorized by controller for proof purpose "${this.term}".`);return s}catch(e){return{valid:!1,error:e}}}}},function(e,t,r){var i=r(0);r(1),e.exports=i.cipher=i.cipher||{},i.cipher.algorithms=i.cipher.algorithms||{},i.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=i.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new i.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},i.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=i.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new i.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},i.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),i.cipher.algorithms[e]=t},i.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in i.cipher.algorithms?i.cipher.algorithms[e]:null};var n=i.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};n.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=i.util.createBuffer(),this.output=e.output||i.util.createBuffer(),this.mode.start(t)},n.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},n.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(n.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new a(n.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(91),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(16))},function(e,t,r){var i=r(0);r(8),r(1);var n=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=n,n.create=function(){u||function(){a=String.fromCharCode(128),a+=i.util.fillString(String.fromCharCode(0),64),s=[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],c=new Array(64);for(var e=0;e<64;++e)c[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));u=!0}();var e=null,t=i.util.createBuffer(),r=new Array(16),n={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var r=n.messageLengthSize/4,a=0;a>>0,o>>>0];for(var c=n.fullMessageLength.length-1;c>=0;--c)n.fullMessageLength[c]+=o[1],o[1]=o[0]+(n.fullMessageLength[c]/4294967296>>>0),n.fullMessageLength[c]=n.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=i.util.createBuffer();s.putBytes(t.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(a.substr(0,n.blockLength-o));for(var c,u=0,d=n.fullMessageLength.length-1;d>=0;--d)u=(c=8*n.fullMessageLength[d]+u)/4294967296>>>0,s.putInt32Le(c>>>0);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(p,r,s);var h=i.util.createBuffer();return h.putInt32Le(p.h0),h.putInt32Le(p.h1),h.putInt32Le(p.h2),h.putInt32Le(p.h3),h},n};var a=null,s=null,o=null,c=null,u=!1;function l(e,t,r){for(var i,n,a,u,l,d,p,h=r.length();h>=64;){for(n=e.h0,a=e.h1,u=e.h2,l=e.h3,p=0;p<16;++p)t[p]=r.getInt32Le(),i=n+(l^a&(u^l))+c[p]+t[p],n=l,l=u,u=a,a+=i<<(d=o[p])|i>>>32-d;for(;p<32;++p)i=n+(u^l&(a^u))+c[p]+t[s[p]],n=l,l=u,u=a,a+=i<<(d=o[p])|i>>>32-d;for(;p<48;++p)i=n+(a^u^l)+c[p]+t[s[p]],n=l,l=u,u=a,a+=i<<(d=o[p])|i>>>32-d;for(;p<64;++p)i=n+(u^(a|~l))+c[p]+t[s[p]],n=l,l=u,u=a,a+=i<<(d=o[p])|i>>>32-d;e.h0=e.h0+n|0,e.h1=e.h1+a|0,e.h2=e.h2+u|0,e.h3=e.h3+l|0,h-=64}}},function(e,t,r){(function(t){var i=r(0);r(24),r(8),r(1);var n,a=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(n=r(38)),e.exports=i.pbkdf2=a.pbkdf2=function(e,r,a,s,o,c){if("function"==typeof o&&(c=o,o=null),i.util.isNodejs&&!i.options.usePureJavaScript&&n.pbkdf2&&(null===o||"object"!=typeof o)&&(n.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!=typeof o&&(o="sha1"),e=t.from(e,"binary"),r=t.from(r,"binary"),c?4===n.pbkdf2Sync.length?n.pbkdf2(e,r,a,s,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):n.pbkdf2(e,r,a,s,o,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===n.pbkdf2Sync.length?n.pbkdf2Sync(e,r,a,s).toString("binary"):n.pbkdf2Sync(e,r,a,s,o).toString("binary");if(null==o&&(o="sha1"),"string"==typeof o){if(!(o in i.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=i.md[o].create()}var u=o.digestLength;if(s>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var d=Math.ceil(s/u),p=s-(d-1)*u,h=i.hmac.create();h.start(o,e);var f,g,y,m="";if(!c){for(var v=1;v<=d;++v){h.start(null,null),h.update(r),h.update(i.util.int32ToBytes(v)),f=y=h.digest().getBytes();for(var b=2;b<=a;++b)h.start(null,null),h.update(y),g=h.digest().getBytes(),f=i.util.xorBytes(f,g,u),y=g;m+=vd)return c(null,m);h.start(null,null),h.update(r),h.update(i.util.int32ToBytes(v)),f=y=h.digest().getBytes(),b=2,C()}function C(){if(b<=a)return h.start(null,null),h.update(y),g=h.digest().getBytes(),f=i.util.xorBytes(f,g,u),y=g,++b,i.util.setImmediate(C);m+=v>>0,o>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=o[1],o[1]=o[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=i.util.createBuffer();s.putBytes(t.bytes());var o,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(a.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],d=0;d>>0,s.putInt32(l>>>0),l=o>>>0;s.putInt32(l);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(p,r,s);var h=i.util.createBuffer();return h.putInt32(p.h0),h.putInt32(p.h1),h.putInt32(p.h2),h.putInt32(p.h3),h.putInt32(p.h4),h.putInt32(p.h5),h.putInt32(p.h6),h.putInt32(p.h7),h},n};var a=null,s=!1,o=null;function c(e,t,r){for(var i,n,a,s,c,u,l,d,p,h,f,g,y,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)i=((i=t[c-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,n=((n=t[c-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[c]=i+t[c-7]+n+t[c-16]|0;for(u=e.h0,l=e.h1,d=e.h2,p=e.h3,h=e.h4,f=e.h5,g=e.h6,y=e.h7,c=0;c<64;++c)a=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&l|d&(u^l),i=y+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(g^h&(f^g))+o[c]+t[c],y=g,g=f,f=h,h=p+i>>>0,p=d,d=l,l=u,u=i+(n=a+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+d|0,e.h3=e.h3+p|0,e.h4=e.h4+h|0,e.h5=e.h5+f|0,e.h6=e.h6+g|0,e.h7=e.h7+y|0,m-=64}}},function(e,t,r){var i=r(0);r(12),r(7),r(29),r(8),r(94),r(13),r(17),r(41),r(30),r(1);var n=i.asn1,a=e.exports=i.pki=i.pki||{},s=a.oids,o={};o.CN=s.commonName,o.commonName="CN",o.C=s.countryName,o.countryName="C",o.L=s.localityName,o.localityName="L",o.ST=s.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=s.organizationName,o.organizationName="O",o.OU=s.organizationalUnitName,o.organizationalUnitName="OU",o.E=s.emailAddress,o.emailAddress="E";var c=i.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:n.Class.UNIVERSAL,type:n.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:n.Class.UNIVERSAL,type:n.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:n.Class.UNIVERSAL,type:n.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:n.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:n.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:n.Class.UNIVERSAL,type:n.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},d={name:"CertificationRequestInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0}]}]}]},p={name:"CertificationRequest",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[d,{name:"CertificationRequest.signatureAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:n.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:n.Class.UNIVERSAL,type:n.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function h(e,t){"string"==typeof t&&(t={shortName:t});for(var r,i=null,n=0;null===i&&n128)throw new Error('Invalid "nsComment" content.');e.value=n.create(n.Class.UNIVERSAL,n.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var f=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!1,f))}if(e.authorityCertIssuer){var y=[n.create(n.Class.CONTEXT_SPECIFIC,4,!0,[g(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,y))}if(e.serialNumber){var m=i.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;var v,b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),w=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(p=0;p2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(d.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=d[0],c.validity.notAfter=d[1],c.tbsCertificate=r.tbsCertificate,t){var p;if(c.md=null,c.signatureOid in s)switch(s[c.signatureOid]){case"sha1WithRSAEncryption":c.md=i.md.sha1.create();break;case"md5WithRSAEncryption":c.md=i.md.md5.create();break;case"sha256WithRSAEncryption":c.md=i.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=i.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=i.md.sha512.create();break;case"RSASSA-PSS":c.md=i.md.sha256.create()}if(null===c.md)throw(p=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,p;var g=n.toDer(c.tbsCertificate);c.md.update(g.getBytes())}var m=i.md.sha1.create();c.issuer.getField=function(e){return h(c.issuer,e)},c.issuer.addField=function(e){y([e]),c.issuer.attributes.push(e)},c.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var v=i.md.sha1.create();return c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){y([e]),c.subject.attributes.push(e)},c.subject.attributes=a.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),r.certExtensions?c.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},a.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),a=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){(c=n.fromDer(t.value)).value.length>0&&c.value[0].type===n.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var o=null;c.value.length>0&&c.value[0].type===n.Type.INTEGER?o=c.value[0].value:c.value.length>1&&(o=c.value[1].value),null!==o&&(t.pathLenConstraint=n.derToInteger(o))}else if("extKeyUsage"===t.name)for(var c=n.fromDer(t.value),u=0;u1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var d;t.altNames=[];c=n.fromDer(t.value);for(var p=0;p=w&&e0&&s.value.push(a.certificateExtensionsToAsn1(e.extensions)),s},a.getCertificationRequestInfo=function(e){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),g(e.subject),a.publicKeyToAsn1(e.publicKey),b(e)])},a.distinguishedNameToAsn1=function(e){return g(e)},a.certificateToAsn1=function(e){var t=e.tbsCertificate||a.getTBSCertificate(e);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[t,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},a.certificateExtensionsToAsn1=function(e){var t=n.create(n.Class.CONTEXT_SPECIFIC,3,!0,[]),r=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);t.value.push(r);for(var i=0;il.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===c){if(null===(d=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(p=!0,d=l),d){var h=d;i.util.isArray(h)||(h=[h]);for(var f=!1;!f&&h.length>0;){d=h.shift();try{f=d.verify(l)}catch(e){}}f||(c={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}null!==c||d&&!p||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(null===c&&d&&!l.isIssuer(d)&&(c={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===c)for(var g={keyUsage:!0,basicConstraints:!0},y=0;null===c&&yv.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}var w=null===c||c.error,C=r.verify?r.verify(w,u,n):w;if(!0!==C)throw!0===w&&(c={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(C||0===C)&&("object"!=typeof C||i.util.isArray(C)?"string"==typeof C&&(c.error=C):(C.message&&(c.message=C.message),C.error&&(c.error=C.error))),c;c=null,o=!1,++u}while(t.length>0);return!0}},function(e,t,r){var i=r(0);r(3),r(1),(e.exports=i.pss=i.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,a=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=i.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||i.random,c={encode:function(e,c){var u,l,d=c-1,p=Math.ceil(d/8),h=e.digest().getBytes();if(p>8*p-d&255;return(w=String.fromCharCode(w.charCodeAt(0)&~C)+w.substr(1))+g+String.fromCharCode(188)},verify:function(e,s,o){var c,u=o-1,l=Math.ceil(u/8);if(s=s.substr(-l),l>8*l-u&255;if(0!=(p.charCodeAt(0)&f))throw new Error("Bits beyond keysize not zero as expected.");var g=n.generate(h,d),y="";for(c=0;c{i.pkcs5.pbkdf2(e,t,r,n,(e,t)=>e?s(e):a(t))})}publicNode({controller:e=this.controller,owner:t=this.owner}={}){const r={id:this.id,type:this.type};return e&&(r.controller=e),t&&(r.owner=t),this.addEncodedPublicKey(r),r}async export(){const e=this.publicNode();return this.addEncryptedPrivateKey(e)}}},function(e,t,r){"use strict";(function(t){ /*! * Copyright (c) 2018-2019 Digital Bazaar, Inc. All rights reserved. */ const i=r(56),n=r(23),{md:{sha256:a},pki:{getPublicKeyFingerprint:s,publicKeyFromPem:o},util:{binary:{base58:c,raw:u}}}=n,l=r(42);class d extends l{constructor(e={}){super(e),this.type="RsaVerificationKey2018",this.privateKeyPem=e.privateKeyPem,this.publicKeyPem=e.publicKeyPem,this.validateKeyParams()}get publicKey(){return this.publicKeyPem}get privateKey(){return this.privateKeyPem}static async generate(e={}){return new Promise((t,r)=>{n.pki.rsa.generateKeyPair({bits:2048,e:65537,workers:-1},(i,a)=>{if(i)return r(i);t(new d({publicKeyPem:n.pki.publicKeyToPem(a.publicKey),privateKeyPem:n.pki.privateKeyToPem(a.privateKey),...e}))})})}static async from(e){const t=e.privateKeyPem||e.privateKeyPem&&e.privateKey.privateKeyPem;return new d({publicKey:e.publicKeyPem,privateKeyPem:t,type:e.type||e.keyType,...e})}validateKeyParams(){if(this.publicKeyPem){const e=n.pki.publicKeyFromPem(this.publicKeyPem),t=e.n.bitLength();if(2048!==t)throw new Error("Invalid RSA keyBit length "+JSON.stringify(t)+" required value is 2048");if("65537"!==e.e.toString(10))throw new Error("Invalid RSA exponent "+JSON.stringify(e.e.toString(10))+" required value is 65537}")}if(this.privateKeyPem){const e=n.pki.privateKeyFromPem(this.privateKeyPem),t=e.n.bitLength();if(2048!==t)throw new Error("Invalid RSA keyBit length "+JSON.stringify(t)+" required value is 2048");if("65537"!==e.e.toString(10))throw new Error("Invalid RSA exponent "+JSON.stringify(e.e.toString(10))+" required value is 65537}")}}addEncodedPublicKey(e){return e.publicKeyPem=this.publicKeyPem,e}async addEncryptedPrivateKey(e){return null!==this.passphrase?e.privateKeyPem=n.pki.encryptRsaPrivateKey(n.pki.privateKeyFromPem(this.privateKeyPem),this.passphrase,{algorithm:"aes256"}):e.privateKeyPem=this.privateKeyPem,e}fingerprint(){const e=n.util.createBuffer(),t=n.pki.getPublicKeyFingerprint(n.pki.publicKeyFromPem(this.publicKeyPem),{md:a.create()});return e.putBytes(n.util.hexToBytes("5d1220")),e.putBytes(t.bytes()),"z"+c.encode(e)}verifyFingerprint(e){if("string"!=typeof e||"z"!==e[0])return{error:new Error("`fingerprint` must be a multibase encoded string."),valid:!1};const t=c.decode(e.slice(1)),r=s(o(this.publicKeyPem),{md:a.create()}),i="5d1220"===t.slice(0,3).toString("hex")&&r.toHex()===t.slice(3).toString("hex");return i?{valid:i}:{error:new Error("The fingerprint does not match the public key."),valid:!1}}signer(){return function(e){if(!e.privateKeyPem)return{async sign(){throw new Error("No private key to sign with.")}};if(i.nodejs){const i=r(25);if("RSA_PKCS1_PSS_PADDING"in i.constants)return{async sign({data:r}){const n=i.createSign("RSA-SHA256");n.update(t.from(r.buffer,r.byteOffset,r.length));const a=n.sign({key:e.privateKeyPem,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST});return new Uint8Array(a.buffer,a.byteOffset,a.length)}}}const s=n.pki.privateKeyFromPem(e.privateKeyPem);return{async sign({data:e}){const t=p(),r=a.create();r.update(u.encode(e),"binary");const i=s.sign(r,t);return u.decode(i)}}}(this)}verifier(){return function(e){if(i.nodejs){const i=r(25);if("RSA_PKCS1_PSS_PADDING"in i.constants)return{async verify({data:r,signature:n}){const a=i.createVerify("RSA-SHA256");return a.update(t.from(r.buffer,r.byteOffset,r.length)),a.verify({key:e.publicKeyPem,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST},t.from(n.buffer,n.byteOffset,n.length))}}}const n=o(e.publicKeyPem);return{async verify({data:e,signature:t}){const r=p(),i=a.create();i.update(u.encode(e),"binary");try{return n.verify(i.digest().bytes(),u.encode(t),r)}catch(e){return!1}}}}(this)}}function p(){const e=a.create();return n.pss.create({md:e,mgf:n.mgf.mgf1.create(a.create()),saltLength:e.digestLength})}e.exports=d}).call(this,r(6).Buffer)},function(e,t){},function(e,t){},function(e,t,r){"use strict";const i=r(14),n=r(72),a=r(108),s=r(75),o=r(109);let c;try{c=r(110)}catch(e){}const u={};e.exports=u,u.NQuads=r(48),u.IdentifierIssuer=r(47),u._rdfCanonizeNative=function(e){return e&&(c=e),c},u.canonize=i.callbackify((async function(e,t){let r;const i=new Promise((e,t)=>{r=(r,i)=>{if(r)return t(r);e(i)}});if(Array.isArray(e)||(e=u.NQuads.legacyDatasetToQuads(e)),t.useNative){if(!c)throw new Error("rdf-canonize-native not available");c.canonize(e,t,r)}else if("URDNA2015"===t.algorithm)new n(t).main(e,r);else{if("URGNA2012"!==t.algorithm)throw"algorithm"in t?new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.");new a(t).main(e,r)}return i})),u.canonizeSync=function(e,t){if(Array.isArray(e)||(e=u.NQuads.legacyDatasetToQuads(e)),t.useNative){if(c)return c.canonizeSync(e,t);throw new Error("rdf-canonize-native not available")}if("URDNA2015"===t.algorithm)return new s(t).main(e);if("URGNA2012"===t.algorithm)return new o(t).main(e);if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)}},function(e,t,r){"use strict";const i=r(14);e.exports=class e{constructor(e){this.prefix=e,this.counter=0,this.existing={}}clone(){const t=new e(this.prefix);return t.counter=this.counter,t.existing=i.clone(this.existing),t}getId(e){if(e&&e in this.existing)return this.existing[e];const t=this.prefix+this.counter;return this.counter+=1,e&&(this.existing[e]=t),t}hasId(e){return e in this.existing}}},function(e,t,r){"use strict";const i="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",n="http://www.w3.org/2001/XMLSchema#string",a={};function s(e,t){for(const r in e)if(e[r].termType!==t[r].termType||e[r].value!==t[r].value)return!1;return"Literal"!==e.object.termType||e.object.datatype.termType===t.object.datatype.termType&&e.object.datatype.value===t.object.datatype.value&&e.object.language===t.object.language}a.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,a.empty=new RegExp("^[ \\t]*$"),a.quad=new RegExp('^[ \\t]*(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<([^:]+:[^>]*)>)[ \\t]+(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<([^:]+:[^>]*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$'),e.exports=class e{static parse(e){const t=[],r={},o=e.split(a.eoln);let u=0;for(const e of o){if(u++,a.empty.test(e))continue;const o=e.match(a.quad);if(null===o)throw new Error("N-Quads parse error on line "+u+".");const l={};if(void 0!==o[1]?l.subject={termType:"NamedNode",value:o[1]}:l.subject={termType:"BlankNode",value:o[2]},l.predicate={termType:"NamedNode",value:o[3]},void 0!==o[4]?l.object={termType:"NamedNode",value:o[4]}:void 0!==o[5]?l.object={termType:"BlankNode",value:o[5]}:(l.object={termType:"Literal",value:void 0,datatype:{termType:"NamedNode"}},void 0!==o[7]?l.object.datatype.value=o[7]:void 0!==o[8]?(l.object.datatype.value=i,l.object.language=o[8]):l.object.datatype.value=n,l.object.value=o[6].replace(c,(function(e,t,r,i){if(t)switch(t){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(r)return String.fromCharCode(parseInt(r,16));if(i)throw new Error("Unsupported U escape")}))),void 0!==o[9]?l.graph={termType:"NamedNode",value:o[9]}:void 0!==o[10]?l.graph={termType:"BlankNode",value:o[10]}:l.graph={termType:"DefaultGraph",value:""},l.graph.value in r){let e=!0;const i=r[l.graph.value];for(const t of i)if(s(t,l)){e=!1;break}e&&(i.push(l),t.push(l))}else r[l.graph.value]=[l],t.push(l)}return t}static serialize(t){Array.isArray(t)||(t=e.legacyDatasetToQuads(t));const r=[];for(const i of t)r.push(e.serializeQuad(i));return r.sort().join("")}static serializeQuad(e){const t=e.subject,r=e.predicate,a=e.object,s=e.graph;let c="";return[t,r].forEach(e=>{"NamedNode"===e.termType?c+="<"+e.value+">":c+=e.value,c+=" "}),"NamedNode"===a.termType?c+="<"+a.value+">":"BlankNode"===a.termType?c+=a.value:(c+='"'+function(e){return e.replace(o,(function(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(a.value)+'"',a.datatype.value===i?a.language&&(c+="@"+a.language):a.datatype.value!==n&&(c+="^^<"+a.datatype.value+">")),"NamedNode"===s.termType?c+=" <"+s.value+">":"BlankNode"===s.termType&&(c+=" "+s.value),c+=" .\n",c}static legacyDatasetToQuads(e){const t=[],r={"blank node":"BlankNode",IRI:"NamedNode",literal:"Literal"};for(const a in e){e[a].forEach(e=>{const s={};for(const t in e){const a=e[t],o={termType:r[a.type],value:a.value};"Literal"===o.termType&&(o.datatype={termType:"NamedNode"},"datatype"in a&&(o.datatype.value=a.datatype),"language"in a?("datatype"in a||(o.datatype.value=i),o.language=a.language):"datatype"in a||(o.datatype.value=n)),s[t]=o}s.graph="@default"===a?{termType:"DefaultGraph",value:""}:{termType:a.startsWith("_:")?"BlankNode":"NamedNode",value:a},t.push(s)})}return t}};const o=/["\\\n\r]/g;const c=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g},function(e,t,r){"use strict";e.exports=class{constructor(){this._requests={}}wrapLoader(e){const t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i=r(80),n=r(21),a=r(81);e.exports=class extends i{constructor({type:e,alg:t,LDKeyClass:r,creator:i,verificationMethod:n,signer:a,key:s,proof:o,date:c,useNativeCanonize:u}={}){if(super({type:e,creator:i,verificationMethod:n,proof:o,date:c,useNativeCanonize:u}),this.alg=t,this.LDKeyClass=r,this.signer=a,s){if(void 0===n&&void 0===i){const e=s.publicNode();e.owner?this.creator=e.id:this.verificationMethod=e.id}this.key=s,"function"==typeof s.signer&&(this.signer=s.signer()),"function"==typeof s.verifier&&(this.verifier=s.verifier())}}async sign({verifyData:e,proof:t}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");const r={alg:this.alg,b64:!1,crit:["b64"]},i=a.encodeBase64Url(JSON.stringify(r)),n=a.createJws({encodedHeader:i,verifyData:e}),s=await this.signer.sign({data:n}),o=a.encodeBase64Url(s);return t.jws=i+".."+o,t}async verifySignature({verifyData:e,verificationMethod:t,proof:r}){if(!r.jws||"string"!=typeof r.jws||!r.jws.includes("."))throw new TypeError('The proof does not include a valid "jws" property.');const[i,,n]=r.jws.split(".");let s;try{s=JSON.parse(a.decodeBase64UrlToString(i))}catch(e){throw new Error("Could not parse JWS header; "+e)}if(!s||"object"!=typeof s)throw new Error("Invalid JWS header.");if((s.alg!==this.alg||!1!==s.b64||!Array.isArray(s.crit)||1!==s.crit.length||"b64"!==s.crit[0])&&3===Object.keys(s).length)throw new Error(`Invalid JWS header parameters for ${this.type}.`);const o=a.decodeBase64Url(n),c=a.createJws({encodedHeader:i,verifyData:e});let{verifier:u}=this;if(!u){u=(await this.LDKeyClass.from(t)).verifier()}return u.verify({data:c,signature:o})}async assertVerificationMethod({verificationMethod:e}){if(!n.hasValue(e,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`)}async getVerificationMethod({proof:e,documentLoader:t}){if(this.key)return this.key.publicNode();const r=await super.getVerificationMethod({proof:e,documentLoader:t});return await this.assertVerificationMethod({verificationMethod:r}),r}async matchProof({proof:e,document:t,purpose:r,documentLoader:i,expansionMap:n}){if(!await super.matchProof({proof:e,document:t,purpose:r,documentLoader:i,expansionMap:n}))return!1;if(!this.key)return!0;let{verificationMethod:a}=e;return a||(a=e.creator),"object"==typeof a?a.id===this.key.id:a===this.key.id}}},function(e,t){},function(e){e.exports=JSON.parse('{"@context":{"id":"@id","type":"@type","dc":"http://purl.org/dc/terms/","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","EcdsaKoblitzSignature2016":"sec:EcdsaKoblitzSignature2016","Ed25519Signature2018":"sec:Ed25519Signature2018","EncryptedMessage":"sec:EncryptedMessage","GraphSignature2012":"sec:GraphSignature2012","LinkedDataSignature2015":"sec:LinkedDataSignature2015","LinkedDataSignature2016":"sec:LinkedDataSignature2016","CryptographicKey":"sec:Key","authenticationTag":"sec:authenticationTag","canonicalizationAlgorithm":"sec:canonicalizationAlgorithm","cipherAlgorithm":"sec:cipherAlgorithm","cipherData":"sec:cipherData","cipherKey":"sec:cipherKey","created":{"@id":"dc:created","@type":"xsd:dateTime"},"creator":{"@id":"dc:creator","@type":"@id"},"digestAlgorithm":"sec:digestAlgorithm","digestValue":"sec:digestValue","domain":"sec:domain","encryptionKey":"sec:encryptionKey","expiration":{"@id":"sec:expiration","@type":"xsd:dateTime"},"expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"initializationVector":"sec:initializationVector","iterationCount":"sec:iterationCount","nonce":"sec:nonce","normalizationAlgorithm":"sec:normalizationAlgorithm","owner":{"@id":"sec:owner","@type":"@id"},"password":"sec:password","privateKey":{"@id":"sec:privateKey","@type":"@id"},"privateKeyPem":"sec:privateKeyPem","publicKey":{"@id":"sec:publicKey","@type":"@id"},"publicKeyBase58":"sec:publicKeyBase58","publicKeyPem":"sec:publicKeyPem","publicKeyWif":"sec:publicKeyWif","publicKeyService":{"@id":"sec:publicKeyService","@type":"@id"},"revoked":{"@id":"sec:revoked","@type":"xsd:dateTime"},"salt":"sec:salt","signature":"sec:signature","signatureAlgorithm":"sec:signingAlgorithm","signatureValue":"sec:signatureValue"}}')},function(e){e.exports=JSON.parse('{"@context":[{"@version":1.1},"https://w3id.org/security/v1",{"AesKeyWrappingKey2019":"sec:AesKeyWrappingKey2019","DeleteKeyOperation":"sec:DeleteKeyOperation","DeriveSecretOperation":"sec:DeriveSecretOperation","EcdsaSecp256k1Signature2019":"sec:EcdsaSecp256k1Signature2019","EcdsaSecp256r1Signature2019":"sec:EcdsaSecp256r1Signature2019","EcdsaSecp256k1VerificationKey2019":"sec:EcdsaSecp256k1VerificationKey2019","EcdsaSecp256r1VerificationKey2019":"sec:EcdsaSecp256r1VerificationKey2019","Ed25519Signature2018":"sec:Ed25519Signature2018","Ed25519VerificationKey2018":"sec:Ed25519VerificationKey2018","EquihashProof2018":"sec:EquihashProof2018","ExportKeyOperation":"sec:ExportKeyOperation","GenerateKeyOperation":"sec:GenerateKeyOperation","KmsOperation":"sec:KmsOperation","RevokeKeyOperation":"sec:RevokeKeyOperation","RsaSignature2018":"sec:RsaSignature2018","RsaVerificationKey2018":"sec:RsaVerificationKey2018","Sha256HmacKey2019":"sec:Sha256HmacKey2019","SignOperation":"sec:SignOperation","UnwrapKeyOperation":"sec:UnwrapKeyOperation","VerifyOperation":"sec:VerifyOperation","WrapKeyOperation":"sec:WrapKeyOperation","X25519KeyAgreementKey2019":"sec:X25519KeyAgreementKey2019","allowedAction":"sec:allowedAction","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},"capability":{"@id":"sec:capability","@type":"@id"},"capabilityAction":"sec:capabilityAction","capabilityChain":{"@id":"sec:capabilityChain","@type":"@id","@container":"@list"},"capabilityDelegation":{"@id":"sec:capabilityDelegationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"sec:capabilityInvocationMethod","@type":"@id","@container":"@set"},"caveat":{"@id":"sec:caveat","@type":"@id","@container":"@set"},"challenge":"sec:challenge","ciphertext":"sec:ciphertext","controller":{"@id":"sec:controller","@type":"@id"},"delegator":{"@id":"sec:delegator","@type":"@id"},"equihashParameterK":{"@id":"sec:equihashParameterK","@type":"xsd:integer"},"equihashParameterN":{"@id":"sec:equihashParameterN","@type":"xsd:integer"},"invocationTarget":{"@id":"sec:invocationTarget","@type":"@id"},"invoker":{"@id":"sec:invoker","@type":"@id"},"jws":"sec:jws","keyAgreement":{"@id":"sec:keyAgreementMethod","@type":"@id","@container":"@set"},"kmsModule":{"@id":"sec:kmsModule"},"parentCapability":{"@id":"sec:parentCapability","@type":"@id"},"plaintext":"sec:plaintext","proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab"},"proofValue":"sec:proofValue","referenceId":"sec:referenceId","unwrappedKey":"sec:unwrappedKey","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"},"verifyData":"sec:verifyData","wrappedKey":"sec:wrappedKey"}]}')},function(e,t,r){(function(t,r,i){e.exports=function e(t,r,i){function n(s,o){if(!r[s]){if(!t[s]){if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){return n(t[s][1][e]||e)}),u,u.exports,e,t,r,i)}return r[s].exports}for(var a=!1,s=0;s>2,o=(3&t)<<4|r>>4,c=1>6:64,u=2>4,r=(15&s)<<4|(o=a.indexOf(e.charAt(u++)))>>2,i=(3&o)<<6|(c=a.indexOf(e.charAt(u++))),p[l++]=t,64!==o&&(p[l++]=r),64!==c&&(p[l++]=i);return p}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var i=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function o(e,t,r,i,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=n}o.prototype={getContentWorker:function(){var e=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new a).pipe(new s("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(e){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var i=e("./utils"),n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,r,i){var a=n,s=0+r;e^=-1;for(var o=0;o>>8^a[255&(e^t[o])];return-1^e}(0|t,e,e.length):function(e,t,r,i){var a=n,s=0+r;e^=-1;for(var o=0;o>>8^a[255&(e^t.charCodeAt(o))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var i;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),a=e("./utils"),s=e("./stream/GenericWorker"),o=i?"uint8array":"array";function c(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",a.inherits(c,s),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(o,e.data),!1)},c.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new c("Deflate",e)},r.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function i(e,t){var r,i="";for(r=0;r>>=8;return i}function n(e,t,r,n,s,l){var d,p,h=e.file,f=e.compression,g=l!==o.utf8encode,y=a.transformTo("string",l(h.name)),m=a.transformTo("string",o.utf8encode(h.name)),v=h.comment,b=a.transformTo("string",l(v)),w=a.transformTo("string",o.utf8encode(v)),C=m.length!==h.name.length,E=w.length!==v.length,S="",T="",I="",A=h.dir,_=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),g||!C&&!E||(k|=2048);var B=0,N=0;A&&(B|=16),"UNIX"===s?(N=798,B|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,A)):(N=20,B|=function(e){return 63&(e||0)}(h.dosPermissions)),d=_.getUTCHours(),d<<=6,d|=_.getUTCMinutes(),d<<=5,d|=_.getUTCSeconds()/2,p=_.getUTCFullYear()-1980,p<<=4,p|=_.getUTCMonth()+1,p<<=5,p|=_.getUTCDate(),C&&(T=i(1,1)+i(c(y),4)+m,S+="up"+i(T.length,2)+T),E&&(I=i(1,1)+i(c(b),4)+w,S+="uc"+i(I.length,2)+I);var R="";return R+="\n\0",R+=i(k,2),R+=f.magic,R+=i(d,2),R+=i(p,2),R+=i(x.crc32,4),R+=i(x.compressedSize,4),R+=i(x.uncompressedSize,4),R+=i(y.length,2),R+=i(S.length,2),{fileRecord:u.LOCAL_FILE_HEADER+R+y+S,dirRecord:u.CENTRAL_FILE_HEADER+i(N,2)+R+i(b.length,2)+"\0\0\0\0"+i(B,4)+i(n,4)+y+S+b}}var a=e("../utils"),s=e("../stream/GenericWorker"),o=e("../utf8"),c=e("../crc32"),u=e("../signature");function l(e,t,r,i){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(l,s),l.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,s.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}}))},l.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,r){"use strict";var i=e("./Uint8ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var i=e("./DataReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var i=e("./ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../support"),a=e("./ArrayReader"),s=e("./StringReader"),o=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new o(e):n.uint8array?new c(i.transformTo("uint8array",e)):new a(i.transformTo("array",e)):new s(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../utils");function a(e){i.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(a,i),a.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,i),a.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(a,n),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}i.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r "+e:e}},t.exports=i},{}],29:[function(e,r,i){"use strict";var n=e("../utils"),a=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),c=e("../support"),u=e("../external"),l=null;if(c.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function d(e,t,r){var i=t;switch(t){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string"}try{this._internalType=i,this._outputType=t,this._mimeType=r,n.checkSupport(i),this._worker=e.pipe(new a(i)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}d.prototype={accumulate:function(e){return function(e,r){return new u.Promise((function(i,a){var s=[],c=e._internalType,u=e._outputType,l=e._mimeType;e.on("data",(function(e,t){s.push(e),r&&r(t)})).on("error",(function(e){s=[],a(e)})).on("end",(function(){try{var e=function(e,t,r){switch(e){case"blob":return n.newBlob(n.transformTo("arraybuffer",t),r);case"base64":return o.encode(t);default:return n.transformTo(e,t)}}(u,function(e,r){var i,n=0,a=null,s=0;for(i=0;i>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},r.utf8decode=function(e){return n.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,a,s=e.length,c=new Array(2*s);for(t=r=0;t>10&1023,c[r++]=56320|1023&n)}return c.length!==r&&(c.subarray?c=c.subarray(0,r):c.length=r),i.applyFromCharCode(c)}(e=i.transformTo(n.uint8array?"uint8array":"array",e))},i.inherits(u,s),u.prototype.processChunk=function(e){var t=i.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var s=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}(t),c=t;s!==t.length&&(n.uint8array?(c=t.subarray(0,s),this.leftOver=t.subarray(s,t.length)):(c=t.slice(0,s),this.leftOver=t.slice(s,t.length))),this.push({data:r.utf8decode(c),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,i.inherits(l,s),l.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var i=e("./support"),n=e("./base64"),a=e("./nodejsUtils"),s=e("set-immediate-shim"),o=e("./external");function c(e){return e}function u(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,r,i,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return c(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r>10&1023,u[i++]=56320|1023&n)}return c(u,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,i){for(var n=65535&e|0,a=e>>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var a=i,s=n+r;e^=-1;for(var o=n;o>>8^a[255&(e^t[o])];return-1^e}},{}],46:[function(e,t,r){"use strict";var i,n=e("../utils/common"),a=e("./trees"),s=e("./adler32"),o=e("./crc32"),c=e("./messages"),u=-2,l=258,d=262,p=113;function h(e,t){return e.msg=c[t],t}function f(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function m(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,y(e.strm)}function v(e,t){e.pending_buf[e.pending++]=t}function b(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function w(e,t){var r,i,n=e.max_chain_length,a=e.strstart,s=e.prev_length,o=e.nice_match,c=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,u=e.window,p=e.w_mask,h=e.prev,f=e.strstart+l,g=u[a+s-1],y=u[a+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(r=t)+s]===y&&u[r+s-1]===g&&u[r]===u[a]&&u[++r]===u[a+1]){a+=2,r++;do{}while(u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&ac&&0!=--n);return s<=e.lookahead?s:e.lookahead}function C(e){var t,r,i,a,c,u,l,p,h,f,g=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=g+(g-d)){for(n.arraySet(e.window,e.window,g,g,0),e.match_start-=g,e.strstart-=g,e.block_start-=g,t=r=e.hash_size;i=e.head[--t],e.head[t]=g<=i?i-g:0,--r;);for(t=r=g;i=e.prev[--t],e.prev[t]=g<=i?i-g:0,--r;);a+=g}if(0===e.strm.avail_in)break;if(u=e.strm,l=e.window,p=e.strstart+e.lookahead,f=void 0,(h=a)<(f=u.avail_in)&&(f=h),r=0===f?0:(u.avail_in-=f,n.arraySet(l,u.input,u.next_in,f,p),1===u.state.wrap?u.adler=s(u.adler,l,f,p):2===u.state.wrap&&(u.adler=o(u.adler,l,f,p)),u.next_in+=f,u.total_in+=f,f),e.lookahead+=r,e.lookahead+e.insert>=3)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(i=a._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,i=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(C(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,m(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(m(e,!1),e.strm.avail_out),1)})),new T(4,4,8,4,E),new T(4,5,16,8,E),new T(4,6,32,32,E),new T(4,4,16,16,S),new T(8,16,32,32,S),new T(8,16,128,128,S),new T(8,32,128,256,S),new T(32,128,258,1024,S),new T(32,258,258,4096,S)],r.deflateInit=function(e,t){return x(e,t,8,15,8,0)},r.deflateInit2=x,r.deflateReset=_,r.deflateResetKeep=A,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},r.deflate=function(e,t){var r,n,s,c;if(!e||!e.state||5>8&255),v(n,n.gzhead.time>>16&255),v(n,n.gzhead.time>>24&255),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(v(n,255&n.gzhead.extra.length),v(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=o(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(v(n,0),v(n,0),v(n,0),v(n,0),v(n,0),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,3),n.status=p);else{var d=8+(n.w_bits-8<<4)<<8;d|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=p,b(n,d),0!==n.strstart&&(b(n,e.adler>>>16),b(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(s=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),y(e),s=n.pending,n.pending!==n.pending_buf_size));)v(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),y(e),s=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindexs&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),y(e),s=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindexs&&(e.adler=o(e.adler,n.pending_buf,n.pending-s,s)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&y(e),n.pending+2<=n.pending_buf_size&&(v(n,255&e.adler),v(n,e.adler>>8&255),e.adler=0,n.status=p)):n.status=p),0!==n.pending){if(y(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(r)&&4!==t)return h(e,-5);if(666===n.status&&0!==e.avail_in)return h(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var w=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(C(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,i,n,s,o=e.window;;){if(e.lookahead<=l){if(C(e),e.lookahead<=l&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}(n,t):i[n.level].func(n,t);if(3!==w&&4!==w||(n.status=666),1===w||3===w)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===w&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(g(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),y(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(v(n,255&e.adler),v(n,e.adler>>8&255),v(n,e.adler>>16&255),v(n,e.adler>>24&255),v(n,255&e.total_in),v(n,e.total_in>>8&255),v(n,e.total_in>>16&255),v(n,e.total_in>>24&255)):(b(n,e.adler>>>16),b(n,65535&e.adler)),y(e),0=r.w_size&&(0===o&&(g(r.head),r.strstart=0,r.block_start=0,r.insert=0),p=new n.Buf8(r.w_size),n.arraySet(p,t,h-r.w_size,r.w_size,0),t=p,h=r.w_size),c=e.avail_in,l=e.next_in,d=e.input,e.avail_in=h,e.next_in=0,e.input=t,C(r);r.lookahead>=3;){for(i=r.strstart,a=r.lookahead-2;r.ins_h=(r.ins_h<>>=w=b>>>24,f-=w,0==(w=b>>>16&255))A[a++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=g[(65535&b)+(h&(1<>>=w,f-=w),f<15&&(h+=I[i++]<>>=w=b>>>24,f-=w,!(16&(w=b>>>16&255))){if(0==(64&w)){b=y[(65535&b)+(h&(1<>>=w,f-=w,(w=a-s)>3,h&=(1<<(f-=C<<3))-1,e.next_in=i,e.next_out=a,e.avail_in=i>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function l(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(852),t.distcode=t.distdyn=new i.Buf32(592),t.sane=1,t.back=-1,0):c}function p(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,d(e)):c}function h(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(i.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(a=s.wsize-s.wnext)&&(a=n),i.arraySet(s.window,t,r-n,a,s.wnext),(n-=a)?(i.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=a,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=a(r.check,P,2,0),m=y=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&y)<<8)+(y>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&y)){e.msg="unknown compression method",r.mode=30;break}if(m-=4,N=8+(15&(y>>>=4)),0===r.wbits)r.wbits=N;else if(N>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(P[0]=255&y,P[1]=y>>>8&255,r.check=a(r.check,P,2,0)),m=y=0,r.mode=3;case 3:for(;m<32;){if(0===f)break e;f--,y+=l[p++]<>>8&255,P[2]=y>>>16&255,P[3]=y>>>24&255,r.check=a(r.check,P,4,0)),m=y=0,r.mode=4;case 4:for(;m<16;){if(0===f)break e;f--,y+=l[p++]<>8),512&r.flags&&(P[0]=255&y,P[1]=y>>>8&255,r.check=a(r.check,P,2,0)),m=y=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===f)break e;f--,y+=l[p++]<>>8&255,r.check=a(r.check,P,2,0)),m=y=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(f<(E=r.length)&&(E=f),E&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,l,p,E,N)),512&r.flags&&(r.check=a(r.check,l,E,p)),f-=E,p+=E,r.length-=E),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===f)break e;for(E=0;N=l[p+E++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N)),N&&E>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===f)break e;f--,y+=l[p++]<>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===f)break e;f--,y+=l[p++]<>>=1)){case 0:r.mode=14;break;case 1:if(v(r),r.mode=20,6!==t)break;y>>>=2,m-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}y>>>=2,m-=2;break;case 14:for(y>>>=7&m,m-=7&m;m<32;){if(0===f)break e;f--,y+=l[p++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&y,m=y=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(E=r.length){if(f>>=5,m-=5,r.ndist=1+(31&y),y>>>=5,m-=5,r.ncode=4+(15&y),y>>>=4,m-=4,286>>=3,m-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,L={bits:r.lenbits},R=o(0,r.lens,0,19,r.lencode,0,r.work,L),r.lenbits=L.bits,R){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,_=65535&O,!((I=O>>>24)<=m);){if(0===f)break e;f--,y+=l[p++]<>>=I,m-=I,r.lens[r.have++]=_;else{if(16===_){for(D=I+2;m>>=I,m-=I,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}N=r.lens[r.have-1],E=3+(3&y),y>>>=2,m-=2}else if(17===_){for(D=I+3;m>>=I)),y>>>=3,m-=3}else{for(D=I+7;m>>=I)),y>>>=7,m-=7}if(r.have+E>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;E--;)r.lens[r.have++]=N}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,L={bits:r.lenbits},R=o(1,r.lens,0,r.nlen,r.lencode,0,r.work,L),r.lenbits=L.bits,R){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,L={bits:r.distbits},R=o(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,L),r.distbits=L.bits,R){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=f&&258<=g){e.next_out=h,e.avail_out=g,e.next_in=p,e.avail_in=f,r.hold=y,r.bits=m,s(e,C),h=e.next_out,d=e.output,g=e.avail_out,p=e.next_in,l=e.input,f=e.avail_in,y=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;A=(O=r.lencode[y&(1<>>16&255,_=65535&O,!((I=O>>>24)<=m);){if(0===f)break e;f--,y+=l[p++]<>x)])>>>16&255,_=65535&O,!(x+(I=O>>>24)<=m);){if(0===f)break e;f--,y+=l[p++]<>>=x,m-=x,r.back+=x}if(y>>>=I,m-=I,r.back+=I,r.length=_,0===A){r.mode=26;break}if(32&A){r.back=-1,r.mode=12;break}if(64&A){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&A,r.mode=22;case 22:if(r.extra){for(D=r.extra;m>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;A=(O=r.distcode[y&(1<>>16&255,_=65535&O,!((I=O>>>24)<=m);){if(0===f)break e;f--,y+=l[p++]<>x)])>>>16&255,_=65535&O,!(x+(I=O>>>24)<=m);){if(0===f)break e;f--,y+=l[p++]<>>=x,m-=x,r.back+=x}if(y>>>=I,m-=I,r.back+=I,64&A){e.msg="invalid distance code",r.mode=30;break}r.offset=_,r.extra=15&A,r.mode=24;case 24:if(r.extra){for(D=r.extra;m>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===g)break e;if(E=C-g,r.offset>E){if((E=r.offset-E)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}S=E>r.wnext?(E-=r.wnext,r.wsize-E):r.wnext-E,E>r.length&&(E=r.length),T=r.window}else T=d,S=h-r.offset,E=r.length;for(gv?(w=U[M+d[T]],L[D+d[T]]):(w=96,0),h=1<>k)+(f-=h)]=b<<24|w<<16|C|0,0!==f;);for(h=1<>=1;if(0!==h?(R&=h-1,R+=h):R=0,T++,0==--O[S]){if(S===A)break;S=t[r+d[T]]}if(_>>7)]}function I(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function A(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function k(e,t,r){var i,n,a=new Array(16),s=0;for(i=1;i<=c;i++)a[i]=s=s+r[i-1]<<1;for(n=0;n<=t;n++){var o=e[2*n+1];0!==o&&(e[2*n]=x(a[o]++,o))}}function B(e){var t;for(t=0;t>1;1<=r;r--)L(e,a,r);for(n=u;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],L(e,a,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,a[2*n]=a[2*r]+a[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,a[2*r+1]=a[2*i+1]=n,e.heap[1]=n++,L(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,a,s,o,u=t.dyn_tree,l=t.max_code,d=t.stat_desc.static_tree,p=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,g=t.stat_desc.max_length,y=0;for(a=0;a<=c;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)g<(a=u[2*u[2*(i=e.heap[r])+1]+1]+1)&&(a=g,y++),u[2*i+1]=a,l>=7;i>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==t?V(e,t,r,i):4===e.strategy||s===n?(A(e,2+(i?1:0),3),D(e,h,f)):(A(e,4+(i?1:0),3),function(e,t,r,i){var n;for(A(e,t-257,5),A(e,r-1,5),A(e,i-4,4),n=0;n>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(y[r]+a+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){A(e,2,3),_(e,256,h),function(e){16===e.bi_valid?(I(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){"use strict";t.exports="function"==typeof i?i:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}},{}]},{},[10])(10)}).call(this,r(6).Buffer,r(16),r(35).setImmediate)},function(e){e.exports=JSON.parse('{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}')},function(e,t,r){"use strict";(function(t){ /*! * Copyright (c) 2018-2019 Digital Bazaar, Inc. All rights reserved. */ const r=void 0!==t&&t.versions&&t.versions.node,i=!r&&("undefined"!=typeof window||"undefined"!=typeof self);e.exports={nodejs:r,browser:i}}).call(this,r(11))},function(e,t,r){var i=r(0);r(1),i.cipher=i.cipher||{};var n=e.exports=i.cipher.modes=i.cipher.modes||{};function a(e,t){if("string"==typeof e&&(e=i.util.createBuffer(e)),i.util.isArray(e)&&e.length>4){var r=e;e=i.util.createBuffer();for(var n=0;n0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=e.length(),i=e.at(r-1);return!(i>this.blockSize<<2)&&(e.truncate(i),!0)},n.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},n.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=e.length(),i=e.at(r-1);return!(i>this.blockSize<<2)&&(e.truncate(i),!0)},n.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.cfb.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.cfb.prototype.decrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ofb.prototype.encrypt=function(e,t,r){var i=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb.prototype.decrypt=n.ofb.prototype.encrypt,n.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ctr.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},n.ctr.prototype.decrypt=n.ctr.prototype.encrypt,n.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0,this._R=3774873600},n.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=i.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?i.util.createBuffer(e.additionalData):i.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=i.util.createBuffer(e.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 n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*n)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=i.util.createBuffer(t),this._aDataLength=o(8*t.length());var a=t.length()%this.blockSize;for(a&&t.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},n.gcm.prototype.encrypt=function(e,t,r){var i=e.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize){for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},n.gcm.prototype.decrypt=function(e,t,r){var i=e.length();if(i0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n0;--i)t[i]=e[i]>>>1|(1&e[i-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},n.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var i=e[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][i];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}return t},n.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},n.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,i=4*r,n=16*r,a=new Array(n),s=0;s>>1,n=new Array(r);n[i]=e.slice(0);for(var a=i>>>1;a>0;)this.pow(n[2*a],n[a]=[]),a>>=1;for(a=2;a>1,o=s+(1&e.length),c=e.substr(0,o),u=e.substr(s,o),l=i.util.createBuffer(),d=i.hmac.create();r=t+r;var p=Math.ceil(n/16),h=Math.ceil(n/20);d.start("MD5",c);var f=i.util.createBuffer();l.putBytes(r);for(var g=0;g0&&(u.queue(e,u.createAlert(e,{level:u.Alert.Level.warning,description:u.Alert.Description.no_renegotiation})),u.flush(e)),e.process()},u.parseHelloMessage=function(e,t,r){var n=null,a=e.entity===u.ConnectionEnd.client;if(r<38)e.error(e,{message:a?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});else{var s=t.fragment,c=s.length();if(n={version:{major:s.getByte(),minor:s.getByte()},random:i.util.createBuffer(s.getBytes(32)),session_id:o(s,1),extensions:[]},a?(n.cipher_suite=s.getBytes(2),n.compression_method=s.getByte()):(n.cipher_suites=o(s,2),n.compression_methods=o(s,1)),(c=r-(c-s.length()))>0){for(var l=o(s,2);l.length()>0;)n.extensions.push({type:[l.getByte(),l.getByte()],data:o(l,2)});if(!a)for(var d=0;d0;){if(0!==h.getByte())break;e.session.extensions.server_name.serverNameList.push(o(h,2).getBytes())}}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});if(a)e.session.cipherSuite=u.getCipherSuite(n.cipher_suite);else for(var f=i.util.createBuffer(n.cipher_suites.bytes());f.length()>0&&(e.session.cipherSuite=u.getCipherSuite(f.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure},cipherSuite:i.util.bytesToHex(n.cipher_suite)});e.session.compressionMethod=a?n.compression_method:u.CompressionMethod.none}return n},u.createSecurityParameters=function(e,t){var r=e.entity===u.ConnectionEnd.client,i=t.random.bytes(),n=r?e.session.sp.client_random:i,a=r?i:u.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:u.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:a}},u.handleServerHello=function(e,t,r){var i=u.parseHelloMessage(e,t,r);if(!e.fail){if(!(i.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});e.version.minor=i.version.minor,e.session.version=e.version;var n=i.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=f,e.session.resuming=!0,e.session.sp.server_random=i.random.bytes()):(e.expect=l,e.session.resuming=!1,u.createSecurityParameters(e,i)),e.session.id=n,e.process()}},u.handleClientHello=function(e,t,r){var n=u.parseHelloMessage(e,t,r);if(!e.fail){var a=n.session_id.bytes(),s=null;if(e.sessionCache&&(null===(s=e.sessionCache.getSession(a))?a="":(s.version.major!==n.version.major||s.version.minor>n.version.minor)&&(s=null,a="")),0===a.length&&(a=i.random.getBytes(32)),e.session.id=a,e.session.clientHelloVersion=n.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var o,c=1;c0;)n=o(c.certificate_list,3),a=i.asn1.fromDer(n),n=i.pki.certificateFromAsn1(a,!0),l.push(n)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var p=e.entity===u.ConnectionEnd.client;!p&&!0!==e.verifyClient||0!==l.length?0===l.length?e.expect=p?d:b:(p?e.session.serverCertificate=l[0]:e.session.clientCertificate=l[0],u.verifyCertificateChain(e,l)&&(e.expect=p?d:b)):e.error(e,{message:p?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}}),e.process()},u.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});e.expect=p,e.process()},u.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});var n=t.fragment,a={enc_pre_master_secret:o(n,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=i.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}});try{var c=e.session.sp;c.pre_master_secret=s.decrypt(a.enc_pre_master_secret);var l=e.session.clientHelloVersion;if(l.major!==c.pre_master_secret.charCodeAt(0)||l.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){c.pre_master_secret=i.random.getBytes(48)}e.expect=C,null!==e.session.clientCertificate&&(e.expect=w),e.process()},u.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var i=t.fragment,n={certificate_types:o(i,1),certificate_authorities:o(i,2)};e.session.certificateRequest=n,e.expect=h,e.process()},u.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var a=n.bytes();n.read+=4;var s={signature:o(n,2).getBytes()},c=i.util.createBuffer();c.putBuffer(e.session.md5.digest()),c.putBuffer(e.session.sha1.digest()),c=c.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(a),e.session.sha1.update(a)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure}})}e.expect=C,e.process()},u.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.insufficient_security}},a=e.verify(e,n.alert.description,0,[]);if(!0!==a)return(a||0===a)&&("object"!=typeof a||i.util.isArray(a)?"number"==typeof a&&(n.alert.description=a):(a.message&&(n.message=a.message),a.alert&&(n.alert.description=a.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificate(e)}),u.queue(e,t)),t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createClientKeyExchange(e)}),u.queue(e,t),e.expect=m;var s=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificateVerify(e,t)})),u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.pending=u.createConnectionState(e),e.state.current.write=e.state.pending.write,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)})),e.expect=f,u.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return s(e,null);u.getClientSignature(e,s)},u.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var r=e.entity===u.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=u.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?g:E,e.process()},u.handleFinished=function(e,t,r){var a=t.fragment;a.read-=4;var s=a.bytes();a.read+=4;var o=t.fragment.getBytes();(a=i.util.createBuffer()).putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest());var c=e.entity===u.ConnectionEnd.client,l=c?"server finished":"client finished",d=e.session.sp;if((a=n(d.master_secret,l,a.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&c||!e.session.resuming&&!c)&&(u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)}))),e.expect=c?y:S,e.handshaking=!1,++e.handshakes,e.peerCertificate=c?e.session.serverCertificate:e.session.clientCertificate,u.flush(e),e.isConnected=!0,e.connected(e),e.process()},u.handleAlert=function(e,t){var r,i=t.fragment,n={level:i.getByte(),description:i.getByte()};switch(n.description){case u.Alert.Description.close_notify:r="Connection closed.";break;case u.Alert.Description.unexpected_message:r="Unexpected message.";break;case u.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case u.Alert.Description.decryption_failed:r="Decryption failed.";break;case u.Alert.Description.record_overflow:r="Record overflow.";break;case u.Alert.Description.decompression_failure:r="Decompression failed.";break;case u.Alert.Description.handshake_failure:r="Handshake failure.";break;case u.Alert.Description.bad_certificate:r="Bad certificate.";break;case u.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case u.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case u.Alert.Description.certificate_expired:r="Certificate expired.";break;case u.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case u.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case u.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case u.Alert.Description.access_denied:r="Access denied.";break;case u.Alert.Description.decode_error:r="Decode error.";break;case u.Alert.Description.decrypt_error:r="Decrypt error.";break;case u.Alert.Description.export_restriction:r="Export restriction.";break;case u.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case u.Alert.Description.insufficient_security:r="Insufficient security.";break;case u.Alert.Description.internal_error:r="Internal error.";break;case u.Alert.Description.user_canceled:r="User canceled.";break;case u.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(n.description===u.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===u.ConnectionEnd.client?"server":"client",alert:n}),e.process()},u.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),a=r.getInt24();if(a>r.length())return e.fragmented=t,t.fragment=i.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(a+4);r.read+=4,n in M[e.entity][e.expect]?(e.entity!==u.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:i.md.md5.create(),sha1:i.md.sha1.create()}),n!==u.HandshakeType.hello_request&&n!==u.HandshakeType.certificate_verify&&n!==u.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),M[e.entity][e.expect][n](e,t,a)):u.handleUnexpected(e,t)},u.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},u.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),a=r.getInt16(),s=r.getBytes(a);if(n===u.HeartbeatMessageType.heartbeat_request){if(e.handshaking||a>s.length)return e.process();u.queue(e,u.createRecord(e,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_response,s)})),u.flush(e)}else if(n===u.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,i.util.createBuffer(s))}e.process()};var l=1,d=2,p=3,h=4,f=5,g=6,y=7,m=8,v=1,b=2,w=3,C=4,E=5,S=6,T=u.handleUnexpected,I=u.handleChangeCipherSpec,A=u.handleAlert,_=u.handleHandshake,x=u.handleApplicationData,k=u.handleHeartbeat,B=[];B[u.ConnectionEnd.client]=[[T,A,_,T,k],[T,A,_,T,k],[T,A,_,T,k],[T,A,_,T,k],[T,A,_,T,k],[I,A,T,T,k],[T,A,_,T,k],[T,A,_,x,k],[T,A,_,T,k]],B[u.ConnectionEnd.server]=[[T,A,_,T,k],[T,A,_,T,k],[T,A,_,T,k],[T,A,_,T,k],[I,A,T,T,k],[T,A,_,T,k],[T,A,_,x,k],[T,A,_,T,k]];var N=u.handleHelloRequest,R=u.handleServerHello,L=u.handleCertificate,D=u.handleServerKeyExchange,O=u.handleCertificateRequest,P=u.handleServerHelloDone,U=u.handleFinished,M=[];M[u.ConnectionEnd.client]=[[T,T,R,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T],[N,T,T,T,T,T,T,T,T,T,T,L,D,O,P,T,T,T,T,T,T],[N,T,T,T,T,T,T,T,T,T,T,T,D,O,P,T,T,T,T,T,T],[N,T,T,T,T,T,T,T,T,T,T,T,T,O,P,T,T,T,T,T,T],[N,T,T,T,T,T,T,T,T,T,T,T,T,T,P,T,T,T,T,T,T],[N,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T],[N,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,U],[N,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T],[N,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T]];var V=u.handleClientHello,K=u.handleClientKeyExchange,j=u.handleCertificateVerify;M[u.ConnectionEnd.server]=[[T,V,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T,T,T,T,L,T,T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,K,T,T,T,T],[T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,j,T,T,T,T,T],[T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,U],[T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T]],u.generateKeys=function(e,t){var r=n,i=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",i,48).bytes(),t.pre_master_secret=null),i=t.server_random+t.client_random;var a=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===u.Versions.TLS_1_0.major&&e.version.minor===u.Versions.TLS_1_0.minor;s&&(a+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",i,a),c={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return s&&(c.client_write_IV=o.getBytes(t.fixed_iv_length),c.server_write_IV=o.getBytes(t.fixed_iv_length)),c},u.createConnectionState=function(e){var t=e.entity===u.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},i={read:r(),write:r()};if(i.read.update=function(e,t){return i.read.cipherFunction(t,i.read)?i.read.compressFunction(e,t,i.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_record_mac}}),!e.fail},i.write.update=function(e,t){return i.write.compressFunction(e,t,i.write)?i.write.cipherFunction(t,i.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}),!e.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=u.generateKeys(e,n),i.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,i.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(i,e,n),n.compression_algorithm){case u.CompressionMethod.none:break;case u.CompressionMethod.deflate:i.read.compressFunction=s,i.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return i},u.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=i.util.createBuffer();return r.putInt32(t),r.putBytes(i.random.getBytes(28)),r},u.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},u.createAlert=function(e,t){var r=i.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),u.createRecord(e,{type:u.ContentType.alert,data:r})},u.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=i.util.createBuffer(),r=0;r0&&(f+=2);var g=e.session.id,y=g.length+1+2+4+28+2+a+1+o+f,m=i.util.createBuffer();return m.putByte(u.HandshakeType.client_hello),m.putInt24(y),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),c(m,1,i.util.createBuffer(g)),c(m,2,t),c(m,1,s),f>0&&c(m,2,l),m},u.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=i.util.createBuffer();return n.putByte(u.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),c(n,1,i.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},u.createCertificate=function(e){var t,r=e.entity===u.ConnectionEnd.client,n=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,n=e.getCertificate(e,t));var a=i.util.createBuffer();if(null!==n)try{i.util.isArray(n)||(n=[n]);for(var s=null,o=0;ou.MaxFragment;)n.push(u.createRecord(e,{type:t.type,data:i.util.createBuffer(a.slice(0,u.MaxFragment))})),a=a.slice(u.MaxFragment);a.length>0&&n.push(u.createRecord(e,{type:t.type,data:i.util.createBuffer(a)}))}for(var s=0;s0&&(n=r.order[0]),null!==n&&n in r.cache)for(var a in t=r.cache[n],delete r.cache[n],r.order)if(r.order[a]===n){r.order.splice(a,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=i.util.bytesToHex(e);r.order.push(n),r.cache[n]=t}}return r},u.createConnection=function(e){var t=null;t=e.caStore?i.util.isArray(e.caStore)?i.pki.createCaStore(e.caStore):e.caStore:i.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var n in r=[],u.CipherSuites)r.push(u.CipherSuites[n]);var a=e.server?u.ConnectionEnd.server:u.ConnectionEnd.client,s=e.sessionCache?u.createSessionCache(e.sessionCache):null,o={version:{major:u.Version.major,minor:u.Version.minor},entity:a,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,i){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:i.util.createBuffer(),tlsData:i.util.createBuffer(),data:i.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===u.ConnectionEnd.client?"client":"server"),r.send&&(u.queue(t,u.createAlert(t,r.alert)),u.flush(t));var i=!1!==r.fatal;i&&(t.fail=!0),e.error(t,r),i&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){o.version={major:u.Version.major,minor:u.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=(o.entity,u.ConnectionEnd.client,0),o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(e||void 0===e),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=u.createConnectionState(o)}};o.reset();return o.handshake=function(e){if(o.entity!==u.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0;var t=null;(e=e||"").length>0&&(o.sessionCache&&(t=o.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&o.sessionCache&&null!==(t=o.sessionCache.getSession())&&(e=t.id),o.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:i.md.md5.create(),sha1:i.md.sha1.create()},t&&(o.version=t.version,o.session.sp=t.sp),o.session.sp.client_random=u.createRandom().getBytes(),o.open=!0,u.queue(o,u.createRecord(o,{type:u.ContentType.handshake,data:u.createClientHello(o)})),u.flush(o)}},o.process=function(e){var t=0;return e&&o.input.putBytes(e),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(t=function(e){var t=0,r=e.input,n=r.length();if(n<5)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:i.util.createBuffer(),ready:!1};var a=e.record.version.major===e.version.major;a&&e.session&&e.session.version&&(a=e.record.version.minor===e.version.minor),a||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}})}return t}(o)),o.fail||null===o.record||o.record.ready||(t=function(e){var t=0,r=e.input,i=r.length();i=0;c--)k>>=8,k+=I.at(c)+x.at(c),x.setAt(c,255&k);_.putBuffer(x)}w=_,d.putBuffer(S)}return d.truncate(d.length()-a),d},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var i=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw i.oid=e,i.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],i}},s.pbe.getCipherForPBES2=function(e,t,r){var n,o={},c=[];if(!a.validate(t,u,o,c))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,n;if((e=a.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=a.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var l,d,h=o.kdfSalt,f=i.util.createBuffer(o.kdfIterationCount);switch(f=f.getInt(f.length()<<3),s.oids[e]){case"aes128-CBC":l=16,d=i.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,d=i.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,d=i.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,d=i.des.createDecryptionCipher;break;case"desCBC":l=8,d=i.des.createDecryptionCipher}var g=p(o.prfOid),y=i.pkcs5.pbkdf2(r,h,f,l,g),m=o.encIv,v=d(y);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},o=[];if(!a.validate(t,l,n,o))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,g;var c,u,d,h=i.util.createBuffer(n.salt),f=i.util.createBuffer(n.iterations);switch(f=f.getInt(f.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,d=i.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,d=function(e,t){var r=i.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,g}var y=p(n.prfOid),m=s.pbe.generatePkcs12Key(r,h,1,f,c,y);return y.start(),d(m,s.pbe.generatePkcs12Key(r,h,2,f,u,y))},s.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in i.md))throw new Error('"md5" hash algorithm unavailable.');n=i.md.md5.create()}null===t&&(t="");for(var a=[d(n,e+t)],s=16,o=1;s=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,i=0;i<32;++i)t.reseeds%r==0&&(e.update(t.pools[i].digest().getBytes()),t.pools[i].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var n=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(n),t.generated=0}function u(e){var t=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var a=i.util.createBuffer();if(t)for(;a.length()>16)))<<16,p=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)d=p>>>(c<<3),d^=Math.floor(256*Math.random()),a.putByte(String.fromCharCode(255&d))}return a.getBytes(e)}return t.pools=a,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,a=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed,u=i.util.createBuffer();t.key=null,function l(d){if(d)return r(d);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return i.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,i){if(r)return e(r);t.collect(i),c(),e()}))}(l)}));var p=n(t.key,t.seed);t.generated+=p.length,u.putBytes(p),t.key=s(n(t.key,a(t.seed))),t.seed=o(n(t.key,t.seed)),i.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,a=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=i.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&o();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=a(r(t.key,n(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},n?(t.seedFile=function(e,t){n.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return n.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,i=0;i>n&255);t.collect(i)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var i=r.data;i.forge&&i.forge.prng&&(self.removeEventListener("message",e),t(i.forge.prng.err,i.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var i=r.data;i.forge&&i.forge.prng&&t.seedFile(i.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}}).call(this,r(11))},function(e,t,r){var i=r(0);r(1);var n=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],a=[1,2,3,5],s=function(e,t){return e<>16-t},o=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=i.rc2=i.rc2||{},i.rc2.expandKey=function(e,t){"string"==typeof e&&(e=i.util.createBuffer(e)),t=t||128;var r,a=e,s=e.length(),o=t,c=Math.ceil(o/8),u=255>>(7&o);for(r=s;r<128;r++)a.putByte(n[a.at(r-1)+a.at(r-s)&255]);for(a.setAt(128-c,n[a.at(128-c)&u]),r=127-c;r>=0;r--)a.setAt(r,n[a.at(r+1)^a.at(r+c)]);return a};var c=function(e,t,r){var n,c,u,l,d=!1,p=null,h=null,f=null,g=[];for(e=i.rc2.expandKey(e,t),u=0;u<64;u++)g.push(e.getInt16Le());r?(n=function(e){for(u=0;u<4;u++)e[u]+=g[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=s(e[u],a[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=g[63&e[(u+3)%4]]}):(n=function(e){for(u=3;u>=0;u--)e[u]=o(e[u],a[u]),e[u]-=g[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=g[63&e[(u+3)%4]]});var y=function(e){var t=[];for(u=0;u<4;u++){var i=p.getInt16Le();null!==f&&(r?i^=f.getInt16Le():f.putInt16Le(i)),t.push(65535&i)}l=r?0:63;for(var n=0;n=8;)y([[5,n],[1,c],[6,n],[1,c],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,p,!r);else{var i=8===p.length()?8:8-p.length();p.fillWithByte(i,i)}if(t&&(d=!0,m.update()),!r&&(t=0===p.length()))if(e)t=e(8,h,!r);else{var n=h.length(),a=h.at(n-1);a>n?t=!1:h.truncate(a)}return t}}};i.rc2.startEncrypting=function(e,t,r){var n=i.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},i.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},i.rc2.startDecrypting=function(e,t,r){var n=i.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},i.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},function(e,t,r){var i=r(0);r(1),r(3),r(18);var n=e.exports=i.pkcs1=i.pkcs1||{};function a(e,t,r){r||(r=i.md.sha1.create());for(var n="",a=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+o),n+=r.digest().getBytes()}return n.substring(0,t)}n.encode_rsa_oaep=function(e,t,r){var n,s,o,c;"string"==typeof r?(n=r,s=arguments[3]||void 0,o=arguments[4]||void 0):r&&(n=r.label||void 0,s=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),o?o.start():o=i.md.sha1.create(),c||(c=o);var u=Math.ceil(e.n.bitLength()/8),l=u-2*o.digestLength-2;if(t.length>l)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=t.length,y.maxLength=l,y;n||(n=""),o.update(n,"raw");for(var d=o.digest(),p="",h=l-t.length,f=0;fe&&(s=c(e,t));var h=s.toString(16);n.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(d,0)}}}h()}(e,t,n,a);return o(e,t,n,a)}(e,u,a.options,n);throw new Error("Invalid prime generation algorithm: "+a.name)}}function o(e,t,r,a){var s=c(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(s.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),function e(t,r,a,s,o,u,l){var d=+new Date;do{if(t.bitLength()>r&&(t=c(r,a)),t.isProbablePrime(o))return l(null,t);t.dAddOffset(n[s++%8],0)}while(u<0||+new Date-d=0&&n.push(o):n.push(o))}return n}function h(e){if(e.composed||e.constructed){for(var t=i.util.createBuffer(),r=0;r0&&(c=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,d));var p=[],h=[];null!==t&&(h=i.util.isArray(t)?t:[t]);for(var f=[],g=0;g0){var b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,f),w=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(b).getBytes())])]);p.push(w)}var C=null;if(null!==e){var E=a.wrapRsaPrivateKey(a.privateKeyToAsn1(e));C=null===r?n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.keyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[E]),c]):n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(E,r,o)]),c]);var S=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[C]),T=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(S).getBytes())])]);p.push(T)}var I,A=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,p);if(o.useMac){var _=i.md.sha1.create(),x=new i.util.ByteBuffer(i.random.getBytes(o.saltSize)),k=o.count,B=(e=s.generateKey(r,x,3,k,20),i.hmac.create());B.start(_,e),B.update(n.toDer(A).getBytes());var N=B.getMac();I=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.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.sha1).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,N.getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,x.getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(k).getBytes())])}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(3).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(A).getBytes())])]),I])},s.generateKey=i.pbe.generatePkcs12Key},function(e,t,r){var i=r(0);r(7),r(1);var n=i.asn1,a=e.exports=i.pkcs7asn1=i.pkcs7asn1||{};i.pkcs7=i.pkcs7||{},i.pkcs7.asn1=a;var s={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=s;var o={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},a.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var c={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var i=r(0);r(1),i.mgf=i.mgf||{},(e.exports=i.mgf.mgf1=i.mgf1=i.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new i.util.ByteBuffer,a=Math.ceil(r/e.digestLength),s=0;s>>0,s>>>0];for(var o=h.fullMessageLength.length-1;o>=0;--o)h.fullMessageLength[o]+=s[1],s[1]=s[0]+(h.fullMessageLength[o]/4294967296>>>0),h.fullMessageLength[o]=h.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return n.putBytes(e),l(r,a,n),(n.read>2048||0===n.length())&&n.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(n.bytes());var o,c=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var u=8*h.fullMessageLength[0],d=0;d>>0,t.putInt32(u>>>0),u=o>>>0;t.putInt32(u);var p=new Array(r.length);for(d=0;d=128;){for(B=0;B<16;++B)t[B][0]=r.getInt32()>>>0,t[B][1]=r.getInt32()>>>0;for(;B<80;++B)i=(((N=(L=t[B-2])[0])>>>19|(R=L[1])<<13)^(R>>>29|N<<3)^N>>>6)>>>0,n=((N<<13|R>>>19)^(R<<3|N>>>29)^(N<<26|R>>>6))>>>0,a=(((N=(O=t[B-15])[0])>>>1|(R=O[1])<<31)^(N>>>8|R<<24)^N>>>7)>>>0,s=((N<<31|R>>>1)^(N<<24|R>>>8)^(N<<25|R>>>7))>>>0,D=t[B-7],P=t[B-16],R=n+D[1]+s+P[1],t[B][0]=i+D[0]+a+P[0]+(R/4294967296>>>0)>>>0,t[B][1]=R>>>0;for(f=e[0][0],g=e[0][1],y=e[1][0],m=e[1][1],v=e[2][0],b=e[2][1],w=e[3][0],C=e[3][1],E=e[4][0],S=e[4][1],T=e[5][0],I=e[5][1],A=e[6][0],_=e[6][1],x=e[7][0],k=e[7][1],B=0;B<80;++B)l=((E>>>14|S<<18)^(E>>>18|S<<14)^(S>>>9|E<<23))>>>0,d=(A^E&(T^A))>>>0,o=((f>>>28|g<<4)^(g>>>2|f<<30)^(g>>>7|f<<25))>>>0,u=((f<<4|g>>>28)^(g<<30|f>>>2)^(g<<25|f>>>7))>>>0,p=(f&y|v&(f^y))>>>0,h=(g&m|b&(g^m))>>>0,R=k+(((E<<18|S>>>14)^(E<<14|S>>>18)^(S<<23|E>>>9))>>>0)+((_^S&(I^_))>>>0)+c[B][1]+t[B][1],i=x+l+d+c[B][0]+t[B][0]+(R/4294967296>>>0)>>>0,n=R>>>0,a=o+p+((R=u+h)/4294967296>>>0)>>>0,s=R>>>0,x=A,k=_,A=T,_=I,T=E,I=S,E=w+i+((R=C+n)/4294967296>>>0)>>>0,S=R>>>0,w=v,C=b,v=y,b=m,y=f,m=g,f=i+a+((R=n+s)/4294967296>>>0)>>>0,g=R>>>0;R=e[0][1]+g,e[0][0]=e[0][0]+f+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+m,e[1][0]=e[1][0]+y+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+b,e[2][0]=e[2][0]+v+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+C,e[3][0]=e[3][0]+w+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+S,e[4][0]=e[4][0]+E+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+I,e[5][0]=e[5][0]+T+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+_,e[6][0]=e[6][0]+A+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+k,e[7][0]=e[7][0]+x+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,U-=128}}},function(e,t,r){var i=r(0);r(1),e.exports=i.log=i.log||{},i.log.levels=["none","error","warning","info","debug","verbose","max"];var n={},a=[],s=null;i.log.LEVEL_LOCKED=2,i.log.NO_LEVEL_CHECK=4,i.log.INTERPOLATE=8;for(var o=0;o{r.forEach(e,(e,t,i)=>{r.forEachComponent(e,t=>{if("BlankNode"!==t.termType)return;const i=t.value;i in r.blankNodeInfo?r.blankNodeInfo[i].quads.push(e):(a[i]=!0,r.blankNodeInfo[i]={quads:[e]})}),i()},t)},e=>{let t=!0;r.whilst(()=>t,e=>{t=!1,r.hashToBlankNodes={},r.waterfall([e=>{r.forEach(a,(e,t,i)=>{r.hashFirstDegreeQuads(t,(e,n)=>{if(e)return i(e);n in r.hashToBlankNodes?r.hashToBlankNodes[n].push(t):r.hashToBlankNodes[n]=[t],i()})},e)},e=>{const i=Object.keys(r.hashToBlankNodes).sort();r.forEach(i,(e,i,n)=>{const s=r.hashToBlankNodes[e];if(s.length>1)return n();const o=s[0];r.canonicalIssuer.getId(o),delete a[o],delete r.hashToBlankNodes[e],t=!0,n()},e)}],e)},e)},e=>{const t=Object.keys(r.hashToBlankNodes).sort();r.forEach(t,(e,t,i)=>{const a=[],s=r.hashToBlankNodes[e];r.waterfall([e=>{r.forEach(s,(e,t,i)=>{if(r.canonicalIssuer.hasId(e))return i();const s=new n("_:b");s.getId(e),r.hashNDegreeQuads(e,s,(e,t)=>{if(e)return i(e);a.push(t),i()})},e)},e=>{a.sort((e,t)=>e.hasht.hash?1:0),r.forEach(a,(e,t,i)=>{for(const t in e.issuer.existing)r.canonicalIssuer.getId(t);i()},e)}],i)},e)},e=>{const t=[];r.waterfall([e=>{r.forEach(r.quads,(e,i,n)=>{r.forEachComponent(e,e=>{"BlankNode"!==e.termType||e.value.startsWith(r.canonicalIssuer.prefix)||(e.value=r.canonicalIssuer.getId(e.value))}),t.push(o.serializeQuad(e)),n()},e)},e=>(t.sort(),i=t.join(""),e())],e)}],e=>t(e,i))}hashFirstDegreeQuads(e,t){const r=this,i=r.blankNodeInfo[e];if("hash"in i)return t(null,i.hash);const n=[],s=i.quads;r.forEach(s,(t,i,a)=>{const s={predicate:t.predicate};r.forEachComponent(t,(t,i)=>{s[i]=r.modifyFirstDegreeComponent(e,t,i)}),n.push(o.serializeQuad(s)),a()},e=>{if(e)return t(e);n.sort();const s=new a(r.hashAlgorithm);for(let e=0;es.canonicalIssuer.hasId(e)?(o=s.canonicalIssuer.getId(e),t()):r.hasId(e)?(o=r.getId(e),t()):void s.hashFirstDegreeQuads(e,(e,r)=>{if(e)return t(e);o=r,t()})],e=>{if(e)return n(e);const r=new a(s.hashAlgorithm);return r.update(i),"g"!==i&&r.update(s.getRelatedPredicate(t)),r.update(o),n(null,r.digest())})}hashNDegreeQuads(e,t,r){const i=this;let n;const o=new a(i.hashAlgorithm);i.waterfall([r=>i.createHashToRelated(e,t,(e,t)=>{if(e)return r(e);n=t,r()}),e=>{const r=Object.keys(n).sort();i.forEach(r,(e,r,a)=>{o.update(e);let c,u="";const l=new s(n[e]);i.whilst(()=>l.hasNext(),e=>{const r=l.next();let n=t.clone(),a="";const s=[];i.waterfall([t=>{i.forEach(r,(t,r,o)=>{if(i.canonicalIssuer.hasId(t)?a+=i.canonicalIssuer.getId(t):(n.hasId(t)||s.push(t),a+=n.getId(t)),0!==u.length&&a>u)return e();o()},t)},t=>{i.forEach(s,(t,r,s)=>{i.hashNDegreeQuads(t,n,(r,i)=>r?s(r):(a+=n.getId(t),a+="<"+i.hash+">",n=i.issuer,0!==u.length&&a>u?e():void s()))},t)},e=>{(0===u.length||a{if(e)return a(e);o.update(u),t=c,a()})},e)}],e=>{r(e,{hash:o.digest(),issuer:t})})}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType||((t=c.clone(t)).value=t.value===e?"_:a":"_:z"),t}getRelatedPredicate(e){return"<"+e.predicate.value+">"}createHashToRelated(e,t,r){const i=this,n={},a=i.blankNodeInfo[e].quads;i.forEach(a,(r,a,s)=>{i.forEach(r,(a,s,o)=>{if("predicate"===s||"BlankNode"!==a.termType||a.value===e)return o();const c=a.value,l=u[s];i.hashRelatedBlankNode(c,r,t,l,(e,t)=>{if(e)return o(e);t in n?n[t].push(c):n[t]=[c],o()})},s)},e=>r(e,n))}forEachComponent(e,t){for(const r in e)"predicate"!==r&&t(e[r],r,e)}}},function(e,t,r){"use strict";const i=r(0);r(8),r(18),r(39),e.exports=class{constructor(e){this.md=i.md[e].create()}update(e){this.md.update(e,"utf8")}digest(){return this.md.digest().toHex()}}},function(e,t,r){"use strict";e.exports=class{constructor(e){this.list=e.sort(),this.done=!1,this.left={};for(let t=0;tt)&&(a&&e>0&&n>this.list[e-1]||!a&&ethis.list[e+1])&&(t=n,r=e)}if(null===t)this.done=!0;else{const e=this.left[t]?r-1:r+1;this.list[r]=this.list[e],this.list[e]=t;for(let e=0;et&&(this.left[this.list[e]]=!this.left[this.list[e]])}return e}}},function(e,t,r){"use strict";const i=r(47),n=r(73),a=r(74),s=r(48),o=r(14),c={subject:"s",object:"o",graph:"g"};e.exports=class{constructor(){this.name="URDNA2015",this.blankNodeInfo={},this.hashToBlankNodes={},this.canonicalIssuer=new i("_:c14n"),this.hashAlgorithm="sha256",this.quads}main(e){const t=this;t.quads=e;const r={};for(const i of e)t.forEachComponent(i,e=>{if("BlankNode"!==e.termType)return;const n=e.value;n in t.blankNodeInfo?t.blankNodeInfo[n].quads.push(i):(r[n]=!0,t.blankNodeInfo[n]={quads:[i]})});let n=!0;for(;n;){n=!1,t.hashToBlankNodes={};for(const e in r){const r=t.hashFirstDegreeQuads(e);r in t.hashToBlankNodes?t.hashToBlankNodes[r].push(e):t.hashToBlankNodes[r]=[e]}const e=Object.keys(t.hashToBlankNodes).sort();for(let i=0;i1)continue;const o=s[0];t.canonicalIssuer.getId(o),delete r[o],delete t.hashToBlankNodes[a],n=!0}}const a=Object.keys(t.hashToBlankNodes).sort();for(let e=0;ee.hasht.hash?1:0);for(let e=0;e{"BlankNode"!==e.termType||e.value.startsWith(t.canonicalIssuer.prefix)||(e.value=t.canonicalIssuer.getId(e.value))}),o.push(s.serializeQuad(r))}return o.sort(),o.join("")}hashFirstDegreeQuads(e){const t=this,r=t.blankNodeInfo[e];if("hash"in r)return r.hash;const i=[],a=r.quads;for(let r=0;r{o[i]=t.modifyFirstDegreeComponent(e,r,i)}),i.push(s.serializeQuad(o))}i.sort();const o=new n(t.hashAlgorithm);for(let e=0;eu){s=!0;break}}if(!s){for(let e=0;e",i=o.issuer,0!==u.length&&n>u){s=!0;break}}s||(0===u.length||n"}createHashToRelated(e,t){const r=this,i={},n=r.blankNodeInfo[e].quads;for(let a=0;a1;const g=(e,t,r)=>{const i=e[p].get(t);if(i){const t=i.value;if(y(e,t)){if(v(e,i),!e[o])return}else r&&(e[h]&&(i.value.now=Date.now()),e[d].unshiftNode(i));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},m=e=>{if(e[a]>e[n])for(let t=e[d].tail;e[a]>e[n]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[a]-=r.length,e[p].delete(r.key),e[d].removeNode(t)}};class b{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const w=(e,t,r,i)=>{let n=r.value;y(e,n)&&(v(e,r),e[o]||(n=void 0)),n&&t.call(i,n.value,n.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[n]=e.max||1/0;const t=e.length||f;if(this[s]="function"!=typeof t?f:t,this[o]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[n]=e||1/0,m(this)}get max(){return this[n]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,m(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[s]&&(this[s]=e,this[a]=0,this[d].forEach(e=>{e.length=this[s](e.value,e.key),this[a]+=e.length})),m(this)}get lengthCalculator(){return this[s]}get length(){return this[a]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let r=this[d].tail;null!==r;){const i=r.prev;w(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[d].head;null!==r;){const i=r.next;w(this,e,r,t),r=i}}keys(){return this[d].toArray().map(e=>e.key)}values(){return this[d].toArray().map(e=>e.value)}reset(){this[u]&&this[d]&&this[d].length&&this[d].forEach(e=>this[u](e.key,e.value)),this[p]=new Map,this[d]=new i,this[a]=0}dump(){return this[d].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[d]}set(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const i=r?Date.now():0,o=this[s](t,e);if(this[p].has(e)){if(o>this[n])return v(this,this[p].get(e)),!1;const s=this[p].get(e).value;return this[u]&&(this[l]||this[u](e,s.value)),s.now=i,s.maxAge=r,s.value=t,this[a]+=o-s.length,s.length=o,this.get(e),m(this),!0}const h=new b(e,t,o,i,r);return h.length>this[n]?(this[u]&&this[u](e,t),!1):(this[a]+=h.length,this[d].unshift(h),this[p].set(e,this[d].head),m(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[d].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[p].forEach((e,t)=>g(this,t,!1))}}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i=r(131),n={};e.exports=n,n.extendContextLoader=e=>async t=>{const r=i[t];return void 0!==r?{contextUrl:null,documentUrl:t,document:r}:e(t)},n.strictDocumentLoader=n.extendContextLoader(e=>{throw new Error(e+" not found.")})},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i=r(33);e.exports=class extends i{constructor({controller:e,date:t,maxTimestampDelta:r=1/0}={}){super({term:"publicKey",controller:e,date:t,maxTimestampDelta:r})}async update(e){return e}async match(e){return void 0===e.proofPurpose}}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */e.exports=class{constructor({term:e,date:t,maxTimestampDelta:r=1/0}={}){if(void 0===e)throw new Error('"term" is required.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxTimestampDelta" must be a number.');if(this.term=e,void 0!==t&&(this.date=new Date(t),isNaN(this.date)))throw TypeError(`"date" "${t}" is not a valid date.`);this.maxTimestampDelta=r}async validate(e,{document:t,suite:r,verificationMethod:i,documentLoader:n,expansionMap:a}){try{if(this.maxTimestampDelta!==1/0){const t=(this.date||new Date).getTime(),r=1e3*this.maxTimestampDelta,i=new Date(e.created).getTime();if(!(i>=t-r&&i<=t+r))throw new Error("The proof's created timestamp is out of range.")}return{valid:!0}}catch(e){return{valid:!1,error:e}}}async update(e,{document:t,suite:r,documentLoader:i,expansionMap:n}){return e.proofPurpose=this.term,e}async match(e,{document:t,documentLoader:r,expansionMap:i}){return e.proofPurpose===this.term}}},function(e,t,r){"use strict"; /*! * Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved. */const i=r(27),n=r(21),a=r(81),s=r(82);e.exports=class extends s{constructor({type:e,creator:t,verificationMethod:r,proof:i,date:n,useNativeCanonize:a}={}){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"verificationMethod" must be a URL string.');if(super({type:e}),this.creator=t,this.verificationMethod=r,this.proof=i,void 0!==n&&(this.date=new Date(n),isNaN(this.date)))throw TypeError(`"date" "${n}" is not a valid date.`);this.useNativeCanonize=a}async createProof({document:e,purpose:t,documentLoader:r,expansionMap:s,compactProof:o}){let c;c=this.proof?await n.compact(this.proof,i.SECURITY_CONTEXT_URL,{documentLoader:r,expansionMap:s,compactToRelative:!1}):{"@context":i.SECURITY_CONTEXT_URL},c.type=this.type;let u=this.date;void 0===c.created&&void 0===u&&(u=new Date),void 0!==u&&"string"!=typeof u&&(u=a.w3cDate(u)),void 0!==u&&(c.created=u),void 0!==this.verificationMethod&&(c.verificationMethod=this.verificationMethod),void 0!==this.creator&&(c.creator=this.creator),c=await this.updateProof({document:e,proof:c,purpose:t,documentLoader:r,expansionMap:s,compactProof:o}),c=await t.update(c,{document:e,suite:this,documentLoader:r,expansionMap:s});const l=await this.createVerifyData({document:e,proof:c,documentLoader:r,expansionMap:s,compactProof:o});return c=await this.sign({verifyData:l,document:e,proof:c,documentLoader:r,expansionMap:s}),c}async updateProof({proof:e}){return e}async verifyProof({proof:e,document:t,purpose:r,documentLoader:i,expansionMap:n,compactProof:a}){try{const s=await this.createVerifyData({document:t,proof:e,documentLoader:i,expansionMap:n,compactProof:a}),o=await this.getVerificationMethod({proof:e,document:t,documentLoader:i,expansionMap:n});if(!await this.verifySignature({verifyData:s,verificationMethod:o,document:t,proof:e,documentLoader:i,expansionMap:n}))throw new Error("Invalid signature.");const c=await r.validate(e,{document:t,suite:this,verificationMethod:o,documentLoader:i,expansionMap:n});if(!c.valid)throw c.error;return{verified:!0,purposeResult:c}}catch(e){return{verified:!1,error:e}}}async canonize(e,{documentLoader:t,expansionMap:r,skipExpansion:i}){return n.canonize(e,{algorithm:"URDNA2015",format:"application/n-quads",documentLoader:t,expansionMap:r,skipExpansion:i,useNative:this.useNativeCanonize})}async canonizeProof(e,{documentLoader:t,expansionMap:r}){return delete(e={...e}).jws,delete e.signatureValue,delete e.proofValue,this.canonize(e,{documentLoader:t,expansionMap:r,skipExpansion:!1})}async createVerifyData({document:e,proof:t,documentLoader:r,expansionMap:i}){const n=await this.canonizeProof(t,{documentLoader:r,expansionMap:i}),s=await this.canonize(e,{documentLoader:r,expansionMap:i});return a.concat(a.sha256(n),a.sha256(s))}async getVerificationMethod({proof:e,documentLoader:t}){let{verificationMethod:r}=e;if(!r){const{creator:t}=e;r=t}if("object"==typeof r&&(r=r.id),!r)throw new Error('No "verificationMethod" or "creator" found in proof.');const{"@graph":[a]}=await n.frame(r,{"@context":i.SECURITY_CONTEXT_URL,"@embed":"@always",id:r},{documentLoader:t,compactToRelative:!1});if(!a)throw new Error(`Verification method ${r} not found.`);if(void 0!==a.revoked)throw new Error("The verification method has been revoked.");return a}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(e,t,r){"use strict";(function(t){const i=r(137),n=r(23),a={};e.exports=a,a.createJws=function(){if(i.nodejs)return({encodedHeader:e,verifyData:r})=>{const i=t.concat([t.from(e+".","utf8"),t.from(r.buffer,r.byteOffset,r.length)]);return new Uint8Array(i.buffer,i.byteOffset,i.length)};return({encodedHeader:e,verifyData:t})=>{const r=new n.util.ByteBuffer(e+".","utf8"),i=n.util.binary.raw.encode(t);return r.putBytes(i),n.util.binary.raw.decode(r.getBytes())}}(),a.w3cDate=e=>{null==e?e=new Date:"number"!=typeof e&&"string"!=typeof e||(e=new Date(e));const t=e.toISOString();return t.substr(0,t.length-5)+"Z"},a.encodeBase64Url=function(){if(i.nodejs){const e=r(51);return r=>e("string"==typeof r?r:t.from(r.buffer,r.byteOffset,r.length))}return e=>{let t;t="string"==typeof e?n.util.encodeUtf8(e):n.util.binary.raw.encode(e);return n.util.encode64(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}(),a.decodeBase64Url=function(){if(i.nodejs){const e=r(51);return t=>{const r=e.toBuffer(t);return new Uint8Array(r.buffer,r.offset,r.length)}}return e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=t.length%4;if(0===r);else if(2===r)t+="==";else{if(3!==r)throw new Error("Illegal base64 string.");t+="="}return n.util.binary.base64.decode(t)}}(),a.decodeBase64UrlToString=function(){if(i.nodejs){const e=r(51);return t=>e.decode(t)}return e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=t.length%4;if(0===r);else if(2===r)t+="==";else{if(3!==r)throw new Error("Illegal base64 string.");t+="="}const i=n.util.decode64(t);return n.util.decodeUtf8(i)}}(),a.sha256=function(){if(i.nodejs){const e=r(138);return(t,r)=>{const i=e.createHash("sha256");i.update(t,r);const n=i.digest();return new Uint8Array(n.buffer,n.byteOffset,n.length)}}return(e,t)=>{const r=n.md.sha256.create();r.update(e,t||"utf8");const i=r.digest();return n.util.binary.raw.decode(i.getBytes())}}(),a.concat=function(){if(i.nodejs)return(e,r)=>{const i=t.concat([t.from(e.buffer,e.byteOffset,e.length),t.from(r.buffer,r.byteOffset,r.length)]);return new Uint8Array(i.buffer,i.byteOffset,i.length)};return(e,t)=>{const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}}(),a.stringToBytes=function(){if(i.nodejs)return(e,r)=>{const i=t.from(e,r);return new Uint8Array(i.buffer,i.byteOffset,i.length)};return(e,t)=>{const r=new n.util.ByteBuffer(e,t);return n.util.binary.raw.decode(r.getBytes())}}()}).call(this,r(6).Buffer)},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */e.exports=class{constructor({type:e}={}){if("string"!=typeof e)throw new TypeError('A LinkedDataProof must have a "type".');this.type=e}async createProof({document:e,purpose:t,documentLoader:r,expansionMap:i,compactProof:n}){throw new Error('"createProof" must be implemented in a derived class.')}async verifyProof({proof:e,document:t,purpose:r,documentLoader:i,expansionMap:n}){throw new Error('"verifyProof" must be implemented in a derived class.')}async matchProof({proof:e,document:t,purpose:r,documentLoader:i,expansionMap:n}){return e.type===this.type}}},function(e){e.exports=JSON.parse('{"@context":[{"@version":1.1,"id":"@id","type":"@type","@protected":true,"JsonWebKey2020":{"@id":"https://w3id.org/security#JsonWebKey2020"},"JsonWebSignature2020":{"@id":"https://w3id.org/security#JsonWebSignature2020","@context":{"@version":1.1,"id":"@id","type":"@type","@protected":true,"challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"jws":"https://w3id.org/security#jws","nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"Ed25519VerificationKey2020":{"@id":"https://w3id.org/security#Ed25519VerificationKey2020"},"Ed25519Signature2020":{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":true,"id":"@id","type":"@type","challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},"verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"publicKeyJwk":{"@id":"https://w3id.org/security#publicKeyJwk","@type":"@json"},"ethereumAddress":{"@id":"https://w3id.org/security#ethereumAddress"},"publicKeyHex":{"@id":"https://w3id.org/security#publicKeyHex"},"blockchainAccountId":{"@id":"https://w3id.org/security#blockchainAccountId"},"MerkleProof2019":{"@id":"https://w3id.org/security#MerkleProof2019"},"Bls12381G1Key2020":{"@id":"https://w3id.org/security#Bls12381G1Key2020"},"Bls12381G2Key2020":{"@id":"https://w3id.org/security#Bls12381G2Key2020"},"BbsBlsSignature2020":{"@id":"https://w3id.org/security#BbsBlsSignature2020","@context":{"@protected":true,"id":"@id","type":"@type","challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":"https://w3id.org/security#proofValue","verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"BbsBlsSignatureProof2020":{"@id":"https://w3id.org/security#BbsBlsSignatureProof2020","@context":{"@protected":true,"id":"@id","type":"@type","challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":"https://w3id.org/security#proofValue","verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"EcdsaKoblitzSignature2016":"https://w3id.org/security#EcdsaKoblitzSignature2016","Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@protected":true,"id":"@id","type":"@type","challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"jws":"https://w3id.org/security#jws","nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":"https://w3id.org/security#proofValue","verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"EncryptedMessage":"https://w3id.org/security#EncryptedMessage","GraphSignature2012":"https://w3id.org/security#GraphSignature2012","LinkedDataSignature2015":"https://w3id.org/security#LinkedDataSignature2015","LinkedDataSignature2016":"https://w3id.org/security#LinkedDataSignature2016","CryptographicKey":"https://w3id.org/security#Key","authenticationTag":"https://w3id.org/security#authenticationTag","canonicalizationAlgorithm":"https://w3id.org/security#canonicalizationAlgorithm","cipherAlgorithm":"https://w3id.org/security#cipherAlgorithm","cipherData":"https://w3id.org/security#cipherData","cipherKey":"https://w3id.org/security#cipherKey","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"creator":{"@id":"http://purl.org/dc/terms/creator","@type":"@id"},"digestAlgorithm":"https://w3id.org/security#digestAlgorithm","digestValue":"https://w3id.org/security#digestValue","domain":"https://w3id.org/security#domain","encryptionKey":"https://w3id.org/security#encryptionKey","expiration":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"initializationVector":"https://w3id.org/security#initializationVector","iterationCount":"https://w3id.org/security#iterationCount","nonce":"https://w3id.org/security#nonce","normalizationAlgorithm":"https://w3id.org/security#normalizationAlgorithm","owner":"https://w3id.org/security#owner","password":"https://w3id.org/security#password","privateKey":"https://w3id.org/security#privateKey","privateKeyPem":"https://w3id.org/security#privateKeyPem","publicKey":"https://w3id.org/security#publicKey","publicKeyBase58":"https://w3id.org/security#publicKeyBase58","publicKeyPem":"https://w3id.org/security#publicKeyPem","publicKeyWif":"https://w3id.org/security#publicKeyWif","publicKeyService":"https://w3id.org/security#publicKeyService","revoked":{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"salt":"https://w3id.org/security#salt","signature":"https://w3id.org/security#signature","signatureAlgorithm":"https://w3id.org/security#signingAlgorithm","signatureValue":"https://w3id.org/security#signatureValue","proofValue":"https://w3id.org/security#proofValue","AesKeyWrappingKey2019":"https://w3id.org/security#AesKeyWrappingKey2019","DeleteKeyOperation":"https://w3id.org/security#DeleteKeyOperation","DeriveSecretOperation":"https://w3id.org/security#DeriveSecretOperation","EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@protected":true,"id":"@id","type":"@type","challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"jws":"https://w3id.org/security#jws","nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":"https://w3id.org/security#proofValue","verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@protected":true,"id":"@id","type":"@type","challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"jws":"https://w3id.org/security#jws","nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":"https://w3id.org/security#proofValue","verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"EcdsaSecp256k1VerificationKey2019":"https://w3id.org/security#EcdsaSecp256k1VerificationKey2019","EcdsaSecp256r1VerificationKey2019":"https://w3id.org/security#EcdsaSecp256r1VerificationKey2019","Ed25519VerificationKey2018":"https://w3id.org/security#Ed25519VerificationKey2018","EquihashProof2018":"https://w3id.org/security#EquihashProof2018","ExportKeyOperation":"https://w3id.org/security#ExportKeyOperation","GenerateKeyOperation":"https://w3id.org/security#GenerateKeyOperation","KmsOperation":"https://w3id.org/security#KmsOperation","RevokeKeyOperation":"https://w3id.org/security#RevokeKeyOperation","RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@protected":true,"challenge":"https://w3id.org/security#challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"domain":"https://w3id.org/security#domain","expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"jws":"https://w3id.org/security#jws","nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":"https://w3id.org/security#proofValue","verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"RsaVerificationKey2018":"https://w3id.org/security#RsaVerificationKey2018","Sha256HmacKey2019":"https://w3id.org/security#Sha256HmacKey2019","SignOperation":"https://w3id.org/security#SignOperation","UnwrapKeyOperation":"https://w3id.org/security#UnwrapKeyOperation","VerifyOperation":"https://w3id.org/security#VerifyOperation","WrapKeyOperation":"https://w3id.org/security#WrapKeyOperation","X25519KeyAgreementKey2019":"https://w3id.org/security#X25519KeyAgreementKey2019","allowedAction":"https://w3id.org/security#allowedAction","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capability":{"@id":"https://w3id.org/security#capability","@type":"@id"},"capabilityAction":"https://w3id.org/security#capabilityAction","capabilityChain":{"@id":"https://w3id.org/security#capabilityChain","@type":"@id","@container":"@list"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"caveat":{"@id":"https://w3id.org/security#caveat","@type":"@id","@container":"@set"},"challenge":"https://w3id.org/security#challenge","ciphertext":"https://w3id.org/security#ciphertext","controller":{"@id":"https://w3id.org/security#controller","@type":"@id"},"delegator":{"@id":"https://w3id.org/security#delegator","@type":"@id"},"equihashParameterK":{"@id":"https://w3id.org/security#equihashParameterK","@type":"http://www.w3.org/2001/XMLSchema#:integer"},"equihashParameterN":{"@id":"https://w3id.org/security#equihashParameterN","@type":"http://www.w3.org/2001/XMLSchema#:integer"},"invocationTarget":{"@id":"https://w3id.org/security#invocationTarget","@type":"@id"},"invoker":{"@id":"https://w3id.org/security#invoker","@type":"@id"},"jws":"https://w3id.org/security#jws","keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"},"kmsModule":{"@id":"https://w3id.org/security#kmsModule"},"parentCapability":{"@id":"https://w3id.org/security#parentCapability","@type":"@id"},"plaintext":"https://w3id.org/security#plaintext","proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},"proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"referenceId":"https://w3id.org/security#referenceId","unwrappedKey":"https://w3id.org/security#unwrappedKey","verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"},"verifyData":"https://w3id.org/security#verifyData","wrappedKey":"https://w3id.org/security#wrappedKey"}]}')},function(e,t){e.exports={vaccinationContext:{"@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",schema:"https://schema.org/",vac:"https://cowin.gov.in/credentials/vaccination/v1",ProofOfVaccinationCredential:{"@id":"schema:ProofOfVaccinationCredential","@context":{"@version":1.1,"@protected":!0,nonTransferable:"vac:nonTransferable"}},Person:{"@id":"schema:Person","@context":{"@version":1.1,"@protected":!0,refId:"schema:id",uhid:"schema:id",name:"schema:name",age:"schema:Number",gender:"schema:gender",nationality:"schema:nationality",address:{"@id":"schema:PostalAddress","@context":{"@version":1.1,"@protected":!0,streetAddress:"schema:streetAddress",streetAddress2:"vac:addressLine2",city:"vac:city",district:"vac:district",addressRegion:"schema:addressRegion",postalCode:"schema:postalCode",addressCountry:"schema:addressCountry"}}}},Vaccination:{"@id":"vac:Vaccination","@context":{"@version":1.1,"@protected":!0,certificateId:"schema:id",feedbackUrl:"schema:url",infoUrl:"schema:url",batch:"schema:id",vaccine:"schema:id",manufacturer:"schema:id",date:"schema:date",effectiveStart:"schema:date",effectiveUntil:"schema:date",dose:"schema:doseValue",totalDoses:"schema:doseValue",verifier:{"@id":"vac:verifier","@context":{"@version":1.1,"@protected":!0,id:"schema:id",name:"schema:name","sign-image":"schema:image"}},facility:{"@id":"vac:Facility","@context":{"@version":1.1,"@protected":!0,name:"schema:name",address:{"@id":"schema:PostalAddress","@context":{"@version":1.1,"@protected":!0,streetAddress:"schema:streetAddress",streetAddress2:"vac:addressLine2",city:"vac:city",district:"vac:district",addressRegion:"schema:addressRegion",postalCode:"schema:postalCode",addressCountry:"schema:addressCountry"}},"seal-image":"schema:image"}}}}}}}},function(e){e.exports=JSON.parse('{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","description":"http://schema.org/description","identifier":"http://schema.org/identifier","name":"http://schema.org/name","image":"http://schema.org/image","VaccinationCertificate":{"@id":"https://w3id.org/vaccination#VaccinationCertificate","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","description":"http://schema.org/description","identifier":"http://schema.org/identifier","name":"http://schema.org/name","image":"http://schema.org/image"}},"VaccinationEvent":{"@id":"https://w3id.org/vaccination#VaccinationEvent","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","administeringCentre":"https://w3id.org/vaccination#administeringCentre","batchNumber":"https://w3id.org/vaccination#batchNumber","countryOfVaccination":"https://w3id.org/vaccination#countryOfVaccination","dateOfVaccination":{"@id":"https://w3id.org/vaccination#dateOfVaccination","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"healthProfessional":"https://w3id.org/vaccination#healthProfessional","nextVaccinationDate":{"@id":"https://w3id.org/vaccination#nextVaccinationDate","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"order":"https://w3id.org/vaccination#order","recipient":{"@id":"https://w3id.org/vaccination#recipient","@type":"https://w3id.org/vaccination#VaccineRecipient"},"vaccine":{"@id":"https://w3id.org/vaccination#VaccineEventVaccine","@type":"https://w3id.org/vaccination#Vaccine"}}},"VaccineRecipient":{"@id":"https://w3id.org/vaccination#VaccineRecipient","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","birthDate":{"@id":"http://schema.org/birthDate","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"familyName":"http://schema.org/familyName","gender":"http://schema.org/gender","givenName":"http://schema.org/givenName"}},"Vaccine":{"@id":"https://w3id.org/vaccination#Vaccine","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","atcCode":"https://w3id.org/vaccination#atc-code","disease":"https://w3id.org/vaccination#disease","event":{"@id":"https://w3id.org/vaccination#VaccineRecipientVaccineEvent","@type":"https://w3id.org/vaccination#VaccineEvent"},"marketingAuthorizationHolder":"https://w3id.org/vaccination#marketingAuthorizationHolder","medicinalProductName":"https://w3id.org/vaccination#medicinalProductName"}}}}')},function(e){e.exports=JSON.parse('{"@context":{"@version":1.1,"name":"http://schema.org/name","description":"http://schema.org/description","identifier":"http://schema.org/identifier","image":{"@id":"http://schema.org/image","@type":"@id"},"DocumentVerificationEvidence":{"@id":"https://schema.org/DigitalDocument","@context":{"verifier":{"@id":"https://schema.org/Organization"},"evidenceDocument":{"@id":"https://schema.org/name"},"subjectPresence":{"@id":"https://schema.org/Person"},"documentPresence":{"@id":"https://schema.org/PresentationDigitalDocument"}}},"id":"@id","type":"@type","Brand":{"@id":"https://schema.org/Brand","@context":{"logo":{"@id":"https://schema.org/logo"},"url":{"@id":"https://schema.org/url"}}},"ContactPoint":{"@id":"https://schema.org/ContactPoint","@context":{"name":{"@id":"https://schema.org/name"},"address":{"@id":"https://schema.org/PostalAddress"},"email":{"@id":"https://schema.org/email"},"phoneNumber":{"@id":"https://schema.org/telephone"}}},"CovidTestPassEvidenceDocument":{"@id":"https://w3id.org/pathogen#CovidTestPassEvidenceDocument","@context":{"testType":{"@id":"https://schema.org/name"},"testCenter":{"@id":"https://schema.org/Organization"},"healthProfessionalAdministered":{"@id":"https://schema.org/description"},"testedPerson":{"@id":"https://schema.org/Person"},"testResult":{"@id":"https://schema.org/signDetected"},"testDetails":{"@id":"https://schema.org/MedicalTest"}}},"StandardCovidTestPassDetailed":{"@id":"https://w3id.org/pathogen#CovidTestPassStandardCredentialDetailed","@context":{"testType":{"@id":"https://schema.org/name"},"testCenter":{"@id":"https://schema.org/Organization"},"healthProfessionalAdministered":{"@id":"https://schema.org/description"},"testedPerson":{"@id":"https://schema.org/Person"},"testResult":{"@id":"https://schema.org/signDetected"},"testDetails":{"@id":"https://schema.org/MedicalTest"}}},"StandardCovidTestPassMinimal":{"@id":"https://w3id.org/pathogen#CovidTestPassStandardCredentialMinimal","@context":{"testType":{"@id":"https://schema.org/name"},"testedPerson":{"@id":"https://schema.org/Person"},"testResult":{"@id":"https://schema.org/signDetected"}}},"CovidTestRegistrationCredential":{"@id":"https://w3id.org/pathogen#CovidTestRegistrationCredential","@context":{"nationalHealthAgency":{"@id":"https://schema.org/name"},"testID":{"@id":"https://schema.org/productID"},"productName":{"@id":"https://schema.org/description"},"evaluation":{"@id":"https://schema.org/signDetected"},"marketingAuthorativeHolder":{"@id":"https://schema.org/manufacturer"},"distributor":{"@id":"https://schema.org/Organization"},"sensitivity":{"@id":"https://schema.org/PropertyValue"},"specificity":{"@id":"https://schema.org/additionalProperty"},"testDocumentationLink":{"@id":"https://schema.org/url"}}},"DGCInfectionInformation":{"@id":"https://w3id.org/pathogen#DGCInfectionInformation","@context":{"diseaseRecoveredFrom":{"@id":"http://snomed.info/sct/840539006"},"dateFirstPositive":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.result.effectiveDateTime"},"countryOfTest":{"@id":"https://schema.org/countryOfOrigin"}}},"DGCProofOfCovidTest":{"@id":"https://w3id.org/pathogen#DGCProofOfCovidTest","@context":{"issuerName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"testInformation":{"@id":"https://w3id.org/pathogen#DGCTestInformation"},"personalInformation":{"@id":"https://w3id.org/pathogen#DGCSubject"}}},"DGCProofOfRecovery":{"@id":"https://w3id.org/pathogen#DGCProofOfRecovery","@context":{"issuerName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"validFrom":{"@id":"https://schema.org/validFrom"},"validUntil":{"@id":"https://schema.org/validUntil"},"infectionInformation":{"@id":"https://w3id.org/pathogen#DGCInfectionInformation"},"personalInformation":{"@id":"https://w3id.org/pathogen#DGCSubject"}}},"DGCProofOfVaccination":{"@id":"https://w3id.org/pathogen#DGCProofOfVaccination","@context":{"issuerName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"vaccinationInformation":{"@id":"https://w3id.org/pathogen#DGCVaccinationInformation"},"personalInformation":{"@id":"https://w3id.org/pathogen#DGCSubject"}}},"DGCSubject":{"@id":"https://w3id.org/pathogen#DGCSubject","@context":{"familyName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.familyName"},"givenName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.givenName"},"stdFamilyName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.familyName"},"stdGivenName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.givenName"},"birthDate":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.birthDate"},"gender":{"@id":"http://hl7.org/fhir/gender-identity"}}},"DGCTestInformation":{"@id":"https://w3id.org/pathogen#DGCTestInformation","@context":{"testName":{"@id":"http://hl7.eu/fhir/ig/dgc/ValueSet/loinc-tests-covid-19"},"diseaseTestedFrom":{"@id":"http://snomed.info/sct/840539006"},"testType":{"@id":"http://hl7.eu/fhir/ig/dgc/ValueSet/covid-19-lab-methods"},"sampleOriginType":{"@id":"http://hl7.org/fhir/ValueSet/body-site"},"sampleCollectionDateTime":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.specimen.collectedDateTime"},"testManufacturer":{"@id":"https://schema.org/manufacturer"},"testResultDate":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.resultDate"},"testResult":{"@id":"http://hl7.org/fhir/ValueSet/observation-interpretation"},"testCenter":{"@id":"http://hl7.eu/fhir/ig/dgc/StructureDefinition/Location-dgc"},"testValidatorId":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.resultsIntepreter"},"healthProfessionalAdministered":{"@id":"http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips"},"testDetails":{"@id":"http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-pathology-uv-ips"},"countryOfTestAdminstration":{"@id":"https://schema.org/countryOfOrigin"}}},"DGCVaccinationInformation":{"@id":"https://w3id.org/pathogen#DGCVaccinationInformation","@context":{"administeringCentre":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"batchNumber":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"countryOfVaccination":{"@id":"http://hl7.org/fhir/ValueSet/iso3166-1-2"},"dateOfVaccination":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.occurenceDateTime"},"healthProfessional":{"@id":"http://hl7.org/fhir/ValueSet/immunization-function"},"nextVaccinationDate":{"@id":"http://hl7.org/fhir/ImmunizationRecommendation.dateCriterion.value"},"order":{"@id":"http://hl7.org/fhir/Immunization.protocolApplied.doseNumber"},"dose":{"@id":"http://hl7.org/fhir/Immunization.protocolApplied.doseNumber"},"totalDoses":{"@id":"http://hl7.org/fhir/Immunization.protocolApplied.totalDoses"},"vaccine":{"@id":"https://w3id.org/pathogen#DGCVaccine"},"diseaseProtectedFrom":{"@id":"http://snomed.info/sct/840539006"},"prophylaxis":{"@id":"http://snomed.info/sct/840539006"}}},"DGCVaccine":{"@id":"https://w3id.org/pathogen#DGCVaccine","@context":{"code":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"targetDisease":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"marketingAuthHolder":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"medicinalProductName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"}}},"Entity":{"@id":"https://w3id.org/pathogen#Entity","@context":{}},"GeoCoordinates":{"@id":"https://schema.org/GeoCoordinates","@context":{"latitude":{"@id":"https://schema.org/latitude"},"longitude":{"@id":"https://schema.org/longitude"}}},"LEIaddress":{"@id":"https://w3id.org/pathogen#LEIaddress","@context":{"language":{"@id":"https://schema.org/Language"},"addressLines":{"@id":"https://schema.org/streetAddress"},"addressNumber":{"@id":"https://schema.org/Number"},"addressNumberWithinBuilding":{"@id":"https://schema.org/value"},"mailRouting":{"@id":"https://schema.org/Trip"},"city":{"@id":"https://schema.org/addressLocality"},"region":{"@id":"https://schema.org/addressRegion"},"country":{"@id":"https://schema.org/addressCountry"},"postalCode":{"@id":"https://schema.org/postalCode"}}},"LEIauthority":{"@id":"https://w3id.org/pathogen#LEIauthority","@context":{"validationAuthorityID":{"@id":"https://schema.org/identifier"},"otherValidationAuthorityID":{"@id":"https://schema.org/taxID"},"validationAuthorityEntityID":{"@id":"https://schema.org/leiCode"}}},"LEIentity":{"@id":"https://w3id.org/pathogen#LEIentity","@context":{"legalName":{"@id":"https://schema.org/legalName"},"legalNameLanguage":{"@id":"https://schema.org/Language"},"otherNames":{"@id":"https://schema.org/alternateName"},"transliteratedOtherNames":{"@id":"https://schema.org/name"},"legalAddress":{"@id":"https://w3id.org/pathogen#LEIaddress"},"headquartersAddress":{"@id":"https://schema.org/PostalAddress"},"registrationAuthority":{"@id":"https://w3id.org/pathogen#LEIauthority"},"legalJurisdiction":{"@id":"https://schema.org/countryOfOrigin"},"entityCategory":{"@id":"https://schema.org/category"},"legalForm":{"@id":"https://schema.org/additionalType"},"associatedEntity":{"@id":"https://schema.org/Organization"},"status":{"@id":"https://schema.org/status"},"expirationDate":{"@id":"https://schema.org/expires"},"expirationReason":{"@id":"https://schema.org/Answer"},"successorEntity":{"@id":"https://schema.org/Corporation"},"otherAddresses":{"@id":"https://schema.org/Place"}}},"LEIevidenceDocument":{"@id":"https://w3id.org/pathogen#LEIevidenceDocument","@context":{"lei":{"@id":"https://www.gleif.org/en/about-lei/iso-17442-the-lei-code-structure#"},"entity":{"@id":"https://w3id.org/pathogen#LEIentity"},"registration":{"@id":"https://w3id.org/pathogen#LEIregistration"},"bic":{"@id":"https://www.iso.org/obp/ui/#iso:std:60390:en"}}},"LEIregistration":{"@id":"https://w3id.org/pathogen#LEIregistration","@context":{"initialRegistrationDate":{"@id":"https://schema.org/dateIssued"},"lastUpdateDate":{"@id":"https://schema.org/dateModified"},"status":{"@id":"https://schema.org/status"},"nextRenewalDate":{"@id":"https://schema.org/validThrough"},"managingLou":{"@id":"https://www.gleif.org/en/about-lei/iso-17442-the-lei-code-structure#"},"validationSources":{"@id":"https://schema.org/eventStatus"},"validationAuthority":{"@id":"https://w3id.org/pathogen#LEIauthority"}}},"LegalEntityIdentifierCredential":{"@id":"https://w3id.org/pathogen#LegalEntityIdentifierCredential","@context":{"leiCode":{"@id":"https://schema.org/leiCode"},"certificateName":{"@id":"https://schema.org/name"}}},"MedicalTest":{"@id":"https://schema.org/MedicalTest","@context":{"affectedBy":{"@id":"https://schema.org/affectedBy"},"normalRange":{"@id":"https://schema.org/normalRange"},"signDetected":{"@id":"https://schema.org/MedicalSign"},"usedToDiagnose":{"@id":"https://schema.org/MedicalCondition"},"usesDevice":{"@id":"https://schema.org/usesDevice"},"code":{"@id":"https://schema.org/code"},"guideline":{"@id":"https://schema.org/guideline"},"legalStatus":{"@id":"https://schema.org/legalStatus"},"medicineSystem":{"@id":"https://schema.org/medicineSystem"},"recognizingAuthority":{"@id":"https://schema.org/Organization"},"relevantSpecialty":{"@id":"https://schema.org/relevantSpecialty"}}},"Organization":{"@id":"https://schema.org/Organization","@context":{"name":{"@id":"https://schema.org/name"},"leiCode":{"@id":"https://schema.org/leiCode"},"url":{"@id":"https://schema.org/url"},"description":{"@id":"https://schema.org/description"},"globalLocationNumber":{"@id":"https://schema.org/globalLocationNumber"},"address":{"@id":"https://schema.org/PostalAddress"},"email":{"@id":"https://schema.org/email"},"phoneNumber":{"@id":"https://schema.org/telephone"},"faxNumber":{"@id":"https://schema.org/faxNumber"},"brand":{"@id":"https://schema.org/Brand"},"contactPoint":{"@id":"https://schema.org/ContactPoint"}}},"Person":{"@id":"https://schema.org/Person","@context":{"firstName":{"@id":"https://schema.org/givenName"},"lastName":{"@id":"https://schema.org/familyName"},"email":{"@id":"https://schema.org/email"},"phoneNumber":{"@id":"https://schema.org/telephone"},"worksFor":{"@id":"https://schema.org/worksFor"},"jobTitle":{"@id":"https://schema.org/jobTitle"},"gender":{"@id":"https://schema.org/gender"},"idnumber":{"@id":"https://schema.org/identifier"},"idnumberType":{"@id":"https://schema.org/additionalProperty"},"birthDate":{"@id":"https://schema.org/birthDate"}}},"Place":{"@id":"https://schema.org/Place","@context":{"globalLocationNumber":{"@id":"https://schema.org/globalLocationNumber"},"geo":{"@id":"https://schema.org/GeoCoordinates"},"address":{"@id":"https://schema.org/PostalAddress"}}},"PostalAddress":{"@id":"https://schema.org/PostalAddress","@context":{"organizationName":{"@id":"https://gs1.org/voc/organizationName"},"streetAddress":{"@id":"https://schema.org/streetAddress"},"addressLocality":{"@id":"https://schema.org/addressLocality"},"addressRegion":{"@id":"https://schema.org/addressRegion"},"addressCountry":{"@id":"https://schema.org/addressCountry"},"crossStreet":{"@id":"https://gs1.org/voc/crossStreet"},"countyCode":{"@id":"https://gs1.org/voc/countyCode"},"postalCode":{"@id":"https://schema.org/postalCode"},"postOfficeBoxNumber":{"@id":"https://schema.org/postOfficeBoxNumber"}}},"PriceSpecification":{"@id":"https://schema.org/PriceSpecification","@context":{"price":{"@id":"https://schema.org/price"},"priceCurrency":{"@id":"https://schema.org/priceCurrency"}}},"Product":{"@id":"https://schema.org/Product","@context":{"manufacturer":{"@id":"https://schema.org/manufacturer"},"name":{"@id":"https://schema.org/name"},"description":{"@id":"https://schema.org/description"},"category":{"@id":"https://schema.org/category"},"sizeOrAmount":{"@id":"https://schema.org/size"},"weight":{"@id":"https://schema.org/weight"},"depth":{"@id":"https://schema.org/depth"},"width":{"@id":"https://schema.org/width"},"height":{"@id":"https://schema.org/height"},"quantity":{"@id":"https://www.gs1.org/voc/netContent"},"packagingType":{"@id":"https://www.gs1.org/voc/packagingMaterial"},"priceSpecification":{"@id":"https://schema.org/priceSpecification"},"sku":{"@id":"https://schema.org/sku"}}},"ProductRegistrationEvidenceDocument":{"@id":"https://w3id.org/pathogen#ProductRegistrationEvidenceDocument","@context":{"category":{"@id":"https://schema.org/category"},"inProductGroupWithID":{"@id":"https://schema.org/inProductGroupWithID"},"productID":{"@id":"https://schema.org/productID"},"mpn":{"@id":"https://schema.org/mpn"},"gtin":{"@id":"https://schema.org/gtin"},"isAccessoryOrSparePartFor":{"@id":"https://schema.org/isAccessoryOrSparePartFor"},"releaseDate":{"@id":"https://schema.org/releaseDate"},"manufacturer":{"@id":"https://schema.org/manufacturer"},"globalLocationNumber":{"@id":"https://schema.org/globalLocationNumber"},"leiCode":{"@id":"https://schema.org/leiCode"},"name":{"@id":"https://schema.org/name"},"description":{"@id":"https://schema.org/description"},"model":{"@id":"https://schema.org/model"},"color":{"@id":"https://schema.org/color"},"material":{"@id":"https://schema.org/material"},"weight":{"@id":"https://schema.org/weight"},"height":{"@id":"https://schema.org/height"},"width":{"@id":"https://schema.org/width"},"depth":{"@id":"https://schema.org/depth"},"url":{"@id":"https://schema.org/url"},"isBasedOn":{"@id":"https://schema.org/isBasedOn"},"image":{"@id":"https://schema.org/image"}}},"QuantitativeValue":{"@id":"https://schema.org/QuantitativeValue","@context":{"unitCode":{"@id":"https://schema.org/unitCode"},"value":{"@id":"https://schema.org/value"}}},"TotalCharge":{"@id":"https://w3id.org/pathogen#TotalCharge","@context":{"totalPrepaid":{"@id":"https://schema.org/Price"},"totalCollect":{"@id":"https://schema.org/totalPrice"},"sourceCurrency":{"@id":"https://schema.org/priceCurrency"},"destinationCurrency":{"@id":"https://schema.org/currency"},"currencyConversionRate":{"@id":"https://schema.org/ExchangeRateSpecification"},"ccChargesDestinationCurrency":{"@id":"https://schema.org/discountCurrency"},"chargesDestination":{"@id":"https://schema.org/Number"},"totalCollectCharge":{"@id":"https://schema.org/estimatedCost"}}},"chargeAndPaymentType":{"@id":"https://w3id.org/pathogen#chargeAndPaymentType","@context":{"chargeCollect":{"@id":"https://schema.org/discountPrice"},"chargePrepaid":{"@id":"https://schema.org/totalPrice"}}}}}')},function(e){e.exports=JSON.parse('{"@context":{"@version":1.1,"name":"http://schema.org/name","description":"http://schema.org/description","identifier":"http://schema.org/identifier","image":{"@id":"http://schema.org/image","@type":"@id"},"id":"@id","type":"@type","DGCCertificate":{"@id":"https://w3id.org/dgc#DGCCertificate","@context":{"proofOfVaccination":{"@id":"https://w3id.org/dgc#DGCProofOfVaccination"},"proofOfCovidTest":{"@id":"https://w3id.org/dgc#DGCProofOfCovidTest"},"proofOfRecovery":{"@id":"https://w3id.org/dgc#DGCProofOfRecovery"},"personalInformation":{"@id":"https://w3id.org/dgc#DGCSubject"}}},"DGCProofOfVaccination":{"@id":"https://w3id.org/dgc#DGCProofOfVaccination","@context":{"issuerName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"countryOfVaccination":{"@id":"http://hl7.org/fhir/ValueSet/iso3166-1-2"},"vaccinationInformation":{"@id":"https://w3id.org/dgc#DGCVaccinationInformation"}}},"DGCProofOfCovidTest":{"@id":"https://w3id.org/dgc#DGCProofOfCovidTest","@context":{"issuerName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"countryOfTestAdminstration":{"@id":"https://schema.org/countryOfOrigin"},"testInformation":{"@id":"https://w3id.org/dgc#DGCTestInformation"}}},"DGCProofOfRecovery":{"@id":"https://w3id.org/dgc#DGCProofOfRecovery","@context":{"issuerName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"countryOfTest":{"@id":"https://schema.org/countryOfOrigin"},"infectionInformation":{"@id":"https://w3id.org/dgc#DGCInfectionInformation"}}},"DGCVaccinationInformation":{"@id":"https://w3id.org/dgc#DGCVaccinationInformation","@context":{"administeringCentre":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.location.name"},"batchNumber":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"dateOfVaccination":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.occurenceDateTime"},"nextVaccinationDate":{"@id":"http://hl7.org/fhir/ImmunizationRecommendation.dateCriterion.value"},"order":{"@id":"http://hl7.org/fhir/Immunization.protocolApplied.doseNumber"},"dose":{"@id":"http://hl7.org/fhir/Immunization.protocolApplied.doseNumber"},"totalDoses":{"@id":"http://hl7.org/fhir/Immunization.protocolApplied.totalDoses"},"code":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"targetDisease":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"marketingAuthHolder":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"medicinalProductName":{"@id":"http://hl7.org/fhir/uv/ips/Immunization.lotNumber"},"diseaseProtectedFrom":{"@id":"http://snomed.info/sct/840539006"},"prophylaxis":{"@id":"http://snomed.info/sct/840539006"}}},"DGCTestInformation":{"@id":"https://w3id.org/dgc#DGCTestInformation","@context":{"testName":{"@id":"http://hl7.eu/fhir/ig/dgc/ValueSet/loinc-tests-covid-19"},"diseaseTestedFrom":{"@id":"http://snomed.info/sct/840539006"},"testType":{"@id":"http://hl7.eu/fhir/ig/dgc/ValueSet/covid-19-lab-methods"},"sampleOriginType":{"@id":"http://hl7.org/fhir/ValueSet/body-site"},"sampleCollectionDateTime":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.specimen.collectedDateTime"},"testManufacturer":{"@id":"https://schema.org/manufacturer"},"testResultDate":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.resultDate"},"testResult":{"@id":"http://hl7.org/fhir/ValueSet/observation-interpretation"},"testCenter":{"@id":"http://hl7.eu/fhir/ig/dgc/StructureDefinition/Location-dgc"},"testValidatorId":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.resultsIntepreter"},"healthProfessionalAdministered":{"@id":"http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips"},"testDetails":{"@id":"http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-pathology-uv-ips"}}},"DGCInfectionInformation":{"@id":"https://w3id.org/dgc#DGCInfectionInformation","@context":{"diseaseRecoveredFrom":{"@id":"http://snomed.info/sct/840539006"},"dateFirstPositive":{"@id":"http://hl7.eu/fhir/ig/dgc/DiagnosticReport.result.effectiveDateTime"},"validFrom":{"@id":"https://schema.org/validFrom"},"validUntil":{"@id":"https://schema.org/validUntil"}}},"DGCSubject":{"@id":"https://w3id.org/dgc#DGCSubject","@context":{"familyName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.familyName"},"givenName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.givenName"},"stdFamilyName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.familyName"},"stdGivenName":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.name.givenName"},"birthDate":{"@id":"http://hl7.eu/fhir/ig/dgc/Patient.birthDate"}}}}}')},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,i=u(e),s=i[0],o=i[1],c=new a(function(e,t,r){return 3*(t+r)/4-r}(0,s,o)),l=0,d=o>0?s-4:s;for(r=0;r>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t);1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,a=[],s=0,o=r-n;so?o:s+16383));1===n?(t=e[r-1],a.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=s.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var n,a,s=[],o=t;o>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ t.read=function(e,t,r,i,n){var a,s,o=8*n-i-1,c=(1<>1,l=-7,d=r?n-1:0,p=r?-1:1,h=e[t+d];for(d+=p,a=h&(1<<-l)-1,h>>=-l,l+=o;l>0;a=256*a+e[t+d],d+=p,l-=8);for(s=a&(1<<-l)-1,a>>=-l,l+=i;l>0;s=256*s+e[t+d],d+=p,l-=8);if(0===a)a=1-u;else{if(a===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,i),a-=u}return(h?-1:1)*s*Math.pow(2,a-i)},t.write=function(e,t,r,i,n,a){var s,o,c,u=8*a-n-1,l=(1<>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:a-1,f=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(o=0,s=l):s+d>=1?(o=(t*c-1)*Math.pow(2,n),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;e[r+h]=255&o,h+=f,o/=256,n-=8);for(s=s<0;e[r+h]=255&s,h+=f,s/=256,u-=8);e[r+h-f]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var i,n,a,s,o,c=1,u={},l=!1,d=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick((function(){f(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){f(e.data)},i=function(e){a.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(n=d.documentElement,i=function(e){var t=d.createElement("script");t.onreadystatechange=function(){f(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):i=function(e){setTimeout(f,0,e)}:(s="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&f(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),i=function(t){e.postMessage(s+t,"*")}),p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r0;)o.push(u%a),u=u/a|0}for(n=0;0===e[n]&&n=0;--n)i+=t[o[n]]}else i=function(e,t){var r=0,i=t.length,n=t.charAt(0),a=[0];for(r=0;r0;)a.push(o%i),o=o/i|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[a[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");i=i.match(l).join("\r\n")}return i},r.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=i[r];if(!n){n=i[r]=[];for(var a=0;a>=8;for(;d>0;)c.push(255&d),d>>=8}for(var p=0;e[p]===o&&p=n.Versions.TLS_1_1.minor&&c.output.putBytes(r),c.update(e.fragment),c.finish(o)&&(e.fragment=c.output,e.length=e.fragment.length(),a=!0),a}function o(e,t,r){if(!r){var i=e-t.length()%e;t.fillWithByte(i-1,i)}return!0}function c(e,t,r){var i=!0;if(r){for(var n=t.length(),a=t.last(),s=n-1-a;s=o?(e.fragment=s.output.getBytes(l-o),u=s.output.getBytes(o)):e.fragment=s.output.getBytes(),e.fragment=i.util.createBuffer(e.fragment),e.length=e.fragment.length();var d=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=function(e,t,r){var n=i.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}(t.macKey,u,d)&&a}n.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,e.cipher_type=n.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=n.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:a},n.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,e.cipher_type=n.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=n.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:a}},function(e,t,r){var i=r(0);r(67),e.exports=i.mgf=i.mgf||{},i.mgf.mgf1=i.mgf1},function(e,t,r){(function(t){var i=r(0);r(31),r(3),r(69),r(1);var n=r(96),a=n.publicKeyValidator,s=n.privateKeyValidator;if(void 0===o)var o=i.jsbn.BigInteger;var c=i.util.ByteBuffer,u=void 0===t?Uint8Array:t;i.pki=i.pki||{},e.exports=i.pki.ed25519=i.ed25519=i.ed25519||{};var l=i.ed25519;function d(e){var r=e.message;if(r instanceof Uint8Array||r instanceof u)return r;var i=e.encoding;if(void 0===r){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');r=e.md.digest().getBytes(),i="binary"}if("string"==typeof r&&!i)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof r){if(void 0!==t)return t.from(r,i);r=new c(r,i)}else if(!(r instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new u(r.length()),a=0;a=0;--r)M(i,i),1!==r&&V(i,i,t);for(r=0;r<16;++r)e[r]=i[r]}(r,r),V(r,r,n),V(r,r,a),V(r,r,a),V(e[0],r,a),M(i,e[0]),V(i,i,a),_(i,n)&&V(e[0],e[0],b);if(M(i,e[0]),V(i,i,a),_(i,n))return-1;k(e[0])===t[31]>>7&&U(e[0],p,e[0]);return V(e[3],e[0],e[1]),0}(o,i))return-1;for(n=0;n=0};var p=O(),h=O([1]),f=O([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),g=O([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=O([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=O([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),b=O([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(e,r){var n=i.md.sha512.create(),a=new c(e);n.update(a.getBytes(r),"binary");var s=n.digest().getBytes();if(void 0!==t)return t.from(s,"binary");for(var o=new u(l.constants.HASH_BYTE_LENGTH),d=0;d<64;++d)o[d]=s.charCodeAt(d);return o}function C(e,t){var r,i,n,a;for(i=63;i>=32;--i){for(r=0,n=i-32,a=i-12;n>8,t[n]-=256*r;t[n]+=r,t[i]=0}for(r=0,n=0;n<32;++n)t[n]+=r-(t[31]>>4)*v[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=r*v[n];for(i=0;i<32;++i)t[i+1]+=t[i]>>8,e[i]=255&t[i]}function E(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;C(e,t)}function S(e,t){var r=O(),i=O(),n=O(),a=O(),s=O(),o=O(),c=O(),u=O(),l=O();U(r,e[1],e[0]),U(l,t[1],t[0]),V(r,r,l),P(i,e[0],e[1]),P(l,t[0],t[1]),V(i,i,l),V(n,e[3],t[3]),V(n,n,g),V(a,e[2],t[2]),P(a,a,a),U(s,i,r),U(o,a,n),P(c,a,n),P(u,i,r),V(e[0],s,o),V(e[1],u,c),V(e[2],c,o),V(e[3],s,u)}function T(e,t,r){for(var i=0;i<4;++i)D(e[i],t[i],r)}function I(e,t){var r=O(),i=O(),n=O();!function(e,t){var r,i=O();for(r=0;r<16;++r)i[r]=t[r];for(r=253;r>=0;--r)M(i,i),2!==r&&4!==r&&V(i,i,t);for(r=0;r<16;++r)e[r]=i[r]}(n,t[2]),V(r,t[0],n),V(i,t[1],n),A(e,i),e[31]^=k(r)<<7}function A(e,t){var r,i,n,a=O(),s=O();for(r=0;r<16;++r)s[r]=t[r];for(L(s),L(s),L(s),i=0;i<2;++i){for(a[0]=s[0]-65517,r=1;r<15;++r)a[r]=s[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),n=a[15]>>16&1,a[14]&=65535,D(s,a,1-n)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function _(e,t){var r=new u(32),i=new u(32);return A(r,e),A(i,t),x(r,0,i,0)}function x(e,t,r,i){return function(e,t,r,i,n){var a,s=0;for(a=0;a>>8)-1}(e,t,r,i,32)}function k(e){var t=new u(32);return A(t,e),1&t[0]}function B(e,t,r){var i,n;for(R(e[0],p),R(e[1],h),R(e[2],h),R(e[3],p),n=255;n>=0;--n)T(e,t,i=r[n/8|0]>>(7&n)&1),S(t,e),S(e,e),T(e,t,i)}function N(e,t){var r=[O(),O(),O(),O()];R(r[0],y),R(r[1],m),R(r[2],h),V(r[3],y,m),B(e,r,t)}function R(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function L(e){var t,r,i=1;for(t=0;t<16;++t)r=e[t]+i+65535,i=Math.floor(r/65536),e[t]=r-65536*i;e[0]+=i-1+37*(i-1)}function D(e,t,r){for(var i,n=~(r-1),a=0;a<16;++a)i=n&(e[a]^t[a]),e[a]^=i,t[a]^=i}function O(e){var t,r=new Float64Array(16);if(e)for(t=0;t0&&(s=i.util.fillString(String.fromCharCode(0),c)+s),{encapsulation:t.encrypt(s,"NONE"),key:e.generate(s,a)}},decrypt:function(t,r,i){var n=t.decrypt(r,"NONE");return e.generate(n,i)}};return a},i.kem.kdf1=function(e,t){a(this,e,0,t||e.digestLength)},i.kem.kdf2=function(e,t){a(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(8),r(36),r(18),r(39),r(69)},function(e,t,r){var i=r(0);r(12),r(7),r(29),r(13),r(17),r(66),r(3),r(1),r(40);var n=i.asn1,a=e.exports=i.pkcs7=i.pkcs7||{};function s(e){var t={},r=[];if(!n.validate(e,a.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:i.pki.RDNAttributesAsArray(t.issuer),serialNumber:i.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:n.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function o(e){for(var t,r=[],a=0;a0){for(var r=n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),a=0;a=r&&s0&&s.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,t)),a.length>0&&s.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,a)),s.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,e.signerInfos)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var a=t.certificate;"string"==typeof a&&(a=i.pki.certificateFromPem(a)),r=a.issuer.attributes,n=a.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=i.pki.privateKeyFromPem(s));var o=t.digestAlgorithm||i.pki.oids.sha1;switch(o){case i.pki.oids.sha1:case i.pki.oids.sha256:case i.pki.oids.sha384:case i.pki.oids.sha512:case i.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,d=0;d="8"&&(r="00"+r);var n=i.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function s(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=i.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=y[this.state].block)},m.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==p&&(this.state=u,v(this,0)),this.blocks},m.prototype.sleep=function(e){e=void 0===e?0:e,this.state=y[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=u,v(t,0)}),e)},m.prototype.wait=function(e){e.wait(this)},m.prototype.wakeup=function(){this.state===d&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=u,v(this,0))},m.prototype.cancel=function(){this.state=y[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},m.prototype.fail=function(e){if(this.error=!0,b(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,v(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;b(t,!0)}this.failureCallback&&this.failureCallback(this)}};var v=function(e,t){var r=t>30||+new Date-e.swapTime>20,i=function(t){if(t++,e.state===u)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var i=e.subtasks.shift();i.error=e.error,i.swapTime=e.swapTime,i.userData=e.userData,i.run(i),i.error||v(i,t)}else b(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,v(e.parent,t))};r?setTimeout(i,0):i(t)},b=function(e,t){e.state=p,delete a[e.id],null===e.parent&&(e.type in o?0===o[e.type].length?i.log.error(n,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):o[e.type][0]!==e?i.log.error(n,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(o[e.type].shift(),0===o[e.type].length?delete o[e.type]:o[e.type][0].start()):i.log.error(n,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=i.task=i.task||{},i.task.start=function(e){var t=new m({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in o?o[e.type].push(t):(o[t.type]=[t],function(e){e.error=!1,e.state=y[e.state][g],setTimeout((function(){e.state===u&&(e.swapTime=+new Date,e.run(e),v(e,0))}),0)}(t))},i.task.cancel=function(e){e in o&&(o[e]=[o[e][0]])},i.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018-2019 Digital Bazaar, Inc. All rights reserved. */const i={};e.exports=i;const n=r(103);i.encode=n.encode,i.decode=n.decode},function(e,t,r){"use strict"; /*! * Copyright (c) 2018-2019 Digital Bazaar, Inc. All rights reserved. */const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",n=[62,-1,-1,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,63,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];e.exports={decode:function(e){let t=e.length;const r=t%4;if(1===r)throw new Error("Illegal base64 string.");let i=0;r>0&&(i=4-r,t+=i);const a=new Uint8Array(t/4*3-i);let s,o,c,u,l=0,d=0;for(;l>4,l>2,l>2),a+=i.charAt((3&t)<<4|r>>4),isNaN(r)||(a+=i.charAt((15&r)<<2|n>>6),isNaN(n)||(a+=i.charAt(63&n)));return a}}},function(e,t,r){"use strict";(function(e){const{asn1:i,oids:n,util:{ByteBuffer:a}}=r(23);t.base58Decode=({decode:e,keyMaterial:t,type:r})=>{let i;try{i=e(t)}catch(e){}if(void 0===i)throw new TypeError(`The ${r} key material must be Base58 encoded.`);return i},t.privateKeyDerEncode=({privateKeyBytes:t,seedBytes:r})=>{if(!t&&!r)throw new TypeError("`privateKeyBytes` or `seedBytes` is required.");if(!(t||e.isBuffer(r)&&32===r.length))throw new TypeError("`seedBytes` must be a 32 byte Buffer.");if(!(r||e.isBuffer(t)&&64===t.length))throw new TypeError("`privateKeyBytes` must be a 64 byte Buffer.");let s;s=r||e.from(t.buffer,t.byteOffset,32);const o=new a(s),c=i.create(i.UNIVERSAL,i.Type.OCTETSTRING,!1,o.getBytes()),u=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(0).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.EdDSA25519).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(c).getBytes())]),l=i.toDer(u);return e.from(l.getBytes(),"binary")},t.publicKeyDerEncode=({publicKeyBytes:t})=>{if(!e.isBuffer(t)||32!==t.length)throw new TypeError("`publicKeyBytes` must be a 32 byte Buffer.");const r=e.from(new Uint8Array([0])),s=new a(e.concat([r,t])),o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.EdDSA25519).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,s.getBytes())]),c=i.toDer(o);return e.from(c.getBytes(),"binary")}}).call(this,r(6).Buffer)},function(e,t){},function(e,t){},function(e,t,r){"use strict";const i=r(14);e.exports=class{constructor({maxCallStackDepth:e=500,maxTotalCallStackDepth:t=4294967295,timeSlice:r=10}={}){this.schedule={},this.schedule.MAX_DEPTH=e,this.schedule.MAX_TOTAL_DEPTH=t,this.schedule.depth=0,this.schedule.totalDepth=0,this.schedule.timeSlice=r}doWork(e,t){const r=this.schedule;if(r.totalDepth>=r.MAX_TOTAL_DEPTH)return t(new Error("Maximum total call stack depth exceeded; canonicalization aborting."));!function n(){if(r.depth===r.MAX_DEPTH)return r.depth=0,r.running=!1,i.nextTick(n);const a=Date.now();if(r.running||(r.start=Date.now(),r.deadline=r.start+r.timeSlice),a{r.depth--,r.totalDepth--,t(e,i)});r.depth=0,r.running=!1,i.setImmediate(n)}()}forEach(e,t,r){const i=this;let n,a,s=0;if(Array.isArray(e))a=e.length,n=()=>s!==a&&(n.value=e[s++],n.key=s,!0);else{const t=Object.keys(e);a=t.length,n=()=>s!==a&&(n.key=t[s++],n.value=e[n.key],!0)}!function e(a){return a?r(a):n()?i.doWork(()=>t(n.value,n.key,e)):void r()}()}waterfall(e,t){const r=this;r.forEach(e,(e,t,i)=>r.doWork(e,i),t)}whilst(e,t,r){const i=this;!function n(a){return a?r(a):e()?void i.doWork(t,n):r()}()}}},function(e,t,r){"use strict";const i=r(72),n=r(14);e.exports=class extends i{constructor(e){super(e),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(e,t,r){return"BlankNode"!==t.termType||((t=n.clone(t)).value="name"===r?"_:g":t.value===e?"_:a":"_:z"),t}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t,r){const i=this,n={},a=i.blankNodeInfo[e].quads;i.forEach(a,(r,a,s)=>{let o,c;if("BlankNode"===r.subject.termType&&r.subject.value!==e)c=r.subject.value,o="p";else{if("BlankNode"!==r.object.termType||r.object.value===e)return s();c=r.object.value,o="r"}i.hashRelatedBlankNode(c,r,t,o,(e,t)=>{if(e)return s(e);t in n?n[t].push(c):n[t]=[c],s()})},e=>r(e,n))}}},function(e,t,r){"use strict";const i=r(75),n=r(14);e.exports=class extends i{constructor(){super(),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(e,t,r){return"BlankNode"!==t.termType||((t=n.clone(t)).value="name"===r?"_:g":t.value===e?"_:a":"_:z"),t}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t){const r=this,i={},n=r.blankNodeInfo[e].quads;for(let a=0;a10)throw new o("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"loading remote context failed",max:10});if(r.has(e))throw new o("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"recursive context inclusion",url:e});let s,c;r.add(e);try{c=await t(e),s=c.document||null,a(s)&&(s=JSON.parse(s))}catch(t){throw new o("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:e,cause:t})}if(!n(s))throw new o("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:e});return s="@context"in s?{"@context":s["@context"]}:{"@context":{}},c.contextUrl&&(i(s["@context"])||(s["@context"]=[s["@context"]]),s["@context"].push(c.contextUrl)),{context:s,remoteDoc:c}}}},function(e,t,r){"use strict";const i=r(76);e.exports=class{constructor({document:e}){this.document=e,this.cache=new i({max:10})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}},function(e,t,r){"use strict";function i(e){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},i.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},i.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},i.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},i.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new i;if(tthis.length&&(t=this.length);for(var n=0,a=this.head;null!==a&&nthis.length&&(t=this.length);for(var n=this.length,a=this.tail;null!==a&&n>t;n--)a=a.prev;for(;null!==a&&n>e;n--,a=a.prev)r.push(a.value);return r},i.prototype.splice=function(e,t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,i=this.head;null!==i&&r{})})=>{if(null==r)return null;if("@default"===t&&(d=Object.assign({},d,{isFrame:!1})),!n(r)&&!a(r)){if(!A&&(null===t||"@graph"===p(e,t,{vocab:!0},d))){const i=await k({unmappedValue:r,activeCtx:e,activeProperty:t,options:d,insideList:A});return void 0===i?null:i}return S({activeCtx:e,activeProperty:t,value:r,options:d})}if(n(r)){let i=[];const a=h(e,t,"@container")||[];A=A||a.includes("@list");for(let a=0;a1?i.slice().sort():i:[i];for(const t of n){const r=h(x,t,"@context");c(r)||(e=await g({activeCtx:e,localCtx:r,options:d,propagate:!1}))}}}let O={};await async function e({activeCtx:t,activeProperty:r,expandedActiveProperty:d,element:w,expandedParent:S,options:A={},insideList:_,typeScopedContext:x,typeKey:k,expansionMap:B}){const N=Object.keys(w).sort(),R=[];let L;const D=w[k]&&"@json"==p(t,n(w[k])?w[k][0]:w[k],{vocab:!0},A);for(const e of N){let k,N=w[e];if("@context"===e)continue;let O=p(t,e,{vocab:!0},A);if((null===O||!m(O)&&!f(O))&&(O=B({unmappedProperty:e,activeCtx:t,activeProperty:r,parent:w,options:A,insideList:_,value:N,expandedParent:S}),void 0===O))continue;if(f(O)){if("@reverse"===d)throw new i("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:N});if(O in S)throw new i("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:O})}if("@id"===O){if(!o(N)){if(!A.isFrame)throw new i('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:N});if(a(N)){if(!s(N))throw new i('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:N})}else{if(!n(N))throw new i('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:N});if(!N.every(e=>o(e)))throw new i('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:N})}}v(S,"@id",b(N).map(e=>o(e)?p(t,e,{base:!0},A):e),{propertyIsArray:A.isFrame});continue}if("@type"===O){C(N),v(S,"@type",b(N).map(e=>o(e)?p(x,e,{base:!0,vocab:!0},A):e),{propertyIsArray:A.isFrame});continue}if("@graph"===O&&!a(N)&&!n(N))throw new i('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:N});if("@value"===O){L=N,D&&y(t,1.1)?S["@value"]=N:v(S,"@value",N,{propertyIsArray:A.isFrame});continue}if("@language"===O){if(null===N)continue;if(!o(N)&&!A.isFrame)throw new i('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:N});N=b(N).map(e=>o(e)?e.toLowerCase():e),v(S,"@language",N,{propertyIsArray:A.isFrame});continue}if("@index"===O){if(!o(N))throw new i('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:N});v(S,"@index",N);continue}if("@reverse"===O){if(!a(N))throw new i('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:N});if(k=await E.expand({activeCtx:t,activeProperty:"@reverse",element:N,options:A,expansionMap:B}),"@reverse"in k)for(const e in k["@reverse"])v(S,e,k["@reverse"][e],{propertyIsArray:!0});let e=S["@reverse"]||null;for(const t in k){if("@reverse"===t)continue;null===e&&(e=S["@reverse"]={}),v(e,t,[],{propertyIsArray:!0});const r=k[t];for(let n=0;n"@id"===e||"@index"===e)&&(k=b(k).map(e=>({"@graph":b(e)}))),P.mappings.has(e)&&P.mappings.get(e).reverse){const e=S["@reverse"]=S["@reverse"]||{};k=b(k);for(let t=0;t"@value"===p(t,e,{vocab:!0},A)))throw new i("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:n});await e({activeCtx:t,activeProperty:r,expandedActiveProperty:d,element:n,expandedParent:S,options:A,insideList:_,typeKey:k,expansionMap:B})}}}({activeCtx:e,activeProperty:t,expandedActiveProperty:B,element:r,expandedParent:O,options:d,insideList:A,typeScopedContext:x,typeKey:D,expansionMap:k}),R=Object.keys(O);let P=R.length;if("@value"in O){if("@type"in O&&"@language"in O)throw new i('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:O});let n=P-1;if("@type"in O&&(n-=1),"@index"in O&&(n-=1),"@language"in O&&(n-=1),0!==n)throw new i('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and at most one other property which can be "@type" or "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:O});const a=null===O["@value"]?[]:b(O["@value"]),c=w(O,"@type");if(y(e,1.1)&&c.includes("@json")&&1===c.length);else if(0===a.length){const i=await k({unmappedValue:O,activeCtx:e,activeProperty:t,element:r,options:d,insideList:A});O=void 0!==i?i:null}else{if(!a.every(e=>o(e)||s(e))&&"@language"in O)throw new i("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:O});if(!c.every(e=>m(e)&&!(o(e)&&0===e.indexOf("_:"))||s(e)))throw new i('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:O})}}else if("@type"in O&&!n(O["@type"]))O["@type"]=[O["@type"]];else if("@set"in O||"@list"in O){if(P>1&&(2!==P||!("@index"in O)))throw new i('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:O});"@set"in O&&(O=O["@set"],R=Object.keys(O),P=R.length)}else if(1===P&&"@language"in O){const i=await k(O,{unmappedValue:O,activeCtx:e,activeProperty:t,element:r,options:d,insideList:A});O=void 0!==i?i:null}if(a(O)&&!d.keepFreeFloatingNodes&&!A&&(null===t||"@graph"===B)&&(0===P||"@value"in O||"@list"in O||1===P&&"@id"in O)){const i=await k({unmappedValue:O,activeCtx:e,activeProperty:t,element:r,options:d,insideList:A});O=void 0!==i?i:null}return O}},function(e,t,r){"use strict";const{isSubjectReference:i}=r(9),{createMergedNodeMap:n}=r(32),a={};e.exports=a,a.flatten=e=>{const t=n(e),r=[],a=Object.keys(t).sort();for(let e=0;e{const i={},p={"@default":i},h={};for(const n of e){const e="DefaultGraph"===n.graph.termType?"@default":n.graph.value;e in p||(p[e]={}),"@default"===e||e in i||(i[e]={"@id":e});const a=p[e],o=n.subject.value,c=n.predicate.value,u=n.object;o in a||(a[o]={"@id":o});const f=a[o],g=u.termType.endsWith("Node");if(g&&!(u.value in a)&&(a[u.value]={"@id":u.value}),c===d&&!t&&g){s.addValue(f,"@type",u.value,{propertyIsArray:!0});continue}const y=v(u,r);if(s.addValue(f,c,y,{propertyIsArray:!0}),g)if(u.value===l){const e=a[u.value];"usages"in e||(e.usages=[]),e.usages.push({node:f,property:c,value:y})}else u.value in h?h[u.value]=!1:h[u.value]={node:f,property:c,value:y}}for(const e in p){const t=p[e];if(!(l in t))continue;const r=t[l];if(r.usages){for(let e of r.usages){let r=e.node,i=e.property,s=e.value;const l=[],d=[];let p=Object.keys(r).length;for(;i===u&&a.isObject(h[r["@id"]])&&a.isArray(r[c])&&1===r[c].length&&a.isArray(r[u])&&1===r[u].length&&(3===p||4===p&&a.isArray(r["@type"])&&1===r["@type"].length&&r["@type"][0]===o)&&(l.push(r[c][0]),d.push(r["@id"]),e=h[r["@id"]],r=e.node,i=e.property,s=e.value,p=Object.keys(r).length,n.isBlankNode(r)););delete s["@id"],s["@list"]=l.reverse();for(const e of d)delete t[e]}delete r.usages}}const f=[],g=Object.keys(i).sort();for(const e of g){const t=i[e];if(e in p){const r=t["@graph"]=[],i=p[e],a=Object.keys(i).sort();for(const e of a){const t=i[e];n.isSubjectReference(t)||r.push(t)}}n.isSubjectReference(t)||f.push(t)}return f}},function(e,t,r){"use strict";const{createNodeMap:i}=r(32),{isKeyword:n}=r(15),a=r(9),s=r(122),o=r(2),c=r(4),{RDF_FIRST:u,RDF_REST:l,RDF_NIL:d,RDF_TYPE:p,RDF_JSON_LITERAL:h,RDF_LANGSTRING:f,XSD_BOOLEAN:g,XSD_DOUBLE:y,XSD_INTEGER:m,XSD_STRING:v}=r(26),{isAbsolute:b}=r(20),w={};function C(e,t,r,i,a){const s=Object.keys(t).sort();for(const o of s){const s=t[o],c=Object.keys(s).sort();for(let t of c){const c=s[t];if("@type"===t)t=p;else if(n(t))continue;for(const n of c){const s={termType:o.startsWith("_:")?"BlankNode":"NamedNode",value:o};if(!b(o))continue;const c={termType:t.startsWith("_:")?"BlankNode":"NamedNode",value:t};if(!b(t))continue;if("BlankNode"===c.termType&&!a.produceGeneralizedRdf)continue;const u=E(n,i,e,r);u&&e.push({subject:s,predicate:c,object:u,graph:r})}}}}function E(e,t,r,i){const n={};if(a.isValue(e)){n.termType="Literal",n.value=void 0,n.datatype={termType:"NamedNode"};let t=e["@value"];const r=e["@type"]||null;"@json"===r?(n.value=s(t),n.datatype.value=h):o.isBoolean(t)?(n.value=t.toString(),n.datatype.value=r||g):o.isDouble(t)||r===y?(o.isDouble(t)||(t=parseFloat(t)),n.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n.datatype.value=r||y):o.isNumber(t)?(n.value=t.toFixed(0),n.datatype.value=r||m):"@language"in e?(n.value=t,n.datatype.value=r||f,n.language=e["@language"]):(n.value=t,n.datatype.value=r||v)}else if(a.isList(e)){const a=function(e,t,r,i){const n={termType:"NamedNode",value:u},a={termType:"NamedNode",value:l},s={termType:"NamedNode",value:d},o=e.pop(),c=o?{termType:"BlankNode",value:t.getId()}:s;let p=c;for(const s of e){const e=E(s,t,r,i),o={termType:"BlankNode",value:t.getId()};r.push({subject:p,predicate:n,object:e,graph:i}),r.push({subject:p,predicate:a,object:o,graph:i}),p=o}if(o){const e=E(o,t,r,i);r.push({subject:p,predicate:n,object:e,graph:i}),r.push({subject:p,predicate:a,object:s,graph:i})}return c}(e["@list"],t,r,i);n.termType=a.termType,n.value=a.value}else{const t=o.isObject(e)?e["@id"]:e;n.termType=t.startsWith("_:")?"BlankNode":"NamedNode",n.value=t}return"NamedNode"!==n.termType||b(n.value)?n:null}e.exports=w,w.toRDF=(e,t)=>{const r=new c.IdentifierIssuer("_:b"),n={"@default":{}};i(e,n,"@default",r);const a=[],s=Object.keys(n).sort();for(const e of s){let i;if("@default"===e)i={termType:"DefaultGraph",value:""};else{if(!b(e))continue;i=e.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},i.value=e}C(a,n[e],i,r,t)}return a}},function(e,t,r){"use strict";e.exports=function e(t){return null===t||"object"!=typeof t||null!=t.toJSON?JSON.stringify(t):Array.isArray(t)?"["+t.reduce((t,r,i)=>t+(0===i?"":",")+e(void 0===r||"symbol"==typeof r?null:r),"")+"]":"{"+Object.keys(t).sort().reduce((r,i,n)=>{if(void 0===t[i]||"symbol"==typeof t[i])return r;return r+(0===r.length?"":",")+e(i)+":"+e(t[i])},"")+"}"}},function(e,t,r){"use strict";const{isKeyword:i}=r(15),n=r(9),a=r(2),s=r(4),o=r(5),{createNodeMap:c,mergeNodeMapGraphs:u}=r(32),l={};function d(e){const t={};for(const r in e)void 0!==e[r]&&(t["@"+r]=[e[r]]);return[t]}function p(e,t,r){for(let i=r.length-1;i>=0;--i){const n=r[i];if(n.graph===t&&n.subject["@id"]===e["@id"])return!0}return!1}function h(e,t,r){const i="@"+r;let n=i in e?e[i][0]:t[r];return"embed"===r&&(!0===n?n="@last":!1===n?n="@never":"@always"!==n&&"@never"!==n&&"@link"!==n&&(n="@last")),n}function f(e){if(!a.isArray(e)||1!==e.length||!a.isObject(e[0]))throw new o("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e})}function g(e,t,r,o){let c=!0,u=!1;for(const l in r){let d=!1;const p=s.getValues(t,l),h=0===s.getValues(r,l).length;if(i(l)){if("@id"!==l&&"@type"!==l)continue;if(c=!1,"@id"===l){if(r["@id"].length>=0&&!a.isEmptyObject(r["@id"][0]))return r["@id"].includes(p[0]);d=!0;continue}if("@type"in r)if(h){if(p.length>0)return!1;d=!0}else{if(1!==r["@type"].length||!a.isEmptyObject(r["@type"][0])){for(const e of r["@type"])if(p.some(t=>t===e))return!0;return!1}d=p.length>0}}const g=s.getValues(r,l)[0];let y=!1;if(g&&(f([g]),y="@default"in g),c=!1,0!==p.length||!y){if(p.length>0&&h)return!1;if(void 0===g){if(p.length>0)return!1;d=!0}else if(a.isObject(g))d=p.length>0;else if(n.isValue(g))d=p.some(e=>b(g,e));else if(n.isSubject(g)||n.isSubjectReference(g))d=p.some(t=>v(e,g,t,o));else if(n.isList(g)){const t=g["@list"][0];if(n.isList(p[0])){const r=p[0]["@list"];n.isValue(t)?d=r.some(e=>b(t,e)):(n.isSubject(t)||n.isSubjectReference(t))&&(d=r.some(r=>v(e,t,r,o)))}else d=!1}if(!d&&o.requireAll)return!1;u=u||d}}return c||u}function y(e,t){const r=e.uniqueEmbeds[e.graph],i=r[t],n=i.parent,o=i.property,c={"@id":t};if(a.isArray(n)){for(let e=0;e{const t=Object.keys(r);for(const i of t)i in r&&a.isObject(r[i].parent)&&r[i].parent["@id"]===e&&(delete r[i],u(i))};u(t)}function m(e,t,r){a.isObject(e)?s.addValue(e,t,r,{propertyIsArray:!0}):e.push(r)}function v(e,t,r,i){if(!("@id"in r))return!1;const n=e.subjects[r["@id"]];return n&&g(e,n,t,i)}function b(e,t){const r=t["@value"],i=t["@type"],n=t["@language"],s=e["@value"]?a.isArray(e["@value"])?e["@value"]:[e["@value"]]:[],o=e["@type"]?a.isArray(e["@type"])?e["@type"]:[e["@type"]]:[],c=e["@language"]?a.isArray(e["@language"])?e["@language"]:[e["@language"]]:[];return 0===s.length&&0===o.length&&0===c.length||!(!s.includes(r)&&!a.isEmptyObject(s[0]))&&(!!(!i&&0===o.length||o.includes(i)||i&&a.isEmptyObject(o[0]))&&!!(!n&&0===c.length||c.includes(n)||n&&a.isEmptyObject(c[0])))}e.exports=l,l.frameMergedOrDefault=(e,t,r)=>{const i={options:r,graph:"@default",graphMap:{"@default":{}},graphStack:[],subjectStack:[],link:{},bnodeMap:{}},n=new s.IdentifierIssuer("_:b");c(e,i.graphMap,"@default",n),r.merged&&(i.graphMap["@merged"]=u(i.graphMap),i.graph="@merged"),i.subjects=i.graphMap[i.graph];const a=[];return l.frame(i,Object.keys(i.subjects).sort(),t,a),r.pruneBlankNodeIdentifiers&&(r.bnodesToClear=Object.keys(i.bnodeMap).filter(e=>1===i.bnodeMap[e].length)),a},l.frame=(e,t,r,o,c=null)=>{f(r),r=r[0];const u=e.options,v={embed:h(r,u,"embed"),explicit:h(r,u,"explicit"),requireAll:h(r,u,"requireAll")},w=function(e,t,r,i){const n={};for(const a of t){const t=e.graphMap[e.graph][a];g(e,t,r,i)&&(n[a]=t)}return n}(e,t,r,v),C=Object.keys(w).sort();for(const t of C){const f=w[t];if("@link"===v.embed&&t in e.link){m(o,c,e.link[t]);continue}null===c?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{};const g={};if(g["@id"]=t,0===t.indexOf("_:")&&s.addValue(e.bnodeMap,t,g,{propertyIsArray:!0}),e.link[t]=g,"@never"===v.embed||p(f,e.graph,e.subjectStack))m(o,c,g);else{if("@last"===v.embed&&(t in e.uniqueEmbeds[e.graph]&&y(e,t),e.uniqueEmbeds[e.graph][t]={parent:o,property:c}),e.subjectStack.push({subject:f,graph:e.graph}),t in e.graphMap){let i=!1,n=null;"@graph"in r?(n=r["@graph"][0],a.isObject(n)||(n={}),i=!("@merged"===t||"@default"===t)):(i="@merged"!==e.graph,n={}),i&&(e.graphStack.push(e.graph),e.graph=t,l.frame(e,Object.keys(e.graphMap[t]).sort(),[n],g,"@graph"),e.graph=e.graphStack.pop)}for(const t of Object.keys(f).sort())if(i(t)){if(g[t]=s.clone(f[t]),"@type"===t)for(const t of f["@type"])0===t.indexOf("_:")&&s.addValue(e.bnodeMap,t,g,{propertyIsArray:!0})}else if(!v.explicit||t in r)for(let i of f[t]){const a=t in r?r[t]:d(v);if(n.isList(i)){const a={"@list":[]};m(g,t,a);const o=i["@list"];for(const c in o)if(i=o[c],n.isSubjectReference(i)){const n=t in r?r[t][0]["@list"]:d(v);l.frame(e,[i["@id"]],n,a,"@list")}else m(a,"@list",s.clone(i))}else n.isSubjectReference(i)?l.frame(e,[i["@id"]],a,g,t):b(a[0],i)&&m(g,t,s.clone(i))}for(const e of Object.keys(r).sort()){if(i(e))continue;const t=r[e][0]||{};if(!h(t,u,"omitDefault")&&!(e in g)){let r="@null";"@default"in t&&(r=s.clone(t["@default"])),a.isArray(r)||(r=[r]),g[e]=[{"@preserve":r}]}}if("@reverse"in r)for(const i of Object.keys(r["@reverse"]).sort()){const n=r["@reverse"][i];for(const r of Object.keys(e.subjects)){s.getValues(e.subjects[r],i).some(e=>e["@id"]===t)&&(g["@reverse"]=g["@reverse"]||{},s.addValue(g["@reverse"],i,[],{propertyIsArray:!0}),l.frame(e,[r],n,g["@reverse"][i],c))}}m(o,c,g),e.subjectStack.pop()}}}},function(e,t,r){"use strict";const i=r(5),{isArray:n,isObject:a,isString:s,isUndefined:o}=r(2),{isList:c,isValue:u,isGraph:l,isSimpleGraph:d,isSubjectReference:p}=r(9),{expandIri:h,getContextValue:f,isKeyword:g,process:y,processingMode:m}=r(15),{removeBase:v}=r(20),{addValue:b,asArray:w,compareShortestLeast:C}=r(4),E={};function S(e,t,r){if("@nest"!==h(e,t,{vocab:!0},r))throw new i("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}e.exports=E,E.compact=async({activeCtx:e,activeProperty:t=null,element:r,options:h={},compactionMap:v=(()=>{})})=>{if(n(r)){let i=[];for(let n=0;n1&&(_=Array.from(_).sort());const x=e;for(const t of _){const r=E.compactIri({activeCtx:x,iri:t,relativeTo:{vocab:!0}}),i=f(I,r,"@context");o(i)||(e=await y({activeCtx:e,localCtx:i,options:h,propagate:!1}))}const k=Object.keys(r).sort();for(const o of k){const p=r[o];if("@id"!==o)if("@type"!==o)if("@reverse"!==o)if("@preserve"!==o)if("@index"!==o)if("@graph"!==o&&"@list"!==o&&g(o)){const t=E.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}});b(T,t,p)}else{if(!n(p))throw new i("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===p.length){const t=E.compactIri({activeCtx:e,iri:o,value:p,relativeTo:{vocab:!0},reverse:C}),r=e.mappings.has(t)?e.mappings.get(t)["@nest"]:null;let i=T;r&&(S(e,r,h),a(T[r])||(T[r]={}),i=T[r]),b(i,t,p,{propertyIsArray:!0})}for(const t of p){const r=E.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:C}),i=e.mappings.has(r)?e.mappings.get(r)["@nest"]:null;let p=T;i&&(S(e,i,h),a(T[i])||(T[i]={}),p=T[i]);const g=f(e,r,"@container")||[],y=l(t),m=c(t);let I;m?I=t["@list"]:y&&(I=t["@graph"]);let A=await E.compact({activeCtx:e,activeProperty:r,element:m||y?I:t,options:h,compactionMap:v});if(m){if(n(A)||(A=[A]),g.includes("@list")){b(p,r,A,{valueIsArray:!0,allowDuplicate:!0});continue}A={[E.compactIri({activeCtx:e,iri:"@list",relativeTo:{vocab:!0}})]:A},"@index"in t&&(A[E.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])}if(y)if(g.includes("@graph")&&(g.includes("@id")||g.includes("@index")&&d(t))){let i;p.hasOwnProperty(r)?i=p[r]:p[r]=i={};const n=(g.includes("@id")?t["@id"]:t["@index"])||E.compactIri({activeCtx:e,iri:"@none",vocab:!0});b(i,n,A,{propertyIsArray:!h.compactArrays||g.includes("@set")})}else g.includes("@graph")&&d(t)?(n(A)&&A.length>1&&(A={"@included":A}),b(p,r,A,{propertyIsArray:!h.compactArrays||g.includes("@set")})):(n(A)&&1===A.length&&h.compactArrays&&(A=A[0]),A={[E.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}})]:A},"@id"in t&&(A[E.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t["@id"]),"@index"in t&&(A[E.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"]),b(p,r,A,{propertyIsArray:!h.compactArrays||g.includes("@set")}));else if(g.includes("@language")||g.includes("@index")||g.includes("@id")||g.includes("@type")){let i,n;if(p.hasOwnProperty(r)?i=p[r]:p[r]=i={},g.includes("@language"))u(A)&&(A=A["@value"]),n=t["@language"];else if(g.includes("@index")){const i=f(e,r,"@index")||"@index",a=E.compactIri({activeCtx:e,iri:i,vocab:!0});if("@index"===i)n=t["@index"],delete A[a];else{let e;if([n,...e]=w(A[i]||[]),s(n))switch(e.length){case 0:delete A[i];break;case 1:A[i]=e[0];break;default:A[i]=e}else n=null}}else if(g.includes("@id")){const t=E.compactIri({activeCtx:e,iri:"@id",vocab:!0});n=A[t],delete A[t]}else if(g.includes("@type")){const i=E.compactIri({activeCtx:e,iri:"@type",vocab:!0});let a;switch([n,...a]=w(A[i]||[]),a.length){case 0:delete A[i];break;case 1:A[i]=a[0];break;default:A[i]=a}1===Object.keys(A).length&&"@id"in t&&(A=await E.compact({activeCtx:e,activeProperty:r,element:{"@id":t["@id"]},options:h,compactionMap:v}))}n||(n=E.compactIri({activeCtx:e,iri:"@none",vocab:!0})),b(i,n,A,{propertyIsArray:g.includes("@set")})}else{const e=!h.compactArrays||g.includes("@set")||g.includes("@list")||n(A)&&0===A.length||"@list"===o||"@graph"===o;b(p,r,A,{propertyIsArray:e})}}}else{if((f(e,t,"@container")||[]).includes("@index"))continue;const r=E.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}});b(T,r,p)}else{const r=await E.compact({activeCtx:e,activeProperty:t,element:p,options:h,compactionMap:v});n(r)&&0===r.length||b(T,o,r)}else{const t=await E.compact({activeCtx:e,activeProperty:"@reverse",element:p,options:h,compactionMap:v});for(const r in t)if(e.mappings.has(r)&&e.mappings.get(r).reverse){const i=t[r],n=(f(e,r,"@container")||[]).includes("@set")||!h.compactArrays;b(T,r,i,{propertyIsArray:n}),delete t[r]}if(Object.keys(t).length>0){const r=E.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}});b(T,r,t)}}else{let t=w(p).map(e=>E.compactIri({activeCtx:I,iri:e,relativeTo:{vocab:!0}}));1===t.length&&(t=t[0]);const r=E.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}}),i=(f(e,r,"@container")||[]).includes("@set")&&m(e,1.1)||n(t)&&0===p.length;b(T,r,t,{propertyIsArray:i})}else{let t=w(p).map(t=>E.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1}}));1===t.length&&(t=t[0]);T[E.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t}}return T}return r},E.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:n={vocab:!1},reverse:s=!1})=>{if(null===t)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);const o=e.getInverse();if(g(t)&&t in o&&"@none"in o[t]&&"@type"in o[t]["@none"]&&"@none"in o[t]["@none"]["@type"])return o[t]["@none"]["@type"]["@none"];if(n.vocab&&t in o){const i=e["@language"]||"@none",n=[];a(r)&&"@index"in r&&!("@graph"in r)&&n.push("@index","@index@set"),a(r)&&"@preserve"in r&&(r=r["@preserve"][0]),l(r)?("@index"in r&&n.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r&&n.push("@graph@id","@graph@id@set"),n.push("@graph","@graph@set","@set"),"@index"in r||n.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r||n.push("@graph@id","@graph@id@set")):a(r)&&!u(r)&&n.push("@id","@id@set","@type","@set@type");let o="@language",d="@null";if(s)o="@type",d="@reverse",n.push("@set");else if(c(r)){"@index"in r||n.push("@list");const e=r["@list"];if(0===e.length)o="@any",d="@none";else{let t=0===e.length?i:null,r=null;for(let i=0;i=0;--i){const n=p[i],a=n.terms;for(const i of a){const a=i+":"+t.substr(n.iri.length);e.mappings.get(i)._prefix&&(!e.mappings.has(a)||null===r&&e.mappings.get(a)["@id"]===t)&&(null===d||C(a,d)<0)&&(d=a)}}if(null!==d)return d;for(const[r,n]of e.mappings)if(n&&n._prefix&&t.startsWith(r+":"))throw new i(`Absolute IRI "${t}" confused with prefix "${r}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:e});return n.vocab?t:v(e["@base"],t)},E.compactValue=({activeCtx:e,activeProperty:t,value:r,options:i})=>{if(u(r)){const i=f(e,t,"@type"),n=f(e,t,"@language"),a=f(e,t,"@container")||[],o="@index"in r&&!a.includes("@index");if(!o&&"@none"!==i&&(r["@type"]===i||r["@language"]===n))return r["@value"];const c=Object.keys(r).length,u=1===c||2===c&&"@index"in r&&!o,l="@language"in e,d=s(r["@value"]),p=e.mappings.has(t)&&null===e.mappings.get(t)["@language"];if(u&&"@none"!==i&&(!l||!d||p))return r["@value"];const h={};return o&&(h[E.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=r["@index"]),"@type"in r?h[E.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}})]=E.compactIri({activeCtx:e,iri:r["@type"],relativeTo:{vocab:!0}}):"@language"in r&&(h[E.compactIri({activeCtx:e,iri:"@language",relativeTo:{vocab:!0}})]=r["@language"]),h[E.compactIri({activeCtx:e,iri:"@value",relativeTo:{vocab:!0}})]=r["@value"],h}const n=h(e,t,{vocab:!0},i),a=f(e,t,"@type"),o=E.compactIri({activeCtx:e,iri:r["@id"],relativeTo:{vocab:"@vocab"===a}});return"@id"===a||"@vocab"===a||"@graph"===n?o:{[E.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]:o}}, /** * Removes the @preserve keywords as the last step of the compaction * algorithm when it is running on framed output. * * @param ctx the active context used to compact the input. * @param input the framed, compacted output. * @param options the compaction options used. * * @return the resulting output. */ E.removePreserve=(e,t,r)=>{if(n(t)){const i=[];for(let n=0;n{l=n(l),u=u||r(126);const d=r(127);return(new o).wrapLoader((function(r){return async function r(n,o){if(0!==n.indexOf("http:")&&0!==n.indexOf("https:"))throw new s('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:n});if(e&&0!==n.indexOf("https"))throw new s('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:n});let p,h=null;if(null!==h)return h;try{p=await function(e,t){return new Promise((r,i)=>{e(t,(e,t,n)=>{e?i(e):r({res:t,body:n})})})}(u,{url:n,headers:l,strictSSL:t,followRedirect:!1})}catch(e){throw new s("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:n,cause:e})}const{res:f,body:g}=p;h={contextUrl:null,documentUrl:n,document:g||null};const y=d.STATUS_CODES[f.statusCode];if(f.statusCode>=400)throw new s(`URL "${n}" could not be dereferenced: ${y}`,"jsonld.InvalidUrl",{code:"loading document failed",url:n,httpStatusCode:f.statusCode});if(f.headers.link&&"application/ld+json"!==f.headers["content-type"]){const e=i(f.headers.link)[a];if(Array.isArray(e))throw new s("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:n});e&&(h.contextUrl=e.target)}if(f.statusCode>=300&&f.statusCode<400&&f.headers.location){if(o.length===c)throw new s("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:n,httpStatusCode:f.statusCode,redirects:o});if(-1!==o.indexOf(n))throw new s("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:n,httpStatusCode:f.statusCode,redirects:o});return o.push(n),r(f.headers.location,o)}return o.push(n),h}(r,[])}))}},function(e,t){},function(e,t){},function(e,t,r){"use strict";const{parseLinkHeader:i,buildHeaders:n}=r(4),{LINK_HEADER_REL:a}=r(26),s=r(5),o=r(49),c=/(^|(\r\n))link:/i;e.exports=({secure:e,headers:t={},xhr:r}={headers:{}})=>{t=n(t);return(new o).wrapLoader((async function(n){if(0!==n.indexOf("http:")&&0!==n.indexOf("https:"))throw new s('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:n});if(e&&0!==n.indexOf("https"))throw new s('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:n});let o;try{o=await function(e,t,r){const i=new(e=e||XMLHttpRequest);return new Promise((e,n)=>{i.onload=()=>e(i),i.onerror=e=>n(e),i.open("GET",t,!0);for(const e in r)i.setRequestHeader(e,r[e]);i.send()})}(r,n,t)}catch(e){throw new s("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:n,cause:e})}if(o.status>=400)throw new s("URL could not be dereferenced: "+o.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:n,httpStatusCode:o.status});const u={contextUrl:null,documentUrl:n,document:o.response},l=o.getResponseHeader("Content-Type");let d;c.test(o.getAllResponseHeaders())&&(d=o.getResponseHeader("Link"));if(d&&"application/ld+json"!==l){if(d=i(d)[a],Array.isArray(d))throw new s("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:n});d&&(u.contextUrl=d.target)}return u}))}},function(e,t,r){"use strict";e.exports=e=>{class t{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,r)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i=r(27),n=r(21),{extendContextLoader:a,strictDocumentLoader:s}=r(77),{serializeError:o}=r(132),c=r(133),u=r(78);function l(e){Object.defineProperty(e,"toJSON",{value:function(){return o(this)},configurable:!0,writable:!0})}e.exports=class{async add(e,{suite:t,purpose:r,documentLoader:o,expansionMap:l,compactProof:d=!0}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!r)throw new TypeError('"options.purpose" is required.');if(t.legacy&&!(r instanceof u))throw new TypeError(`The "${t.type}" suite requires "options.purpose" to be an instance of "PublicKeyProofPurpose".`);let p;o=o?a(o):s,!1!==l&&(l=c),"string"==typeof e&&(e=await o(e)),p=d?await n.compact(e,i.SECURITY_CONTEXT_URL,{documentLoader:o,expansionMap:l,compactToRelative:!1}):{...e};const h=t.legacy?"signature":"proof";delete p[h];const f=await t.createProof({document:p,purpose:r,documentLoader:o,expansionMap:l,compactProof:d});if(d){let r;r=t.legacy?{[i.SECURITY_SIGNATURE_URL]:f}:{[i.SECURITY_PROOF_URL]:{"@graph":f}};const{types:a,alias:s}=await async function({document:e,documentLoader:t,expansionMap:r}){const i=n.getValues(e,"@context"),a=await n.compact({"@type":"_:b0"},i,{documentLoader:t,expansionMap:r});delete a["@context"];const s=Object.keys(a)[0],o={"@context":i};o["@type"]=n.getValues(e,"@type").concat(n.getValues(e,s));const c=(await n.expand(o,{documentLoader:t,expansionMap:r}))[0]||{};return{types:n.getValues(c,"@type"),alias:s}}({document:e,documentLoader:o,expansionMap:l});r["@type"]=a;const c=n.getValues(e,"@context"),u=await n.compact(r,c,{documentLoader:o,expansionMap:l,compactToRelative:!1});delete u[s],delete u["@context"];const d=Object.keys(u)[0];n.addValue(e,d,u[d])}else delete f["@context"],n.addValue(e,h,f);return e}async verify(e,{suite:t,purpose:r,documentLoader:o,expansionMap:d,compactProof:p=!0}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!r)throw new TypeError('"options.purpose" is required.');const h=Array.isArray(t)?t:[t];if(0===h.length)throw new TypeError("At least one suite is required.");const f=h.some(e=>e.legacy);if(f){if(h.some(e=>!e.legacy))throw new Error("Legacy suites may not be combined with current suites.");if(!(r instanceof u))throw new TypeError('"options.purpose" must be an instance of "PublicKeyProofPurpose"to use a legacy suite.')}o=o?a(o):s,!1!==d&&(d=c);try{e="string"==typeof e?await o(e):{...e};const{proofSet:t,document:a}=await async function({document:e,legacy:t,documentLoader:r,expansionMap:a,compactProof:s}){const o=t?"signature":"proof";let c;s&&(e=await n.compact(e,i.SECURITY_CONTEXT_URL,{documentLoader:r,expansionMap:a,compactToRelative:!1}));if(c=n.getValues(e,o),delete e[o],0===c.length)throw new Error("No matching proofs found in the given document.");return c=c.map(e=>({"@context":i.SECURITY_CONTEXT_URL,...e})),{proofSet:c,document:e}}({document:e,legacy:f,documentLoader:o,expansionMap:d,compactProof:p});e=a;const s=await async function({document:e,suites:t,proofSet:r,purpose:i,documentLoader:n,expansionMap:a,compactProof:s}){const o=await Promise.all(r.map(t=>i.match(t,{document:e,documentLoader:n,expansionMap:a}))),c=r.filter((e,t)=>o[t]);if(0===c.length)return[];return(await Promise.all(c.map(async r=>{for(const o of t)if(await o.matchProof({proof:r,document:e,documentLoader:n,expansionMap:a}))return o.verifyProof({proof:r,document:e,purpose:i,documentLoader:n,expansionMap:a,compactProof:s}).catch(e=>({verified:!1,error:e}))}))).map((e,t)=>e?(e.error&&l(e.error),{proof:c[t],...e}):null).filter(e=>e)}({document:e,suites:h,proofSet:t,purpose:r,documentLoader:o,expansionMap:d,compactProof:p});if(0===s.length)throw new Error("Could not verify any proofs; no proofs matched the required suite and purpose.");const c=s.some(e=>e.verified);if(!c){const e=[].concat(...s.filter(e=>e.error).map(e=>e.error)),t={verified:c,results:s};return e.length>0&&(t.error=e),t}return{verified:c,results:s}}catch(e){return l(e),{verified:!1,error:e}}}}},function(e,t,r){"use strict";const i=r(27);e.exports={[i.SECURITY_CONTEXT_V1_URL]:r(52),[i.SECURITY_CONTEXT_V2_URL]:r(53)}},function(e,t,r){"use strict";(function(t){class r extends Error{constructor(e){super(r._prepareSuperMessage(e)),Object.defineProperty(this,"name",{value:"NonError",configurable:!0,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(this,r)}static _prepareSuperMessage(e){try{return JSON.stringify(e)}catch{return String(e)}}}const i=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],n=Symbol(".toJSON called"),a=({from:e,seen:r,to_:s,forceEnumerable:o,maxDepth:c,depth:u})=>{const l=s||(Array.isArray(e)?[]:{});if(r.push(e),u>=c)return l;if("function"==typeof e.toJSON&&!0!==e[n])return(e=>{e[n]=!0;const t=e.toJSON();return delete e[n],t})(e);for(const[i,n]of Object.entries(e))"function"==typeof t&&t.isBuffer(n)?l[i]="[object Buffer]":"function"!=typeof n&&(n&&"object"==typeof n?r.includes(e[i])?l[i]="[Circular]":(u++,l[i]=a({from:e[i],seen:r.slice(),forceEnumerable:o,maxDepth:c,depth:u})):l[i]=n);for(const{property:t,enumerable:r}of i)"string"==typeof e[t]&&Object.defineProperty(l,t,{value:e[t],enumerable:!!o||r,configurable:!0,writable:!0});return l};e.exports={serializeError:(e,t={})=>{const{maxDepth:r=Number.POSITIVE_INFINITY}=t;return"object"==typeof e&&null!==e?a({from:e,seen:[],forceEnumerable:!0,maxDepth:r,depth:0}):"function"==typeof e?`[Function: ${e.name||"anonymous"}]`:e},deserializeError:(e,t={})=>{const{maxDepth:i=Number.POSITIVE_INFINITY}=t;if(e instanceof Error)return e;if("object"==typeof e&&null!==e&&!Array.isArray(e)){const t=new Error;return a({from:e,seen:[],to_:t,maxDepth:i,depth:0}),t}return new r(e)}}}).call(this,r(6).Buffer)},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */e.exports=e=>{if(e.unmappedProperty)throw new Error('The property "'+e.unmappedProperty+'" in the input was not defined in the context.')}},function(e,t,r){"use strict"; /*! * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. */class i extends Error{constructor(e){super("Verification error(s)."),this.name="VerificationError",this.errors=[].concat(e)}}e.exports=i},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i={};e.exports=i,i.suites={Ed25519Signature2018:r(136),JwsLinkedDataSignature:r(50),LinkedDataProof:r(82),LinkedDataSignature:r(80),RsaSignature2018:r(139)}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const{Ed25519KeyPair:i}=r(22),n=r(50);e.exports=class extends n{constructor({signer:e,key:t,creator:r,verificationMethod:n,proof:a,date:s,useNativeCanonize:o}={}){super({type:"Ed25519Signature2018",alg:"EdDSA",LDKeyClass:i,creator:r,verificationMethod:n,signer:e,key:t,proof:a,date:s,useNativeCanonize:o}),this.requiredKeyType="Ed25519VerificationKey2018"}}},function(e,t,r){"use strict";(function(t){ /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */ const r=void 0!==t&&t.versions&&t.versions.node,i=!r&&("undefined"!=typeof window||"undefined"!=typeof self);e.exports={nodejs:r,browser:i}}).call(this,r(11))},function(e,t){},function(e,t,r){"use strict"; /*!s * Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved. */const{RSAKeyPair:i}=r(22),n=r(50);e.exports=class extends n{constructor({signer:e,key:t,creator:r,verificationMethod:n,proof:a,date:s,useNativeCanonize:o}={}){super({type:"RsaSignature2018",alg:"PS256",LDKeyClass:i,creator:r,verificationMethod:n,signer:e,key:t,proof:a,date:s,useNativeCanonize:o}),this.requiredKeyType="RsaVerificationKey2018"}}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i={};e.exports=i,i.purposes={AssertionProofPurpose:r(141),AuthenticationProofPurpose:r(142),ControllerProofPurpose:r(33),ProofPurpose:r(79),PublicKeyProofPurpose:r(78)}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i=r(33);e.exports=class extends i{constructor({term:e="assertionMethod",controller:t,date:r,maxTimestampDelta:i=1/0}={}){super({term:e,controller:t,date:r,maxTimestampDelta:i})}}},function(e,t,r){"use strict"; /*! * Copyright (c) 2018 Digital Bazaar, Inc. All rights reserved. */const i=r(33);e.exports=class extends i{constructor({term:e="authentication",controller:t,challenge:r,date:i,domain:n,maxTimestampDelta:a=1/0}={}){if(super({term:e,controller:t,date:i,maxTimestampDelta:a}),"string"!=typeof r)throw new TypeError('"challenge" must be a string.');if(void 0!==n&&"string"!=typeof n)throw new TypeError('"domain" must be a string.');this.challenge=r,this.domain=n}async validate(e,{verificationMethod:t,documentLoader:r,expansionMap:i}){try{if(e.challenge!==this.challenge)throw new Error(`The challenge is not as expected; challenge="${e.challenge}", expected="${this.challenge}"`);if(void 0!==this.domain&&e.domain!==this.domain)throw new Error(`The domain is not as expected; domain="${e.domain}", expected="${this.domain}"`);return super.validate(e,{verificationMethod:t,documentLoader:r,expansionMap:i})}catch(e){return{valid:!1,error:e}}}async update(e,{document:t,suite:r,documentLoader:i,expansionMap:n}){return(e=await super.update(e,{document:t,suite:r,documentLoader:i,expansionMap:n})).challenge=this.challenge,void 0!==this.domain&&(e.domain=this.domain),e}}},function(e,t,r){"use strict";r.r(t),r.d(t,"sign",(function(){return S})),r.d(t,"verify",(function(){return E})),r.d(t,"pack",(function(){return I})),r.d(t,"unpack",(function(){return T})),r.d(t,"signAndPack",(function(){return A})),r.d(t,"unpackAndVerify",(function(){return _}));var i=r(22),n=r(21),a=r(10),s=r.n(a),o=r(54),c=r.n(o),u=r(52),l=r(53),d=r(83),p=r(84),h=r(55),f=r(85),g=r(86),y=r(87);const{RsaSignature2018:m}=s.a.suites,{AssertionProofPurpose:v}=s.a.purposes,{node:b}=n.documentLoaders;function w(e){const t={"https://w3id.org/security/v1":u,"https://w3id.org/security/v2":l,"https://www.w3.org/2018/credentials#":h,"https://www.w3.org/2018/credentials/v1":h,"https://cowin.gov.in/credentials/vaccination/v1":p.vaccinationContext,"https://w3id.org/vaccination/v1":f,"https://w3id.org/security/v3-unstable":d,"https://w3id.org/pathogen/v1":g,"https://w3id.org/dgc/v1":y};let r=t[e];return void 0!==r?{contextUrl:null,documentUrl:e,document:r}:e.startsWith("{")?JSON.parse(e):void console.log("Fallback url lookup for document: "+e,t)}async function C(e,t){try{const r=e,n=e.proof.verificationMethod,a={"@context":s.a.SECURITY_CONTEXT_URL,id:n,type:"RsaVerificationKey2018",controller:"https://cowin.gov.in/",publicKeyPem:t},o={"@context":s.a.SECURITY_CONTEXT_URL,id:"https://cowin.gov.in/",publicKey:[a],assertionMethod:[a.id]},c=new i.RSAKeyPair({...a});return(await s.a.verify(r,{suite:new m({key:c}),purpose:new v({controller:o}),documentLoader:w,compactProof:!1})).verified}catch(e){console.log("Invalid data",e)}}async function E(e,t){return await C(e,"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0i7R4XsyG3m6KD36qKEVxE+odCh68W2O4vLqh6SnsgItzvLYvJKPai+jEkf22FlPn0QnGo+Znyi6dw1lhvg9FGXqodv33yrqKhGLkQPeURaMnJidxktK/3QLXuv9HiKq9fSDLJyPBJEFCCCiZNTGgWM0dqq43/XRi+7IX3gWU68U6v/7EyOW3U4ZgYUVlfwbUh6eKRan68/TObQua39oeUfDMhJa0NHnMXb1lq/vQIjEgGkOK5LLyz+X8ETUEhn8Qdx2SIORmftCPW4XO0UZmMHuGw9t+UUgniy5BL8kmvtjpVRWFUliJFGBTvBZCO6gcoX5eXi8LytCg+mJ6EDO+QIDAQAB\n-----END PUBLIC KEY-----")||await C(e,"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnhht8e5qjjnzcpA8fWbdv7whEbseWdvDcwEptGqyGpLGen2bLUZ2KeKloF1+BxeNOHyd8/Po79uogLVs5TvlJvjYCyj668ZjNaqsqvvNz27izQuvUDsaDIawFO10o7QqBC1YhCeRzSfjpbzQr3bcCJ4+hdNH30os6jBa7TMlNJk+N297bQ+vI1TDl6AR3bl/bYIDx56aKIyK6APi5mdZUPyYbVw+gHv/4FTTnuWH76XQHkQBHOWvCSH1JTmB+HjX9xtDBt9BBW7z00H3sAf0gsYauDgjfNxKhm/boHdjJxUGDwxIkYIrz85fJCjL3sNvHI0l4kn4IrREsTUKZ1cBEwIDAQAB\n-----END PUBLIC KEY-----")||await C(e,"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyZle/tYFpdIEg+ppZpOejTBokp1Fl9IYgUDyojlGoiyAbHVDI7GuLkf64q3Iw9j5sj8DLgMDfv7KJdhUjBmhaUK0/cba+MPq18ChO4Y3v2CBMW+z5Q32BX2S7FjNC3FNCVF8NgKGwXjD8/67Iy7I4ZSvQkZ+TiRgBW6kpZI8sXplHxo5Z2dM6U3bEhwf/Mwhyr783qvhq2phify3t+YfBNRVD05XtZiLoIah9JnXon/xDJVEk1Yu7aPee8jqRjGJ0Zxfkwo2crTMdUuHwsAGbc2Vau3ch0U8+Ei6XTBvobFJvok535II30TsGokDGqbMsPQxzCkhiPZ8WE9Q5CUrlwIDAQAB\n-----END PUBLIC KEY-----\n")||!!t&&await C(e,t)}async function S(e,t,r){const n=JSON.parse(JSON.stringify(e)),a={"@context":s.a.SECURITY_CONTEXT_URL,id:"did:india",type:"RsaVerificationKey2018",controller:"https://cowin.gov.in/",privateKeyPem:t,publicKeyPem:r},o={"@context":s.a.SECURITY_CONTEXT_URL,id:"https://cowin.gov.in/",privateKey:[a],publicKey:[a],assertionMethod:[a.id]},c=new i.RSAKeyPair(a);return await s.a.sign(n,{documentLoader:w,suite:new m({key:c}),purpose:new v({controller:o}),compactProof:!1})}async function T(e){if(e.startsWith("PK")){var t=new c.a;const r=await t.loadAsync(e),i=await r.files["certificate.json"].async("text");return JSON.parse(i)}if(e.includes("did:india")||e.includes("did:srilanka"))return JSON.parse(e)}async function I(e){let t=JSON.stringify(e);var r=new c.a;return r.file("certificate.json",t,{compression:"DEFLATE",compressionOptions:{level:9}}),await r.generateAsync({type:"binarystring"})}async function A(e,t,r){return await I(await S(e,t,r))}async function _(e,t){try{const r=await T(e);return await E(r,t)?r:void 0}catch(e){return void console.log(e)}} /*! * Copyright (c) 2021 PathCheck Foundation. All rights reserved. */}])})); //# sourceMappingURL=divoc-sdk.min.js.map