worldwideweb 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,141 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("window"),require("fetch"),require("crypto"),require("TextEncoder")):"function"==typeof define&&define.amd?define(["window","fetch","crypto","TextEncoder"],t):"object"==typeof exports?exports.Mashlib=t(require("window"),require("fetch"),require("crypto"),require("TextEncoder")):e.Mashlib=t(e.window,e.fetch,e.crypto,e.TextEncoder)}(window,function(__WEBPACK_EXTERNAL_MODULE__47__,__WEBPACK_EXTERNAL_MODULE__56__,__WEBPACK_EXTERNAL_MODULE__72__,__WEBPACK_EXTERNAL_MODULE__402__){var _MathLN=Math.LN2,_Mathlog=Math.log,_Mathabs=Math.abs,_Mathround=Math.round,_Mathsin=Math.sin,_Mathcos=Math.cos,_MathPI=Math.PI,_Mathimul=Math.imul,_Mathclz=Math.clz32,_Mathmax=Math.max,_Mathceil=Math.ceil,_Mathfloor=Math.floor,_Mathpow=Math.pow,_StringfromCharCode=String.fromCharCode,_Mathmin=Math.min;return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=484)}([function(e,t,n){"use strict";var r=n(23),i={ns:n(6),rdf:r,acl:n(169),aclControl:n(288),authn:n(41),create:n(284),icons:n(16),log:n(15),matrix:n(283),messageArea:n(282),infiniteMessageArea:n(281),pad:n(90),preferences:n(280),store:n(8),style:n(42),table:n(279),tabs:n(278),utils:n(21),widgets:n(14)};e.exports=i},function(e,t){e.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";(function(e){function r(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(r()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=a.prototype:(null===e&&(e=new a(t)),e.length=t),e}function a(e,t,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(this,e)}return o(this,e,t,n)}function o(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,0>n||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),a.TYPED_ARRAY_SUPPORT?(e=t).__proto__=a.prototype:e=l(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if(("string"!=typeof n||""===n)&&(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(t,n),o=(e=i(e,r)).write(t,n);return o!==r&&(e=e.slice(0,o)),e}(e,t,n):function(e,t){if(a.isBuffer(t)){var n=0|c(t.length);return 0===(e=i(e,n)).length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||function(e){return e!=e}
2
- /*!
3
- * The buffer module from node.js, for the browser.
4
- *
5
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
6
- * @license MIT
7
- */(t.length)?i(e,0):l(e,t);if("Buffer"===t.type&&q(t.data))return l(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(0>e)throw new RangeError('"size" argument must not be negative')}function u(e,t){if(s(t),e=i(e,0>t?0:0|c(t)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function l(e,t){var n=0>t.length?0:0|c(t.length);e=i(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function c(e){if(e>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function d(e,t){if(a.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 n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return P(e).length;default:if(r)return L(e).length;t=(""+t).toLowerCase(),r=!0}}function h(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function f(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647<n?n=2147483647:-2147483648>n&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),0>n&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(0>n){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:p(e,t,n,r,i);if("number"==typeof t)return t&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):p(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function p(e,t,n,r,i){function a(e,t){return 1==s?e[t]:e.readUInt16BE(t*s)}var o,s=1,u=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=(r+"").toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(2>e.length||2>t.length)return-1;s=2,u/=2,l/=2,n/=2}if(i){var c=-1;for(o=n;o<u;o++)if(a(e,o)!==a(t,-1==c?0:o-c))-1!=c&&(o-=o-c),c=-1;else if(-1==c&&(c=o),o-c+1===l)return c*s}else for(n+l>u&&(n=u-l),o=n;0<=o;o--){for(var d=!0,h=0;h<l;h++)if(a(e,o+h)!==a(t,h)){d=!1;break}if(d)return o}return-1}function m(e,t,n,r){n=+n||0;var i=e.length-n;r?(r=+r)>i&&(r=i):r=i;var a=t.length;if(0!=a%2)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o,s=0;s<r;++s){if(o=parseInt(t.substr(2*s,2),16),isNaN(o))return s;e[n+s]=o}return s}function v(e,t,n,r){return D(L(t,e.length-n),e,n,r)}function g(e,t,n,r){return D(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function b(e,t,n,r){return g(e,t,n,r)}function y(e,t,n,r){return D(P(t),e,n,r)}function w(e,t,n,r){return D(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!(0>(t-=2));++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?B.fromByteArray(e):B.fromByteArray(e.slice(t,n))}function x(e,t,n){n=_Mathmin(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,u,l=e[i],c=null,d=239<l?4:223<l?3:191<l?2:1;if(i+d<=n)1==d?128>l&&(c=l):2==d?128==(192&(a=e[i+1]))&&(127<(u=(31&l)<<6|63&a)&&(c=u)):3==d?(a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(2047<(u=(15&l)<<12|(63&a)<<6|63&o)&&(55296>u||57343<u)&&(c=u))):4==d&&(a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(65535<(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)&&1114112>u&&(c=u)));null===c?(c=65533,d=1):65535<c&&(c-=65536,r.push(55296|1023&c>>>10),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=F)return _StringfromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=_StringfromCharCode.apply(String,e.slice(r,r+=F));return n}(r)}function M(e,t,n){var r="";n=_Mathmin(e.length,n);for(var i=t;i<n;++i)r+=_StringfromCharCode(127&e[i]);return r}function k(e,t,n){var r="";n=_Mathmin(e.length,n);for(var i=t;i<n;++i)r+=_StringfromCharCode(e[i]);return r}function C(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=R(e[a]);return i}function E(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=_StringfromCharCode(r[a]+256*r[a+1]);return i}function A(e,t,n){if(0!=e%1||0>e)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function S(e,t,n,r){0>t&&(t=65535+t+1);for(var i=0,a=_Mathmin(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function I(e,t,n,r){0>t&&(t=4294967295+t+1);for(var i=0,a=_Mathmin(e.length-n,4);i<a;++i)e[n+i]=255&t>>>8*(r?i:3-i)}function N(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(0>n)throw new RangeError("Index out of range")}function j(e,t,n,r,i){return i||N(e,0,n,4),U.write(e,t,n,r,23,4),n+4}function O(e,t,n,r,i){return i||N(e,0,n,8),U.write(e,t,n,r,52,8),n+8}function R(e){return 16>e?"0"+e.toString(16):e.toString(16)}function L(e,t){t=t||1/0;for(var n,r=e.length,i=null,a=[],o=0;o<r;++o){if(55295<(n=e.charCodeAt(o))&&57344>n){if(!i){if(56319<n){-1<(t-=3)&&a.push(239,191,189);continue}if(o+1===r){-1<(t-=3)&&a.push(239,191,189);continue}i=n;continue}if(56320>n){-1<(t-=3)&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&-1<(t-=3)&&a.push(239,191,189);if(i=null,128>n){if(0>(t-=1))break;a.push(n)}else if(2048>n){if(0>(t-=2))break;a.push(192|n>>6,128|63&n)}else if(65536>n){if(0>(t-=3))break;a.push(224|n>>12,128|63&n>>6,128|63&n)}else{if(!(1114112>n))throw new Error("Invalid code point");if(0>(t-=4))break;a.push(240|n>>18,128|63&n>>12,128|63&n>>6,128|63&n)}}return a}function P(e){return B.toByteArray(function(e){if(2>(e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(z,"")).length)return"";for(;0!=e.length%4;)e+="=";return e}(e))}function D(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}var B=n(476),U=n(475),q=n(220);t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0===e.TYPED_ARRAY_SUPPORT?function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}():e.TYPED_ARRAY_SUPPORT,t.kMaxLength=r(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return o(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return function(e,t,n,r){return s(t),0>=t?i(e,t):void 0===n?i(e,t):"string"==typeof r?i(e,t).fill(n,r):i(e,t).fill(n)}(null,e,t,n)},a.allocUnsafe=function(e){return u(null,e)},a.allocUnsafeSlow=function(e){return u(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=_Mathmin(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},a.isEncoding=function(e){switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!q(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=a.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(0!=e%2)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(0!=e%4)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(0!=e%8)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},a.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?x(this,0,e):function(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return x(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),0>t||n>e.length||0>r||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,u=_Mathmin(o,s),l=this.slice(r,i),c=e.slice(t,n),d=0;d<u;++d)if(l[d]!==c[d]){o=l[d],s=c[d];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},a.prototype.indexOf=function(e,t,n){return f(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return f(this,e,t,n,!1)},a.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),0<e.length&&(0>n||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return g(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return y(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;a.prototype.slice=function(e,t){var n,r=this.length;if(e=~~e,t=void 0===t?r:~~t,0>e?0>(e+=r)&&(e=0):e>r&&(e=r),0>t?0>(t+=r)&&(t=0):t>r&&(t=r),t<e&&(t=e),a.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=a.prototype;else{var i=t-e;n=new a(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},a.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},a.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=this[e+--t],i=1;0<t&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=_Mathpow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=t,i=1,a=this[e+--r];0<r&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=_Mathpow(2,8*t)),a},a.prototype.readInt8=function(e,t){return t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),U.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),U.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),U.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),U.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||T(this,e,t,n,_Mathpow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=255&e/i;return t+n},a.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||T(this,e,t,n,_Mathpow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;0<=--i&&(a*=256);)this[t+i]=255&e/a;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=_Mathfloor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):S(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):S(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=_Mathpow(2,8*n-1);T(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)0>e&&0==s&&0!==this[t+a-1]&&(s=1),this[t+a]=255&(e/o>>0)-s;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=_Mathpow(2,8*n-1);T(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;0<=--a&&(o*=256);)0>e&&0==s&&0!==this[t+a+1]&&(s=1),this[t+a]=255&(e/o>>0)-s;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=_Mathfloor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):S(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):S(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return O(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return O(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0<r&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;0<=i;--i)e[i+t]=this[i+n];else if(1e3>o||!a.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},a.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);256>i&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(0>t||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=a.isBuffer(e)?e:L(new a(e,r).toString()),u=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%u]}return this};var z=/[^+\/0-9A-Za-z-_]/g}).call(this,n(5))},function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return o(e,t,n)}var a=n(2),o=a.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=a:(r(a,t),t.Buffer=i),r(o,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0===t?r.fill(0):"string"==typeof n?r.fill(t,n):r.fill(t),r},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t){var n=e.exports={};n.list=[],n.paneForIcon=[],n.paneForPredicate=[],n.register=function(e,t){if(e.requireQueryButton=t,e.name)if(console.log(" registering pane: "+e.name),e.label){if(n.list.push(e),e.name in n||(n[e.name]=e),e.icon&&(n.paneForIcon[e.icon]=e),e.predicates)for(var r in e.predicates)n.paneForPredicate[r]={pred:r,code:e.predicates[r]}}else console.log("*** No label for pane!");else console.log("*** No name for pane!")},n.byName=function(e){for(var t=0;t<n.list.length;t++)if(n.list[t].name===e)return n.list[t];return null}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={};e.exports=r;var i=n(23);r.expand=function(e){var t=e.split(":");if(0===t.length)throw new Error("Prefixed name has no colon: "+e);if(!(t[0]in r))throw new Error("Unregistered namespace prefix in: "+e);return r[t[0]](t[1])},r.auth=i.Namespace("http://www.w3.org/ns/auth/acl#"),r.acl=i.Namespace("http://www.w3.org/ns/auth/acl#"),r.arg=i.Namespace("http://www.w3.org/ns/pim/arg#"),r.cal=i.Namespace("http://www.w3.org/2002/12/cal/ical#"),r.contact=i.Namespace("http://www.w3.org/2000/10/swap/pim/contact#"),r.dc=i.Namespace("http://purl.org/dc/elements/1.1/"),r.dct=i.Namespace("http://purl.org/dc/terms/"),r.doap=i.Namespace("http://usefulinc.com/ns/doap#"),r.foaf=i.Namespace("http://xmlns.com/foaf/0.1/"),r.http=i.Namespace("http://www.w3.org/2007/ont/http#"),r.httph=i.Namespace("http://www.w3.org/2007/ont/httph#"),r.icalTZ=i.Namespace("http://www.w3.org/2002/12/cal/icaltzd#"),r.ldp=i.Namespace("http://www.w3.org/ns/ldp#"),r.link=r.tab=r.tabont=i.Namespace("http://www.w3.org/2007/ont/link#"),r.log=i.Namespace("http://www.w3.org/2000/10/swap/log#"),r.meeting=i.Namespace("http://www.w3.org/ns/pim/meeting#"),r.mo=i.Namespace("http://purl.org/ontology/mo/"),r.owl=i.Namespace("http://www.w3.org/2002/07/owl#"),r.pad=i.Namespace("http://www.w3.org/ns/pim/pad#"),r.patch=i.Namespace("http://www.w3.org/ns/pim/patch#"),r.qu=i.Namespace("http://www.w3.org/2000/10/swap/pim/qif#"),r.trip=i.Namespace("http://www.w3.org/ns/pim/trip#"),r.rdf=i.Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),r.rdfs=i.Namespace("http://www.w3.org/2000/01/rdf-schema#"),r.rss=i.Namespace("http://purl.org/rss/1.0/"),r.sched=i.Namespace("http://www.w3.org/ns/pim/schedule#"),r.schema=i.Namespace("http:/schema.org/"),r.sioc=i.Namespace("http://rdfs.org/sioc/ns#"),r.solid=i.Namespace("http://www.w3.org/ns/solid/terms#"),r.space=i.Namespace("http://www.w3.org/ns/pim/space#"),r.stat=i.Namespace("http://www.w3.org/ns/posix/stat#"),r.ui=i.Namespace("http://www.w3.org/ns/ui#"),r.vcard=i.Namespace("http://www.w3.org/2006/vcard/ns#"),r.wf=i.Namespace("http://www.w3.org/2005/01/wf/flow#"),r.xsd=i.Namespace("http://www.w3.org/2001/XMLSchema#")},function(e,t,n){"use strict";var r=t;r.version=n(339).version,r.utils=n(338),r.rand=n(150),r.curve=n(68),r.curves=n(332),r.ec=n(324),r.eddsa=n(320)},function(e,t,n){"use strict";var r=n(23),i=e.exports=r.graph();r.fetcher(i),i.updater=new r.UpdateManager(i),console.log("Unique quadstore initialized.")},function(e,t,n){var r=n(114)("wks"),i=n(78),a=n(10).Symbol,o="function"==typeof a;(e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:i)("Symbol."+e))}).store=r},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function a(){p&&h&&(p=!1,h.length?f=h.concat(f):m=-1,f.length&&o())}function o(){if(!p){var e=i(a);p=!0;for(var t=f.length;t;){for(h=f,f=[];++m<t;)h&&h[m].run();m=-1,t=f.length}h=null,p=!1,function(e){if(c===clearTimeout)return clearTimeout(e);if((c===r||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}(e)}}function s(e,t){this.fun=e,this.array=t}function u(){}var l,c,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{c="function"==typeof clearTimeout?clearTimeout:r}catch(e){c=r}}();var h,f=[],p=!1,m=-1;d.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new s(e,t)),1!==f.length||p||i(o)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=u,d.addListener=u,d.once=u,d.off=u,d.removeListener=u,d.removeAllListeners=u,d.emit=u,d.prependListener=u,d.prependOnceListener=u,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(49),a=n(19),o=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(n.termType=t.termType,e&&e.termType===t.termType&&(e=e.value),!e)throw new Error("Missing IRI for NamedNode");if(!e.includes(":"))throw new Error('NamedNode IRI "'+e+'" must be absolute.');if(e.includes(" "))throw new Error('Error: NamedNode IRI "'+e+'" must not contain unencoded spaces.');return n.value=e,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a),r(t,[{key:"dir",value:function(){var e=this.uri.split("#")[0],n=e.slice(0,-1).lastIndexOf("/"),r=e.indexOf("//");return 0<=r&&n<r+2||0>n?null:new t(e.slice(0,n+1))}},{key:"site",value:function(){var e=this.uri.split("#")[0],n=e.indexOf("//");if(0>n)throw new Error("This URI does not have a web site part (origin)");var r=e.indexOf("/",n+2);if(0>r)throw new Error("This URI does not have a web site part. (origin)");return new t(e.slice(0,r+1))}},{key:"doc",value:function(){return 0>this.uri.indexOf("#")?this:new t(this.uri.split("#")[0])}},{key:"toString",value:function(){return"<"+this.uri+">"}},{key:"uri",get:function(){return this.value},set:function(e){this.value=e}}],[{key:"fromValue",value:function(e){return void 0===e||null===e?e:e&&e.termType?e:new t(e)}}]),t}();o.termType="NamedNode",o.prototype.classOrder=i.NamedNode,o.prototype.isVar=0,e.exports=o},function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},function(e,t,n){"use strict";function r(e,t){if(t){var n=e.statusArea||e.div||function(e){var t=e.statusArea||e.div||null;if(t)return t;var n=e.dom;if(n||"undefined"==typeof document||(n=document),n){var r=n.getElementsByTagName("body")[0];return t=n.createEvent("div"),r.insertBefore(t,r.firstElementChild),e.statusArea=t,t}return null}(e);console.log("Complaint: "+t),n?n.appendChild(s.errorMessageBlock(e.dom,t)):alert(t)}}function i(e,t,n,r,i,a,s){var u=e.createElement("div"),l=e.createTextNode(n),c=o.store.updater.editable(s.uri);l.style="colour: black; font-size: 100%; padding-left: 0.5 em; padding-right: 0.5 em;",u.appendChild(l);var d=e.createElement("input");u.appendChild(d),d.setAttribute("type","checkbox"),d.setAttribute("style","margin: 0.7em"),i&&i.object&&!i.why&&(i.why=s),r&&r.object&&!r.why&&(r.why=s);var h=t.holds(i);if(r){var f=t.holds(r);if(h&&f)return u.appendChild(o.widgets.errorMessageBlock(e,"Inconsistent data in store!\n"+i+" and\n"+r)),u;h||f||(h=!!t.any(a,o.ns.ui("default")))}if(d.checked=h,!c)return u;return d.addEventListener("click",function(t){var n,a;l.style="color: #bbb;",this.checked?(n=i,a=r&&f?r:[],o.store.updater.update(a,n,function(t,n,r){n?(l.style="color: #black;",h=!0,f=!1):(l.style="color: #black; background-color: #fee;",u.appendChild(o.widgets.errorMessageBlock(e,"Error updating store (setting boolean, checked) :\n\n"+r)),d.checked=!1)})):(n=r,a=i,o.store.updater.update(a,n,function(t,n,i){l.className="question",n?(l.style="color: #black;",h=!1,f=!!r):(l.style="color: #black; background-color: #fee;",u.appendChild(o.widgets.errorMessageBlock(e,"Error updating store (unchecked):\n\n"+i)),d.checked=!0)}))},!1),u}var a=e.exports=Object.assign({},n(378),n(136),n(66),{buildCheckboxForm:i,complain:r}),o={icons:n(16),log:n(15),ns:n(6),store:n(8),style:n(42),widgets:a},s=n(66),u=n(21),l=o.icons.iconBase+"noun_1180156.svg",c=o.icons.iconBase+"noun_1180158.svg";o.widgets.field={},o.widgets.clearElement=function(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e},o.widgets.refreshTree=function(e){if(e.refresh)e.refresh();else for(var t=0;t<e.children.length;t++)o.widgets.refreshTree(e.children[t])},o.widgets.extractLogURI=function(e){var t=e.search(/logFile=/),n=e.search(/&rulesFile=/);return e.substring(t+8,n)},o.widgets.shortDate=function(e,t){if(!e)return"???";try{var n=(new Date).toISOString();return e.slice(0,10)!==n.slice(0,10)||t?e.slice(0,4)===n.slice(0,4)?["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(e.slice(5,7),10)-1]+" "+parseInt(e.slice(8,10),10):e.slice(0,10):e.slice(11,16)}catch(t){return"shortdate:"+t}},o.widgets.formatDateTime=function(e,t){return t.split("{").map(function(t){var n=t.split("}")[0];return t?("000"+(e["get"+n]()+({Month:1}[n]||0))).slice(-({Milliseconds:3,FullYear:4}[n]||2))+t.split("}")[1]:""}).join("")},o.widgets.timestamp=function(){return o.widgets.formatDateTime(new Date,"{FullYear}-{Month}-{Date}T{Hours}:{Minutes}:{Seconds}.{Milliseconds}")},o.widgets.shortTime=function(){return o.widgets.formatDateTime(new Date,"{Hours}:{Minutes}:{Seconds}.{Milliseconds}")},o.widgets.newThing=function(e){var t=new Date;return $rdf.sym(e.uri+"#id"+t.getTime())},o.widgets.setName=function(e,t){var n=o.store,r=o.ns,i=function(e){var t=n.any(e,r.vcard("fn"))||n.any(e,r.foaf("name"))||n.any(e,r.vcard("organization-name"));return t?t.value:null},a=t.sameTerm(r.foaf("Agent"))?"Everyone":i(t);e.textContent=a||u.label(t),!a&&t.uri&&n.fetcher.nowOrWhenFetched(t.doc(),void 0,function(n){e.textContent=i(t)||u.label(t)})},o.widgets.imagesOf=function(e,t){var n=o.ns;return t.each(e,n.sioc("avatar")).concat(t.each(e,n.foaf("img"))).concat(t.each(e,n.vcard("logo"))).concat(t.each(e,n.vcard("photo"))).concat(t.each(e,n.foaf("depiction")))},o.widgets.setImage=function(e,t){var n=o.store,r=o.ns,i=o.icons.iconBase,a=function(e){if(e.sameTerm(r.foaf("Agent"))||e.sameTerm(r.rdf("Resource")))return i+"noun_98053.svg";var t=n.any(e,r.sioc("avatar"))||n.any(e,r.foaf("img"))||n.any(e,r.vcard("logo"))||n.any(e,r.vcard("hasPhoto"))||n.any(e,r.vcard("photo"))||n.any(e,r.foaf("depiction"));return t?t.uri:null},s=function(e){var t=n.findTypeURIs(e);if(r.solid("AppProvider").uri in t)return i+"noun_15177.svg";if(e.uri){if(4===e.uri.split("/").length&&!e.uri.split("/")[1]&&!e.uri.split("/")[3])return i+"noun_15177.svg";if(e.uri.startsWith("message:")||e.uri.startsWith("mid:"))return i+"noun_480183.svg";if(e.uri.startsWith("mailto:"))return i+"noun_567486.svg";if(e.uri.startsWith("https:")&&0>e.uri.indexOf("#"))return e.site().uri+"favicon.ico"}return r.solid("AppProviderClass").uri in t?i+"noun_144.svg":r.vcard("Group").uri in t||r.rdfs("Class").uri in t?i+"noun_339237.svg":r.vcard("Organization").uri in t||r.rdfs("Class").uri in t?i+"noun_143899.svg":r.vcard("Individual").uri in t||r.foaf("Person").uri in t?i+"noun_15059.svg":r.vcard("AddressBook").uri in t?i+"noun_15695.svg":"http://www.w3.org/ns/pim/trip#Trip"in t?i+"noun_581629.svg":r.meeting("Meeting").uri in t?i+"noun_66617.svg":i+"noun_10636_grey.svg"},u=a(t);e.setAttribute("src",u||s(t)),!u&&t.uri&&n.fetcher.nowOrWhenFetched(t.doc(),void 0,function(n){e.setAttribute("src",a(t)||s(t))})};o.widgets.deleteButtonWithCheck=function(e,t,n,r){var i=o.icons.iconBase+"noun_2188_red.svg",a=e.createElement("img");a.setAttribute("src",i),a.setAttribute("style","margin: 0.2em; width: 1em; height:1em"),a.title="Remove this "+n;var s=a;return t.appendChild(s),t.setAttribute("class","hoverControl"),s.setAttribute("class","hoverControlHide"),s.addEventListener("click",function(i){t.removeChild(s);var a=e.createElement("button");a.setAttribute("style",o.style.buttonStyle);var u=a.appendChild(e.createElement("img"));u.setAttribute("src",l),u.setAttribute("style",o.style.buttonStyle),t.appendChild(a).addEventListener("click",function(e){t.removeChild(c),t.removeChild(a),t.appendChild(s)},!1);var c=e.createElement("button");c.textContent="Delete "+n,c.setAttribute("style",o.style.buttonStyle),t.appendChild(c).addEventListener("click",function(e){t.removeChild(c),t.removeChild(a),r()},!1)},!1),s},o.widgets.button=function(e,t,n){var r=e.createElement("button");r.setAttribute("type","button"),r.setAttribute("style",o.style.buttonStyle);var i=r.appendChild(e.createElement("img"));return i.setAttribute("src",t),i.setAttribute("style","width: 2em; height: 2em;"),r},o.widgets.cancelButton=function(e){return o.widgets.button(e,l,"Cancel")},o.widgets.continueButton=function(e){return o.widgets.button(e,c,"Continue")},o.widgets.askName=function(e,t,n,r,i,a){return new Promise(function(t,s){var l=e.createElement("div");r=r||o.ns.foaf("name");var c=(a=a||(i?u.label(i):" "))+" "+u.label(r)+": ";l.appendChild(e.createElement("p")).textContent=c;var d=e.createElement("input");d.setAttribute("type","text"),d.setAttribute("size","100"),d.setAttribute("maxLength","2048"),d.setAttribute("style",o.style.textInputStyle),d.select(),l.appendChild(d),n.appendChild(l);var h=function(){l.parentNode.removeChild(l),t(d.value)};d.addEventListener("keyup",function(e){13===e.keyCode&&h()},!1),l.appendChild(e.createElement("br")),l.appendChild(o.widgets.cancelButton(e)).addEventListener("click",function(e){l.parentNode.removeChild(l),t(null)},!1),l.appendChild(o.widgets.continueButton(e)).addEventListener("click",function(e){h()},!1)})},o.widgets.linkIcon=function(e,t,n){var r=e.createElement("a");r.setAttribute("href",t.uri),t.uri.startsWith("http")&&r.setAttribute("target","_blank");var i=r.appendChild(e.createElement("img"));return i.setAttribute("src",n||o.icons.originalIconBase+"go-to-this.png"),i.setAttribute("style","margin: 0.3em;"),r},o.widgets.personTR=function(e,t,n,r){var i=e.createElement("tr");r=r||{};var a=i.appendChild(e.createElement("td")),s=i.appendChild(e.createElement("td")),u=i.appendChild(e.createElement("td")),l=function(e,t){var n=e.createElement("img");if(n.setAttribute("src",o.icons.iconBase+(function(e){if(!e.uri)return!1;var t=e.uri.split("/");return 3===t.length||4===t.length&&""===t[3]}(t)?"noun_15177.svg":"noun_681601.svg")),t.uri&&t.uri.startsWith("https:")&&0>t.uri.indexOf("#")){var r=e.createElement("object");return r.setAttribute("data",t.site().uri+"favicon.ico"),r.setAttribute("type","image/x-icon"),r.appendChild(n),r}return o.widgets.setImage(n,t),n}(e,n);if(a.setAttribute("style","vertical-align: middle; width:2.5em; padding:0.5em; height: 2.5em;"),s.setAttribute("style","vertical-align: middle; text-align:left;"),u.setAttribute("style","vertical-align: middle; width:2em; padding:0.5em; height: 4em;"),l.setAttribute("style","width: 3em; height: 3em; margin: 0.1em; border-radius: 1em;"),a.appendChild(l),o.widgets.setName(s,n),r.deleteFunction&&o.widgets.deleteButtonWithCheck(e,u,r.noun||"one",r.deleteFunction),n.uri){if(!1!==r.link)u.appendChild(o.widgets.linkIcon(e,n)).classList.add("HoverControlHide"),u.appendChild(e.createElement("br"));!1!==r.draggable&&(l.setAttribute("draggable","false"),o.widgets.makeDraggable(i,n))}return i},o.widgets.refreshTree=function e(t){if(t.refresh)t.refresh();else for(var n=0;n<t.children.length;n++)e(t.children[n])},o.widgets.attachmentList=function(e,t,n,i){var a=(i=i||{}).doc||t.doc();void 0===i.modify&&(i.modify=!0);var s=i.modify,l=i.promptIcon||o.icons.iconBase+"noun_748003.svg",c=i.predicate||o.ns.wf("attachment"),d=i.noun||"attachment",h=o.store,f=n.appendChild(e.createElement("table"));f.setAttribute("style","margin-top: 1em; margin-bottom: 1em;");var p=f.appendChild(e.createElement("tr")),m=p.appendChild(e.createElement("td")),v=p.appendChild(e.createElement("td")).appendChild(e.createElement("table"));v.appendChild(e.createElement("tr"));var g=function(e){h.updater.update($rdf.st(t,c,e,a),[],function(e,t,n,i){t?y():r("Error deleting one: "+n)})},b=function(t){var n=t,r={noun:d};return s&&(r.deleteFunction=function(){g(n)}),o.widgets.personTR(e,c,t,r)},y=v.refresh=function(){var e=h.each(t,c);e.sort(),u.syncTableToArray(v,e,b)};f.refresh=y,y();if(s){var w=m.appendChild(e.createElement("img"));w.setAttribute("src",l),w.setAttribute("style","width; 2em; height: 2em; margin: 0.5em;"),w.setAttribute("draggable","false"),o.widgets.makeDropTarget(m,function(e){var n=[];e.map(function(e){var r=$rdf.sym(e);console.log("Dropped on attachemnt "+e),n.push($rdf.st(t,c,r,a))}),h.updater.update([],n,function(e,t,n,i){t?y():r("Error adding one: "+n)})})}return f},o.widgets.field[o.ns.ui("Form").uri]=o.widgets.field[o.ns.ui("Group").uri]=function(e,t,n,r,i,a,s){var u=o.store,l=e.createElement("div");l.setAttribute("style","padding-left: 2em; border: 0.05em solid brown;");var c=o.ns.ui;t.appendChild(l);var d=r.toNT()+"|"+i.toNT();if(n[d]){l.appendChild(e.createTextNode("Group: see above "+d));var h=[$rdf.st(r,o.ns.owl("sameAs"),r)];return e.outlineManager.appendPropertyTRs(l,h),l}var f={};for(var p in n)f[p]=1;f[d]=1;var m,v=u.any(i,c("parts"));if(v?m=v.elements:(v=u.each(i,c("part")),m=o.widgets.sortBySequence(v)),!v)return l.appendChild(o.widgets.errorMessageBlock(e,"No parts to form! ")),e;for(var g=[],b=[],y=0;y<m.length;y++){var w=m[y];if(o.widgets.bottomURI(w)===c("Options").uri){var _=u.any(w,c("dependingOn"));_&&u.any(r,_)&&(b[y]=u.any(r,_).toNT())}var x=o.widgets.fieldFunction(e,w);g.push(x(e,l,f,r,w,a,function(t,i){if(t)for(var d=0;d<m.length;d++){var h=m[d];if(o.widgets.bottomURI(h)===c("Options").uri){var f=u.any(h,c("dependingOn")),p=x(e,l,n,r,h,a,s);l.removeChild(p),l.insertBefore(p,g[d]),l.removeChild(g[d]),b[d]=u.any(r,f).toNT(),g[d]=p}}s(t,i)}))}return l},o.widgets.field[o.ns.ui("Options").uri]=function(e,t,n,r,i,a,s){var u=o.store,l=e.createElement("div"),c=o.ns.ui;t.appendChild(l);var d=u.any(i,c("dependingOn"));d||(d=o.ns.rdf("type"));var h,f=u.each(i,c("case"));if(f||l.appendChild(o.widgets.errorMessageBlock(e,"No cases to Options form. ")),d.sameTerm(o.ns.rdf("type")))h=u.findTypeURIs(r);else{var p=u.any(r,d);void 0===p?l.appendChild(o.widgets.errorMessageBlock(e,"Can't select subform as no value of: "+d)):(h={})[p.uri]=!0}for(var m=0;m<f.length;m++)for(var v=f[m],g=u.each(v,c("for")),b=0;b<g.length;b++)if(h[g[b].uri]){var y=u.the(v,c("use"));if(!y)return l.appendChild(o.widgets.errorMessageBlock(e,'No "use" part for case in form '+i)),l;o.widgets.appendForm(e,l,n,r,y,a,s);break}return l},o.widgets.field[o.ns.ui("Multiple").uri]=function(e,t,n,r,i,a,s){var l=o.icons.iconBase+"noun_19460_green.svg",c=o.store;c.updater=c.updater||new $rdf.UpdateManager(c);var d=e.createElement("table"),h=o.ns.ui;t.appendChild(d);var f=c.any(i,h("property"));if(!f)return d.appendChild(o.widgets.errorMessageBlock(e,"No property to multiple: "+i)),d;var p=c.any(i,h("min"));p=p?p.value:0;var m=c.any(i,h("part"));if(!m)return d.appendChild(o.widgets.errorMessageBlock(e,"No part to multiple: "+i)),d;var v=d.appendChild(e.createElement("tr")),g=d.appendChild(e.createElement("tr")),b=g.appendChild(e.createElement("img"));b.setAttribute("src",l),b.setAttribute("style","margin: 0.2em; width: 1em; height:1em"),b.title="Click to add one or more "+u.label(f);var y=g.appendChild(e.createElement("span")),w=function(t,i){o.log.debug("Multiple add: "+i),i||(i=o.widgets.newThing(a));var l=d.insertBefore(e.createElement("tr"),g),h=function(e,t,n){return s(t,n)},p=o.widgets.fieldFunction(e,m)(e,v,n,i,m,a,function(t,n,u){if(n){if(!c.holds(r,f,i)){var d=[$rdf.st(r,f,i,a)];c.updater.update([],d,h)}}else l.appendChild(o.widgets.errorMessageBlock(e,"Multiple: item failed: "+v)),s(n,u)});o.widgets.deleteButtonWithCheck(e,p,u.label(f),function(){if(c.holds(r,f,i)){var t=[$rdf.st(r,f,i,a)];c.updater.update(t,[],function(t,n,r){n?v.removeChild(p):v.appendChild(o.widgets.errorMessageBlock(e,"Multiple: delete failed: "+r))})}})},_=c.each(r,f);y.textContent=(0===_.length?"Add one or more ":"Add more ")+u.label(f),_.map(function(e){w(0,e)});for(var x=p-_.length,M=0;M<x;M++)console.log("Adding extra: min "+p),w();return g.addEventListener("click",w,!0),d},o.widgets.fieldParams={},o.widgets.fieldParams[o.ns.ui("ColorField").uri]={size:9,type:"color",dt:"color"},o.widgets.fieldParams[o.ns.ui("ColorField").uri].pattern=/^\s*#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]([0-9a-f][0-9a-f])?\s*$/,o.widgets.fieldParams[o.ns.ui("DateField").uri]={size:20,type:"date",dt:"date"},o.widgets.fieldParams[o.ns.ui("DateField").uri].pattern=/^\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?Z?\s*$/,o.widgets.fieldParams[o.ns.ui("DateTimeField").uri]={size:20,type:"date",dt:"dateTime"},o.widgets.fieldParams[o.ns.ui("DateTimeField").uri].pattern=/^\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?(T[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)?Z?\s*$/,o.widgets.fieldParams[o.ns.ui("TimeField").uri]={size:10,type:"time",dt:"time"},o.widgets.fieldParams[o.ns.ui("TimeField").uri].pattern=/^\s*([0-2]?[0-9]:[0-5][0-9](:[0-5][0-9])?)\s*$/,o.widgets.fieldParams[o.ns.ui("IntegerField").uri]={size:12,style:"text-align: right",dt:"integer"},o.widgets.fieldParams[o.ns.ui("IntegerField").uri].pattern=/^\s*-?[0-9]+\s*$/,o.widgets.fieldParams[o.ns.ui("DecimalField").uri]={size:12,style:"text-align: right",dt:"decimal"},o.widgets.fieldParams[o.ns.ui("DecimalField").uri].pattern=/^\s*-?[0-9]*(\.[0-9]*)?\s*$/,o.widgets.fieldParams[o.ns.ui("FloatField").uri]={size:12,style:"text-align: right",dt:"float"},o.widgets.fieldParams[o.ns.ui("FloatField").uri].pattern=/^\s*-?[0-9]*(\.[0-9]*)?((e|E)-?[0-9]*)?\s*$/,o.widgets.fieldParams[o.ns.ui("SingleLineTextField").uri]={},o.widgets.fieldParams[o.ns.ui("NamedNodeURIField").uri]={namedNode:!0},o.widgets.fieldParams[o.ns.ui("TextField").uri]={},o.widgets.fieldParams[o.ns.ui("PhoneField").uri]={size:20,uriPrefix:"tel:"},o.widgets.fieldParams[o.ns.ui("PhoneField").uri].pattern=/^\s*\+?[ 0-9-]+[0-9]\s*$/,o.widgets.fieldParams[o.ns.ui("EmailField").uri]={size:30,uriPrefix:"mailto:"},o.widgets.fieldParams[o.ns.ui("EmailField").uri].pattern=/^\s*.*@.*\..*\s*$/,o.widgets.field[o.ns.ui("PhoneField").uri]=o.widgets.field[o.ns.ui("EmailField").uri]=o.widgets.field[o.ns.ui("ColorField").uri]=o.widgets.field[o.ns.ui("DateField").uri]=o.widgets.field[o.ns.ui("DateTimeField").uri]=o.widgets.field[o.ns.ui("TimeField").uri]=o.widgets.field[o.ns.ui("NumericField").uri]=o.widgets.field[o.ns.ui("IntegerField").uri]=o.widgets.field[o.ns.ui("DecimalField").uri]=o.widgets.field[o.ns.ui("FloatField").uri]=o.widgets.field[o.ns.ui("TextField").uri]=o.widgets.field[o.ns.ui("SingleLineTextField").uri]=o.widgets.field[o.ns.ui("NamedNodeURIField").uri]=function(e,t,n,r,i,a,s){var u=o.ns.ui,l=o.store,c=e.createElement("tr");t.appendChild(c);var d=e.createElement("td");d.setAttribute("class","formFieldName"),d.setAttribute("style"," vertical-align: middle;"),c.appendChild(d);var h=e.createElement("td");h.setAttribute("class","formFieldValue"),c.appendChild(h);var f=l.any(i,u("property"));if(!f)return c.appendChild(e.createTextNode("Error: No property given for text field: "+i)),c;d.appendChild(o.widgets.fieldLabel(e,f,i));var p=o.widgets.bottomURI(i),m=o.widgets.fieldParams[p];void 0===m&&(m={});var v=m.style||"font-size: 100%; margin: 0.1em; padding: 0.1em;",g=e.createElement("input");h.appendChild(g),g.setAttribute("type",m.type?m.type:"text");var b=l.any(i,u("size"));g.setAttribute("size",b?""+b:m.size?""+m.size:"20");var y=l.any(i,u("maxLength"));g.setAttribute("maxLength",y?""+y:"4096"),a=a||o.widgets.fieldStore(r,f,a);var w=l.any(r,f,void 0,a);return w||(w=l.any(i,u("default")))&&l.add(r,f,w,a),w&&w.uri&&m.uriPrefix?g.value=decodeURIComponent(w.uri.replace(m.uriPrefix,"")).replace(/ /g,""):w&&(g.value=w.value||w.uri),g.setAttribute("style",v),g.addEventListener("keyup",function(e){m.pattern&&g.setAttribute("style",v+(g.value.match(m.pattern)?"color: green;":"color: red;"))},!0),g.addEventListener("change",function(t){if(!m.pattern||g.value.match(m.pattern)){g.disabled=!0,g.setAttribute("style",v+"color: gray;");var n,i=l.statementsMatching(r,f);m.namedNode?n=l.sym(g.value):m.uriPrefix?(n=encodeURIComponent(g.value.replace(/ /g,"")),n=l.sym(m.uriPrefix+g.value)):n=m.dt?new $rdf.Literal(g.value.trim(),void 0,o.ns.xsd(m.dt)):new $rdf.Literal(g.value);var u=$rdf.st(r,f,n,a);l.updater.update(i,u,function(t,n,r){n?(g.disabled=!1,g.setAttribute("style",v)):c.appendChild(o.widgets.errorMessageBlock(e,r)),s(n,r)})}},!0),c},o.widgets.field[o.ns.ui("MultiLineTextField").uri]=function(e,t,n,r,i,a,s){var u=o.ns.ui,l=o.store,c=l.any(i,u("property"));if(!c)return o.widgets.errorMessageBlock(e,"No property to text field: "+i);t.appendChild(o.widgets.fieldLabel(e,c,i)),a=o.widgets.fieldStore(r,c,a);var d=o.widgets.makeDescription(e,l,r,c,a,s);return t.appendChild(d),d},o.widgets.field[o.ns.ui("BooleanField").uri]=function(e,t,n,r,a,s,l){var c=o.ns.ui,d=o.store,h=d.any(a,c("property"));if(!h)return t.appendChild(o.widgets.errorMessageBlock(e,"No property to boolean field: "+a));var f=d.any(a,c("label"));f||(f=u.label(h,!0)),s=o.widgets.fieldStore(r,h,s);var p=d.any(r,h);void 0===p&&(p=!1);var m=$rdf.st(r,h,!0,s),v=i(e,d,f,$rdf.st(r,h,!1,s),m,a,s);return t.appendChild(v),v},o.widgets.field[o.ns.ui("Classifier").uri]=function(e,t,n,r,i,a,s){var u=o.store,l=o.ns.ui,c=u.any(i,l("category"));if(!c)return o.widgets.errorMessageBlock(e,"No category for classifier: "+i);o.log.debug("Classifier: store="+a);var d=o.widgets.makeSelectForNestedCategory(e,u,r,c,a,function(e,t){return s(e,t)});return t.appendChild(d),d},o.widgets.field[o.ns.ui("Choice").uri]=function(e,t,n,r,i,a,s){var l,c=o.ns.ui,d=o.ns,h=o.store,f=e.createElement("tr");t.appendChild(f);var p=e.createElement("td");f.appendChild(p);var m=e.createElement("td");f.appendChild(m);var v=h.any(i,c("property"));if(!v)return o.widgets.errorMessageBlock(e,"No property for Choice: "+i);p.appendChild(o.widgets.fieldLabel(e,v,i));var g=h.any(i,c("from"));if(!g)return o.widgets.errorMessageBlock(e,"No 'from' for Choice: "+i);var b,y=h.any(i,c("use")),w=[],_={multiple:!1,nullLabel:"--"+u.label(v)+"-?",disambiguate:!1};for(var x in w=h.each(void 0,d.rdf("type"),g),h.findMembersNT(g))w.push(h.fromNT(x));if(g.sameTerm(d.rdfs("Class")))for(l in o.widgets.allClassURIs())w.push(h.sym(l));else if(g.sameTerm(d.rdf("Property"))){for(l in(b=o.widgets.propertyTriage()).op)w.push(h.fromNT(l));for(l in b.dp)w.push(h.fromNT(l));_.disambiguate=!0}else if(g.sameTerm(d.owl("ObjectProperty"))){for(l in(b=o.widgets.propertyTriage()).op)w.push(h.fromNT(l));_.disambiguate=!0}else if(g.sameTerm(d.owl("DatatypeProperty"))){for(l in(b=o.widgets.propertyTriage()).dp)w.push(h.fromNT(l));_.disambiguate=!0}var M=h.any(r,v),k=o.widgets.sortByLabel(w);h.any(i,c("canMintNew"))&&(_.mint="* New *",_.subForm=y);var C=o.widgets.makeSelectForOptions(e,h,r,v,k,_,a,s);return m.appendChild(C),M&&y&&(M=h.any(r,v),o.widgets.fieldFunction(e,y)(e,m,n,M,y,a,s)),f},o.widgets.fieldParams[o.ns.ui("Comment").uri]={element:"p",style:"padding: 0.1em 1.5em; color: brown; white-space: pre-wrap;"},o.widgets.fieldParams[o.ns.ui("Heading").uri]={element:"h3",style:"font-size: 110%; color: brown;"},o.widgets.field[o.ns.ui("Comment").uri]=o.widgets.field[o.ns.ui("Heading").uri]=function(e,t,n,r,i,a,s){var u=o.ns.ui,l=o.store,c=l.any(i,u("contents"));c||(c="Error: No contents in comment field.");var d=o.widgets.bottomURI(i),h=o.widgets.fieldParams[d];void 0===h&&(h={});var f=e.createElement("div");t.appendChild(f);var p=f.appendChild(e.createElement(h.element));p.textContent=c;var m=l.any(i,u("style"));return void 0===m&&(m=h.style?h.style:""),m&&p.setAttribute("style",m),f},o.widgets.openHrefInOutlineMode=function(e){e.preventDefault(),e.stopPropagation();var t=u.getTarget(e).getAttribute("href");if(!t)return console.log("openHrefInOutlineMode: No href found!\n");var n=window.document;n.outlineManager?n.outlineManager.GotoSubject(o.store.sym(t),!0,void 0,!0,void 0):window&&window.panes&&window.panes.getOutliner?window.panes.getOutliner().GotoSubject(o.store.sym(t),!0,void 0,!0,void 0):console.log("ERROR: Can't access outline manager in this config")},o.widgets.defaultAnnotationStore=function(e){if(void 0!==e.uri){var t=e.uri;if("http://"===t.slice(0,7)){var n=(t=t.slice(7)).indexOf("#");if(0<=n)t=t.slice(0,n);else{var r=t.lastIndexOf("/");if(0>r)return;t=t.slice(0,r)}return o.store.sym("http://tabulator.org/wiki/annnotation/"+t)}}},o.widgets.fieldStore=function(e,t,n){var r=o.store.statementsMatching(e,t);return 0===r.length?n:0<r.length&&r[0].why.uri&&o.store.updater.editable(r[0].why.uri,o.store)?o.store.sym(r[0].why.uri):null},o.widgets.allClassURIs=function(){var e={};return o.store.statementsMatching(void 0,o.ns.rdf("type"),void 0).map(function(t){t.object.uri&&(e[t.object.uri]=!0)}),o.store.statementsMatching(void 0,o.ns.rdfs("subClassOf"),void 0).map(function(t){t.object.uri&&(e[t.object.uri]=!0),t.subject.uri&&(e[t.subject.uri]=!0)}),o.store.each(void 0,o.ns.rdf("type"),o.ns.rdfs("Class")).map(function(t){t.uri&&(e[t.uri]=!0)}),e},o.widgets.propertyTriage=function(){var e={},t=o.store,n={},r={},i=0,a=0,s=0,u=t.predicateIndex;for(var l in u){"Literal"===u[l][0].object.termType?(n[l]=!0,a++):(r[l]=!0,i++)}for(var c=t.each(void 0,o.ns.rdf("type"),o.ns.rdf("Property")),d=0;d<c.length;d++)l=c[d].toNT(),o.log.debug("propertyTriage: unknown: "+l),r[l]||n[l]||(n[l]=!0,r[l]=!0,s++);return e.op=r,e.dp=n,o.log.info("propertyTriage: "+i+" non-lit, "+a+" literal. "+s+" unknown."),e},o.widgets.fieldLabel=function(e,t,n){var r=o.store.any(n,o.ns.ui("label"));if(r||(r=u.label(t,!0)),void 0===t)return e.createTextNode("@@Internal error: undefined property");var i=e.createElement("a");return t.uri&&i.setAttribute("href",t.uri),i.setAttribute("style","color: #3B5998; text-decoration: none;"),i.textContent=r,i},o.widgets.bottomURI=function(e){var t=o.store,n=t.findTypeURIs(e),r=t.bottomTypeURIs(n),i=[];for(var a in r)i.push(a);return i[0]},o.widgets.fieldFunction=function(e,t){var n=o.widgets.bottomURI(t),r=o.widgets.field[n];return o.log.debug("paneUtils: Going to implement field "+t+" of type "+n),r||function(){return o.widgets.errorMessageBlock(e,"No handler for field "+t+" of type "+n)}},o.widgets.editFormButton=function(e,t,n,r,i){var a=e.createElement("button");return a.setAttribute("type","button"),a.innerHTML="Edit "+u.label(o.ns.ui("Form")),a.addEventListener("click",function(s){o.widgets.appendForm(e,t,{},n,o.ns.ui("FormForm"),r,i).setAttribute("style",o.ns.ui("FormForm").sameTerm(n)?"background-color: #fee;":"background-color: #ffffe7;"),t.removeChild(a)},!0),a},o.widgets.linkButton=function(e,t){var n=e.createElement("button");return n.setAttribute("type","button"),n.textContent="Goto "+u.label(t),n.addEventListener("click",function(n){e.outlineManager.GotoSubject(t,!0,void 0,!0,void 0)},!0),n},o.widgets.removeButton=function(e,t){var n=e.createElement("button");return n.setAttribute("type","button"),n.textContent="✕",n.addEventListener("click",function(e){t.parentNode.removeChild(t)},!0),n},o.widgets.appendForm=function(e,t,n,r,i,a,s){return o.widgets.fieldFunction(e,i)(e,t,n,r,i,a,s)},o.widgets.propertiesForClass=function(e,t){var n=o.ns,r=e.each(void 0,n.rdf("range"),t);[n.rdfs("comment"),n.dc("title"),n.foaf("name"),n.foaf("homepage")].map(function(e){r.push(e)});var i=e.each(void 0,n.rdf("type"),t);60<i.length&&(i=i.slice(0,60));for(var a={},s=0;s<(60<i.length?60:i.length);s++)e.statementsMatching(i[s],void 0,void 0).map(function(e){a[e.predicate.uri]=!0});r.map(function(e){a[e.uri]=!0});var u=[];for(var l in a)u.push(e.sym(l));return u},o.widgets.findClosest=function(e,t,n){for(var r=[e.sym(t)];0<r.length;){var i=r.shift(),a=e.each(i,n);if(o.log.debug("Lists for "+i+", "+n+": "+a.length),0!==a.length)return a;for(var s=e.each(i,o.ns.rdfs("subClassOf")),u=0;u<s.length;u++)r.push(s[u]),o.log.debug("findClosest: add super: "+s[u])}return[]},o.widgets.formsFor=function(e){var t=o.ns,n=o.store;o.log.debug("formsFor: subject="+e);var r,i=n.findTypeURIs(e);for(r in i)o.log.debug(" type: "+r);var a=n.bottomTypeURIs(i),s=[];for(var u in a)o.log.debug("formsFor: trying bottom type ="+u),s=(s=s.concat(o.widgets.findClosest(n,u,t.ui("creationForm")))).concat(o.widgets.findClosest(n,u,t.ui("annotationForm")));return o.log.debug("formsFor: subject="+e+", forms="),s},o.widgets.sortBySequence=function(e){var t=e.map(function(e){return[o.store.any(e,o.ns.ui("sequence"))||9999,e]});return t.sort(function(e,t){return e[0]-t[0]}),t.map(function(e){return e[1]})},o.widgets.sortByLabel=function(e){var t=e.map(function(e){return[u.label(e).toLowerCase(),e]});return t.sort(),t.map(function(e){return e[1]})},o.widgets.newButton=function(e,t,n,r,i,a,s,l){var c=e.createElement("button");return c.setAttribute("type","button"),c.innerHTML="New "+u.label(i),c.addEventListener("click",function(u){c.parentNode.appendChild(o.widgets.promptForNew(e,t,n,r,i,a,s,l))},!1),c},o.widgets.promptForNew=function(e,t,n,r,i,a,s,l){var c=o.ns,d=e.createElement("form");if(!a){var h=o.widgets.findClosest(t,i.uri,c.ui("creationForm"));if(0===h.length){d.appendChild(e.createElement("p")).textContent="I am sorry, you need to provide information about a "+u.label(i)+" but I don't know enough information about those to ask you.";var f=d.appendChild(e.createElement("button"));return f.setAttribute("type","button"),f.setAttribute("style","float: right;"),f.innerHTML="Goto "+u.label(i),f.addEventListener("click",function(t){e.outlineManager.GotoSubject(i,!0,void 0,!0,void 0)},!1),d}o.log.debug("lists[0] is "+h[0]),a=h[0]}o.log.debug("form is "+a),d.setAttribute("style","border: 0.05em solid brown; color: brown"),d.innerHTML="<h3>New "+u.label(i)+"</h3>";var p=o.widgets.fieldFunction(e,a),m=o.widgets.newThing(s),v=!1,g=function(e,t,n){return l(t,n)};o.log.info("paneUtils Object is "+m);var b=p(e,d,{},m,a,s,function(a,u){if(!a)return l(a,u);var h=[];n&&!t.holds(n,r,m,s)&&h.push($rdf.st(n,r,m,s)),n&&!t.holds(m,c.rdf("type"),i,s)&&h.push($rdf.st(m,c.rdf("type"),i,s)),h.length?o.store.updater.update([],h,g):l(!0,u),v||(v=d.appendChild(o.widgets.linkButton(e,m)))});return o.widgets.removeButton(e,b).setAttribute("style","float: right;"),d.AJAR_subject=m,d},o.widgets.makeDescription=function(e,t,n,r,i,a){var s=e.createElement("div"),l=t.statementsMatching(n,r,void 0);if(1<l.length)return o.widgets.errorMessageBlock(e,"Should not be "+l.length+" i.e. >1 "+r+" of "+n);var c=l.length?l[0].object.value:void 0,d=e.createElement("textarea");s.appendChild(d),d.rows=c?c.split("\n").length+2:2,d.cols=80;var h="font-size:100%; white-space: pre-wrap; background-color: white; border: 0.07em solid gray; padding: 1em 0.5em; margin: 1em 1em;";d.setAttribute("style",h),l.length?d.value=c:d.select(),s.refresh=function(){var e=t.any(n,r);e&&e.value!==d.value&&(d.value=e.value)};var f=e.createElement("br");s.appendChild(f);var p=e.createElement("input");p.setAttribute("type","submit"),p.disabled=!0,p.setAttribute("style","visibility: hidden; float: right;"),p.value="Save "+u.label(r),s.appendChild(p);var m=function(u){p.disabled=!0,p.setAttribute("style","visibility: hidden; float: right;"),d.disabled=!0,d.setAttribute("style",h+"color: gray;");var l=t.statementsMatching(n,r),c=$rdf.st(n,r,d.value,i);o.store.updater.update(l,c,function(t,n,r){n?(d.setAttribute("style",h+"color: black;"),d.disabled=!1):s.appendChild(o.widgets.errorMessageBlock(e,"Error (while saving change to "+i.uri+"): "+r)),a&&a(n,r)})};return d.addEventListener("keyup",function(e){d.setAttribute("style",h+"color: green;"),p&&(p.disabled=!1,p.setAttribute("style","float: right;"))},!0),d.addEventListener("change",m,!0),p.addEventListener("click",m,!1),s},o.widgets.makeSelectForOptions=function(e,t,n,r,i,a,s,l){o.log.debug("Select list length now "+i.length);for(var c,d=0,h={},f=0;f<i.length;f++)(c=i[f]).uri in h||(h[c.uri]=!0,d++);if(0==d&&!a.mint)return o.widgets.errorMessageBlock(e,"Can't do selector with no options, subject= "+n+" property = "+r+".");o.log.debug("makeSelectForOptions: store="+s);var p=function(){return m={},r.sameTerm(o.ns.rdf("type"))?m=t.findTypeURIs(n):t.each(n,r).map(function(e){m[e.uri]=!0}),m},m=p(),v=e.createElement("select");for(var g in v.setAttribute("style","margin: 0.6em 1.5em;"),a.multiple&&v.setAttribute("multiple","true"),v.currentURI=null,v.refresh=function(){m=p();for(var e,t=0;t<v.children.length;t++)(e=v.children[t]).AJAR_uri&&(e.selected=e.AJAR_uri in m);v.disabled=!1},h){var b=t.sym(g),y=e.createElement("option");a.disambiguate?y.appendChild(e.createTextNode(u.labelWithOntology(b,!0))):y.appendChild(e.createTextNode(u.label(b,!0)));var w=t.any(b,t.sym("http://www.w3.org/ns/ui#backgroundColor"));w&&y.setAttribute("style","background-color: "+w.value+"; "),y.AJAR_uri=g,g in m&&(y.setAttribute("selected","true"),v.currentURI=g),v.appendChild(y)}if(a.mint){var _=e.createElement("option");_.appendChild(e.createTextNode(a.mint)),_.AJAR_mint=!0,v.insertBefore(_,v.firstChild)}if(null==v.currentURI&&!a.multiple){var x=e.createElement("option");x.appendChild(e.createTextNode(a.nullLabel)),v.insertBefore(x,v.firstChild),x.selected=!0}return v.addEventListener("change",function(i){function u(e,t){l(e,t)}v.disabled=!0;for(var c,d=[],h=[],f=function(e){t.holds(n,r,e,s)&&d.push($rdf.st(n,r,e,s))},g=0;g<v.options.length;g++){if((c=v.options[g]).selected&&c.AJAR_mint){var b;if(a.mintClass){var y=o.widgets.promptForNew(e,t,n,r,a.mintClass,null,s,function(e,t){e||l(e,t)});v.parentNode.appendChild(y),b=y.AJAR_subject}else b=o.widgets.newThing(s);h.push($rdf.st(n,r,b,s)),a.mintStatementsFun&&(h=h.concat(a.mintStatementsFun(b)))}c.AJAR_uri&&(c.selected&&!(c.AJAR_uri in m)&&h.push($rdf.st(n,r,t.sym(c.AJAR_uri),s)),!c.selected&&c.AJAR_uri in m&&f(t.sym(c.AJAR_uri)),c.selected&&(v.currentURI=c.AJAR_uri))}for(var w=v.subSelect;w&&w.currentURI;)f(t.sym(w.currentURI)),w=w.subSelect;for(w=v.superSelect;w&&w.currentURI;)f(t.sym(w.currentURI)),w=w.superSelect;o.log.info("selectForOptions: stote = "+s),o.store.updater.update(d,h,function(t,n,r){m=p(),n&&(v.disabled=!1,b)&&o.widgets.fieldFunction(e,a.subForm)(e,v.parentNode,{},b,a.subForm,s,u),l&&l(n,r)})},!1),v},o.widgets.makeSelectForCategory=function(e,t,n,r,i,a){var s,u=o.log,l=t.any(r,o.ns.owl("disjointUnionOf")),c=!1;return l?s=l.elements:(s=t.each(void 0,o.ns.rdfs("subClassOf"),r),c=!0),u.debug("Select list length "+s.length),0===s.length?o.widgets.errorMessageBlock(e,"Can't do "+(c?"multiple ":"")+"selector with no subclasses of category: "+r):1===s.length?o.widgets.errorMessageBlock(e,"Can't do "+(c?"multiple ":"")+"selector with only 1 subclass of category: "+r+":"+s[1]):o.widgets.makeSelectForOptions(e,t,n,o.ns.rdf("type"),s,{multiple:c,nullPrompt:"--classify--"},i,a)},o.widgets.makeSelectForNestedCategory=function(e,t,n,r,i,a){var s,u=e.createElement("span"),l=null;s=o.widgets.makeSelectForCategory(e,t,n,r,i,function(e,t){e&&c(),a(e,t)}),u.appendChild(s);var c=function(){l&&(u.removeChild(l),l=null),s.currentURI&&t.any(t.sym(s.currentURI),o.ns.owl("disjointUnionOf"))&&(l=o.widgets.makeSelectForNestedCategory(e,t,n,t.sym(s.currentURI),i,a),s.subSelect=l.firstChild,s.subSelect.superSelect=s,u.appendChild(l))};return c(),u},o.widgets.selectorPanel=function(e,t,n,r,i,a,s,u,l){return o.widgets.selectorPanelRefresh(e.createElement("div"),e,t,n,r,i,a,s,u,l)},o.widgets.selectorPanelRefresh=function(e,t,n,r,i,a,s,u,l,c){var d="border: 0.1em solid #ddd; border-bottom: none; width: 95%; height: 2em; padding: 0.5em;",h=null;e.innerHTML="";for(var f,p=function(e,s){var f,p,m=function(){var e=a?n.each(void 0,i,s):n.each(s,i);y.setAttribute("class",0===e.length?"hideTillHover":""),p.setAttribute("src",u.connectIcon||o.icons.iconBase+"noun_25830.svg"),p.setAttribute("title",e.length?e.length:"attach")},v=o.widgets.index.twoLine.widgetForClass(r);(f=v(t,s)).setAttribute("style",d);var g=t.createElement("div");g.setAttribute("class","hideTillHover"),g.setAttribute("style","float:right; width:10%");var b=t.createElement("a");b.setAttribute("href",s.uri),b.setAttribute("style","float:right"),g.appendChild(b).textContent=">",e.appendChild(g);var y=t.createElement("div");return y.setAttribute("style",(a?"float:left;":"float:right;")+" width:30px;"),p=t.createElement("img"),m(),y.appendChild(p),e.appendChild(y),f.addEventListener("click",function(e){h===f?(f.setAttribute("style",d),h=null):(h&&h.setAttribute("style",d),f.setAttribute("style",d+"background-color: #ccc; color:black;"),h=f),l(s,e,h===f),m()},!1),p.addEventListener("click",function(e){c(s,e,a,m)},!1),e.appendChild(f),e},m=0;m<s.length;m++)f=t.createElement("div"),e.appendChild(f),p(f,s[m]);return e},o.widgets.index={},o.widgets.index.line={},o.widgets.index.twoLine={},o.widgets.index.twoLine[""]=function(e,t){var n=e.createElement("div");return n.textContent=u.label(t),n},o.widgets.index.twoLine.widgetForClass=function(e){var t=o.widgets.index.twoLine[e.uri],n=o.store;if(t)return t;var r=n.findSuperClassesNT(e);for(var i in r)if(t=o.widgets.index.twoLine[n.fromNT(i).uri])return t;return o.widgets.index.twoLine[""]},o.widgets.index.twoLine["http://www.w3.org/2000/10/swap/pim/qif#Transaction"]=function(e,t){var n="",r=function(e){var r=o.store.any(t,o.ns.qu(e));return r||(n+="@@ No value for "+e+"! "),r?u.escapeForXML(r.value):"?"},i=e.createElement("table");return i.innerHTML='<tr><td colspan="2">'+r("payee")+"</td></tr>\n<tr><td><td>"+r("date").slice(0,10)+'</td><td style="text-align: right;">'+r("amount")+"</td></tr>",n&&(i.innerHTML='<tr><td><a href="'+u.escapeForXML(t.uri)+'">'+u.escapeForXML(n)+"</a></td></tr>"),i},o.widgets.index.twoLine["http://www.w3.org/ns/pim/trip#Trip"]=function(e,t){var n=function(e){var n=o.store.any(t,e);return n?u.escapeForXML(n.value):"?"},r=e.createElement("table");return r.innerHTML='<tr><td colspan="2">'+n(o.ns.dc("title"))+'</td></tr>\n<tr style="color: #777"><td><td>'+n(o.ns.cal("dtstart"))+"</td><td>"+n(o.ns.cal("dtend"))+"</td></tr>",r},o.widgets.addStyleSheet=function(e,t){for(var n=e.querySelectorAll("link"),r=0;r<n.length;r++)if("stylesheet"===(n[r].getAttribute("rel")||"")&&(n[r].getAttribute("href")||"")===t)return;var i=e.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",t),e.getElementsByTagName("head")[0].appendChild(i)},o.widgets.isAudio=function(e){return o.widgets.isImage(e,"audio")},o.widgets.isVideo=function(e){return o.widgets.isImage(e,"video")},o.widgets.isImage=function(e,t){var n=t||"image",r=o.store.findTypeURIs(e),i=$rdf.Util.mediaTypeClass(n+"/*").uri.split("*")[0];for(var a in r)if(a.startsWith(i))return!0;return!!({audio:"http://purl.org/dc/dcmitype/Sound",image:"http://purl.org/dc/dcmitype/Image",video:"http://purl.org/dc/dcmitype/MovingImage"}[n]in r)}},function(e,t,n){"use strict";e.exports=function(){var e={};return e.level=7,e.ascending=!1,e.msg=function(t,n,r){if(n||(n=4,r="mesg"),e.level&n)if("undefined"!=typeof document){var i=document.getElementById("status");if(!i)return;var a=document.createElement("span");a.setAttribute("class",r);var o=new Date;a.innerHTML=o.getHours()+":"+o.getMinutes()+":"+o.getSeconds()+" ["+r+"] "+function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;")}(t)+"<br/>",e.ascending?i.insertBefore(a,i.firstChild):i.appendChild(a)}else"undefined"!=typeof console&&console.log(t)},e.warn=function(t){e.msg(t,2,"warn")},e.debug=function(t){e.msg(t,32,"dbug")},e.info=function(t){e.msg(t,16,"info")},e.error=function(t){e.msg(t,1,"eror")},e.success=function(t){e.msg(t,8,"good")},e.alert="undefined"==typeof alert?e.warn:alert,e.clear=function(){var e=document.getElementById("status");e&&(e.innerHTML="")},e.setLevel=function(t){e.level=63,e.debug("Log level is now "+t),e.level=t},e.dumpHTML=function(){var t=e.level;e.level=63,e.debug(document.innerHTML),e.level=t},e}()},function(e,t,n){"use strict";(function(e){if(e.scriptURI)e.exports.iconBase=e.scriptURI.slice(0,e.scriptURI.lastIndexOf("/"))+"/icons/",e.exports.originalIconBase=e.scriptURI.slice(0,e.scriptURI.lastIndexOf("/"))+"/originalIcons/";else{var t="https://solid.github.io/solid-ui/src";"undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.iconBase?(e.exports.iconBase=$SolidTestEnvironment.iconBase,e.exports.originalIconBase=$SolidTestEnvironment.originalIconBase):(e.exports.iconBase=t+"/icons/",e.exports.originalIconBase=t+"/originalIcons/")}console.log(" Icon base is: "+e.exports.iconBase)}).call(this,n(22)(e))},function(e,t,n){"use strict";e.exports={Formats:n(188),Initializer:n(187),JSONDocument:n(410),JSONMapping:n(409),JSONPatch:n(186),JSONPointer:n(103),JSONSchema:n(408),Validator:n(185)}},function(e,t){var n=e.exports={version:"2.5.5"};"number"==typeof __e&&(__e=n)},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"substitute",value:function(e){return console.log("@@@ node substitute"+this),this}},{key:"compareTerm",value:function(e){return this.classOrder<e.classOrder?-1:this.classOrder>e.classOrder?1:this.value<e.value?-1:this.value>e.value?1:0}},{key:"equals",value:function(e){return!!e&&this.termType===e.termType&&this.value===e.value}},{key:"hashString",value:function(){return this.toCanonical()}},{key:"sameTerm",value:function(e){return this.equals(e)}},{key:"toCanonical",value:function(){return this.toNT()}},{key:"toNT",value:function(){return this.toString()}},{key:"toString",value:function(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}]),e}();e.exports=i,i.fromValue=function(e){var t=n(88),r=n(48);n(12);return void 0===e||null===e?e:e&&e.termType?e:Array.isArray(e)?new t(e):r.fromValue(e)}},function(e,t,n){"use strict";function r(e){var t;return 0>(t=e.indexOf("#"))?e:e.slice(0,t)}var i=i||console.log;e.exports.docpart=r,e.exports.document=function(e){return new a(r(e.uri))},e.exports.hostpart=function(e){var t=/[^\/]*\/\/([^\/]*)\//.exec(e);return t?t[1]:""},e.exports.join=function(e,t){var n,r,a,o,s,u=t.indexOf("#");if(0<u&&(t=t.slice(0,u)),0===e.length)return t;if(0===e.indexOf("#"))return t+e;if(0<=e.indexOf(":"))return e;if(n=t.indexOf(":"),0===t.length)return e;if(0>n)return i("Invalid base: "+t+" in join with given: "+e),e;if(r=t.slice(0,+n+1||9e9),0===e.indexOf("//"))return r+e;if(t.indexOf("//",n)===n+1){if(0>(a=t.indexOf("/",n+3)))return 0<t.length-n-3?t+"/"+e:r+e}else if(0>(a=t.indexOf("/",n+1)))return 0<t.length-n-1?t+"/"+e:r+e;if(0===e.indexOf("/"))return t.slice(0,a)+e;if(0>(o=(s=t.slice(a)).lastIndexOf("/")))return r+e;for(0<=o&&o<s.length-1&&(s=s.slice(0,+o+1||9e9)),s+=e;s.match(/[^\/]*\/\.\.\//);)s=s.replace(/[^\/]*\/\.\.\//,"");return s=(s=s.replace(/\.\//g,"")).replace(/\/\.$/,"/"),t.slice(0,a)+s},e.exports.protocol=function(e){var t;return 0>(t=e.indexOf(":"))?null:e.slice(0,t)},e.exports.refTo=function(e,t){var n,r,i,a,o,s,u,l,c,d,h,f;if(!e)return t;if(e===t)return"";for(n=u=0,a=t.length;u<a&&t[n]===e[n];n=++u);if(e.slice(0,n).match(/^[-_a-zA-Z0-9.]+:(\/\/[^\/]*)?\/[^\/]*$/)&&(0>(r=t.indexOf("//"))&&(r=-2),"/"!==t[(i=t.indexOf("/",r+2))+1]&&"/"!==e[i+1]&&t.slice(0,i)===e.slice(0,i)))return t.slice(i);if("#"===t[n]&&e.length===n)return t.slice(n);for(;0<n&&"/"!==t[n-1];)n--;if(3>n)return t;if(0<e.indexOf("//",n-2)||0<t.indexOf("//",n-2))return t;if(0<e.indexOf(":",n))return t;for(s=0,l=0,o=(d=e.slice(n)).length;l<o;l++)"/"===d[l]&&s++;if(0===s&&n<t.length&&"#"===t[n])return"./"+t.slice(n);if(0===s&&n===t.length)return"./";if(f="",0<s)for(c=1,h=s;1<=h?c<=h:c>=h;1<=h?++c:--c)f+="../";return f+t.slice(n)};var a=n(12)},function(e,t,n){"use strict";function r(e,t){var n,r;for(n=t;n&&1===n.nodeType;n=n.parentNode)if(r=n.getAttribute("about"))return e.fromNT(r);c.log.debug("getAbout: No about found")}function i(e){var t=e.ownerDocument.documentElement.getBoundingClientRect(),n=e.getBoundingClientRect();return[n.left-t.left,n.top-t.top]}function a(e){if(void 0===e.uri)return"??";var t,n=e.uri,r=[],i=n.lastIndexOf("#");if(0<=i)n=n.slice(0,i+1);else{if(!(0<=(i=n.lastIndexOf("/"))))return e.uri+"?!";n=n.slice(0,i+1)}for(var a in c.ns)r[c.ns[a]]=a;try{return r[n]}catch(n){}for(n=n.slice(0,-1);n;){if(!(0<=(i=n.lastIndexOf("/"))))return e.uri+"!?";if(t=n.slice(i+1),n=n.slice(0,i),"ns"!==t&&0>"0123456789".indexOf(t[0]))return t}}function o(e,t){function n(e){return t?e.slice(0,1).toUpperCase()+e.slice(1):e}function r(e){var t="";"/"===e.slice(-1)&&(e=e.slice(0,-1));for(var r=0;r<e.length;r++)"_"!==e[r]&&"-"!==e[r]?(t+=e[r],r+1<e.length&&e[r].toUpperCase()!==e[r]&&e[r+1].toLowerCase()!==e[r+1]&&(t+=" ")):t+=" ";return"has "===t.slice(0,4)&&(t=t.slice(4)),n(t)}var i;if("undefined"!=typeof tabulator&&tabulator.lb&&(i=tabulator.lb.label(e)))return n(i.value);var a=c.store,o=a.any(e,c.ns.link("message"))||a.any(e,c.ns.vcard("fn"))||a.any(e,c.ns.foaf("name"))||a.any(e,c.ns.dct("title"))||a.any(e,c.ns.dc("title"))||a.any(e,c.ns.rss("title"))||a.any(e,c.ns.contact("fullName"))||a.any(e,a.sym("http://www.w3.org/2001/04/roadmap/org#name"))||a.any(e,c.ns.cal("summary"))||a.any(e,c.ns.foaf("nick"))||a.any(e,c.ns.rdfs("label"));if(o)return n(o.value);if("BlankNode"===e.termType)return"...";if("Collection"===e.termType)return"("+e.elements.length+")";var s=e.uri;if(void 0===s)return e.toString();try{s=s.split("/").map(decodeURIComponent).join("/")}catch(t){for(var u,l=s.length-3;0<l;l--)for(u="0123456789abcefABCDEF";"%"===s[l]&&0<=u.indexOf(s[l+1])&&0<=u.indexOf(s[l+2]);)s=s.slice(0,l)+_StringfromCharCode(parseInt(s.slice(l+1,l+3),16))+s.slice(l+3)}"#this"===s.slice(-5)?s=s.slice(0,-5):"#me"===s.slice(-3)&&(s=s.slice(0,-3));var d=s.indexOf("#");if(0<=d)return r(s.slice(d+1));"/foaf.rdf"===s.slice(-9)?s=s.slice(0,-9):"/foaf"===s.slice(-5)&&(s=s.slice(0,-5));var h=s.lastIndexOf("/",s.length-2);return 0<=h&&h<e.uri.length?r(s.slice(h+1)):n(decodeURIComponent(e.uri))}function s(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;")}function u(e){return s(o(e))}e.exports={addLoadEvent:function(e){var t=window.onload;window.onload="function"==typeof window.onload?function(){t(),e()}:e},AJARImage:function(e,t,n,r){r||(r=document);var i=r.createElement("img");return i.setAttribute("src",e),i.addEventListener("copy",function(e){e.clipboardData.setData("text/plain",""),e.clipboardData.setData("text/html",""),e.preventDefault()}),void 0!==n&&i.setAttribute("title",n),i},ancestor:function(e,t){var n;for(n=e;n;n=n.parentNode)try{if(n.tagName===t)return n}catch(t){return}},beep:function(){if(l){var e=new l;return function(t,n,r,i){t=+(t||.3),r=r||"sine","function"!=typeof i&&(i=function(){});var a=e.createOscillator();a.type=r,a.frequency.value=n||256,a.connect(e.destination),a.start(0),a.stop(t)}}},clearVariableNames:function(){d=0},emptyNode:function(e){var t,n=e.childNodes;for(t=n.length-1;0<=t;t--)e.removeChild(n[t]);return e},escapeForXML:s,findPos:i,genUuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=0|16*Math.random();return("x"===e?t:8|3&t).toString(16)})},getAbout:r,getEyeFocus:function(e,t,n,r){r||(r=window);var a=i(e)[1],o=a-52-r.scrollY;if(t)return n?void r.scrollBy(0,a+e.clientHeight-(r.scrollY+r.innerHeight)):void r.scrollBy(0,o);var s=r.setInterval(function(){r.scrollBy(0,o/10),10==++u&&r.clearInterval(s)},50),u=0},getTarget:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),t},getTerm:function(e){var t=e.parentNode,n=t?t.AJAR_statement:void 0,i=n?e.className:"";return"pred"===i||"pred selected"===i?n.predicate:"obj"===i||"obj selected"===i?t.AJAR_inverse?n.subject:n.object:""===i||"selected"===i?r(c.store,e):"undetermined selected"===i?e.nextSibling?n.predicate:t.AJAR_inverse?n.subject:n.object:void 0},hashColor:function(e){return"#"+(12632256|16777215&function(e){return e.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0)}(e=e.uri||e)).toString(16)},include:function(e,t){var n=e.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",t),n},label:o,labelForXML:u,labelWithOntology:function(e,t){var n=c.store.findTypeURIs(e);return n[c.ns.rdf("Predicate").uri]||n[c.ns.rdfs("Class").uri]?o(e,t)+" ("+a(e)+")":o(e,t)},newVariableName:function(){return"v"+d++},ontologyLabel:a,predicateLabelForXML:function(e,t){var n;if(t){var r=c.store.any(e,c.ns.owl("inverseOf"));if(r||(r=c.store.any(void 0,c.ns.owl("inverseOf"),e)),r)return u(r)}return n=u(e),t?"type"===n?"...":"is "+n+" of":n},predParentOf:function(e){for(var t=e;;){if(t.getAttribute("predTR"))return t;if(!t.previousSibling||"TR"!==t.previousSibling.nodeName)return c.log.error("Could not find predParent"),e;t=t.previousSibling}},RDFComparePredicateObject:function(e,t){var n=e.predicate.compareTerm(t.predicate);return 0===n?e.object.compareTerm(t.object):n},RDFComparePredicateSubject:function(e,t){var n=e.predicate.compareTerm(t.predicate);return 0===n?e.subject.compareTerm(t.subject):n},shortName:function(e){var t=e;0<="#/".indexOf(t[t.length-1])&&(t=t.slice(0,-1));var n=[];for(var r in this.prefixes)n[this.prefixes[r]]=r;var i,a,o=function(e){return"ns"!==e&&(i=e,!0)},s=t.lastIndexOf("#");for(0<=s&&(t=t.slice(s-1));;){var u=t.lastIndexOf("/");for(0<=u&&(t=t.slice(u+1)),a=0;a<t.length&&this.prefixchars.indexOf(t[a]);)a++;if(6>(t=t.slice(0,a)).length&&o(t))return i;if(o(t.slice(0,3)))return i;if(o(t.slice(0,2)))return i;if(o(t.slice(0,4)))return i;if(o(t.slice(0,1)))return i;if(o(t.slice(0,5)))return i;for(a=0;;a++)if(o(t.slice(0,3)+a))return i}},stackString:function(e){var t,n=e+"\n";if(!e.stack)return n+"No stack available.\n";var r=e.stack.toString().split("\n"),i=[];for(t=0;t<r.length;t++){var a=r[t];if(-1<a.indexOf("ecmaunit.js"))break;"("===a.charAt(0)&&(a="function"+a);var o=a.split("@");i.push(o)}for(t=0;t<i.length;t++)n+=" "+i[t][1]+"\n "+i[t][0];return n},syncTableToArray:function(e,t,n){var r,i,a;for(a=0;a<e.children.length;a++)(i=e.children[a]).trashMe=!0;for(var o,s=0;s<t.length;s++){for(o=t[s],r=!1,a=0;a<e.children.length;a++)if((i=e.children[a]).subject&&i.subject.sameTerm(o)){i.trashMe=!1,r=!0;break}if(!r){var u=n(o);if(s>=e.children.length)e.appendChild(u);else{var l=e.children[s];e.insertBefore(u,l)}u.subject=o}}for(a=0;a<e.children.length;a++)(i=e.children[a]).trashMe&&e.removeChild(i)}};var l,c={log:n(15),ns:n(6),rdf:n(23),store:n(8)},d=0;"undefined"==typeof AudioContext?"undefined"!=typeof window&&(l=window.AudioContext||window.webkitAudioContext):l=AudioContext},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],!e.children&&(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}}(n(89)),i={BlankNode:n(40),Collection:n(88),convert:n(227),DataFactory:n(83),Empty:n(383),Fetcher:n(123),Formula:n(228),IndexedFormula:r.default,jsonParser:n(382),Literal:n(48),log:n(39),N3Parser:n(82),NamedNode:n(12),Namespace:n(62),Node:n(19),parse:n(215),Query:n(84).Query,queryToSPARQL:n(381),RDFaProcessor:n(122),RDFParser:n(121),serialize:n(134),Serializer:n(124),SPARQLToQuery:n(380),sparqlUpdateParser:n(214),Statement:n(86),term:n(19).fromValue,UpdateManager:n(379),UpdatesSocket:n(170).UpdatesSocket,UpdatesVia:n(170).UpdatesVia,uri:n(20),Util:n(27),Variable:n(85)};i.NextId=i.BlankNode.nextId,i.fromNT=i.Formula.prototype.fromNT,i.fetcher=i.DataFactory.fetcher,i.graph=i.DataFactory.graph,i.lit=i.DataFactory.lit,i.st=i.DataFactory.st,i.sym=i.DataFactory.namedNode,i.variable=i.DataFactory.variable,i.blankNode=i.DataFactory.blankNode,i.defaultGraph=i.DataFactory.defaultGraph,i.literal=i.DataFactory.literal,i.namedNode=i.DataFactory.namedNode,i.quad=i.DataFactory.quad,i.triple=i.DataFactory.triple,e.exports=i},function(e,t,n){"use strict";function r(e){return(e>>>24|65280&e>>>8|16711680&e<<8|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function a(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}var o=n(13),s=n(1);t.inherits=s,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e)for(r=0;r<e.length;r++)n[r]=0|e[r];else if(t){if("hex"===t)for(0!=(e=e.replace(/[^a-z0-9]+/gi,"")).length%2&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var r=0;r<e.length;r++){var i=e.charCodeAt(r),a=i>>8,o=255&i;a?n.push(a,o):n.push(o)}return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n].toString(16));return t},t.htonl=r,t.toHex32=function(e,t){for(var n,i="",o=0;o<e.length;o++)n=e[o],"little"===t&&(n=r(n)),i+=a(n.toString(16));return i},t.zero2=i,t.zero8=a,t.join32=function(e,t,n,r){var i=n-t;o(0==i%4);for(var a=Array(i/4),s=0,u=t;s<a.length;s++,u+=4){var l;l="big"===r?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],a[s]=l>>>0}return a},t.split32=function(e,t){for(var n,r=Array(4*e.length),i=0,a=0;i<e.length;i++,a+=4)n=e[i],"big"===t?(r[a]=n>>>24,r[a+1]=255&n>>>16,r[a+2]=255&n>>>8,r[a+3]=255&n):(r[a+3]=n>>>24,r[a+2]=255&n>>>16,r[a+1]=255&n>>>8,r[a]=255&n);return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},t.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},t.sum64=function(e,t,n,r){var i=e[t],a=r+e[t+1]>>>0,o=(a<r?1:0)+n+i;e[t]=o>>>0,e[t+1]=a},t.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,r){return t+r>>>0},t.sum64_4_hi=function(e,t,n,r,i,a,o,s){var u=0,l=t;return u+=(l=l+r>>>0)<t?1:0,u+=(l=l+a>>>0)<a?1:0,e+n+i+o+(u+=(l=l+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,n,r,i,a,o,s){return t+r+a+s>>>0},t.sum64_5_hi=function(e,t,n,r,i,a,o,s,u,l){var c=0,d=t;return c+=(d=d+r>>>0)<t?1:0,c+=(d=d+a>>>0)<a?1:0,c+=(d=d+s>>>0)<s?1:0,e+n+i+o+u+(c+=(d=d+l>>>0)<l?1:0)>>>0},t.sum64_5_lo=function(e,t,n,r,i,a,o,s,u,l){return t+r+a+s+l>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(337).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t,n){var r=n(30),i=n(212),a=n(119),o=Object.defineProperty;t.f=n(29)?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),i)try{return o(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";(function(e){function t(e,n,r,i){var a,o="",s=[!1];if(void 0===e.nodeType)return o;if(1===e.nodeType){if(e.hasAttribute("class")&&"classWithChildText"in n&&e.matches(n.classWithChildText.class))o+=e.querySelector(n.classWithChildText.element).textContent;else if(!("skipNodeWithClass"in n&&e.matches("."+n.skipNodeWithClass))){var u=e.nodeName.toLowerCase();o+="<"+u;var l=[];for(a=e.attributes.length-1;0<=a;a--){var c=e.attributes[a];if(!(0<i.length&&i[c.name]||/^\d+$/.test(c.name))){if("class"===c.name&&"replaceClassItemWith"in n&&-1<c.value.split(" ").indexOf(n.replaceClassItemWith.source)){var d=new RegExp(n.replaceClassItemWith.source,"g");c.value=c.value.replace(d,n.replaceClassItemWith.target).trim()}"class"===c.name&&"skipClassWithValue"in n&&n.skipClassWithValue===c.value||l.push(c.name+"='"+c.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&quot;")+"'")}}if(0<l.length&&("sortAttributes"in n&&n.sortAttributes&&l.sort(function(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())}),o+=" "+l.join(" ")),r[u])o+=" />";else{for(o+=">",o+="html"===u?"\n ":"",s.push("style"===u||"script"===u),a=0;a<e.childNodes.length;a++)o+=t(e.childNodes[a]);s.pop(),o+="body"===u?"</"+u+">\n":"</"+u+">"}}}else if(8===e.nodeType)o+="\x3c!--"+e.nodeValue+"--\x3e";else if(3===e.nodeType||4===e.nodeType){var h=e.nodeValue.replace(/\n+$/,"");o+=s[s.length-1]?h:h.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}else console.log("Warning; Cannot handle serialising nodes of type: "+e.nodeType),console.log(e);return o}function r(e,t,n,r){var i=function(e){return"BlankNode"===e.termType?null:e},a=function(e){var t=n.statementsMatching(e).map(function(e){return i(e.subject)+" "+i(e.predicate)+" "+i(e.object)}).concat(n.statementsMatching(void 0,void 0,e).map(function(e){return i(e.subject)+" "+i(e.predicate)+" "+i(e.object)}));return t.sort(),t.join("\n")};return"BlankNode"===e.termType&&"BlankNode"===t.termType?0===e.compareTerm(t)?0:a(e)>a(t)?1:a(e)<a(t)?-1:e.compareTerm(t):r&&e.uri&&t.uri?(r[e.uri]||e.uri).localeCompare(r[t.uri]||t.uri):e.compareTerm(t)}function i(e,t){return e.slice(0,t.length)===t}var a=n(20).docpart,o=n(39),s=n(12);e.exports.AJAR_handleNewTerm=function(e,t,n){var r=null;if(void 0!==e.fetcher&&(r=e.fetcher,"NamedNode"===t.termType)){var s,u=a(t.uri);if(0>t.uri.indexOf("#")){if(i(t.uri,"http://dbpedia.org/resource/Category:"))return;i(t.uri,"http://purl.org/dc/elements/1.1/")||i(t.uri,"http://purl.org/dc/terms/")?s="http://dublincore.org/2005/06/13/dcq":i(t.uri,"http://xmlns.com/wot/0.1/")?s="http://xmlns.com/wot/0.1/index.rdf":i(t.uri,"http://web.resource.org/cc/")&&(s="http://web.resource.org/cc/schema.rdf")}return s&&(u=s),r&&"unrequested"!==r.getState(u)?void 0:(s&&o.warn("Assuming server still broken, faking redirect of <"+t.uri+"> to <"+u+">"),r.fetch(u,{referringTerm:n}))}},e.exports.ArrayIndexOf=function(e,t,n){n||(n=0);var r=e.length;for(0>n&&(n=r+n);n<r;n++)if(e[n]===t)return n;return-1},e.exports.callbackify=function(e,t){e.callbacks={};for(var n=t.length-1;0<=n;n--)e.callbacks[t[n]]=[];e.addHook=function(t){e.callbacks[t]||(e.callbacks[t]=[])},e.addCallback=function(t,n){e.callbacks[t].push(n)},e.removeCallback=function(t,n){for(var r=0;r<e.callbacks[t].length;r++)if(e.callbacks[t][r].name===n)return e.callbacks[t].splice(r,1),!0;return!1},e.insertCallback=function(t,n){e.callbacks[t].unshift(n)},e.fireCallbacks=function(t,n){var r,i,a=[],o=[],s=e.callbacks[t].length;for(r=s-1;0<=r;r--)(i=e.callbacks[t][r])&&i.apply(e,n)&&a.push(i);for(r=a.length-1;0<=r;r--)o.push(a[r]);for(r=s;r<e.callbacks[t].length;r++)o.push(e.callbacks[t][r]);e.callbacks[t]=o}},e.exports.dtstamp=function(){var e=new Date,t=e.getYear()+1900,n=e.getMonth()+1,r=e.getDate(),i=e.getUTCHours(),a=e.getUTCMinutes(),o=e.getSeconds();return 10>n&&(n="0"+n),10>r&&(r="0"+r),10>i&&(i="0"+i),10>a&&(a="0"+a),10>o&&(o="0"+o),t+"-"+n+"-"+r+"T"+i+":"+a+":"+o+"Z"},e.exports.DOMParserFactory=function(){return window.DOMParser?new DOMParser:!!window.ActiveXObject&&new ActiveXObject("Microsoft.XMLDOM")},e.exports.domToString=function(e,n){var r=[];"selfClosing"in(n=n||{})&&n.selfClosing.split(" ").forEach(function(e){r[e]=!0});var i=[];return"skipAttributes"in n&&n.skipAttributes.split(" ").forEach(function(e){i[e]=!0}),t(e,n,r,i)},e.exports.dumpNode=t,e.exports.heavyCompare=r,e.exports.heavyCompareSPO=function(e,t,n,i){return r(e.subject,t.subject,n,i)||r(e.predicate,t.predicate,n,i)||r(e.object,t.object,n,i)},e.exports.output=function(e){var t=document.createElement("div");t.textContent=e,document.body.appendChild(t)},e.exports.parseXML=function(t,r){if(r=r||{},void 0!==e&&e&&e.exports){var i=n(47).DOMParser;return(new i).parseFromString(t,r.contentType||"application/xhtml+xml")}return("undefined"!=typeof window&&window.DOMParser?new window.DOMParser:new i).parseFromString(t,"application/xml")},e.exports.RDFArrayRemove=function(e,t){for(var n=0;n<e.length;n++)if(e[n].subject.sameTerm(t.subject)&&e[n].predicate.sameTerm(t.predicate)&&e[n].object.sameTerm(t.object)&&e[n].why.sameTerm(t.why))return void e.splice(n,1);throw new Error("RDFArrayRemove: Array did not contain "+t+" "+t.why)},e.exports.stackString=function(e){var t=e+"\n";if(!e.stack)return t+"No stack available.\n";for(var n,r=e.stack.toString().split("\n"),i=[],a=0;a<r.length&&!(-1<(n=r[a]).indexOf("ecmaunit.js"));a++){"("==n.charAt(0)&&(n="function"+n);var o=n.split("@");i.push(o)}for(a=0;a<i.length;a++)t+=" "+i[a][1]+"\n "+i[a][0];return t},e.exports.string_startswith=i,e.exports.string={},e.exports.string.template=function(e,t){for(var n=e.split("%s"),r="",i=0;i<t.length;i++)t[i]+="",r+=n[i]+t[i];return r+n.slice(t.length).join()},e.exports.uri=n(20),e.exports.log=o,e.exports.mediaTypeClass=function(e){return e=e.split(";")[0].trim(),new s("http://www.w3.org/ns/iana/media-types/"+e+"#Resource")},e.exports.linkRelationProperty=function(e){return new s("http://www.w3.org/ns/iana/link-relations/relation#"+e.trim())}}).call(this,n(22)(e))},function(e,t,n){function r(e){a.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}var i=n(3).Buffer,a=n(64).Transform,o=n(127).StringDecoder;n(1)(r,a),r.prototype.update=function(e,t,n){"string"==typeof e&&(e=i.from(e,t));var r=this._update(e);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},r.prototype.setAutoPadding=function(){},r.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},r.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},r.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},r.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(t){r=t}finally{n(r)}},r.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},r.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},r.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},e.exports=r},function(e,t,n){e.exports=!n(60)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(36);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(10),i=n(18),a=n(61),o=n(37),s=n(35),u="prototype",l=function(e,t,n){var c,d,h,f=e&l.F,p=e&l.G,m=e&l.S,v=e&l.P,g=e&l.B,b=e&l.W,y=p?i:i[t]||(i[t]={}),w=y[u],_=p?r:m?r[t]:(r[t]||{})[u];for(c in p&&(n=t),n)(d=!f&&_&&void 0!==_[c])&&s(y,c)||(h=d?_[c]:n[c],y[c]=p&&"function"!=typeof _[c]?n[c]:g&&d?a(h,r):b&&_[c]==h?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t[u]=e[u],t}(h):v&&"function"==typeof h?a(Function.call,h):h,v&&((y.virtual||(y.virtual={}))[c]=h,e&l.R&&w&&!w[c]&&o(w,c,h)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){e.exports=n(407).default,e.exports.default=e.exports},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(76));t.default=function(e){return function(){var t=e.apply(this,arguments);return new r.default(function(e,n){return function i(a,o){try{var s=t[a](o),u=s.value}catch(e){return void n(e)}return s.done?void e(u):r.default.resolve(u).then(function(e){i("next",e)},function(e){i("throw",e)})}("next")})}}},function(e,t,n){e.exports=n(455)},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(26),i=n(59);e.exports=n(29)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";function r(e){return this instanceof r?(l.call(this,e),c.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||o.nextTick(a,this)}function a(e){e.end()}var o=n(87),s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=r;var u=n(63);u.inherits=n(1);var l=n(221),c=n(128);u.inherits(r,l);for(var d,h=s(c.prototype),f=0;f<h.length;f++)d=h[f],r.prototype[d]||(r.prototype[d]=c.prototype[d]);Object.defineProperty(r.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(r.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0===this._readableState||void 0===this._writableState||(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),r.prototype._destroy=function(e,t){this.push(null),this.end(),o.nextTick(t,e)}},function(e,t,n){"use strict";e.exports={debug:function(e){},warn:function(e){},info:function(e){},error:function(e){},success:function(e){},msg:function(e){}}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(49),a=n(19),o=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(n.termType=t.termType,e){if("string"!=typeof e)throw console.log("Bad blank id:",e),new Error("Bad id argument to new blank node: "+e);if(e.includes("#")){var r=e.split("#");e=r[r.length-1]}n.id=e}else n.id="n"+t.nextId++;return n.value=n.id,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a),r(t,[{key:"compareTerm",value:function(e){return this.classOrder<e.classOrder?-1:this.classOrder>e.classOrder?1:this.id<e.id?-1:this.id>e.id?1:0}},{key:"copy",value:function(e){var n=new t;return e.copyTo(this,n),n}},{key:"toCanonical",value:function(){return"_:"+this.value}},{key:"toString",value:function(){return t.NTAnonymousNodePrefix+this.id}}]),t}();o.nextId=0,o.termType="BlankNode",o.NTAnonymousNodePrefix="_:",o.prototype.classOrder=i.BlankNode,o.prototype.isBlank=1,o.prototype.isVar=1,e.exports=o},function(e,t,n){"use strict";function r(e,t){var n;if(e){n=e.uri||e;var r=v.namedNode(n);return t&&(t.me=r),r}return null}function i(){var e=c();return e||null}function a(e){var t=i();return t?(e.me=t,Promise.resolve(e)):new Promise(function(t){h().then(function(n){if(n)return e.me=v.sym(n),console.log("logIn: Already logged in as "+e.me),void t(e);var i=f(e.dom,function(n){r(n,e),t(e)});e.div.appendChild(i)})})}function o(e){if(e.publicProfile)return Promise.resolve(e);var t,n=w.store.fetcher;return new Promise(function(r,i){a(e).then(function(e){var a=e.me;if(!a)throw new Error("Could not log in");t=a.doc(),n.load(t,{withCredentials:!1,cache:"reload"}).then(function(n){e.publicProfile=t,r(e)},function(n){var r="Logged in but cannot load profile "+t+" : "+n;e.div.appendChild(g.errorMessageBlock(e.dom,r)),i(r)})},function(e){i(new Error("Can't log in: "+e))})})}function s(e){if(e.preferencesFile)return Promise.resolve(e);var t=w.store,n=e.statusArea||e.div||null;return new Promise(function(r,i){o(e).then(function(e){function a(t){t="logInLoadPreferences: "+t,n&&n.appendChild(g.errorMessageBlock(e.dom,t)),console.log(t),i(new Error(t))}var o=t.any(e.me,w.ns.space("preferencesFile"));if(!o){var s="Can't find a preferences file pointer in profile "+e.publicProfile;return i(new Error(s))}t.fetcher.load(o,{withCredentials:!0}).then(function(){return e.preferencesFile=o,r(e)},function(e){var t,n=e.status,r=e.message;if(console.log("HTTP status "+n+" for pref file "+o),401===n)t="Strange - you are not authenticated (properly logged on) to read preferences file.";else if(403===n)t="Strange - you are not authorized to read your preferences file.";else if(404===n){if(confirm("You do not currently have a Preferences file. Ok for me to create an empty one? "+o))return a(new Error("Sorry No code yet to craete a preferences fille at "));i(new Error("User declined to craete a preferences fille at "))}else t="Strange: Error "+n+" trying to read your preferences file."+r;alert(t)})},function(e){i(new Error("(via loadPrefs) "+e))},function(e){return i(e)})})}function u(e){var t=w.ns,n=w.store;return new Promise(function(r,i){s(e).then(function(e){var a=e.me;if(e.index=e.index||{},e.index.private=n.each(a,t.solid("privateTypeIndex"),void 0,e.preferencesFile),0===e.index.private.length)return i(new Error("Your preference file "+e.preferencesFile+" does not point to a private type index."));if(e.index.public=n.each(a,t.solid("publicTypeIndex"),void 0,e.publicProfile),0===e.index.public.length)return i(new Error("Your preference file "+e.preferencesFile+" does not point to a public type index."));var o=e.index.private.concat(e.index.public);n.fetcher.load(o).then(function(t){r(e)},function(e){i(new Error("Error loading type indexes: "+e))})},function(e){i(new Error("[LTI] "+e))})})}function l(e){return new Promise(function(t,n){return u(e).then(function(e){console.log("ensureTypeIndexes: Type indexes exist already"),t(e)},function(n){if(confirm("You don't have, or you couldn't acess, type indexes --lists of things of different types. Create new empty ones? "+n)){var r,i=w.ns,a=w.store,o=e.me,s=function(e,t){return new Promise(function(n,s){function u(t){a.fetcher.webOperation("PUT",t,{data:"# "+new Date+" Blank initial Type index\n"}).then(function(t){n(e)},function(t){var n="Creating new index file "+t;b.complain(e,n),s(new Error(n))})}var l={private:e.preferencesFile,public:e.publicProfile}[t];if(e.index=e.index||{},e.index[t]=e.index[t]||[],0===e.index[t].length){r=v.sym(l.dir().uri+t+"TypeIndex.ttl"),console.log("Linking to new fresh type index "+r),confirm("Ok to create a new empty index file at "+r+", overwriting anything that was there?")||s(new Error("cancelled by user"));var c=[v.st(o,i.solid(t+"TypeIndex"),r,l)];w.store.updater.update([],c,function(n,i,a){return i?(e.index[t].push(r),console.log("Creating new fresh type index "+r),void u(r)):s(new Error("Error saving type index link saving back "+n+": "+a))})}else{var d=e.index[t][0];a.fetcher.load(d).then(function(t){n(e)},function(e){404===e.status?(!confirm("Ok to create a new empty index file at "+d+", overwriting anything that was there?")&&s(new Error("cancelled by user")),u(d)):s(new Error("You should have a type index file "+d+", but "+e))})}})},u=[s(e,"private"),s(e,"public")];return Promise.all(u).then(function(){t(e)})}})})}function c(){if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.username)return console.log("Assuming the user is "+$SolidTestEnvironment.username),v.sym($SolidTestEnvironment.username);if("undefined"!=typeof document&&document.location&&"http://localhost"===(""+document.location).slice(0,16)){var e=document.getElementById("appTarget");if(!e)return null;var t=e.getAttribute("testID");return t?(console.log("Assuming user is "+t),v.sym(t)):null}return null}function d(e){var t=e?e.webId:null;return t&&r(t),t}function h(e){var t=i();return t?Promise.resolve(e?e(t):t):y.currentSession().then(d,function(e){return console.log("Error fetching currentSession:",e),null}).then(function(t){var n=r(t);return n&&console.log("(Logged in as "+n+" by authentication)"),e?e(n):n})}function f(e,t){var n=i(),r=e.createElement("div"),a=function(e){if(e){var i=e.uri||e;n=v.sym(i),r.refresh(),t&&t(n.uri)}},o=function(){var e="Your Web ID was "+n+". It has been forgotten.";n=null;try{w.log.alert(e)}catch(t){try{window.alert(e)}catch(e){}}r.refresh(),t&&t(null)};return r.refresh=function(){var t=i(),n=t?t.uri:"";r.me!==n&&(b.clearElement(r),t?r.appendChild(function(t){var n="Web ID logout";if(t){var r=w.store.any(t,w.ns.foaf("nick"))||w.store.any(t,w.ns.foaf("name"));r&&(n="Logout "+r.value)}var i=e.createElement("input");return i.className="WebIDCancelButton",i.setAttribute("type","button"),i.setAttribute("value",n),i.addEventListener("click",o,!1),i}(t)):r.appendChild(function(e,t){var n=e.createElement("div"),r="SolidSignInOrSignUpBox";console.log("widgets.signInOrSignUpBox"),n.setUserCallback=t,n.setAttribute("class",r);var i=e.createElement("input");n.appendChild(i),i.setAttribute("type","button"),i.setAttribute("value","Log in"),i.setAttribute("style","padding: 1em; border-radius:0.5em; margin: 2em;"),i.addEventListener("click",function(){var n=c();return n?t(n.uri):y.popupLogin({popupUri:$SOLID_GLOBAL_config.popupUri}).then(function(t){var n=t.webId,i=e.getElementsByClassName(r);console.log("Logged in, "+i.length+" panels to be serviced");for(var a,o=0;o<i.length;o++)if((a=i[o]).setUserCallback)try{a.setUserCallback(n);var s=a.parentNode;s&&s.removeChild(a)}catch(n){console.log("## Error satisfying login box: "+n),a.appendChild(w.error.errorMessageBlock(e,n))}})},!1);var a=e.createElement("input");return n.appendChild(a),a.setAttribute("type","button"),a.setAttribute("value","Sign Up"),a.setAttribute("style","padding: 1em; border-radius:0.5em; margin: 2em;"),a.addEventListener("click",function(e){(new m.Signup).signup().then(function(e){console.log("signInOrSignUpBox signed up "+e),t(e)})},!1),n}(e,a))),r.me=n},r.me="99999",r.refresh(),r}function p(e,t,n){var r=t.noun,a=t.appPathSegment,o=i(),u=w.store,l=e.createElement("div"),c=function(t){l.appendChild(g.errorMessageBlock(e,t))},d=function(e){var t=u.any(e,w.ns.space("uriPrefix"));"/"!==(t=t?t.value:e.uri.split("#")[0]).slice(-1)&&(console.log(a+": No / at end of uriPrefix "+t),t+="/");var n=new Date;return t+=a+"/id"+n.getTime()+"/"};return s({me:o,dom:e,div:l}).then(function(t){var i=t.me,a=t.preferencesFile,o=null,s=u.statementsMatching(i,w.ns.space("workspace"),void 0,a).map(function(e){return e.object}),h=u.each(i,w.ns.space("storage"));h.map(function(e){s=s.concat(u.each(e,w.ns.ldp("contains")))}),1===s.length?(c("Workspace used: "+s[0].uri),o=d(s[0])):0===s.length&&c("You don't seem to have any workspaces. You have "+h.length+" storages.");var f=e.createElement("table");f.setAttribute("style","border-collapse:separate; border-spacing: 0.5em;"),l.appendChild(f),l.appendChild(e.createElement("hr")),l.appendChild(e.createElement("p")).textContent="Where would you like to store the data for the "+r+"? Give the URL of the directory where you would like the data stored.";var p=l.appendChild(e.createElement("input"));p.setAttribute("type","text"),p.size=80,p.label="base URL",p.autocomplete="on",o&&(p.value=o),t.baseField=p,l.appendChild(e.createElement("br"));var m=l.appendChild(e.createElement("button"));m.textContent="Start new "+r+" at this URI",m.addEventListener("click",function(e){var t=p.value;"/"!==t.slice(-1)&&(t+="/"),n(null,t)}),s=s.filter(function(e){return!u.holds(e,w.ns.rdf("type"),w.ns.space("MasterWorkspace"))});for(var v,g,b,y,_,x,M,k="height: 3em; margin: 1em; padding: 1em white; border-radius: 0.3em;",C=k+"border: 0px;",E=0;E<s.length;E++){_=s[E],y=e.createElement("tr"),0===E&&((v=e.createElement("td")).setAttribute("rowspan",""+s.length+1),v.textContent="Chose a workspace for this:",v.setAttribute("style","vertical-align:middle;"),y.appendChild(v)),g=e.createElement("td"),x=(x=u.any(_,w.ns.ui("style")))?x.value:"color: black ; background-color: #"+(12632256|16777215&function(e){return e.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0)}(_.uri)).toString(16)+";",g.setAttribute("style",C+x),y.target=_.uri;var A=u.any(_,w.ns.rdfs("label"));A||(A=_.uri.split("/").slice(-1)[0]||_.uri.split("/").slice(-2)[0]),g.textContent=A||"???",y.appendChild(g),0===E&&((b=e.createElement("td")).setAttribute("rowspan",""+s.length+1),b.setAttribute("style","width:50%;"),y.appendChild(b)),f.appendChild(y);var T=function(t){var r=e.createElement("button");r.textContent="Continue";var i=d(t);return p.value=i,r.addEventListener("click",function(e){r.disabled=!0,n(t,i),r.textContent="----\x3e"},!0),r};!function(e,t,n,r){e.addEventListener("click",function(e){b.textContent=t,b.setAttribute("style",n),b.appendChild(T(r))},!0)}(g,(M=(M=u.any(_,w.ns.rdfs("comment")))?M.value:"Use this workspace")?M.value:"",C+x,_)}var S=e.createElement("tr");(g=e.createElement("td")).setAttribute("style",k),g.textContent="+ Make a new workspace",S.appendChild(g),f.appendChild(S)},function(e){l.appendChild(w.widgets.errorMessageBlock(e))}),l}var m=n(287),v=n(23),g=n(66),b=n(14),y=n(213),w={log:n(15),ns:n(6),store:n(8)};e.exports={checkUser:h,currentUser:function(){var e=localStorage["solid-auth-client"];if(e){var t=JSON.parse(e);if(t.session&&t.session.webId)return v.sym(t.session.webId)}return null},defaultTestUser:i,findAppInstances:function(e,t){var n=w.store,r=w.ns,i=w.store.fetcher;return new Promise(function(a,o){u(e).then(function(s){for(var u=n.each(void 0,r.solid("forClass"),t),l=[],c=[],d=0;d<u.length;d++)l=l.concat(n.each(t,r.solid("instance"))),c=c.concat(n.each(t,r.solid("instanceContainer")));c.length||(e.instances=[],e.containers=[],a(e)),i.load(c).then(function(t){for(var i,o=0;o<c.length;o++)i=c[o],l=l.concat(n.each(i,r.ldp("contains")));e.instances=l,e.containers=c,a(e)},function(e){o(new Error("[FAI] Unable to load containers"+e))})},function(e){return o(new Error("Error looking for instances of "+t+": "+e))})})},findOriginOwner:function(e,t){var n=e.uri||e,r=n.indexOf("://");if(0>r)return!1;var i=n.indexOf("/",r+3);return!(0>i)&&n.slice(0,i+1)},loadTypeIndexes:u,logIn:a,logInLoadProfile:o,logInLoadPreferences:s,loginStatusBox:f,newAppInstance:function(e,t,n){var r=function(e,t){n(e,t)},i=e.createElement("div"),a=e.createElement("button");return a.setAttribute("type","button"),i.appendChild(a),a.innerHTML="Make new "+t.noun,a.addEventListener("click",function(n){i.appendChild(p(e,t,r))},!1),i.appendChild(a),i},offlineTestID:c,registrationControl:function(e,t,n){var r=w.store,i=w.ns,a=e.dom.createElement("div");return e.div.appendChild(a),l(e).then(function(e){a.innerHTML="<table><tbody><tr></tr><tr></tr></tbody></table>",a.setAttribute("style","font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;");var o,s,u=a.children[0].children[0],l=r.bnode(),c=function(e){var a=r.each(void 0,i.solid("instance"),t).filter(function(e){return r.holds(e,i.solid("forClass"),n)}),o=a.length?a[0]:b.newThing(e);return[v.st(o,i.solid("instance"),t,e),v.st(o,i.solid("forClass"),n,e)]};return e.index.public&&0<e.index.public.length&&(s=c(o=e.index.public[0]),u.children[0].appendChild(b.buildCheckboxForm(e.dom,w.store,"Public link to this "+e.noun,null,s,l,o))),e.index.private&&0<e.index.private.length&&(s=c(o=e.index.private[0]),u.children[1].appendChild(b.buildCheckboxForm(e.dom,w.store,"Personal note of this "+e.noun,null,s,l,o))),e},function(t){var n="registrationControl: Type indexes not available: "+t;e.div.appendChild(w.error.errorMessageBlock(e.dom,t)),console.log(n)}).catch(function(t){var n="registrationControl: Error making panel:"+t;e.div.appendChild(w.error.errorMessageBlock(e.dom,t)),console.log(n)})},registrationList:function(e,t){var n=w.store,r=w.ns,i=e.dom,a=i.createElement("div");return e.div.appendChild(a),l(e).then(function(o){a.innerHTML="<table><tbody></tbody></table>",a.setAttribute("style","font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;");var s=a.firstChild,u=[],l=[];["private","public"].forEach(function(i){t[i]&&(u=u.concat(e.index[i][0]),l=l.concat(n.statementsMatching(void 0,r.solid("instance"),void 0,e.index[i][0])))});for(var c=0;c<l.length;c++){var d=l[c],h=d.object,f={deleteFunction:function(e){n.updater.update([d],[],function(e,t,n){t?console.log("Removed from index: "+d.subject):console.log("Error: Cannot delete "+d+": "+n)})}},p=b.personTR(i,r.solid("instance"),h,f);s.appendChild(p)}return e})},selectWorkspace:p,setACLUserPublic:function(e,t,n){var r=w.store,i=r.any(r.sym(e),r.sym("http://www.iana.org/assignments/link-relations/acl"));return Promise.resolve().then(function(){return i||function(e){var t=w.store;return t.fetcher.load(e).then(function(n){if(!n.ok)throw new Error("fetchACLRel: While loading:"+n.error);var r=t.any(t.sym(e),t.sym("http://www.iana.org/assignments/link-relations/acl"));if(!r)throw new Error("fetchACLRel: No Link rel=ACL header for "+e);return r})}(e).catch(function(t){throw new Error("Error fetching rel=ACL header for "+e+": "+t)})}).then(function(i){var a=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=r.public||[],a=v.graph(),o=v.Namespace("http://www.w3.org/ns/auth/acl#"),s=a.sym(n+"#a1"),u=a.sym(n),l=a.sym(e);if(a.add(s,w.ns.rdf("type"),o("Authorization"),u),a.add(s,o("accessTo"),l,u),r.defaultForNew&&a.add(s,o("defaultForNew"),l,u),a.add(s,o("agent"),t,u),a.add(s,o("mode"),o("Read"),u),a.add(s,o("mode"),o("Write"),u),a.add(s,o("mode"),o("Control"),u),i.length){s=a.sym(n+"#a2"),a.add(s,w.ns.rdf("type"),o("Authorization"),u),a.add(s,o("accessTo"),l,u),a.add(s,o("agentClass"),w.ns.foaf("Agent"),u);for(var c=0;c<i.length;c++)a.add(s,o("mode"),o(i[c]),u)}return v.serialize(u,a,n,"text/turtle")}(e,t,i.uri,n);return r.fetcher.webOperation("PUT",i.uri,{data:a,contentType:"text/turtle"}).then(function(e){if(!e.ok)throw new Error("Error writing ACL text: "+e.error);return i})})},saveUser:r,solidAuthClient:y}},function(e,t,n){"use strict";e.exports={textInputStyle:"background-color: #eef; padding: 0.5em; border: .5em solid white; font-size: 100%;",buttonStyle:"background-color: #fff; padding: 0.5em; border: .5em solid white; font-size: 100%;",pendingeditModifier:"color: #bbb;"}},function(e,t,n){function r(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}var i=n(3).Buffer;r.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var n=this._block,r=this._blockSize,a=e.length,o=this._len,s=0;s<a;){for(var u=o%r,l=_Mathmin(a-s,r-u),c=0;c<l;c++)n[u+c]=e[s+c];s+=l,0==(o+=l)%r&&this._update(n)}return this._len+=a,this},r.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(4294967295>=n)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=r},function(e,t,n){"use strict";(function(t,r){var i=n(3).Buffer,a=t.crypto||t.msCrypto;e.exports=a&&a.getRandomValues?function(e,n){if(65536<e)throw new Error("requested too many random bytes");var o=new t.Uint8Array(e);0<e&&a.getRandomValues(o);var s=i.from(o.buffer);return"function"==typeof n?r.nextTick(function(){n(null,s)}):s}:function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(5),n(11))},function(e,t,n){var r=n(210),i=n(118);e.exports=function(e){return r(i(e))}},function(e,t){},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__47__},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(49),o=n(12),s=n(19),u=n(229),l=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.termType=t.termType,i.value=e,n&&(i.lang=n,r=u.langString),r&&(i.datatype=o.fromValue(r)),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s),i(t,[{key:"copy",value:function(){return new t(this.value,this.lang,this.datatype)}},{key:"equals",value:function(e){return!!e&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&(!this.datatype&&!e.datatype||this.datatype&&this.datatype.equals(e.datatype))}},{key:"toNT",value:function(){if("number"==typeof this.value)return this.toString();if("string"!=typeof this.value)throw new Error("Value of RDF literal is not string or number: "+this.value);var e=this.value;return e='"'+(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\"/g,'\\"')).replace(/\n/g,"\\n"))+'"',this.language?e+="@"+this.language:!this.datatype.equals(u.string)&&(e+="^^"+this.datatype.toCanonical()),e}},{key:"toString",value:function(){return""+this.value}},{key:"language",get:function(){return this.lang},set:function(e){this.lang=e||""}}],[{key:"fromBoolean",value:function(e){return new t(e?"1":"0",null,u.boolean)}},{key:"fromDate",value:function(e){if(!(e instanceof Date))throw new TypeError("Invalid argument to Literal.fromDate()");var n=function(e){return(""+(100+e)).slice(1,3)};return new t(e.getUTCFullYear()+"-"+n(e.getUTCMonth()+1)+"-"+n(e.getUTCDate())+"T"+n(e.getUTCHours())+":"+n(e.getUTCMinutes())+":"+n(e.getUTCSeconds())+"Z",null,u.dateTime)}},{key:"fromNumber",value:function(e){if("number"!=typeof e)throw new TypeError("Invalid argument to Literal.fromNumber()");var n=e.toString();return new t(n,null,0>n.indexOf("e")&&_Mathabs(e)<=Number.MAX_SAFE_INTEGER?Number.isInteger(e)?u.integer:u.decimal:u.double)}},{key:"fromValue",value:function(e){if(void 0===e||null===e)return e;if("object"===(void 0===e?"undefined":r(e))&&e.termType)return e;switch(void 0===e?"undefined":r(e)){case"object":if(e instanceof Date)return t.fromDate(e);case"boolean":return t.fromBoolean(e);case"number":return t.fromNumber(e);case"string":return new t(e)}throw new Error("Can't make literal from "+e+" of type "+(void 0===e?"undefined":r(e)))}}]),t}();l.termType="Literal",l.prototype.classOrder=a.Literal,l.prototype.datatype=u.string,l.prototype.lang="",l.prototype.isVar=0,e.exports=l},function(e,t,n){"use strict";e.exports={Literal:1,Collection:3,Graph:4,NamedNode:5,BlankNode:6,Variable:7}},function(e,t,n){var r=t;r.Reporter=n(310).Reporter,r.DecoderBuffer=n(144).DecoderBuffer,r.EncoderBuffer=n(144).EncoderBuffer,r.Node=n(309)},function(e,t,n){var r=t;r.bignum=n(315),r.define=n(313).define,r.base=n(50),r.constants=n(143),r.decoders=n(307),r.encoders=n(305)},function(e,t,n){"use strict";function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var i=n(24),a=n(13);t.BlockHash=r,r.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending=this.pending?this.pending.concat(e):e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},r.prototype.digest=function(e){return this.update(this._pad()),a(null===this.pending),this._digest(e)},r.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=255&e>>>24,r[i++]=255&e>>>16,r[i++]=255&e>>>8,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=255&e>>>8,r[i++]=255&e>>>16,r[i++]=255&e>>>24,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,a=8;a<this.padLength;a++)r[i++]=0;return r}},function(e,t,n){(function(t){e.exports=function(e,n){for(var r=_Mathmin(e.length,n.length),i=new t(r),a=0;a<r;++a)i[a]=e[a]^n[a];return i}}).call(this,n(2).Buffer)},function(e,t,n){"use strict";function r(e){u.call(this,"digest"),this._hash=e}var i=n(1),a=n(100),o=n(99),s=n(98),u=n(28);i(r,u),r.prototype._update=function(e){this._hash.update(e)},r.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new a:"rmd160"===e||"ripemd160"===e?new o:new r(s(e))}},function(e,t,n){"use strict";var r=n(102),i=n(180),a=n(398),o=n(397),s=n(174),u=n(177),l=n(175),c=n(71),d=n(179),h=n(176),f=n(178);e.exports={JWA:r,JWK:i,JWKSet:a,JWT:o,JWS:s,Base64URLSchema:u,JOSEHeaderSchema:l,JWKSchema:c,JWKSetSchema:d,JWTClaimsSetSchema:h,JWTSchema:f}},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__56__},function(e,t){e.exports={}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(80);e.exports=function(e,t,n){return r(e),void 0===t?e:1===n?function(n){return e.call(t,n)}:2===n?function(n,r){return e.call(t,n,r)}:3===n?function(n,r,i){return e.call(t,n,r,i)}:function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(12);e.exports=function(e){return function(t){return new r(e+(t||""))}}},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(2).Buffer)},function(e,t,n){function r(){i.call(this)}e.exports=r;var i=n(130).EventEmitter;n(1)(r,i),r.Readable=n(129),r.Writable=n(469),r.Duplex=n(468),r.Transform=n(467),r.PassThrough=n(466),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&l.pause&&l.pause()}function r(){l.readable&&l.resume&&l.resume()}function a(){c||(c=!0,e.end())}function o(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){l.removeListener("data",n),e.removeListener("drain",r),l.removeListener("end",a),l.removeListener("close",o),l.removeListener("error",s),e.removeListener("error",s),l.removeListener("end",u),l.removeListener("close",u),e.removeListener("close",u)}var l=this;l.on("data",n),e.on("drain",r),e._isStdio||t&&!1===t.end||(l.on("end",a),l.on("close",o));var c=!1;return l.on("error",s),e.on("error",s),l.on("end",u),l.on("close",u),e.on("close",u),e.emit("pipe",l),e}},function(e,t,n){(function(e){function r(e,t){this._id=e,this._clearFn=t}var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,a=Function.prototype.apply;t.setTimeout=function(){return new r(a.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new r(a.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.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;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(480),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,n(5))},function(e,t,n){"use strict";e.exports.errorMessageBlock=function(e,t,n){var r=e.createElement("div");return r.setAttribute("style","margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: "+(n||"#fee")+"; color:black;"),r.textContent=t,r}},function(e,t,n){(function(t){function r(e){var n;"object"!=typeof e||t.isBuffer(e)||(n=e.passphrase,e=e.key),"string"==typeof e&&(e=new t(e));var r,o,u=s(e,n),l=u.tag,c=u.data;switch(l){case"CERTIFICATE":o=a.certificate.decode(c,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(o||(o=a.PublicKey.decode(c,"der")),r=o.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPublicKey.decode(o.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return o.subjectPrivateKey=o.subjectPublicKey,{type:"ec",data:o};case"1.2.840.10040.4.1":return o.algorithm.params.pub_key=a.DSAparam.decode(o.subjectPublicKey.data,"der"),{type:"dsa",data:o.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+l);case"ENCRYPTED PRIVATE KEY":c=i(c=a.EncryptedPrivateKey.decode(c,"der"),n);case"PRIVATE KEY":switch(r=(o=a.PrivateKey.decode(c,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPrivateKey.decode(o.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:o.algorithm.curve,privateKey:a.ECPrivateKey.decode(o.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return o.algorithm.params.priv_key=a.DSAparam.decode(o.subjectPrivateKey,"der"),{type:"dsa",params:o.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+l);case"RSA PUBLIC KEY":return a.RSAPublicKey.decode(c,"der");case"RSA PRIVATE KEY":return a.RSAPrivateKey.decode(c,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:a.DSAPrivateKey.decode(c,"der")};case"EC PRIVATE KEY":return{curve:(c=a.ECPrivateKey.decode(c,"der")).parameters.value,privateKey:c.privateKey};default:throw new Error("unknown key type "+l)}}function i(e,n){var r=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),a=o[e.algorithm.decrypt.cipher.algo.join(".")],s=e.algorithm.decrypt.cipher.iv,c=e.subjectPrivateKey,d=parseInt(a.split("-")[1],10)/8,h=l.pbkdf2Sync(n,r,i,d),f=u.createDecipheriv(a,h,s),p=[];return p.push(f.update(c)),p.push(f.final()),t.concat(p)}var a=n(316),o=n(302),s=n(301),u=n(96),l=n(162);e.exports=r,r.signature=a.signature}).call(this,n(2).Buffer)},function(e,t,n){"use strict";var r=t;r.base=n(336),r.short=n(335),r.mont=n(334),r.edwards=n(333)},function(e,t,n){var r=n(3).Buffer,i=n(100);e.exports=function(e,t,n,a){if(r.isBuffer(e)||(e=r.from(e,"binary")),t&&(r.isBuffer(t)||(t=r.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o,s=n/8,u=r.alloc(s),l=r.alloc(a||0),c=r.alloc(0);0<s||0<a;){(o=new i).update(c),o.update(e),t&&o.update(t),c=o.digest();var d=0;if(0<s){var h=u.length-s;d=_Mathmin(s,c.length),c.copy(u,h,0,d),s-=d}if(d<c.length&&0<a){var f=l.length-a,p=_Mathmin(a,c.length-d);c.copy(l,f,d,d+p),a-=p}}return c.fill(0),{key:u,iv:l}}},function(e,t,n){function r(e){s.isBuffer(e)||(e=s.from(e));for(var t=0|e.length/4,n=Array(t),r=0;r<t;r++)n[r]=e.readUInt32BE(4*r);return n}function i(e){for(;0<e.length;e++)e[0]=0}function a(e,t,n,r,i){for(var a,o,s,u,l=n[0],c=n[1],d=n[2],h=n[3],f=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],v=e[3]^t[3],g=4,b=1;b<i;b++)a=l[f>>>24]^c[255&p>>>16]^d[255&m>>>8]^h[255&v]^t[g++],o=l[p>>>24]^c[255&m>>>16]^d[255&v>>>8]^h[255&f]^t[g++],s=l[m>>>24]^c[255&v>>>16]^d[255&f>>>8]^h[255&p]^t[g++],u=l[v>>>24]^c[255&f>>>16]^d[255&p>>>8]^h[255&m]^t[g++],f=a,p=o,m=s,v=u;return a=(r[f>>>24]<<24|r[255&p>>>16]<<16|r[255&m>>>8]<<8|r[255&v])^t[g++],o=(r[p>>>24]<<24|r[255&m>>>16]<<16|r[255&v>>>8]<<8|r[255&f])^t[g++],s=(r[m>>>24]<<24|r[255&v>>>16]<<16|r[255&f>>>8]<<8|r[255&p])^t[g++],u=(r[v>>>24]<<24|r[255&f>>>16]<<16|r[255&p>>>8]<<8|r[255&m])^t[g++],[a>>>=0,o>>>=0,s>>>=0,u>>>=0]}function o(e){this._key=r(e),this._reset()}var s=n(3).Buffer,u=[0,1,2,4,8,16,32,64,128,27,54],l=function(){for(var e=Array(256),t=0;256>t;t++)e[t]=128>t?t<<1:283^t<<1;for(var n,r=[],i=[],a=[[],[],[],[]],o=[[],[],[],[]],s=0,u=0,l=0;256>l;++l){n=(n=u^u<<1^u<<2^u<<3^u<<4)>>>8^255&n^99,r[s]=n,i[n]=s;var c=e[s],d=e[c],h=e[d],f=257*e[n]^16843008*n;a[0][s]=f<<24|f>>>8,a[1][s]=f<<16|f>>>16,a[2][s]=f<<8|f>>>24,a[3][s]=f,f=16843009*h^65537*d^257*c^16843008*s,o[0][n]=f<<24|f>>>8,o[1][n]=f<<16|f>>>16,o[2][n]=f<<8|f>>>24,o[3][n]=f,0==s?s=u=1:(s=c^e[e[e[h^c]]],u^=e[e[u]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:a,INV_SUB_MIX:o}}();o.blockSize=16,o.keySize=32,o.prototype.blockSize=o.blockSize,o.prototype.keySize=o.keySize,o.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],a=0;a<t;a++)i[a]=e[a];for(a=t;a<r;a++){var o=i[a-1];0==a%t?(o=o<<8|o>>>24,o=l.SBOX[o>>>24]<<24|l.SBOX[255&o>>>16]<<16|l.SBOX[255&o>>>8]<<8|l.SBOX[255&o],o^=u[0|a/t]<<24):6<t&&4==a%t&&(o=l.SBOX[o>>>24]<<24|l.SBOX[255&o>>>16]<<16|l.SBOX[255&o>>>8]<<8|l.SBOX[255&o]),i[a]=i[a-t]^o}for(var s=[],c=0;c<r;c++){var d=r-c,h=i[d-(c%4?0:4)];s[c]=4>c||4>=d?h:l.INV_SUB_MIX[0][l.SBOX[h>>>24]]^l.INV_SUB_MIX[1][l.SBOX[255&h>>>16]]^l.INV_SUB_MIX[2][l.SBOX[255&h>>>8]]^l.INV_SUB_MIX[3][l.SBOX[255&h]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=s},o.prototype.encryptBlockRaw=function(e){return a(e=r(e),this._keySchedule,l.SUB_MIX,l.SBOX,this._nRounds)},o.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=s.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},o.prototype.decryptBlock=function(e){var t=(e=r(e))[1];e[1]=e[3],e[3]=t;var n=a(e,this._invKeySchedule,l.INV_SUB_MIX,l.INV_SBOX,this._nRounds),i=s.allocUnsafe(16);return i.writeUInt32BE(n[0],0),i.writeUInt32BE(n[3],4),i.writeUInt32BE(n[2],8),i.writeUInt32BE(n[1],12),i},o.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},e.exports.AES=o},function(e,t,n){"use strict";var r=n(17).JSONSchema,i=(n(399).BASE64_REGEXP,new r({type:"object",properties:{kty:{type:"string",enum:["RSA","EC","oct"]},use:{type:"string",enum:["sig","enc"]},key_ops:{type:"array",items:{enum:["sign","verify","encrypt","decrypt","wrapKey","unwrapKey","deriveKey","deriveBits"]}},alg:{type:"string",enum:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512","none"]},kid:{type:"string"},x5u:{type:"string"},x5c:{type:"array"},x5t:{type:"string"}}}));e.exports=i},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__72__},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return{getItem:function(t){return a.default.resolve(e.getItem(t))},setItem:function(t,n){return a.default.resolve(e.setItem(t,n))},removeItem:function(t){return a.default.resolve(e.removeItem(t))}}}Object.defineProperty(t,"__esModule",{value:!0}),t.postMessageStorage=t.memStorage=t.updateStorage=t.getData=t.defaultStorage=t.NAMESPACE=void 0;var a=r(n(76)),o=r(n(431)),s=r(n(34)),u=r(n(33)),l=t.getData=function(){var e=(0,u.default)(s.default.mark(function e(t){var n,r;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=void 0,r=void 0,e.prev=2,e.next=5,t.getItem(d);case 5:n=e.sent,r=JSON.parse(n||"{}"),e.next=14;break;case 9:e.prev=9,e.t0=e.catch(2),console.warn("Could not deserialize data:",n),console.error(e.t0),r={};case 14:return e.abrupt("return",r);case 15:case"end":return e.stop()}},e,this,[[2,9]])}));return function(t){return e.apply(this,arguments)}}();t.updateStorage=function(){var e=(0,u.default)(s.default.mark(function e(t,n){var r,i;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l(t);case 2:return r=e.sent,i=n(r),e.next=6,t.setItem(d,(0,o.default)(i));case 6:return e.abrupt("return",i);case 7:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}();t.asyncStorage=i;var c=n(193),d=t.NAMESPACE="solid-auth-client",h=(t.defaultStorage=function(){try{if(window&&window.localStorage)return i(window.localStorage)}catch(e){if(!(e instanceof ReferenceError))throw e}return console.warn("'window.localStorage' unavailable. Creating a (not very useful) in-memory storage object as the default storage interface."),i(h())},t.memStorage=function(){var e={};return{getItem:function(t){return void 0===e[t]?null:e[t]},setItem:function(t,n){e[t]=n},removeItem:function(t){delete e[t]}}});t.postMessageStorage=function(e,t){var n=(0,c.client)(e,t);return{getItem:function(){var e=(0,u.default)(s.default.mark(function e(t){var r;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n({method:"storage/getItem",args:[t]});case 2:if("string"==typeof(r=e.sent)){e.next=5;break}throw new Error("expected postMessage call for 'storage/getItem' to return a string, but got value "+r);case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}},e,void 0)}));return function(t){return e.apply(this,arguments)}}(),setItem:function(e,t){return n({method:"storage/setItem",args:[e,t]})},removeItem:function(e){return n({method:"storage/removeItem",args:[e]})}}}},function(e,t,n){var r=n(26).f,i=n(35),a=n(9)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t){e.exports=!0},function(e,t,n){e.exports={default:n(453),__esModule:!0}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(211),i=n(113);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(461));t.default=r.default||function(e){for(var t,n=1;n<arguments.length;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(20),a=n(27).ArrayIndexOf,o=function(){function e(e,t,n,r,i,a,o,s){void 0===t&&(t=null),void 0===n&&(n=""),void 0===r&&(r=null),void 0===i&&(i=""),void 0===a&&(a=null),void 0===o&&(o=""),void 0===s&&(s=null),this._bindings=new d([]),this._flags=o,""!=n&&(g(0<=n.indexOf(":"),"Document URI not absolute: "+n),this._bindings[""]=n+"#"),this._store=e,i&&e.setGenPrefix(i),this._thisDoc=n,this.source=e.sym(n),this.lines=0,this.statementCount=0,this.startOfLine=0,this.previousLine=0,this._genPrefix=i,this.keywords=new c(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new d([]),this._variables=new d([]),this._parentVariables=new d([]),this._reason=s,this._reason2=null,this._baseURI=r||(n||null),g(!this._baseURI||0<=this._baseURI.indexOf(":")),this._genPrefix||(this._thisDoc?this._genPrefix=this._thisDoc+"#_g":this._genPrefix=RDFSink_uniqueURI()),this._formula=null==t?this._thisDoc?e.formula(n+"#_formula"):e.formula():t,this._context=this._formula,this._parentContext=null}function t(e,t,n,r,i){this._str=n.encode("utf-8"),this._str=n,this._i=r,this._why=i,this.lines=t,this._uri=e}function n(e,t,n,r,i){return"Line "+(t+1)+" of <"+e+">: Bad syntax: "+i+'\nat: "'+f(n,r,r+30)+'"'}var o=String.prototype,s=function(e){e=e.replace(/\r\n/g,"\n");for(var t,n="",r=0;r<e.length;r++)128>(t=e.charCodeAt(r))?n+=_StringfromCharCode(t):127<t&&2048>t?(n+=_StringfromCharCode(192|t>>6),n+=_StringfromCharCode(128|63&t)):(n+=_StringfromCharCode(224|t>>12),n+=_StringfromCharCode(128|63&t>>6),n+=_StringfromCharCode(128|63&t));return n},u="http://www.w3.org/2000/10/swap/log#",l=function(e){return e},c=function(e){return e},d=function(e){if(0<e.length)throw"missing.js: oops nnonempty dict not imp";return[]},h=function(e){return e.length},f=function(e,t,n){if(void 0===e.slice)throw"@@ mising.js: No .slice function for "+e+" of type "+(void 0===e?"undefined":r(e));return void 0===n||null==n?e.slice(t):e.slice(t,n)},p=Error("dummy error stop iteration"),m=function(e){return this.last=0,this.li=e,this.next=function(){if(this.last==this.li.length)throw p;return this.li[this.last++]},this},v=function(e,t){return e.indexOf(t)},g=function(e,t){if(!e){if(t)throw"python Assertion failed: "+t;throw"(python) Assertion failed."}};o.encode=function(e){if("utf-8"!=e)throw"UTF8_converter: can only do utf-8";return s(this)},o.decode=function(e){if("utf-8"!=e)throw"UTF8_converter: can only do utf-8";return this};var b=function(e,t){return i.join(t,e)},y="http://www.w3.org/2002/07/owl#sameAs",w="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",_=w+":",x=/^([-+]?[0-9]+)(\.[0-9]+)?(e[-+]?[0-9]+)?/g,M=/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\.[0-9]*)?)?)?Z?/,k=/[\\\r\n\"]/g,C=/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*/g;return e.prototype.here=function(e){return this._genPrefix+"_L"+this.lines+"C"+(e-this.startOfLine+1)},e.prototype.formula=function(){return this._formula},e.prototype.loadStream=function(e){return this.loadBuf(e.read())},e.prototype.loadBuf=function(e){return this.startDoc(),this.feed(e),this.endDoc()},e.prototype.feed=function(e){for(var t,r=e.decode("utf-8"),i=0;0<=i;){if(0>(t=this.skipSpace(r,i)))return;if(0>(i=this.directiveOrStatement(r,t)))throw n(this._thisDoc,this.lines,r,t,"expected directive or statement")}},e.prototype.directiveOrStatement=function(e,t){var n,r=this.skipSpace(e,t);return 0>r?r:0<=(n=this.directive(e,r))?this.checkDot(e,n):0<=(n=this.statement(e,r))?this.checkDot(e,n):n},e.prototype.tok=function(e,t,n){if("@"==f(t,n,n+1))n=n+1;else if(0>a(this.keywords,e))return-1;var r=n+h(e);return f(t,n,r)==e&&0<=w.indexOf(t.charAt(r))?r:-1},e.prototype.directive=function(e,t){if(0>(s=this.skipSpace(e,t)))return s;var r=new c([]);if(0<(s=this.tok("bind",e,t)))throw n(this._thisDoc,this.lines,e,t,"keyword bind is obsolete: use @prefix");if(0<(s=this.tok("keywords",e,t))){if(0>(t=this.commaSeparatedList(e,s,r,!1)))throw n(this._thisDoc,this.lines,e,t,"'@keywords' needs comma separated list of words");return this.setKeywords(f(r,null,null)),t}if(0<(s=this.tok("forAll",e,t))){if(0>(t=this.commaSeparatedList(e,s,r,!0)))throw n(this._thisDoc,this.lines,e,t,"Bad variable list after @forAll");var i=new m(r);try{for(;;){var o=i.next();(0>a(this._variables,o)||0<=a(this._parentVariables,o))&&(this._variables[o]=this._context.newUniversal(o))}}catch(l){if(l!=p)throw l}return t}if(0<(s=this.tok("forSome",e,t))){if(0>(t=this.commaSeparatedList(e,s,r,this.uri_ref2)))throw n(this._thisDoc,this.lines,e,t,"Bad variable list after @forSome");i=new m(r);try{for(;;){o=i.next();this._context.declareExistential(o)}}catch(l){if(l!=p)throw l}return t}if(0<=(s=this.tok("prefix",e,t))){var s,u=new c([]);if(0>(t=this.qname(e,s,u)))throw n(this._thisDoc,this.lines,e,s,"expected qname after @prefix");if(0>(s=this.uri_ref2(e,t,u)))throw n(this._thisDoc,this.lines,e,t,"expected <uriref> after @prefix _qname_");var l=u[1].uri;if(this._baseURI)l=b(this._baseURI,l);else g(0<=l.indexOf(":"),"With no base URI, cannot handle relative URI for NS");return g(0<=l.indexOf(":")),this._bindings[u[0][0]]=l,this.bind(u[0][0],function(e){return encodeURI(e)}(l)),s}if(0<=(s=this.tok("base",e,t))){u=new c([]);if(0>(t=this.uri_ref2(e,s,u)))throw n(this._thisDoc,this.lines,e,s,"expected <uri> after @base ");l=u[0].uri;if(!this._baseURI)throw n(this._thisDoc,this.lines,e,s,"With no previous base URI, cannot use relative URI in @base <"+l+">");l=b(this._baseURI,l);return g(0<=l.indexOf(":")),this._baseURI=l,t}return-1},e.prototype.bind=function(e,t){""==e||this._store.setPrefixForURI(e,t)},e.prototype.setKeywords=function(e){null==e?this.keywordsSet=0:(this.keywords=e,this.keywordsSet=1)},e.prototype.startDoc=function(){},e.prototype.endDoc=function(){return this._formula},e.prototype.makeStatement=function(e){e[0].add(e[2],e[1],e[3],this.source),this.statementCount+=1},e.prototype.statement=function(e,t){var r=new c([]);if(0>(t=this.object(e,t,r)))return t;var i=this.property_list(e,t,r[0]);if(0>i)throw n(this._thisDoc,this.lines,e,t,"expected propertylist");return i},e.prototype.subject=function(e,t,n){return this.item(e,t,n)},e.prototype.verb=function(e,t,r){if(0>(a=this.skipSpace(e,t)))return a;var i=new c([]);if(0<=(a=this.tok("has",e,t))){if(0>(t=this.prop(e,a,i)))throw n(this._thisDoc,this.lines,e,a,"expected property after 'has'");return r.push(new l(["->",i[0]])),t}if(0<=(a=this.tok("is",e,t))){if(0>(t=this.prop(e,a,i)))throw n(this._thisDoc,this.lines,e,a,"expected <property> after 'is'");if(0>(a=this.skipSpace(e,t)))throw n(this._thisDoc,this.lines,e,t,"End of file found, expected property after 'is'");var a;t=a;if(0>(a=this.tok("of",e,t)))throw n(this._thisDoc,this.lines,e,t,"expected 'of' after 'is' <prop>");return r.push(new l(["<-",i[0]])),a}if(0<=(a=this.tok("a",e,t)))return r.push(new l(["->",this._store.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")])),a;if("<="==f(e,t,t+2))return r.push(new l(["<-",this._store.sym(u+"implies")])),t+2;if("="==f(e,t,t+1))return">"==f(e,t+1,t+2)?(r.push(new l(["->",this._store.sym(u+"implies")])),t+2):(r.push(new l(["->",this._store.sym(y)])),t+1);if(":="==f(e,t,t+2))return r.push(new l(["->",u+"becomes"])),t+2;if(0<=(a=this.prop(e,t,i)))return r.push(new l(["->",i[0]])),a;if(">-"==f(e,t,t+2)||"<-"==f(e,t,t+2))throw n(this._thisDoc,this.lines,e,a,">- ... -> syntax is obsolete.");return-1},e.prototype.prop=function(e,t,n){return this.item(e,t,n)},e.prototype.item=function(e,t,n){return this.path(e,t,n)},e.prototype.blankNode=function(e){return this._context.bnode(e,this._reason2)},e.prototype.path=function(e,t,r){if(0>(o=this.nodeOrLiteral(e,t,r)))return o;for(;0<="!^.".indexOf(f(e,o,o+1));){var i=f(e,o,o+1);if("."==i){var a=f(e,o+1,o+2);if(!a||0<=_.indexOf(a)&&0>":?<[{(".indexOf(a))break}var o,s=r.pop(),u=this.blankNode(this.here(o));if(0>(o=this.node(e,o+1,r)))throw n(this._thisDoc,this.lines,e,o,"EOF found in middle of path syntax");var c=r.pop();"^"==i?this.makeStatement(new l([this._context,c,u,s])):this.makeStatement(new l([this._context,c,s,u])),r.push(u)}return o},e.prototype.anonymousNode=function(e){if(t=this._anonymousNodes[e])return t;var t=this._store.bnode(e);return this._anonymousNodes[e]=t,t},e.prototype.node=function(e,t,r,i){void 0===i&&(i=null);var a=i;if(0>(b=this.skipSpace(e,t)))return b;var o=f(e,t=b,t+1);if("["==o){var s=this.here(t);if(0>(b=this.skipSpace(e,t+1)))throw n(this._thisDoc,this.lines,e,t,"EOF after '['");if("="==f(e,b,b+1)){var t=b+1,u=new c([]);if(!(0<=(b=this.objectList(e,t,u))))throw n(this._thisDoc,this.lines,e,t,"objectList expected after [= ");a=u[0];if(1<h(u)){var v=new m(u);try{for(;;){var g=v.next();this.makeStatement(new l([this._context,this._store.sym(y),a,g]))}}catch(t){if(t!=p)throw t}}if(0>(b=this.skipSpace(e,b)))throw n(this._thisDoc,this.lines,e,t,"EOF when objectList expected after [ = ");if(";"==f(e,b,b+1))var b=b+1}if(null==a)a=this.blankNode(s);if(0>(t=this.property_list(e,b,a)))throw n(this._thisDoc,this.lines,e,b,"property_list expected");if(0>(b=this.skipSpace(e,t)))throw n(this._thisDoc,this.lines,e,t,"EOF when ']' expected after [ <propertyList>");if("]"!=f(e,b,b+1))throw n(this._thisDoc,this.lines,e,b,"']' expected");return r.push(a),b+1}if("{"==o){if("$"==f(e,t+1,t+2)){for(var b=(t+=1)+1,w=new c([]),_=!0;;){if(0>(t=this.skipSpace(e,b)))throw n(this._thisDoc,this.lines,e,t,"needed '$}', found end.");if("$}"==f(e,t,t+2)){var b=t+2;break}if(_)_=!1;else{if(","!=f(e,t,t+1))throw n(this._thisDoc,this.lines,e,t,"expected: ','");t+=1}var x=new c([]);if(0>(b=this.item(e,t,x)))throw n(this._thisDoc,this.lines,e,t,"expected item in set or '$}'");w.push(x[0])}return r.push(this._store.newSet(w,this._context)),b}var b=t+1,M=this._parentContext;this._parentContext=this._context;var k=this._anonymousNodes,C=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new d([]),this._variables=this._variables.slice();var E=this._reason2;if(this._reason2=null,null==a)a=this._store.formula();for(this._context=a;;){if(0>(t=this.skipSpace(e,b)))throw n(this._thisDoc,this.lines,e,t,"needed '}', found end.");if("}"==f(e,t,t+1)){var b=t+1;break}if(0>(b=this.directiveOrStatement(e,t)))throw n(this._thisDoc,this.lines,e,t,"expected statement or '}'")}return this._anonymousNodes=k,this._variables=this._parentVariables,this._parentVariables=C,this._context=this._parentContext,this._reason2=E,this._parentContext=M,r.push(a.close()),b}if("("==o){var A=this._store.list;if("$"==f(e,t+1,t+2)){A=this._store.newSet;t+=1}for(b=t+1,w=new c([]);;){if(0>(t=this.skipSpace(e,b)))throw n(this._thisDoc,this.lines,e,t,"needed ')', found end.");if(")"==f(e,t,t+1)){b=t+1;break}x=new c([]);if(0>(b=this.item(e,t,x)))throw n(this._thisDoc,this.lines,e,t,"expected item in list or ')'");w.push(x[0])}return r.push(A(w,this._context)),b}if(0<=(b=this.tok("this",e,t)))throw n(this._thisDoc,this.lines,e,t,"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.");if(0<=(b=this.tok("true",e,t)))return r.push(!0),b;if(0<=(b=this.tok("false",e,t)))return r.push(!1),b;if(null==a&&0<=(b=this.uri_ref2(e,t,r)))return b;return-1},e.prototype.property_list=function(e,t,r){for(;;){if(0>(v=this.skipSpace(e,t)))throw n(this._thisDoc,this.lines,e,t,"EOF found when expected verb in property list");if(":-"!=f(e,v,v+2)){t=v;var i=new c([]);if(0>=(v=this.verb(e,t,i)))return t;var a=new c([]);if(0>(t=this.objectList(e,v,a)))throw n(this._thisDoc,this.lines,e,v,"objectList expected");var o=new m(a);try{for(;;){var s=o.next(),u=i[0],d=u[0],h=u[1];"->"==d?this.makeStatement(new l([this._context,h,r,s])):this.makeStatement(new l([this._context,h,s,r]))}}catch(t){if(t!=p)throw t}if(0>(v=this.skipSpace(e,t)))throw n(this._thisDoc,this.lines,e,v,"EOF found in list of objects");if(";"!=f(e,t,t+1))return t;t=t+1}else{var v,t=v+2,g=new c([]);if(0>(v=this.node(e,t,g,r)))throw n(this._thisDoc,this.lines,e,t,"bad {} or () or [] node after :- ");var t=v}}},e.prototype.commaSeparatedList=function(e,t,r,i){if(0>(a=this.skipSpace(e,t)))throw n(this._thisDoc,this.lines,e,a,"EOF found expecting comma sep list");if("."==e.charAt(a))return t;if(i)var a=this.uri_ref2(e,a,r);else a=this.bareWord(e,a,r);if(0>a)return-1;for(;;){if(0>(t=this.skipSpace(e,a)))return t;var o=f(e,t,t+1);if(","!=o)return"."==o?t:-1;if(i)a=this.uri_ref2(e,t+1,r);else a=this.bareWord(e,t+1,r);if(0>a)throw n(this._thisDoc,this.lines,e,a,"bad list content")}},e.prototype.objectList=function(e,t,r){if(0>(t=this.object(e,t,r)))return-1;for(;;){var i=this.skipSpace(e,t);if(0>i)throw n(this._thisDoc,this.lines,e,i,"EOF found after object");if(","!=f(e,i,i+1))return i;if(0>(t=this.object(e,i+1,r)))return t}},e.prototype.checkDot=function(e,t){var r=this.skipSpace(e,t);if(0>r)return r;if("."==f(e,r,r+1))return r+1;if("}"==f(e,r,r+1))return r;if("]"==f(e,r,r+1))return r;throw n(this._thisDoc,this.lines,e,r,"expected '.' or '}' or ']' at end of statement")},e.prototype.uri_ref2=function(e,t,r){var i=new c([]);if(0<=(y=this.qname(e,t,i))){var o=i[0],s=o[0],u=o[1];if(null==s){g(0,"not used?");var l=this._baseURI+"#"}else{if(!(l=this._bindings[s])){if("_"==s)return r.push(this.anonymousNode(u)),y;throw n(this._thisDoc,this.lines,e,t,"Prefix "+s+" not bound.")}}var d=this._store.sym(l+u);return 0<=a(this._variables,d)?r.push(this._variables[d]):r.push(d),y}if(0>(t=this.skipSpace(e,t)))return-1;if("?"==e.charAt(t)){var p=new c([]);return 0<(y=this.variable(e,t,p))?(r.push(p[0]),y):-1}if("<"==e.charAt(t)){for(var m=t=t+1;t<h(e);){if(">"==e.charAt(t)){var v=f(e,m,t);if(this._baseURI)v=b(this._baseURI,v);else g(0<=v.indexOf(":"),"With no base URI, cannot deal with relative URIs");if("#"==f(e,t-1,t)&&"#"!=f(v,-1,null))v=v+"#";d=this._store.sym(v);return 0<=a(this._variables,d)?r.push(this._variables[d]):r.push(d),t+1}t=t+1}throw n(this._thisDoc,this.lines,e,y,"unterminated URI reference")}if(this.keywordsSet){var y;p=new c([]);if(0>(y=this.bareWord(e,t,p)))return-1;if(0<=a(this.keywords,p[0]))throw n(this._thisDoc,this.lines,e,t,'Keyword "'+p[0]+'" not allowed here.');return r.push(this._store.sym(this._bindings[""]+p[0])),y}return-1},e.prototype.skipSpace=function(e,t){for(var n,r=t||0;r<e.length;r++)if(n=e.charAt(r),0>" \n\r\t\f\v            ​\u2028\u2029 ".indexOf(n)){if("#"!==e.charAt(r))return r;for(;;r++){if(r===e.length)return-1;if("\n"===e.charAt(r)){++this.lines;break}}}else"\n"===e.charAt(r)&&++this.lines;return-1},e.prototype.variable=function(e,t,r){if(0>(i=this.skipSpace(e,t)))return-1;if("?"!=f(e,i,i+1))return-1;var i;t=i+=1;if(0<="0123456789-".indexOf(e.charAt(i)))throw n(this._thisDoc,this.lines,e,i,"Varible name can't start with '"+e.charAt(i)+"s'");for(;t<h(e)&&0>_.indexOf(e.charAt(t));)t=t+1;if(null==this._parentContext)throw n(this._thisDoc,this.lines,e,i,"Can't use ?xxx syntax for variable in outermost level: "+f(e,i-1,t));return r.push(this._store.variable(f(e,i,t))),t},e.prototype.bareWord=function(e,t,n){var r=this.skipSpace(e,t);if(0>r)return-1;var i=e.charAt(r);if(0<="0123456789-".indexOf(i))return-1;if(0<=_.indexOf(i))return-1;for(t=r;t<h(e)&&0>_.indexOf(e.charAt(t));)++t;return n.push(f(e,r,t)),t},e.prototype.qname=function(e,t,n){if(0>(t=this.skipSpace(e,t)))return-1;var r=e.charAt(t);if(0<="0123456789-+".indexOf(r))return-1;if(0>_.indexOf(r)){var i=r;for(t=t+1;t<h(e)&&(r=e.charAt(t),0>_.indexOf(r));)i=i+r,t=t+1}else i="";if(t<h(e)&&":"==e.charAt(t)){var o=i;for(t=t+1,i="";t<h(e)&&(r=e.charAt(t),0>_.indexOf(r));)i=i+r,t=t+1;return n.push(new l([o,i])),t}return i&&this.keywordsSet&&0>a(this.keywords,i)?(n.push(new l(["",i])),t):-1},e.prototype.object=function(e,t,n){if(0<=(o=this.subject(e,t,n)))return o;if(0>(o=this.skipSpace(e,t)))return-1;t=o;var r=null,i=e.charAt(t);if('"'==i||"'"==i){r=e.slice(t,t+3==i+i)?i+i+i:i;t=t+h(r);var a=this.strconst(e,t,r),o=a[0],s=a[1];return n.push(this._store.literal(s)),o}return-1},e.prototype.nodeOrLiteral=function(e,t,r){if(0<=(l=this.node(e,t,r)))return l;if(0>(l=this.skipSpace(e,t)))return-1;t=l;var i=e.charAt(t);if(0<="-+0987654321".indexOf(i)){if(M.lastIndex=0,null!=(m=M.exec(e.slice(t)))){l=t+(a=m[0]).length,0<=a.indexOf("T")?r.push(this._store.literal(a,void 0,this._store.sym("http://www.w3.org/2001/XMLSchema#dateTime"))):r.push(this._store.literal(a,void 0,this._store.sym("http://www.w3.org/2001/XMLSchema#date")))}else{var a;if(x.lastIndex=0,null==(m=x.exec(e.slice(t))))throw n(this._thisDoc,this.lines,e,t,"Bad number or date syntax");l=t+x.lastIndex,0<=(a=f(e,t,l)).indexOf("e")?r.push(this._store.literal(parseFloat(a),void 0,this._store.sym("http://www.w3.org/2001/XMLSchema#double"))):0<=f(e,t,l).indexOf(".")?r.push(this._store.literal(parseFloat(a),void 0,this._store.sym("http://www.w3.org/2001/XMLSchema#decimal"))):r.push(this._store.literal(parseInt(a),void 0,this._store.sym("http://www.w3.org/2001/XMLSchema#integer")))}return l}if('"'==e.charAt(t)){if('"""'==f(e,t,t+3))var o='"""';else o='"';t=t+h(o);var s=null,u=this.strconst(e,t,o),l=u[0],d=u[1],p=null;if("@"==f(e,l,l+1)){var m;if(C.lastIndex=0,null==(m=C.exec(e.slice(l+1))))throw n(this._thisDoc,startline,e,t,"Bad language code syntax on string literal, after @");t=C.lastIndex+l+1,p=f(e,l+1,t),l=t}if("^^"==f(e,l,l+2)){var v=new c([]);l=this.uri_ref2(e,l+2,v),s=v[0]}return r.push(this._store.literal(d,p,s)),l}return-1},e.prototype.strconst=function(e,t,r){for(var i=t,a="",o=this.lines;i<h(e);){if(t=i+h(r),f(e,i,t)==r)return new l([t,a]);if('"'!=e.charAt(i)){if(k.lastIndex=0,!k.exec(e.slice(i)))throw n(this._thisDoc,o,e,i,"Closing quote missing in string at ^ in "+f(e,i-20,i)+"^"+f(e,i,i+20));t=i+k.lastIndex-1,a=a+f(e,i,t);if('"'!=(c=e.charAt(t)))if("\r"!=c){if("\n"==c){if('"'==r)throw n(this._thisDoc,o,e,t,"newline found in string literal");++this.lines;a=a+c,i=t+1;this.previousLine=this.startOfLine,this.startOfLine=i}else if("\\"==c){if(!(c=f(e,i=t+1,i+1)))throw n(this._thisDoc,o,e,t,"unterminated string literal (2)");var s=v('abfrtvn\\"',c);if(0<=s)a=a+'a\b\f\r\t\v\n\\"'.charAt(s),i=i+1;else if("u"==c)i=(u=this.uEscape(e,i+1,o))[0],a=a+(c=u[1]);else{if("U"!=c)throw n(this._thisDoc,this.lines,e,t,"bad escape");var u,c;i=(u=this.UEscape(e,i+1,o))[0],a=a+(c=u[1])}}}else var i=t+1;else var i=t}else var a=a+'"',i=i+1}throw n(this._thisDoc,this.lines,e,t,"unterminated string literal")},e.prototype.uEscape=function(e,t,r){for(var i=t,a=0,o=0;4>a;){var s=f(e,i,i+1).toLowerCase();i=i+1;if(""==s)throw n(this._thisDoc,r,e,t,"unterminated string literal(3)");var u=v("0123456789abcdef",s);if(0>u)throw n(this._thisDoc,r,e,t,"bad string literal hex escape");o=16*o+u,a=a+1}var c=_StringfromCharCode(o);return new l([i,c])},e.prototype.UEscape=function(e,t,r){for(var i=t,a=0,o="\\U";8>a;){var s=f(e,i,i+1).toLowerCase();i=i+1;if(""==s)throw n(this._thisDoc,r,e,t,"unterminated string literal(3)");if(0>v("0123456789abcdef",s))throw n(this._thisDoc,r,e,t,"bad string literal hex escape");o=o+s,a=a+1}var u=function(e){return _StringfromCharCode(e)}("0x"+f(o,2,10)-0);return new l([i,u])},t.prototype.toString=function(){var e=this._str,t=this._i,n=0;if(60<t){var r="...";n=t-60}else r="";if(60<h(e)-t)var i="...";else i="";return'Line %i of <%s>: Bad syntax (%s) at ^ in:\n"%s%s^%s%s"'%new l([this.lines+1,this._uri,this._why,r,f(e,n,t),f(e,t,t+60),i])},function(t,n,r,i,a,o,s,u){return new e(t,n,r,i,a,o,s,u)}}();e.exports=o},function(e,t,n){"use strict";function r(e){return new d(e)}function i(e,t,n,r){return r=r||new u,new h(e,t,n,r)}var a=function(e){return e&&e.__esModule?e:{default:e}}(n(89)),o=n(40),s=n(88),u=n(463),l=n(123),c=n(48),d=n(12),h=n(86),f=n(85);e.exports.blankNode=function(e){return new o(e)},e.exports.defaultGraph=function(){return new u},e.exports.graph=function(){return new a.default},e.exports.literal=function(e,t){return"string"==typeof t?-1===t.indexOf(":")?new c(e,t):new c(e,null,r(t)):new c(e,null,t)},e.exports.namedNode=r,e.exports.quad=i,e.exports.triple=function(e,t,n){return i(e,t,n)},e.exports.variable=function(e){return new f(e)},e.exports.collection=function(e){return new s(e)},e.exports.fetcher=function(e,t){return new l(e,t)},e.exports.lit=function(e,t,n){return new c(""+e,t,n)},e.exports.st=function(e,t,n,r){return new h(e,t,n,r)}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}}(n(89)),i=n(39),a=n(20).docpart;e.exports.Query=function e(t,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.pat=new r.default,this.vars=[],this.name=t,this.id=n},e.exports.indexedFormulaQuery=function(e,t,n,r){function o(e,t){return e.nvars===t.nvars?e.index.length-t.index.length:e.nvars-t.nvars}var s=function(e){var t,n="";for(t in e)e.hasOwnProperty(t)&&(n+=" "+t+" -> "+e[t]);return n},u=function(e){var t,n="Bindings: ",r=e.length;for(t=0;t<r;t++)n+=s(e[t][0])+";\n\t";return n},l=function(e,t,n,r){var i=n[e];if(void 0===i){if(e.isVar){var a=[];return a[e]=t,[[a,null]]}i=e}if(!i.complexType)return r.redirections[i]&&(i=r.redirections[i]),r.redirections[t]&&(t=r.redirections[t]),i.sameTerm(t)?[[[],null]]:[];if(e instanceof Array)return t instanceof Array?c(e,t,n):[];throw new Error("query.js: oops - code not written yet")},c=function e(t,n,r,i){var a;if(t.length!==n.length)return[];if(!t.length)return[[[],null]];var o=l(t[0],n[0],r,i);if(0===o.length)return o;var s,u,c,d,h,f,p,m=[],v=o.length;for(s=0;s<v;s++){for(h in p=[],u=o[s][0])u.hasOwnProperty(h)&&(p[h]=u[h]);for(h in r)r.hasOwnProperty(h)&&(p[h]=r[h]);for(d=(a=e(t.slice(1),n.slice(1),p,i)).length,c=0;c<d;c++){for(h in f=a[c][0],u)u.hasOwnProperty(h)&&(f[h]=u[h]);m.push([f,null])}}return m},d=function(e,t){var n=t[e];return void 0===n?e:n},h=function(e,t){var n,r={};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r},f=function(e,t){return this.trunkBindings=t,this.originalCallback=e,this.branches=[],this};f.prototype.checkAllDone=function(){var e;for(e=0;e<this.branches.length;e++)if(!this.branches[e].done)return;i.debug("OPTIONAL BIDNINGS ALL DONE:"),this.doCallBacks(this.branches.length-1,this.trunkBindings)},f.prototype.doCallBacks=function(e,t){var n;if(0>e)return this.originalCallback(t);for(n=0;n<this.branches[e].results.length;n++)this.doCallBacks(e-1,h(t,this.branches[e].results[n]))};var p=function(e,t){return this.count=0,this.success=!1,this.done=!1,this.callback=e,this.onDone=t,this};p.prototype.reportMatch=function(e){this.callback(e),this.success=!0},p.prototype.reportDone=function(){this.done=!0,i.info("Mandatory query branch finished.***"),void 0!==this.onDone&&this.onDone()};var m=function(e){return this.count=0,this.done=!1,this.results=[],this.junction=e,e.branches.push(this),this};m.prototype.reportMatch=function(e){this.results.push(e)},m.prototype.reportDone=function(){i.debug("Optional branch finished - results.length = "+this.results.length),0===this.results.length&&(this.results.push({}),i.debug("Optional branch FAILED - that's OK.")),this.done=!0,this.junction.checkAllDone()};var v=function(e,t,n){var r,i,a,o,s;for(t.nvars=0,t.index=null,i=[t.subject,t.predicate,t.object],s=[e.subjectIndex,e.predicateIndex,e.objectIndex],o=0;3>o;o++)if(i[o].isVar&&void 0===n[i[o]])t.nvars++;else{if(r=d(i[o],n),e.redirections[r.hashString()]&&(r=e.redirections[r.hashString()]),!(a=s[o][r.hashString()]))return t.index=[],!1;(null===t.index||t.index.length>a.length)&&(t.index=a)}return null===t.index&&(t.index=e.statements),!0},g=function e(n,r,o,u,l,c,d){i.debug("Match begins, Branch count now: "+d.count+" for "+d.pattern_debug);var h=n.fetcher?n.fetcher:null,p=r.statements;if(0===p.length){if(i.debug("FOUND MATCH WITH BINDINGS:"+s(o)),0===r.optional.length)d.reportMatch(o);else{i.debug("OPTIONAL: "+r.optional);var v,g=new f(t,o),b=[];for(v=0;v<r.optional.length;v++)b[v]=new m(g),b[v].pattern_debug=r.optional[v];for(v=0;v<r.optional.length;v++)++b[v].count,e(n,r.optional[v],o,"",l,t,b[v])}return d.count--,void i.debug("Match ends -- success , Branch count now: "+d.count+" for "+d.pattern_debug)}var w,_,x=p.length;if(h){var M=function(t,i){var a=t.uri.split("#")[0];h.nowOrWhenFetched(a,void 0,function(i,a,s){i||console.log("Error following link to <"+t.uri+"> in query: "+a),e(n,r,o,u,l,c,d)})};for(_=0;_<x;_++){if(w=p[_],void 0!==o[w.subject]&&o[w.subject].uri&&h&&"unrequested"===h.getState(a(o[w.subject].uri)))return void M(o[w.subject]);if(void 0!==o[w.object]&&o[w.object].uri&&h&&"unrequested"===h.getState(a(o[w.object].uri)))return void M(o[w.object])}}y(n,r,o,u,l,c,d)},b=function(e,t){var n,r,i=!0;for(n in e)e.hasOwnProperty(n)&&t[n]&&(r=t[n].test)&&!r(e[n])&&(i=!1);return i},y=function(e,t,n,r,a,l,d){var h,f,p,m,y,w,_,x=t.statements,M=x.length;for(h=0;h<M;h++)_=x[h],i.info("match2: item="+_+", bindingsSoFar="+s(n)),v(e,_,n);x.sort(o),_=x[0];var k=e.formula();k.optional=t.optional,k.constraints=t.constraints,k.statements=x.slice(1),i.debug(r+"match2 searching "+_.index.length+" for "+_+"; bindings so far="+s(n));var C,E,A,T=_.index.length,S=0;for(C=0;C<T;C++)for(A=_.index[C],E=c([_.subject,_.predicate,_.object],[A.subject,A.predicate,A.object],n,e),i.info(r+" From first: "+E.length+": "+u(E)),p=E.length,f=0;f<p;f++)if(y=[],w=E[f][0],b(w,t.constraints)){for(m in w)w.hasOwnProperty(m)&&(y[m]=w[m]);for(m in n)n.hasOwnProperty(m)&&(y[m]=n[m]);d.count++,S++,g(e,k,y,r+" ",a,l,d)}else i.debug("Branch count CS: "+d.count);d.count--,0==S&&i.debug("Match2 fails completely on "+_),i.debug("Match2 ends, Branch count: "+d.count+" for "+d.pattern_debug),0===d.count&&(i.debug("Branch finished."),d.reportDone())},w=this;i.debug("Query on "+this.statements.length);var _=new p(t,r);return _.count++,void setTimeout(function(){g(w,e.pat,e.pat.initBindings,"",n,t,_)},0)}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(49),a=n(19),o=n(20),s=function(e){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.termType=t.termType,n.value=e,n.base="varid:",n.uri=o.join(e,n.base),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a),r(t,[{key:"equals",value:function(e){return!!e&&this.termType===e.termType&&this.value===e.value}},{key:"hashString",value:function(){return this.toString()}},{key:"substitute",value:function(e){var t;return null==(t=e[this.toNT()])?this:t}},{key:"toString",value:function(){return this.uri.slice(0,this.base.length)===this.base?"?"+this.uri.slice(this.base.length):"?"+this.uri}}]),t}();s.termType="Variable",s.prototype.classOrder=i.Variable,s.prototype.isVar=1,e.exports=s},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(19),a=function(){function e(t,n,r,a){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.subject=i.fromValue(t),this.predicate=i.fromValue(n),this.object=i.fromValue(r),this.why=a}return r(e,[{key:"equals",value:function(e){return e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}},{key:"substitute",value:function(t){var n=new e(this.subject.substitute(t),this.predicate.substitute(t),this.object.substitute(t),this.why.substitute(t));return console.log("@@@ statement substitute:"+n),n}},{key:"toCanonical",value:function(){var e=[this.subject.toCanonical(),this.predicate.toCanonical(),this.object.toCanonical()];return this.graph&&"DefaultGraph"!==this.graph.termType&&e.push(this.graph.toCanonical()),e.join(" ")+" ."}},{key:"toNT",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT()].join(" ")+" ."}},{key:"toString",value:function(){return this.toNT()}},{key:"graph",get:function(){return this.why},set:function(e){this.why=e}}]),e}();e.exports=a},function(e,t,n){"use strict";(function(t){e.exports=!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?{nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,n)});case 3:return t.nextTick(function(){e.call(null,n,r)});case 4:return t.nextTick(function(){e.call(null,n,r,i)});default:for(a=Array(s-1),o=0;o<a.length;)a[o++]=arguments[o];return t.nextTick(function(){e.apply(null,a)})}}}:t}).call(this,n(11))},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(40),a=n(49),o=n(19),s=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.termType=t.termType,n.id=i.nextId++,n.elements=[],n.closed=!1,e&&0<e.length&&e.forEach(function(e){n.elements.push(o.fromValue(e))}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o),r(t,[{key:"append",value:function(e){return this.elements.push(e)}},{key:"close",value:function(){return this.closed=!0,this.closed}},{key:"shift",value:function(){return this.elements.shift()}},{key:"substitute",value:function(e){return new t(this.elements.map(function(t){t.substitute(e)}))}},{key:"toNT",value:function(){return i.NTAnonymousNodePrefix+this.id}},{key:"toString",value:function(){return"("+this.elements.join(" ")+")"}},{key:"unshift",value:function(e){return this.elements.unshift(e)}}]),t}();s.termType="Collection",s.prototype.classOrder=a.Collection,s.prototype.compareTerm=i.prototype.compareTerm,s.prototype.isVar=0,e.exports=s},function(e,t,n){"use strict";function r(e,t,n,r){var i=e.any(t,n,void 0);return!!i&&(e.equate(i,r),!0)}function i(e,t,n,r){var i=e.any(void 0,n,r);return!!i&&(e.equate(i,t),!0)}function a(e,t,n,r,i){e.typeCallback&&e.typeCallback(e,r,i);var a=e.classActions[r.hashString()],o=!1;if(a)for(var s=0;s<a.length;s++)o=o||a[s](e,t,n,r,i);return o}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(27).ArrayIndexOf,u=n(228),l=n(27).RDFArrayRemove,c=n(86),d=n(19),h=n(85),f="http://www.w3.org/2002/07/owl#",p=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.propertyActions=[],n.classActions=[],n.redirections=[],n.aliases=[],n.HTTPRedirects=[],n.subjectIndex=[],n.predicateIndex=[],n.objectIndex=[],n.whyIndex=[],n.index=[n.subjectIndex,n.predicateIndex,n.objectIndex,n.whyIndex],n.namespaces={},n.features=e||["sameAs","InverseFunctionalProperty","FunctionalProperty"],n.initPropertyActions(n.features),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u),o(t,[{key:"substitute",value:function(e){var n=this.statements.map(function(t){return t.substitute(e)}),r=new t;return r.add(n),r}},{key:"applyPatch",value:function(e,t,r){var i,a=n(84).Query,o=this,s=null,u=function(n){if(e.delete){i=e.delete,s&&(i=i.substitute(s));var a=[],u=(i=i.statements).map(function(e){var n=o.statementsMatching(e.subject,e.predicate,e.object,t);return 0===n.length?(a.push(e),null):n[0]});if(a.length)return r("Could not find to delete: "+a.join("\n or "));u.map(function(e){o.remove(e)})}e.insert&&(i=e.insert,s&&(i=i.substitute(s)),(i=i.statements).map(function(e){e.why=t,o.add(e.subject,e.predicate,e.object,e.why)})),n()};if(e.where){var l=new a("patch");l.pat=e.where,l.pat.statements.map(function(e){e.why=t});var c=[];o.query(l,function(e){c.push(e)},o.fetcher,function(){return 0===c.length?r("No match found to be patched:"+e.where):1<c.length?r("Patch ambiguous. No patch done."):(s=c[0],void u(r))})}else u(r)}},{key:"declareExistential",value:function(e){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(e),e}},{key:"initPropertyActions",value:function(e){this.propertyActions["<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"]=[a],0<=s(e,"sameAs")&&(this.propertyActions["<http://www.w3.org/2002/07/owl#sameAs>"]=[function(e,t,n,r,i){return e.equate(t,r),!0}]),0<=s(e,"InverseFunctionalProperty")&&(this.classActions["<"+f+"InverseFunctionalProperty>"]=[function(e,t,n,r,a){return e.newPropertyAction(t,i)}]),0<=s(e,"FunctionalProperty")&&(this.classActions["<"+f+"FunctionalProperty>"]=[function(e,t,n,i,a){return e.newPropertyAction(t,r)}])}},{key:"add",value:function(e,n,r,i){var a,o,s;if(1===arguments.length){if(e instanceof Array)for(a=0;a<e.length;a++)this.add(e[a]);else e instanceof c?this.add(e.subject,e.predicate,e.object,e.why):e instanceof t&&this.add(e.statements);return this}i||(i=this.fetcher?this.fetcher.appNode:this.sym("chrome:theSession")),e=d.fromValue(e),n=d.fromValue(n),r=d.fromValue(r),i=d.fromValue(i),this.predicateCallback&&this.predicateCallback(this,n,i);var u=this.canon(n).hashString(),l=!1;if(o=this.propertyActions[u])for(a=0;a<o.length;a++)l=l||o[a](this,e,n,r,i);if(this.holds(e,n,r,i))return null;var h=[this.canon(e).hashString(),u,this.canon(r).hashString(),this.canon(i).hashString()];for(s=new c(e,n,r,i),a=0;4>a;a++){var f=this.index[a],p=h[a];f[p]||(f[p]=[]),f[p].push(s)}return this.statements.push(s),s}},{key:"addAll",value:function(e){var t=this;e.forEach(function(e){t.add(e.subject,e.predicate,e.object,e.graph)})}},{key:"any",value:function(e,t,n,r){var i=this.anyStatementMatching(e,t,n,r);if(null!=i)return null==e?i.subject:null==t?i.predicate:null==n?i.object:void 0}},{key:"anyValue",value:function(e,t,n,r){var i=this.any(e,t,n,r);return i?i.value:void 0}},{key:"anyStatementMatching",value:function(e,t,n,r){var i=this.statementsMatching(e,t,n,r,!0);return i&&0!==i.length?i[0]:void 0}},{key:"canon",value:function(e){if(!e)return e;var t=this.redirections[e.hashString()];return t||e}},{key:"check",value:function(){this.checkStatementList(this.statements);for(var e,t=0;4>t;t++)for(var n in e=this.index[t])e.hasOwnProperty(n)&&this.checkStatementList(e[n],t)}},{key:"checkStatementList",value:function(e,t){for(var n,r=" found in "+["subject","predicate","object","why"][t]+" index.",i=0;i<e.length;i++){for(var a=[(n=e[i]).subject,n.predicate,n.object,n.why],o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].subject.sameTerm(t.subject)&&e[n].predicate.sameTerm(t.predicate)&&e[n].object.sameTerm(t.object)&&e[n].why.sameTerm(t.why))return!0},s=0;4>s;s++){var u=this.canon(a[s]).hashString();this.index[s][u]&&o(this.index[s][u],n)}if(!o(this.statements,n))throw new Error("Statement list does not statement "+n+"@"+n.why+r)}}},{key:"close",value:function(){return this}},{key:"copyTo",value:function(e,t,n){n||(n=[]);var r=this.statementsMatching(e);-1!==s(n,"two-direction")&&r.concat(this.statementsMatching(void 0,void 0,e));for(var i,a=0;a<r.length;a++){switch((i=r[a]).object.termType){case"NamedNode":this.add(t,i.predicate,i.object);break;case"Literal":case"BlankNode":case"Collection":this.add(t,i.predicate,i.object.copy(this))}-1!==s(n,"delete")&&this.remove(i)}}},{key:"equate",value:function(e,t){e=this.canon(e),t=this.canon(t);var n=e.compareTerm(t);return!n||(0>n?this.replaceWith(t,e):this.replaceWith(e,t))}},{key:"formula",value:function(e){return new t(e)}},{key:"match",value:function(e,t,n,r){return this.statementsMatching(d.fromValue(e),d.fromValue(t),d.fromValue(n),d.fromValue(r))}},{key:"mentionsURI",value:function(e){var t="<"+e+">";return!!this.subjectIndex[t]||!!this.objectIndex[t]||!!this.predicateIndex[t]}},{key:"newExistential",value:function(e){if(!e)return this.bnode();var t=this.sym(e);return this.declareExistential(t)}},{key:"newPropertyAction",value:function(e,t){var n=e.hashString();this.propertyActions[n]||(this.propertyActions[n]=[]),this.propertyActions[n].push(t);for(var r=this.statementsMatching(void 0,e,void 0),i=!1,a=0;a<r.length;a++)i=i||t(this,r[a].subject,e,r[a].object);return i}},{key:"newUniversal",value:function(e){var t=this.sym(e);return this._universalVariables||(this._universalVariables=[]),this._universalVariables.push(t),t}},{key:"variable",value:function(e){return new h(e)}},{key:"nextSymbol",value:function(e){for(var t,n=0;;n++)if(t=e.uri+"#n"+n,!this.mentionsURI(t))return this.sym(t)}},{key:"query",value:function(e,t,r,i){return n(84).indexedFormulaQuery.call(this,e,t,r,i)}},{key:"remove",value:function(e){if(e instanceof Array){for(var n=0;n<e.length;n++)this.remove(e[n]);return this}if(e instanceof t)return this.remove(e.statements);var r=this.statementsMatching(e.subject,e.predicate,e.object,e.why);if(!r.length)throw new Error("Statement to be removed is not on store: "+e);return this.removeStatement(r[0]),this}},{key:"removeDocument",value:function(e){for(var t=this.statementsMatching(void 0,void 0,void 0,e).slice(),n=0;n<t.length;n++)this.removeStatement(t[n]);return this}},{key:"removeMany",value:function(e,t,n,r,i){for(var a=this.statementsMatching(e,t,n,r,!1),o=[],s=0;s<a.length;s++)o.push(a[s]);for(i&&(o=o.slice(0,i)),s=0;s<o.length;s++)this.remove(o[s])}},{key:"removeMatches",value:function(e,t,n,r){return this.removeStatements(this.statementsMatching(e,t,n,r)),this}},{key:"removeStatement",value:function(e){for(var t=[e.subject,e.predicate,e.object,e.why],n=0;4>n;n++){var r=this.canon(t[n]).hashString();this.index[n][r]&&l(this.index[n][r],e)}return l(this.statements,e),this}},{key:"removeStatements",value:function(e){for(var t=0;t<e.length;t++)this.remove(e[t]);return this}},{key:"replaceWith",value:function(e,t){for(var n=e.hashString(),r=t.hashString(),i=function(e){var t=e[n];if(t){var i=e[r];e[r]=i?t.concat(i):t,delete e[n]}},a=0;4>a;a++)i(this.index[a]);if(this.redirections[n]=t,e.uri){if(this.aliases[r]||(this.aliases[r]=[]),this.aliases[r].push(e),this.aliases[n])for(a=0;a<this.aliases[n].length;a++)this.redirections[this.aliases[n][a].hashString()]=t,this.aliases[r].push(this.aliases[n][a]);this.add(t,this.sym("http://www.w3.org/2007/ont/link#uri"),e.uri),this.fetcher&&this.fetcher.nowKnownAs(e,t)}return i(this.classActions),i(this.propertyActions),!0}},{key:"allAliases",value:function(e){var t=this.aliases[this.canon(e).hashString()]||[];return t.push(this.canon(e)),t}},{key:"sameThings",value:function(e,t){if(e.sameTerm(t))return!0;var n=this.canon(e);if(!n)return!1;var r=this.canon(t);return!!r&&n.uri===r.uri}},{key:"setPrefixForURI",value:function(e,t){"tab"===e&&this.namespaces.tab||"ns"===e.slice(0,2)||"default"===e.slice(0,7)||(this.namespaces[e]=t)}},{key:"statementsMatching",value:function(e,t,n,r,i){var a,o,s=[e,t,n,r],u=[],l=[],c=[],h=[];for(a=0;4>a;a++)u[a]=this.canon(d.fromValue(s[a])),u[a]?(h.push(a),l[a]=u[a].hashString()):c.push(a);if(0===h.length)return this.statements;if(1===h.length)return a=h[0],(o=this.index[a][l[a]])&&i&&1<o.length&&(o=o.slice(0,1)),o=o||[];var f,p,m=1e10;for(p=0;p<h.length;p++){if(a=h[p],!(o=this.index[a][l[a]]))return[];o.length<m&&(m=o.length,f=p)}for(var v,g=h[f],b=this.index[g][l[g]],y=h.slice(0,f).concat(h.slice(f+1)),w=[],_=["subject","predicate","object","why"],x=0;x<b.length;x++){for(v=b[x],p=0;p<y.length;p++)if(a=y[p],!this.canon(v[_[a]]).sameTerm(u[a])){v=null;break}if(null!=v&&(w.push(v),i))break}return w}},{key:"uris",value:function(e){var t=this.canon(e),n=this.aliases[t.hashString()];if(!t.uri)return[];var r=[t.uri];if(n)for(var i=0;i<n.length;i++)r.push(n[i].uri);return r}},{key:"length",get:function(){return this.statements.length}}]),t}();t.default=p,p.handleRDFType=a},function(e,t,n){"use strict";var r=n(23),i=e.exports={},a={authn:n(41),icons:n(16),log:n(15),ns:n(6),pad:i,rdf:r,store:n(8),widgets:n(14)},o=a.store,s=a.ns,u=n(21);a.pad.lightColorHash=function(e){return e&&e.uri?"#"+(12632256|16777215&function(e){return e.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0)}(e.uri)).toString(16):"#ffffff"},a.pad.renderPartipants=function(e,t,n,r,i,l){t.setAttribute("style","margin: 0.8em;");var c=function(n){var r=o.any(n,s.wf("participant")),i=o.anyValue(n,s.ui("backgroundColor"))||"white",u=e.createElement("div");u.setAttribute("style","height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: "+i);var c=a.widgets.personTR(e,null,r,l);t.appendChild(c);var d=e.createElement("td");return d.setAttribute("style","vertical-align: middle;"),d.appendChild(u),c.insertBefore(d,c.firstChild),c},d=function(){var e=o.each(r,s.wf("participation")).map(function(e){return[o.anyValue(e,a.ns.cal("dtstart"))||"9999-12-31",e]});e.sort();var n=e.map(function(e){return e[1]});u.syncTableToArray(t,n,c)};return t.refresh=d,d(),t},a.pad.participationObject=function(e,t,n){return new Promise(function(r,i){if(!n)throw new Error("Not user id");var u=o.each(e,s.wf("participation")).filter(function(e){return o.holds(e,s.wf("participant"),n)});if(1<u.length)throw new Error("Multiple records of your participation");if(u.length)r(u[0]);else{var l=a.widgets.newThing(t),c=[a.rdf.st(e,s.wf("participation"),l,t),a.rdf.st(l,s.wf("participant"),n,t),a.rdf.st(l,s.cal("dtstart"),new Date,t),a.rdf.st(l,s.ui("backgroundColor"),a.pad.lightColorHash(n),t)];o.updater.update([],c,function(e,t,n){t?r(l):i(new Error("Error recording your partipation: "+n))}),r(l)}})},a.pad.recordParticipation=function(e,t,n){var r=a.authn.currentUser();if(r){var i=o.each(e,s.wf("participation")).filter(function(e){return o.holds(e,s.wf("participant"),r)});if(1<i.length)throw new Error("Multiple records of your participation");if(i.length)return i[0];var u=a.widgets.newThing(t),l=[a.rdf.st(e,s.wf("participation"),u,t),a.rdf.st(u,s.wf("participant"),r,t),a.rdf.st(u,a.ns.cal("dtstart"),new Date,t),a.rdf.st(u,s.ui("backgroundColor"),a.pad.lightColorHash(r),t)];return o.updater.update([],l,function(e,t,r){if(!t)throw new Error("Error recording your partipation: "+r);n&&n.refresh&&n.refresh()}),u}},a.pad.manageParticipation=function(e,t,n,r,i,o){var s=e.createElement("table");t.appendChild(s),a.pad.renderPartipants(e,s,n,r,i,o);try{a.pad.recordParticipation(r,n,s)}catch(r){t.appendChild(a.widgets.errorMessageBlock(e,"Error recording your partipation: "+r))}return s},a.pad.notepad=function(e,t,n,i,o){var s=(o=o||{}).exists,l=e.createElement("table"),c=a.store,d=a.ns;if(i&&!i.uri)throw new Error("UI.pad.notepad: Invalid userid");var h=a.store.updater,f=r.Namespace("http://www.w3.org/ns/pim/pad#");l.setAttribute("style","padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;");var p=null,m=null;if(o.statusArea){var v=o.statusArea.appendChild(e.createElement("table")).appendChild(e.createElement("tr"));p=v.appendChild(e.createElement("td")),m=v.appendChild(e.createElement("td")),p.setAttribute("style","width:50%"),m.setAttribute("style","width:50%")}var g=function(t,n){console.log(t),o.statusArea&&(n?p:m).appendChild(a.widgets.errorMessageBlock(e,t,"pink"))},b=function(e){o.statusArea&&(o.statusArea.innerHTML="")},y=function(e,t,n){var r=e.subject;t=t||"";var i=c.any(r,d.dc("author"));if(!t&&i){var o=a.pad.lightColorHash(i);t="color: "+(n?"#888":"black")+"; background-color: "+o+";"}var s=c.any(r,f("indent")),u=0<=(s=s?s.value:0)?"font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;text-indent: "+3*s+"em;":"font-family: sans-serif; font-weight: bold; border: none;"+["font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;","font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;","font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;"][-1-s];e.setAttribute("style",u+t)},w=function(e){var i=e.subject;if(!i)throw new Error("No chunk for line to be deleted!");var a=c.any(void 0,f("next"),i),o=c.any(i,f("next"));if(a.sameTerm(n)&&o.sameTerm(n))console.log("You can't delete the only line.");else{var s=c.statementsMatching(i,void 0,void 0,t).concat(c.statementsMatching(void 0,void 0,i,t)),l=[r.st(a,f("next"),o,t)],d=i.uri.slice(-4);console.log("Deleting line "+d),h.update(s,l,function(n,r,a,o){if(r){var l=e.parentNode,c=l.previousSibling;l.parentNode.removeChild(l),console.log(" deleted line "+d+" ok "+e.value),c&&c.firstChild&&c.firstChild.focus()}else if(o&&409===o.status)y(e,"color: black; background-color: #ffd;"),e.state=0,u.beep(.5,512),setTimeout(function(){h.requestDownstreamAction(t,T)},1e3);else{console.log(" removePart FAILED "+i+": "+a),console.log(" removePart was deleteing :'"+s),y(e,"color: black; background-color: #fdd;");var f=o?o.status:" [no response field] ";g("Error "+f+" saving changes: "+a.true)}})}},_=function(e,n,i){var a=c.statementsMatching(n,f("indent")),o=a.length?+a[0].object.value:0;if(!(-3>o+i)){var s=o+i,u=r.st(n,f("indent"),s,t);h.update(a,u,function(n,r,i){r?y(e):(console.log("Indent change FAILED '"+s+"' for "+t+": "+i),y(e,"color: black; background-color: #fdd;"),h.requestDownstreamAction(t,T))})}},x=function(e,n){e.addEventListener("keydown",function(r){var i,a;switch(r.keyCode){case 13:var o=r.shiftKey;if(console.log("enter"),o?(a=c.any(void 0,f("next"),n),i="newlinesAfter"):(a=c.any(n,f("next")),i="newlinesBefore"),a[i]=a[i]||0,a[i]+=1,1<a[i])return void console.log(" queueing newline queue = "+a[i]);console.log(" go ahead line before "+a[i]),k(e,o);break;case 8:if(0===e.value.length)switch(console.log("Delete key line "+n.uri.slice(-4)+" state "+e.state),e.state){case 1:case 2:return void(e.state=4);case 3:case 4:return;case void 0:case 0:e.state=3,w(e),r.preventDefault();break;default:throw new Error("pad: Unexpected state "+e)}break;case 9:var s=r.shiftKey?-1:1;_(e,n,s),r.preventDefault();break;case 27:console.log("escape"),h.requestDownstreamAction(t,T),r.preventDefault();break;case 38:e.parentNode.previousSibling&&(e.parentNode.previousSibling.firstChild.focus(),r.preventDefault());break;case 40:e.parentNode.nextSibling&&(e.parentNode.nextSibling.firstChild.focus(),r.preventDefault())}});var i=function e(n){var i=n.subject;y(n,void 0,!0);var a=c.any(i,d.sioc("content")).value,o=[r.st(i,d.sioc("content"),a,t)],s=[r.st(i,d.sioc("content"),n.value,t)],l=n.value;if(n.lastSent&&a!==n.lastSent)throw new Error("Out of order, last sent expected '"+a+"' but found '"+n.lastSent+"'");n.lastSent=l,console.log(" Patch proposed to "+i.uri.slice(-4)+" '"+a+"' -> '"+l+"' "),h.update(o,s,function(r,i,o,s){i?(b(),y(n),console.log(" Patch ok '"+a+"' -> '"+l+"' "),4===n.state?(n.state=3,w(n)):3===n.state||(2===n.state?(n.state=1,e(n)):n.state=0)):(console.log(" patch FAILED "+s.status+" for '"+a+"' -> '"+l+"': "+o),409===s.status?(y(n,"color: black; background-color: #fdd;"),n.state=0,u.beep(.5,512),setTimeout(function(){h.requestDownstreamAction(t,T)},1e3)):(y(n,"color: black; background-color: #fdd;"),n.state=0,g(" Error "+s.status+" sending data: "+o,!0),u.beep(1,128)))})};e.addEventListener("input",function(t){switch(y(e,void 0,!0),console.log("Input event state "+e.state+" value '"+e.value+"'"),e.state){case 3:case 4:case 2:return;case 1:return void(e.state=2);case 0:case void 0:e.state=1,i(e)}})},M=function(t,n,r){var a=c.any(n,d.sioc("content"));a=a?a.value:"";var o=e.createElement("tr");r?l.insertBefore(o,t):t&&t.nextSibling?l.insertBefore(o,t.nextSibling):l.appendChild(o);var s=o.appendChild(e.createElement("input"));return s.subject=n,s.setAttribute("type","text"),s.value=a,i?(y(s,""),x(s,n)):(y(s,"color: #222; background-color: #111;"),console.log("Note can't add listeners - not logged in")),s},k=function e(o,s){var u,l,c,p,m,v=a.store,g=0,b=null;o?("input"!==o.tagName.toLowerCase()&&console.log("return pressed when current document is: "+o.tagName),u=o.subject,g=(g=v.any(u,f("indent")))?+g.value:0,s?(l=v.any(void 0,f("next"),u),c=u,p=l,b="newlinesAfter"):(l=u,c=v.any(u,f("next")),p=c,b="newlinesBefore"),m=o.parentNode):(l=n,c=n,m=void 0);var w=a.widgets.newThing(t),_=w.uri.slice(-4),x=[r.st(l,f("next"),c,t)],k=[r.st(l,f("next"),w,t),r.st(w,f("next"),c,t),r.st(w,d.dc("author"),i,t),r.st(w,d.sioc("content"),"",t)];0<g&&k.push(r.st(w,f("indent"),g,t)),console.log(" Fresh chunk "+_+" proposed"),h.update(x,k,function(t,n,r,i){if(n){var a=M(m,w,s);y(a),a.focus(),b&&(console.log(" Fresh chunk "+_+" updated, queue = "+p[b]),p[b]-=1,0<p[b]&&(console.log(" Implementing queued newlines = "+c.newLinesBefore),e(a,s)))}else console.log(" ERROR writing new line "+_+": "+r)})},C=function(){function e(e){g(e),r++}var t=[],r=0;if(!c.the(n,f("next")))return e("No initial next pointer"),!1;for(var i,a=n;(i=c.the(a,f("next")))||e("No next pointer from "+a),!i.sameTerm(n);){a=i;var o=i.uri.split("#")[1];if(t[i.uri])return e("Loop!"),!1;t[i.uri]=!0;var s=c.each(i,f("next")).length;1!==s&&e("Should be 1 not "+s+" next pointer for "+o),1<(s=c.each(i,f("indent")).length)&&e("Should be 0 or 1 not "+s+" indent for "+o),1!==(s=c.each(i,d.sioc("content")).length)&&e("Should be 1 not "+s+" contents for "+o),1!==(s=c.each(i,d.dc("author")).length)&&e("Should be 1 not "+s+" author for "+o),c.statementsMatching(void 0,d.sioc("contents")).map(function(n){t[n.subject.uri]||e("Loose chunk! "+n.subject.uri)})}return!r},E=function(){if(1!==c.each(n,f("next")).length){var e="Pad: Inconsistent data - NEXT pointers: "+c.each(n,f("next")).length;return console.log(e),void(o.statusAra&&(o.statusArea.textContent+=e))}for(var t,r=[],i=c.the(n,f("next"));!i.sameTerm(n);i=c.the(i,f("next")))for(var a,s=0;s<l.children.length;s++)(a=l.children[s]).firstChild.subject.sameTerm(i)&&(r[i.uri]=a.firstChild);for(var u=l.children.length-1;0<=u;u--)r[(t=l.children[u]).firstChild.subject.uri]||l.removeChild(t);t=l.firstChild;for(var h,p=c.the(n,f("next"));!p.sameTerm(n);p=c.the(p,f("next")))if(h=c.any(p,d.sioc("content")).value,t&&r[p.uri]){var m=t.firstChild;h!==m.value&&(m.value=h),y(m),m.state=0,delete m.lastSent,t=t.nextSibling}else M(t,p,!0)},A=!1,T=function(){if(A)console.log(" Already reloading - stop");else{A=!0;var e=1e3;!function n(){console.log("try reload - timeout = "+e),h.reload(h.store,t,function(r,i,a){A=!1,r?(console.log(" reloaded OK"),b(),C()?function e(t){if(t.refresh)t.refresh();else for(var n=0;n<t.children.length;n++)e(t.children[n])}(l):g("CONSITENCY CHECK FAILED")):0===a.status?(g("Network error refreshing the pad. Retrying in "+e/1e3),A=!0,e*=2,setTimeout(n,e)):g("Error "+a.status+"refreshing the pad:"+i+". Stopped. "+t)})}()}};if(l.refresh=E,l.reloadAndSync=T,i||console.log("Warning: must be logged in for pad to be edited"),s)console.log("Existing pad."),C()?(E(),c.holds(n,f("next"),n)&&k()):console.log(l.textContent="Inconsistent data. Abort");else{console.log("No pad exists - making new one.");var S=[r.st(n,d.rdf("type"),f("Notepad"),t),r.st(n,d.dc("author"),i,t),r.st(n,d.dc("created"),new Date,t),r.st(n,f("next"),n,t)];h.update([],S,function(e,t,n){t?(console.log("Initial pad created"),k()):g(n)})}return l}},function(e,t,n){"use strict";
8
- /*!
9
- * mime-types
10
- * Copyright(c) 2014 Jonathan Ong
11
- * Copyright(c) 2015 Douglas Christopher Wilson
12
- * MIT Licensed
13
- */function r(e){if(!e||"string"!=typeof e)return!1;var t=o.exec(e),n=t&&i[t[1].toLowerCase()];return n&&n.charset?n.charset:t&&s.test(t[1])&&"UTF-8"}var i=n(291),a=n(289).extname,o=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;t.charset=r,t.charsets={lookup:r},t.contentType=function(e){if(!e||"string"!=typeof e)return!1;var n=-1===e.indexOf("/")?t.lookup(e):e;if(!n)return!1;if(-1===n.indexOf("charset")){var r=t.charset(n);r&&(n+="; charset="+r.toLowerCase())}return n},t.extension=function(e){if(!e||"string"!=typeof e)return!1;var n=o.exec(e),r=n&&t.extensions[n[1].toLowerCase()];return r&&r.length&&r[0]},t.extensions=Object.create(null),t.lookup=function(e){if(!e||"string"!=typeof e)return!1;var n=a("x."+e).toLowerCase().substr(1);return!!n&&(t.types[n]||!1)},t.types=Object.create(null),function(e,t){var n=["nginx","apache",void 0,"iana"];Object.keys(i).forEach(function(r){var a=i[r],o=a.extensions;if(o&&o.length){e[r]=o;for(var s,u=0;u<o.length;u++){if(s=o[u],t[s]){var l=n.indexOf(i[t[s]].source),c=n.indexOf(a.source);if("application/octet-stream"!==t[s]&&(l>c||l===c&&"application/"===t[s].substr(0,12)))continue}t[s]=r}}})}(t.extensions,t.types)},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(294).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t,n){var r=t;r.utils=n(24),r.common=n(52),r.sha=n(331),r.ripemd=n(327),r.hmac=n(326),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(e,t,n){(function(t){function r(e){var t=a(e);return{blinder:t.toRed(o.mont(e.modulus)).redPow(new o(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}function i(e,n){var i=r(n),a=n.modulus.byteLength(),s=(o.mont(n.modulus),new o(e).mul(i.blinder).umod(n.modulus)),u=s.toRed(o.mont(n.prime1)),l=s.toRed(o.mont(n.prime2)),c=n.coefficient,d=n.prime1,h=n.prime2,f=u.redPow(n.exponent1),p=l.redPow(n.exponent2);f=f.fromRed(),p=p.fromRed();var m=f.isub(p).imul(c).umod(d);return m.imul(h),p.iadd(m),new t(p.imul(i.unblinder).umod(n.modulus).toArray(!1,a))}function a(e){for(var t=e.modulus.byteLength(),n=new o(s(t));0<=n.cmp(e.modulus)||!n.umod(e.prime1)||!n.umod(e.prime2);)n=new o(s(t));return n}var o=n(341),s=n(44);e.exports=i,i.getr=a}).call(this,n(2).Buffer)},function(e,t,n){var r={ECB:n(359),CBC:n(358),CFB:n(357),CFB8:n(356),CFB1:n(355),OFB:n(354),CTR:n(158),GCM:n(158)},i=n(156);for(var a in i)i[a].module=r[i[a].mode];e.exports=i},function(e,t,n){var r=n(360),i=n(352),a=n(156);t.createCipher=t.Cipher=r.createCipher,t.createCipheriv=t.Cipheriv=r.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=function(){return Object.keys(a)}},function(e,t,n){"use strict";t.utils=n(365),t.Cipher=n(364),t.DES=n(363),t.CBC=n(362),t.EDE=n(361)},function(e,t,n){(t=e.exports=function(e){e=e.toLowerCase();var n=t[e];if(!n)throw new Error(e+" is not supported (we accept pull requests)");return new n}).sha=n(374),t.sha1=n(373),t.sha224=n(372),t.sha256=n(167),t.sha384=n(371),t.sha512=n(166)},function(e,t,n){"use strict";function r(){h.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function i(e,t){return e<<t|e>>>32-t}function a(e,t,n,r,a,o,s,u){return 0|i(0|e+(t^n^r)+o+s,u)+a}function o(e,t,n,r,a,o,s,u){return 0|i(0|e+(t&n|~t&r)+o+s,u)+a}function s(e,t,n,r,a,o,s,u){return 0|i(0|e+((t|~n)^r)+o+s,u)+a}function u(e,t,n,r,a,o,s,u){return 0|i(0|e+(t&r|n&~r)+o+s,u)+a}function l(e,t,n,r,a,o,s,u){return 0|i(0|e+(t^(n|~r))+o+s,u)+a}var c=n(2).Buffer,d=n(1),h=n(168),f=Array(16),p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],v=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],b=[0,1518500249,1859775393,2400959708,2840853838],y=[1352829926,1548603684,1836072691,2053994217,0];d(r,h),r.prototype._update=function(){for(var e=f,t=0;16>t;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,c=0|this._c,d=0|this._d,h=0|this._e,w=0|this._a,_=0|this._b,x=0|this._c,M=0|this._d,k=0|this._e,C=0;80>C;C+=1){var E,A;16>C?(E=a(n,r,c,d,h,e[p[C]],b[0],v[C]),A=l(w,_,x,M,k,e[m[C]],y[0],g[C])):32>C?(E=o(n,r,c,d,h,e[p[C]],b[1],v[C]),A=u(w,_,x,M,k,e[m[C]],y[1],g[C])):48>C?(E=s(n,r,c,d,h,e[p[C]],b[2],v[C]),A=s(w,_,x,M,k,e[m[C]],y[2],g[C])):64>C?(E=u(n,r,c,d,h,e[p[C]],b[3],v[C]),A=o(w,_,x,M,k,e[m[C]],y[3],g[C])):(E=l(n,r,c,d,h,e[p[C]],b[4],v[C]),A=a(w,_,x,M,k,e[m[C]],y[4],g[C])),n=h,h=d,d=i(c,10),c=r,r=E,w=k,k=M,M=i(x,10),x=_,_=A}var T=0|this._b+c+M;this._b=0|this._c+d+k,this._c=0|this._d+h+w,this._d=0|this._e+n+_,this._e=0|this._a+r+x,this._a=T},r.prototype._digest=function(){this._block[this._blockOffset++]=128,56<this._blockOffset&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=c.alloc?c.alloc(20):new c(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=r},function(e,t,n){"use strict";(function(t){function r(){c.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function i(e,t){return e<<t|e>>>32-t}function a(e,t,n,r,a,o,s){return 0|i(0|e+(t&n|~t&r)+a+o,s)+t}function o(e,t,n,r,a,o,s){return 0|i(0|e+(t&r|n&~r)+a+o,s)+t}function s(e,t,n,r,a,o,s){return 0|i(0|e+(t^n^r)+a+o,s)+t}function u(e,t,n,r,a,o,s){return 0|i(0|e+(n^(t|~r))+a+o,s)+t}var l=n(1),c=n(168),d=Array(16);l(r,c),r.prototype._update=function(){for(var e=d,t=0;16>t;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,l=this._d;r=u(r=u(r=u(r=u(r=s(r=s(r=s(r=s(r=o(r=o(r=o(r=o(r=a(r=a(r=a(r=a(r,i=a(i,l=a(l,n=a(n,r,i,l,e[0],3614090360,7),r,i,e[1],3905402710,12),n,r,e[2],606105819,17),l,n,e[3],3250441966,22),i=a(i,l=a(l,n=a(n,r,i,l,e[4],4118548399,7),r,i,e[5],1200080426,12),n,r,e[6],2821735955,17),l,n,e[7],4249261313,22),i=a(i,l=a(l,n=a(n,r,i,l,e[8],1770035416,7),r,i,e[9],2336552879,12),n,r,e[10],4294925233,17),l,n,e[11],2304563134,22),i=a(i,l=a(l,n=a(n,r,i,l,e[12],1804603682,7),r,i,e[13],4254626195,12),n,r,e[14],2792965006,17),l,n,e[15],1236535329,22),i=o(i,l=o(l,n=o(n,r,i,l,e[1],4129170786,5),r,i,e[6],3225465664,9),n,r,e[11],643717713,14),l,n,e[0],3921069994,20),i=o(i,l=o(l,n=o(n,r,i,l,e[5],3593408605,5),r,i,e[10],38016083,9),n,r,e[15],3634488961,14),l,n,e[4],3889429448,20),i=o(i,l=o(l,n=o(n,r,i,l,e[9],568446438,5),r,i,e[14],3275163606,9),n,r,e[3],4107603335,14),l,n,e[8],1163531501,20),i=o(i,l=o(l,n=o(n,r,i,l,e[13],2850285829,5),r,i,e[2],4243563512,9),n,r,e[7],1735328473,14),l,n,e[12],2368359562,20),i=s(i,l=s(l,n=s(n,r,i,l,e[5],4294588738,4),r,i,e[8],2272392833,11),n,r,e[11],1839030562,16),l,n,e[14],4259657740,23),i=s(i,l=s(l,n=s(n,r,i,l,e[1],2763975236,4),r,i,e[4],1272893353,11),n,r,e[7],4139469664,16),l,n,e[10],3200236656,23),i=s(i,l=s(l,n=s(n,r,i,l,e[13],681279174,4),r,i,e[0],3936430074,11),n,r,e[3],3572445317,16),l,n,e[6],76029189,23),i=s(i,l=s(l,n=s(n,r,i,l,e[9],3654602809,4),r,i,e[12],3873151461,11),n,r,e[15],530742520,16),l,n,e[2],3299628645,23),i=u(i,l=u(l,n=u(n,r,i,l,e[0],4096336452,6),r,i,e[7],1126891415,10),n,r,e[14],2878612391,15),l,n,e[5],4237533241,21),i=u(i,l=u(l,n=u(n,r,i,l,e[12],1700485571,6),r,i,e[3],2399980690,10),n,r,e[10],4293915773,15),l,n,e[1],2240044497,21),i=u(i,l=u(l,n=u(n,r,i,l,e[8],1873313359,6),r,i,e[15],4264355552,10),n,r,e[6],2734768916,15),l,n,e[13],1309151649,21),i=u(i,l=u(l,n=u(n,r,i,l,e[4],4149444226,6),r,i,e[11],3174756917,10),n,r,e[2],718787259,15),l,n,e[9],3951481745,21),this._a=0|this._a+n,this._b=0|this._b+r,this._c=0|this._c+i,this._d=0|this._d+l},r.prototype._digest=function(){this._block[this._blockOffset++]=128,56<this._blockOffset&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=new t(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=r}).call(this,n(2).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.currentUrl=function(){return window.location.href},t.currentUrlNoParams=function(){return window.location.origin+window.location.pathname},t.navigateTo=function(e){window.location.href=e},t.originOf=function(e){return new URL(e).origin}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=(n(32),n(405)),a=n(182).NotSupportedError,o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"sign",value:function(e,t,n){var r=i.normalize("sign",e);return r instanceof Error?Promise.reject(new a(e)):r.sign(t,n)}},{key:"verify",value:function(e,t,n,r){var o=i.normalize("verify",e);return o instanceof Error?Promise.reject(new a(e)):o.verify(t,n,r)}},{key:"importKey",value:function(e){return i.normalize("importKey",e.alg).importKey(e)}}]),e}();e.exports=o},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=0,a=function(){function e(t,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.expr=t,this.mode=n||i,this.tokens=t&&"#"===t.charAt(0)?this.parseURIFragmentIdentifier(t):this.parseJSONString(t)}return r(e,[{key:"escape",value:function(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}},{key:"unescape",value:function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}},{key:"parseJSONString",value:function(e){if("string"!=typeof e)throw new Error("JSON Pointer must be a string");if(""===e)return[];if("/"!==e.charAt(0))throw new Error("Invalid JSON Pointer");return"/"===e?[""]:e.substr(1).split("/").map(this.unescape)}},{key:"toJSONString",value:function(){return"/"+this.tokens.map(this.escape).join("/")}},{key:"parseURIFragmentIdentifier",value:function(e){if("string"!=typeof e)throw new Error("JSON Pointer must be a string");if("#"!==e.charAt(0))throw new Error("Invalid JSON Pointer URI Fragment Identifier");return this.parseJSONString(decodeURIComponent(e.substr(1)))}},{key:"toURIFragmentIdentifier",value:function(){var e=this;return"#/"+this.tokens.map(function(t){return encodeURIComponent(e.escape(t))}).join("/")}},{key:"get",value:function(e){for(var t=e,n=this.tokens,r=0;r<n.length;r++){if(!t||void 0===t[n[r]]){if(this.mode!==i)return;throw new Error("Invalid JSON Pointer reference")}t=t[n[r]]}return t}},{key:"add",value:function(e,t){for(var n,r=this.tokens,a=e,o=0;o<r.length;o++)if(n=r[o],o===r.length-1)"-"===n?a.push(t):Array.isArray(a)?a.splice(n,0,t):void 0!==t&&(a[n]=t);else if(a[n])a=a[n];else switch(this.mode){case i:throw new Error("Invalid JSON Pointer reference");case 1:a=a[n]=parseInt(n)?[]:{};break;case 2:return;default:throw new Error("Invalid pointer mode")}}},{key:"replace",value:function(e,t){for(var n,r=this.tokens,i=e,a=0;a<r.length;a++)n=r[a],a===r.length-1?i[n]=t:i=i[n]?i[n]:i[n]=parseInt(n)?[]:{}}},{key:"remove",value:function(e){for(var t,n=this.tokens,r=e,i=0;i<n.length;i++){if(t=n[i],void 0===r||void 0===r[t])return;if(Array.isArray(r))return void r.splice(t,1);i===n.length-1&&delete r[t],r=r[t]}}}],[{key:"parse",value:function(t){return new e(t)}}]),e}();e.exports=a},function(e,t,n){"use strict";(function(t){
14
- /*!
15
- * The buffer module from node.js, for the browser.
16
- *
17
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
18
- * @license MIT
19
- */
20
- function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=_Mathmin(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0}function i(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}function a(e){return Object.prototype.toString.call(e)}function o(e){return!i(e)&&!("function"!=typeof t.ArrayBuffer)&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(!!(e instanceof DataView)||e.buffer&&e.buffer instanceof ArrayBuffer))}function s(e){if(g.isFunction(e)){if(w)return e.name;var t=e.toString().match(x);return t&&t[1]}}function u(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function l(e){if(w||!g.isFunction(e))return g.inspect(e);var t=s(e);return"[Function"+(t?": "+t:"")+"]"}function c(e){return u(l(e.actual),128)+" "+e.operator+" "+u(l(e.expected),128)}function d(e,t,n,r,i){throw new _.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function h(e,t){e||d(e,!0,t,"==",_.ok)}function f(e,t,n,s){if(e===t)return!0;if(i(e)&&i(t))return 0===r(e,t);if(g.isDate(e)&&g.isDate(t))return e.getTime()===t.getTime();if(g.isRegExp(e)&&g.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(!(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t))return e==t;if(o(e)&&o(t)&&a(e)===a(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===r(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(i(e)!==i(t))return!1;var u=(s=s||{actual:[],expected:[]}).actual.indexOf(e);return-1!==u&&u===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),function(e,t,n,r){if(null===e||void 0===e||null===t||void 0===t)return!1;if(g.isPrimitive(e)||g.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=p(e),a=p(t);if(i&&!a||!i&&a)return!1;if(i)return e=y.call(e),t=y.call(t),f(e,t,n);var o,s,u=M(e),l=M(t);if(u.length!==l.length)return!1;for(u.sort(),l.sort(),s=u.length-1;0<=s;s--)if(u[s]!==l[s])return!1;for(s=u.length-1;0<=s;s--)if(o=u[s],!f(e[o],t[o],n,r))return!1;return!0}(e,t,n,s))}function p(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function m(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(t){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function v(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&d(i,n,"Missing expected exception"+r);var a="string"==typeof r,o=!e&&g.isError(i),s=!e&&i&&!n;if((o&&a&&m(i,n)||s)&&d(i,n,"Got unwanted exception"+r),e&&i&&n&&!m(i,n)||!e&&i)throw i}var g=n(126),b=Object.prototype.hasOwnProperty,y=Array.prototype.slice,w="foo"===function(){}.name,_=e.exports=h,x=/\s*function\s+([^\(\s]*)\s*/;_.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=c(this),this.generatedMessage=!0);var t=e.stackStartFunction||d;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=s(t),a=r.indexOf("\n"+i);if(0<=a){var o=r.indexOf("\n",a+1);r=r.substring(o+1)}this.stack=r}}},g.inherits(_.AssertionError,Error),_.fail=d,_.ok=h,_.equal=function(e,t,n){e!=t&&d(e,t,n,"==",_.equal)},_.notEqual=function(e,t,n){e==t&&d(e,t,n,"!=",_.notEqual)},_.deepEqual=function(e,t,n){f(e,t,!1)||d(e,t,n,"deepEqual",_.deepEqual)},_.deepStrictEqual=function(e,t,n){f(e,t,!0)||d(e,t,n,"deepStrictEqual",_.deepStrictEqual)},_.notDeepEqual=function(e,t,n){f(e,t,!1)&&d(e,t,n,"notDeepEqual",_.notDeepEqual)},_.notDeepStrictEqual=function e(t,n,r){f(t,n,!0)&&d(t,n,r,"notDeepStrictEqual",e)},_.strictEqual=function(e,t,n){e!==t&&d(e,t,n,"===",_.strictEqual)},_.notStrictEqual=function(e,t,n){e===t&&d(e,t,n,"!==",_.notStrictEqual)},_.throws=function(e,t,n){v(!0,e,t,n)},_.doesNotThrow=function(e,t,n){v(!1,e,t,n)},_.ifError=function(e){if(e)throw e};var M=Object.keys||function(e){var t=[];for(var n in e)b.call(e,n)&&t.push(n);return t}}).call(this,n(5))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.fetchWithCredentials=t.requiresAuth=t.getRegisteredRp=t.logout=t.currentSession=t.login=void 0;var i=r(n(81)),a=r(n(34)),o=r(n(33)),s=function(){var e=(0,o.default)(a.default.mark(function e(t){var n,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,f.getData)(t);case 2:if(n=e.sent,!(r=n.rpConfig)){e.next=9;break}return r.store=t,e.abrupt("return",c.default.from(r));case 9:return e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),u=function(){var e=(0,o.default)(a.default.mark(function e(t,n,r){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,f.updateStorage)(t,function(e){return(0,i.default)({},e,{rpConfig:r})});case 2:return e.abrupt("return",r);case 3:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}();n(56);var l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(191)),c=r(n(411)),d=r(n(390)),h=n(101),f=n(73),p=(t.login=function(){var e=(0,o.default)(a.default.mark(function e(t,n){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p(t,n);case 3:return r=e.sent,e.next=6,g(n.storage);case 6:return e.abrupt("return",function(){return v(r,n)});case 9:return e.prev=9,e.t0=e.catch(0),console.warn("Error logging in with WebID-OIDC"),console.error(e.t0),e.abrupt("return",null);case 14:case"end":return e.stop()}},e,void 0,[[0,9]])}));return function(t,n){return e.apply(this,arguments)}}(),t.currentSession=function(){var e=(0,o.default)(a.default.mark(function e(){var t,n,r,i,o,u,l,c,d,p=0<arguments.length&&void 0!==arguments[0]?arguments[0]:(0,f.defaultStorage)();return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,s(p);case 3:if(t=e.sent){e.next=6;break}return e.abrupt("return",null);case 6:if((n=(0,h.currentUrl)())&&n.includes("#")){e.next=9;break}return e.abrupt("return",null);case 9:return e.next=11,(0,f.getData)(p);case 11:return r=e.sent,e.next=14,t.validateResponse(n,r);case 14:if(i=e.sent){e.next=17;break}return e.abrupt("return",null);case 17:return e.next=19,b(p);case 19:return o=i.idp,u=i.idToken,l=i.accessToken,c=i.clientId,d=i.sessionKey,e.abrupt("return",{authType:"WebID-OIDC",webId:i.decoded.payload.sub,idp:o,idToken:u,accessToken:l,clientId:c,sessionKey:d});case 23:return e.prev=23,e.t0=e.catch(0),console.warn("Error finding a WebID-OIDC session"),console.error(e.t0),e.abrupt("return",null);case 28:case"end":return e.stop()}},e,void 0,[[0,23]])}));return function(){return e.apply(this,arguments)}}(),t.logout=function(e){return s(e).then(function(e){return e?e.logout():void 0}).catch(function(e){console.warn("Error logging out of the WebID-OIDC session"),console.error(e)})},t.getRegisteredRp=function(e,t){return s(t.storage).then(function(n){return n&&n.provider.url===e?n:m(e,t).then(function(n){return u(t.storage,e,n)})})}),m=function(e,t){var n=t.storage,r=t.callbackUri,i="id_token token",a={issuer:e,grant_types:["implicit"],redirect_uris:[r],response_types:[i],scope:"openid profile"},o={defaults:{authenticate:{redirect_uri:r,response_type:i}},store:n};return c.default.register(e,a,o)},v=function(){var e=(0,o.default)(a.default.mark(function e(t,n){var r,i,o=n.callbackUri,s=n.storage;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,f.getData)(s);case 2:return r=e.sent,e.next=5,t.createRequest({redirect_uri:o},r);case 5:return i=e.sent,e.next=8,(0,f.updateStorage)(s,function(){return r});case 8:return e.abrupt("return",(0,h.navigateTo)(i));case 9:case"end":return e.stop()}},e,void 0)}));return function(t,n){return e.apply(this,arguments)}}(),g=function(e){return(0,f.updateStorage)(e,function(e){return(0,i.default)({},e,{appHashFragment:window.location.hash})})},b=function(e){return(0,f.updateStorage)(e,function(e){return window.location.hash=e.appHashFragment,delete e.appHashFragment,e})};t.requiresAuth=function(e){if(401!==e.status)return!1;var t=e.headers.get("www-authenticate");if(!t)return!1;var n=l.parse(t);return"Bearer"===n.scheme&&n.params&&"openid webid"===n.params.scope},t.fetchWithCredentials=function(e){return function(){var t=(0,o.default)(a.default.mark(function t(n,r){var o,s;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.default.issueFor(n,e);case 2:return o=t.sent,s=(0,i.default)({},r,{headers:(0,i.default)({},r&&r.headers?r.headers:{},{authorization:"Bearer "+o})}),t.abrupt("return",fetch(n,s));case 5:case"end":return t.stop()}},t,void 0)}));return function(e,n){return t.apply(this,arguments)}}()}},function(e,t,n){var r=n(10),i=n(18),a=n(75),o=n(107),s=n(26).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=a?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:o.f(e)})}},function(e,t,n){t.f=n(9)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.clearSession=t.getSession=void 0;var i=r(n(81)),a=r(n(34)),o=r(n(33));t.getSession=function(){var e=(0,o.default)(a.default.mark(function e(t){var n;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.getData)(t);case 2:return n=e.sent,e.abrupt("return",n.session||null);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),t.clearSession=function(){var e=(0,o.default)(a.default.mark(function e(t){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.updateStorage)(t,function(e){return(0,i.default)({},e,{session:null})});case 2:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}();t.saveSession=function(e){var t,n=this;return t=(0,o.default)(a.default.mark(function t(r){var o;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,s.updateStorage)(e,function(e){return(0,i.default)({},e,{session:r})});case 2:return o=t.sent,t.abrupt("return",o.session);case 4:case"end":return t.stop()}},t,n)})),function(e){return t.apply(this,arguments)}};var s=n(73)},function(e,t,n){"use strict";var r=n(80);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,r){if(void 0!=t||void 0!=n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}(e)}},function(e,t,n){"use strict";var r=n(452)(!0);n(208)(String,"String",function(e){this._t=e+"",this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(118);e.exports=function(e){return Object(r(e))}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t,n){var r=n(10),i="__core-js_shared__",a=r[i]||(r[i]={});e.exports=function(e){return a[e]||(a[e]={})}},function(e,t,n){var r=n(114)("keys"),i=n(78);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t){var n=_Mathceil,r=_Mathfloor;e.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},function(e,t,n){var r=n(116),i=_Mathmin;e.exports=function(e){return 0<e?i(r(e),9007199254740991):0}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(36);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(36),i=n(10).document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){"use strict";var r=n(20);e.exports=function(e){var t={ns:{RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDFS:"http://www.w3.org/2000/01/rdf-schema#"},nodeType:{ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12}};this.frameFactory=function(e,n,i){return{NODE:1,ARC:2,parent:n,parser:e,store:e.store,element:i,lastChild:0,base:null,lang:null,node:null,nodeType:null,listIndex:1,rdfid:null,datatype:null,collection:!1,terminateFrame:function(){this.collection&&this.node.close()},addSymbol:function(e,t){t=r.join(t,this.base),this.node=this.store.sym(t),this.nodeType=e},loadTriple:function(){if(this.parent.parent.collection?this.parent.parent.node.append(this.node):this.store.add(this.parent.parent.node,this.parent.node,this.node,this.parser.why),null!=this.parent.rdfid){var e=this.store.sym(r.join("#"+this.parent.rdfid,this.base));this.store.add(e,this.store.sym(t.ns.RDF+"type"),this.store.sym(t.ns.RDF+"Statement"),this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"subject"),this.parent.parent.node,this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"predicate"),this.parent.node,this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"object"),this.node,this.parser.why)}},isTripleToLoad:function(){return null!=this.parent&&null!=this.parent.parent&&this.nodeType===this.NODE&&this.parent.nodeType===this.ARC&&this.parent.parent.nodeType===this.NODE},addNode:function(e){this.addSymbol(this.NODE,e),this.isTripleToLoad()&&this.loadTriple()},addCollection:function(){this.nodeType=this.NODE,this.node=this.store.collection(),this.collection=!0,this.isTripleToLoad()&&this.loadTriple()},addCollectionArc:function(){this.nodeType=this.ARC},addBNode:function(e){this.node=null==e?this.store.bnode():null==this.parser.bnodes[e]?this.parser.bnodes[e]=this.store.bnode():this.parser.bnodes[e],this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()},addArc:function(e){e===t.ns.RDF+"li"&&(e=t.ns.RDF+"_"+this.parent.listIndex,this.parent.listIndex++),this.addSymbol(this.ARC,e)},addLiteral:function(e){this.node=this.parent.datatype?this.store.literal(e,"",this.store.sym(this.parent.datatype)):this.store.literal(e,this.lang),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()}}},this.getAttributeNodeNS=function(e,t,n){var r=null;if(e.getAttributeNodeNS)r=e.getAttributeNodeNS(t,n);else for(var i,a=e.attributes,o=0;o<a.length;++o)if((i=a[o]).namespaceURI===t&&(i.prefix?i.prefix+":"+n:n)===i.nodeName){r=i;break}return r},this.store=e,this.bnodes={},this.why=null,this.reify=!1,this.parse=function(e,n,r){var i,a=e.childNodes;if(this.cleanParser(),e.nodeType===t.nodeType.DOCUMENT){for(var o=0;o<a.length;o++)if(a[o].nodeType===t.nodeType.ELEMENT){i=a[o];break}}else{if(e.nodeType!==t.nodeType.ELEMENT)throw new Error("RDFParser: can't find root in "+n+". Halting. ");i=e}this.why=r;var s=this.frameFactory(this);return this.base=n,s.base=n,s.lang=null,this.parseDOM(this.buildFrame(s,i)),!0},this.parseDOM=function(e){for(var n,i=function(e){var t="";if(null==e.namespaceURI)throw new Error("RDF/XML syntax error: No namespace for "+e.localName+" in "+this.base);return e.namespaceURI&&(t+=e.namespaceURI),e.localName?t+=e.localName:e.nodeName&&(0<=e.nodeName.indexOf(":")?t+=e.nodeName.split(":")[1]:t+=e.nodeName),t}.bind(this),a=!0;e.parent;){var o=e.element,s=o.attributes;if(o.nodeType===t.nodeType.TEXT||o.nodeType===t.nodeType.CDATA_SECTION)e.parent.nodeType===e.NODE&&(e.addArc(t.ns.RDF+"value"),e=this.buildFrame(e)),e.addLiteral(o.nodeValue);else if(i(o)!==t.ns.RDF+"RDF")if(e.parent&&e.parent.collection&&(e.addCollectionArc(),(e=this.buildFrame(e,e.element)).parent.element=null),e.parent&&e.parent.nodeType&&e.parent.nodeType!==e.ARC){e.addArc(i(o)),this.reify&&(n=this.getAttributeNodeNS(o,t.ns.RDF,"ID"))&&(e.rdfid=n.nodeValue,o.removeAttributeNode(n));var u=this.getAttributeNodeNS(o,t.ns.RDF,"parseType"),l=this.getAttributeNodeNS(o,t.ns.RDF,"datatype");if(l&&(e.datatype=l.nodeValue,o.removeAttributeNode(l)),u){var c=u.nodeValue;"Literal"===c?(e.datatype=t.ns.RDF+"XMLLiteral",(e=this.buildFrame(e)).addLiteral(o.childNodes),a=!1):"Resource"===c?((e=this.buildFrame(e,e.element)).parent.element=null,e.addBNode()):"Collection"===c&&((e=this.buildFrame(e,e.element)).parent.element=null,e.addCollection()),o.removeAttributeNode(u)}if(0!==s.length){var d=this.getAttributeNodeNS(o,t.ns.RDF,"resource"),h=this.getAttributeNodeNS(o,t.ns.RDF,"nodeID");e=this.buildFrame(e),d?(e.addNode(d.nodeValue),o.removeAttributeNode(d)):h?(e.addBNode(h.nodeValue),o.removeAttributeNode(h)):e.addBNode();for(var f,p=s.length-1;0<=p;p--)(f=this.buildFrame(e)).addArc(i(s[p])),i(s[p])===t.ns.RDF+"type"?this.buildFrame(f).addNode(s[p].nodeValue):this.buildFrame(f).addLiteral(s[p].nodeValue)}else 0===o.childNodes.length&&this.buildFrame(e).addLiteral("")}else{var m=this.getAttributeNodeNS(o,t.ns.RDF,"about");if(n=this.getAttributeNodeNS(o,t.ns.RDF,"ID"),m&&n)throw new Error("RDFParser: "+o.nodeName+" has both rdf:id and rdf:about. Halting. Only one of these properties may be specified on a node.");if(!m&&n)e.addNode("#"+n.nodeValue),o.removeAttributeNode(n);else if(null==m&&null==n){var v=this.getAttributeNodeNS(o,t.ns.RDF,"nodeID");v?(e.addBNode(v.nodeValue),o.removeAttributeNode(v)):e.addBNode()}else e.addNode(m.nodeValue),o.removeAttributeNode(m);var g=this.getAttributeNodeNS(o,t.ns.RDF,"type");t.ns.RDF+"Description"!==i(o)&&(g={nodeValue:i(o)}),null!=g&&(this.store.add(e.node,this.store.sym(t.ns.RDF+"type"),this.store.sym(r.join(g.nodeValue,e.base)),this.why),g.nodeName&&o.removeAttributeNode(g));for(var b=s.length-1;0<=b;b--)this.store.add(e.node,this.store.sym(i(s[b])),this.store.literal(s[b].nodeValue,e.lang),this.why)}for(o=e.element;e.parent;){for(var y=e;null==o;)o=(e=e.parent).element;var w=o.childNodes&&o.childNodes[e.lastChild];if(w&&a){if((w.nodeType===t.nodeType.ELEMENT||w.nodeType===t.nodeType.TEXT||w.nodeType===t.nodeType.CDATA_SECTION)&&(w.nodeType!==t.nodeType.TEXT&&w.nodeType!==t.nodeType.CDATA_SECTION||1===o.childNodes.length)){e.lastChild++,e=this.buildFrame(y,o.childNodes[e.lastChild-1]);break}e.lastChild++}else{if(e.terminateFrame(),!(e=e.parent))break;o=e.element,a=!0}}}},this.cleanParser=function(){this.bnodes={},this.why=null},this.buildFrame=function(e,n){var i=this.frameFactory(this,e,n);if(e&&(i.base=e.base,i.lang=e.lang),!n||n.nodeType===t.nodeType.TEXT||n.nodeType===t.nodeType.CDATA_SECTION)return i;var a=n.attributes,o=n.getAttributeNode("xml:base");null!=o&&(i.base=o.nodeValue,n.removeAttribute("xml:base"));var s=n.getAttributeNode("xml:lang");null!=s&&(i.lang=s.nodeValue,n.removeAttribute("xml:lang"));for(var u=a.length-1;0<=u;u--)if("xml"===a[u].nodeName.substr(0,3)){if("xmlns:"===a[u].name.slice(0,6)){var l=a[u].nodeValue;this.base&&(l=r.join(l,this.base)),this.store.setPrefixForURI(a[u].name.slice(6),l)}n.removeAttributeNode(a[u])}return i}}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(40),a=n(48),o=n(83),s=n(12),u=n(20),l=n(27);if(void 0===c)var c={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};var d=function(){function e(t,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.options=n||{},this.kb=t,this.target=n.target||{graph:{subjects:{},prefixes:{},terms:{}}},this.blankNodes=[],this.htmlOptions={selfClosing:"br img input area base basefont col colgroup source wbr isindex link meta param hr"},this.theOne="_:"+(new Date).getTime(),this.language=null,this.vocabulary=null,this.blankCounter=0,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}],this.inXHTMLMode=!1,this.absURIRE=/[\w\_\-]+:\S+/,this.finishedHandlers=[],this.init()}return r(e,[{key:"addTriple",value:function(e,t,n,r){var i,a,s,u;i=void 0===t?o.namedNode(this.options.base):this.toRDFNodeObject(t),s=this.toRDFNodeObject(n),a=this.toRDFNodeObject(r),u=o.namedNode(this.options.base),this.kb.add(i,s,a,u)}},{key:"ancestorPath",value:function(e){for(var t="";e&&e.nodeType!==c.DOCUMENT_NODE;)t="/"+e.localName+t,e=e.parentNode;return t}},{key:"copyMappings",value:function(e){var t={};for(var n in e)t[n]=e[n];return t}},{key:"copyProperties",value:function(){}},{key:"deriveDateTimeType",value:function(t){for(var n,r=0;r<e.dateTimeTypes.length;r++)if((n=e.dateTimeTypes[r].pattern.exec(t))&&n[0].length===t.length)return e.dateTimeTypes[r].type;return null}},{key:"init",value:function(){}},{key:"newBlankNode",value:function(){return this.blankCounter++,"_:"+this.blankCounter}},{key:"newSubjectOrigin",value:function(e,t){}},{key:"parseCURIE",value:function(t,n,r){var i,a=t.indexOf(":");if(0<=a){var o=t.substring(0,a);if(""===o)return(i=n[""])?i+t.substring(a+1):null;if("_"===o)return"_:"+t.substring(a+1);if(e.NCNAME.test(o)&&(i=n[o]))return i+t.substring(a+1)}return null}},{key:"parseCURIEOrURI",value:function(e,t,n){var r=this.parseCURIE(e,t,n);return r||this.resolveAndNormalize(n,e)}},{key:"parsePredicate",value:function(e,t,n,r,i,a){if(""===e)return null;var o=this.parseTermOrCURIEOrAbsURI(e,t,a?null:n,r,i);return o&&0===o.indexOf("_:")?null:o}},{key:"parsePrefixMappings",value:function(e,t){for(var n=this.tokenize(e),r=null,i=0;i<n.length;i++)":"===n[i][n[i].length-1]?r=n[i].substring(0,n[i].length-1):r&&(t[r]=this.options.base?u.join(n[i],this.options.base):n[i],r=null)}},{key:"parseSafeCURIEOrCURIEOrURI",value:function(e,t,n){return"["===(e=this.trim(e)).charAt(0)&&"]"===e.charAt(e.length-1)?0===(e=(e=e.substring(1,e.length-1)).trim(e)).length?null:"_:"===e?this.theOne:this.parseCURIE(e,t,n):this.parseCURIEOrURI(e,t,n)}},{key:"parseTermOrCURIEOrAbsURI",value:function(e,t,n,r,i){e=this.trim(e);var a=this.parseCURIE(e,r,i);if(a)return a;if(n){if(t&&!this.absURIRE.exec(e))return t+e;var o=n[e];if(o)return o;if(o=n[e.toLowerCase()])return o}return this.absURIRE.exec(e)?this.resolveAndNormalize(i,e):null}},{key:"parseTermOrCURIEOrURI",value:function(e,t,n,r,i){e=this.trim(e);var a=this.parseCURIE(e,r,i);if(a)return a;var o=n[e];return o||((o=n[e.toLowerCase()])||(t&&!this.absURIRE.exec(e)?t+e:this.resolveAndNormalize(i,e)))}},{key:"parseURI",value:function(e){return e}},{key:"process",value:function(t,n){var r;t.nodeType===c.DOCUMENT_NODE?(r=t.baseURI,(t=t.documentElement).baseURI=r,this.setContext(t)):t.parentNode.nodeType===c.DOCUMENT_NODE&&this.setContext(t);var i=[],a=function(e){if(!e&&n&&n.baseURI)return n.baseURI;var t=e.indexOf("#");return 0<=t&&(e=e.substring(0,t)),n&&n.baseURIMap&&(e=n.baseURIMap(e)),e};for(i.push({current:t,context:this.push(null,a(t.baseURI))});0<i.length;){var o=i.shift();if(o.parent){if(o.context.parent&&o.context.parent.listMapping===o.listMapping)continue;for(var s in o.listMapping){var l=o.listMapping[s];if(0!==l.length){for(var d=[],h=0;h<l.length;h++)d.push(this.newBlankNode());for(var f=0;f<d.length;f++)this.addTriple(o.parent,d[f],"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",l[f]),this.addTriple(o.parent,d[f],"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",{type:e.objectURI,value:f+1<d.length?d[f+1]:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"});this.addTriple(o.parent,o.subject,s,{type:e.objectURI,value:d[0]})}else this.addTriple(o.parent,o.subject,s,{type:e.objectURI,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"})}}else{var p=o.current,m=o.context,v=!1,g=null,b=null,y=null,w=m.prefixes,_=!1,x=[],M=m.listMapping,k=!m.parent,C=m.language,E=m.vocabulary;r=this.parseURI(a(p.baseURI)),p.item=null;var A=p.getAttributeNode("vocab");if(A){var T=this.trim(A.value);if(0<T.length){E=T;var S=r.spec;this.addTriple(p,S,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:e.objectURI,value:E})}else E=this.vocabulary}for(var I,N=0;N<p.attributes.length;N++)if("x"===(I=p.attributes[N]).nodeName.charAt(0)&&0===I.nodeName.indexOf("xmlns:")){_||(w=this.copyMappings(w),_=!0);var j=I.nodeName.substring(6),O=e.trim(I.value);w[j]=this.options.base?u.join(O,this.options.base):O}var R=p.getAttributeNode("prefix");R&&(!_&&(w=this.copyMappings(w),_=!0),this.parsePrefixMappings(R.value,w));for(var L=null,P=0;!L&&P<this.langAttributes.length;P++)L=p.getAttributeNodeNS(this.langAttributes[P].namespaceURI,this.langAttributes[P].localName);if(L){var D=e.trim(L.value);C=0<D.length?D:null}var B,U,q=p.getAttributeNode("rel"),F=p.getAttributeNode("rev"),z=p.getAttributeNode("typeof"),H=p.getAttributeNode("property"),W=p.getAttributeNode("datatype"),V=this.inHTMLMode?p.getAttributeNode("datetime"):null,J=p.getAttributeNode("content"),G=p.getAttributeNode("about"),K=p.getAttributeNode("src"),$=p.getAttributeNode("resource"),X=p.getAttributeNode("href"),Z=p.getAttributeNode("inlist"),Y=[];if(q){U=this.tokenize(q.value);for(var Q=0;Q<U.length;Q++)(B=this.parsePredicate(U[Q],E,m.terms,w,r,this.inHTMLMode&&null!==H))&&Y.push(B)}var ee=[];if(F){U=this.tokenize(F.value);for(var te=0;te<U.length;te++)(B=this.parsePredicate(U[te],E,m.terms,w,r,this.inHTMLMode&&H))&&ee.push(B)}if(this.inHTMLMode&&(q||F)&&H&&(0===Y.length&&(q=null),0===ee.length&&(F=null)),q||F?(G&&(g=this.parseSafeCURIEOrCURIEOrURI(G.value,w,r)),z&&(y=g),!g&&(p.parentNode.nodeType===c.DOCUMENT_NODE?g=a(p.baseURI):m.parentObject&&(g=a(p.parentNode.baseURI)===m.parentObject?a(p.baseURI):m.parentObject)),$&&(b=this.parseSafeCURIEOrCURIEOrURI($.value,w,r)),!b&&(X?b=this.resolveAndNormalize(r,encodeURI(X.value)):K?b=this.resolveAndNormalize(r,encodeURI(K.value)):z&&!G&&!(this.inXHTMLMode&&("head"===p.localName||"body"===p.localName))&&(b=this.newBlankNode())),!z||G||!this.inXHTMLMode||"head"!==p.localName&&"body"!==p.localName?z&&!G&&(y=b):y=g):!H||J||W?(G&&(g=this.parseSafeCURIEOrCURIEOrURI(G.value,w,r)),!g&&$&&(g=this.parseSafeCURIEOrCURIEOrURI($.value,w,r)),!g&&X&&(g=this.resolveAndNormalize(r,encodeURI(X.value))),!g&&K&&(g=this.resolveAndNormalize(r,encodeURI(K.value))),!g&&(p.parentNode.nodeType===c.DOCUMENT_NODE?g=a(p.baseURI):!this.inXHTMLMode&&!this.inHTMLMode||"head"!==p.localName&&"body"!==p.localName?z?g=this.newBlankNode():m.parentObject&&(g=a(p.parentNode.baseURI)===m.parentObject?a(p.baseURI):m.parentObject,!H&&(v=!0)):g=a(p.parentNode.baseURI)===m.parentObject?a(p.baseURI):m.parentObject),z&&(y=g)):(G&&(g=this.parseSafeCURIEOrCURIEOrURI(G.value,w,r),z&&(y=g)),g||p.parentNode.nodeType!==c.DOCUMENT_NODE?!g&&m.parentObject&&(g=a(p.parentNode.baseURI)===m.parentObject?a(p.baseURI):m.parentObject):(g=a(p.baseURI),z&&(y=g)),z&&!y&&($&&(y=this.parseSafeCURIEOrCURIEOrURI($.value,w,r)),!y&&X&&(y=this.resolveAndNormalize(r,encodeURI(X.value))),!y&&K&&(y=this.resolveAndNormalize(r,encodeURI(K.value))),!y&&(this.inXHTMLMode||this.inHTMLMode)&&("head"===p.localName||"body"===p.localName)&&(y=g),!y&&(y=this.newBlankNode()),b=y)),g&&(G||$||y)){var ne=g;z&&!G&&!$&&b&&(ne=b),this.newSubjectOrigin(p,ne)}if(y){U=this.tokenize(z.value);for(var re,ie=0;ie<U.length;ie++)(re=this.parseTermOrCURIEOrAbsURI(U[ie],E,m.terms,w,r))&&this.addTriple(p,y,e.typeURI,{type:e.objectURI,value:re})}if(g&&g!==m.parentObject&&(M={},k=!0),b){if(q&&Z)for(var ae,oe=0;oe<Y.length;oe++)(ae=M[Y[oe]])||(ae=[],M[Y[oe]]=ae),ae.push({type:e.objectURI,value:b});else if(q)for(var se=0;se<Y.length;se++)this.addTriple(p,g,Y[se],{type:e.objectURI,value:b});if(F)for(var ue=0;ue<ee.length;ue++)this.addTriple(p,b,ee[ue],{type:e.objectURI,value:g})}else{if(g&&!b&&(q||F)&&(b=this.newBlankNode()),q&&Z)for(var le,ce=0;ce<Y.length;ce++)(le=M[Y[ce]])||(le=[],M[B]=le),x.push({predicate:Y[ce],list:le});else if(q)for(var de=0;de<Y.length;de++)x.push({predicate:Y[de],forward:!0});if(F)for(var he=0;he<ee.length;he++)x.push({predicate:ee[he],forward:!1})}if(H){var fe=null,pe=null;W?(fe=""===W.value?e.PlainLiteralURI:this.parseTermOrCURIEOrAbsURI(W.value,E,m.terms,w,r),pe=V&&!J?V.value:fe===e.XMLLiteralURI||fe===e.HTMLLiteralURI?null:J?J.value:p.textContent):J?(fe=e.PlainLiteralURI,pe=J.value):V?(pe=V.value,!(fe=e.deriveDateTimeType(pe))&&(fe=e.PlainLiteralURI)):!q&&!F&&($&&(pe=this.parseSafeCURIEOrCURIEOrURI($.value,w,r)),!pe&&X?pe=this.resolveAndNormalize(r,encodeURI(X.value)):!pe&&K&&(pe=this.resolveAndNormalize(r,encodeURI(K.value))),pe&&(fe=e.objectURI)),fe||(z&&!G?(fe=e.objectURI,pe=y):(pe=p.textContent,this.inHTMLMode&&"time"===p.localName&&(fe=e.deriveDateTimeType(pe)),!fe&&(fe=e.PlainLiteralURI))),U=this.tokenize(H.value);for(var me,ve=0;ve<U.length;ve++)if(me=this.parsePredicate(U[ve],E,m.terms,w,r))if(Z){var ge=M[me];ge||(ge=[],M[me]=ge),ge.push(fe===e.XMLLiteralURI||fe===e.HTMLLiteralURI?{type:fe,value:p.childNodes}:{type:fe||e.PlainLiteralURI,value:pe,language:C})}else fe===e.XMLLiteralURI||fe===e.HTMLLiteralURI?this.addTriple(p,g,me,{type:fe,value:p.childNodes}):this.addTriple(p,g,me,{type:fe||e.PlainLiteralURI,value:pe,language:C})}if(g&&!v)for(var be=0;be<m.incomplete.length;be++)m.incomplete[be].list?m.incomplete[be].list.push({type:e.objectURI,value:g}):m.incomplete[be].forward?this.addTriple(p,m.subject,m.incomplete[be].predicate,{type:e.objectURI,value:g}):this.addTriple(p,g,m.incomplete[be].predicate,{type:e.objectURI,value:m.subject});var ye=null,we=g;v?((ye=this.push(m,m.subject)).parentObject=a(p.parentNode.baseURI)===m.parentObject?a(p.baseURI):m.parentObject,ye.incomplete=m.incomplete,ye.language=C,ye.prefixes=w,ye.vocabulary=E):((ye=this.push(m,g)).parentObject=b||(g||m.subject),ye.prefixes=w,ye.incomplete=x,b&&(we=b,M={},k=!0),ye.listMapping=M,ye.language=C,ye.vocabulary=E),k&&i.unshift({parent:p,context:m,subject:we,listMapping:M});for(var _e=p.lastChild;_e;_e=_e.previousSibling)_e.nodeType===c.ELEMENT_NODE&&(_e.baseURI=p.baseURI,i.unshift({current:_e,context:ye}))}}this.inHTMLMode&&this.copyProperties();for(var xe=0;xe<this.finishedHandlers.length;xe++)this.finishedHandlers[xe](t)}},{key:"push",value:function(e,t){return{parent:e,subject:t||(e?e.subject:null),parentObject:null,incomplete:[],listMapping:e?e.listMapping:{},language:e?e.language:this.language,prefixes:e?e.prefixes:this.target.graph.prefixes,terms:e?e.terms:this.target.graph.terms,vocabulary:e?e.vocabulary:this.vocabulary}}},{key:"resolveAndNormalize",value:function(e,t){return u.join(t,e)}},{key:"setContext",value:function(e){"html"===e.localName&&"XHTML+RDFa 1.1"===e.getAttribute("version")?this.setXHTMLContext():"html"===e.localName||"http://www.w3.org/1999/xhtml"===e.namespaceURI?"undefined"!=typeof document&&document.doctype?"-//W3C//DTD XHTML+RDFa 1.0//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"===document.doctype.systemId?(console.log("WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode."),this.setHTMLContext()):"-//W3C//DTD XHTML+RDFa 1.1//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"===document.doctype.systemId?this.setXHTMLContext():this.setHTMLContext():this.setHTMLContext():this.setXMLContext()}},{key:"setHTMLContext",value:function(){this.setInitialContext(),this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.inXHTMLMode=!1,this.inHTMLMode=!0}},{key:"setInitialContext",value:function(){this.vocabulary=null,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}]}},{key:"setXHTMLContext",value:function(){this.setInitialContext(),this.inXHTMLMode=!0,this.inHTMLMode=!1,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.target.graph.terms.alternate="http://www.w3.org/1999/xhtml/vocab#alternate",this.target.graph.terms.appendix="http://www.w3.org/1999/xhtml/vocab#appendix",this.target.graph.terms.bookmark="http://www.w3.org/1999/xhtml/vocab#bookmark",this.target.graph.terms.cite="http://www.w3.org/1999/xhtml/vocab#cite",this.target.graph.terms.chapter="http://www.w3.org/1999/xhtml/vocab#chapter",this.target.graph.terms.contents="http://www.w3.org/1999/xhtml/vocab#contents",this.target.graph.terms.copyright="http://www.w3.org/1999/xhtml/vocab#copyright",this.target.graph.terms.first="http://www.w3.org/1999/xhtml/vocab#first",this.target.graph.terms.glossary="http://www.w3.org/1999/xhtml/vocab#glossary",this.target.graph.terms.help="http://www.w3.org/1999/xhtml/vocab#help",this.target.graph.terms.icon="http://www.w3.org/1999/xhtml/vocab#icon",this.target.graph.terms.index="http://www.w3.org/1999/xhtml/vocab#index",this.target.graph.terms.last="http://www.w3.org/1999/xhtml/vocab#last",this.target.graph.terms.license="http://www.w3.org/1999/xhtml/vocab#license",this.target.graph.terms.meta="http://www.w3.org/1999/xhtml/vocab#meta",this.target.graph.terms.next="http://www.w3.org/1999/xhtml/vocab#next",this.target.graph.terms.prev="http://www.w3.org/1999/xhtml/vocab#prev",this.target.graph.terms.previous="http://www.w3.org/1999/xhtml/vocab#previous",this.target.graph.terms.section="http://www.w3.org/1999/xhtml/vocab#section",this.target.graph.terms.stylesheet="http://www.w3.org/1999/xhtml/vocab#stylesheet",this.target.graph.terms.subsection="http://www.w3.org/1999/xhtml/vocab#subsection",this.target.graph.terms.start="http://www.w3.org/1999/xhtml/vocab#start",this.target.graph.terms.top="http://www.w3.org/1999/xhtml/vocab#top",this.target.graph.terms.up="http://www.w3.org/1999/xhtml/vocab#up",this.target.graph.terms.p3pv1="http://www.w3.org/1999/xhtml/vocab#p3pv1",this.target.graph.terms.related="http://www.w3.org/1999/xhtml/vocab#related",this.target.graph.terms.role="http://www.w3.org/1999/xhtml/vocab#role",this.target.graph.terms.transformation="http://www.w3.org/1999/xhtml/vocab#transformation"}},{key:"setXMLContext",value:function(){this.setInitialContext(),this.inXHTMLMode=!1,this.inHTMLMode=!1}},{key:"tokenize",value:function(e){return this.trim(e).split(/\s+/)}},{key:"toRDFNodeObject",value:function(t){if(void 0!==t){if("string"==typeof t)return"_:"===t.substring(0,2)?(void 0===this.blankNodes[t.substring(2)]&&(this.blankNodes[t.substring(2)]=new i(t.substring(2))),this.blankNodes[t.substring(2)]):o.namedNode(t);switch(t.type){case e.objectURI:return"_:"===t.value.substring(0,2)?(void 0===this.blankNodes[t.value.substring(2)]&&(this.blankNodes[t.value.substring(2)]=new i(t.value.substring(2))),this.blankNodes[t.value.substring(2)]):o.namedNode(t.value);case e.PlainLiteralURI:return new a(t.value,t.language||"");case e.XMLLiteralURI:case e.HTMLLiteralURI:var n="";return Object.keys(t.value).forEach(function(e){n+=l.domToString(t.value[e],this.htmlOptions)}),new a(n,"",new s(t.type));default:return new a(t.value,"",new s(t.type))}}}},{key:"trim",value:function(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}],[{key:"parseRDFaDOM",value:function(t,n,r){var i=new e(n,{base:r});t.baseURI=r,i.process(t)}}]),e}();d.XMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral",d.HTMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML",d.PlainLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral",d.objectURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#object",d.typeURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",d.nameChar="[-A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�က0-F.0-9·̀-ͯ‿-⁀]",d.nameStartChar="[A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩_]",d.NCNAME=new RegExp("^"+d.nameStartChar+d.nameChar+"*$"),d.dateTimeTypes=[{pattern:/-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\.[0-9]+)?S)?)?/,type:"http://www.w3.org/2001/XMLSchema#duration"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9]T(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#dateTime"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9](?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#date"},{pattern:/(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#time"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]/,type:"http://www.w3.org/2001/XMLSchema#gYearMonth"},{pattern:/-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,type:"http://www.w3.org/2001/XMLSchema#gYear"}],e.exports=d},function(e,t,n){"use strict";function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(39),u=n(82),l=n(12),c=n(62),d=n(215),h=n(122).parseRDFaDOM,f=n(121),p=n(20),m=n(27),v=n(134),g=n(213).fetch,b={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/ld+json":!0},y={rdf:"application/rdf+xml",owl:"application/rdf+xml",n3:"text/n3",ttl:"text/turtle",nt:"text/n3",acl:"text/n3",html:"text/html",xml:"text/xml"},w={link:c("http://www.w3.org/2007/ont/link#"),http:c("http://www.w3.org/2007/ont/http#"),httph:c("http://www.w3.org/2007/ont/httph#"),rdf:c("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),rdfs:c("http://www.w3.org/2000/01/rdf-schema#"),dc:c("http://purl.org/dc/elements/1.1/"),ldp:c("http://www.w3.org/ns/ldp#")},_=function e(t,n){a(this,e),this.response=t,this.dom=n},x=function(e){function t(){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,_),o(t,[{key:"parse",value:function e(t,n,r,i){var a=t.store;if(this.dom||(this.dom=m.parseXML(n)),"parsererror"===this.dom.documentElement.nodeName)return t.failFetch(r,"Badly formed XML in "+r.resource.uri,"parse_error");var o=new f(a);try{o.parse(this.dom,r.original.uri,r.original,i)}catch(e){return t.failFetch(r,"Syntax error parsing RDF/XML! "+e,"parse_error")}return r.noMeta||a.add(r.original,w.rdf("type"),w.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}],[{key:"toString",value:function(){return"RDFXMLHandler"}},{key:"register",value:function(e){e.mediatypes["application/rdf+xml"]={q:.9}}}]),t}();x.pattern=/application\/rdf\+xml/;var M=function(e){function t(){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,_),o(t,[{key:"parse",value:function e(t,n,r,i){var a,o;this.dom||(this.dom=m.parseXML(n));var s=t.store,u=this.dom.getElementsByTagName("title");0<u.length&&s.add(r.resource,w.dc("title"),s.literal(u[0].textContent),r.resource);for(var l=this.dom.getElementsByTagName("link"),c=l.length-1;0<=c;c--)o=!1,(a=l[c].getAttribute("rel"))||(a=l[c].getAttribute("rev"),o=!0),a&&t.linkData(r.original,a,l[c].getAttribute("href"),r.resource,o);for(var f,p=this.dom.getElementsByTagName("script"),v=0;v<p.length;v++)f=p[v].getAttribute("type"),b[f]&&(d(p[v].textContent,s,r.original.uri,f),d(p[v].textContent,s,r.original.uri,f));if(r.noMeta||s.add(r.resource,w.rdf("type"),w.link("WebPage"),t.appNode),!r.noRDFa&&h)try{h(this.dom,s,r.original.uri)}catch(e){var g="Error trying to parse "+r.resource+" as RDFa:\n"+e+":\n"+e.stack;return t.failFetch(r,g,"parse_error")}return t.doneFetch(r,this.response)}}],[{key:"toString",value:function(){return"XHTMLHandler"}},{key:"register",value:function(e){e.mediatypes["application/xhtml+xml"]={}}}]),t}();M.pattern=/application\/xhtml/;var k=function(e){function t(){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,_),o(t,[{key:"parse",value:function(e,t,n,r){for(var i=m.parseXML(t),a=0;a<i.childNodes.length;a++)if(1===i.childNodes[a].nodeType){var o=i.childNodes[a].namespaceURI;if(o&&o===o.rdf)return e.addStatus(n.req,"Has XML root element in the RDF namespace, so assume RDF/XML."),new x(this.response,i).parse(e,t,n,r);break}if(i.doctype&&"html"===i.doctype.name&&i.doctype.publicId.match(/^-\/\/W3C\/\/DTD XHTML/)&&i.doctype.systemId.match(/http:\/\/www.w3.org\/TR\/xhtml/))return e.addStatus(n.req,"Has XHTML DOCTYPE. Switching to XHTML Handler.\n"),new M(this.response,i).parse(e,t,n,r);var s=i.getElementsByTagName("html")[0];if(s){var u=s.getAttribute("xmlns");if(u&&u.match(/^http:\/\/www.w3.org\/1999\/xhtml/))return e.addStatus(n.req,"Has a default namespace for XHTML. Switching to XHTMLHandler.\n"),new M(this.response,i).parse(e,t,n,r)}return e.failFetch(n,"Unsupported dialect of XML: not RDF or XHTML namespace, etc.\n"+t.slice(0,80),901)}}],[{key:"toString",value:function(){return"XMLHandler"}},{key:"register",value:function(e){e.mediatypes["text/xml"]={q:.5},e.mediatypes["application/xml"]={q:.5}}}]),t}();k.pattern=/(text|application)\/(.*)xml/;var C=function(e){function t(){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,_),o(t,[{key:"parse",value:function(e,t,n,r){var i=e.store;if(t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/))return e.addStatus(n.req,"Has an XML declaration. We'll assume it's XHTML as the content-type was text/html.\n"),new M(this.response).parse(e,t,n,r);if(t.match(/.*<!DOCTYPE\s+html[^<]+-\/\/W3C\/\/DTD XHTML[^<]+http:\/\/www.w3.org\/TR\/xhtml[^<]+>/))return e.addStatus(n.req,"Has XHTML DOCTYPE. Switching to XHTMLHandler.\n"),new M(this.response).parse(e,t,n,r);if(t.match(/[^(<html)]*<html\s+[^<]*xmlns=['"]http:\/\/www.w3.org\/1999\/xhtml["'][^<]*>/))return e.addStatus(n.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),new M(this.response).parse(e,t,n,r);var a=/<title>([\s\S]+?)<\/title>/im.exec(t);return a&&i.add(n.resource,w.dc("title"),i.literal(a[1]),n.resource),i.add(n.resource,w.rdf("type"),w.link("WebPage"),e.appNode),e.addStatus(n.req,"non-XML HTML document, not parsed for data."),e.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"HTMLHandler"}},{key:"register",value:function(e){e.mediatypes["text/html"]={q:.9}}}]),t}();C.pattern=/text\/html/;var E=function(e){function t(){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,_),o(t,[{key:"parse",value:function(e,t,n,r){return t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)?(e.addStatus(n.req,"Warning: "+n.resource+" has an XML declaration. We'll assume it's XML but its content-type wasn't XML.\n"),new k(this.response).parse(e,t,n,r)):t.slice(0,500).match(/xmlns:/)?(e.addStatus(n.req,"May have an XML namespace. We'll assume it's XML but its content-type wasn't XML.\n"),new k(this.response).parse(e,t,n,r)):(e.addStatus(n.req,"Plain text document, no known RDF semantics."),e.doneFetch(n,this.response))}}],[{key:"toString",value:function(){return"TextHandler"}},{key:"register",value:function(e){e.mediatypes["text/plain"]={q:.5}}}]),t}();E.pattern=/text\/plain/;var A=function(e){function t(){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,_),o(t,[{key:"parse",value:function e(t,n,r,i){var a=t.store,o=u(a,a,r.original.uri,r.original.uri,null,null,"",null);try{o.loadBuf(n)}catch(e){var s="Error trying to parse "+r.resource+" as Notation3:\n"+e+":\n"+e.stack;return t.failFetch(r,s,"parse_error",i)}return t.addStatus(r.req,"N3 parsed: "+o.statementCount+" triples in "+o.lines+" lines."),t.store.add(r.original,w.rdf("type"),w.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}],[{key:"toString",value:function(){return"N3Handler"}},{key:"register",value:function(e){e.mediatypes["text/n3"]={q:"1.0"},e.mediatypes["text/turtle"]={q:1}}}]),t}();A.pattern=/(application|text)\/(x-)?(rdf\+)?(n3|turtle)/;var T={RDFXMLHandler:x,XHTMLHandler:M,XMLHandler:k,HTMLHandler:C,TextHandler:E,N3Handler:A},S=function(){function e(t){var n=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(a(this,e),this.store=t,this.timeout=r.timeout||3e4,this._fetch=r.fetch||g,!this._fetch)throw new Error("No _fetch function availble for Fetcher");this.appNode=this.store.bnode(),this.store.fetcher=this,this.requested={},this.timeouts={},this.redirectedTo={},this.fetchQueue={},this.fetchCallbacks={},this.nonexistent={},this.lookedUp={},this.handlers=[],this.mediatypes={"image/*":{q:.9},"*/*":{q:.1}},m.callbackify(this,["request","fail","refresh","retract","done"]),Object.keys(T).map(function(e){return n.addHandler(T[e])})}return o(e,[{key:"load",value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(e instanceof Array)return Promise.all(e.map(function(e){return t.load(e,Object.assign({},n))}));var r=e.uri||e;return r=r.split("#")[0],n=this.initFetchOptions(r,n),this.pendingFetchPromise(r,n.baseURI,n)}},{key:"pendingFetchPromise",value:function(e,t,n){var r,i=this;return!n.force&&this.fetchQueue[t]?r=this.fetchQueue[t]:(r=Promise.race([this.setRequestTimeout(e,n),this.fetchUri(e,n)]),this.fetchQueue[t]=r,this.cleanupFetchRequest(t,n,this.timeout)),r.then(function(t){return e in i.timeouts&&(i.timeouts[e].forEach(clearTimeout),delete i.timeouts[e]),t})}},{key:"cleanupFetchRequest",value:function(e,t,n){var r=this;this.timeouts[e]=(this.timeouts[e]||[]).concat(setTimeout(function(){r.isPending(e)||delete r.fetchQueue[e]},n))}},{key:"initFetchOptions",value:function(t,n){var r=this.store;!n.method||"GET"===n.method.toUpperCase()||(n.force=!0),n.resource=r.sym(t),n.baseURI=n.baseURI||t,n.original=r.sym(n.baseURI),n.req=r.bnode(),n.headers=n.headers||{},n.contentType&&(n.headers["content-type"]=n.contentType),n.force&&(n.cache="no-cache");var i=this.acceptString();n.headers.accept=i;var a=e.offlineOverride(t);n.requestedURI=a,e.withCredentials(a,n)&&(n.credentials="include");var o=e.proxyIfNecessary(a);return a!==o&&(n.proxyUsed=!0),n.actualProxyURI=o,n}},{key:"fetchUri",value:function(t,n){var r=this;if(!t)return Promise.reject(new Error("Cannot fetch an empty uri"));if(e.unsupportedProtocol(t))return this.failFetch(n,"fetcher: Unsupported protocol","unsupported_protocol");var i=this.getState(t);if(n.force)delete this.nonexistent[t];else{if("fetched"===i)return Promise.resolve(this.doneFetch(n,{status:200,ok:!0,statusText:"Already loaded into quadstore."}));if("failed"===i){var a="Previously failed: "+this.requested[t],o={url:t,status:this.requested[t],statusText:a,responseText:a,headers:{},ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.failFetch(n,a,this.requested[t],o)}}this.fireCallbacks("request",[t]),this.requested[t]=!0,n.noMeta||this.saveRequestMetadata(t,n);var s=n.actualProxyURI;return this._fetch(s,n).then(function(e){return r.handleResponse(e,t,n)},function(e){var t={url:s,status:999,statusText:(e.name||"network failure")+": "+(e.errno||e.code||e.type),responseText:e.message,headers:{},ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return console.log("Fetcher: <"+s+"> Non-HTTP fetch error: "+e),r.failFetch(n,"fetch failed: "+e,999,t)})}},{key:"nowOrWhenFetched",value:function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};e=e.uri||e,"function"==typeof t?n=t:void 0===t||(t instanceof l?r.referringTerm=t:r=t),this.load(e,r).then(function(t){if(n)if(t)if(t.ok)n(!0,"OK",t);else{console.log("@@@ fetcher.js Should not take this path !!!!!!!!!!!!");var r="HTTP error: Status "+t.status+" ("+t.statusText+")";t.responseText&&(r+=" "+t.responseText),console.log(r+" fetching "+e),n(!1,r,t)}else{var i="@@ nowOrWhenFetched: no response object!";console.log(i),n(!1,i)}},function(t){var r=t.message||t.statusText;r="Failed to load <"+e+"> "+r,console.log(r),t.response&&t.response.status&&(r+=" status: "+t.response.status),n(!1,r,t.response)})}},{key:"addStatus",value:function(e,t){var n=new Date;t="["+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()+"."+n.getMilliseconds()+"] "+t;var r=this.store,i=r.the(e,w.link("status"));i&&i.append?i.append(r.literal(t)):s.warn("web.js: No list to add to: "+i+","+t)}},{key:"failFetch",value:function(e,t,n,r){this.addStatus(e.req,t),e.noMeta||this.store.add(e.original,w.link("error"),t);var i=(e.method||"GET").toUpperCase();("GET"===i||"HEAD"===i)&&(e.resource.sameTerm(e.original)?console.log("@@ Recording "+i+" failure for "+e.original+": "+n):console.log("@@ Recording failure "+i+" original "+e.original+"( as "+e.resource+") : "+n),this.requested[p.docpart(e.original.uri)]=n,this.fireCallbacks("fail",[e.original.uri,t]));var a=new Error("Fetcher: "+t);return a.status=n,a.statusText=t,a.response=r,Promise.reject(a)}},{key:"linkData",value:function(e,t,n,r,i){if(n){var a,o=this.store,s=o.sym(p.join(n,e.uri));if("alternate"===t||"seeAlso"===t||"meta"===t||"describedby"===t){if(s.uri===e.uri)return;a=w.rdfs("seeAlso")}else a="type"===t?o.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):o.sym(p.join(encodeURIComponent(t),"http://www.iana.org/assignments/link-relations/"));i?o.add(s,a,e,r):o.add(e,a,s,r)}}},{key:"parseLinkHeader",value:function(e,t,n){if(e)for(var r=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,i=e.match(/<[^>]*>\s*(\s*;\s*[^()<>@,;:"/[\]?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g),a=0;a<i.length;a++)for(var o=i[a].split(">"),s=o[0].substring(1),u=o[1].match(r),l=0;l<u.length;l++){var c=u[l].split("=")[1].replace(/["']/g,"");this.linkData(t,c,s,n)}}},{key:"doneFetch",value:function(e,t){return this.addStatus(e.req,"Done."),this.requested[e.original.uri]="done",this.fireCallbacks("done",[e.original.uri]),t.req=e.req,t}},{key:"nowKnownAs",value:function(e,t){this.lookedUp[e.uri]?!this.lookedUp[t.uri]&&this.lookUpThing(t,e):this.lookedUp[t.uri]&&!this.lookedUp[e.uri]&&this.lookUpThing(e,t)}},{key:"putBack",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};e=e.uri||e;var n=new l(e).doc();return t.data=v(n,this.store,n.uri,t.contentType||"text/turtle"),this.webOperation("PUT",e,t)}},{key:"webCopy",value:function(e,t,n){var r=this;return this.webOperation("GET",e).then(function(e){return r.webOperation("PUT",t,{data:e.responseText,contentType:n})})}},{key:"delete",value:function(e,t){var n=this;return this.webOperation("DELETE",e,t).then(function(t){return n.requested[e]=404,n.nonexistent[e]=!0,n.unload(n.store.sym(e)),t})}},{key:"createContainer",value:function(e,t,n){var r={"content-type":"text/turtle",link:w.ldp("BasicContainer")+'; rel="type"'};t&&(r.slug=t);var i={headers:r};return n&&(i.body=n),this.webOperation("POST",e,i)}},{key:"webOperation",value:function(t,n){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};r.method=t,r.body=r.data||r.body,r.force=!0;var i=this;if(r.body&&!r.contentType)throw new Error("Web operation sending data must have a defined contentType.");return r.contentType&&(r.headers=r.headers||{},r.headers["content-type"]=r.contentType),e.withCredentials(n,r)&&(r.credentials="include"),new Promise(function(e,a){i._fetch(n,r).then(function(r){if(r.ok)r.body?r.text().then(function(t){r.responseText=t,e(r)}):e(r);else{var i="Web error: "+r.status;r.statusText&&(i+=" ("+r.statusText+")"),i+=" on "+t+" of <"+n+">",r.responseText&&(i+=": "+r.responseText),a(new Error(i))}},function(e){a(new Error("Fetch error for "+t+" of <"+n+">:"+e))})})}},{key:"lookUpThing",value:function(e,t){var n=this,r=this.store.uris(e);return(r=r.map(function(e){return p.docpart(e)})).forEach(function(e){n.lookedUp[e]=!0}),this.load(r,{referringTerm:t})}},{key:"getHeader",value:function(e,t){for(var n,r=this.store,i=r.each(void 0,w.link("requestedURI"),e.uri),a=0;a<i.length;a++)if(void 0!==(n=i[a])){var o=r.any(n,w.link("response"));if(void 0!==o){var s=r.each(o,w.httph(t.toLowerCase()));return s.length?s.map(function(e){return e.value}):[]}}}},{key:"saveRequestMetadata",value:function(e,t){var n=t.req,r=this.store,i=t.referringTerm;this.addStatus(t.req,"Accept: "+t.headers.accept),i&&i.uri&&r.add(e,w.link("requestedBy"),i.uri,this.appNode),t.original&&t.original.uri!==e&&r.add(n,w.link("orginalURI"),r.literal(t.original.uri),this.appNode);var a=new Date,o="["+a.getHours()+":"+a.getMinutes()+":"+a.getSeconds()+"] ";r.add(n,w.rdfs("label"),r.literal(o+" Request for "+e),this.appNode),r.add(n,w.link("requestedURI"),r.literal(e),this.appNode),r.add(n,w.link("status"),r.collection(),this.appNode)}},{key:"saveResponseMetadata",value:function(e,t){var n=this.store,r=n.bnode();return n.add(t.req,w.link("response"),r),n.add(r,w.http("status"),n.literal(e.status),r),n.add(r,w.http("statusText"),n.literal(e.statusText),r),t.resource.uri.startsWith("http")?(e.headers.forEach(function(e,i){n.add(r,w.httph(i),e,r),"content-type"===i&&n.add(t.resource,w.rdf("type"),m.mediaTypeClass(e),r)}),r):r}},{key:"objectRefresh",value:function(e){var t=this.store.uris(e);if(void 0!==t)for(var n=0;n<t.length;n++)this.refresh(this.store.sym(p.docpart(t[n])))}},{key:"refresh",value:function(e,t){this.fireCallbacks("refresh",arguments),this.nowOrWhenFetched(e,{force:!0,clearPreviousData:!0},t)}},{key:"retract",value:function(e){this.store.removeMany(void 0,void 0,void 0,e),e.uri&&delete this.requested[p.docpart(e.uri)],this.fireCallbacks("retract",arguments)}},{key:"getState",value:function(e){return void 0===this.requested[e]?"unrequested":!0===this.requested[e]?"requested":"done"===this.requested[e]?"fetched":"redirected"===this.requested[e]?this.getState(this.redirectedTo[e]):"failed"}},{key:"isPending",value:function(e){return!0===this.requested[e]}},{key:"unload",value:function(e){this.store.removeDocument(e),delete this.requested[e.uri]}},{key:"addHandler",value:function(e){this.handlers.push(e),e.register(this)}},{key:"retryNoCredentials",value:function(e,t){console.log("web: Retrying with no credentials for "+t.resource),t.retriedWithNoCredentials=!0,delete this.requested[e];var n=Object.assign({},t,{withCredentials:!1});return this.addStatus(t.req,"Abort: Will retry with credentials SUPPRESSED to see if that helps"),this.load(e,n)}},{key:"isCrossSite",value:function(e){if("undefined"==typeof document||!document.location)return!1;var t=p.hostpart,n=""+document.location;return t(n)&&t(e)&&t(n)!==t(e)}},{key:"handleError",value:function(t,n,r){if(this.isCrossSite(n)){if(r.withCredentials&&!r.retriedWithNoCredentials)return this.retryNoCredentials(n,r);var i=e.crossSiteProxy(n);if(i&&!r.proxyUsed)return console.log("web: Direct failed so trying proxy "+i),this.redirectToProxy(i,r)}var a;return t.message?a="Fetch error: "+t.message:(a=t.statusText,t.responseText&&(a+=" "+t.responseText)),this.failFetch(r,a,t.status||998,t)}},{key:"addType",value:function(e,t,n,r){var i=t;if(r){var a=n.any(i,w.link("requestedURI"));a&&a!==r&&n.add(n.sym(r),w.rdf("type"),e,this.appNode)}for(;;){var o=n.any(i,w.link("requestedURI"));if(o&&o.value&&n.add(n.sym(o.value),w.rdf("type"),e,this.appNode),!(i=n.any(void 0,n.sym("http://www.w3.org/2007/ont/link#redirectedRequest"),i)))break;var s=n.any(i,n.sym("http://www.w3.org/2007/ont/link#response"));if(!s)break;var u=n.any(s,n.sym("http://www.w3.org/2007/ont/http#status"));if(!u)break;if("301"!==u&&"302"!==u)break}}},{key:"handleResponse",value:function(e,t,n){var r=this,i=this.store,a=e.headers,o=n.req,s=this.saveResponseMetadata(e,n),u=this.normalizedContentType(n,a)||"",l=a.get("content-location");if(0===e.status)return console.log("Masked error - status 0 for "+t),this.handleError(e,t,n);if(400<=e.status)return 404===e.status&&(this.nonexistent[n.original.uri]=!0,this.nonexistent[t]=!0),this.saveErrorResponse(e,s).then(function(){var t=n.resource+" "+e.statusText;return r.failFetch(n,t,e.status,e)});var c=null,d=null;if(l&&((d=p.join(l,t))!==t&&(c=d)),200===e.status){this.addType(w.link("Document"),o,i,t),c&&this.addType(w.link("Document"),o,i,c),n.clearPreviousData&&i.removeDocument(n.resource);var h=u.includes("image/")||u.includes("application/pdf");u&&h&&(this.addType(i.sym("http://purl.org/dc/terms/Image"),o,i,t),c&&this.addType(i.sym("http://purl.org/dc/terms/Image"),o,i,c))}if(l){if(!n.force&&c&&"done"===this.requested[d])return this.doneFetch(n,e);this.requested[d]=!0}this.parseLinkHeader(a.get("link"),n.original,o);var f=this.handlerForContentType(u,e);return f?e.text().then(function(t){return e.responseText=t,f.parse(r,t,n,e)}):(this.addStatus(o,"Fetch over. No data handled."),this.doneFetch(n,e))}},{key:"saveErrorResponse",value:function(e,t){var n=this.store;return e.text().then(function(e){10<e.length&&n.add(t,w.http("content"),n.literal(e),t)})}},{key:"handlerForContentType",value:function(e,t){if(!e)return null;var n=this.handlers.find(function(t){return e.match(t.pattern)});return n?new n(t):null}},{key:"guessContentType",value:function(e){return y[e.split(".").pop()]}},{key:"normalizedContentType",value:function(e,t){if(e.forceContentType)return e.forceContentType;var n=t.get("content-type");if(!n||n.includes("application/octet-stream")){var r=this.guessContentType(e.resource.uri);if(r)return r}var i=p.protocol(e.resource.uri);return!n&&["file","chrome"].includes(i)?"text/xml":n}},{key:"redirectToProxy",value:function(e,t){var n=this;this.addStatus(t.req,"BLOCKED -> Cross-site Proxy to <"+e+">"),t.proxyUsed=!0;var r=this.store,i=t.req;t.noMeta||(r.add(i,w.link("redirectedTo"),r.sym(e),i),this.addStatus(i,"redirected to new request")),this.requested[t.resource.uri]="redirected",this.redirectedTo[t.resource.uri]=e;var a=Object.assign({},t);return a.baseURI=t.resource.uri,this.fetchUri(e,a).then(function(e){return a.noMeta||r.add(i,w.link("redirectedRequest"),a.req,n.appNode),e})}},{key:"setRequestTimeout",value:function(e,t){var n=this;return new Promise(function(r){n.timeouts[e]=(n.timeouts[e]||[]).concat(setTimeout(function(){!n.isPending(e)||t.retriedWithNoCredentials||t.proxyUsed||r(n.failFetch(t,"Request to "+e+" timed out","timeout"))},n.timeout))})}},{key:"addFetchCallback",value:function(e,t){this.fetchCallbacks[e]?this.fetchCallbacks[e].push(t):this.fetchCallbacks[e]=[t]}},{key:"acceptString",value:function(){var e="";for(var t in this.mediatypes)for(var n in""!=e&&(e+=", "),e+=t,this.mediatypes[t])e+=";"+n+"="+this.mediatypes[t][n];return e}}],[{key:"crossSiteProxy",value:function(t){return e.crossSiteProxyTemplate?e.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):void 0}},{key:"offlineOverride",value:function(e){var t,n=e;return"undefined"!=typeof window&&window.panes&&(t=window.panes.UI)&&t.preferences&&t.preferences.get("offlineModeUsingLocalhost")&&"http://"===n.slice(0,7)&&"localhost/"!==n.slice(7,17)&&(n="http://localhost/"+n.slice(7),s.warn("Localhost kludge for offline use: actually getting <"+n+">")),n}},{key:"proxyIfNecessary",value:function(t){var n;if("undefined"!=typeof window&&window.panes&&(n=window.panes.UI)&&n.isExtension)return t;if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.localSiteMap){var r=function e(t,n){var r=n[t.shift()];return r?"string"==typeof r?r+t.join("/"):t?e(t,r):null:null}(t.split("/").slice(2),$SolidTestEnvironment.localSiteMap);if(r)return r}return e.crossSiteProxyTemplate&&"undefined"!=typeof document&&document.location&&"https:"===(""+document.location).slice(0,6)&&"http:"===t.slice(0,5)?e.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):t}},{key:"unsupportedProtocol",value:function(e){var t=p.protocol(e);return"tel"===t||"mailto"===t||"urn"===t}},{key:"withCredentials",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=e.startsWith("https:");return void 0!==t.withCredentials&&(n=t.withCredentials),n}}]),e}();e.exports=S,e.exports.HANDLERS=T,e.exports.CONTENT_TYPE_BY_EXT=y},function(e,t,n){"use strict";var r=n(12),i=n(40),a=n(20),o=n(27),s=n(229),u=function(){var e=function(e){this.flags="",this.base=null,this.prefixes=[],this.namespaces=[],this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.suggestPrefix("xml","reserved:reservedForFutureUse"),this.namespacesUsed=[],this.keywords=["a"],this.prefixchars="abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.incoming=null,this.formulas=[],this.store=e};e.prototype.setBase=function(e){return this.base=e,this},e.prototype.setFlags=function(e){return this.flags=e||"",this},e.prototype.toStr=function(e){var t=e.toNT();return"Graph"===e.termType&&(this.formulas[t]=e),t},e.prototype.fromStr=function(e){if("{"===e[0]){var t=this.formulas[e];return t||console.log("No formula object for "+e),t}return this.store.fromNT(e)},e.prototype.suggestPrefix=function(e,t){"default"===e.slice(0,7)||"ns"===e.slice(0,2)||!e||!t||e in this.namespaces||t in this.prefixes||(this.prefixes[t]=e,this.namespaces[e]=t)},e.prototype.suggestNamespaces=function(e){for(var t in e)return this.suggestPrefix(t,e[t]),this},e.prototype.checkIntegrity=function(){var e,t;for(e in this.namespaces)if(this.prefixes[this.namespaces[e]]!==e)throw new Error("Serializer integity error 1: "+e+", "+this.namespaces[e]+", "+this.prefixes[this.namespaces[e]]+"!");for(t in this.prefixes)if(this.namespaces[this.prefixes[t]]!==t)throw new Error("Serializer integity error 2: "+t+", "+this.prefixs[t]+", "+this.namespaces[this.prefixes[t]]+"!")},e.prototype.makeUpPrefix=function(t){var n=t,r=function(n){return!!e.prototype.validPrefix.test(n)&&"ns"!==n&&!(n in this.namespaces)&&(this.prefixes[t]=n,this.namespaces[n]=t,n)}.bind(this);0<="#/".indexOf(n[n.length-1])&&(n=n.slice(0,-1));var i=n.lastIndexOf("/");0<=i&&(n=n.slice(i+1));for(var a=0;a<n.length&&this.prefixchars.indexOf(n[a]);)a++;if(6>(n=n.slice(0,a)).length&&r(n))return n;if(r(n.slice(0,3)))return n.slice(0,3);if(r(n.slice(0,2)))return n.slice(0,2);if(r(n.slice(0,4)))return n.slice(0,4);if(r(n.slice(0,1)))return n.slice(0,1);if(r(n.slice(0,5)))return n.slice(0,5);e.prototype.validPrefix.test(n)||(n="n");for(var o=0;;o++)if(r(n.slice(0,3)+o))return n.slice(0,3)+o},e.prototype.rootSubjects=function(e){for(var t={},n={},r={},i=0;i<e.length;i++){var a=e[i],o=function(e){t.hasOwnProperty(e)||(t[e]=[]),t[e].push(a.subject)};[a.subject,a.predicate,a.object].map(function(e){"BlankNode"===e.termType?r[e.toNT()]=!0:"Collection"===e.termType&&e.elements.forEach(function(e){o(e)})}),o(e[i].object);var s=n[this.toStr(a.subject)];s||(s=[]),s.push(a),n[this.toStr(a.subject)]=s}var u=[];for(var l in n)if(n.hasOwnProperty(l)){var c=this.fromStr(l);if("BlankNode"!==c.termType||!t[c]||1!==t[c].length){u.push(c);continue}}this.incoming=t;for(var d={},h=0;h<u.length;h++)d[u[h].toNT()]=!0;return{roots:u,subjects:n,rootsHash:d,incoming:t}},e.prototype.toN3=function(e){return this.statementsToN3(e.statements)},e.prototype._notQNameChars="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",e.prototype._notNameChars=e.prototype._notQNameChars+":",e.prototype.explicitURI=function(e){return"<"+(e=0>this.flags.indexOf("r")&&this.base?a.refTo(this.base,e):0<=this.flags.indexOf("u")?function(e){for(var t,n="",r=0;r<e.length;r++)n+=65535<(t=e.charCodeAt(r))?"\\U"+("00000000"+t.toString(16)).slice(-8):126<t?"\\u"+("0000"+t.toString(16)).slice(-4):e[r];return n}(e):function(e){return encodeURI(e)}(e))+">"},e.prototype.statementsToNTriples=function(e){var t=e.slice();t.sort();for(var n="",r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a=this,o=this.store,s=function e(t){if("Collection"!==t.termType)return a.atomicTermToN3(t);for(var s,u=t.elements,l=o.sym(r+"nill"),c=u.length-1;0<=c;c--)s=new i,n+=e(s)+" "+e(o.sym(r+"first"))+" "+e(u[c])+".\n",n+=e(s)+" "+e(o.sym(r+"rest"))+" "+e(l)+".\n",l=s;return a.atomicTermToN3(l)},u=0;u<t.length;u++){var l=t[u],c="";c+=s(l.subject)+" ",c+=s(l.predicate)+" ",c+=s(l.object)+" ",0<=this.flags.indexOf("q")&&(c+=s(l.why)+" "),n+=c+=".\n"}return n},e.prototype.statementsToN3=function(t){function n(e,t){return"BlankNode"!==e.termType||t.incoming[e]?[h(e,t)].concat([c(e,t)]).concat(["."]):d(e,t,!0).concat(["."])}var r=this.store,i={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":"aaa:00"};t.sort(function(e,t){return o.heavyCompareSPO(e,t,r,i)}),this.base&&!this.defaultNamespace&&(this.defaultNamespace=this.base+"#");var a={};0>this.flags.indexOf("s")&&(a["http://www.w3.org/2002/07/owl#sameAs"]="="),0>this.flags.indexOf("t")&&(a["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]="a"),0>this.flags.indexOf("i")&&(a["http://www.w3.org/2000/10/swap/log#implies"]="=>");var s=function(e){for(var t="",n=0;n<e;n++)t+=" ";return t},u=function e(t){for(var n="",r=0;r<t.length;r++){var i=t[r],a="string"==typeof i?i:e(i);if(0!==r){var o=n.slice(-1)||" ";","!==a&&";"!==a&&("."!==a||"0123456789.".includes(o))&&(n+=" ")}n+=a}return n},l=function(e){for(var t,r=this.rootSubjects(e),i=r.roots,a=[],o=0;o<i.length;o++)t=i[o],a.push(n(t,r));return a}.bind(this),c=function(e,t){var n=[],r=null,i=t.subjects[this.toStr(e)]||[];if(void 0===i)throw new Error("Cant find statements for "+e);for(var o,s=[],u=0;u<i.length;u++)(o=i[u]).predicate.uri===r?s.push(","):(r&&(n=n.concat([s]).concat([";"]),s=[]),n.push(a[o.predicate.uri]?a[o.predicate.uri]:h(o.predicate,t))),r=o.predicate.uri,s.push(d(o.object,t));return n=n.concat([s])}.bind(this),d=function(e,t,n){return"BlankNode"!==e.termType||!n&&void 0!==t.rootsHash[e.toNT()]?h(e,t):t.subjects[this.toStr(e)]?["[",c(e,t),"]"]:"[]"}.bind(this);e.prototype.termToN3=h;var h=function(e,t){var n,r;switch(e.termType){case"Graph":return(r=(r=["{"]).concat(l(e.statements))).concat(["}"]);case"Collection":for(r=["("],n=0;n<e.elements.length;n++)r.push([d(e.elements[n],t)]);return r.push(")"),r;default:return this.atomicTermToN3(e)}}.bind(this),f=function(){var e="";for(var t in this.defaultNamespace&&(e+="@prefix : "+this.explicitURI(this.defaultNamespace)+".\n"),this.prefixes)this.prefixes.hasOwnProperty(t)&&this.namespacesUsed[t]&&(e+="@prefix "+this.prefixes[t]+": "+this.explicitURI(t)+".\n");return e+"\n"}.bind(this),p=l(t);return f()+function e(t,n){var r="",i=1e5;void 0===n&&(n=-1);for(var a,o=0;o<t.length;o++){if("string"!=typeof(a=t[o])){var l=e(a,n+1);if(l.length<10*(80-4*n)&&0>l.indexOf('"""')){var c=u(a);c.length<80-4*n&&(a=c,l="")}l&&(i=1e4),r+=l}if("string"==typeof a){if(1===a.length&&"\n"===r.slice(-1)&&0<=",.;".indexOf(a)){r=r.slice(0,-1)+a+"\n",i+=1;continue}if(i<4*n+4||i+a.length+1<80&&0>";.".indexOf(r[r.length-2]))r=r.slice(0,-1)+" "+a+"\n",i+=a.length+1;else{var d=s(4*n)+a;r+=d+"\n",i=d.length,0>n&&(r+="\n",i=1e5)}}}return r}(p)},e.prototype.atomicTermToN3=function(e,t){switch(e.termType){case"BlankNode":case"Variable":return e.toNT();case"Literal":var n=e.value.toString();if(e.datatype&&0>this.flags.indexOf("x"))switch(e.datatype.uri){case"http://www.w3.org/2001/XMLSchema#integer":return n;case"http://www.w3.org/2001/XMLSchema#decimal":return 0>n.indexOf(".")&&(n+=".0"),n;case"http://www.w3.org/2001/XMLSchema#double":return 0>n.indexOf(".")&&(n+=".0"),0>n.indexOf("e")&&(n+="e0"),n;case"http://www.w3.org/2001/XMLSchema#boolean":return e.value?"true":"false"}var r=this.stringToN3(e.value);return e.language?r+="@"+e.language:!e.datatype.equals(s.string)&&(r+="^^"+this.atomicTermToN3(e.datatype,t)),r;case"NamedNode":return this.symbolToN3(e);default:throw new Error("Internal: atomicTermToN3 cannot handle "+e+" of termType: "+e.termType)}},e.prototype.validPrefix=new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/),e.prototype.forbidden1=new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm),e.prototype.forbidden3=new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm),e.prototype.stringToN3=function(t,n){n||(n="e");var r,i,a,o,s,u="";for(20<t.length&&'"'!==t.slice(-1)&&0>n.indexOf("n")&&(0<t.indexOf("\n")||0<t.indexOf('"'))?(o='"""',s=e.prototype.forbidden3):(o='"',s=e.prototype.forbidden1),r=0;r<t.length;){if(s.lastIndex=0,null==s.exec(t.slice(r)))break;i=r+s.lastIndex-1,u+=t.slice(r,i);var l=t[i];'"'===l&&'"""'===o&&'"""'!==t.slice(i,i+3)?u+=l:u+=0<=(a='\b\f\r\t\v\n\\"'.indexOf(l))?"\\"+'bfrtvn\\"'[a]:0<=n.indexOf("e")?"\\u"+("000"+l.charCodeAt(0).toString(16).toLowerCase()).slice(-4):l,r=i+1}return o+u+t.slice(r)+o},e.prototype.symbolToN3=function(t){var n=t.uri,r=n.indexOf("#");if(0>r&&0>this.flags.indexOf("/")&&(r=n.lastIndexOf("/")),0<=r&&0>this.flags.indexOf("p")&&(0===n.indexOf("http")||0===n.indexOf("ws")||0===n.indexOf("file"))){for(var i=!0,a=r+1;a<n.length;a++)if(0<=e.prototype._notNameChars.indexOf(n[a])){i=!1;break}if(i){var o=n.slice(r+1),s=n.slice(0,r+1);if(this.defaultNamespace&&this.defaultNamespace===s&&0>this.flags.indexOf("d"))return 0<=this.flags.indexOf("k")&&0>this.keyords.indexOf(o)?o:":"+o;var u=this.prefixes[s];if(u||(u=this.makeUpPrefix(s)),u)return this.namespacesUsed[s]=!0,u+":"+o}}return this.explicitURI(n)},e.prototype.writeStore=function(e){var t=this.store,n=t.fetcher,r=n&&n.appNode,i=this.store.index[3];for(var a in i){var o=t.fromNT(a);r&&o.sameTerm(r)||e("\n"+this.atomicTermToN3(o)+" "+this.atomicTermToN3(t.sym("http://www.w3.org/2000/10/swap/log#semantics"))+" { "+this.statementsToN3(t.statementsMatching(void 0,void 0,void 0,o))+" }.\n")}t.statementsMatching(void 0,t.sym("http://www.w3.org/2007/ont/link#requestedURI")).map(function(n){e("\n<"+n.object.value+"> log:metadata {\n");var r=t.statementsMatching(void 0,void 0,void 0,n.subject);e(this.statementsToN3(this.statementsToN3(r))),e("}.\n")});var s=[];r&&s.push(r);var u=[];s.map(function(e){u=u.concat(t.statementsMatching(void 0,void 0,void 0,e))}),e(this.statementsToN3(u))},e.prototype.statementsToXML=function(t){function n(e){return void 0===e?"@@@undefined@@@@":e.replace(/[&<"]/g,function(e){switch(e[0]){case"&":return"&amp;";case"<":return"&lt;";case'"':return"&quot;"}})}function i(e,t){for(var n=[],r=0;r<e.elements.length;r++)n.push(f(e.elements[r],t));return n}var a=[];a["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=!0;var u="http://www.w3.org/1999/02/22-rdf-syntax-ns#_",l=function(e){for(var t="",n=0;n<e;n++)t+=" ";return t},c=function e(t){for(var n="",r=0;r<t.length;r++){var i=t[r];n+="string"==typeof i?i:e(i)}return n},d=function(e){this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");for(var t,n=this.rootSubjects(e),r=n.roots,i=[],a=0;a<r.length;a++)t=r[a],i.push(f(t,n));return i}.bind(this),h=function(e){return n(this.base?o.uri.refTo(this.base,e.uri):e.uri)}.bind(this),f=function(e,t){var a,o,l,c,d=[],v=t.subjects[this.toStr(e)];if(void 0===v)return p(e,t);v.sort(function(e,t){var n=e.predicate.uri,r=t.predicate.uri;if(n.substring(0,u.length)===u||r.substring(0,u.length)===u)return n.localeCompare(r);var i=n.substring(u.length),a=r.substring(u.length),o=parseInt(i,10),s=parseInt(a,10);return isNaN(o)||isNaN(s)||o!==i||s!==a?n.localeCompare(r):o-s});for(var g=0;g<v.length;g++)if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"!==(l=v[g]).predicate.uri||a||"symbol"!==l.object.termType){if((c=l.predicate).uri.substr(0,u.length)===u){var b=c.uri.substr(u.length);b===parseInt(b,10).toString()&&(c=new r("http://www.w3.org/1999/02/22-rdf-syntax-ns#li"))}switch(o=m(c),l.object.termType){case"BlankNode":d=1===t.incoming[l.object].length?d.concat(["<"+o+' rdf:parseType="Resource">',f(l.object,t),"</"+o+">"]):d.concat(["<"+o+' rdf:nodeID="'+l.object.toNT().slice(2)+'"/>']);break;case"NamedNode":d=d.concat(["<"+o+' rdf:resource="'+h(l.object)+'"/>']);break;case"Literal":d=d.concat(["<"+o+(l.object.datatype.equals(s.string)?"":' rdf:datatype="'+n(l.object.datatype.uri)+'"')+(l.object.language?' xml:lang="'+l.object.language+'"':"")+">"+n(l.object.value)+"</"+o+">"]);break;case"Collection":d=d.concat(["<"+o+' rdf:parseType="Collection">',i(l.object,t),"</"+o+">"]);break;default:throw new Error("Can't serialize object of type "+l.object.termType+" into XML")}}else a=l.object;var y=a?m(a):"rdf:Description",w="";return"BlankNode"===e.termType?(!t.incoming[e]||1!==t.incoming[e].length)&&(w=' rdf:nodeID="'+e.toNT().slice(2)+'"'):w=' rdf:about="'+h(e)+'"',["<"+y+w+">"].concat([d]).concat(["</"+y+">"])}.bind(this),p=function(e,t){var r=[],a=t.subjects[this.toStr(e)];if(!a)return r;a.sort();for(var o,u=0;u<a.length;u++)switch(o=a[u],o.object.termType){case"BlankNode":r=t.rootsHash[o.object.toNT()]?r.concat(["<"+m(o.predicate)+' rdf:nodeID="'+o.object.toNT().slice(2)+'">',"</"+m(o.predicate)+">"]):r.concat(["<"+m(o.predicate)+' rdf:parseType="Resource">',p(o.object,t),"</"+m(o.predicate)+">"]);break;case"NamedNode":r=r.concat(["<"+m(o.predicate)+' rdf:resource="'+h(o.object)+'"/>']);break;case"Literal":r=r.concat(["<"+m(o.predicate)+(o.object.datatype.equals(s.string)?"":' rdf:datatype="'+n(o.object.datatype.value)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+n(o.object.value)+"</"+m(o.predicate)+">"]);break;case"Collection":r=r.concat(["<"+m(o.predicate)+' rdf:parseType="Collection">',i(o.object,t),"</"+m(o.predicate)+">"]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}return r}.bind(this),m=function(t){var n=t.uri,r=n.indexOf("#");if(0>r&&0>this.flags.indexOf("/")&&(r=n.lastIndexOf("/")),0>r)throw new Error("Cannot make qname out of <"+n+">");for(var i=r+1;i<n.length;i++)if(0<=e.prototype._notNameChars.indexOf(n[i]))throw new Error('Invalid character "'+n[i]+'" cannot be in XML qname for URI: '+n);var o=n.slice(r+1),s=n.slice(0,r+1);if(this.defaultNamespace&&this.defaultNamespace===s&&0>this.flags.indexOf("d"))return o;var u=this.prefixes[s];return u||(u=this.makeUpPrefix(s)),a[s]=!0,u+":"+o}.bind(this),v=d(t),g="<rdf:RDF";for(var b in this.defaultNamespace&&(g+=' xmlns="'+n(this.defaultNamespace)+'"'),a)if(a.hasOwnProperty(b)){var y=this.base&&this.flags.includes("z")?o.uri.refTo(this.base,b):b;g+="\n xmlns:"+this.prefixes[b]+'="'+n(y)+'"'}return function e(t,n){var r,i="",a=1e5;n||(n=0);for(var o,s=0;s<t.length;s++){if("string"!=typeof(o=t[s])){var u=e(o,n+1);u.length<10*(80-4*n)&&0>u.indexOf('"""')&&(r=c(o)).length<80-4*n&&(o=" "+r,u=""),u&&(a=1e4),i+=u}"string"==typeof o&&(a<4*n+4?(i=i.slice(0,-1)+" "+o+"\n",a+=o.length+1):(i+=(r=l(4*n)+o)+"\n",a=r.length))}return i}([g+=">",v,"</rdf:RDF>"],-1)};return function(t){return new e(t)}}();e.exports=u},function(e,t){function n(e,t){if(!(this instanceof n))return new n(e,t);if(e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else{var r="";this._outputStream={write:function(e,t,n){r+=e,n&&n()},end:function(e){e&&e(null,r)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?this._writeTriple=this._writeTripleLine:(this._graph="",this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes))}function r(e){var t=s[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}var i=/^"([^]*)"(?:\^\^(.+)|@([\-a-z]+))?$/i,a=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,o=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,s={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};n.prototype={_write:function(e,t){this._outputStream.write(e,"utf8",t)},_writeTriple:function(e,t,n,r,i){try{this._graph!==r&&(this._write((null===this._subject?"":this._graph?"\n}\n":".\n")+(r?this._encodeIriOrBlankNode(r)+" {\n":"")),this._subject=null,this._graph="["===r[0]?"]":r),this._subject===e?this._predicate===t?this._write(", "+this._encodeObject(n),i):this._write(";\n "+this._encodePredicate(this._predicate=t)+" "+this._encodeObject(n),i):this._write((null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)+" "+this._encodePredicate(this._predicate=t)+" "+this._encodeObject(n),i)}catch(e){i&&i(e)}},_writeTripleLine:function(e,t,n,r,i){delete this._prefixMatch;try{this._write(this._encodeIriOrBlankNode(e)+" "+this._encodeIriOrBlankNode(t)+" "+this._encodeObject(n)+(r?" "+this._encodeIriOrBlankNode(r)+".\n":".\n"),i)}catch(e){i&&i(e)}},_encodeIriOrBlankNode:function(e){var t=e[0];if("["===t||"("===t||"_"===t&&":"===e[1])return e;a.test(e)&&(e=e.replace(o,r));var n=this._prefixRegex.exec(e);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:e:"<"+e+">"},_encodeLiteral:function(e,t,n){return a.test(e)&&(e=e.replace(o,r)),n?'"'+e+'"@'+n:t?'"'+e+'"^^'+this._encodeIriOrBlankNode(t):'"'+e+'"'},_encodeSubject:function(e){if('"'===e[0])throw new Error("A literal as subject is not allowed: "+e);return"["===e[0]&&(this._subject="]"),this._encodeIriOrBlankNode(e)},_encodePredicate:function(e){if('"'===e[0])throw new Error("A literal as predicate is not allowed: "+e);return"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===e?"a":this._encodeIriOrBlankNode(e)},_encodeObject:function(e){if('"'!==e[0])return this._encodeIriOrBlankNode(e);var t=i.exec(e);if(!t)throw new Error("Invalid literal: "+e);return this._encodeLiteral(t[1],t[2],t[3])},_blockedWrite:function(){throw new Error("Cannot write because the writer has been closed.")},addTriple:function(e,t,n,r,i){void 0===n?this._writeTriple(e.subject,e.predicate,e.object,e.graph||"",t):"string"==typeof r?this._writeTriple(e,t,n,r,i):this._writeTriple(e,t,n,"",r)},addTriples:function(e){for(var t=0;t<e.length;t++)this.addTriple(e[t])},addPrefix:function(e,t,n){var r={};r[e]=t,this.addPrefixes(r,n)},addPrefixes:function(e,t){var n=this._prefixIRIs,r=!1;for(var i in e){var a=e[i];/[#\/]$/.test(a)&&n[a]!==(i+=":")&&(r=!0,n[a]=i,null!==this._subject&&(this._write(this._graph?"\n}\n":".\n"),this._subject=null,this._graph=""),this._write("@prefix "+i+" <"+a+">.\n"))}if(r){var o="",s="";for(var u in n)o+=o?"|"+u:u,s+=(s?"|":"")+n[u];o=o.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp("^(?:"+s+")[^/]*$|^("+o+")([a-zA-Z][\\-_a-zA-Z0-9]*)$")}this._write(r?"\n":"",t)},blank:function(e,t){var n,r,i=e;switch(void 0===e?i=[]:"string"==typeof e?i=[{predicate:e,object:t}]:!("length"in e)&&(i=[e]),r=i.length){case 0:return"[]";case 1:if("["!==(n=i[0]).object[0])return"[ "+this._encodePredicate(n.predicate)+" "+this._encodeObject(n.object)+" ]";default:for(var a="[",o=0;o<r;o++)(n=i[o]).predicate===e?a+=", "+this._encodeObject(n.object):(a+=(o?";\n ":"\n ")+this._encodePredicate(n.predicate)+" "+this._encodeObject(n.object),e=n.predicate);return a+"\n]"}},list:function(e){for(var t=e&&e.length||0,n=Array(t),r=0;r<t;r++)n[r]=this._encodeObject(e[r]);return"("+n.join(" ")+")"},_prefixRegex:/$0^/,end:function(e){null!==this._subject&&(this._write(this._graph?"\n}\n":".\n"),this._subject=null),this._write=this._blockedWrite;var t=e&&function(n,r){t=null,e(n,r)};if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t()}},e.exports=n},function(e,t,n){(function(e,r){function i(e,n){var r={seen:[],stylize:o};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),h(n)?r.showHidden=n:n&&t._extend(r,n),v(r.showHidden)&&(r.showHidden=!1),v(r.depth)&&(r.depth=2),v(r.colors)&&(r.colors=!1),v(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),s(r,e,r.depth)}function a(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function o(e,t){return e}function s(e,n,r){if(e.customInspect&&n&&_(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return m(i)||(i=s(e,i,r)),i}var a=u(e,n);if(a)return a;var o=Object.keys(n),h=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),w(n)&&(0<=o.indexOf("message")||0<=o.indexOf("description")))return l(n);if(0===o.length){if(_(n)){var f=n.name?": "+n.name:"";return e.stylize("[Function"+f+"]","special")}if(g(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(y(n))return e.stylize(Date.prototype.toString.call(n),"date");if(w(n))return l(n)}var p,v="",b=!1,x=["{","}"];(d(n)&&(b=!0,x=["[","]"]),_(n))&&(v=" [Function"+(n.name?": "+n.name:"")+"]");return g(n)&&(v=" "+RegExp.prototype.toString.call(n)),y(n)&&(v=" "+Date.prototype.toUTCString.call(n)),w(n)&&(v=" "+l(n)),0!==o.length||b&&0!=n.length?0>r?g(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),p=b?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o<s;++o)k(t,o+"")?a.push(c(e,t,n,r,o+"",!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(c(e,t,n,r,i,!0))}),a}(e,n,r,h,o):o.map(function(t){return c(e,n,r,h,t,b)}),e.seen.pop(),function(e,t,n){return 60<e.reduce(function(e,t){return 0,0<=t.indexOf("\n")&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(p,v,x)):x[0]+v+x[1]}function u(e,t){if(v(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return p(t)?e.stylize(""+t,"number"):h(t)?e.stylize(""+t,"boolean"):f(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,n,r,i,a){var o,u,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?u=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(u=e.stylize("[Setter]","special")),k(r,i)||(o="["+i+"]"),u||(0>e.seen.indexOf(l.value)?-1<(u=f(n)?s(e,l.value,null):s(e,l.value,n-1)).indexOf("\n")&&(u=a?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n")):u=e.stylize("[Circular]","special")),v(o)){if(a&&i.match(/^\d+$/))return u;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+u}function d(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function f(e){return null===e}function p(e){return"number"==typeof e}function m(e){return"string"==typeof e}function v(e){return void 0===e}function g(e){return b(e)&&"[object RegExp]"===x(e)}function b(e){return"object"==typeof e&&null!==e}function y(e){return b(e)&&"[object Date]"===x(e)}function w(e){return b(e)&&("[object Error]"===x(e)||e instanceof Error)}function _(e){return"function"==typeof e}function x(e){return Object.prototype.toString.call(e)}function M(e){return 10>e?"0"+e.toString(10):e.toString(10)}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var C=/%[sdj%]/g;t.format=function(e){if(!m(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,a=r.length,o=(e+"").replace(C,function(e){if("%%"===e)return"%";if(n>=a)return e;switch(e){case"%s":return r[n++]+"";case"%d":return+r[n++];case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n<a;s=r[++n])o+=f(s)||!b(s)?" "+s:" "+i(s);return o},t.deprecate=function(n,i){if(v(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(!0===r.noDeprecation)return n;var a=!1;return function(){if(!a){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return n.apply(this,arguments)}};var E,A={};t.debuglog=function(e){if(v(E)&&(E=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!A[e])if(new RegExp("\\b"+e+"\\b","i").test(E)){var n=r.pid;A[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else A[e]=function(){};return A[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=h,t.isNull=f,t.isNullOrUndefined=function(e){return null==e},t.isNumber=p,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=v,t.isRegExp=g,t.isObject=b,t.isDate=y,t.isError=w,t.isFunction=_,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(465);var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[M(e.getHours()),M(e.getMinutes()),M(e.getSeconds())].join(":");return[e.getDate(),T[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=n(464),t._extend=function(e,t){if(!t||!b(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,n(5),n(11))},function(e,t,n){"use strict";function r(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(h.isEncoding===f||!f(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=o,this.end=s,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=l,t=3;break;default:return this.write=c,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=h.allocUnsafe(t)}function i(e){return 127>=e?0:6==e>>5?2:14==e>>4?3:30==e>>3?4:2==e>>6?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(1<e.lastNeed&&1<t.length){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(2<e.lastNeed&&2<t.length&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0===n?this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length)):n}function o(e,t){if(0==(e.length-t)%2){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(55296<=r&&56319>=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function u(e,t){var n=(e.length-t)%3;return 0==n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1==n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function c(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}var h=n(3).Buffer,f=h.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var a=i(t[r]);return 0<=a?(0<a&&(e.lastNeed=a-1),a):--r<n||-2===a?0:0<=(a=i(t[r]))?(0<a&&(e.lastNeed=a-2),a):--r<n||-2===a?0:0<=(a=i(t[r]))?(0<a&&(2===a?a=0:e.lastNeed=a-3),a):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},r.prototype.fillLast=function(e){return this.lastNeed<=e.length?(e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),void(this.lastNeed-=e.length))}},function(e,t,n){"use strict";(function(t,r,i){function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}function o(){}function s(e,t){g=g||n(38),e=e||{};var r=t instanceof g;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,o=e.writableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:s,this.highWaterMark=_Mathfloor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(v.nextTick(i,r),v.nextTick(m,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),m(e,t))}(e,n,r,t,i);else{var a=f(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||h(e,n),r?b(d,e,n,a,i):d(e,n,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function u(e){return g=g||n(38),w.call(u,this)||this instanceof g?(this._writableState=new s(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),void x.call(this)):new u(e)}function l(e,t,n,r,i,a){if(!n){var o=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=M.from(t,n)),t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else c(e,t,!1,s,r,i,a);return u}function c(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function d(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),m(e,t)}function h(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=Array(r),o=t.corkedRequestsFree;o.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,c(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,d=n.encoding,h=n.callback;if(c(e,t,!1,t.objectMode?1:l.length,l,d,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function f(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function p(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),m(e,t)})}function m(e,t){var n=f(t);return n&&(function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,v.nextTick(p,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}var v=n(87);e.exports=u;var g,b=!t.browser&&-1<["v0.10","v0.9."].indexOf(t.version.slice(0,5))?r:v.nextTick;u.WritableState=s;var y=n(63);y.inherits=n(1);var w,_={deprecate:n(471)},x=n(219),M=n(3).Buffer,k=i.Uint8Array||function(){},C=n(218);y.inherits(u,x),s.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(s.prototype,"buffer",{get:_.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(w=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function(e){return!!w.call(this,e)||!(this!==u)&&e&&e._writableState instanceof s}})):w=function(e){return e instanceof this},u.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},u.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&function(e){return M.isBuffer(e)||e instanceof k}(e);return a&&!M.isBuffer(e)&&(e=function(e){return M.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":!t&&(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),v.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"!=typeof n&&void 0!==n&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),v.nextTick(r,a),i=!1),i}(this,r,e,n))&&(r.pendingcb++,i=l(this,r,a,e,t,n)),i},u.prototype.cork=function(){this._writableState.corked++},u.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.finished&&!e.bufferProcessing&&e.bufferedRequest&&h(this,e))},u.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),u.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},u.prototype._writev=null,u.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,m(e,t),n&&(t.finished?v.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),u.prototype.destroy=C.destroy,u.prototype._undestroy=C.undestroy,u.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(11),n(65).setImmediate,n(5))},function(e,t,n){(t=e.exports=n(221)).Stream=t,t.Readable=t,t.Writable=n(128),t.Duplex=n(38),t.Transform=n(217),t.PassThrough=n(470)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(a(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),o=(l=n.slice()).length,u=0;u<o;u++)l[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var o;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&((o=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&0<o&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,a,o,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,a=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=o;0<s--;)if(n[s]===t||n[s].listener&&n[s].listener===t){a=s;break}if(0>a)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(a,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){function n(e,t){for(var n in i)t?e.prototype[n]=r(i[n]):e[n]=i[n];return e}function r(e){return function(t){return e(this,t)}}var i={isIRI:function(e){if(!e)return e;var t=e[0];return'"'!==t&&"_"!==t},isLiteral:function(e){return e&&'"'===e[0]},isBlank:function(e){return e&&"_:"===e.substr(0,2)},getLiteralValue:function(e){var t=/^"([^]*)"/.exec(e);if(!t)throw new Error(e+" is not a literal");return t[1]},getLiteralType:function(e){var t=/^"[^]*"(?:\^\^([^"]+)|(@)[^@"]+)?$/.exec(e);if(!t)throw new Error(e+" is not a literal");return t[1]||(t[2]?"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString":"http://www.w3.org/2001/XMLSchema#string")},getLiteralLanguage:function(e){var t=/^"[^]*"(?:@([^@"]+)|\^\^[^"]+)?$/.exec(e);if(!t)throw new Error(e+" is not a literal");return t[1]?t[1].toLowerCase():""},isPrefixedName:function(e){return e&&/^[^:\/"']*:[^:\/"']+$/.test(e)},expandPrefixedName:function(e,t){var n,r,i,a=/(?:^|"\^\^)([^:\/#"'\^_]*):[^\/]*$/.exec(e);return a&&(r=t[n=a[1]],i=a.index),void 0===r?e:0===i?r+e.substr(n.length+1):e.substr(0,i+3)+r+e.substr(i+n.length+4)},createIRI:function(e){return e&&'"'===e[0]?i.getLiteralValue(e):e},createLiteral:function(e,t){if(!t)switch(typeof e){case"boolean":t="http://www.w3.org/2001/XMLSchema#boolean";break;case"number":if(isFinite(e)){t=0==e%1?"http://www.w3.org/2001/XMLSchema#integer":"http://www.w3.org/2001/XMLSchema#decimal";break}default:return'"'+e+'"'}return'"'+e+(/^[a-z]+(-[a-z0-9]+)*$/i.test(t)?'"@'+t.toLowerCase():'"^^'+t)}};e.exports=n(n)},function(e,t,n){function r(e){if(!(this instanceof r))return new r(e);this._tripleStack=[],this._graph=null,e=e||{},this._setBase(e.documentIRI);var t="string"==typeof e.format&&e.format.match(/\w*$/)[0].toLowerCase(),n="turtle"===t,o="trig"===t,s=/triple/.test(t),u=/quad/.test(t),l=s||u;(this._supportsNamedGraphs=!n)||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||o||s),l&&(this._base="",this._resolveIRI=function(e){return this._error("Disallowed relative IRI",e),this._callback=i,this._subject=null}),this._blankNodePrefix="string"==typeof e.blankNodePrefix?"_:"+e.blankNodePrefix.replace(/^_:/,""):"",this._lexer=e.lexer||new a({lineMode:l})}function i(){}var a=n(133),o="http://www.w3.org/1999/02/22-rdf-syntax-ns#",s=o+"nil",u=o+"first",l=/^[a-z][a-z0-9+.-]*:/i,c=/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i,d=/(?:^|\/)\.\.?(?:$|[\/#?])/,h=0,f=0;r._resetBlankNodeIds=function(){h=f=0},r.prototype={_setBase:function(e){if(e){if(0<=e.indexOf("#"))throw new Error("Invalid base IRI "+e)}else e=null;(this._base=e)&&(this._basePath=e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(c),this._baseRoot=e[0],this._baseScheme=e[1])},_readInTopContext:function(e){switch(e.type){case"eof":return null===this._graph?(delete this._prefixes._,this._callback(null,null,this._prefixes)):this._error("Unclosed graph",e);case"@prefix":return this._sparqlStyle=!1,this._readPrefix;case"PREFIX":return this._sparqlStyle=!0,this._readPrefix;case"@base":return this._sparqlStyle=!1,this._readBaseIRI;case"BASE":return this._sparqlStyle=!0,this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}},_readSubject:function(e){switch(this._predicate=null,e.type){case"IRI":this._subject=null===this._base||l.test(e.value)?e.value:this._resolveIRI(e);break;case"prefixed":var t=this._prefixes[e.prefix];if(void 0===t)return this._error('Undefined prefix "'+e.prefix+':"',e);this._subject=t+e.value;break;case"[":return this._subject="_:b"+f++,this._tripleStack.push({subject:this._subject,predicate:null,object:null,type:"blank"}),this._readBlankNodeHead;case"(":return this._tripleStack.push({subject:s,predicate:null,object:null,type:"list"}),this._subject=null,this._readListItem;case"}":return this._readPunctuation(e);default:return this._error("Expected subject but got "+e.type,e)}return this._readPredicateOrNamedGraph},_readPredicate:function(e){var t=e.type;switch(t){case"IRI":case"abbreviation":this._predicate=null===this._base||l.test(e.value)?e.value:this._resolveIRI(e);break;case"prefixed":if("_"===e.prefix)return this._error("Disallowed blank node as predicate",e);var n=this._prefixes[e.prefix];if(void 0===n)return this._error('Undefined prefix "'+e.prefix+':"',e);this._predicate=n+e.value;break;case".":case"]":case"}":return null===this._predicate?this._error("Unexpected "+t,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._readPredicate;default:return this._error('Expected predicate to follow "'+this._subject+'"',e)}return this._readObject},_readObject:function(e){switch(e.type){case"IRI":this._object=null===this._base||l.test(e.value)?e.value:this._resolveIRI(e);break;case"prefixed":var t=this._prefixes[e.prefix];if(void 0===t)return this._error('Undefined prefix "'+e.prefix+':"',e);this._object=t+e.value;break;case"literal":return this._object=e.value,this._readDataTypeOrLang;case"[":var n="_:b"+f++;return this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:n,type:"blank"}),this._subject=n,this._readBlankNodeHead;case"(":return this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:s,type:"list"}),this._subject=null,this._readListItem;default:return this._error('Expected object to follow "'+this._predicate+'"',e)}return this._getTripleEndReader()},_readPredicateOrNamedGraph:function(e){return"{"===e.type?this._readGraph(e):this._readPredicate(e)},_readGraph:function(e){return"{"===e.type?(this._graph=this._subject,this._subject=null,this._readSubject):this._error("Expected graph but got "+e.type,e)},_readBlankNodeHead:function(e){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))},_readBlankNodeTail:function(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""});var t=this._tripleStack.pop();return this._subject=t.subject,null===t.object?null===this._predicate?this._readPredicateOrNamedGraph:this._readPredicate:(this._predicate=t.predicate,this._object=t.object,this._getTripleEndReader())},_readDataTypeOrLang:function(e){switch(e.type){case"type":var t;if(""===e.prefix)t=null===this._base||l.test(e.value)?e.value:this._resolveIRI(e);else{var n=this._prefixes[e.prefix];if(void 0===n)return this._error('Undefined prefix "'+e.prefix+':"',e);t=n+e.value}return this._object+="^^"+t,this._getTripleEndReader();case"langcode":return this._object+="@"+e.value.toLowerCase(),this._getTripleEndReader();default:return this._getTripleEndReader().call(this,e)}},_readListItem:function(e){var t=null,n=null,r=this._subject,i=this._tripleStack,a=i[i.length-1],o=this._readListItem;switch(e.type){case"IRI":t=null===this._base||l.test(e.value)?e.value:this._resolveIRI(e);break;case"prefixed":var c=this._prefixes[e.prefix];if(void 0===c)return this._error('Undefined prefix "'+e.prefix+':"',e);t=c+e.value;break;case"literal":t=e.value,o=this._readDataTypeOrLang;break;case"[":n="_:b"+f++,t="_:b"+f++,i.push({subject:n,predicate:u,object:t,type:"blank"}),this._subject=t,o=this._readBlankNodeHead;break;case"(":n="_:b"+f++,i.push({subject:n,predicate:u,object:s,type:"list"}),this._subject=null,o=this._readListItem;break;case")":if(i.pop(),0!==i.length&&"list"===i[i.length-1].type&&this._callback(null,{subject:a.subject,predicate:a.predicate,object:a.object,graph:this._graph||""}),this._subject=a.subject,null===a.predicate){if(o=this._readPredicate,a.subject===s)return o}else if(this._predicate=a.predicate,this._object=a.object,o=this._getTripleEndReader(),a.object===s)return o;n=s;break;default:return this._error('Expected list item instead of "'+e.type+'"',e)}return null===n&&(this._subject=n="_:b"+f++),null===r?a.object===s?a.object=n:a.subject=n:this._callback(null,{subject:r,predicate:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",object:n,graph:this._graph||""}),null!==t&&this._callback(null,{subject:n,predicate:u,object:t,graph:this._graph||""}),o},_readPunctuation:function(e){var t,n=this._subject,r=this._graph;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);this._graph=null;case".":this._subject=null,t=this._readInTopContext;break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"IRI":if(this._supportsQuads&&null===this._graph){r=null===this._base||l.test(e.value)?e.value:this._resolveIRI(e),n=this._subject,t=this._readQuadPunctuation;break}case"prefixed":if(this._supportsQuads&&null===this._graph){var i=this._prefixes[e.prefix];if(void 0===i)return this._error('Undefined prefix "'+e.prefix+':"',e);r=i+e.value,t=this._readQuadPunctuation;break}default:return this._error('Expected punctuation to follow "'+this._object+'"',e)}return null!==n&&this._callback(null,{subject:n,predicate:this._predicate,object:this._object,graph:r||""}),t},_readBlankNodePunctuation:function(e){var t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error('Expected punctuation to follow "'+this._object+'"',e)}return this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""}),t},_readQuadPunctuation:function(e){return"."===e.type?this._readInTopContext:this._error("Expected dot to follow quad",e)},_readPrefix:function(e){return"prefix"===e.type?(this._prefix=e.value,this._readPrefixIRI):this._error("Expected prefix to follow @prefix",e)},_readPrefixIRI:function(e){return"IRI"!==e.type?this._error('Expected IRI to follow prefix "'+this._prefix+':"',e):(t=null===this._base||l.test(e.value)?e.value:this._resolveIRI(e),this._prefixes[this._prefix]=t,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation);var t},_readBaseIRI:function(e){if("IRI"!==e.type)return this._error("Expected IRI to follow base declaration",e);try{this._setBase(null===this._base||l.test(e.value)?e.value:this._resolveIRI(e))}catch(t){this._error(t.message,e)}return this._readDeclarationPunctuation},_readNamedGraphLabel:function(e){switch(e.type){case"IRI":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}},_readNamedGraphBlankLabel:function(e){return"]"===e.type?(this._subject="_:b"+f++,this._readGraph):this._error("Invalid graph label",e)},_readDeclarationPunctuation:function(e){return this._sparqlStyle?this._readInTopContext(e):"."===e.type?this._readInTopContext:this._error("Expected declaration to end with a dot",e)},_getTripleEndReader:function(){var e=this._tripleStack;if(0===e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem}},_error:function(e,t){this._callback(new Error(e+" at line "+t.line+"."))},_resolveIRI:function(e){var t=e.value;switch(t[0]){case void 0:return this._base;case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return this._removeDotSegments(this._basePath+t)}},_removeDotSegments:function(e){if(!d.test(e))return e;for(var t="",n=e.length,r=-1,i=-1,a=0,o="/";r<n;){switch(o){case":":if(0>i&&"/"===e[++r]&&"/"===e[++r])for(;(i=r+1)<n&&"/"!==e[i];)r=i;break;case"?":case"#":r=n;break;case"/":if("."===e[r+1])switch(o=e[++r+1],o){case"/":t+=e.substring(a,r-1),a=r+1;break;case void 0:case"?":case"#":return t+e.substring(a,r)+e.substr(r+1);case".":if(void 0===(o=e[++r+1])||"/"===o||"?"===o||"#"===o){if((a=(t+=e.substring(a,r-2)).lastIndexOf("/"))>=i&&(t=t.substr(0,a)),"/"!==o)return t+"/"+e.substr(r+1);a=r+1}}}o=e[++r]}return t+e.substring(a)},parse:function(e,t,n){this._readCallback=this._readInTopContext,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix||"_:b"+h+++"_","function"==typeof e&&(n=t,t=e,e=null),this._callback=t||i,this._prefixCallback=n||i;var r=this;this._lexer.tokenize(e,function(e,t){null===e?void 0!==r._readCallback&&(r._readCallback=r._readCallback(t)):(r._callback(e),r._callback=i)}),e||(this.addChunk=this._lexer.addChunk,this.end=this._lexer.end)}},e.exports=r},function(e,t,n){(function(t){function n(e){if(!(this instanceof n))return new n(e);if(e&&e.lineMode){this._tripleQuotedString=this._number=this._boolean=/$0^/;var t=this;this._tokenize=this.tokenize,this.tokenize=function(e,n){this._tokenize(e,function(e,r){!e&&/^(?:IRI|prefixed|literal|langcode|type|\.|eof)$/.test(r.type)?n&&n(e,r):n&&n(e||t._syntaxError(r.type,n=null))})}}}var r=_StringfromCharCode,i="function"==typeof t?t:function(e){setTimeout(e,0)},a=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\[uU]|\\(.)/g,o={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},s=/[\x00-\x20<>\\"\{\}\|\^\`]/;n.prototype={_iri:/^<((?:[^>\\]|\\[uU])+)>/,_unescapedIri:/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>/,_unescapedString:/^"[^"\\]+"(?=[^"\\])/,_singleQuotedString:/^"[^"\\]*(?:\\.[^"\\]*)*"(?=[^"\\])|^'[^'\\]*(?:\\.[^'\\]*)*'(?=[^'\\])/,_tripleQuotedString:/^""("[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*")""|^''('[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*')''/,_langcode:/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,_prefix:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,_prefixed:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=\.?[,;\s#()\[\]\{\}"'<])/,_blank:/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=\.?[,;:\s#()\[\]\{\}"'<])/,_number:/^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d*\.?\d+)(?=[.,;:\s#()\[\]\{\}"'<])/,_boolean:/^(?:true|false)(?=[.,;:\s#()\[\]\{\}"'<])/,_keyword:/^@[a-z]+(?=[\s#<:])/,_sparqlKeyword:/^(?:PREFIX|BASE|GRAPH)(?=[\s#<:])/i,_shortPredicates:/^a(?=\s+|<)/,_newline:/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,_whitespace:/^[ \t]+/,_endOfFile:/^(?:#[^\n\r]*)?$/,_tokenizeToEnd:function(e,t){function n(t){e(t._syntaxError(/^\S*/.exec(r)[0]))}for(var r=this._input;;){for(var i;i=this._newline.exec(r);)r=r.substr(i[0].length,r.length),this._line++;if((i=this._whitespace.exec(r))&&(r=r.substr(i[0].length,r.length)),this._endOfFile.test(r))return t&&e(r=null,{line:this._line,type:"eof",value:"",prefix:""}),this._input=r;var a,o=this._line,u="",l="",c="",d=r[0],h=null,f=0,p=!1;switch(d){case"^":if(1===r.length)break;if("^"!==r[1])return n(this);if(this._prevTokenType="^","<"!==(r=r.substr(2))[0]){p=!0;break}case"<":if(h=this._unescapedIri.exec(r))u="IRI",l=h[1];else if(h=this._iri.exec(r)){if(null===(a=this._unescape(h[1]))||s.test(a))return n(this);u="IRI",l=a}break;case"_":((h=this._blank.exec(r))||t&&(h=this._blank.exec(r+" ")))&&(u="prefixed",c="_",l=h[1]);break;case'"':case"'":if(h=this._unescapedString.exec(r))u="literal",l=h[0];else if(h=this._singleQuotedString.exec(r)){if(null===(a=this._unescape(h[0])))return n(this);u="literal",l=a.replace(/^'|'$/g,'"')}else if(h=this._tripleQuotedString.exec(r)){if(a=h[1]||h[2],this._line+=a.split(/\r\n|\r|\n/).length-1,null===(a=this._unescape(a)))return n(this);u="literal",l=a.replace(/^'|'$/g,'"')}break;case"@":"literal"===this._prevTokenType&&(h=this._langcode.exec(r))?(u="langcode",l=h[1]):(h=this._keyword.exec(r))&&(u=h[0]);break;case".":if(1===r.length?t:"0">r[1]||"9"<r[1]){u=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(h=this._number.exec(r))&&(u="literal",l='"'+h[0]+'"^^http://www.w3.org/2001/XMLSchema#'+(h[1]?"double":/^[+\-]?\d+$/.test(h[0])?"integer":"decimal"));break;case"B":case"b":case"p":case"P":case"G":case"g":(h=this._sparqlKeyword.exec(r))?u=h[0].toUpperCase():p=!0;break;case"f":case"t":(h=this._boolean.exec(r))?(u="literal",l='"'+h[0]+'"^^http://www.w3.org/2001/XMLSchema#boolean'):p=!0;break;case"a":(h=this._shortPredicates.exec(r))?(u="abbreviation",l="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):p=!0;break;case",":case";":case"[":case"]":case"(":case")":case"{":case"}":f=1,u=d;break;default:p=!0}if(p&&("@prefix"!==this._prevTokenType&&"PREFIX"!==this._prevTokenType||!(h=this._prefix.exec(r))?((h=this._prefixed.exec(r))||t&&(h=this._prefixed.exec(r+" ")))&&(u="prefixed",c=h[1]||"",l=this._unescape(h[2])):(u="prefix",l=h[1]||"")),"^"===this._prevTokenType&&(u="IRI"===u||"prefixed"===u?"type":""),!u)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?n(this):this._input=r;e(null,{line:o,type:u,value:l,prefix:c}),this._prevTokenType=u,r=r.substr(f||h[0].length,r.length)}},_unescape:function(e){try{return e.replace(a,function(e,t,n,i){var a;if(t){if(a=parseInt(t,16),isNaN(a))throw new Error;return r(a)}if(n){if(a=parseInt(n,16),isNaN(a))throw new Error;return 65535>=a?r(a):r(55296+(a-=65536)/1024,56320+(1023&a))}var s=o[i];if(!s)throw new Error;return s})}catch(e){return null}},_syntaxError:function(e){return this._input=null,new Error('Syntax error: unexpected "'+e+'" on line '+this._line+".")},tokenize:function(e,t){function n(e){null!==a._input&&(a._input+=e,a._tokenizeToEnd(t,!1))}function r(){null!==a._input&&a._tokenizeToEnd(t,!0)}var a=this;this._line=1,"string"==typeof e?(this._input=e,i(function(){a._tokenizeToEnd(t,!0)})):(this._input="",e&&"function"!=typeof e?("function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",n),e.on("end",r)):(this.addChunk=n,this.end=r,!t&&(t=e)))}},e.exports=n}).call(this,n(65).setImmediate)},function(e,t,n){"use strict";e.exports=function(e,t,n,a,o,s){function u(e,t){return o?void o(e,t):t}n=n||e.uri,s=s||{},a=a||"text/turtle";try{var l=i(t);s.flags&&l.setFlags(s.flags);var c,d=t.statementsMatching(void 0,void 0,void 0,e);switch(l.suggestNamespaces(t.namespaces),l.setBase(n),a){case"application/rdf+xml":return u(null,l.statementsToXML(d));case"text/n3":case"application/n3":return u(null,l.statementsToN3(d));case"text/turtle":case"application/x-turtle":return l.setFlags("si"),u(null,l.statementsToN3(d));case"application/n-triples":return l.setFlags("deinprstux"),u(null,l.statementsToNTriples(d));case"application/ld+json":l.setFlags("deinprstux"),c=l.statementsToNTriples(d),r.convertToJson(c,o);break;case"application/n-quads":case"application/nquads":return l.setFlags("deinprstux q"),u(null,l.statementsToNTriples(d));default:throw new Error("Serialize: Content-type "+a+" not supported for data write.")}}catch(e){if(o)return o(e);throw e}};var r=n(227),i=n(124)},function(e,t,n){"use strict";e.exports={authEndpoint:"",fallbackAuthEndpoint:"https://databox.me/",signupEndpoint:"https://solid.github.io/solid-idps/",signupWindowHeight:600,signupWindowWidth:1024,key:"",cert:""}},function(e,t,n){"use strict";var r=n(91);e.exports={makeDropTarget:function(e,t,n){var r=function(e){e.preventDefault(),e.dataTransfer.dropEffect="copy"},i=function(e){console.log("dragenter event dropEffect: "+e.dataTransfer.dropEffect),this.style.backgroundColor="#ccc",e.dataTransfer.dropEffect="link",console.log("dragenter event dropEffect 2: "+e.dataTransfer.dropEffect)},a=function(e){console.log("dragleave event dropEffect: "+e.dataTransfer.dropEffect),this.style.backgroundColor="white"},o=function(e){e.preventDefault&&e.preventDefault(),console.log("Drop event. dropEffect: "+e.dataTransfer.dropEffect),console.log("Drop event. types: "+(e.dataTransfer.types?e.dataTransfer.types.join(", "):"NOPE"));var r,i=null;if(e.dataTransfer.types){for(var a,o=0;o<e.dataTransfer.types.length;o++)if("text/uri-list"===(a=e.dataTransfer.types[o]))i=e.dataTransfer.getData(a).split("\n"),console.log("Dropped text/uri-list: "+i);else if("text/plain"===a)r=e.dataTransfer.getData(a);else if("Files"===a&&n){for(var s,u=e.dataTransfer.files,l=0;u[l];l++)s=u[l],console.log("Filename: "+s.name+", type: "+(s.type||"n/a")+" size: "+s.size+" bytes, last modified: "+(s.lastModifiedDate?s.lastModifiedDate.toLocaleDateString():"n/a"));n(u)}null===i&&r&&"http"===r.slice(0,4)&&(i=r,console.log("Waring: Poor man's drop: using text for URI"))}else i=[e.dataTransfer.getData("Text")],console.log("WARNING non-standard drop event: "+i[0]);return console.log("Dropped URI list (2): "+i),i&&t(i),this.style.backgroundColor="white",!1};!function(e){e||console.log("@@@ addTargetListeners: ele "+e),e.addEventListener("dragover",r),e.addEventListener("dragenter",i),e.addEventListener("dragleave",a),e.addEventListener("drop",o)}(e)},makeDraggable:function(e,t){e.setAttribute("draggable","true"),e.addEventListener("dragstart",function(n){e.style.fontWeight="bold",n.dataTransfer.setData("text/uri-list",t.uri),n.dataTransfer.setData("text/plain",t.uri),n.dataTransfer.setData("text/html",e.outerHTML),console.log("Dragstart: "+e+" -> "+t+"de: "+n.dataTransfer.dropEffect)},!1),e.addEventListener("drag",function(e){e.preventDefault(),e.stopPropagation()},!1),e.addEventListener("dragend",function(n){e.style.fontWeight="normal",console.log("Dragend dropeffect: "+n.dataTransfer.dropEffect),console.log("Dragend: "+e+" -> "+t)},!1)},uploadFiles:function(e,t,n,i,a){for(var o,s=0;t[s];s++){o=t[s],console.log(" dropped: Filename: "+o.name+", type: "+(o.type||"n/a")+" size: "+o.size+" bytes, last modified: "+(o.lastModifiedDate?o.lastModifiedDate.toLocaleDateString():"n/a"));var u=new FileReader;u.onload=function(t){return function(o){var s=o.target.result;console.log(" File read byteLength : "+s.byteLength);var u=(t.type.startsWith("image/")&&i||n)+"/"+encodeURIComponent(t.name),l=r.extension(t.type);t.type!==r.lookup(t.name)&&(u+="_."+l,console.log("MIME TYPE MISMATCH -- adding extension: "+u)),e.webOperation("PUT",u,{data:s,contentType:t.type}).then(function(e){console.log(" Upload: put OK: "+u),a(t,u)},function(e){console.log(" Upload: FAIL "+u+", Error: "+e)})}}(o),u.readAsArrayBuffer(o)}}}},function(e,t,n){(function(t){var r=n(92);e.exports=function(e,n){return new t(e.toRed(r.mont(n.modulus)).redPow(new r(n.publicExponent)).fromRed().toArray())}}).call(this,n(2).Buffer)},function(e,t){e.exports=function(e,t){for(var n=e.length,r=-1;++r<n;)e[r]^=t[r];return e}},function(e,t,n){(function(t){function r(e){var n=new t(4);return n.writeUInt32BE(e,0),n}var i=n(54);e.exports=function(e,n){for(var a,o=new t(""),s=0;o.length<n;)a=r(s++),o=t.concat([o,i("sha1").update(e).update(a).digest()]);return o.slice(0,n)}}).call(this,n(2).Buffer)},function(e){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},function(e,t,n){function r(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new i,this.tree._init(e.body)}function i(e){c.Node.call(this,"der",e)}function a(e){return 10>e?"0"+e:e}function o(e,t,n,r){var i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),d.tagByName.hasOwnProperty(e))i=d.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return 31<=i?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=d.tagClassByName[n||"universal"]<<6)}var s=n(1),u=n(2).Buffer,l=n(51),c=l.base,d=l.constants.der;e.exports=r,r.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},s(i,c.Node),i.prototype._encodeComposite=function(e,t,n,r){var i,a=o(e,t,n,this.reporter);if(128>r.length)return(i=new u(2))[0]=a,i[1]=r.length,this._createEncoderBuffer([i,r]);for(var s=1,l=r.length;256<=l;l>>=8)s++;(i=new u(2+s))[0]=a,i[1]=128|s;l=1+s;for(var c=r.length;0<c;l--,c>>=8)i[l]=255&c;return this._createEncoderBuffer([i,r])},i.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var n=new u(2*e.length),r=0;r<e.length;r++)n.writeUInt16BE(e.charCodeAt(r),2*r);return this._createEncoderBuffer(n)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},i.prototype._encodeObjid=function(e,t,n){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var r=0;r<e.length;r++)e[r]|=0}else if(Array.isArray(e)){e=e.slice();for(r=0;r<e.length;r++)e[r]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(40<=e[1])return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var i=0;for(r=0;r<e.length;r++)for(a=e[r],i++;128<=a;a>>=7)i++;var a,o=new u(i),s=o.length-1;for(r=e.length-1;0<=r;r--)for(a=e[r],o[s--]=127&a;0<(a>>=7);)o[s--]=128|127&a;return this._createEncoderBuffer(o)},i.prototype._encodeTime=function(e,t){var n,r=new Date(e);return"gentime"===t?n=[a(r.getFullYear()),a(r.getUTCMonth()+1),a(r.getUTCDate()),a(r.getUTCHours()),a(r.getUTCMinutes()),a(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[a(r.getFullYear()%100),a(r.getUTCMonth()+1),a(r.getUTCDate()),a(r.getUTCHours()),a(r.getUTCMinutes()),a(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!u.isBuffer(e)){var n=e.toArray();!e.sign&&128&n[0]&&n.unshift(0),e=new u(n)}if(u.isBuffer(e)){var r=e.length;0===e.length&&r++;var i=new u(r);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(128>e)return this._createEncoderBuffer(e);if(256>e)return this._createEncoderBuffer([0,e]);r=1;for(var a=e;256<=a;a>>=8)r++;for(a=(i=Array(r)).length-1;0<=a;a--)i[a]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new u(i))},i.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},i.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},i.prototype._skipDefault=function(e,t,n){var r,i=this._baseState;if(null===i.default)return!1;var a=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,n).join()),a.length!==i.defaultBuffer.length)return!1;for(r=0;r<a.length;r++)if(a[r]!==i.defaultBuffer[r])return!1;return!0}},function(e,t,n){function r(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new i,this.tree._init(e.body)}function i(e){l.Node.call(this,"der",e)}function a(e,t){var n=e.readUInt8(t);if(e.isError(n))return n;var r=d.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){var a=n;for(n=0;128==(128&a);){if(a=e.readUInt8(t),e.isError(a))return a;n<<=7,n|=127&a}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:d.tag[n]}}function o(e,t,n){var r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;var i=127&r;if(4<i)return e.error("length octect is too long");r=0;for(var a=0;a<i;a++){r<<=8;var o=e.readUInt8(n);if(e.isError(o))return o;r|=o}return r}var s=n(1),u=n(51),l=u.base,c=u.bignum,d=u.constants.der;e.exports=r,r.prototype.decode=function(e,t){return e instanceof l.DecoderBuffer||(e=new l.DecoderBuffer(e,t)),this.tree._decode(e,t)},s(i,l.Node),i.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;var r=e.save(),i=a(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||n)},i.prototype._decodeTag=function(e,t,n){var r=a(e,'Failed to decode tag of "'+t+'"');if(e.isError(r))return r;var i=o(e,r.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(r.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');var s=e.save(),u=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(u)?u:(i=e.offset-s.offset,e.restore(s),e.skip(i,'Failed to match body of: "'+t+'"'))},i.prototype._skipUntilEnd=function(e,t){for(;;){var n=a(e,t);if(e.isError(n))return n;var r,i=o(e,n.primitive,t);if(e.isError(i))return i;if(r=n.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(r))return r;if("end"===n.tagStr)break}},i.prototype._decodeList=function(e,t,n,r){for(var i=[];!e.isEmpty();){var a=this._peekTag(e,"end");if(e.isError(a))return a;var o=n.decode(e,"der",r);if(e.isError(o)&&a)break;i.push(o)}return i},i.prototype._decodeStr=function(e,t){if("bitstr"===t){var n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}if("bmpstr"===t){var r=e.raw();if(1==r.length%2)return e.error("Decoding of string type: bmpstr length mismatch");for(var i="",a=0;a<r.length/2;a++)i+=_StringfromCharCode(r.readUInt16BE(2*a));return i}if("numstr"===t){var o=e.raw().toString("ascii");return this._isNumstr(o)?o:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var s=e.raw().toString("ascii");return this._isPrintstr(s)?s:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},i.prototype._decodeObjid=function(e,t,n){for(var r,i,a=[],o=0;!e.isEmpty();)o<<=7,o|=127&(i=e.readUInt8()),0==(128&i)&&(a.push(o),o=0);128&i&&a.push(o);var s=0|a[0]/40,u=a[0]%40;if(r=n?a:[s,u].concat(a.slice(1)),t){var l=t[r.join(" ")];void 0===l&&(l=t[r.join(".")]),void 0!==l&&(r=l)}return r},i.prototype._decodeTime=function(e,t){var n=e.raw().toString();if("gentime"===t)var r=0|n.slice(0,4),i=0|n.slice(4,6),a=0|n.slice(6,8),o=0|n.slice(8,10),s=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),a=0|n.slice(4,6),o=0|n.slice(6,8),s=0|n.slice(8,10),u=0|n.slice(10,12);r=70>r?2e3+r:1900+r}return Date.UTC(r,i-1,a,o,s,u,0)},i.prototype._decodeNull=function(e){return null},i.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},i.prototype._decodeInt=function(e,t){var n=e.raw(),r=new c(n);return t&&(r=t[r.toString(10)]||r),r},i.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},function(e,t,n){var r=t;r._reverse=function(e){var t={};return Object.keys(e).forEach(function(n){(0|n)==n&&(n|=0);var r=e[n];t[r]=n}),t},r.der=n(308)},function(e,t,n){function r(e,t){return o.call(this,t),s.isBuffer(e)?(this.base=e,this.offset=0,void(this.length=e.length)):void this.error("Input not Buffer")}function i(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof i||(e=new i(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&255>=e))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=s.byteLength(e);else{if(!s.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}var a=n(1),o=n(50).Reporter,s=n(2).Buffer;a(r,o),t.DecoderBuffer=r,r.prototype.save=function(){return{offset:this.offset,reporter:o.prototype.save.call(this)}},r.prototype.restore=function(e){var t=new r(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,o.prototype.restore.call(this,e.reporter),t},r.prototype.isEmpty=function(){return this.offset===this.length},r.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},r.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var n=new r(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},r.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=i,i.prototype.join=function(e,t){return e||(e=new s(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):s.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(317).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t,n){"use strict";function r(){return this instanceof r?(I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=N,void(this.W=Array(160))):new r}function i(e,t,n,r,i){var a=e&n^~e&i;return 0>a&&(a+=4294967296),a}function a(e,t,n,r,i,a){var o=t&r^~t&a;return 0>o&&(o+=4294967296),o}function o(e,t,n,r,i){var a=e&n^e&i^n&i;return 0>a&&(a+=4294967296),a}function s(e,t,n,r,i,a){var o=t&r^t&a^r&a;return 0>o&&(o+=4294967296),o}function u(e,t){var n=y(e,t,28)^y(t,e,2)^y(t,e,7);return 0>n&&(n+=4294967296),n}function l(e,t){var n=w(e,t,28)^w(t,e,2)^w(t,e,7);return 0>n&&(n+=4294967296),n}function c(e,t){var n=y(e,t,14)^y(e,t,18)^y(t,e,9);return 0>n&&(n+=4294967296),n}function d(e,t){var n=w(e,t,14)^w(e,t,18)^w(t,e,9);return 0>n&&(n+=4294967296),n}function h(e,t){var n=y(e,t,1)^y(e,t,8)^_(e,t,7);return 0>n&&(n+=4294967296),n}function f(e,t){var n=w(e,t,1)^w(e,t,8)^x(e,t,7);return 0>n&&(n+=4294967296),n}function p(e,t){var n=y(e,t,19)^y(t,e,29)^_(e,t,6);return 0>n&&(n+=4294967296),n}function m(e,t){var n=w(e,t,19)^w(t,e,29)^x(e,t,6);return 0>n&&(n+=4294967296),n}var v=n(24),g=n(52),b=n(13),y=v.rotr64_hi,w=v.rotr64_lo,_=v.shr64_hi,x=v.shr64_lo,M=v.sum64,k=v.sum64_hi,C=v.sum64_lo,E=v.sum64_4_hi,A=v.sum64_4_lo,T=v.sum64_5_hi,S=v.sum64_5_lo,I=g.BlockHash,N=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];v.inherits(r,I),e.exports=r,r.blockSize=1024,r.outSize=512,r.hmacStrength=192,r.padLength=128,r.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;32>r;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=p(n[r-4],n[r-3]),a=m(n[r-4],n[r-3]),o=n[r-14],s=n[r-13],u=h(n[r-30],n[r-29]),l=f(n[r-30],n[r-29]),c=n[r-32],d=n[r-31];n[r]=E(i,a,o,s,u,l,c,d),n[r+1]=A(i,a,o,s,u,l,c,d)}},r.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],h=this.h[1],f=this.h[2],p=this.h[3],m=this.h[4],v=this.h[5],g=this.h[6],y=this.h[7],w=this.h[8],_=this.h[9],x=this.h[10],E=this.h[11],A=this.h[12],I=this.h[13],N=this.h[14],j=this.h[15];b(this.k.length===n.length);for(var O=0;O<n.length;O+=2){var R=N,L=j,P=c(w,_),D=d(w,_),B=i(w,0,x,0,A),U=a(0,_,0,E,0,I),q=this.k[O],F=this.k[O+1],z=n[O],H=n[O+1],W=T(R,L,P,D,B,U,q,F,z,H),V=S(R,L,P,D,B,U,q,F,z,H);R=u(r,h),L=l(r,h),P=o(r,0,f,0,m),D=s(0,h,0,p,0,v);var J=k(R,L,P,D),G=C(R,L,P,D);N=A,j=I,A=x,I=E,x=w,E=_,w=k(g,y,W,V),_=C(y,y,W,V),g=m,y=v,m=f,v=p,f=r,p=h,r=k(W,V,J,G),h=C(W,V,J,G)}M(this.h,0,r,h),M(this.h,2,f,p),M(this.h,4,m,v),M(this.h,6,g,y),M(this.h,8,w,_),M(this.h,10,x,E),M(this.h,12,A,I),M(this.h,14,N,j)},r.prototype._digest=function(e){return"hex"===e?v.toHex32(this.h,"big"):v.split32(this.h,"big")}},function(e,t,n){"use strict";function r(){return this instanceof r?(g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,void(this.W=Array(64))):new r}var i=n(24),a=n(52),o=n(148),s=n(13),u=i.sum32,l=i.sum32_4,c=i.sum32_5,d=o.ch32,h=o.maj32,f=o.s0_256,p=o.s1_256,m=o.g0_256,v=o.g1_256,g=a.BlockHash,b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];i.inherits(r,g),e.exports=r,r.blockSize=512,r.outSize=256,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(e,t){for(var n=this.W,r=0;16>r;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=l(v(n[r-2]),n[r-7],m(n[r-15]),n[r-16]);var i=this.h[0],a=this.h[1],o=this.h[2],g=this.h[3],b=this.h[4],y=this.h[5],w=this.h[6],_=this.h[7];for(s(this.k.length===n.length),r=0;r<n.length;r++){var x=c(_,p(b),d(b,y,w),this.k[r],n[r]),M=u(f(i),h(i,a,o));_=w,w=y,y=b,b=u(g,x),g=o,o=a,a=i,i=u(x,M)}this.h[0]=u(this.h[0],i),this.h[1]=u(this.h[1],a),this.h[2]=u(this.h[2],o),this.h[3]=u(this.h[3],g),this.h[4]=u(this.h[4],b),this.h[5]=u(this.h[5],y),this.h[6]=u(this.h[6],w),this.h[7]=u(this.h[7],_)},r.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,n){"use strict";function r(e,t,n){return e&t^~e&n}function i(e,t,n){return e&t^e&n^t&n}function a(e,t,n){return e^t^n}var o=n(24).rotr32;t.ft_1=function(e,t,n,o){return 0===e?r(t,n,o):1===e||3===e?a(t,n,o):2===e?i(t,n,o):void 0},t.ch32=r,t.maj32=i,t.p32=a,t.s0_256=function(e){return o(e,2)^o(e,13)^o(e,22)},t.s1_256=function(e){return o(e,6)^o(e,11)^o(e,25)},t.g0_256=function(e){return o(e,7)^o(e,18)^e>>>3},t.g1_256=function(e){return o(e,17)^o(e,19)^e>>>10}},function(e,t,n){"use strict";function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}var a=t;a.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for(0!=(e=e.replace(/[^a-z0-9]+/gi,"")).length%2&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),a=i>>8,o=255&i;a?n.push(a,o):n.push(o)}return n},a.zero2=r,a.toHex=i,a.encode=function(e,t){return"hex"===t?i(e):e}},function(e,t,n){function r(e){this.rand=e}var i;if(e.exports=function(e){return i||(i=new r(null)),i.generate(e)},e.exports.Rand=r,r.prototype.generate=function(e){return this._rand(e)},r.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(r.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=n(346);if("function"!=typeof a.randomBytes)throw new Error("Not supported");r.prototype._rand=function(e){return a.randomBytes(e)}}catch(t){}},function(e,t,n){function r(e){this.rand=e||new a.Rand}var i=n(348),a=n(150);e.exports=r,r.create=function(e){return new r(e)},r.prototype._randbelow=function(e){var t=e.bitLength(),n=_Mathceil(t/8);do{var r=new i(this.rand.generate(n))}while(0<=r.cmp(e));return r},r.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},r.prototype.test=function(e,t,n){var r=e.bitLength(),a=i.mont(e),o=new i(1).toRed(a);t||(t=_Mathmax(1,0|r/48));for(var s=e.subn(1),u=0;!s.testn(u);u++);for(var l=e.shrn(u),c=s.toRed(a);0<t;t--){var d=this._randrange(new i(2),s);n&&n(d);var h=d.toRed(a).redPow(l);if(0!==h.cmp(o)&&0!==h.cmp(c)){for(var f=1;f<u;f++){if(0===(h=h.redSqr()).cmp(o))return!1;if(0===h.cmp(c))break}if(f===u)return!1}}return!0},r.prototype.getDivisor=function(e,t){var n=e.bitLength(),r=i.mont(e),a=new i(1).toRed(r);t||(t=_Mathmax(1,0|n/48));for(var o=e.subn(1),s=0;!o.testn(s);s++);for(var u=e.shrn(s),l=o.toRed(r);0<t;t--){var c=this._randrange(new i(2),o),d=e.gcd(c);if(0!==d.cmpn(1))return d;var h=c.toRed(r).redPow(u);if(0!==h.cmp(a)&&0!==h.cmp(l)){for(var f=1;f<s;f++){if(0===(h=h.redSqr()).cmp(a))return h.fromRed().subn(1).gcd(e);if(0===h.cmp(l))break}if(f===s)return(h=h.redSqr()).fromRed().subn(1).gcd(e)}}return!1}},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(349).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t,n){function r(e){for(var t=function(){if(null!=g)return g;var e=[];e[0]=2;for(var t,n=1,r=3;r<1048576;r+=2){t=_Mathceil(Math.sqrt(r));for(var i=0;i<n&&e[i]<=t&&0!=r%e[i];i++);n!==i&&e[i]<=t||(e[n++]=r)}return g=e,e}(),n=0;n<t.length;n++)if(0===e.modn(t[n]))return 0===e.cmpn(t[n]);return!0}function i(e){var t=s.mont(e);return 0===d.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)}function a(e,t){if(16>e)return new s(2===t||5===t?[140,123]:[140,39]);t=new s(t);for(var n,a;;){for(n=new s(o(_Mathceil(e/8)));n.bitLength()>e;)n.ishrn(1);if(n.isEven()&&n.iadd(c),n.testn(1)||n.iadd(d),t.cmp(d)){if(!t.cmp(h))for(;n.mod(f).cmp(p);)n.iadd(v)}else for(;n.mod(u).cmp(m);)n.iadd(v);if(r(a=n.shrn(1))&&r(n)&&i(a)&&i(n)&&l.test(a)&&l.test(n))return n}}var o=n(44);e.exports=a,a.simpleSieve=r,a.fermatTest=i;var s=n(152),u=new s(24),l=new(n(151)),c=new s(1),d=new s(2),h=new s(5),f=(new s(16),new s(8),new s(10)),p=new s(3),m=(new s(7),new s(11)),v=new s(4),g=(new s(12),null)},function(e,t,n){function r(e,t,n,r){o.call(this),this._cipher=new i.AES(t),this._prev=a.from(n),this._cache=a.allocUnsafe(0),this._secCache=a.allocUnsafe(0),this._decrypt=r,this._mode=e}var i=n(70),a=n(3).Buffer,o=n(28);n(1)(r,o),r.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},r.prototype._final=function(){this._cipher.scrub()},e.exports=r},function(e,t,n){function r(e,t,n,r){o.call(this);var s=a.alloc(4,0);this._cipher=new i.AES(t);var l=this._cipher.encryptBlock(s);this._ghash=new u(l),n=function(e,t,n){if(12===t.length)return e._finID=a.concat([t,a.from([0,0,0,1])]),a.concat([t,a.from([0,0,0,2])]);var r=new u(n),i=t.length,o=i%16;r.update(t),o&&(o=16-o,r.update(a.alloc(o,0))),r.update(a.alloc(8,0));var s=8*i,l=a.alloc(8);l.writeUIntBE(s,0,8),r.update(l),e._finID=r.state;var d=a.from(e._finID);return c(d),d}(this,n,l),this._prev=a.from(n),this._cache=a.allocUnsafe(0),this._secCache=a.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}var i=n(70),a=n(3).Buffer,o=n(28),s=n(1),u=n(353),l=n(53),c=n(157);s(r,o),r.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;16>t&&(t=a.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},r.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=l(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=_Mathmin(e.length,t.length),i=0;i<r;++i)n+=e[i]^t[i];return n}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},r.prototype.getAuthTag=function(){if(this._decrypt||!a.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},r.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},r.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=r},function(e){e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},function(e,t){e.exports=function(e){for(var t,n=e.length;n--;){if(255!==(t=e.readUInt8(n))){t++,e.writeUInt8(t,n);break}e.writeUInt8(0,n)}}},function(e,t,n){function r(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}var i=n(53),a=n(3).Buffer,o=n(157);t.encrypt=function(e,t){var n=_Mathceil(t.length/16),o=e._cache.length;e._cache=a.concat([e._cache,a.allocUnsafe(16*n)]);for(var s=0;s<n;s++){var u=r(e),l=o+16*s;e._cache.writeUInt32BE(u[0],l+0),e._cache.writeUInt32BE(u[1],l+4),e._cache.writeUInt32BE(u[2],l+8),e._cache.writeUInt32BE(u[3],l+12)}var c=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,c)}},function(e,t,n){function r(e,t,n){var r=i(e),a="sha512"===e||"sha384"===e?128:64;t.length>a?t=r(t):t.length<a&&(t=c.concat([t,d],a));for(var o=c.allocUnsafe(a+h[e]),s=c.allocUnsafe(a+h[e]),u=0;u<a;u++)o[u]=54^t[u],s[u]=92^t[u];var l=c.allocUnsafe(a+n+4);o.copy(l,0,0,a),this.ipad1=l,this.ipad2=o,this.opad=s,this.alg=e,this.blocksize=a,this.hash=r,this.size=h[e]}function i(e){return"rmd160"===e||"ripemd160"===e?o:"md5"===e?a:function(t){return s(e).update(t).digest()}}var a=n(164),o=n(99),s=n(98),u=n(161),l=n(160),c=n(3).Buffer,d=c.alloc(128),h={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};r.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},e.exports=function(e,t,n,i,a){u(e,t,n,i),c.isBuffer(e)||(e=c.from(e,l)),c.isBuffer(t)||(t=c.from(t,l));var o=new r(a=a||"sha1",e,t.length),s=c.allocUnsafe(i),d=c.allocUnsafe(t.length+4);t.copy(d,0,0,t.length);for(var f=0,p=h[a],m=_Mathceil(i/p),v=1;v<=m;v++){d.writeUInt32BE(v,t.length);for(var g=o.run(d,o.ipad1),b=g,y=1;y<n;y++){b=o.run(b,o.ipad2);for(var w=0;w<p;w++)g[w]^=b[w]}g.copy(s,f),f+=p}return s}},function(e,t,n){(function(t){var n;t.browser?n="utf-8":n=6<=parseInt(t.version.split(".")[0].slice(1),10)?"utf-8":"binary";e.exports=n}).call(this,n(11))},function(e,t,n){(function(t){function n(e,n){if("string"!=typeof e&&!t.isBuffer(e))throw new TypeError(n+" must be a buffer or string")}e.exports=function(e,t,r,i){if(n(e,"Password"),n(t,"Salt"),"number"!=typeof r)throw new TypeError("Iterations not a number");if(0>r)throw new TypeError("Bad iterations");if("number"!=typeof i)throw new TypeError("Key length not a number");if(0>i||i>1073741823||i!=i)throw new TypeError("Bad key length")}}).call(this,n(2).Buffer)},function(e,t,n){t.pbkdf2=n(368),t.pbkdf2Sync=n(159)},function(e){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},function(e,t,n){var r=n(100);e.exports=function(e){return(new r).update(e).digest()}},function(e,t,n){"use strict";function r(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var n="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>n)?t=("rmd160"===e?new l:c(e)).update(t).digest():t.length<n&&(t=s.concat([t,d],n));for(var r=this._ipad=s.allocUnsafe(n),i=this._opad=s.allocUnsafe(n),a=0;a<n;a++)r[a]=54^t[a],i[a]=92^t[a];this._hash="rmd160"===e?new l:c(e),this._hash.update(r)}var i=n(1),a=n(370),o=n(28),s=n(3).Buffer,u=n(164),l=n(99),c=n(98),d=s.alloc(128);i(r,o),r.prototype._update=function(e){this._hash.update(e)},r.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new l:c(this._alg)).update(this._opad).update(e).digest()},e.exports=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new r("rmd160",t):"md5"===e?new a(u,t):new r(e,t)}},function(e,t,n){function r(){this.init(),this._w=g,p.call(this,128,112)}function i(e,t,n){return n^e&(t^n)}function a(e,t,n){return e&t|n&(e|t)}function o(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function s(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function u(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function c(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function d(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function h(e,t){return e>>>0<t>>>0?1:0}var f=n(1),p=n(43),m=n(3).Buffer,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],g=Array(160);f(r,p),r.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,f=0|this._ch,p=0|this._dh,m=0|this._eh,g=0|this._fh,b=0|this._gh,y=0|this._hh,w=0|this._al,_=0|this._bl,x=0|this._cl,M=0|this._dl,k=0|this._el,C=0|this._fl,E=0|this._gl,A=0|this._hl,T=0;32>T;T+=2)t[T]=e.readInt32BE(4*T),t[T+1]=e.readInt32BE(4*T+4);for(;160>T;T+=2){var S=t[T-30],I=t[T-30+1],N=u(S,I),j=l(I,S),O=c(S=t[T-4],I=t[T-4+1]),R=d(I,S),L=t[T-14],P=t[T-14+1],D=t[T-32],B=t[T-32+1],U=0|j+P,q=0|N+L+h(U,j);q=0|(q=0|q+O+h(U=0|U+R,R))+D+h(U=0|U+B,B),t[T]=q,t[T+1]=U}for(var F=0;160>F;F+=2){q=t[F],U=t[F+1];var z=a(n,r,f),H=a(w,_,x),W=o(n,w),V=o(w,n),J=s(m,k),G=s(k,m),K=v[F],$=v[F+1],X=i(m,g,b),Z=i(k,C,E),Y=0|A+G,Q=0|y+J+h(Y,A);Q=0|(Q=0|(Q=0|Q+X+h(Y=0|Y+Z,Z))+K+h(Y=0|Y+$,$))+q+h(Y=0|Y+U,U);var ee=0|V+H,te=0|W+z+h(ee,V);y=b,A=E,b=g,E=C,g=m,C=k,m=0|p+Q+h(k=0|M+Y,M),p=f,M=x,f=r,x=_,r=n,_=w,n=0|Q+te+h(w=0|Y+ee,Y)}this._al=0|this._al+w,this._bl=0|this._bl+_,this._cl=0|this._cl+x,this._dl=0|this._dl+M,this._el=0|this._el+k,this._fl=0|this._fl+C,this._gl=0|this._gl+E,this._hl=0|this._hl+A,this._ah=0|this._ah+n+h(this._al,w),this._bh=0|this._bh+r+h(this._bl,_),this._ch=0|this._ch+f+h(this._cl,x),this._dh=0|this._dh+p+h(this._dl,M),this._eh=0|this._eh+m+h(this._el,k),this._fh=0|this._fh+g+h(this._fl,C),this._gh=0|this._gh+b+h(this._gl,E),this._hh=0|this._hh+y+h(this._hl,A)},r.prototype._hash=function(){function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}var t=m.allocUnsafe(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=r},function(e,t,n){function r(){this.init(),this._w=p,d.call(this,64,56)}function i(e,t,n){return n^e&(t^n)}function a(e,t,n){return e&t|n&(e|t)}function o(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function s(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function u(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function l(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=n(1),d=n(43),h=n(3).Buffer,f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],p=Array(64);c(r,d),r.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,c=0|this._c,d=0|this._d,h=0|this._e,p=0|this._f,m=0|this._g,v=0|this._h,g=0;16>g;++g)t[g]=e.readInt32BE(4*g);for(;64>g;++g)t[g]=0|l(t[g-2])+t[g-7]+u(t[g-15])+t[g-16];for(var b=0;64>b;++b){var y=0|v+s(h)+i(h,p,m)+f[b]+t[b],w=0|o(n)+a(n,r,c);v=m,m=p,p=h,h=0|d+y,d=c,c=r,r=n,n=0|y+w}this._a=0|n+this._a,this._b=0|r+this._b,this._c=0|c+this._c,this._d=0|d+this._d,this._e=0|h+this._e,this._f=0|p+this._f,this._g=0|m+this._g,this._h=0|v+this._h},r.prototype._hash=function(){var e=h.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=r},function(e,t,n){"use strict";function r(e){a.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var i=n(3).Buffer,a=n(64).Transform;n(1)(r,a),r.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},r.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},r.prototype.update=function(e,t){if(function(e,t){if(!i.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");i.isBuffer(e)||(e=i.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var a=this._blockOffset;a<this._blockSize;)n[a++]=e[r++];this._update(),this._blockOffset=0}for(;r<e.length;)n[this._blockOffset++]=e[r++];for(var o=0,s=8*e.length;0<s;++o)this._length[o]+=s,0<(s=0|this._length[o]/4294967296)&&(this._length[o]-=4294967296*s);return this},r.prototype._update=function(){throw new Error("_update is not implemented")},r.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;4>n;++n)this._length[n]=0;return t},r.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=r},function(e,t,n){"use strict";var r={acl:e.exports={},icons:n(16),log:n(15),ns:n(6),store:n(8),widgets:n(14)},i=n(21),a=r.store;r.acl.adoptACLDefault=function(e,t,n,i){var a=r.store,o=r.ns.acl,s="/"===e.uri.slice(-1),u=[];a.each(void 0,o("defaultForNew"),n,i).map(function(t){(u=u.concat(a.statementsMatching(t,o("agent"),void 0,i)).concat(a.statementsMatching(t,o("agentClass"),void 0,i)).concat(a.statementsMatching(t,o("agentGroup"),void 0,i)).concat(a.statementsMatching(t,o("origin"),void 0,i)).concat(a.statementsMatching(t,o("originClass"),void 0,i)).concat(a.statementsMatching(t,o("mode"),void 0,i))).push($rdf.st(t,o("accessTo"),e,i)),s&&u.push($rdf.st(t,o("defaultForNew"),e,i))});var l=$rdf.graph();return u.map(function(e){var n=function(e){var n=i.uri.length;return $rdf.sym(e.uri.slice(0,n)===i.uri?t.uri+e.uri.slice(n):e.uri)};l.add(n(e.subject),n(e.predicate),n(e.object),$rdf.sym(t.uri))}),l},r.acl.readACL=function(e,t,n,i){n=n||r.store;var a=r.ns,o=i?a.acl("defaultForNew"):a.acl("accessTo"),s=r.ns.acl,u={agent:[],agentClass:[],agentGroup:[],origin:[],originClass:[]},l=n.each(void 0,o,e);for(var c in{agent:!0,agentClass:!0,agentGroup:!0,origin:!0,originClass:!0})l.map(function(e){n.each(e,s("mode")).map(function(t){n.each(e,s(c)).map(function(n){u[c][n.uri]||(u[c][n.uri]=[]),u[c][n.uri][t.uri]=e})})});return u},r.acl.sameACL=function(e,t){var n=function(e,t){for(var n in{agent:!0,agentClass:!0,agentGroup:!0,origin:!0,originClass:!0})if(e[n])for(var r in e[n])for(var i in e[n][r])if(!t[n][r]||!t[n][r][i])return!1;return!0};return n(e,t)&&n(t,e)},r.acl.ACLunion=function(e){for(var t,n,r=e[0],i=1;i<e.length;i++)["agent","agentClass","agentGroup","origin","originClass"].map(function(a){if((t=e[i])[a])for(n in t[a])for(var o in t[a][n])r[a][n]||(r[a][n]=[]),r[a][n][o]=!0});return r},r.acl.loadUnionACL=function(e,t){var n=[];!function e(i){if(i.length){var a=i.shift().doc();r.acl.getACLorDefault(a,function(a,o,s,u,l,c){var d=!o;return a?(n.push(d?r.widgets.readACL(l,c):r.widgets.readACL(s,u)),void e(i.slice(1))):t(a,u)})}else t(!0,r.widgets.ACLunion(n))}(e)},r.acl.ACLbyCombination=function(e){var t=[];return["agent","agentClass","agentGroup","origin","originClass"].map(function(n){for(var r in e[n]){var i=[];for(var a in e[n][r])i.push(a);i.sort(),i=i.join("\n"),t[i]||(t[i]=[]),t[i].push([n,r])}}),t},r.acl.makeACLGraph=function(e,t,n,i){var a=r.acl.ACLbyCombination(n);return r.acl.makeACLGraphbyCombo(e,t,a,i)},r.acl.makeACLGraphbyCombo=function(e,t,n,i,a,o){var s=r.ns.acl;for(var u in n){var l=u.split("\n"),c=l.map(function(e){return e.split("#")[1]}).join("");o&&!a&&(c+="Default");var d=e.sym(i.uri+"#"+c);e.add(d,r.ns.rdf("type"),s("Authorization"),i),a&&e.add(d,s("accessTo"),t,i),o&&e.add(d,s("defaultForNew"),t,i);for(var h=0;h<l.length;h++)e.add(d,s("mode"),e.sym(l[h]),i);var f=n[u];for(h=0;h<f.length;h++){var p=f[h][0],m=f[h][1];e.add(d,s(p),e.sym(m),i)}}},r.acl.ACLToString=function(e){return r.widgets.comboToString(r.widgets.ACLbyCombination(e))},r.acl.comboToString=function(e){var t="";for(var n in e){t+=n.split("\n").map(function(e){return e.split("#")[1][0]}).join("")+":";for(var a=e[n],o=0;o<a.length;o++){var s=a[o][0],u=$rdf.sym(a[o][1]);t+="agent"===s?"@":"",t+=u.sameTerm(r.ns.foaf("Agent"))?"*":i.label(u),o<a.length-1&&(t+=",")}t+=";"}return"{"+t.slice(0,-1)+"}"},r.acl.makeACLString=function(e,t,n){var i=$rdf.graph();return r.widgets.makeACLGraph(i,e,t,n),$rdf.serialize(n,i,n.uri,"text/turtle")},r.acl.putACLObject=function(e,t,n,i,a){var o=r.widgets.ACLbyCombination(n);return r.widgets.putACLbyCombo(e,t,o,i,a)},r.acl.putACLbyCombo=function(e,t,n,i,a){var o=$rdf.graph();r.widgets.makeACLGraphbyCombo(o,t,n,i,!0),e.updater.put(i,o.statementsMatching(void 0,void 0,void 0,i),"text/turtle",function(o,s,u){s?(e.fetcher.unload(i),r.widgets.makeACLGraphbyCombo(e,t,n,i,!0),e.fetcher.requested[i.uri]="done",a(s)):a(s,u)})},r.acl.fixIndividualCardACL=function(e,t,n){var i=r.store.each(void 0,r.ns.vcard("hasMember"),e);i?r.widgets.fixIndividualACL(e,i,t,n):(t("This card is in no groups"),n(!0))},r.acl.fixIndividualACL=function(e,t,n,a){n=n||console.log;var o=e.doc();r.acl.getACLorDefault(o,function(s,u,l,c,d,h){if(!s)return a(!1,c);var f=u?r.widgets.readACL(l,c):r.widgets.readACL(d,h);r.widgets.loadUnionACL(t,function(t,s){return t?void(r.widgets.sameACL(s,f)?n("Nice - same ACL. no change "+i.label(e)+" "+o):(n("Group ACLs differ for "+i.label(e)+" "+o),r.widgets.putACLObject(r.store,l,s,c,a))):a(!1,s)})})},r.acl.setACL=function(e,t,n){var r=a.any(a.sym(e),a.sym("http://www.iana.org/assignments/link-relations/acl"));r?a.fetcher.webOperation("PUT",r.uri,{data:t,contentType:"text/turtle"}).then(n):a.fetcher.nowOrWhenFetched(e,void 0,function(r,i){if(!r)return n(r,"Gettting headers for ACL: "+i);var o=a.any(a.sym(e),a.sym("http://www.iana.org/assignments/link-relations/acl"));o?a.fetcher.webOperation("PUT",o.uri,{data:t,contentType:"text/turtle"}).then(n):n(!1,"No Link rel=ACL header for "+e)})},r.acl.getACLorDefault=function(e,t){r.acl.getACL(e,function(n,i,a,o){var s=r.store,u=r.ns.acl;if(!n)return t(!1,!1,i,o);return n?404===i?void function n(i){"/"===i.slice(-1)&&(i=i.slice(0,-1));var o=i.lastIndexOf("/"),l=i.indexOf("/",i.indexOf("//")+2);i=i.slice(0,o+1);var c=$rdf.sym(i);r.acl.getACL(c,function(r,d,h){if(!r)return t(!1,!0,d,"( No ACL pointer "+i+" "+d+")"+h);if(403===d)return t(!1,!0,d,"( default ACL file FORBIDDEN. Stop."+i+")");if(404===d){if(l>=o)return t(!1,!0,499,"Nothing to hold a default");n(i)}else{if(200!==d)return t(!1,!0,d,"Error status '"+d+"' searching for default for "+c);if(s.each(void 0,u("defaultForNew"),s.sym(i),h).length){var f=s.sym(i);t(!0,!1,e,a,f,h)}else n(i)}})}(e.uri):403===i?t(!1,!1,i,"(Sharing not available to you)"+o):200===i?t(!0,!0,e,a):t(!1,!1,i,"Error "+i+" accessing Access Control information for "+e+": "+o):t(!1,!1,i,"Error accessing Access Control information for "+e+") "+o)})},r.acl.getACL=function(e,t){r.store.fetcher.nowOrWhenFetched(e,void 0,function(n,i){if(!n)return t(n,"Can't get headers to find ACL for "+e+": "+i);var a=r.store,o=a.any(e,a.sym("http://www.iana.org/assignments/link-relations/acl"));if(o){if(r.store.fetcher.nonexistent[o.uri])return t(!0,404,o,"ACL file "+o+" does not exist.");r.store.fetcher.nowOrWhenFetched(o,void 0,function(e,n,r){e?t(!0,200,o):t(!0,r.status,o,"Can't read Access Control File "+o+": "+n)})}else t(!1,900,"No Link rel=ACL header for "+e)})}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(83).namedNode,o=function(){function e(t,n){r(this,e),this.parent=t,this.via=n,this.connected=!1,this.pending={},this.subscribed={},this.socket={};try{this.socket=new WebSocket(n),this.socket.onopen=this.onOpen,this.socket.onclose=this.onClose,this.socket.onmessage=this.onMessage,this.socket.onerror=this.onError}catch(e){this.onError(e)}}return i(e,[{key:"_decode",value:function(e){var t,n,r,i,a,o,s;for(n in i={},a=function(){var n,r,i,a;for(a=[],n=0,r=(i=e.split("&")).length;n<r;n++)t=i[n],a.push(t.split("="));return a}())t=a[n],r=(o=[decodeURIComponent(t[0]),decodeURIComponent(t[1])])[0],s=o[1],null==i[r]&&(i[r]=[]),i[r].push(s);return i}},{key:"_send",value:function(e,t,n){var r,i;return i=[e,t,n].join(" "),"function"==typeof(r=this.socket).send?r.send(i):void 0}},{key:"_subscribe",value:function(e){return this._send("sub",e,""),this.subscribed[e]=!0,this.subscribed[e]}},{key:"onClose",value:function(e){var t;for(t in this.connected=!1,this.subscribed)this.pending[t]=!0;return this.subscribed={},this.subscribed}},{key:"onError",value:function(e){throw new Error("onError"+e)}},{key:"onMessage",value:function(e){var t,n;return"ping"===(n=e.data.split(" "))[0]?"function"==typeof(t=this.socket).send?t.send("pong "+n.slice(1).join(" ")):void 0:"pub"===n[0]?this.parent.onUpdate(n[1],this._decode(n[2])):void 0}},{key:"onOpen",value:function(e){var t,n;for(n in this.connected=!0,t=[],this.pending)delete this.pending[n],t.push(this._subscribe(n));return t}},{key:"subscribe",value:function(e){return this.connected?this._subscribe(e):(this.pending[e]=!0,this.pending[e])}}]),e}(),s=function(){function e(t){r(this,e),this.fetcher=t,this.graph={},this.via={},this.fetcher.addCallback("headers",this.onHeaders)}return i(e,[{key:"onHeaders",value:function(e){var t,n,r;return null==e.headers||"undefined"==typeof WebSocket||null===WebSocket||(t=e.headers.etag,r=e.headers["updates-via"],n=e.uri,t&&r&&(this.graph[n]={etag:t,via:r},this.register(r,n)),!0)}},{key:"onUpdate",value:function(e,t){return this.fetcher.refresh(a(e))}},{key:"register",value:function(e,t){return null==this.via[e]&&(this.via[e]=new o(this,e)),this.via[e].subscribe(t)}}]),e}();e.exports.UpdatesSocket=o,e.exports.UpdatesVia=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.requiresAuth=t.login=void 0,n(56);var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(191));t.login=function(e){return fetch(e,{method:"HEAD",credentials:"include"}).then(function(e){return e.headers.get("user")}).then(function(t){return t?{authType:"WebID-TLS",idp:e,webId:t}:null})},t.requiresAuth=function(e){if(401!==e.status)return!1;var t=e.headers.get("www-authenticate");return!!t&&"WebID-TLS"===r.parse(t).scheme}},function(e,t,n){"use strict";e.exports=function(e="fetch error"){return t=>{if(200<=t.status&&300>t.status)return t;let n=`${e}: ${t.status} ${t.statusText}`,r=new Error(n);throw r.response=t,r.statusCode=t.status,r}}},function(e,t){e.exports=class{static encode(e){let t=[];return Object.keys(e).forEach(function(n){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]))}),t.join("&")}static decode(e){let t={};return e.split("&").forEach(function(e){let n=e.split("="),r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]);t[r]=i}),t}}},function(e,t,n){"use strict";var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n,r=[],i=!0,a=!1;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){a=!0,n=e}finally{try{!i&&s.return&&s.return()}finally{if(a)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(32),o=n(102),s=n(182).DataError,u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"sign",value:function(e){var t=a(JSON.stringify(e.payload));if("compact"===e.serialization){var n=e.key,r=e.header.alg,i=a(JSON.stringify(e.header))+"."+t;return o.sign(r,n,i).then(function(e){return i+"."+e})}return e.serialization,e.serialization,Promise.reject(new s("Unsupported serialization"))}},{key:"verify",value:function(e){e.signatures;var t=e.key,n=e.signature,i=e.header.alg;if(e.signature){var a=r(e.segments,2),u=a[0]+"."+a[1];return"none"===i?Promise.reject(new s("Signature provided to verify with alg: none")):o.verify(i,t,n,u).then(function(t){return e.verified=t,t})}if("none"===i){if(!t&&!n)return e.verified=!0,Promise.resolve(!0);if(t)return Promise.reject(new s("Key provided to verify signature with alg: none"))}return Promise.reject(new s("Missing signature(s)"))}}]),e}();e.exports=u},function(e,t,n){"use strict";n(71);var r=new(0,n(17).JSONSchema)({type:"object",properties:{typ:{type:"string"},cty:{type:"string",enum:["JWT"]},alg:{type:"string",format:"StringOrURI"},jku:{type:"string",format:"URI"},kid:{type:"string"},x5u:{type:"string",format:"URI"},x5c:{type:"array",items:{type:"string",format:"base64"}},x5t:{type:"string",format:"base64url"},crit:{type:"array",items:{type:"string"},minItems:1},enc:{type:"string",format:"StringOrURI"},zip:{type:"string"}}});e.exports=r},function(e,t,n){"use strict";var r=new(0,n(17).JSONSchema)({properties:{iss:{type:"string",format:"StringOrURI"},sub:{type:"string",format:"StringOrURI"},aud:{type:["array","string"],format:"StringOrURI",items:{format:"StringOrURI"}},exp:{type:"number",format:"NumericDate"},nbf:{type:"number",format:"NumericDate"},iat:{type:"number",format:"NumericDate"},jti:{type:"string"}}});e.exports=r},function(e,t,n){"use strict";var r=new(0,n(17).JSONSchema)({type:"string",format:"base64url"});e.exports=r},function(e,t,n){"use strict";var r=n(177),i=n(176),a=n(175),o=new(0,n(17).JSONSchema)({type:"object",properties:{type:{type:"string",enum:["JWS","JWE"]},segments:{type:"array"},header:a,protected:a,unprotected:a,iv:r,aad:r,ciphertext:r,tag:r,recipients:{type:"array",items:{type:"object",properties:{header:a,encrypted_key:r}}},payload:i,signatures:{type:"array",items:{type:"object",properties:{protected:a,header:a,signature:r,key:{type:"object"}}}},signature:r,verified:{type:"boolean",default:!1},key:{type:"object"},serialization:{type:"string",enum:["compact","json","flattened"],default:"compact"}}});e.exports=o},function(e,t,n){"use strict";var r=new(0,n(17).JSONSchema)({type:"object",properties:{keys:{type:"array",items:n(71)}}});e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(17).JSONDocument,a=n(71),o=n(102),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i),r(t,null,[{key:"importKey",value:function(e){return o.importKey(e)}},{key:"schema",get:function(){return a}}]),t}();e.exports=s},function(e,t,n){"use strict";var r=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),t}();e.exports=r},function(e,t,n){"use strict";e.exports={DataError:n(181),NotSupportedError:n(183)}},function(e,t,n){"use strict";var r=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.message=e+" is not a supported algorithm",n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),t}();e.exports=r},function(e,t,n){"use strict";(function(t){var r=t.TextEncoder?t.TextEncoder:n(402).TextEncoder;e.exports=r}).call(this,n(5))},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(188),o=0,s=function(){function e(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.schema=t,Object.assign(this,n),this.address||(this.address=""),!0!==this.require&&(this.require=!1)}return i(e,null,[{key:"compile",value:function(t){var n='\n // "cursor"\n let value = data\n let container\n let stack = []\n let top = -1\n\n // error state\n let valid = true\n let errors = []\n\n // complex schema state\n let initialValidity\n let anyValid\n let notValid\n let countOfValid\n let initialErrorCount\n let accumulatedErrorCount\n\n // validation code\n '+new e(t).compile()+"\n\n // validation result\n return {\n valid,\n errors\n }\n ";return new Function("data",n)}},{key:"counter",get:function(){return o++}}]),i(e,[{key:"compile",value:function(){var e="";return this.require&&(e+=this.required()),e+=this.type(),e+=this.array(),e+=this.number(),e+=this.object(),e+=this.string(),e+=this.enum(),e+=this.anyOf(),e+=this.allOf(),e+=this.not(),e+=this.oneOf()}},{key:"push",value:function(){return"\n stack.push(value)\n container = value\n top++\n "}},{key:"pop",value:function(){return"\n if (stack.length > 1) {\n top--\n stack.pop()\n }\n\n value = container = stack[top]\n "}},{key:"type",value:function(){var e=this.schema.type,t=this.address,n="";e&&(n+="\n // "+t+" type checking\n if (value !== undefined && "+(Array.isArray(e)?e:[e]).map(function(e){return"array"===e?"!Array.isArray(value)":"boolean"===e?"typeof value !== 'boolean'":"integer"===e?"!Number.isInteger(value)":"null"===e?"value !== null":"number"===e?"typeof value !== 'number'":"object"===e?"(typeof value !== 'object' || Array.isArray(value) || value === null)":"string"===e?"typeof value !== 'string'":void 0}).join(" && ")+") {\n valid = false\n errors.push({\n keyword: 'type',\n message: 'invalid type'\n })\n }\n ");return n}},{key:"array",value:function(){var e=this.validations(["additionalItems","items","minItems","maxItems","uniqueItems"]),t="";return 0<e.length&&(t+="\n /**\n * Array validations\n */\n if (Array.isArray(value)) {\n "+e+"\n }\n "),t}},{key:"number",value:function(){var e=this.validations(["minimum","maximum","multipleOf"]),t="";return 0<e.length&&(t+="\n /**\n * Number validations\n */\n if (typeof value === 'number') {\n "+e+"\n }\n "),t}},{key:"object",value:function(){var e=this.validations(["maxProperties","minProperties","additionalProperties","properties","patternProperties","dependencies","schemaDependencies","propertyDependencies"]),t="";return 0<e.length&&(t+="\n /**\n * Object validations\n */\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n "+e+"\n }\n "),t}},{key:"string",value:function(){var e=this.validations(["maxLength","minLength","pattern","format"]),t="";return 0<e.length&&(t+="\n /**\n * String validations\n */\n if (typeof value === 'string') {\n "+e+"\n }\n "),t}},{key:"validations",value:function(e){var t=this,n=this.schema,r="";return Object.keys(n).filter(function(t){return-1!==e.indexOf(t)}).forEach(function(e){r+=t[e]()}),r}},{key:"enum",value:function(){var e=this.schema.enum,t=this.address,n=["value !== undefined"],i="";return e&&(e.forEach(function(e){switch(void 0===e?"undefined":r(e)){case"boolean":case"number":n.push("value !== "+e);break;case"string":n.push('value !== "'+e+'"');break;case"object":null===e?n.push("value !== null"):n.push("'"+JSON.stringify(e)+"' !== JSON.stringify(value)");break;default:throw new Error("Things are not well in the land of enum")}}),i+='\n /**\n * Validate "'+t+'" enum\n */\n if ('+n.join(" && ")+") {\n valid = false\n errors.push({\n keyword: 'enum',\n message: JSON.stringify(value) + ' is not an enumerated value'\n })\n }\n "),i}},{key:"anyOf",value:function(){var t=this.schema.anyOf,n=this.address,r="";return Array.isArray(t)&&(r+="\n initialValidity = valid\n initialErrorCount = errors.length\n anyValid = false\n ",t.forEach(function(t){var i=new e(t,{address:n});r+="\n accumulatedErrorCount = errors.length\n "+i.compile()+"\n if (accumulatedErrorCount === errors.length) {\n anyValid = true\n }\n "}),r+="\n if (anyValid === true) {\n valid = initialValidity\n errors = errors.slice(0, initialErrorCount)\n }\n "),r}},{key:"allOf",value:function(){var t=this.schema.allOf,n=this.address,r="";return Array.isArray(t)&&t.forEach(function(t){var i=new e(t,{address:n});r+="\n "+i.compile()+"\n "}),r}},{key:"oneOf",value:function(){var t=this.schema.oneOf,n=this.address,r="";return Array.isArray(t)&&(r+="\n /**\n * Validate "+n+" oneOf\n */\n initialValidity = valid\n initialErrorCount = errors.length\n countOfValid = 0\n ",t.forEach(function(t){var i=new e(t,{address:n});r+="\n accumulatedErrorCount = errors.length\n "+i.compile()+"\n if (accumulatedErrorCount === errors.length) {\n countOfValid += 1\n }\n "}),r+="\n if (countOfValid === 1) {\n valid = initialValidity\n errors = errors.slice(0, initialErrorCount)\n } else {\n valid = false\n errors.push({\n keyword: 'oneOf',\n message: 'what is a reasonable error message for this case?'\n })\n }\n "),r}},{key:"not",value:function(){var t=this.schema.not,n=this.address,i="";"object"!==(void 0===t?"undefined":r(t))||null===t||Array.isArray(t)||(i+="\n /**\n * NOT\n */\n if (value !== undefined) {\n initialValidity = valid\n initialErrorCount = errors.length\n notValid = true\n\n accumulatedErrorCount = errors.length\n\n "+new e(t,{address:n}).compile()+"\n\n if (accumulatedErrorCount === errors.length) {\n notValid = false\n }\n\n if (notValid === true) {\n valid = initialValidity\n errors = errors.slice(0, initialErrorCount)\n } else {\n valid = false\n errors = errors.slice(0, initialErrorCount)\n errors.push({\n keyword: 'not',\n message: 'hmm...'\n })\n }\n }\n ");return i}},{key:"properties",value:function(){var t=this.schema,n=this.address,i=t.properties,a=t.required,o=this.push();return a=Array.isArray(a)?a:[],"object"===(void 0===i?"undefined":r(i))&&Object.keys(i).forEach(function(t){var r=i[t],s=-1!==a.indexOf(t),u=new e(r,{address:[n,t].filter(function(e){return!!e}).join("."),require:s});o+="\n value = container['"+t+"']\n ",o+=u.compile()}),o+=this.pop()}},{key:"otherProperties",value:function(){return"\n /**\n * Validate Other Properties\n */\n "+this.push()+"\n\n for (let key in container) {\n value = container[key]\n matched = false\n\n "+this.patternValidations()+"\n "+this.additionalValidations()+"\n }\n\n "+this.pop()+"\n "}},{key:"patternValidations",value:function(){var t=this.schema.patternProperties,n="";return"object"===(void 0===t?"undefined":r(t))&&Object.keys(t).forEach(function(r){var i=new e(t[r]);n+="\n if (key.match('"+r+"')) {\n matched = true\n "+i.compile()+"\n }\n "}),n}},{key:"additionalValidations",value:function(){var t=this.schema,n=t.properties,i=t.additionalProperties,a=this.address,o="",s=["matched !== true"];if(Object.keys(n||{}).forEach(function(e){s.push("key !== '"+e+"'")}),"object"===(void 0===i?"undefined":r(i))){var u=new e(i,{address:a+"[APKey]"});o+="\n // validate additional properties\n if ("+s.join(" && ")+") {\n "+u.compile()+"\n }\n "}return!1===i&&(o+="\n // validate non-presence of additional properties\n if ("+s.join(" && ")+") {\n valid = false\n errors.push({\n keyword: 'additionalProperties',\n message: key + ' is not a defined property'\n })\n }\n "),o}},{key:"patternProperties",value:function(){var e="";return this.otherPropertiesCalled||(this.otherPropertiesCalled=!0,e+=this.otherProperties()),e}},{key:"additionalProperties",value:function(){var e="";return this.otherPropertiesCalled||(this.otherPropertiesCalled=!0,e+=this.otherProperties()),e}},{key:"minProperties",value:function(){var e=this.schema.minProperties;return"\n // "+this.address+" min properties\n if (Object.keys(value).length < "+e+") {\n valid = false\n errors.push({\n keyword: 'minProperties',\n message: 'too few properties'\n })\n }\n "}},{key:"maxProperties",value:function(){var e=this.schema.maxProperties;return"\n // "+this.address+" max properties\n if (Object.keys(value).length > "+e+") {\n valid = false\n errors.push({\n keyword: 'maxProperties',\n message: 'too many properties'\n })\n }\n "}},{key:"dependencies",value:function(){var t=this.schema.dependencies,n=this.address,i=this.push();return"object"===(void 0===t?"undefined":r(t))&&Object.keys(t).forEach(function(a){var o=t[a],s=[];if(Array.isArray(o))o.forEach(function(e){s.push("container['"+e+"'] === undefined")}),i+="\n if (container['"+a+"'] !== undefined && ("+s.join(" || ")+")) {\n valid = false\n errors.push({\n keyword: 'dependencies',\n message: 'unmet dependencies'\n })\n }\n ";else if("object"===(void 0===o?"undefined":r(o))){var u=new e(o,{address:n});i+="\n if (container['"+a+"'] !== undefined) {\n "+u.compile()+"\n }\n "}}),i+=this.pop()}},{key:"required",value:function(){this.schema.properties;var e="";return e+="\n // validate "+this.address+" presence\n if (value === undefined) {\n valid = false\n errors.push({\n keyword: 'required',\n message: 'is required'\n })\n }\n "}},{key:"additionalItems",value:function(){var t=this.schema,n=t.items,i=t.additionalItems,a=(this.address,"");if(!1===i&&Array.isArray(n)&&(a+="\n // don't allow additional items\n if (value.length > "+n.length+") {\n valid = false\n errors.push({\n keyword: 'additionalItems',\n message: 'additional items not allowed'\n })\n }\n "),"object"===(void 0===i?"undefined":r(i))&&null!==i&&Array.isArray(n)){var o=new e(i),s=e.counter;a+="\n // additional items\n "+this.push()+"\n\n for (var i"+s+" = "+n.length+"; i"+s+" <= container.length; i"+s+"++) {\n value = container[i"+s+"]\n "+o.compile()+"\n }\n\n "+this.pop()+"\n "}return a}},{key:"items",value:function(){var t=this.schema.items,n=this.address,i="";if(Array.isArray(t))i+=this.push(),t.forEach(function(t,r){var a=new e(t,{address:n+"["+r+"]"});i+="\n // item #"+r+"\n value = container["+r+"]\n "+a.compile()+"\n "}),i+=this.pop();else if("object"===(void 0===t?"undefined":r(t))&&null!==t){var a=new e(t),o=e.counter;i+="\n // items\n "+this.push()+"\n\n for (var i"+o+" = 0; i"+o+" < container.length; i"+o+"++) {\n // read array element\n value = container[i"+o+"]\n "+a.compile()+"\n }\n\n "+this.pop()+"\n "}return i}},{key:"minItems",value:function(){var e=this.schema.minItems;return"\n // "+this.address+" min items\n if (value.length < "+e+") {\n valid = false\n errors.push({\n keyword: 'minItems',\n message: 'too few properties'\n })\n }\n "}},{key:"maxItems",value:function(){var e=this.schema.maxItems;return"\n // "+this.address+" max items\n if (value.length > "+e+") {\n valid = false\n errors.push({\n keyword: 'maxItems',\n message: 'too many properties'\n })\n }\n "}},{key:"uniqueItems",value:function(){var e=this.schema.uniqueItems,t=this.address,n="";return!0===e&&(n+="\n // validate "+t+" unique items\n let values = value.map(v => JSON.stringify(v)) // TODO: optimize\n let set = new Set(values)\n if (values.length !== set.size) {\n valid = false\n errors.push({\n keyword: 'uniqueItems',\n message: 'items must be unique'\n })\n }\n "),n}},{key:"minLength",value:function(){var e=this.schema.minLength;return"\n // "+this.address+" validate minLength\n if (Array.from(value).length < "+e+") {\n valid = false\n errors.push({\n keyword: 'minLength',\n message: 'too short'\n })\n }\n "}},{key:"maxLength",value:function(){var e=this.schema.maxLength;return"\n // "+this.address+" validate maxLength\n if (Array.from(value).length > "+e+") {\n valid = false\n errors.push({\n keyword: 'maxLength',\n message: 'too long'\n })\n }\n "}},{key:"pattern",value:function(){var e=this.schema.pattern,t=this.address;if(e)return"\n // "+t+" validate pattern\n if (!value.match(new RegExp('"+e+"'))) {\n valid = false\n errors.push({\n keyword: 'pattern',\n message: 'does not match the required pattern'\n })\n }\n "}},{key:"format",value:function(){var e=this.schema.format,t=this.address,n=a.resolve(e);if(n)return"\n // "+t+" validate format\n if (!value.match("+n+")) {\n valid = false\n errors.push({\n keyword: 'format',\n message: 'is not \""+e+"\" format'\n })\n }\n "}},{key:"minimum",value:function(){var e=this.schema,t=e.minimum,n=e.exclusiveMinimum;return"\n // "+this.address+" validate minimum\n if (value "+(!0===n?"<=":"<")+" "+t+") {\n valid = false\n errors.push({\n keyword: 'minimum',\n message: 'too small'\n })\n }\n "}},{key:"maximum",value:function(){var e=this.schema,t=e.maximum,n=e.exclusiveMaximum;return"\n // "+this.address+" validate maximum\n if (value "+(!0===n?">=":">")+" "+t+") {\n valid = false\n errors.push({\n keyword: 'maximum',\n message: 'too large'\n })\n }\n "}},{key:"multipleOf",value:function(){var e=this.schema.multipleOf,t="";if("number"==typeof e){var n=e.toString().length-e.toFixed(0).length-1,r=0<n?_Mathpow(10,n):1;t+="\n if ("+(0<n?"(value * "+r+") % "+e*r+" !== 0":"value % "+e+" !== 0")+") {\n valid = false\n errors.push({\n keyword: 'multipleOf',\n message: 'must be a multiple of "+e+"'\n })\n }\n "}return t}}]),e}();e.exports=s},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(103),o=["add","remove","replace","move","copy","test"],s=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.ops=t||[]}return i(e,[{key:"apply",value:function(e){var t=this;this.ops.forEach(function(n){var r=n.op;if(!r)throw new Error('Missing "op" in JSON Patch operation');if(-1===o.indexOf(r))throw new Error('Invalid "op" in JSON Patch operation');if(!n.path)throw new Error('Missing "path" in JSON Patch operation');t[r](n,e)})}},{key:"add",value:function(e,t){if(void 0===e.value)throw new Error('Missing "value" in JSON Patch add operation');new a(e.path,2).add(t,e.value)}},{key:"remove",value:function(e,t){new a(e.path).remove(t)}},{key:"replace",value:function(e,t){if(void 0===e.value)throw new Error('Missing "value" in JSON Patch replace operation');new a(e.path).replace(t,e.value)}},{key:"move",value:function(e,t){if(void 0===e.from)throw new Error('Missing "from" in JSON Patch move operation');if(e.path.match(new RegExp("^"+e.from)))throw new Error('Invalid "from" in JSON Patch move operation');var n=new a(e.path),r=new a(e.from),i=r.get(t);r.remove(t),n.add(t,i)}},{key:"copy",value:function(e,t){if(void 0===e.from)throw new Error('Missing "from" in JSON Patch copy operation');var n=new a(e.path),r=new a(e.from).get(t);n.add(t,r)}},{key:"test",value:function(e,t){if(void 0===e.value)throw new Error('Missing "value" in JSON Patch test operation');var n=new a(e.path).get(t);if(r(e.value),n!==e.value)throw new Error("Mismatching JSON Patch test value")}}]),e}();e.exports=s},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),Object.assign(this,n||{}),this.root=this.root||this,this.root.depth=this.root.depth||1,this.level>this.root.depth&&(this.root.depth=this.level),this.level=this.level||0,this.schema=t}return i(e,[{key:"compile",value:function(){var e=this.root,t=(this.depth,this.level,""),n="";if(n+=this.default(),n+=this.properties(),n+=this.items(),n+=this.member(),n+=this.item(),e===this){for(var r=1;r<=this.root.depth;r++)t+=this.declaration(r);return"\n options = options || {}\n\n if (options.filter === false) {\n Object.assign(target, JSON.parse(JSON.stringify(source)))\n }\n\n "+t+"\n "+n+"\n "}return n}},{key:"declaration",value:function(e){return"\n var target"+e+"\n var source"+e+"\n var count"+e+"\n "}},{key:"default",value:function(){var e=this.schema,t=this.level,n=this.key,r=this.index,i=e.default,a="";return e.hasOwnProperty("default")&&(n&&(a+="\n target"+t+"['"+n+"'] = "+JSON.stringify(i)+"\n "),r&&(a+="\n target"+t+"["+r+"] = "+JSON.stringify(i)+"\n "),1<t&&(a+="\n count"+t+"++\n "),a="\n if (options.defaults !== false) {\n "+a+"\n }\n "),a}},{key:"member",value:function(){var e=this.schema,t=(this.root,this.level),n=this.key,r=e.properties,i=e.additionalProperties,a=e.items,o=e.additionalItems,s="";return!n||r||i||a||o||(s+="\n target"+t+"['"+n+"'] = source"+t+"['"+n+"']\n ",1<t&&(s+="\n count"+t+"++\n "),s="\n if (source"+t+".hasOwnProperty('"+n+"')) {\n "+s+"\n }\n "),s}},{key:"item",value:function(){var e=this.schema,t=(this.root,this.level),n=this.index,r=e.properties,i=e.additionalProperties,a=e.items,o=e.additionalItems,s="";return!n||r||i||a||o||(s+="\n target"+t+"["+n+"] = source"+t+"["+n+"]\n ",1<t&&(s+="\n count"+t+"++\n "),s="\n if ("+n+" < len) {\n "+s+"\n }\n "),s}},{key:"properties",value:function(){var t=this.schema,n=this.root,r=this.level,i=this.key,a=this.index,o=t.properties,s="";return o&&(Object.keys(o).forEach(function(t){var i=new e(o[t],{key:t,root:n,level:r+1});s+=i.compile()}),n===this?s="\n if (typeof source === 'object' && source !== null && !Array.isArray(source)) {\n if (typeof target !== 'object') {\n throw new Error('?')\n }\n\n source1 = source\n target1 = target\n count1 = 0\n\n "+s+"\n }\n ":(a&&(s="\n if ("+a+" < source"+r+".length || typeof source"+r+"["+a+"] === 'object') {\n\n source"+(r+1)+" = source"+r+"["+a+"] || {}\n count"+(r+1)+" = 0\n\n if ("+a+" < target"+r+".length || typeof target"+r+"["+a+"] !== 'object') {\n target"+(r+1)+" = {}\n if ("+a+" < source"+r+".length) {\n count"+(r+1)+"++\n }\n } else {\n target"+(r+1)+" = target"+r+"["+a+"]\n }\n\n "+s+"\n\n if (count"+(r+1)+" > 0) {\n target"+r+"["+a+"] = target"+(r+1)+"\n count"+r+"++\n }\n\n } else {\n target"+r+"["+a+"] = source"+r+"["+a+"]\n count"+r+"++\n }\n "),i&&(s="\n if ((typeof source"+r+"['"+i+"'] === 'object'\n && source"+r+"['"+i+"'] !== null\n && !Array.isArray(source"+r+"['"+i+"']))\n || !source"+r+".hasOwnProperty('"+i+"')) {\n\n source"+(r+1)+" = source"+r+"['"+i+"'] || {}\n count"+(r+1)+" = 0\n\n if (!target"+r+".hasOwnProperty('"+i+"')\n || typeof target"+r+"['"+i+"'] !== 'object'\n || target"+r+"['"+i+"'] === null\n || Array.isArray(target"+r+"['"+i+"'])) {\n target"+(r+1)+" = {}\n if (source"+r+".hasOwnProperty('"+i+"')) {\n count"+(r+1)+"++\n }\n } else {\n target"+(r+1)+" = target"+r+"['"+i+"']\n count"+(r+1)+"++\n }\n\n "+s+"\n\n if (count"+(r+1)+" > 0) {\n target"+r+"['"+i+"'] = target"+(r+1)+"\n count"+r+"++\n }\n\n } else {\n target"+r+"['"+i+"'] = source"+r+"['"+i+"']\n count"+r+"++\n }\n "))),s}},{key:"additionalProperties",value:function(){}},{key:"items",value:function(){var t=this.schema,n=this.root,i=this.level,a=this.key,o=(this.index,t.items),s="";if(o){if(Array.isArray(o));else if("object"===(void 0===o?"undefined":r(o))&&null!==o){var u="i"+(i+1);s+="\n var sLen = source"+(i+1)+".length || 0\n var tLen = target"+(i+1)+".length || 0\n var len = 0\n\n if (sLen > len) { len = sLen }\n // THIS IS WRONG, CAUSED SIMPLE ARRAY INIT TO FAIL (OVERWRITE\n // EXISTING TARGET VALUES WITH UNDEFINED WHEN SOURCE IS SHORTER THAN\n // TARGET). LEAVING HERE UNTIL WE FINISH TESTING AND SEE WHY IT MIGHT\n // HAVE BEEN HERE IN THE FIRST PLACE.\n //\n // if (tLen > len) { len = tLen }\n\n for (var "+u+" = 0; "+u+" < len; "+u+"++) {\n "+new e(o,{index:u,root:n,level:i+1}).compile()+"\n }\n "}s=n===this?"\n if (Array.isArray(source)) {\n if (!Array.isArray(target)) {\n throw new Error('?')\n }\n\n source1 = source\n target1 = target\n\n "+s+"\n }\n ":"\n if (Array.isArray(source"+i+"['"+a+"']) || !source"+i+".hasOwnProperty('"+a+"')) {\n\n source"+(i+1)+" = source"+i+"['"+a+"'] || []\n count"+(i+1)+" = 0\n\n if (!target"+i+".hasOwnProperty('"+a+"') || !Array.isArray(target"+i+"['"+a+"'])) {\n target"+(i+1)+" = []\n if (source"+i+".hasOwnProperty('"+a+"')) {\n count"+(i+1)+"++\n }\n\n } else {\n target"+(i+1)+" = target"+i+"['"+a+"']\n count"+(i+1)+"++\n }\n\n "+s+"\n\n if (count"+(i+1)+" > 0) {\n target"+i+"['"+a+"'] = target"+(i+1)+"\n count"+i+"++\n }\n\n } else {\n target"+i+"['"+a+"'] = source"+i+"['"+a+"']\n count"+i+"++\n }\n "}return s}},{key:"additionalItems",value:function(){}}],[{key:"compile",value:function t(n){var r=new e(n).compile();try{return new Function("target","source","options",r)}catch(t){console.log(t,t.stack)}}}]),e}();e.exports=a},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i,a=/^(?:[a-z][a-z0-9+-.]*)?(?:\:|\/)\/?[^\s]*$/i,o=/^[a-z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,s=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,u=/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,l=/^[a-z](?:(?:[-0-9a-z]{0,61})?[0-9a-z])?(\.[a-z](?:(?:[-0-9a-z]{0,61})?[0-9a-z])?)*$/i,c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"register",value:function(e,t){if("string"!=typeof e)throw new Error("Format name must be a string");return"string"==typeof t&&(t=new RegExp(t)),this[e]=t}},{key:"resolve",value:function(e){var t=this[e];if(!t)throw new Error("Unknown JSON Schema format.");return t}},{key:"test",value:function(e,t){return this.resolve(e).test(t)}}],[{key:"initialize",value:function(){var t=new e;return t.register("date-time",i),t.register("uri",a),t.register("email",o),t.register("ipv4",s),t.register("ipv6",u),t.register("hostname",l),t}}]),e}();e.exports=c.initialize()},function(e,t,n){(function(t){const r=n(104),i=n(56),{URL:a}=n(47),o=i.Headers?i.Headers:t.Headers,{JSONDocument:s}=n(17),{JWKSet:u}=n(55),l=n(396),c=n(395),d=n(391),h=n(172);class f extends s{static get schema(){return d}static from(e){let t=new f(e),n=t.validate();if(!n.valid)return Promise.reject(new Error(JSON.stringify(n)));let r=t.provider.jwks;return r?u.importKeys(r).then(e=>(t.provider.jwks=e,t)):t.jwks().then(()=>t)}static register(e,t,n){let r=new f({provider:{url:e},defaults:Object.assign({},n.defaults),store:n.store});return Promise.resolve().then(()=>r.discover()).then(()=>r.jwks()).then(()=>r.register(t)).then(()=>r)}discover(){try{let e=this.provider.url;r(e,'RelyingParty provider must define "url"');let t=new a(e);return t.pathname=".well-known/openid-configuration",i(t.toString()).then(h("Error fetching openid configuration")).then(e=>e.json().then(e=>this.provider.configuration=e))}catch(e){return Promise.reject(e)}}register(e){try{let t=this.provider.configuration;r(t,"OpenID Configuration is not initialized."),r(t.registration_endpoint,"OpenID Configuration is missing registration_endpoint.");let n=t.registration_endpoint,a="post",s=new o({"Content-Type":"application/json"}),u=this.defaults.register,l=JSON.stringify(Object.assign({},u,e));return i(n,{method:a,headers:s,body:l}).then(h("Error registering client")).then(e=>e.json().then(e=>this.registration=e))}catch(e){return Promise.reject(e)}}serialize(){return JSON.stringify(this)}jwks(){try{let e=this.provider.configuration;r(e,"OpenID Configuration is not initialized."),r(e.jwks_uri,"OpenID Configuration is missing jwks_uri.");let t=e.jwks_uri;return i(t).then(h("Error resolving provider keys")).then(e=>e.json().then(e=>u.importKeys(e)).then(e=>this.provider.jwks=e))}catch(e){return Promise.reject(e)}}createRequest(e,t){return l.create(this,e,t||this.store)}validateResponse(e,t){return t=t||this.store,e=e.match(/^http(s?):\/\//)?{rp:this,redirect:e,session:t}:{rp:this,body:e,session:t},c.validateResponse(e)}userinfo(){try{let e=this.provider.configuration;r(e,"OpenID Configuration is not initialized."),r(e.userinfo_endpoint,"OpenID Configuration is missing userinfo_endpoint.");let t=e.userinfo_endpoint,n=this.store.access_token;r(n,"Missing access token.");let a=new o({"Content-Type":"application/json",Authorization:`Bearer ${n}`});return i(t,{headers:a}).then(h("Error fetching userinfo")).then(e=>e.json())}catch(e){return Promise.reject(e)}}logout(){let e;try{r(this.provider,"OpenID Configuration is not initialized."),e=this.provider.configuration,r(e,"OpenID Configuration is not initialized."),r(e.end_session_endpoint,"OpenID Configuration is missing end_session_endpoint.")}catch(e){return Promise.reject(e)}this.clearSession();let t=e.end_session_endpoint;return i(t,{method:"get"}).then(h("Error logging out"))}clearSession(){let e=this.store;e&&delete e[p]}popTokenFor(e,t){return PoPToken.issueFor(e,t,this)}}const p="oidc.session.privateKey";f.SESSION_PRIVATE_KEY=p,e.exports=f}).call(this,n(5))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=/^[^\u0000-\u001F\u007F()<>@,;:\\"/?={}\[\]\u0020\u0009]+$/,i=t.isToken=function(e){return"string"==typeof e&&r.test(e)};t.isScheme=i,t.quote=function(e){return'"'+e.replace(/"/g,'\\"')+'"'},t.unquote=function(e){return e.substr(1,e.length-2).replace(/\\"/g,'"')}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.parse=t.format=void 0;var i=r(n(413)),a=r(n(412));t.format=i.default,t.parse=a.default},function(e,t,n){var r=n(211),i=n(113).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.combineHandlers=t.server=t.client=void 0;var i=r(n(34)),a=r(n(33)),o=r(n(76)),s=r(n(429)),u=r(n(194)),l=r(n(416)),c="solid-auth-client",d=function(e){return(0,u.default)({},c,e)},h=function(e){if(!e||"object"!==(void 0===e?"undefined":(0,s.default)(e)))return null;var t=e[c];return t&&"object"===(void 0===t?"undefined":(0,s.default)(t))?t:null},f=function(e){var t=h(e);if(!t)return null;var n=t.id,r=t.method,i=t.args;return null!=n&&"string"==typeof n&&"string"==typeof r&&Array.isArray(i)?{id:n,method:r,args:i}:null};t.client=function(e,t){return function(n){return new o.default(function(r,i){var a=(0,l.default)();window.addEventListener("message",function e(n){var i=n.data,o=n.origin,s=function(e){var t=h(e);if(!t)return null;var n=t.id,r=t.ret;return null!=n&&"string"==typeof n&&t.hasOwnProperty("ret")?{id:n,ret:r}:null}(i);("*"===t||o===t)&&s&&s.id===a&&(r(s.ret),window.removeEventListener("message",e))}),e.postMessage({"solid-auth-client":{id:a,method:n.method,args:n.args}},t)})}},t.server=function(e,t){return function(n){var r=function(){var r=(0,a.default)(i.default.mark(function r(a){var o,s,u,l;return i.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(o=a.data,s=a.origin,u=f(o)){r.next=4;break}return r.abrupt("return");case 4:if(s===t){r.next=7;break}return console.warn("SECURITY WARNING: solid-auth-client is listening for messages from "+t+", but received a message from "+s+". Ignoring the message."),r.abrupt("return");case 7:return r.next=9,n(u);case 9:(l=r.sent)&&e.postMessage(d(l),t);case 11:case"end":return r.stop()}},r,void 0)}));return function(e){return r.apply(this,arguments)}}(),o={start:function(){return window.addEventListener("message",r),o},stop:function(){return window.removeEventListener("message",r),o}};return o}},t.combineHandlers=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.map(function(t){return t(e)}).find(function(e){return null!==e})}}},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(434));t.default=function(e,t,n){return t in e?(0,r.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var r=n(9)("iterator"),i=!1;try{var a=[7][r]();a.return=function(){i=!0},Array.from(a,function(){throw 2})}catch(t){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var a=[7],o=a[r]();o.next=function(){return{done:n=!0}},a[r]=function(){return o},e(a)}catch(t){}return n}},function(e,t,n){var r=n(30),i=n(36),a=n(109);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=a.f(e);return(0,n.resolve)(t),n.promise}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r,i,a,o=n(61),s=n(442),u=n(205),l=n(120),c=n(10),d=c.process,h=c.setImmediate,f=c.clearImmediate,p=c.MessageChannel,m=c.Dispatch,v=0,g={},b="onreadystatechange",y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},w=function(e){y.call(e.data)};h&&f||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++v]=function(){s("function"==typeof e?e:Function(e),t)},r(v),v},f=function(e){delete g[e]},"process"==n(58)(d)?r=function(e){d.nextTick(o(y,e,1))}:m&&m.now?r=function(e){m.now(o(y,e,1))}:p?(a=(i=new p).port2,i.port1.onmessage=w,r=o(a.postMessage,a,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(r=function(e){c.postMessage(e+"","*")},c.addEventListener("message",w,!1)):r=b in l("script")?function(e){u.appendChild(l("script"))[b]=function(){u.removeChild(this),y.call(e)}}:function(e){setTimeout(o(y,e,1),0)}),e.exports={set:h,clear:f}},function(e,t,n){var r=n(30),i=n(80),a=n(9)("species");e.exports=function(e,t){var n,o=r(e).constructor;return void 0===o||void 0==(n=r(o)[a])?t:i(n)}},function(e,t,n){var r=n(203),i=n(9)("iterator"),a=n(57);e.exports=n(18).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||a[r(e)]}},function(e,t,n){var r=n(57),i=n(9)("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[i]===e)}},function(e,t,n){var r=n(30);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(n){var a=e.return;throw void 0!==a&&r(a.call(e)),n}}},function(e,t,n){var r=n(58),i=n(9)("toStringTag"),a="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(t){}}(t=Object(e),i))?n:a?r(t):"Object"==(o=r(t))&&"function"==typeof t.callee?"Arguments":o}},function(e,t,n){n(448);for(var r=n(10),i=n(37),a=n(57),o=n(9)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<s.length;u++){var l=s[u],c=r[l],d=c&&c.prototype;d&&!d[o]&&i(d,o,l),a[l]=a.Array}},function(e,t,n){var r=n(10).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(30),i=n(450),a=n(113),o=n(115)("IE_PROTO"),s=function(){},u="prototype",l=function(){var e,t=n(120)("iframe"),r=a.length;for(t.style.display="none",n(205).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l[u][a[r]];return l()};e.exports=Object.create||function(e,t){var n;return null===e?n=l():(s[u]=r(e),n=new s,s[u]=null,n[o]=e),void 0===t?n:i(n,t)}},function(e,t,n){e.exports=n(37)},function(e,t,n){"use strict";var r=n(75),i=n(31),a=n(207),o=n(37),s=n(57),u=n(451),l=n(74),c=n(449),d=n(9)("iterator"),h=!([].keys&&"next"in[].keys()),f="keys",p="values",m=function(){return this};e.exports=function(e,t,n,v,g,b,y){u(n,t,v);var w,_,x,M=function(e){return!h&&e in A?A[e]:function(){return new n(this,e)}},k=t+" Iterator",C=g==p,E=!1,A=e.prototype,T=A[d]||A["@@iterator"]||g&&A[g],S=T||M(g),I=g?C?M("entries"):S:void 0,N="Array"==t&&A.entries||T;if(N&&((x=c(N.call(new e)))!==Object.prototype&&x.next&&(l(x,k,!0),!r&&"function"!=typeof x[d]&&o(x,d,m))),C&&T&&T.name!==p&&(E=!0,S=function(){return T.call(this)}),(!r||y)&&(h||E||!A[d])&&o(A,d,S),s[t]=S,s[k]=m,g)if(w={values:C?S:M(p),keys:b?S:M(f),entries:I},y)for(_ in w)_ in A||a(A,_,w[_]);else i(i.P+i.F*(h||E),t,w);return w}},function(e,t){},function(e,t,n){var r=n(58);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(35),i=n(45),a=n(457)(!1),o=n(115)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),u=0,l=[];for(n in s)n!=o&&r(s,n)&&l.push(n);for(;t.length>u;)r(s,n=t[u++])&&(~a(l,n)||l.push(n));return l}},function(e,t,n){e.exports=!n(29)&&!n(60)(function(){return 7!=Object.defineProperty(n(120)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(462);Object.defineProperty(t,"login",{enumerable:!0,get:function(){return r.login}}),Object.defineProperty(t,"popupLogin",{enumerable:!0,get:function(){return r.popupLogin}}),Object.defineProperty(t,"currentSession",{enumerable:!0,get:function(){return r.currentSession}}),Object.defineProperty(t,"logout",{enumerable:!0,get:function(){return r.logout}}),Object.defineProperty(t,"fetch",{enumerable:!0,get:function(){return r.fetch}})},function(e,t,n){"use strict";e.exports=function(e,t,n){var a,o,s,u=["INSERT","DELETE","WHERE"],l=i("http://www.w3.org/ns/pim/patch#"),c=r(t,t,n,n,null,null,"",null),d={},h=function(e,t,n,r,i){return"Line "+(t+1)+" of <"+e+">: Bad syntax:\n "+i+'\n at: "'+n.slice(r,r+30)+'"'};a=0;var f=t.sym(n+"#query");for(d.query=f;;){if(0>(o=c.skipSpace(e,a)))return d;if(";"===e[o]){if(0>(a=c.skipSpace(e,o+1)))return d;o=a}var p=!1;for(s=0;s<u.length;s++){var m=u[s];if(e.slice(o,o+m.length)===m){if(0>(a=c.skipSpace(e,o+m.length)))throw h(c._thisDoc,c.lines,e,o+m.length,"found EOF, needed {...} after "+m);if(("INSERT"===m||"DELETE"===m)&&"DATA"===e.slice(a,a+4)){if(0>(o=c.skipSpace(e,a+4)))throw h(c._thisDoc,c.lines,e,a+4,"needed {...} after INSERT DATA "+m);a=o}var v=[];if(0>(o=c.node(e,a,v)))throw h(c._thisDoc,c.lines,e,a,"bad syntax or EOF in {...} after "+m);d[m.toLowerCase()]=v[0],t.add(f,l(m.toLowerCase()),v[0]),p=!0,a=o}}if(!p&&"@prefix"===e.slice(o,o+7)){if(0>(a=c.directive(e,o)))throw h(c._thisDoc,c.lines,e,a,"bad syntax or EOF after @prefix ");a=c.checkDot(e,a),p=!0}if(!p)throw h(c._thisDoc,c.lines,e,o,"Unknown syntax at start of statememt: '"+e.slice(o).slice(0,20)+"'")}};var r=n(82),i=n(62)},function(e,t,n){"use strict";e.exports=function(e,t,n,f,p){function m(){p&&p(null,t)}function v(e,n){e&&p(e,t);try{w.parse(n,g)}catch(e){p(e,t)}}function g(e,n,r){if(e&&p(e,t),n)_.push(n);else{for(var i=0;i<_.length;i++)b(t,_[i]);p(null,t)}}function b(e,t){var n=y(t.subject),r=y(t.predicate),i=y(t.object),a=null;t.graph&&(a=y(t.graph)),e.add(n,r,i,a)}function y(e){var t;if(o.Util.isLiteral(e)){t=o.Util.getLiteralValue(e);var n=o.Util.getLiteralLanguage(e),i=new u(o.Util.getLiteralType(e));return new a(t,n,i)}return o.Util.isIRI(e)?new u(e):o.Util.isBlank(e)?(t=e.substring(2,e.length),new r(t)):null}f=(f=f||"text/turtle").split(";")[0];try{if("text/n3"===f||"text/turtle"===f)s(t,t,n,n,null,null,"",null).loadBuf(e),m();else if("application/rdf+xml"===f)new c(t).parse(h.parseXML(e),n,t.sym(n)),m();else if("application/xhtml+xml"===f)l(h.parseXML(e,{contentType:"application/xhtml+xml"}),t,n),m();else if("text/html"===f)l(h.parseXML(e,{contentType:"text/html"}),t,n),m();else if("application/sparql-update"===f)d(e,t,n),m();else{if("application/ld+json"!==f&&"application/nquads"!==f&&"application/n-quads"!==f)throw new Error("Don't know how to parse "+f+" yet");var w=o.Parser(),_=[];if("application/ld+json"===f){var x;try{x=JSON.parse(e)}catch(e){return p(e,null)}i.toRDF(x,{format:"application/nquads",base:n},v)}else v(null,e)}}catch(t){!function(e){if("application/ld+json"!==f||"application/nquads"!==f||"application/n-quads"!==f){if(!p)throw new Error("Error trying to parse <"+n+"> as "+f+":\n"+e+":\n"+e.stack);p(e,t)}}(t)}};var r=n(40),i=n(226),a=n(48),o=n(224),s=n(82),u=n(12),l=n(122).parseRDFaDOM,c=n(121),d=n(214),h=n(27)},function(e,t,n){function r(e){if(!(this instanceof r))return new r(e);i.call(this,{encoding:"utf8"}),this._writableState.objectMode=!0;var t=this,n=new o({write:function(e,n,r){t.push(e),r&&r()},end:function(e){t.push(null),e&&e()}},e);this._transform=function(e,t,r){n.addTriple(e,r)},this._flush=function(e){n.end(e)}}var i=n(64).Transform,a=n(126),o=n(125);a.inherits(r,i),e.exports=r},function(e,t,n){"use strict";function r(e){return this instanceof r?(o.call(this,e),this._transformState={afterTransform:function(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),void this.on("prefinish",i)):new r(e)}function i(){var e=this;"function"==typeof this._flush?this._flush(function(t,n){a(e,t,n)}):a(this,null,null)}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}e.exports=r;var o=n(38),s=n(63);s.inherits=n(1),s.inherits(r,o),r.prototype.push=function(e,t){return this._transformState.needTransform=!1,o.prototype.push.call(this,e,t)},r.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},r.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},r.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},r.prototype._destroy=function(e,t){var n=this;o.prototype._destroy.call(this,e,function(e){t(e),n.emit("close")})}},function(e,t,n){"use strict";function r(e,t){e.emit("error",t)}var i=n(87);e.exports={destroy:function(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):e&&(!this._writableState||!this._writableState.errorEmitted)&&i.nextTick(r,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(i.nextTick(r,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){e.exports=n(130).EventEmitter},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t,r){function i(e,t){x=x||n(38),e=e||{};var r=t instanceof x;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,a=e.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(a||0===a)?a:o,this.highWaterMark=_Mathfloor(this.highWaterMark),this.buffer=new j,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(!N&&(N=n(127).StringDecoder),this.decoder=new N(e.encoding),this.encoding=e.encoding)}function a(e){return x=x||n(38),this instanceof a?(this._readableState=new i(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),void C.call(this)):new a(e)}function o(e,t,n,r,i){var a,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,c(e)}}(e,o)):(i||(a=u(o,t)),a?e.emit("error",a):o.objectMode||t&&0<t.length?("string"!=typeof t&&!o.objectMode&&Object.getPrototypeOf(t)!==E.prototype&&(t=function(e){return E.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):s(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?s(e,o,t,!1):h(e,o)):s(e,o,t,!1))):!r&&(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function s(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&c(e)),h(e,t)}function u(e,t){var n;return function(e){return E.isBuffer(e)||e instanceof A}(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e==e?(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=L?e=L:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function c(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(S("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?_.nextTick(d,e):d(e))}function d(e){S("emit readable"),e.emit("readable"),v(e)}function h(e,t){t.readingMore||(t.readingMore=!0,_.nextTick(f,e,t))}function f(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(S("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function p(e){S("readable nexttick read 0"),e.read(0)}function m(e,t){t.reading||(S("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),v(e),t.flowing&&!t.reading&&e.read(0)}function v(e){var t=e._readableState;for(S("flow",t.flowing);t.flowing&&null!==e.read(););}function g(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(i+=o===a.length?a:a.slice(0,e),0===(e-=o)){o===a.length?(++r,t.head=n.next?n.next:t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=E.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function b(e){var t=e._readableState;if(0<t.length)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,_.nextTick(y,t,e))}function y(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function w(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}var _=n(87);e.exports=a;var x,M=n(220);a.ReadableState=i;n(130).EventEmitter;var k=function(e,t){return e.listeners(t).length},C=n(219),E=n(3).Buffer,A=t.Uint8Array||function(){},T=n(63);T.inherits=n(1);var S,I=n(474);S=I&&I.debuglog?I.debuglog("stream"):function(){};var N,j=n(473),O=n(218);T.inherits(a,C);var R=["error","close","destroy","pause","resume"];Object.defineProperty(a.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),a.prototype.destroy=O.destroy,a.prototype._undestroy=O.undestroy,a.prototype._destroy=function(e,t){this.push(null),t(e)},a.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=E.from(e,t),t=""),n=!0),o(this,e,t,!1,n)},a.prototype.unshift=function(e){return o(this,e,null,!0,!1)},a.prototype.isPaused=function(){return!1===this._readableState.flowing},a.prototype.setEncoding=function(e){return N||(N=n(127).StringDecoder),this._readableState.decoder=new N(e),this._readableState.encoding=e,this};var L=8388608;a.prototype.read=function(e){S("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return S("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?b(this):c(this),null;if(0===(e=l(e,t))&&t.ended)return 0===t.length&&b(this),null;var r,i=t.needReadable;return S("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&S("length less than watermark",i=!0),t.ended||t.reading?S("reading or ended",i=!1):i&&(S("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,!t.reading&&(e=l(n,t))),null===(r=0<e?g(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(!t.ended&&(t.needReadable=!0),n!==e&&t.ended&&b(this)),null!==r&&this.emit("data",r),r},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,t){function n(e,t){S("onunpipe"),e===d&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,a())}function i(){S("onend"),e.end()}function a(){S("cleanup"),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("drain",p),e.removeListener("error",s),e.removeListener("unpipe",n),d.removeListener("end",i),d.removeListener("end",c),d.removeListener("data",o),m=!0,h.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&p()}function o(t){S("ondata"),g=!1,!1!==e.write(t)||g||((1===h.pipesCount&&h.pipes===e||1<h.pipesCount&&-1!==w(h.pipes,e))&&!m&&(S("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,g=!0),d.pause())}function s(t){S("onerror",t),c(),e.removeListener("error",s),0===k(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",l),c()}function l(){S("onfinish"),e.removeListener("close",u),c()}function c(){S("unpipe"),d.unpipe(e)}var d=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,S("pipe count=%d opts=%j",h.pipesCount,t);var f=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?i:c;h.endEmitted?_.nextTick(f):d.once("end",f),e.on("unpipe",n);var p=function(e){return function(){var t=e._readableState;S("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&k(e,"data")&&(t.flowing=!0,v(e))}}(d);e.on("drain",p);var m=!1,g=!1;return d.on("data",o),function(e,t,n){"function"==typeof e.prependListener?e.prependListener(t,n):e._events&&e._events[t]?M(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",s),e.once("close",u),e.once("finish",l),e.emit("pipe",d),h.flowing||(S("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit("unpipe",this,n);return this}var o=w(t.pipes,e);return-1===o?this:(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},a.prototype.on=function(e,t){var n=C.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&c(this):_.nextTick(p,this))}return n},a.prototype.addListener=a.prototype.on,a.prototype.resume=function(){var e=this._readableState;return e.flowing||(S("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,_.nextTick(m,e,t))}(this,e)),this},a.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this},a.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(S("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(S("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length))&&(t.push(i)||(r=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<R.length;a++)e.on(R[a],this.emit.bind(this,R[a]));return this._read=function(t){S("wrapped _read",t),r&&(r=!1,e.resume())},this},Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),a._fromList=g}).call(this,n(5),n(11))},function(e,t,n){function r(e){if(!(this instanceof r))return new r(e);i.call(this,{decodeStrings:!0}),this._readableState.objectMode=!0;var t=this,n=new o(e);n.parse(function(e,n){n&&t.push(n)||e&&t.emit("error",e)},this.emit.bind(this,"prefix")),this._transform=function(e,t,r){n.addChunk(e),r()},this._flush=function(e){n.end(),e()}}var i=n(64).Transform,a=n(126),o=n(132);a.inherits(r,i),e.exports=r},function(e,t,n){function r(e,t){return this instanceof r?(this._size=0,this._graphs=Object.create(null),this._entities=Object.create(null),this._entities["><"]=0,this._entityCount=0,this._blankNodeIndex=0,!t&&e&&!e[0]&&(t=e,e=null),this._prefixes=Object.create(null),t&&t.prefixes&&this.addPrefixes(t.prefixes),void(e&&this.addTriples(e))):new r(e,t)}var i=n(131).expandPrefixedName;r.prototype={get size(){var e=this._size;if(null!==e)return e;var t,n,r=this._graphs;for(var i in r)for(var a in t=r[i].subjects)for(var o in n=t[a])e+=Object.keys(n[o]).length;return this._size=e},_addToIndex:function(e,t,n,r){var i=e[t]||(e[t]={});(i[n]||(i[n]={}))[r]=null},_removeFromIndex:function(e,t,n,r){var i,a=e[t],o=a[n];for(i in delete o[r],o)return;for(i in delete a[n],a)return;delete e[t]},_findInIndex:function(e,t,n,r,i,a,o,s){var u,l,c,d=[],h=Object.keys(this._entities);for(var f in t&&((u=e,e={})[t]=u[t]),e){var p=h[f];if(l=e[f])for(var m in n&&((u=l,l={})[n]=u[n]),l){var v=h[m];if(c=l[m])for(var g,b=(r?r in c?[r]:[]:Object.keys(c)),y=b.length-1;0<=y;y--)(g={subject:"",predicate:"",object:"",graph:s})[i]=p,g[a]=v,g[o]=h[b[y]],d.push(g)}}return d},_countInIndex:function(e,t,n,r){var i,a,o,s=0;for(var u in t&&((i=e,e={})[t]=i[t]),e)if(a=e[u])for(var l in n&&((i=a,a={})[n]=i[n]),a)(o=a[l])&&(r?r in o&&s++:s+=Object.keys(o).length);return s},addTriple:function(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r||"";var i=this._graphs[r];i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i));var a=this._entities;e=a[e]||(a[e]=++this._entityCount),t=a[t]||(a[t]=++this._entityCount),n=a[n]||(a[n]=++this._entityCount),this._addToIndex(i.subjects,e,t,n),this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null},addTriples:function(e){for(var t=e.length-1;0<=t;t--)this.addTriple(e[t])},addPrefix:function(e,t){this._prefixes[e]=t},addPrefixes:function(e){for(var t in e)this.addPrefix(t,e[t])},removeTriple:function(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r||"";var i,a,o,s=this._entities,u=this._graphs;if((e=s[e])&&(t=s[t])&&(n=s[n])&&(i=u[r])&&((a=i.subjects[e])&&(o=a[t])&&n in o)){for(e in this._removeFromIndex(i.subjects,e,t,n),this._removeFromIndex(i.predicates,t,n,e),this._removeFromIndex(i.objects,n,e,t),null!==this._size&&this._size--,i.subjects)return;delete u[r]}},removeTriples:function(e){for(var t=e.length-1;0<=t;t--)this.removeTriple(e[t])},find:function(e,t,n,r){var a=this._prefixes;return this.findByIRI(i(e,a),i(t,a),i(n,a),i(r,a))},findByIRI:function(e,t,n,r){r=r||"";var i=this._graphs[r],a=this._entities;return i?e&&!(e=a[e])?[]:t&&!(t=a[t])?[]:n&&!(n=a[n])?[]:e?n?this._findInIndex(i.objects,n,e,t,"object","subject","predicate",r):this._findInIndex(i.subjects,e,t,null,"subject","predicate","object",r):t?this._findInIndex(i.predicates,t,n,null,"predicate","object","subject",r):n?this._findInIndex(i.objects,n,null,null,"object","subject","predicate",r):this._findInIndex(i.subjects,null,null,null,"subject","predicate","object",r):[]},count:function(e,t,n,r){var a=this._prefixes;return this.countByIRI(i(e,a),i(t,a),i(n,a),i(r,a))},countByIRI:function(e,t,n,r){r=r||"";var i=this._graphs[r],a=this._entities;return i?e&&!(e=a[e])?0:t&&!(t=a[t])?0:n&&!(n=a[n])?0:e?n?this._countInIndex(i.objects,n,e,t):this._countInIndex(i.subjects,e,t,n):t?this._countInIndex(i.predicates,t,n,e):this._countInIndex(i.objects,n,e,t):0},createBlankNode:function(e){var t,n;if(e)for(t=e="_:"+e,n=1;this._entities[t];)t=e+n++;else do{t="_:b"+this._blankNodeIndex++}while(this._entities[t]);return this._entities[t]=++this._entityCount,t}},e.exports=r},function(e,t,n){var r;r=function(){};t=e.exports={Lexer:r("./lib/N3Lexer"),Parser:r("./lib/N3Parser"),Writer:r("./lib/N3Writer"),Store:r("./lib/N3Store"),StreamParser:r("./lib/N3StreamParser"),StreamWriter:r("./lib/N3StreamWriter"),Util:r("./lib/N3Util")};Object.keys(t).forEach(function(e){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return delete t[e],t[e]=n(477)("./N3"+e)}})})},function(e,t,n){(function(r,i,a){var o;
21
- /*!
22
- * @overview es6-promise - a tiny implementation of Promises/A+.
23
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
24
- * @license Licensed under MIT license
25
- * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
26
- * @version 2.3.0
27
- */
28
- /*!
29
- * @overview es6-promise - a tiny implementation of Promises/A+.
30
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
31
- * @license Licensed under MIT license
32
- * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
33
- * @version 2.3.0
34
- */
35
- (function(){"use strict";function s(e){return"function"==typeof e}function u(){return function(){setTimeout(l,1)}}function l(){for(var e=0;e<E;e+=2){(0,O[e])(O[e+1]),O[e]=void 0,O[e+1]=void 0}E=0}function c(){}function d(e,t){if(t.constructor===e.constructor)!function(e,t){t._state===L?p(e,t._result):t._state===P?m(e,t._result):v(t,void 0,function(t){h(e,t)},function(t){m(e,t)})}(e,t);else{var n=function(e){try{return e.then}catch(e){return D.error=e,D}}(t);n===D?m(e,D.error):void 0===n?p(e,t):s(n)?function(e,t,n){A(function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(t){return t}}(n,t,function(n){r||(r=!0,t===n?p(e,n):h(e,n))},function(t){r||(r=!0,m(e,t))},e._label);!r&&i&&(r=!0,m(e,i))},e)}(e,t,n):p(e,t)}}function h(e,t){e===t?m(e,new TypeError("You cannot resolve a promise with itself")):function(e){return"function"==typeof e||"object"==typeof e&&null!==e}(t)?d(e,t):p(e,t)}function f(e){e._onerror&&e._onerror(e._result),g(e)}function p(e,t){e._state!==R||(e._result=t,e._state=L,0!==e._subscribers.length&&A(g,e))}function m(e,t){e._state!==R||(e._state=P,e._result=t,A(f,e))}function v(e,t,n,r){var i=e._subscribers,a=i.length;e._onerror=null,i[a]=t,i[a+L]=n,i[a+P]=r,0===a&&e._state&&A(g,e)}function g(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,a=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?y(n,r,i,a):i(a);e._subscribers.length=0}}function b(){this.error=null}function y(e,t,n,r){var i,a,o,u,l=s(n);if(l){if((i=function(e,t){try{return e(t)}catch(t){return B.error=t,B}}(n,r))===B?(u=!0,a=i.error,i=null):o=!0,t===i)return void m(t,new TypeError("A promises callback cannot return that same promise."))}else i=r,o=!0;t._state!==R||(l&&o?h(t,i):u?m(t,a):e===L?p(t,i):e===P&&m(t,i))}function w(e,t){var n=this;n._instanceConstructor=e,n.promise=new e(c),n._validateInput(t)?(n._input=t,n.length=t.length,n._remaining=t.length,n._init(),0===n.length?p(n.promise,n._result):(n.length=n.length||0,n._enumerate(),0===n._remaining&&p(n.promise,n._result))):m(n.promise,n._validationError())}function _(e){this._id=W++,this._state=void 0,this._result=void 0,this._subscribers=[],c!==e&&(!s(e)&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),!(this instanceof _)&&function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}(),function(e,t){try{t(function(t){h(e,t)},function(t){m(e,t)})}catch(t){m(e,t)}}(this,e))}var x,M,k,C=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},E=0,A=function(e,t){O[E]=e,O[E+1]=t,2==(E+=2)&&(M?M(l):k())},T="undefined"==typeof window?void 0:window,S=T||{},I=S.MutationObserver||S.WebKitMutationObserver,N=void 0!==r&&"[object process]"==={}.toString.call(r),j="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,O=Array(1e3);k=N?function(){var e=r.nextTick,t=r.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(t)&&"0"===t[1]&&"10"===t[2]&&(e=i),function(){e(l)}}():I?function(){var e=0,t=new I(l),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}():j?function(){var e=new MessageChannel;return e.port1.onmessage=l,function(){e.port2.postMessage(0)}}():void 0!==T?u():function(){try{var e=n(479);return x=e.runOnLoop||e.runOnContext,function(){x(l)}}catch(e){return u()}}();var R,L=1,P=2,D=new b,B=new b;w.prototype._validateInput=function(e){return C(e)},w.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},w.prototype._init=function(){this._result=Array(this.length)};var U=w;w.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,r=e._input,i=0;n._state===R&&i<t;i++)e._eachEntry(r[i],i)},w.prototype._eachEntry=function(e,t){var n=this,r=n._instanceConstructor;!function(e){return"object"==typeof e&&null!==e}(e)?(n._remaining--,n._result[t]=e):e.constructor===r&&e._state!==R?(e._onerror=null,n._settledAt(e._state,t,e._result)):n._willSettleAt(r.resolve(e),t)},w.prototype._settledAt=function(e,t,n){var r=this,i=r.promise;i._state===R&&(r._remaining--,e===P?m(i,n):r._result[t]=n),0===r._remaining&&p(i,r._result)},w.prototype._willSettleAt=function(e,t){var n=this;v(e,void 0,function(e){n._settledAt(L,t,e)},function(e){n._settledAt(P,t,e)})};var q=function(e){return new U(this,e).promise},F=function(e){function t(e){h(r,e)}function n(e){m(r,e)}var r=new this(c);if(!C(e))return m(r,new TypeError("You must pass an array to race.")),r;for(var i=e.length,a=0;r._state===R&&a<i;a++)v(this.resolve(e[a]),void 0,t,n);return r},z=function(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(c);return h(t,e),t},H=function(e){var t=new this(c);return m(t,e),t},W=0,V=_;_.all=q,_.race=F,_.resolve=z,_.reject=H,_._setScheduler=function(e){M=e},_._setAsap=function(e){A=e},_._asap=A,_.prototype={constructor:_,then:function(e,t){var n=this,r=n._state;if(r===L&&!e||r===P&&!t)return this;var i=new this.constructor(c),a=n._result;if(r){var o=arguments[r-1];A(function(){y(r,i,o,a)})}else v(n,i,e,t);return i},catch:function(e){return this.then(null,e)}};var J=function(){var e;if(void 0!==a)e=a;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;t&&"[object Promise]"===Object.prototype.toString.call(t.resolve())&&!t.cast||(e.Promise=V)},G={Promise:V,polyfill:J};void 0!==(o=function(){return G}.call(t,n,t,e))&&(e.exports=o),J()}).call(this)}).call(this,n(11),n(65).setImmediate,n(5))},function(e,t,n){(function(r,i,a,o){var s;
36
- /**
37
- * A JavaScript implementation of the JSON-LD API.
38
- *
39
- * @author Dave Longley
40
- *
41
- * @license BSD 3-Clause License
42
- * Copyright (c) 2011-2015 Digital Bazaar, Inc.
43
- * All rights reserved.
44
- *
45
- * Redistribution and use in source and binary forms, with or without
46
- * modification, are permitted provided that the following conditions are met:
47
- *
48
- * Redistributions of source code must retain the above copyright notice,
49
- * this list of conditions and the following disclaimer.
50
- *
51
- * Redistributions in binary form must reproduce the above copyright
52
- * notice, this list of conditions and the following disclaimer in the
53
- * documentation and/or other materials provided with the distribution.
54
- *
55
- * Neither the name of the Digital Bazaar, Inc. nor the names of its
56
- * contributors may be used to endorse or promote products derived from
57
- * this software without specific prior written permission.
58
- *
59
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
60
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
61
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
62
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
63
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
64
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
65
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
66
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
67
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
68
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
69
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70
- */
71
- /**
72
- * A JavaScript implementation of the JSON-LD API.
73
- *
74
- * @author Dave Longley
75
- *
76
- * @license BSD 3-Clause License
77
- * Copyright (c) 2011-2015 Digital Bazaar, Inc.
78
- * All rights reserved.
79
- *
80
- * Redistribution and use in source and binary forms, with or without
81
- * modification, are permitted provided that the following conditions are met:
82
- *
83
- * Redistributions of source code must retain the above copyright notice,
84
- * this list of conditions and the following disclaimer.
85
- *
86
- * Redistributions in binary form must reproduce the above copyright
87
- * notice, this list of conditions and the following disclaimer in the
88
- * documentation and/or other materials provided with the distribution.
89
- *
90
- * Neither the name of the Digital Bazaar, Inc. nor the names of its
91
- * contributors may be used to endorse or promote products derived from
92
- * this software without specific prior written permission.
93
- *
94
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
95
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
96
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
97
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
98
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
99
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
100
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
101
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
102
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
103
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
104
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
105
- */
106
- !function(){var u=void 0!==r&&r.versions&&r.versions.node,l=!u&&("undefined"!=typeof window||"undefined"!=typeof self);l&&void 0===i&&("undefined"==typeof window?"undefined"==typeof self?"undefined"!=typeof $&&(i=$):i=self:i=window);var c=function(e){function t(){}function s(e){for(var t=[],n=Object.keys(e).sort(),r=0;r<n.length;++r){var i=n[r],a=e[i];P(a)||(a=[a]);for(var o,s=0;s<a.length;++s)if(null!==(o=a[s])){if(!B(o))throw new xe("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:e});t.push({"@value":o,"@language":i.toLowerCase()})}}return t}function c(e,t,n){for(var r=[],i=Object.keys(e).sort(),a=0;a<i.length;++a)for(var o=i[a],s=e[o],u=Object.keys(s).sort(),l=0;l<u.length;++l){var c=u[l],f=s[c];if("@type"===c)c=me;else if(R(c))continue;for(var p=0;p<f.length;++p){var m=f[p],v={};if(v.type=0===o.indexOf("_:")?"blank node":"IRI",v.value=o,G(o)){var g={type:0===c.indexOf("_:")?"blank node":"IRI",value:c};if(G(c)&&("blank node"!==g.type||n.produceGeneralizedRdf))if(V(m))d(m["@list"],t,v,g,r);else{var b=h(m);b&&r.push({subject:v,predicate:g,object:b})}}}}return r}function d(e,t,n,r,i){for(var a={type:"IRI",value:he},o={type:"IRI",value:fe},s={type:"IRI",value:pe},u=0;u<e.length;++u){var l=e[u],c={type:"blank node",value:t.getId()};i.push({subject:n,predicate:r,object:c}),n=c,r=a;var d=h(l);d&&i.push({subject:n,predicate:r,object:d}),r=o}i.push({subject:n,predicate:r,object:s})}function h(e){var t={};if(W(e)){t.type="literal";var n=e["@value"],r=e["@type"]||null;!function(e){return"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e)}(n)?q(n)||r===ue?(!q(n)&&(n=parseFloat(n)),t.value=n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),t.datatype=r||ue):U(n)?(t.value=n.toFixed(0),t.datatype=r||le):"@language"in e?(t.value=n,t.datatype=r||ye,t.language=e["@language"]):(t.value=n,t.datatype=r||ce):(t.value=n.toString(),t.datatype=r||se)}else{var i=L(e)?e["@id"]:e;t.type=0===i.indexOf("_:")?"blank node":"IRI",t.value=i}return"IRI"!==t.type||G(t.value)?t:null}function f(e,t){if("IRI"===e.type||"blank node"===e.type)return{"@id":e.value};var n={"@value":e.value};if(e.language)n["@language"]=e.language;else{var r=e.datatype;if(r||(r=ce),t){if(r===se)"true"===n["@value"]?n["@value"]=!0:"false"===n["@value"]&&(n["@value"]=!1);else if(function(e){return!isNaN(parseFloat(e))&&isFinite(e)}(n["@value"]))if(r===le){var i=parseInt(n["@value"],10);i.toFixed(0)===n["@value"]&&(n["@value"]=i)}else r===ue&&(n["@value"]=parseFloat(n["@value"]));-1===[se,le,ue,ce].indexOf(r)&&(n["@type"]=r)}else r!==ce&&(n["@type"]=r)}return n}function p(e,t){for(var n,r=["subject","predicate","object"],i=0;i<r.length;++i)if(e[n=r[i]].type!==t[n].type||e[n].value!==t[n].value)return!1;return e.object.language===t.object.language&&e.object.datatype===t.object.datatype}function m(t,n,r,i,a,o){if(P(t))for(var s=0;s<t.length;++s)m(t[s],n,r,i,void 0,o);else if(L(t))if(W(t)){"@type"in t&&0===(u=t["@type"]).indexOf("_:")&&(t["@type"]=u=i.getId(u)),o&&o.push(t)}else{if("@type"in t){var u,l=t["@type"];for(s=0;s<l.length;++s)0===(u=l[s]).indexOf("_:")&&i.getId(u)}F(a)&&(a=J(t)?i.getId(t["@id"]):t["@id"]),o&&o.push({"@id":a});var c=n[r],d=c[a]=c[a]||{};d["@id"]=a;for(var h,f=Object.keys(t).sort(),p=0;p<f.length;++p)if("@id"!==(h=f[p])){if("@reverse"===h){var v={"@id":a},g=t["@reverse"];for(var b in g)for(var y=g[b],w=0;w<y.length;++w){var _=y[w],x=_["@id"];J(_)&&(x=i.getId(x)),m(_,n,r,i,x),e.addValue(c[x],b,v,{propertyIsArray:!0,allowDuplicate:!1})}continue}if("@graph"===h){a in n||(n[a]={});var M="@merged"===r?r:a;m(t[h],n,M,i);continue}if("@type"!==h&&R(h)){if("@index"===h&&h in d&&(t[h]!==d[h]||t[h]["@id"]!==d[h]["@id"]))throw new xe("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:d});d[h]=t[h];continue}var k=t[h];if(0===h.indexOf("_:")&&(h=i.getId(h)),0===k.length){e.addValue(d,h,[],{propertyIsArray:!0});continue}for(var C,E=0;E<k.length;++E)if(C=k[E],"@type"===h&&(C=0===C.indexOf("_:")?i.getId(C):C),z(C)||H(C)){var A=J(C)?i.getId(C["@id"]):C["@id"];e.addValue(d,h,{"@id":A},{propertyIsArray:!0,allowDuplicate:!1}),m(C,n,r,i,A)}else if(V(C)){var T=[];m(C["@list"],n,r,i,a,T),C={"@list":T},e.addValue(d,h,C,{propertyIsArray:!0,allowDuplicate:!1})}else m(C,n,r,i,a),e.addValue(d,h,C,{propertyIsArray:!0,allowDuplicate:!1})}}else o&&o.push(t)}function v(e){for(var t,n=e["@default"],r=Object.keys(e).sort(),i=0;i<r.length;++i)if("@default"!==(t=r[i])){var a=e[t],o=n[t];o?!("@graph"in o)&&(o["@graph"]=[]):n[t]=o={"@id":t,"@graph":[]};for(var s,u=o["@graph"],l=Object.keys(a).sort(),c=0;c<l.length;++c)H(s=a[l[c]])||u.push(s)}return n}function g(e,t,n,r,i){(function(e){if(!P(e)||1!==e.length||!L(e[0]))throw new xe("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e})})(n),n=n[0];for(var a=e.options,o={embed:w(n,a,"embed"),explicit:w(n,a,"explicit"),requireAll:w(n,a,"requireAll")},s=_(e,t,n,o),u=Object.keys(s).sort(),l=0;l<u.length;++l){var c=u[l],d=s[c];if("@link"===o.embed&&c in e.link)k(r,i,e.link[c]);else{null===i&&(e.uniqueEmbeds={});var h={};if(h["@id"]=c,e.link[c]=h,"@never"===o.embed||y(d,e.subjectStack))k(r,i,h);else{"@last"===o.embed&&(c in e.uniqueEmbeds&&M(e,c),e.uniqueEmbeds[c]={parent:r,property:i}),e.subjectStack.push(d);for(var f=Object.keys(d).sort(),p=0;p<f.length;p++)if(R(S=f[p]))h[S]=K(d[S]);else if(!o.explicit||S in n)for(var m,v=d[S],x=0;x<v.length;++x)if(V(m=v[x])){var C={"@list":[]};k(h,S,C);var E=m["@list"];for(var A in E)if(H(m=E[A])){var T=S in n?n[S][0]["@list"]:b(o);g(e,[m["@id"]],T,C,"@list")}else k(C,"@list",K(m))}else if(H(m)){T=S in n?n[S]:b(o);g(e,[m["@id"]],T,h,S)}else k(h,S,K(m));var S;for(f=Object.keys(n).sort(),p=0;p<f.length;++p)if(!R(S=f[p])){var I=n[S][0];if(!(w(I,a,"omitDefault")||S in h)){var N="@null";"@default"in I&&(N=K(I["@default"])),P(N)||(N=[N]),h[S]=[{"@preserve":N}]}}k(r,i,h),e.subjectStack.pop()}}}}function b(e){var t={};for(var n in e)void 0!==e[n]&&(t["@"+n]=[e[n]]);return[t]}function y(e,t){for(var n=t.length-1;0<=n;--n)if(t[n]["@id"]===e["@id"])return!0;return!1}function w(e,t,n){var r="@"+n,i=r in e?e[r][0]:t[n];return"embed"===n&&(!0===i?i="@last":!1===i?i="@never":"@always"!==i&&"@never"!==i&&"@link"!==i&&(i="@last")),i}function _(e,t,n,r){for(var i={},a=0;a<t.length;++a){var o=t[a],s=e.subjects[o];x(s,n,r)&&(i[o]=s)}return i}function x(t,n,r){if("@type"in n&&(1!==n["@type"].length||!L(n["@type"][0]))){for(var i=n["@type"],a=0;a<i.length;++a)if(e.hasValue(t,"@type",i[a]))return!0;return!1}var o=!0,s=!1;for(var u in n){if(R(u)){if("@id"!=u&&"@type"!=u)continue;if(o=!1,"@id"==u&&B(n[u])){if(t[u]!==n[u])return!1;s=!0;continue}}if(o=!1,u in t){if(P(n[u])&&0===n[u].length&&void 0!==t[u])return!1;s=!0}else{var l=P(n[u])&&L(n[u][0])&&"@default"in n[u][0];if(r.requireAll&&!l)return!1}}return o||s}function M(t,n){var r=t.uniqueEmbeds,i=r[n],a=i.parent,o=i.property,s={"@id":n};if(P(a)){for(var u=0;u<a.length;++u)if(e.compareValues(a[u],s)){a[u]=s;break}}else{var l=P(a[o]);e.removeValue(a,o,s,{propertyIsArray:l}),e.addValue(a,o,s,{propertyIsArray:l})}var c=function(e){for(var t,n=Object.keys(r),i=0;i<n.length;++i)(t=n[i])in r&&L(r[t].parent)&&r[t].parent["@id"]===e&&(delete r[t],c(t))};c(n)}function k(t,n,r){L(t)?e.addValue(t,n,r,{propertyIsArray:!0}):t.push(r)}
107
- /**
108
- * Removes the @preserve keywords as the last step of the framing algorithm.
109
- *
110
- * @param ctx the active context used to compact the input.
111
- * @param input the framed, compacted output.
112
- * @param options the compaction options used.
113
- *
114
- * @return the resulting output.
115
- */function C(t,n,r){if(P(n)){for(var i=[],a=0;a<n.length;++a)null!==(c=C(t,n[a],r))&&i.push(c);n=i}else if(L(n)){// remove @preserve
116
- if("@preserve"in n)return"@null"===n["@preserve"]?null:n["@preserve"];if(W(n))return n;if(V(n))return n["@list"]=C(t,n["@list"],r),n;var o=T(t,"@id");if(o in n){var s=n[o];if(s in r.link){var u=r.link[s].indexOf(n);if(-1!==u)return r.link[s][u];r.link[s].push(n)}else r.link[s]=[n]}for(var l in n){var c=C(t,n[l],r),d=e.getContextValue(t,l,"@container");r.compactArrays&&P(c)&&1===c.length&&null===d&&(c=c[0]),n[l]=c}}return n}function E(e,t){return e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1}function A(e,t,n,r,i,a){null===a&&(a="@null");var o=[];if("@id"!==a&&"@reverse"!==a||!H(n))o.push(a);else{"@reverse"===a&&o.push("@reverse");var s=T(e,n["@id"],null,{vocab:!0});s in e.mappings&&e.mappings[s]&&e.mappings[s]["@id"]===n["@id"]?o.push.apply(o,["@vocab","@id"]):o.push.apply(o,["@id","@vocab"])}o.push("@none");for(var u,l=e.inverse[t],c=0;c<r.length;++c)if((u=r[c])in l)for(var d,h=l[u][i],f=0;f<o.length;++f)if((d=o[f])in h)return h[d];return null}function T(e,t,n,r,i){if(null===t)return t;F(n)&&(n=null),F(i)&&(i=!1),r=r||{};var a=e.getInverse();if(R(t))return t in a?a[t]["@none"]["@type"]["@none"]:t;if(r.vocab&&t in a){var o=e["@language"]||"@none",s=[];L(n)&&"@index"in n&&s.push("@index");var u="@language",l="@null";if(i)u="@type",l="@reverse",s.push("@set");else if(V(n)){"@index"in n||s.push("@list");for(var c=n["@list"],d=0===c.length?o:null,h=null,f=0;f<c.length;++f){var p=c[f],m="@none",v="@none";if(W(p)?"@language"in p?m=p["@language"]:"@type"in p?v=p["@type"]:m="@null":v="@id",null===d?d=m:m!==d&&W(p)&&(d="@none"),null==h?h=v:v!==h&&(h="@none"),"@none"===d&&"@none"===h)break}d=d||"@none","@none"===(h=h||"@none")?l=d:(u="@type",l=h)}else W(n)?"@language"in n&&!("@index"in n)?(s.push("@language"),l=n["@language"]):"@type"in n&&(u="@type",l=n["@type"]):(u="@type",l="@id"),s.push("@set");s.push("@none");var g=A(e,t,n,s,u,l);if(null!==g)return g}if(r.vocab&&"@vocab"in e){var b=e["@vocab"];if(0===t.indexOf(b)&&t!==b){var y=t.substr(b.length);if(!(y in e.mappings))return y}}for(var w=null,_=0,x=[],M=e.fastCurieMap,k=t.length-1;_<k&&t[_]in M;++_)""in(M=M[t[_]])&&x.push(M[""][0]);for(f=x.length-1;0<=f;--f)for(var C=x[f],T=C.terms,S=0;S<T.length;++S){var I=T[S]+":"+t.substr(C.iri.length);(!(I in e.mappings)||null===n&&e.mappings[I]["@id"]===t)&&(null==w||0>E(I,w))&&(w=I)}return null===w?r.vocab?t:j(e["@base"],t):w}function S(e,t,n,r){if(n in r){if(r[n])return;throw new xe("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:n})}if(r[n]=!1,R(n))throw new xe("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:n});if(""===n)throw new xe("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t});e.mappings[n]&&delete e.mappings[n];var i=t[n];if(null===i||L(i)&&null===i["@id"])return e.mappings[n]=null,void(r[n]=!0);if(B(i)&&(i={"@id":i}),!L(i))throw new xe("Invalid JSON-LD syntax; @context property values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});var a=e.mappings[n]={};if(a.reverse=!1,"@reverse"in i){if("@id"in i)throw new xe("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});var o=i["@reverse"];if(!B(o))throw new xe("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(!G(s=I(e,o,{vocab:!0,base:!1},t,r)))throw new xe("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});a["@id"]=s,a.reverse=!0}else if("@id"in i){if(!B(s=i["@id"]))throw new xe("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(s!==n){if(!G(s=I(e,s,{vocab:!0,base:!1},t,r))&&!R(s))throw new xe("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});a["@id"]=s}}var s,u=n.indexOf(":");if(a._termHasColon=-1!==u,!("@id"in a))if(a._termHasColon){var l=n.substr(0,u);if(l in t&&S(e,t,l,r),e.mappings[l]){var c=n.substr(u+1);a["@id"]=e.mappings[l]["@id"]+c}else a["@id"]=n}else{if(!("@vocab"in e))throw new xe("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:n});a["@id"]=e["@vocab"]+n}if(r[n]=!0,"@type"in i){var d=i["@type"];if(!B(d))throw new xe("Invalid JSON-LD syntax; an @context @type values must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@id"!==d&&"@vocab"!==d){if(!G(d=I(e,d,{vocab:!0,base:!1},t,r)))throw new xe("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===d.indexOf("_:"))throw new xe("Invalid JSON-LD syntax; an @context @type values must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}a["@type"]=d}if("@container"in i){var h=i["@container"];if("@list"!==h&&"@set"!==h&&"@index"!==h&&"@language"!==h)throw new xe("Invalid JSON-LD syntax; @context @container value must be one of the following: @list, @set, @index, or @language.","jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(a.reverse&&"@index"!==h&&"@set"!==h&&null!==h)throw new xe("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});a["@container"]=h}if("@language"in i&&!("@type"in i)){var f=i["@language"];if(null!==f&&!B(f))throw new xe("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==f&&(f=f.toLowerCase()),a["@language"]=f}// disallow aliasing @context and @preserve
117
- if("@context"===(s=a["@id"])||"@preserve"===s)throw new xe("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t})}function I(t,n,r,i,a){if(null===n||R(n))return n;if(n+="",i&&n in i&&!0!==a[n]&&S(t,i,n,a),(r=r||{}).vocab){if(null===(s=t.mappings[n]))return null;if(s)return s["@id"]}var o=n.indexOf(":");if(-1!==o){var s,u=n.substr(0,o),l=n.substr(o+1);return"_"===u||0===l.indexOf("//")?n:(i&&u in i&&S(t,i,u,a),(s=t.mappings[u])?s["@id"]+l:n)}if(r.vocab&&"@vocab"in t)return t["@vocab"]+n;var c=n;return r.base&&(c=e.prependBase(t["@base"],c)),c}function N(t,n){if(null===t)return n;if(-1!==n.indexOf(":"))return n;B(t)&&(t=e.url.parse(t||""));var r=e.url.parse(n),i={protocol:t.protocol||""};if(null!==r.authority)i.authority=r.authority,i.path=r.path,i.query=r.query;else if(i.authority=t.authority,""===r.path)i.path=t.path,i.query=null===r.query?t.query:r.query;else{if(0===r.path.indexOf("/"))i.path=r.path;else{var a=t.path;""!==r.path&&(0<(a=a.substr(0,a.lastIndexOf("/")+1)).length&&"/"!==a.substr(-1)&&(a+="/"),a+=r.path),i.path=a}i.query=r.query}i.path=ee(i.path,!!i.authority);var o=i.protocol;return null!==i.authority&&(o+="//"+i.authority),o+=i.path,null!==i.query&&(o+="?"+i.query),null!==r.fragment&&(o+="#"+r.fragment),""===o&&(o="./"),o}function j(t,n){if(null===t)return n;B(t)&&(t=e.url.parse(t||""));var r="";if(""===t.href?n.indexOf("//")&&(r+="//"):r+=(t.protocol||"")+"//"+(t.authority||""),0!==n.indexOf(r))return n;for(var i=e.url.parse(n.substr(r.length)),a=t.normalizedPath.split("/"),o=i.normalizedPath.split("/"),s=i.fragment||i.query?0:1;0<a.length&&o.length>s&&a[0]===o[0];)a.shift(),o.shift();var u="";if(0<a.length){a.pop();for(var l=0;l<a.length;++l)u+="../"}return u+=o.join("/"),null!==i.query&&(u+="?"+i.query),null!==i.fragment&&(u+="#"+i.fragment),""===u&&(u="./"),u}function O(t){function n(e,t,r){for(var i,a,o=e[t],s=e[t]={},u=0;u<o.length;++u)(a=r>=(i=o[u].iri).length?"":i[r])in s?s[a].push(o[u]):s[a]=[o[u]];for(var t in s)""!==t&&n(s,t,r+1)}function r(e,t,n,r){r in n||(n[r]=t)}return{"@base":e.url.parse(t.base||""),mappings:{},inverse:null,getInverse:function(){var e=this;if(e.inverse)return e.inverse;for(var t=e.inverse={},i=e.fastCurieMap={},a={},o=e["@language"]||"@none",s=e.mappings,u=Object.keys(s).sort(E),l=0;l<u.length;++l){var c=u[l],d=s[c];if(null!==d){var h=d["@container"]||"@none",f=d["@id"];P(f)||(f=[f]);for(var p=0;p<f.length;++p){var m=f[p],v=t[m],g=R(m);if(v)g||d._termHasColon||a[m].push(c);else if(t[m]=v={},!g&&!d._termHasColon){a[m]=[c];var b={iri:m,terms:a[m]};m[0]in i?i[m[0]].push(b):i[m[0]]=[b]}if(v[h]||(v[h]={"@language":{},"@type":{}}),v=v[h],d.reverse)r(0,c,v["@type"],"@reverse");else if("@type"in d)r(0,c,v["@type"],d["@type"]);else if("@language"in d){var y=d["@language"]||"@null";r(0,c,v["@language"],y)}else r(0,c,v["@language"],o),r(0,c,v["@type"],"@none"),r(0,c,v["@language"],"@none")}}}for(var w in i)n(i,w,1);return t},clone:function(){var e={};return e["@base"]=this["@base"],e.mappings=K(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e}}}function R(e){return!!B(e)&&("@base"===e||"@context"===e||"@container"===e||"@default"===e||"@embed"===e||"@explicit"===e||"@graph"===e||"@id"===e||"@index"===e||"@language"===e||"@list"===e||"@omitDefault"===e||"@preserve"===e||"@requireAll"===e||"@reverse"===e||"@set"===e||"@type"===e||"@value"===e||"@vocab"===e)}function L(e){return"[object Object]"===Object.prototype.toString.call(e)}function P(e){return Array.isArray(e)}function D(e){if(!B(e)&&!function(e){return L(e)&&0===Object.keys(e).length}(e)){var t=!1;if(P(e)){t=!0;for(var n=0;n<e.length;++n)if(!B(e[n])){t=!1;break}}if(!t)throw new xe('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, or an empty object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})}}function B(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)}function U(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function q(e){return U(e)&&-1!==(e+"").indexOf(".")}function F(e){return void 0===e}function z(e){var t=!1;L(e)&&!("@value"in e||"@set"in e||"@list"in e)&&(t=1<Object.keys(e).length||!("@id"in e));return t}function H(e){return L(e)&&1===Object.keys(e).length&&"@id"in e}function W(e){return L(e)&&"@value"in e}function V(e){return L(e)&&"@list"in e}function J(e){var t=!1;return L(e)&&(t="@id"in e?0===e["@id"].indexOf("_:"):0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e)),t}function G(e){return B(e)&&-1!==e.indexOf(":")}function K(e){if(e&&"object"==typeof e){var t;if(P(e)){t=[];for(var n=0;n<e.length;++n)t[n]=K(e[n])}else if(L(e))for(var r in t={},e)t[r]=K(e[r]);else t=e.toString();return t}return e}function $(t,n,r,i){var a=Object.keys(n).length;if(P(t)){for(var o=0;o<t.length;++o)$(t[o],n,r,i);return a<Object.keys(n).length}if(L(t)){for(var s in t)if("@context"==s){var u=t[s];if(P(u)){var l,c=u.length;for(o=0;o<c;++o)B(l=u[o])&&(l=e.prependBase(i,l),r?P(l=n[l])?(Array.prototype.splice.apply(u,[o,1].concat(l)),o+=l.length-1,c=u.length):u[o]=l:!(l in n)&&(n[l]=!1))}else B(u)&&(u=e.prependBase(i,u),r?t[s]=n[u]:!(u in n)&&(n[u]=!1))}else $(t[s],n,r,i);return a<Object.keys(n).length}return!1}function X(e,t,n){var r=null,i=t.documentLoader,a=function(e,t,n,i,o){if(Object.keys(t).length>_e)return r=new xe("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"loading remote context failed",max:_e}),o(r);var s={},u=function(){$(e,s,!0,i),o(null,e)};if(!$(e,s,!1,i))return u();var l=[];for(var c in s)!1===s[c]&&l.push(c);for(var d=l.length,h=0;h<l.length;++h)!function(e){if(e in t)return r=new xe("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"recursive context inclusion",url:e}),o(r);var i=K(t);i[e]=!0;var l=function(t,l){if(!r){var c=l?l.document:null;if(!t&&B(c))try{c=JSON.parse(c)}catch(e){t=e}return t?t=new xe("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}):!L(c)&&(t=new xe("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,cause:t})),t?o(r=t):(c="@context"in c?{"@context":c["@context"]}:{"@context":{}},l.contextUrl&&(!P(c["@context"])&&(c["@context"]=[c["@context"]]),c["@context"].push(l.contextUrl)),void a(c,i,n,e,function(t,n){return t?o(t):(s[e]=n["@context"],void(0===(d-=1)&&u()))}))}},c=n(e,l);c&&"then"in c&&c.then(l.bind(null,null),l)}(l[h])};a(e,{},i,t.base,n)}function Z(e){for(var t,n=/^[ \t]*(?:#.*)?$/,r=/^[ \t]*(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-z0-9]+)))[ \t]+(?:<([^:]+:[^>]*)>)[ \t]+(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-z0-9]+))|(?:"([^"\\]*(?:\\.[^"\\]*)*)"(?:(?:\^\^(?:<([^:]+:[^>]*)>))|(?:@([a-z]+(?:-[a-z0-9]+)*)))?))[ \t]*(?:\.|(?:(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-z0-9]+)))[ \t]*\.))[ \t]*(?:#.*)?$/,i={},a=e.split(/(?:\r\n)|(?:\n)|(?:\r)/g),o=0,s=0;s<a.length;++s)if(t=a[s],o++,!n.test(t)){var u=t.match(r);if(null===u)throw new xe("Error while parsing N-Quads; invalid quad.","jsonld.ParseError",{line:o});var l={};if(l.subject=F(u[1])?{type:"blank node",value:u[2]}:{type:"IRI",value:u[1]},l.predicate={type:"IRI",value:u[3]},F(u[4]))if(F(u[5])){l.object={type:"literal"},F(u[7])?F(u[8])?l.object.datatype=ce:(l.object.datatype=ye,l.object.language=u[8]):l.object.datatype=u[7];var c=u[6].replace(/\\"/g,'"').replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\\\/g,"\\");l.object.value=c}else l.object={type:"blank node",value:u[5]};else l.object={type:"IRI",value:u[4]};var d="@default";if(F(u[9])?!F(u[10])&&(d=u[10]):d=u[9],d in i){for(var h=!0,f=i[d],m=0;h&&m<f.length;++m)p(f[m],l)&&(h=!1);h&&f.push(l)}else i[d]=[l]}return i}function Y(e,t){var n=e.subject,r=e.predicate,i=e.object,a=t||null;"name"in e&&e.name&&(a=e.name.value);var o="";if(o+="IRI"===n.type?"<"+n.value+">":n.value,o+=" ",o+="IRI"===r.type?"<"+r.value+">":r.value,o+=" ","IRI"===i.type)o+="<"+i.value+">";else if("blank node"===i.type)o+=i.value;else{o+='"'+i.value.replace(/\\/g,"\\\\").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\"/g,'\\"')+'"',i.datatype===ye?i.language&&(o+="@"+i.language):i.datatype!==ce&&(o+="^^<"+i.datatype+">")}return null!==a&&void 0!==a&&(0===a.indexOf("_:")?o+=" "+a:o+=" <"+a+">"),o+=" .\n"}function Q(e){this.prefix=e,this.counter=0,this.existing={}}function ee(e,t){var n="";0===e.indexOf("/")&&(n="/");for(var r=e.split("/"),i=[];0<r.length;)"."===r[0]||""===r[0]&&1<r.length?r.shift():".."!==r[0]?i.push(r.shift()):(r.shift(),t||0<i.length&&".."!==i[i.length-1]?i.pop():i.push(".."));return n+i.join("/")}e.compact=function(t,n,r,i){function a(e,t,r,a){if(e)return i(e);a.compactArrays&&!a.graph&&P(t)?1===t.length?t=t[0]:0===t.length&&(t={}):a.graph&&L(t)&&(t=[t]),L(n)&&"@context"in n&&(n=n["@context"]),P(n=K(n))||(n=[n]);var o=n;n=[];for(var s=0;s<o.length;++s)(!L(o[s])||0<Object.keys(o[s]).length)&&n.push(o[s]);var u=0<n.length;if(1===n.length&&(n=n[0]),P(t)){var l=T(r,"@graph"),c=t;t={},u&&(t["@context"]=n),t[l]=c}else if(L(t)&&u){c=t;for(var d in t={"@context":n},c)t[d]=c[d]}i(null,t,r)}if(2>arguments.length)return e.nextTick(function(){i(new TypeError("Could not compact, too few arguments."))});if("function"==typeof r&&(i=r,r={}),r=r||{},null===n)return e.nextTick(function(){i(new xe("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"}))});if(null===t)return e.nextTick(function(){i(null,null)});"base"in r||(r.base="string"==typeof t?t:""),"compactArrays"in r||(r.compactArrays=!0),"graph"in r||(r.graph=!1),"skipExpansion"in r||(r.skipExpansion=!1),"documentLoader"in r||(r.documentLoader=e.loadDocument),"link"in r||(r.link=!1),r.link&&(r.skipExpansion=!0);!function(t,n,r){n.skipExpansion?e.nextTick(function(){r(null,t)}):e.expand(t,n,r)}(t,r,function(t,o){if(t)return i(new xe("Could not expand input before compaction.","jsonld.CompactError",{cause:t}));var s=O(r);e.processContext(s,n,r,function(e,t){if(e)return i(new xe("Could not process context before compaction.","jsonld.CompactError",{cause:e}));var n;try{n=(new Me).compact(t,null,o,r)}catch(e){return i(e)}a(null,n,t,r)})})},e.expand=function(t,n,r){function i(e){"base"in n||(n.base=e.documentUrl||"");var t={document:K(e.document),remoteContext:{"@context":e.contextUrl}};if("expandContext"in n){var i=K(n.expandContext);t.expandContext="object"==typeof i&&"@context"in i?i:{"@context":i}}X(t,n,function(e,t){if(e)return r(e);var i;try{var a=new Me,o=O(n),s=t.document,u=t.remoteContext["@context"];t.expandContext&&(o=a.processContext(o,t.expandContext["@context"],n)),u&&(o=a.processContext(o,u,n)),L(i=a.expand(o,null,s,n,!1))&&"@graph"in i&&1===Object.keys(i).length?i=i["@graph"]:null===i&&(i=[]),P(i)||(i=[i])}catch(e){return r(e)}r(null,i)})}return 1>arguments.length?e.nextTick(function(){r(new TypeError("Could not expand, too few arguments."))}):("function"==typeof n&&(r=n,n={}),!("documentLoader"in(n=n||{}))&&(n.documentLoader=e.loadDocument),!("keepFreeFloatingNodes"in n)&&(n.keepFreeFloatingNodes=!1),void e.nextTick(function(){if("string"!=typeof t)i({contextUrl:null,documentUrl:null,document:t});else{var e=function(e,t){if(e)return r(e);try{if(!t.document)throw new xe("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof t.document&&(t.document=JSON.parse(t.document))}catch(e){return r(new xe("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:t}))}i(t)},a=n.documentLoader(t,e);a&&"then"in a&&a.then(e.bind(null,null),e)}}))},e.flatten=function(t,n,r,i){return 1>arguments.length?e.nextTick(function(){i(new TypeError("Could not flatten, too few arguments."))}):("function"==typeof r?(i=r,r={}):"function"==typeof n&&(i=n,n=null,r={}),!("base"in(r=r||{}))&&(r.base="string"==typeof t?t:""),!("documentLoader"in r)&&(r.documentLoader=e.loadDocument),void e.expand(t,r,function(t,a){if(t)return i(new xe("Could not expand input before flattening.","jsonld.FlattenError",{cause:t}));var o;try{o=(new Me).flatten(a)}catch(t){return i(t)}return null===n?i(null,o):(r.graph=!0,r.skipExpansion=!0,void e.compact(o,n,r,function(e,t){return e?i(new xe("Could not compact flattened output.","jsonld.FlattenError",{cause:e})):void i(null,t)}))}))},e.frame=function(t,n,r,i){function a(n){var a,o=n.document;o?(a=o["@context"],n.contextUrl?(a?P(a)?a.push(n.contextUrl):a=[a,n.contextUrl]:a=n.contextUrl,o["@context"]=a):a=a||{}):a={},e.expand(t,r,function(t,n){if(t)return i(new xe("Could not expand input before framing.","jsonld.FrameError",{cause:t}));var s=K(r);s.isFrame=!0,s.keepFreeFloatingNodes=!0,e.expand(o,s,function(t,r){if(t)return i(new xe("Could not expand frame before framing.","jsonld.FrameError",{cause:t}));var o;try{o=(new Me).frame(n,r,s)}catch(t){return i(t)}s.graph=!0,s.skipExpansion=!0,s.link={},e.compact(o,a,s,function(e,t,n){if(e)return i(new xe("Could not compact framed output.","jsonld.FrameError",{cause:e}));var r=T(n,"@graph");// remove @preserve from results
118
- s.link={},t[r]=C(n,t[r],s),i(null,t)})})})}return 2>arguments.length?e.nextTick(function(){i(new TypeError("Could not frame, too few arguments."))}):("function"==typeof r&&(i=r,r={}),!("base"in(r=r||{}))&&(r.base="string"==typeof t?t:""),!("documentLoader"in r)&&(r.documentLoader=e.loadDocument),!("embed"in r)&&(r.embed="@last"),r.explicit=r.explicit||!1,!("requireAll"in r)&&(r.requireAll=!0),r.omitDefault=r.omitDefault||!1,void e.nextTick(function(){if("string"!=typeof n)a({contextUrl:null,documentUrl:null,document:n});else{var e=function(e,t){if(e)return i(e);try{if(!t.document)throw new xe("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof t.document&&(t.document=JSON.parse(t.document))}catch(e){return i(new xe("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:t}))}a(t)},t=r.documentLoader(n,e);t&&"then"in t&&t.then(e.bind(null,null),e)}}))},e.link=function(t,n,r,i){var a={};n&&(a["@context"]=n),a["@embed"]="@link",e.frame(t,a,r,i)},e.objectify=function(t,n,r,i){"function"==typeof r&&(i=r,r={}),"base"in(r=r||{})||(r.base="string"==typeof t?t:""),"documentLoader"in r||(r.documentLoader=e.loadDocument),e.expand(t,r,function(t,a){if(t)return i(new xe("Could not expand input before linking.","jsonld.LinkError",{cause:t}));var o;try{o=(new Me).flatten(a)}catch(t){return i(t)}r.graph=!0,r.skipExpansion=!0,e.compact(o,n,r,function(t,n,r){if(t)return i(new xe("Could not compact flattened output before linking.","jsonld.LinkError",{cause:t}));var a=n[T(r,"@graph")][0],o=function(t){if(L(t)||P(t)){if(L(t)){if(o.visited[t["@id"]])return;o.visited[t["@id"]]=!0}for(var n in t){var i=t[n],s="@id"===e.getContextValue(r,n,"@type");if(P(i)||L(i)||s)if(B(i)&&s)t[n]=i=a[i],o(i);else if(P(i))for(var u=0;u<i.length;++u)B(i[u])&&s?i[u]=a[i[u]]:L(i[u])&&"@id"in i[u]&&(i[u]=a[i[u]["@id"]]),o(i[u]);else if(L(i)){var l=i["@id"];t[n]=i=a[l],o(i)}}}};for(var s in o.visited={},o(a),n.of_type={},a)if("@type"in a[s]){var u=a[s]["@type"];P(u)||(u=[u]);for(var l=0;l<u.length;++l)u[l]in n.of_type||(n.of_type[u[l]]=[]),n.of_type[u[l]].push(a[s])}i(null,n)})})},e.normalize=function(t,n,r){if(1>arguments.length)return e.nextTick(function(){r(new TypeError("Could not normalize, too few arguments."))});if("function"==typeof n&&(r=n,n={}),"algorithm"in(n=n||{})||(n.algorithm="URGNA2012"),"base"in n||(n.base="string"==typeof t?t:""),"documentLoader"in n||(n.documentLoader=e.loadDocument),"inputFormat"in n){if("application/nquads"!==n.inputFormat)return r(new xe("Unknown normalization input format.","jsonld.NormalizeError"));var i=Z(t);(new Me).normalize(i,n,r)}else{var a=K(n);delete a.format,a.produceGeneralizedRdf=!1,e.toRDF(t,a,function(e,t){return e?r(new xe("Could not convert input to RDF dataset before normalization.","jsonld.NormalizeError",{cause:e})):void(new Me).normalize(t,n,r)})}},e.fromRDF=function(t,n,r){return 1>arguments.length?e.nextTick(function(){r(new TypeError("Could not convert from RDF, too few arguments."))}):("function"==typeof n&&(r=n,n={}),!("useRdfType"in(n=n||{}))&&(n.useRdfType=!1),!("useNativeTypes"in n)&&(n.useNativeTypes=!1),!("format"in n)&&B(t)&&!("format"in n)&&(n.format="application/nquads"),void e.nextTick(function(){function e(e,t,n){(new Me).fromRDF(e,t,n)}var i;if(n.format){if(!(i=n.rdfParser||ie[n.format]))return r(new xe("Unknown input format.","jsonld.UnknownFormat",{format:n.format}))}else i=function(){return t};var a=!1;try{t=i(t,function(t,i){return a=!0,t?r(t):void e(i,n,r)})}catch(e){if(!a)return r(e);throw e}if(t){if("then"in t)return t.then(function(t){e(t,n,r)},r);e(t,n,r)}}))},e.toRDF=function(t,n,r){return 1>arguments.length?e.nextTick(function(){r(new TypeError("Could not convert to RDF, too few arguments."))}):("function"==typeof n&&(r=n,n={}),!("base"in(n=n||{}))&&(n.base="string"==typeof t?t:""),!("documentLoader"in n)&&(n.documentLoader=e.loadDocument),void e.expand(t,n,function(e,t){if(e)return r(new xe("Could not expand input before serialization to RDF.","jsonld.RdfError",{cause:e}));var i;try{if(i=Me.prototype.toRDF(t,n),n.format){if("application/nquads"===n.format)return r(null,function(e){var t=[];for(var n in e)for(var r,i=e[n],a=0;a<i.length;++a)r=i[a],"@default"==n&&(n=null),t.push(Y(r,n));return t.sort().join("")}(i));throw new xe("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}}catch(e){return r(e)}r(null,i)}))},e.createNodeMap=function(t,n,r){return 1>arguments.length?e.nextTick(function(){r(new TypeError("Could not create node map, too few arguments."))}):("function"==typeof n&&(r=n,n={}),!("base"in(n=n||{}))&&(n.base="string"==typeof t?t:""),!("documentLoader"in n)&&(n.documentLoader=e.loadDocument),void e.expand(t,n,function(e,t){if(e)return r(new xe("Could not expand input before creating node map.","jsonld.CreateNodeMapError",{cause:e}));var i;try{i=(new Me).createNodeMap(t,n)}catch(e){return r(e)}r(null,i)}))},e.merge=function(t,n,r,i){function a(e,t){return l?void 0:e?(l=e,i(new xe("Could not expand input before flattening.","jsonld.FlattenError",{cause:e}))):(u.push(t),void(0==--c&&o(u)))}function o(t){var a=!0;"mergeNodes"in r&&(a=r.mergeNodes);var o,s=r.namer||r.issuer||new Q("_:b"),u={"@default":{}};try{for(var l,c=0;c<t.length;++c){l=t[c],l=e.relabelBlankNodes(l,{issuer:new Q("_:b"+c+"-")});var d=a||0===c?u:{"@default":{}};if(m(l,d,"@default",s),d!==u)for(var h in d){var f=d[h];if(h in u){var p=u[h];for(var g in f)g in p||(p[g]=f[g])}else u[h]=f}}o=v(u)}catch(t){return i(t)}for(var b,y=[],w=Object.keys(o).sort(),_=0;_<w.length;++_)H(b=o[w[_]])||y.push(b);return null===n?i(null,y):(r.graph=!0,r.skipExpansion=!0,void e.compact(y,n,r,function(e,t){return e?i(new xe("Could not compact merged output.","jsonld.MergeError",{cause:e})):void i(null,t)}))}if(1>arguments.length)return e.nextTick(function(){i(new TypeError("Could not merge, too few arguments."))});if(!P(t))return e.nextTick(function(){i(new TypeError('Could not merge, "docs" must be an array.'))});"function"==typeof r?(i=r,r={}):"function"==typeof n&&(i=n,n=null,r={}),r=r||{};for(var s,u=[],l=null,c=t.length,d=0;d<t.length;++d){for(var h in s={},r)s[h]=r[h];e.expand(t[d],s,a)}},e.relabelBlankNodes=function(e,t){return function e(t,n){if(P(n))for(var r=0;r<n.length;++r)n[r]=e(t,n[r]);else if(V(n))n["@list"]=e(t,n["@list"]);else if(L(n)){J(n)&&(n["@id"]=t.getId(n["@id"]));for(var i,a=Object.keys(n).sort(),o=0;o<a.length;++o)"@id"!==(i=a[o])&&(n[i]=e(t,n[i]))}return n}((t=t||{}).namer||t.issuer||new Q("_:b"),e)},e.prependBase=function(e,t){return N(e,t)},e.documentLoader=function(t,n){var r=new xe("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed"});return u?n(r,{contextUrl:null,documentUrl:t,document:null}):e.promisify(function(e){e(r)})},e.loadDocument=function(t,n){var r=e.documentLoader(t,n);r&&"then"in r&&r.then(n.bind(null,null),n)},e.promises=function(t){t=t||{};var r=Array.prototype.slice,a=e.promisify,o=t.api||{},s=t.version||"jsonld.js";"string"==typeof t.api&&(!t.version&&(s=t.api),o={}),o.expand=function(t){if(1>arguments.length)throw new TypeError("Could not expand, too few arguments.");return a.apply(null,[e.expand].concat(r.call(arguments)))},o.compact=function(t,n){if(2>arguments.length)throw new TypeError("Could not compact, too few arguments.");return a.apply(null,[function(t,n,r,i){"function"==typeof r&&(i=r,r={}),r=r||{},e.compact(t,n,r,function(e,t){i(e,t)})}].concat(r.call(arguments)))},o.flatten=function(t){if(1>arguments.length)throw new TypeError("Could not flatten, too few arguments.");return a.apply(null,[e.flatten].concat(r.call(arguments)))},o.frame=function(t,n){if(2>arguments.length)throw new TypeError("Could not frame, too few arguments.");return a.apply(null,[e.frame].concat(r.call(arguments)))},o.fromRDF=function(t){if(1>arguments.length)throw new TypeError("Could not convert from RDF, too few arguments.");return a.apply(null,[e.fromRDF].concat(r.call(arguments)))},o.toRDF=function(t){if(1>arguments.length)throw new TypeError("Could not convert to RDF, too few arguments.");return a.apply(null,[e.toRDF].concat(r.call(arguments)))},o.normalize=function(t){if(1>arguments.length)throw new TypeError("Could not normalize, too few arguments.");return a.apply(null,[e.normalize].concat(r.call(arguments)))},"jsonld.js"===s&&(o.link=function(t,n){if(2>arguments.length)throw new TypeError("Could not link, too few arguments.");return a.apply(null,[e.link].concat(r.call(arguments)))},o.objectify=function(t){return a.apply(null,[e.objectify].concat(r.call(arguments)))},o.createNodeMap=function(t){return a.apply(null,[e.createNodeMap].concat(r.call(arguments)))},o.merge=function(t){return a.apply(null,[e.merge].concat(r.call(arguments)))});try{e.Promise=i.Promise||n(225).Promise}catch(e){var u=function(){throw new Error("Unable to find a Promise implementation.")};for(var l in o)o[l]=u}return o},e.promisify=function(t){if(!e.Promise)try{e.Promise=i.Promise||n(225).Promise}catch(e){throw new Error("Unable to find a Promise implementation.")}var r=Array.prototype.slice.call(arguments,1);return new e.Promise(function(e,n){t.apply(null,r.concat(function(t,r){t?n(t):e(r)}))})},e.promises({api:e.promises}),t.prototype=e.promises({version:"json-ld-1.0"}),t.prototype.toString=function(){return this instanceof t?"[object JsonLdProcessor]":"[object JsonLdProcessorPrototype]"},e.JsonLdProcessor=t;var te=!!Object.defineProperty;if(te)try{Object.defineProperty({},"x",{})}catch(e){te=!1}te&&(Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t})),l&&void 0===i.JsonLdProcessor&&(te?Object.defineProperty(i,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t}):i.JsonLdProcessor=t);var ne="function"==typeof a&&a,re=ne?function(e){ne(e)}:function(e){setTimeout(e,0)};e.nextTick="object"==typeof r&&"function"==typeof r.nextTick?r.nextTick:re,e.setImmediate=ne?re:e.nextTick,e.parseLinkHeader=function(e){for(var t,n={},r=e.match(/(?:<[^>]*?>|"[^"]*?"|[^,])+/g),i=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,a=0;a<r.length;++a)if(t=r[a].match(i)){for(var o={target:t[1]},s=t[2],u=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g;t=u.exec(s);)o[t[1]]=void 0===t[2]?t[3]:t[2];var l=o.rel||"";P(n[l])?n[l].push(o):n[l]=l in n?[n[l],o]:o}return n},e.RequestQueue=function(){this._requests={}},e.RequestQueue.prototype.wrapLoader=function(e){return this._loader=e,this._usePromise=1===e.length,this.add.bind(this)},e.RequestQueue.prototype.add=function(t,n){var r=this;if(!n&&!r._usePromise)throw new Error("callback must be specified.");return r._usePromise?new e.Promise(function(e,n){var i=r._requests[t];i||(i=r._requests[t]=r._loader(t).then(function(e){return delete r._requests[t],e}).catch(function(e){throw delete r._requests[t],e})),i.then(function(t){e(t)}).catch(function(e){n(e)})}):void(t in r._requests?r._requests[t].push(n):(r._requests[t]=[n],r._loader(t,function(e,n){var i=r._requests[t];delete r._requests[t];for(var a=0;a<i.length;++a)i[a](e,n)})))},e.DocumentCache=function(e){this.order=[],this.cache={},this.size=e||50,this.expires=3e4},e.DocumentCache.prototype.get=function(e){if(e in this.cache){var t=this.cache[e];if(t.expires>=+new Date)return t.ctx;delete this.cache[e],this.order.splice(this.order.indexOf(e),1)}return null},e.DocumentCache.prototype.set=function(e,t){this.order.length===this.size&&delete this.cache[this.order.shift()],this.order.push(e),this.cache[e]={ctx:t,expires:+new Date+this.expires}},e.ActiveContextCache=function(e){this.order=[],this.cache={},this.size=e||100},e.ActiveContextCache.prototype.get=function(e,t){var n=JSON.stringify(e),r=JSON.stringify(t),i=this.cache[n];return i&&r in i?i[r]:null},e.ActiveContextCache.prototype.set=function(e,t,n){if(this.order.length===this.size){var r=this.order.shift();delete this.cache[r.activeCtx][r.localCtx]}var i=JSON.stringify(e),a=JSON.stringify(t);this.order.push({activeCtx:i,localCtx:a}),i in this.cache||(this.cache[i]={}),this.cache[i][a]=K(n)},e.cache={activeCtx:new e.ActiveContextCache},e.documentLoaders={},e.documentLoaders.jquery=function(t,n){function r(r,i){return 0!==r.indexOf("http:")&&0!==r.indexOf("https:")?i(new xe('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:r}),{contextUrl:null,documentUrl:r,document:null}):n.secure&&0!==r.indexOf("https")?i(new xe('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:r}),{contextUrl:null,documentUrl:r,document:null}):void t.ajax({url:r,accepts:{json:"application/ld+json, application/json"},headers:{Accept:"application/ld+json, application/json"},dataType:"json",crossDomain:!0,success:function(t,n,a){var o={contextUrl:null,documentUrl:r,document:t},s=a.getResponseHeader("Content-Type"),u=a.getResponseHeader("Link");if(u&&"application/ld+json"!==s){if(P(u=e.parseLinkHeader(u)[we]))return i(new xe("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:r}),o);u&&(o.contextUrl=u.target)}i(null,o)},error:function(e,t,n){i(new xe("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:r,cause:n}),{contextUrl:null,documentUrl:r,document:null})}})}n=n||{};var i=new e.RequestQueue;return("usePromise"in n?n.usePromise:"undefined"!=typeof Promise)?i.wrapLoader(function(t){return e.promisify(r,t)}):i.wrapLoader(r)},e.documentLoaders.node=function(t){function r(n,l,c){if(0!==n.indexOf("http:")&&0!==n.indexOf("https:"))return c(new xe('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:n}),{contextUrl:null,documentUrl:n,document:null});if(t.secure&&0!==n.indexOf("https"))return c(new xe('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}),{contextUrl:null,documentUrl:n,document:null});var d=null;if(null!=d)return c(null,d);var h={Accept:s};for(var f in t.headers)h[f]=t.headers[f];o({url:n,headers:h,strictSSL:i,followRedirect:!1},function(t,i,o){if(d={contextUrl:null,documentUrl:n,document:o||null},t)return c(new xe("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:n,cause:t}),d);var s=u.STATUS_CODES[i.statusCode];if(400<=i.statusCode)return c(new xe("URL could not be dereferenced: "+s,"jsonld.InvalidUrl",{code:"loading document failed",url:n,httpStatusCode:i.statusCode}),d);if(i.headers.link&&"application/ld+json"!==i.headers["content-type"]){var h=e.parseLinkHeader(i.headers.link)[we];if(P(h))return c(new xe("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:n}),d);h&&(d.contextUrl=h.target)}return 300<=i.statusCode&&400>i.statusCode&&i.headers.location?l.length===a?c(new xe("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:n,httpStatusCode:i.statusCode,redirects:l}),d):-1===l.indexOf(n)?(l.push(n),r(i.headers.location,l,c)):c(new xe("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:n,httpStatusCode:i.statusCode,redirects:l}),d):(l.push(n),void c(t,d))})}var i=!("strictSSL"in(t=t||{}))||t.strictSSL,a="maxRedirects"in t?t.maxRedirects:-1,o="request"in t?t.request:n(46),s="application/ld+json, application/json",u=n(46),l=new e.RequestQueue;if(t.usePromise)return l.wrapLoader(function(t){return e.promisify(r,t,[])});var c=t.headers||{};if("Accept"in c||"accept"in c)throw new RangeError('Accept header may not be specified as an option; only "'+s+'" is supported.');return l.wrapLoader(function(e,t){r(e,[],t)})},e.documentLoaders.xhr=function(t){function n(n,i){if(0!==n.indexOf("http:")&&0!==n.indexOf("https:"))return i(new xe('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:n}),{contextUrl:null,documentUrl:n,document:null});if(t.secure&&0!==n.indexOf("https"))return i(new xe('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}),{contextUrl:null,documentUrl:n,document:null});var a=new(t.xhr||XMLHttpRequest);a.onload=function(){if(400<=a.status)return i(new xe("URL could not be dereferenced: "+a.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:n,httpStatusCode:a.status}),{contextUrl:null,documentUrl:n,document:null});var t,o={contextUrl:null,documentUrl:n,document:a.response},s=a.getResponseHeader("Content-Type");if(r.test(a.getAllResponseHeaders())&&(t=a.getResponseHeader("Link")),t&&"application/ld+json"!==s){if(P(t=e.parseLinkHeader(t)[we]))return i(new xe("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:n}),o);t&&(o.contextUrl=t.target)}i(null,o)},a.onerror=function(){i(new xe("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:n}),{contextUrl:null,documentUrl:n,document:null})},a.open("GET",n,!0),a.setRequestHeader("Accept","application/ld+json, application/json"),a.send()}t=t||{};var r=/(^|(\r\n))link:/i,i=new e.RequestQueue;return("usePromise"in t?t.usePromise:"undefined"!=typeof Promise)?i.wrapLoader(function(t){return e.promisify(n,t)}):i.wrapLoader(n)},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new xe('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.processContext=function(t,n){var r={},i=2;3<arguments.length&&(r=arguments[2]||{},i+=1);var a=arguments[i];return"base"in r||(r.base=""),"documentLoader"in r||(r.documentLoader=e.loadDocument),null===n?a(null,O(r)):(!(L(n=K(n))&&"@context"in n)&&(n={"@context":n}),void X(n,r,function(e,n){if(e)return a(e);try{n=(new Me).processContext(t,n,r)}catch(e){return a(e)}a(null,n)}))},e.hasProperty=function(e,t){var n=!1;if(t in e){var r=e[t];n=!P(r)||0<r.length}return n},e.hasValue=function(t,n,r){var i=!1;if(e.hasProperty(t,n)){var a=t[n],o=V(a);if(P(a)||o){o&&(a=a["@list"]);for(var s=0;s<a.length;++s)if(e.compareValues(r,a[s])){i=!0;break}}else P(r)||(i=e.compareValues(r,a))}return i},e.addValue=function(t,n,r,i){if("propertyIsArray"in(i=i||{})||(i.propertyIsArray=!1),"allowDuplicate"in i||(i.allowDuplicate=!0),P(r)){0===r.length&&i.propertyIsArray&&!(n in t)&&(t[n]=[]);for(var a=0;a<r.length;++a)e.addValue(t,n,r[a],i)}else if(n in t){var o=!i.allowDuplicate&&e.hasValue(t,n,r);P(t[n])||o&&!i.propertyIsArray||(t[n]=[t[n]]),o||t[n].push(r)}else t[n]=i.propertyIsArray?[r]:r},e.getValues=function(e,t){var n=e[t]||[];return P(n)||(n=[n]),n},e.removeProperty=function(e,t){delete e[t]},e.removeValue=function(t,n,r,i){"propertyIsArray"in(i=i||{})||(i.propertyIsArray=!1);var a=e.getValues(t,n).filter(function(t){return!e.compareValues(t,r)});0===a.length?e.removeProperty(t,n):1!==a.length||i.propertyIsArray?t[n]=a:t[n]=a[0]},e.compareValues=function(e,t){return e===t||W(e)&&W(t)&&e["@value"]===t["@value"]&&e["@type"]===t["@type"]&&e["@language"]===t["@language"]&&e["@index"]===t["@index"]||L(e)&&"@id"in e&&L(t)&&"@id"in t&&e["@id"]===t["@id"]},e.getContextValue=function(e,t,n){var r=null;if(null===t)return r;if("@language"===n&&n in e&&(r=e[n]),e.mappings[t]){var i=e.mappings[t];F(n)?r=i:n in i&&(r=i[n])}return r};var ie={};if(e.registerRDFParser=function(e,t){ie[e]=t},e.unregisterRDFParser=function(e){delete ie[e]},u){if(void 0===ae)var ae=null;if(void 0===oe)var oe={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12}}var se="http://www.w3.org/2001/XMLSchema#boolean",ue="http://www.w3.org/2001/XMLSchema#double",le="http://www.w3.org/2001/XMLSchema#integer",ce="http://www.w3.org/2001/XMLSchema#string",de="http://www.w3.org/1999/02/22-rdf-syntax-ns#",he=de+"first",fe=de+"rest",pe=de+"nil",me=de+"type",ve=de+"PlainLiteral",ge=de+"XMLLiteral",be=de+"object",ye=de+"langString",we="http://www.w3.org/ns/json-ld#context",_e=10,xe=function(e,t,n){u?(Error.call(this),Error.captureStackTrace(this,this.constructor)):"undefined"!=typeof Error&&(this.stack=(new Error).stack),this.name=t||"jsonld.Error",this.message=e||"An unspecified JSON-LD error occurred.",this.details=n||{}};u?n(46).inherits(xe,Error):"undefined"!=typeof Error&&(xe.prototype=new Error);var Me=function(){};Me.prototype.compact=function(t,n,r,i){if(P(r)){for(var a,o=[],s=0;s<r.length;++s)null!==(a=this.compact(t,n,r[s],i))&&o.push(a);if(i.compactArrays&&1===o.length)null===(x=e.getContextValue(t,n,"@container"))&&(o=o[0]);return o}if(L(r)){if(i.link&&"@id"in r&&r["@id"]in i.link){var u=i.link[r["@id"]];for(s=0;s<u.length;++s)if(u[s].expanded===r)return u[s].compacted}if(W(r)||H(r)){o=function(t,n,r){if(W(r)){var i=e.getContextValue(t,n,"@type"),a=e.getContextValue(t,n,"@language"),o=e.getContextValue(t,n,"@container"),s="@index"in r&&"@index"!==o;if(!s&&(r["@type"]===i||r["@language"]===a))return r["@value"];var u=Object.keys(r).length,l=1===u||2===u&&"@index"in r&&!s,c="@language"in t,d=B(r["@value"]),h=t.mappings[n]&&null===t.mappings[n]["@language"];if(l&&(!c||!d||h))return r["@value"];var f={};return s&&(f[T(t,"@index")]=r["@index"]),"@type"in r?f[T(t,"@type")]=T(t,r["@type"],null,{vocab:!0}):"@language"in r&&(f[T(t,"@language")]=r["@language"]),f[T(t,"@value")]=r["@value"],f}var p=I(t,n,{vocab:!0}),m=(i=e.getContextValue(t,n,"@type"),T(t,r["@id"],null,{vocab:"@vocab"===i}));return"@id"===i||"@vocab"===i||"@graph"===p?m:((f={})[T(t,"@id")]=m,f)}(t,n,r);return i.link&&H(r)&&(!(r["@id"]in i.link)&&(i.link[r["@id"]]=[]),i.link[r["@id"]].push({expanded:r,compacted:o})),o}var l="@reverse"===n;o={};i.link&&"@id"in r&&(!(r["@id"]in i.link)&&(i.link[r["@id"]]=[]),i.link[r["@id"]].push({expanded:r,compacted:o}));for(var c=Object.keys(r).sort(),d=0;d<c.length;++d){var h=c[d],f=r[h];if("@id"!==h&&"@type"!==h)if("@reverse"!==h)if("@index"!==h)if("@graph"!==h&&"@list"!==h&&R(h)){C=T(t,h);e.addValue(o,C,f)}else{if(0===f.length){var p=T(t,h,f,{vocab:!0},l);e.addValue(o,p,f,{propertyIsArray:!0})}for(A=0;A<f.length;++A){var m=f[A],v=(p=T(t,h,m,{vocab:!0},l),x=e.getContextValue(t,p,"@container"),V(m)),g=null;v&&(g=m["@list"]);var b=this.compact(t,p,v?g:m,i);if(v)if(P(b)||(b=[b]),"@list"!==x){var y={};y[T(t,"@list")]=b,b=y,"@index"in m&&(b[T(t,"@index")]=m["@index"])}else if(p in o)throw new xe('JSON-LD compact error; property has a "@list" @container rule but there is more than a single @list that matches the compacted term in the document. Compaction might mix unwanted items into the list.',"jsonld.SyntaxError",{code:"compaction to list of lists"});if("@language"===x||"@index"===x){var w;p in o?w=o[p]:o[p]=w={},"@language"===x&&W(b)&&(b=b["@value"]),e.addValue(w,m[x],b)}else{S=!i.compactArrays||"@set"===x||"@list"===x||P(b)&&0===b.length||"@list"===h||"@graph"===h;e.addValue(o,p,b,{propertyIsArray:S})}}}else{if("@index"===(x=e.getContextValue(t,n,"@container")))continue;C=T(t,h);e.addValue(o,C,f)}else{E=this.compact(t,"@reverse",f,i);for(var _ in E)if(t.mappings[_]&&t.mappings[_].reverse){var x,M=E[_],k="@set"===(x=e.getContextValue(t,_,"@container"))||!i.compactArrays;e.addValue(o,_,M,{propertyIsArray:k}),delete E[_]}if(0<Object.keys(E).length){var C=T(t,h);e.addValue(o,C,E)}}else{var E;if(B(f))E=T(t,f,null,{vocab:"@type"===h});else{E=[];for(var A=0;A<f.length;++A)E.push(T(t,f[A],null,{vocab:!0}))}var C=T(t,h),S=P(E)&&0===f.length;e.addValue(o,C,E,{propertyIsArray:S})}}return o}return r},Me.prototype.expand=function(t,n,r,i,a){var o=this;if(null===r||void 0===r)return null;if(!P(r)&&!L(r))return a||null!==n&&"@graph"!==I(t,n,{vocab:!0})?function(t,n,r){if(null===r||void 0===r)return null;var i=I(t,n,{vocab:!0});if("@id"===i)return I(t,r,{base:!0});if("@type"===i)return I(t,r,{vocab:!0,base:!0});var a=e.getContextValue(t,n,"@type");if("@id"===a||"@graph"===i&&B(r))return{"@id":I(t,r,{base:!0})};if("@vocab"===a)return{"@id":I(t,r,{vocab:!0,base:!0})};if(R(i))return r;var o={};if(null!==a)o["@type"]=a;else if(B(r)){var s=e.getContextValue(t,n,"@language");null!==s&&(o["@language"]=s)}return-1===["boolean","number","string"].indexOf(typeof r)&&(r=r.toString()),o["@value"]=r,o}(t,n,r):null;if(P(r)){var u=[],l=e.getContextValue(t,n,"@container");a=a||"@list"===l;for(var c,d=0;d<r.length;++d){if(c=o.expand(t,n,r[d],i),a&&(P(c)||V(c)))throw new xe("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"});null!==c&&(P(c)?u=u.concat(c):u.push(c))}return u}"@context"in r&&(t=o.processContext(t,r["@context"],i));for(var h=I(t,n,{vocab:!0}),f=(u={},Object.keys(r).sort()),p=0;p<f.length;++p){var m,v=f[p],g=r[v];if("@context"!==v){var b=I(t,v,{vocab:!0});if(null!==b&&(G(b)||R(b))){if(R(b)){if("@reverse"===h)throw new xe("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:g});if(b in u)throw new xe("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:b})}if("@id"===b&&!B(g)){if(!i.isFrame)throw new xe('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:g});if(!L(g))throw new xe('Invalid JSON-LD syntax; "@id" value must be a string or an object.',"jsonld.SyntaxError",{code:"invalid @id value",value:g})}if("@type"===b&&D(g),"@graph"===b&&!L(g)&&!P(g))throw new xe('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:g});if("@value"===b&&(L(g)||P(g)))throw new xe('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:g});if("@language"===b){if(null===g)continue;if(!B(g))throw new xe('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:g});g=g.toLowerCase()}if("@index"===b&&!B(g))throw new xe('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:g});if("@reverse"===b){if(!L(g))throw new xe('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:g});if("@reverse"in(m=o.expand(t,"@reverse",g,i)))for(var y in m["@reverse"])e.addValue(u,y,m["@reverse"][y],{propertyIsArray:!0});var w=u["@reverse"]||null;for(var y in m)if("@reverse"!=y){null===w&&(w=u["@reverse"]={}),e.addValue(w,y,[],{propertyIsArray:!0});for(var _=m[y],x=0;x<_.length;++x){if(W(C=_[x])||V(C))throw new xe('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:m});e.addValue(w,y,C,{propertyIsArray:!0})}}continue}if("@language"===(l=e.getContextValue(t,v,"@container"))&&L(g))m=s(g);else if("@index"===l&&L(g))m=function(e){for(var n=[],r=Object.keys(g).sort(),a=0;a<r.length;++a){var s=r[a],u=g[s];P(u)||(u=[u]),u=o.expand(t,e,u,i,!1);for(var l,c=0;c<u.length;++c)"@index"in(l=u[c])||(l["@index"]=s),n.push(l)}return n}(v);else{var M="@list"===b;if(M||"@set"===b){var k=n;if(M&&"@graph"===h&&(k=null),m=o.expand(t,k,g,i,M),M&&V(m))throw new xe("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"})}else m=o.expand(t,v,g,i,!1)}if(null!==m||"@value"===b){if("@list"===b||V(m)||"@list"!==l||(m={"@list":m=P(m)?m:[m]}),t.mappings[v]&&t.mappings[v].reverse){w=u["@reverse"]=u["@reverse"]||{};P(m)||(m=[m]);var C;for(x=0;x<m.length;++x){if(W(C=m[x])||V(C))throw new xe('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:m});e.addValue(w,b,C,{propertyIsArray:!0})}continue}var E=-1===["@index","@id","@type","@value","@language"].indexOf(b);e.addValue(u,b,m,{propertyIsArray:E})}}}}var A=(f=Object.keys(u)).length;if("@value"in u){if("@type"in u&&"@language"in u)throw new xe('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:u});var T=A-1;if("@type"in u&&(T-=1),"@index"in u&&(T-=1),"@language"in u&&(T-=1),0!=T)throw new xe('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:u});if(null===u["@value"])u=null;else{if("@language"in u&&!B(u["@value"]))throw new xe("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:u});if("@type"in u&&(!G(u["@type"])||0===u["@type"].indexOf("_:")))throw new xe('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:u})}}else if("@type"in u&&!P(u["@type"]))u["@type"]=[u["@type"]];else if("@set"in u||"@list"in u){if(1<A&&!(2===A&&"@index"in u))throw new xe('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:u});"@set"in u&&(u=u["@set"],A=(f=Object.keys(u)).length)}else 1===A&&"@language"in u&&(u=null);return L(u)&&!i.keepFreeFloatingNodes&&!a&&(null===n||"@graph"===h)&&(0===A||"@value"in u||"@list"in u||1===A&&"@id"in u)&&(u=null),u},Me.prototype.createNodeMap=function(e,t){var n={"@default":{}};return m(e,n,"@default",(t=t||{}).namer||t.issuer||new Q("_:b")),v(n)},Me.prototype.flatten=function(e){for(var t,n=this.createNodeMap(e),r=[],i=Object.keys(n).sort(),a=0;a<i.length;++a)H(t=n[i[a]])||r.push(t);return r},Me.prototype.frame=function(e,t,n){var r={options:n,graphs:{"@default":{},"@merged":{}},subjectStack:[],link:{}},i=new Q("_:b");m(e,r.graphs,"@merged",i),r.subjects=r.graphs["@merged"];var a=[];return g(r,Object.keys(r.subjects).sort(),t,a,null),a},Me.prototype.normalize=function(e,t,n){return"URDNA2015"===t.algorithm?new ke(t).main(e,n):"URGNA2012"===t.algorithm?new Ce(t).main(e,n):void n(new Error("Invalid RDF Dataset Normalization algorithm: "+t.algorithm))},Me.prototype.fromRDF=function(t,n,r){var i={},a={"@default":i},o={};for(var s in t){var u=t[s];s in a||(a[s]={}),"@default"==s||s in i||(i[s]={"@id":s});for(var l=a[s],c=0;c<u.length;++c){var d=u[c],h=d.subject.value,p=d.predicate.value,m=d.object;h in l||(l[h]={"@id":h});var v=l[h],g="IRI"===m.type||"blank node"===m.type;if(g&&!(m.value in l)&&(l[m.value]={"@id":m.value}),p!==me||n.useRdfType||!g){var b=f(m,n.useNativeTypes);if(e.addValue(v,p,b,{propertyIsArray:!0}),g)if(m.value===pe){var y=l[m.value];"usages"in y||(y.usages=[]),y.usages.push({node:v,property:p,value:b})}else o[m.value]=!(m.value in o)&&{node:v,property:p,value:b}}else e.addValue(v,"@type",m.value,{propertyIsArray:!0})}}for(var s in a){var w=a[s];if(pe in w){for(var _=w[pe],x=0;x<_.usages.length;++x){for(var M=_.usages[x],k=(v=M.node,M.property),C=M.value,E=[],A=[],T=Object.keys(v).length;k===fe&&L(o[v["@id"]])&&P(v[he])&&1===v[he].length&&P(v[fe])&&1===v[fe].length&&(3===T||4===T&&P(v["@type"])&&1===v["@type"].length&&"http://www.w3.org/1999/02/22-rdf-syntax-ns#List"===v["@type"][0])&&(E.push(v[he][0]),A.push(v["@id"]),v=(M=o[v["@id"]]).node,k=M.property,C=M.value,T=Object.keys(v).length,0===v["@id"].indexOf("_:")););if(k===he){if(v["@id"]===pe)continue;C=w[C["@id"]][fe][0],E.pop(),A.pop()}delete C["@id"],C["@list"]=E.reverse();for(var S=0;S<A.length;++S)delete w[A[S]]}delete _.usages}}var I=[],N=Object.keys(i).sort();for(x=0;x<N.length;++x){var j=N[x];v=i[j];if(j in a){u=v["@graph"]=[],w=a[j];for(var O,R=Object.keys(w).sort(),D=0;D<R.length;++D)H(O=w[R[D]])||u.push(O)}H(v)||I.push(v)}r(null,I)},Me.prototype.toRDF=function(e,t){var n=new Q("_:b"),r={"@default":{}};m(e,r,"@default",n);for(var i,a={},o=Object.keys(r).sort(),s=0;s<o.length;++s)("@default"===(i=o[s])||G(i))&&(a[i]=c(r[i],n,t));return a},Me.prototype.processContext=function(t,n,r){L(n)&&"@context"in n&&P(n["@context"])&&(n=n["@context"]);var i=P(n)?n:[n];if(0===i.length)return t.clone();for(var a,o=t,s=0;s<i.length;++s)if(null!==(a=i[s])){if(L(a)&&"@context"in a&&(a=a["@context"]),!L(a))throw new xe("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:a});if(e.cache.activeCtx){var u=e.cache.activeCtx.get(t,a);if(u){o=t=u;continue}}t=o,o=o.clone();var l={};if("@base"in a){var c=a["@base"];if(null===c)c=null;else{if(!B(c))throw new xe('Invalid JSON-LD syntax; the value of "@base" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:a});if(""!==c&&!G(c))throw new xe('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI or the empty string.',"jsonld.SyntaxError",{code:"invalid base IRI",context:a})}null!==c&&(c=e.url.parse(c||"")),o["@base"]=c,l["@base"]=!0}if("@vocab"in a){if(null===(d=a["@vocab"]))delete o["@vocab"];else{if(!B(d))throw new xe('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:a});if(!G(d))throw new xe('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:a});o["@vocab"]=d}l["@vocab"]=!0}if("@language"in a){var d;if(null===(d=a["@language"]))delete o["@language"];else{if(!B(d))throw new xe('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:a});o["@language"]=d.toLowerCase()}l["@language"]=!0}for(var h in a)S(o,a,h,l);e.cache.activeCtx&&e.cache.activeCtx.set(t,a,o)}else o=t=O(r);return o};var ke=function(){var t={subject:"s",object:"o",name:"g"},n=function(e){e=e||{},this.name="URDNA2015",this.options=e,this.blankNodeInfo={},this.hashToBlankNodes={},this.canonicalIssuer=new Q("_:c14n"),this.quads=[],this.schedule={},this.schedule.MAX_DEPTH="maxCallStackDepth"in e?e.maxCallStackDepth:500,this.schedule.MAX_TOTAL_DEPTH="maxTotalCallStackDepth"in e?e.maxCallStackDepth:4294967295,this.schedule.depth=0,this.schedule.totalDepth=0,this.schedule.timeSlice="timeSlice"in e?e.timeSlice:10};return n.prototype.doWork=function(t,n){var r=this.schedule;return r.totalDepth>=r.MAX_TOTAL_DEPTH?n(new Error("Maximum total call stack depth exceeded; normalization aborting.")):void function i(){if(r.depth===r.MAX_DEPTH)return r.depth=0,r.running=!1,e.nextTick(i);var a=(new Date).getTime();return r.running||(r.start=(new Date).getTime(),r.deadline=r.start+r.timeSlice),a<r.deadline?(r.running=!0,r.depth++,r.totalDepth++,t(function(e,t){r.depth--,r.totalDepth--,n(e,t)})):(r.depth=0,r.running=!1,void e.setImmediate(i))}()},n.prototype.forEach=function(e,t,n){var r,i,a=this,o=0;if(P(e))i=e.length,r=function(){return o!==i&&(r.value=e[o++],r.key=o,!0)};else{var s=Object.keys(e);i=s.length,r=function(){return o!==i&&(r.key=s[o++],r.value=e[r.key],!0)}}!function e(i,o){return i?n(i):r()?a.doWork(function(){t(r.value,r.key,e)}):void n()}()},n.prototype.waterfall=function(e,t){var n=this;n.forEach(e,function(e,t,r){n.doWork(e,r)},t)},n.prototype.whilst=function(e,t,n){var r=this;!function i(a){return a?n(a):e()?void r.doWork(t,i):n()}()},n.prototype.main=function(e,t){var n,r=this;if(r.schedule.start=(new Date).getTime(),r.options.format&&"application/nquads"!==r.options.format)return t(new xe("Unknown output format.","jsonld.UnknownFormat",{format:r.options.format}));var i={};r.waterfall([function(t){r.forEach(e,function(e,t,n){"@default"===t&&(t=null),r.forEach(e,function(e,n,a){null!==t&&(0===t.indexOf("_:")?e.name={type:"blank node",value:t}:e.name={type:"IRI",value:t}),r.quads.push(e),r.forEachComponent(e,function(t){if("blank node"===t.type){var n=t.value;n in r.blankNodeInfo?r.blankNodeInfo[n].quads.push(e):(i[n]=!0,r.blankNodeInfo[n]={quads:[e]})}}),a()},n)},t)},function(e){var t=!0;r.whilst(function(){return t},function(e){t=!1,r.hashToBlankNodes={},r.waterfall([function(e){r.forEach(i,function(e,t,n){r.hashFirstDegreeQuads(t,function(e,i){return e?n(e):(i in r.hashToBlankNodes?r.hashToBlankNodes[i].push(t):r.hashToBlankNodes[i]=[t],void n())})},e)},function(e){var n=Object.keys(r.hashToBlankNodes).sort();r.forEach(n,function(e,n,a){var o=r.hashToBlankNodes[e];if(1<o.length)return a();var s=o[0];r.canonicalIssuer.getId(s),delete i[s],delete r.hashToBlankNodes[e],t=!0,a()},e)}],e)},e)},function(e){var t=Object.keys(r.hashToBlankNodes).sort();r.forEach(t,function(e,t,n){var i=[],a=r.hashToBlankNodes[e];r.waterfall([function(e){r.forEach(a,function(e,t,n){if(r.canonicalIssuer.hasId(e))return n();var a=new Q("_:b");a.getId(e),r.hashNDegreeQuads(e,a,function(e,t){return e?n(e):(i.push(t),void n())})},e)},function(e){i.sort(function(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}),r.forEach(i,function(e,t,n){for(var i in e.issuer.existing)r.canonicalIssuer.getId(i);n()},e)}],n)},e)},function(e){var t=[];r.waterfall([function(e){r.forEach(r.quads,function(e,n,i){r.forEachComponent(e,function(e){"blank node"===e.type&&0!==e.value.indexOf(r.canonicalIssuer.prefix)&&(e.value=r.canonicalIssuer.getId(e.value))}),t.push(Y(e)),i()},e)},function(e){return t.sort(),"application/nquads"===r.options.format?(n=t.join(""),e()):(n=Z(t.join("")),void e())}],e)}],function(e){t(e,n)})},n.prototype.hashFirstDegreeQuads=function(e,t){var n=this,r=n.blankNodeInfo[e];if("hash"in r)return t(null,r.hash);var i=[],a=r.quads;n.forEach(a,function(t,r,a){var o={predicate:t.predicate};n.forEachComponent(t,function(t,r){o[r]=n.modifyFirstDegreeComponent(e,t,r)}),i.push(Y(o)),a()},function(e){return e?t(e):(i.sort(),r.hash=Ae.hashNQuads(n.name,i),void t(null,r.hash))})},n.prototype.modifyFirstDegreeComponent=function(e,t){return"blank node"===t.type?((t=K(t)).value=t.value===e?"_:a":"_:z",t):t},n.prototype.hashRelatedBlankNode=function(e,t,n,r,i){var a,o=this;o.waterfall([function(t){return o.canonicalIssuer.hasId(e)?(a=o.canonicalIssuer.getId(e),t()):n.hasId(e)?(a=n.getId(e),t()):void o.hashFirstDegreeQuads(e,function(e,n){return e?t(e):(a=n,void t())})}],function(e){if(e)return i(e);var n=new Ae(o.name);return n.update(r),"g"!==r&&n.update(o.getRelatedPredicate(t)),n.update(a),i(null,n.digest())})},n.prototype.getRelatedPredicate=function(e){return"<"+e.predicate.value+">"},n.prototype.hashNDegreeQuads=function(e,t,n){var r,i=this,a=new Ae(i.name);i.waterfall([function(n){i.createHashToRelated(e,t,function(e,t){return e?n(e):(r=t,void n())})},function(e){var n=Object.keys(r).sort();i.forEach(n,function(e,n,o){a.update(e);var s,u="",l=new Ee(r[e]);i.whilst(function(){return l.hasNext()},function(e){var n=l.next(),r=t.clone(),a="",o=[];i.waterfall([function(t){i.forEach(n,function(t,n,s){return i.canonicalIssuer.hasId(t)?a+=i.canonicalIssuer.getId(t):(!r.hasId(t)&&o.push(t),a+=r.getId(t)),0!==u.length&&a.length>=u.length&&a>u?e():void s()},t)},function(t){i.forEach(o,function(t,n,o){i.hashNDegreeQuads(t,r,function(n,i){return n?o(n):(a+=r.getId(t),a+="<"+i.hash+">",r=i.issuer,0!==u.length&&a.length>=u.length&&a>u?e():void o())})},t)},function(e){(0===u.length||a<u)&&(u=a,s=r),e()}],e)},function(e){return e?o(e):(a.update(u),t=s,void o())})},e)}],function(e){n(e,{hash:a.digest(),issuer:t})})},n.prototype.createHashToRelated=function(e,n,r){var i=this,a={},o=i.blankNodeInfo[e].quads;i.forEach(o,function(r,o,s){i.forEach(r,function(o,s,u){if("predicate"===s||"blank node"!==o.type||o.value===e)return u();var l=o.value,c=t[s];i.hashRelatedBlankNode(l,r,n,c,function(e,t){return e?u(e):(t in a?a[t].push(l):a[t]=[l],void u())})},s)},function(e){r(e,a)})},n.prototype.forEachComponent=function(e,t){for(var n in e)"predicate"!=n&&t(e[n],n,e)},n}(),Ce=function(){var e=function(e){ke.call(this,e),this.name="URGNA2012"};return(e.prototype=new ke).modifyFirstDegreeComponent=function(e,t,n){return"blank node"===t.type?((t=K(t)).value="name"===n?"_:g":t.value===e?"_:a":"_:z",t):t},e.prototype.getRelatedPredicate=function(e){return e.predicate.value},e.prototype.createHashToRelated=function(e,t,n){var r=this,i={},a=r.blankNodeInfo[e].quads;r.forEach(a,function(n,a,o){var s,u;if("blank node"===n.subject.type&&n.subject.value!==e)u=n.subject.value,s="p";else{if("blank node"!==n.object.type||n.object.value===e)return o();u=n.object.value,s="r"}r.hashRelatedBlankNode(u,n,t,s,function(e,t){t in i?i[t].push(u):i[t]=[u],o()})},function(e){n(e,i)})},e}();Object.keys||(Object.keys=function(e){if(e!==Object(e))throw new TypeError("Object.keys called on non-object");var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}),e.registerRDFParser("application/nquads",Z),e.registerRDFParser("rdfa-api",function(e){for(var t,n={"@default":[]},r=e.getSubjects(),i=0;i<r.length;++i)if(null!==(t=r[i])){var a=e.getSubjectTriples(t);if(null!==a){var o=a.predicates;for(var s in o)for(var u=o[s].objects,l=0;l<u.length;++l){var c=u[l],d={};d.subject=0===t.indexOf("_:")?{type:"blank node",value:t}:{type:"IRI",value:t},d.predicate=0===s.indexOf("_:")?{type:"blank node",value:s}:{type:"IRI",value:s};var h=c.value;if(c.type===ge){ae||Te();var f=new ae;h="";for(var p=0;p<c.value.length;p++)c.value[p].nodeType===oe.ELEMENT_NODE?h+=f.serializeToString(c.value[p]):c.value[p].nodeType===oe.TEXT_NODE&&(h+=c.value[p].nodeValue)}d.object={},c.type===be?0===c.value.indexOf("_:")?d.object.type="blank node":d.object.type="IRI":(d.object.type="literal",c.type===ve?c.language?(d.object.datatype=ye,d.object.language=c.language):d.object.datatype=ce:d.object.datatype=c.type),d.object.value=h,n["@default"].push(d)}}}return n}),e.IdentifierIssuer=Q,e.UniqueNamer=Q,Q.prototype.clone=function(){var e=new Q(this.prefix);return e.counter=this.counter,e.existing=K(this.existing),e},Q.prototype.getId=function(e){if(e&&e in this.existing)return this.existing[e];var t=this.prefix+this.counter;return this.counter+=1,e&&(this.existing[e]=t),t},Q.prototype.getName=Q.prototype.getName,Q.prototype.hasId=function(e){return e in this.existing},Q.prototype.isNamed=Q.prototype.hasId;var Ee=function(e){this.list=e.sort(),this.done=!1,this.left={};for(var t=0;t<e.length;++t)this.left[e[t]]=!0};Ee.prototype.hasNext=function(){return!this.done},Ee.prototype.next=function(){for(var e=this.list.slice(),t=null,n=0,r=this.list.length,i=0;i<r;++i){var a=this.list[i],o=this.left[a];(null==t||a>t)&&(o&&0<i&&a>this.list[i-1]||!o&&i<r-1&&a>this.list[i+1])&&(t=a,n=i)}if(null===t)this.done=!0;else{var s=this.left[t]?n-1:n+1;this.list[n]=this.list[s],this.list[s]=t;for(i=0;i<r;++i)this.list[i]>t&&(this.left[this.list[i]]=!this.left[this.list[i]])}return e};var Ae=function(e){if(!(this instanceof Ae))return new Ae(e);if(-1===["URDNA2015","URGNA2012"].indexOf(e))throw new Error("Invalid RDF Dataset Normalization algorithm: "+e);Ae._init.call(this,e)};if(Ae.hashNQuads=function(e,t){for(var n=new Ae(e),r=0;r<t.length;++r)n.update(t[r]);return n.digest()},function(e){if(u){var t=n(46);return Ae._init=function(e){e="URDNA2015"===e?"sha256":"sha1",this.md=t.createHash(e)},Ae.prototype.update=function(e){return this.md.update(e,"utf8")},void(Ae.prototype.digest=function(){return this.md.digest("hex")})}Ae._init=function(e){e="URDNA2015"===e?new a.Algorithm:new i.Algorithm,this.md=new r(e)},Ae.prototype.update=function(e){return this.md.update(e)},Ae.prototype.digest=function(){return this.md.digest().toHex()};var r=function(e){if(!(this instanceof r))return new r(e);if(this._algorithm=e,!r._padding||r._padding.length<this._algorithm.blockSize){r._padding="€";for(var t="\0",n=64;0<n;)1&n&&(r._padding+=t),0<(n>>>=1)&&(t+=t)}this.start()};r.prototype.start=function(){this.messageLength=0,this.fullMessageLength=[];for(var e=this._algorithm.messageLengthSize/4,t=0;t<e;++t)this.fullMessageLength.push(0);return this._input=new r.ByteBuffer,this.state=this._algorithm.start(),this},r.prototype.update=function(e){e=new r.ByteBuffer(unescape(encodeURIComponent(e))),this.messageLength+=e.length();var t=e.length();t=[t/4294967296>>>0,t>>>0];for(var n=this.fullMessageLength.length-1;0<=n;--n)this.fullMessageLength[n]+=t[1],t[1]=t[0]+(this.fullMessageLength[n]/4294967296>>>0),this.fullMessageLength[n]>>>=0,t[0]=t[1]/4294967296>>>0;for(this._input.putBytes(e.bytes());this._input.length()>=this._algorithm.blockSize;)this.state=this._algorithm.digest(this.state,this._input);return(2048<this._input.read||0===this._input.length())&&this._input.compact(),this},r.prototype.digest=function(){var e=new r.ByteBuffer;e.putBytes(this._input.bytes());var t=this.fullMessageLength[this.fullMessageLength.length-1]+this._algorithm.messageLengthSize&this._algorithm.blockSize-1;e.putBytes(r._padding.substr(0,this._algorithm.blockSize-t));for(var n=new r.ByteBuffer,i=0;i<this.fullMessageLength.length;++i)n.putInt32(this.fullMessageLength[i]<<3|this.fullMessageLength[i+1]>>>28);this._algorithm.writeMessageLength(e,n);var a=this._algorithm.digest(this.state.copy(),e),o=new r.ByteBuffer;return a.write(o),o},r.ByteBuffer=function(e){this.data="string"==typeof e?e:"",this.read=0},r.ByteBuffer.prototype.putInt32=function(e){this.data+=_StringfromCharCode(255&e>>24)+_StringfromCharCode(255&e>>16)+_StringfromCharCode(255&e>>8)+_StringfromCharCode(255&e)},r.ByteBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},r.ByteBuffer.prototype.putBytes=function(e){this.data+=e},r.ByteBuffer.prototype.bytes=function(){return this.data.slice(this.read)},r.ByteBuffer.prototype.length=function(){return this.data.length-this.read},r.ByteBuffer.prototype.compact=function(){this.data=this.data.slice(this.read),this.read=0},r.ByteBuffer.prototype.toHex=function(){for(var e,t="",n=this.read;n<this.data.length;++n)16>(e=this.data.charCodeAt(n))&&(t+="0"),t+=e.toString(16);return t};var i={_w:null,Algorithm:function(){this.name="sha1",this.blockSize=64,this.digestLength=20,this.messageLengthSize=8}};i.Algorithm.prototype.start=function(){return i._w||(i._w=Array(80)),i._createState()},i.Algorithm.prototype.writeMessageLength=function(e,t){e.putBytes(t.bytes())},i.Algorithm.prototype.digest=function(e,t){for(var n,r,a,o,s,u,l,c=t.length(),d=i._w;64<=c;){for(r=e.h0,a=e.h1,o=e.h2,s=e.h3,u=e.h4,l=0;16>l;++l)n=t.getInt32(),d[l]=n,n=(r<<5|r>>>27)+(s^a&(o^s))+u+1518500249+n,u=s,s=o,o=a<<30|a>>>2,a=r,r=n;for(;20>l;++l)n=(n=d[l-3]^d[l-8]^d[l-14]^d[l-16])<<1|n>>>31,d[l]=n,n=(r<<5|r>>>27)+(s^a&(o^s))+u+1518500249+n,u=s,s=o,o=a<<30|a>>>2,a=r,r=n;for(;32>l;++l)n=(n=d[l-3]^d[l-8]^d[l-14]^d[l-16])<<1|n>>>31,d[l]=n,n=(r<<5|r>>>27)+(a^o^s)+u+1859775393+n,u=s,s=o,o=a<<30|a>>>2,a=r,r=n;for(;40>l;++l)n=(n=d[l-6]^d[l-16]^d[l-28]^d[l-32])<<2|n>>>30,d[l]=n,n=(r<<5|r>>>27)+(a^o^s)+u+1859775393+n,u=s,s=o,o=a<<30|a>>>2,a=r,r=n;for(;60>l;++l)n=(n=d[l-6]^d[l-16]^d[l-28]^d[l-32])<<2|n>>>30,d[l]=n,n=(r<<5|r>>>27)+(a&o|s&(a^o))+u+2400959708+n,u=s,s=o,o=a<<30|a>>>2,a=r,r=n;for(;80>l;++l)n=(n=d[l-6]^d[l-16]^d[l-28]^d[l-32])<<2|n>>>30,d[l]=n,n=(r<<5|r>>>27)+(a^o^s)+u+3395469782+n,u=s,s=o,o=a<<30|a>>>2,a=r,r=n;e.h0=0|e.h0+r,e.h1=0|e.h1+a,e.h2=0|e.h2+o,e.h3=0|e.h3+s,e.h4=0|e.h4+u,c-=64}return e},i._createState=function(){var e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520,copy:function(){var t=i._createState();return t.h0=e.h0,t.h1=e.h1,t.h2=e.h2,t.h3=e.h3,t.h4=e.h4,t},write:function(t){t.putInt32(e.h0),t.putInt32(e.h1),t.putInt32(e.h2),t.putInt32(e.h3),t.putInt32(e.h4)}};return e};var a={_k:null,_w:null,Algorithm:function(){this.name="sha256",this.blockSize=64,this.digestLength=32,this.messageLengthSize=8}};a.Algorithm.prototype.start=function(){return a._k||a._init(),a._createState()},a.Algorithm.prototype.writeMessageLength=function(e,t){e.putBytes(t.bytes())},a.Algorithm.prototype.digest=function(e,t){for(var n,r,i,o,s,u,l,c,d,h,f,p,m,v=t.length(),g=a._k,b=a._w;64<=v;){for(s=0;16>s;++s)b[s]=t.getInt32();for(;64>s;++s)n=((n=b[s-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,r=((r=b[s-15])>>>7|r<<25)^(r>>>18|r<<14)^r>>>3,b[s]=0|n+b[s-7]+r+b[s-16];for(u=e.h0,l=e.h1,c=e.h2,d=e.h3,h=e.h4,f=e.h5,p=e.h6,m=e.h7,s=0;64>s;++s)i=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),o=u&l|c&(u^l),n=m+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(p^h&(f^p))+g[s]+b[s],m=p,p=f,f=h,h=0|d+n,d=c,c=l,l=u,u=0|n+(r=i+o);e.h0=0|e.h0+u,e.h1=0|e.h1+l,e.h2=0|e.h2+c,e.h3=0|e.h3+d,e.h4=0|e.h4+h,e.h5=0|e.h5+f,e.h6=0|e.h6+p,e.h7=0|e.h7+m,v-=64}return e},a._createState=function(){var e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225,copy:function(){var t=a._createState();return t.h0=e.h0,t.h1=e.h1,t.h2=e.h2,t.h3=e.h3,t.h4=e.h4,t.h5=e.h5,t.h6=e.h6,t.h7=e.h7,t},write:function(t){t.putInt32(e.h0),t.putInt32(e.h1),t.putInt32(e.h2),t.putInt32(e.h3),t.putInt32(e.h4),t.putInt32(e.h5),t.putInt32(e.h6),t.putInt32(e.h7)}};return e},a._init=function(){a._k=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a._w=Array(64)}}(),!ae)var Te=function(){ae=n(47).XMLSerializer};if(e.url={},e.url.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*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.url.parse=function(t,n){for(var r={},i=e.url.parsers[n||"full"],a=i.regex.exec(t),o=i.keys.length;o--;)r[i.keys[o]]=void 0===a[o]?null:a[o];return r.normalizedPath=ee(r.path,!!r.authority),r},u?e.useDocumentLoader("node"):"undefined"!=typeof XMLHttpRequest&&e.useDocumentLoader("xhr"),u){e.use=function(t){switch(t){case"request":e.request=n(46);break;default:throw new xe("Unknown extension.","jsonld.UnknownExtension",{extension:t})}};var Se={exports:{},filename:o};n(46)(Se,"version"),e.version=Se.exports.version}return e},d=function(){return c(function(){return d()})};!u&&n(478)?void 0!==(s=function(){return c(d),d}.apply(t,[]))&&(e.exports=s):(c(d),void 0!==e&&e.exports&&(e.exports=d),l&&("undefined"==typeof jsonld?jsonld=jsonldjs=d:jsonldjs=d))}()}).call(this,n(11),n(5),n(65).setImmediate,"/")},function(e,t,n){"use strict";e.exports.convertToJson=function(e,t){var n,o=a.Parser(),s=a.Writer({format:"N-Quads"});r.waterfall([function(t){o.parse(e,t)},function(e,t,n){null!==e&&s.addTriple(e),"function"==typeof n&&s.end(n)},function(e,t){try{i.fromRDF(e,{format:"application/nquads"},t)}catch(e){t(e)}},function(e,r){n=JSON.stringify(e),t(null,n)}],function(e,r){t(e,n)})},e.exports.convertToNQuads=function(e,t){var n,i=a.Parser(),o=a.Writer({format:"N-Quads"});r.waterfall([function(t){i.parse(e,t)},function(e,t,n){null!==e&&o.addTriple(e),"function"==typeof n&&o.end(n)},function(e,r){t(null,n=e)}],function(e,r){t(e,n)})};var r=n(481),i=n(226),a=n(224)},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(40),a=n(49),o=n(88),s=n(48),u=n(39),l=n(12),c=n(19),d=n(134),h=n(86),f=n(85),p=function(e){function t(e,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.termType=t.termType,a.statements=e||[],a.constraints=n||[],a.initBindings=r||[],a.optional=i||[],a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,c),r(t,[{key:"add",value:function(e,t,n,r){return this.statements.push(new h(e,t,n,r))}},{key:"addStatement",value:function(e){return this.statements.push(e)}},{key:"bnode",value:function(e){return new i(e)}},{key:"bottomTypeURIs",value:function(e){var t,n,r,i,a,o,s;for(i in t=[],e)if(e.hasOwnProperty(i)){for(s=e[i],n=!0,r=0,a=(o=this.each(void 0,this.sym("http://www.w3.org/2000/01/rdf-schema#subClassOf"),this.sym(i))).length;r<a;r++)if(o[r].uri in e){n=!1;break}n&&(t[i]=s)}return t}},{key:"collection",value:function(){return new o}},{key:"each",value:function(e,t,n,r){var i,a,o,s,u,l,c,d,h,f=[],p=this.statementsMatching(e,t,n,r,!1);if(null==e)for(a=0,l=p.length;a<l;a++)i=p[a],f.push(i.subject);else if(null==t)for(o=0,c=p.length;o<c;o++)i=p[o],f.push(i.predicate);else if(null==n)for(s=0,d=p.length;s<d;s++)i=p[s],f.push(i.object);else if(null==r)for(u=0,h=p.length;u<h;u++)i=p[u],f.push(i.why);return f}},{key:"equals",value:function(e){return!!e&&this.hashString()===e.hashString()}},{key:"findMembersNT",value:function(e){var t,n,r,i,a,o,s,u,l,c,d,h,f,p,m,v,g,b,y,w,_;for(w in(b={})[e.toNT()]=!0,l={},h=this.transitiveClosure(b,this.sym("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0))if(h.hasOwnProperty(w)){for(t=0,r=(f=this.statementsMatching(void 0,this.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.fromNT(w))).length;t<r;t++)l[(y=f[t]).subject.toNT()]=y;for(n=0,i=(p=this.each(void 0,this.sym("http://www.w3.org/2000/01/rdf-schema#domain"),this.fromNT(w))).length;n<i;n++)for(c=p[n],u=0,a=(m=this.statementsMatching(void 0,c)).length;u<a;u++)l[(y=m[u]).subject.toNT()]=y;for(d=0,o=(v=this.each(void 0,this.sym("http://www.w3.org/2000/01/rdf-schema#range"),this.fromNT(w))).length;d<o;d++)for(c=v[d],_=0,s=(g=this.statementsMatching(void 0,c)).length;_<s;_++)l[(y=g[_]).object.toNT()]=y}return l}},{key:"findMemberURIs",value:function(e){return this.NTtoURI(this.findMembersNT(e))}},{key:"findSubClassesNT",value:function(e){var t={};return t[e.toNT()]=!0,this.transitiveClosure(t,this.sym("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0)}},{key:"findSuperClassesNT",value:function(e){var t={};return t[e.toNT()]=!0,this.transitiveClosure(t,this.sym("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}},{key:"findTypesNT",value:function(e){var t,n,r,i,a,o,s,u,l,c,d,h,f,p,m;for(l="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",m=[],t=0,r=(c=this.statementsMatching(e,void 0,void 0)).length;t<r;t++)if((p=c[t]).predicate.uri===l)m[p.object.toNT()]=p;else for(n=0,i=(d=this.each(p.predicate,this.sym("http://www.w3.org/2000/01/rdf-schema#domain"))).length;n<i;n++)m[d[n].toNT()]=p;for(s=0,a=(h=this.statementsMatching(void 0,void 0,e)).length;s<a;s++)for(p=h[s],u=0,o=(f=this.each(p.predicate,this.sym("http://www.w3.org/2000/01/rdf-schema#range"))).length;u<o;u++)m[f[u].toNT()]=p;return this.transitiveClosure(m,this.sym("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}},{key:"findTypeURIs",value:function(e){return this.NTtoURI(this.findTypesNT(e))}},{key:"connectedStatements",value:function(e,t,n){n=n||[];for(var r=[e],i=[],a=[],o=[],s=this,u=function(e){var u=function(e){"BlankNode"!==e.termType||i[e.value]||(i[e.value]=!0,r.push(e))},l=s.statementsMatching(null,null,e,t).concat(s.statementsMatching(e,null,null,t));(l=l.filter(function(e){if(n[e.predicate.uri])return!1;var t=e.toNT();return!a[t]&&(a[t]=!0,!0)})).forEach(function(e,t){u(e.subject),u(e.object)}),o=o.concat(l)};r.length;)u(r.shift());return o}},{key:"formula",value:function(){return new t}},{key:"fromNT",value:function(e){var t,n,r;switch(e[0]){case"<":return this.sym(e.slice(1,-1));case'"':if(r=void 0,t=void 0,(n=e.lastIndexOf('"'))<e.length-1)if("@"===e[n+1])r=e.slice(n+2);else{if("^^"!==e.slice(n+1,n+3))throw new Error("Can't convert string from NT: "+e);t=this.fromNT(e.slice(n+3))}return e=(e=(e=(e=e.slice(1,n)).replace(/\\"/g,'"')).replace(/\\n/g,"\n")).replace(/\\\\/g,"\\"),this.literal(e,r,t);case"_":return new i(e.slice(2));case"?":return new f(e.slice(1))}throw new Error("Can't convert from NT: "+e)}},{key:"holds",value:function(e,t,n,r){var i;if(1===arguments.length){if(!e)return!0;if(e instanceof Array){for(i=0;i<e.length;i++)if(!this.holds(e[i]))return!1;return!0}if(e instanceof h)return this.holds(e.subject,e.predicate,e.object,e.why);if(e.statements)return this.holds(e.statements)}return null!=this.anyStatementMatching(e,t,n,r)}},{key:"holdsStatement",value:function(e){return this.holds(e.subject,e.predicate,e.object,e.why)}},{key:"list",value:function(e){var t=new o;return e.forEach(function(e){t.append(e)}),t}},{key:"literal",value:function(e,t,n){return new s(""+e,t,n)}},{key:"NTtoURI",value:function(e){var t,n,r={};for(t in e)e.hasOwnProperty(t)&&(n=e[t],"<"===t[0]&&(r[t.slice(1,-1)]=n));return r}},{key:"serialize",value:function(e,t,n){var r,i,a;switch((a=d(this)).suggestNamespaces(this.namespaces),a.setBase(e),i=n?this.statementsMatching(void 0,void 0,void 0,n):this.statements,null==t?"text/n3":t){case"application/rdf+xml":r=a.statementsToXML(i);break;case"text/n3":case"text/turtle":r=a.statementsToN3(i);break;default:throw new Error("serialize: Content-type "+t+" not supported.")}return r}},{key:"substitute",value:function(e){var n=this.statements.map(function(t){return t.substitute(e)});console.log("Formula subs statmnts:"+n);var r=new t;return r.add(n),console.log("indexed-form subs formula:"+r),r}},{key:"sym",value:function(e,t){if(t)throw new Error("This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.");return new l(e)}},{key:"the",value:function(e,t,n,r){var i=this.any(e,t,n,r);return null==i&&u.error("No value found for the() {"+e+" "+t+" "+n+"}."),i}},{key:"transitiveClosure",value:function(e,t,n){var r,i,a,o,s,u={};Object.assign(u,e);for(var l={};;){if(null==(s=function(){for(var e in u)if(u.hasOwnProperty(e))return e}()))return l;for(r=0,i=(o=n?this.each(void 0,t,this.fromNT(s)):this.each(this.fromNT(s),t)).length;r<i;r++)!((a=o[r].toNT())in l)&&(a in u||(u[a]=u[s]));l[s]=u[s],delete u[s]}}},{key:"topTypeURIs",value:function(e){var t,n,r,i,a,o,s;for(n in o=[],e)if(e.hasOwnProperty(n)){for(s=e[n],i=0,t=0,r=(a=this.each(this.sym(n),this.sym("http://www.w3.org/2000/01/rdf-schema#subClassOf"))).length;t<r;t++)if("http://www.w3.org/2000/01/rdf-schema#Resource"!==a[t].uri){i++;break}i||(o[n]=s)}return o["http://www.w3.org/2000/01/rdf-schema#Resource"]&&delete o["http://www.w3.org/2000/01/rdf-schema#Resource"],o["http://www.w3.org/2002/07/owl#Thing"]&&delete o["http://www.w3.org/2002/07/owl#Thing"],o}},{key:"toString",value:function(){return"{"+this.statements.join("\n")+"}"}},{key:"whether",value:function(e,t,n,r){return this.statementsMatching(e,t,n,r,!1).length}}]),t}();p.termType="Graph",p.prototype.classOrder=a.Graph,p.prototype.isVar=0,p.prototype.ns=n(62),p.prototype.variable=function(e){return new f(e)},e.exports=p},function(e,t,n){"use strict";var r=n(12),i=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)};i.boolean=new r("http://www.w3.org/2001/XMLSchema#boolean"),i.dateTime=new r("http://www.w3.org/2001/XMLSchema#dateTime"),i.decimal=new r("http://www.w3.org/2001/XMLSchema#decimal"),i.double=new r("http://www.w3.org/2001/XMLSchema#double"),i.integer=new r("http://www.w3.org/2001/XMLSchema#integer"),i.langString=new r("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),i.string=new r("http://www.w3.org/2001/XMLSchema#string"),e.exports=i},function(e,t,n){var r=n(0),i=n(4);e.exports={icon:r.icons.iconBase+"noun_547570.svg",name:"home",label:function(e){return"home"},render:function(e,t){var n=t.createElement("div"),a=r.authn.currentUser();return function(){var e={div:n,dom:t,statusArea:n,me:a},o=n.appendChild(t.createElement("div")),s={div:o,dom:t,statusArea:n,me:a};o.appendChild(t.createElement("h4")).textContent="Make a new tool",r.create.newThingUI(s,i),n.appendChild(t.createElement("h4")).textContent="Private:",r.authn.registrationList(e,{private:!0}).then(function(e){n.appendChild(t.createElement("h4")).textContent="Public:",r.authn.registrationList(e,{public:!0}).then(function(e){})})}(),n}}},function(e,t,n){const r=void 0!==e;var i,a;r?(a=n(0),i=n(4)):(i=window.panes,a=i.UI);const o=a.store,s=a.ns,u="#090",l={icon:a.icons.iconBase+"noun_492246.svg",name:"profile",label:function(e){var t=o.findTypeURIs(e);return t[a.ns.foaf("Person").uri]||t[a.ns.vcard("Individual").uri]?"Your Profile":"Edit your profile"},render:function(e,t){function n(e,t,n){var r=i.byName(n).render(t,e);return r.setAttribute("style","border: 0.3em solid #444; border-radius: 0.5em"),r}function r(e){var n=h.appendChild(t.createElement("p"));return n.setAttribute("style","padding: 1em;"),n.textContent=e,n}function l(e){var n=h.appendChild(t.createElement("h3"));return n.setAttribute("style","color:"+u+";"),n.textContent=e,n}var c=t.createElement("div");c.setAttribute("style","border: 0.3em solid "+u+"; border-radius: 0.5em; padding: 0.7em; margin-top:0.7em;");var d=c.appendChild(t.createElement("table")),h=d.appendChild(t.createElement("tr")),f=d.appendChild(t.createElement("tr")).appendChild(t.createElement("div"));f.setAttribute("style","padding: 0.7em;");var p={dom:t,div:h,statusArea:f,me:null};return a.authn.logInLoadProfile(p).then(i=>{var u=i.me;e=u,l("Edit your public profile");var c=e.doc(),d=a.store.updater.editable(c.uri,o);d||f.appendChild(a.widgets.errorMessageBlock(t,`Your profile ${e.doc().uri} is not editable, so we cant so much.`)),r("Everything you put here will be public.\n There will be other places to record private things.."),l("Your contact information"),h.appendChild(n(t,e,"contact")),l("People you know who have webids"),r("This is your public social network.\n Just put people here you are happy to be connected with publically\n (You can always keep private track of friends and family in your contacts.)"),d&&r("Drag people onto the target bellow to add people."),a.widgets.attachmentList(t,e,h,{doc:c,modify:!!d,predicate:s.foaf("knows"),noun:"friend"}),l("Thank you for filling your profile.")},e=>{f.appendChild(a.widgets.errorMessageBlock(t,e))}),c}};r?e.exports=l:(console.log("*** patching in live pane: "+l.name),i.register(l))},function(e,t,n){const r=n(0),i=n(4),a=r.ns;e.exports={icon:r.icons.originalIconBase+"tango/22-emblem-system.png",name:"internal",label:function(e){return"under the hood"},render:function(e,t){function n(e,t){return!!u["http://www.w3.org/2007/ont/link#ProtocolEvent"]||void 0!==i.internal.predicates[e.uri]}var o=r.rdf,s=r.store;e=s.canon(e);var u=s.findTypeURIs(e),l=t.createElement("div");if(l.setAttribute("class","internalPane"),l.setAttribute("style","background-color: #ddddff; padding: 0.5em; border-radius: 1em;"),e.uri&&!e.uri.includes("#")){const n=l.appendChild(t.createElement("table"));n.style="width: 100%; margin: 1em;";const i=n.appendChild(t.createElement("tr")),o=i.appendChild(t.createElement("td")),u=e.uri&&e.uri.endsWith("/")||s.holds(e,a.rdf("type"),a.ldp("Container")),d=u?"folder":"file";var c=r.widgets.deleteButtonWithCheck(t,o,d,function(){confirm("Are you sure you want to delete "+e+"? This cannot be undone.")&&(u?function e(t,n){return new Promise(function(r,i){t.fetcher.load(n).then(function(){let o=t.each(n,a.ldp("contains")).map(n=>t.holds(n,a.rdf("type"),a.ldp("BasicContainer"))?e(t,n):(console.log("deleteRecursive leaf file: "+n),t.fetcher.webOperation("DELETE",n)));Promise.all(o).then(e=>{console.log("deleteRecursive empty folder: "+n),t.fetcher.webOperation("DELETE",n).then(e=>{console.log("Deleted Ok: "+n),r()},e=>{var t="Unable to delete "+n+": "+e;console.log(t),i(new Error(t))}),r()},e=>{alert(e),i(e)})})})}(s,e):s.fetcher.webOperation("DELETE",e.uri)).then(t=>{var n="Deleted: "+e;console.log(n)},t=>{var n="Unable to delete "+e+": "+t;console.log(n),alert(n)})});c.style="height: 2em;",c.class="",o.appendChild(c);const h=i.appendChild(t.createElement("td")),f=r.widgets.button(t,r.icons.iconBase+"noun_479395.svg","refresh");h.appendChild(f),f.addEventListener("click",t=>{s.fetcher.refresh(e,function(t,n,r){let i;i=t?"Refreshed OK: "+e:"Error refreshing: "+e+": "+n,console.log(i),alert(i)})})}var d=s.statementsMatching(e),h=null;if(e.uri&&(d.push(o.st(e,s.sym("http://www.w3.org/2007/ont/link#uri"),e.uri,r.store.fetcher.appNode)),0<=e.uri.indexOf("#")?(h=e.uri.split("#")[0],d.push(o.st(e,s.sym("http://www.w3.org/2007/ont/link#documentURI"),e.uri.split("#")[0],r.store.fetcher.appNode)),d.push(o.st(e,s.sym("http://www.w3.org/2007/ont/link#document"),s.sym(e.uri.split("#")[0]),r.store.fetcher.appNode))):h=e.uri),h){var f=r.store.updater.editable(h);f&&d.push(o.st(e,s.sym("http://www.w3.org/ns/rww#editable"),s.literal(f),r.store.fetcher.appNode))}var p=i.getOutliner(t);return p.appendPropertyTRs(l,d,!1,n),d=s.statementsMatching(void 0,void 0,e),p.appendPropertyTRs(l,d,!0,n),l},predicates:{"http://www.w3.org/2007/ont/link#request":1,"http://www.w3.org/2007/ont/link#requestedBy":1,"http://www.w3.org/2007/ont/link#source":1,"http://www.w3.org/2007/ont/link#session":2,"http://www.w3.org/2007/ont/link#uri":1,"http://www.w3.org/2007/ont/link#documentURI":1,"http://www.w3.org/2007/ont/link#document":1,"http://www.w3.org/2007/ont/link#all":1,"http://www.w3.org/2007/ont/link#Document":1,"http://www.w3.org/ns/rww#editable":1,"http://www.w3.org/2000/01/rdf-schema#seeAlso":1,"http://www.w3.org/2002/07/owl#":1},classes:{"http://www.w3.org/2007/ont/link#ProtocolEvent":1}}},function(e,t,n){const r=n(0);e.exports={icon:r.icons.iconBase+"noun_123691.svg",name:"sharing",label:function(e){var t=r.store,n=r.ns,i=t.findTypeURIs(e);return i[n.ldp("Resource").uri]?"Sharing":i[n.ldp("Container").uri]?"Sharing":i[n.ldp("BasicContainer").uri]?"Sharing":null},render:function(e,t){var n=r.store,i=r.ns,a=t.createElement("div");a.setAttribute("class","sharingPane");var o=n.findTypeURIs(e),s="file";(o[i.ldp("BasicContainer").uri]||o[i.ldp("Container").uri])&&(s="folder");var u=t.createElement("div"),l=u.appendChild(t.createElement("table"));l.setAttribute("style","font-size:120%; margin: 1em; border: 0.1em #ccc ;");var c=l.appendChild(t.createElement("tr")).appendChild(t.createElement("div"));c.setAttribute("style","padding: 2em;");var d=l.appendChild(t.createElement("tr")).appendChild(t.createElement("table")),h={target:e,me:null,noun:s,div:u,dom:t,statusRegion:c},f=r.authn.currentUser();return h.me=f,r.aclControl.preventBrowserDropEvents(t),d.appendChild(r.aclControl.ACLControlBox5(e,t,s,n,function(e,t){e||(d.innerHTML="ACL control box Failed: "+t)})),a.appendChild(u),a}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.originalIconBase+"microblog/microblog.png",name:"microblogPane",label:function(e){return r.store.whether(e,r.ns.rdf("type"),r.ns.foaf("Person"))?"Microblog":null},render:function(e,t){var n=r.rdf.Namespace("http://rdfs.org/sioc/ns#"),i=r.rdf.Namespace("http://rdfs.org/sioc/types#"),a=r.rdf.Namespace("http://xmlns.com/foaf/0.1/"),o=r.rdf.Namespace("http://purl.org/dc/terms/"),s=r.ns.rdf,u=r.store,l=r.store.fetcher,c=u.updater,d=function(e){this.userlist={},this.uris={};var t=u.each(u.sym(e),n("follows"));for(var r in t)this.add(u.any(t[r],n("id")),t[r].uri)};d.prototype.add=function(e,t){this.userlist[e]?!(t in this.uris)&&(this.userlist[e].push(t),this.uris[t]=""):this.userlist[e]=[t]},d.prototype.selectUser=function(e){return this.userlist[e]?[1===this.userlist[e].length,this.userlist[e]]:[!1,[]]};var h=function(e){if(this.favorites={},this.favoritesURI="",e){this.user=e.split("#")[0];let a=u.each(u.sym(e),n("creator_of"));for(let e in a)if(u.whether(a[e],s("type"),i("FavouriteThings"))){this.favoritesURI=a[e];var t=u.each(a[e],n("container_of"));for(var r in t)this.favorites[t[r]]="";break}}};h.prototype.favorited=function(e){return u.sym(e)in this.favorites},h.prototype.add=function(e,t){var i=new r.rdf.Statement(this.favoritesURI,n("container_of"),u.sym(e),u.sym(this.user));c.insert_statement(i,function(e,n,r){n&&u.add(i.subject,i.predicate,i.object,i.why),t(e,n,r)})},h.prototype.remove=function(e,t){var i=new r.rdf.Statement(this.favoritesURI,n("container_of"),u.sym(e),u.sym(this.user));c.delete_statement(i,function(e,n,r){n&&u.add(i.subject,i.predicate,i.object,i.why),t(e,n,r)})};var f=function(e){this.kb=e;var t=r.authn.currentUser();if(t){var n=tabulator.preferences.get("acct");n&&(n=e.sym(n)),t&&n&&e.add(t,a("holdsAccount"),n,t.uri.split("#")[0])}};f.prototype.getUser=function(e){return{name:u.any(e,n("name"))?u.any(e,n("name")):"",avatar:u.any(e,n("avatar"))?u.any(e,n("avatar")):"",id:u.any(e,n("id")),sym:e}},f.prototype.getPost=function(e){var t={},r=new Date(u.anyValue(e,o("created"))),i=r.getHours(),a=12<i?" PM":" AM";i=12<i?i-12:i;var s=r.getMinutes();return r=i+":"+(s=10>s?"0"+s:s)+a+" on "+(["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.getDay()]+" "+r.getDate()+" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getMonth()]+" "+r.getFullYear()),t.date=r,t.mentions="",t.message=u.any(e,n("content"))+"",t.creator=u.any(e,n("has_creator")),t.uri="",t},f.prototype.gen_random_uri=function(e){var t=e+"#n"+_Mathfloor(1e10*Math.random());return u.sym(t)},f.prototype.statusUpdate=function(e,t,a,l){var d=this.getMyURI();let h=u.sym(d.split("#")[0]);var f,p=this.gen_random_uri(h.uri),m=u.each(u.sym(d),n("creator_of"));for(var v in m)if(u.whether(m[v],s("type"),i("Microblog"))&&!u.whether(m[v],n("topic"),u.sym(this.getMyURI()))){f=m[v];break}var g=[new r.rdf.Statement(p,s("type"),i("MicroblogPost"),h),new r.rdf.Statement(p,n("has_creator"),u.sym(d),h),new r.rdf.Statement(p,n("content"),e,h),new r.rdf.Statement(p,o("created"),new Date,h),new r.rdf.Statement(f,n("container_of"),p,h)];for(var b in a&&g.push(new r.rdf.Statement(p,n("reply_of"),u.sym(a),h)),l.recipients){g.push(new r.rdf.Statement(p,n("topic"),u.sym(l.recipients[b]),h)),g.push(new r.rdf.Statement(u.any(),n("container_of"),p,h));var y=u.each(u.sym(l.recipients[b]),n("creator_of"));for(var w in y)if(u.whether(y[w],n("topic"),u.sym(l.recipients[b]))){var _=new r.rdf.Statement(y[w],n("container_of"),p,u.sym(l.recipients[b].split("#")[0]));c.insert_statement(_)}}c.insert_statement(g,function(e,n,r){t(e,n,r,g)})},f.prototype.getMyURI=function(){var e=r.authn.currentUser();console.log(e);var t=u.any(u.sym(e),a("holdsAccount"));return console.log("\n\n"+t),!!t&&t.uri},f.prototype.generateNewMB=function(t,o,l,d){var h=d+"/"+t,f=[new r.rdf.Statement(u.sym(h+"#"+t),s("type"),n("User"),u.sym(h)),new r.rdf.Statement(u.sym(h+"#"+t),n("creator_of"),u.sym(h+"#mb"),u.sym(h)),new r.rdf.Statement(u.sym(h+"#"+t),n("creator_of"),u.sym(h+"#mbn"),u.sym(h)),new r.rdf.Statement(u.sym(h+"#"+t),n("creator_of"),u.sym(h+"#fav"),u.sym(h)),new r.rdf.Statement(u.sym(h+"#"+t),n("name"),o,u.sym(h)),new r.rdf.Statement(u.sym(h+"#"+t),n("id"),t,u.sym(h)),new r.rdf.Statement(u.sym(h+"#"+t),s("label"),t,u.sym(h)),new r.rdf.Statement(e,a("holdsAccount"),u.sym(h+"#"+t),u.sym(h)),new r.rdf.Statement(u.sym(h+"#mb"),s("type"),i("Microblog"),u.sym(h)),new r.rdf.Statement(u.sym(h+"#mb"),n("has_creator"),u.sym(h+"#"+t),u.sym(h)),new r.rdf.Statement(u.sym(h+"#mbn"),s("type"),i("Microblog"),u.sym(h)),new r.rdf.Statement(u.sym(h+"#mbn"),n("topic"),u.sym(h+"#"+t),u.sym(h)),new r.rdf.Statement(u.sym(h+"#mbn"),n("has_creator"),u.sym(h+"#"+t),u.sym(h)),new r.rdf.Statement(u.sym(h+"#fav"),s("type"),i("FavouriteThings"),u.sym(h)),new r.rdf.Statement(u.sym(h+"#fav"),n("has_creator"),u.sym(h+"#"+t),u.sym(h))];l&&f.push(new r.rdf.Statement(u.sym(h+"#"+t),n("avatar"),u.sym(l),u.sym(h))),c.insert_statement(f,function(e,n,r,i){if(n)for(var a in alert("Microblog generated at "+h+"#"+t+"please add <b>"+h+"</b> to your foaf."),tabulator.preferences.set("acct",h+"#"+t),i)u.add(i[a].subject,i[a].predicate,i[a].object,i[a].why)})};var p=new f(u),m=new h(p.getMyURI()),v=new d(p.getMyURI()),g=function(e,t,o){var l=function(e){this.tablist={},this.doc=e,this.tabView=e.createElement("ul"),this.tabView.className="tabslist"};l.prototype.create=function(e,n,r,i){var a=this.doc.createElement("li");a.innerHTML=n,i&&(a.className="active"),a.id=e;let o=this.change,s=this.tablist;a.addEventListener("click",function(e){o(e.target.id,s,t)},!1),this.tablist[e]={view:r.id,tab:a},this.tabView.appendChild(a)},l.prototype.getTabView=function(){return this.tabView},l.prototype.change=function(e,t,n){for(var r in t)if(r===e)t[e].tab.className="active",n.getElementById(t[e].view).className+=" active";else{var i=n.getElementById(t[r].view);i.className=i.className.replace(/\w*active\w*/,""),t[r].tab.className=t[e].tab.className.replace(/\w*active\w*/,"")}},this.microblogPane=o;var c=u.each(e,a("holdsAccount"));for(var d in c)if(u.whether(c[d],s("type"),n("User"))&&u.whether(u.any(c[d],n("creator_of")),s("type"),i("Microblog"))){var h=c[d];break}this.Ifollow=u.whether(u.sym(p.getMyURI()),n("follows"),h);var f=u.any(e,s("type"));if(f.uri===i("Microblog").uri||f.uri===i("MicroblogPost").uri)this.thisIsMe=u.any(e,n("has_creator")).uri===p.getMyURI();else if(f.uri===n("User").uri)this.thisIsMe=e.uri===p.getMyURI();else if(f.uri===a("Person").uri){let t=r.authn.currentUser(),n=t&&t.uri;this.thisIsMe=e.uri===n}else this.thisIsMe=!1;this.Tab=new l(t)};g.prototype.notify=function(e){var n=t.createElement("li");n.className="notify",n.innerHTML=e,t.getElementById("notify-container").appendChild(n),setTimeout(function(){t.getElementById("notify-container").removeChild(n)},4e3)},g.prototype.header=function(e,t){var o=this,l=function(e){var n=t.createElement("li");n.className="notify",n.innerHTML=e,t.getElementById("notify-container").appendChild(n),setTimeout(function(){t.getElementById("notify-container").removeChild(n)},4e3)},d=function(e){b.removeChild(b.childNodes[b.childNodes.length-1]),k.disabled=!1},h=function(){_.innerHTML=140-w.value.length,_.style.color=0>140-w.value.length?"#c33":"",0===w.value.length&&(y.value="",x.value="Send")},f=t.createElement("ul");f.className="replyView",f.addEventListener("click",function(){f.className="replyView"},!1),this.xviewReply=f;var m=t.createElement("div");m.className="header-container";var g=t.createElement("ul");g.id="notify-container",g.className="notify-container",this.xnotify=g;var b=t.createElement("form");if(b.className="update-container",b.innerHTML="<h3>What are you up to?</h3>",p.getMyURI()){var y=t.createElement("input");y.id="xinReplyToContainer",y.type="hidden";var w=t.createElement("textarea");w.id="xupdateStatus";var _=t.createElement("span");_.appendChild(t.createTextNode(140)),w.cols=30,w.addEventListener("keyup",h,!1),w.addEventListener("focus",h,!1);var x=t.createElement("input");x.id="xupdateSubmit",x.type="submit",x.value="Send",b.appendChild(y),b.appendChild(_),b.appendChild(w),b.appendChild(x),b.addEventListener("submit",function(){var e={recipients:[]};if(p.getMyURI()){var r=function(e,n,r,i){if(!0===n){for(var a in i)u.add(i[a].subject,i[a].predicate,i[a].object,i[a].why);x.disabled=!1,w.value="",h(),l("Microblog Updated."),o.thisIsMe&&t.getElementById("postNotificationList").insertBefore(o.generatePost(i[0].subject),t.getElementById("postNotificationList").childNodes[0])}else l("There was a problem submitting your post.")},i=w.value.split(" "),a=function(){x.disabled=!0,x.value="Updating...",p.statusUpdate(w.value,r,y.value,e)};for(var s in i)if(i[s].match(/@\w+/)){var c=i[s].replace(/\W/g,""),d=v.selectUser(c);if(!0===d[0])e.recipients.push(d[1][0]);else{if(1<d[1].length){var f=t.createElement("select"),m=t.createElement("input");m.type="button",m.value="Continue",m.addEventListener("click",function(){e.recipients.push(d[1][f.value]),a(),f.parentNode.removeChild(m),f.parentNode.removeChild(f)},!1);var g=function(e,r){var i=u.any(u.sym(e),n("name")),a=t.createElement("option");return a.value=r,a.innerHTML=i,a};for(var _ in d[1])f.appendChild(g(d[1][_],_));return b.appendChild(f),void b.appendChild(m)}if((u.any(u.sym(p.getMyURI()),n("id"))+"").toLowerCase()!==c.toLowerCase())return void l("You do not follow "+c+". Try following "+c+" before mentioning them.");e.recipients.push(p.getMyURI())}}a()}else l("Please set your microblog first.")},!1)}else{var M=t.createTextNode("Hi, it looks like you don't have a microblog, would you like to create one? "),k=t.createElement("input");k.type="button",k.value="Create a new Microblog",k.addEventListener("click",function(n){k.disabled=!0;var r=t.createElement("div"),i=t.createElement("input");u.whether(e,a("name"))?i.value=u.any(e,a("name")):(i.value=u.any(e,a("givenname"))?u.any(e,a("givenname"))+" ":"",i.value+=u.any(e,a("family_name"))?u.any(e,a("givenname")):"",i.value=u.any(e,a("givenname"))+" "+u.any(e,a("family_name")));var o=t.createElement("input");o.value=u.any(e,a("nick"))?u.any(e,a("nick")):"";var s=t.createElement("input");s.value=u.whether(e,a("img"))?u.any(e,a("img")).uri:u.any(e,a("depiction"))?u.any(e,a("depiction")).uri:"";var l=t.createElement("input");l.value="http://dig.csail.mit.edu/2007/wiki/sandbox",r.innerHTML='\n <form class ="createNewMB" id="createNewMB">\n <p id="xcmbname"><span class="">Name: </span></p>\n <p id="xcmbid">Id: </p>\n <p id="xcmbavatar">Avatar: </p>\n <p id="xcmbwritable">Host my microblog at: </p>\n <input type="button" id="mbCancel" value="Cancel" />\n <input type="submit" id="mbCreate" value="Create!" />\n </form>\n ',b.appendChild(r),t.getElementById("xcmbname").appendChild(i),t.getElementById("xcmbid").appendChild(o),t.getElementById("xcmbavatar").appendChild(s),t.getElementById("xcmbwritable").appendChild(l),t.getElementById("mbCancel").addEventListener("click",d,!1),t.getElementById("createNewMB").addEventListener("submit",function(){p.generateNewMB(o.value,i.value,s.value,l.value)},!1),i.focus()},!1),b.appendChild(M),b.appendChild(k)}m.appendChild(b);var C=t.createElement("div");C.className="subheader-container";var E=u.each(e,a("holdsAccount"));for(var A in E)if(u.whether(E[A],s("type"),n("User"))&&u.whether(u.any(E[A],n("creator_of")),s("type"),i("Microblog"))){var T=E[A];break}if(T){if(this.creator=p.getUser(T),""!==this.creator.avatar){var S=t.createElement("img");S.src=this.creator.avatar.uri,C.appendChild(S)}var I=t.createElement("h1");if(I.className="fn",I.appendChild(t.createTextNode(this.creator.name+" ("+this.creator.id+")")),C.appendChild(I),!this.thisIsMe&&p.getMyURI()){var N=t.createElement("input");N.setAttribute("type","button");let e=this.Ifollow?"Unfollow ":"Follow ";N.value=e+this.creator.name,N.addEventListener("click",function(){var e=u.sym(p.getMyURI()),t=o.creator.name,i=function(e,n,r){if(!0===n){o.Ifollow?u.removeMany(a.subject,a.predicate,a.object,a.why):!u.whether(a.subject,a.predicate,a.object,a.why)&&u.add(a.subject,a.predicate,a.object,a.why),console.log(o.Ifollow),o.Ifollow=!o.Ifollow,N.disabled=!1,console.log(o.Ifollow);var i=o.Ifollow?"Unfollow ":"Follow ",s=o.Ifollow?"now follow ":"no longer follow ";N.value=i+t,o.notify("You "+s+t+".")}},a=new r.rdf.Statement(e,n("follows"),o.creator.sym,e);N.disabled=!0,N.value="Updating...",o.Ifollow?c.delete_statement(a,i):c.insert_statement(a,i)},!1),C.appendChild(N)}var j=this.Tab.getTabView();m.appendChild(C),m.appendChild(j)}return m},g.prototype.generatePost=function(e,r){var i=this,o=function(e){let n=i.xviewReply;for(let e=0;e<n.childNodes.length;e++)n.removeChild(n.childNodes[0]);var r=t.createElement("li");r.className="closeContainer";var a=t.createElement("span");for(var o in a.innerHTML="&#215;",a.className="closeButton",r.appendChild(a),n.appendChild(r),e)n.appendChild(i.generatePost(u.sym(e[o]),this.thisIsMe,"view"));n.className="replyView-active",i.microblogPane.appendChild(n)},s=t.createElement("li");s.className="post",s.setAttribute("id",(e.uri+"").split("#")[1]);var d=p.getPost(e),h=u.any(void 0,a("holdsAccount"),u.any(e,n("has_creator"))),f=t.createElement("a");f.href=h.uri,f.className="userLink";var v=t.createTextNode(p.getUser(d.creator).id);f.appendChild(v);var g=t.createElement("img");g.src=p.getUser(d.creator).avatar.uri,g.className="postAvatar";var b=t.createElement("blockquote"),y=d.message,w=t.createElement("a");w.className="postLink",w.addEventListener("click",function(){o([e.uri])},!1),w.id="post_"+(e.uri+"").split("#")[1],w.setAttribute("content",e.uri),w.setAttribute("property","permalink");let _=t.createTextNode(d.date?d.date:"post date unknown");w.appendChild(_);var x=u.each(e,n("topic"));let M={};for(var k in x){l.lookUpThing(x[k]);let e=u.any(x[k],n("id"));M["@"+e]=x[k]}var C=y.match(/(@|#|!)\w+/g),E=function(){let e=C.pop();return M[e]?u.any(void 0,a("holdsAccount"),M[e]).uri:e};for(var A in M){var T=A.replace(/@/,""),S=RegExp("(@|!|#)("+T+")");y=y.replace(S,'$1<a href="'+E()+'">$2</a>')}b.innerHTML=y;var I=u.each(e,n("reply_of")),N=t.createElement("span");for(var j in I){var O;O=(I[j]+"").replace(/<|>/g,"");N.appendChild(function(){var n=t.createElement("a");return n.innerHTML=", <b>in reply to</b>",n.addEventListener("click",function(){return o([e.uri,O]),!1},!1),n}())}if(p.getMyURI()){var R=u.any(e,n("has_creator"));if(p.getMyURI()!==R.uri){var L=t.createElement("input");L.type="button",L.value="reply",L.className="reply",L.addEventListener("click",function(){var n=p.getUser(d.creator).id,r=t.getElementById("xupdateStatus"),i=t.getElementById("xinReplyToContainer"),a=t.getElementById("xupdateSubmit");r.value="@"+n+" ",r.focus(),i.value=e.uri,a.value="Reply"},!1)}else{var P=t.createElement("input");P.type="button",P.value="Delete",P.className="reply",P.addEventListener("click",function(e){var r=function(){t.getElementById("notify-container").removeChild(a),e.target.disabled=!1};e.target.disabled=!0;var a=t.createElement("li");a.className="notify conf",a.innerHTML+="<p>Are you sure you want to delete this post?</p>",a.addEventListener("keyup",function(e){27===e.keyCode&&r()},!1);var o=t.createElement("input");o.type="button",o.className="confirm",o.value="Delete",o.addEventListener("click",function(){l(),t.getElementById("notify-container").removeChild(a)},!1);var s=t.createElement("input");s.type="button",s.className="confirm",s.value="Cancel",s.addEventListener("click",r,!1),a.appendChild(s),a.appendChild(o),t.getElementById("notify-container").appendChild(a),s.focus();var l=function(){var r=function(t,n){if(n){i.notify("Post deleted.");var r=e.target.parentNode;r.parentNode.removeChild(r),u.removeMany(a)}else i.notify("Oops, there was a problem, please try again"),e.target.disabled=!0};e.target.disabled=!0;let a=u.statementsMatching(u.sym(t.getElementById("post_"+e.target.parentNode.id).getAttribute("content")));c.batch_delete_statement(a,function(a,o){if(o){var s=u.statementsMatching(void 0,n("container_of"),u.sym(t.getElementById("post_"+e.target.parentNode.id).getAttribute("content")));c.batch_delete_statement(s,r)}else i.notify("Oops, there was a problem, please try again"),e.target.disabled=!1})}},!1)}}var D=t.createElement("a");return D.innerHTML="&#9733;",D.addEventListener("click",function(e){var n=e.target.parentNode.id,r=t.getElementById("post_"+n).getAttribute("content");D.className+=" ing";var i=function(e,t,n,r){t&&(D.className="ed"===D.className.split(" ")[1]?"favorit":"favorit ed")};m.favorited(r)?m.remove(r,i):m.add(r,i)},!1),D.className=m.favorited(e.uri)?"favorit ed":"favorit",s.appendChild(g),s.appendChild(b),p.getMyURI()&&(s.appendChild(D),p.getMyURI()===R.uri?s.appendChild(P):s.appendChild(L)),s.appendChild(f),s.appendChild(w),""!==I&&s.appendChild(N),s},g.prototype.generatePostList=function(e){var n=t.createElement("ul"),r={},i=[];for(var a in e){var s=u.any(e[a],o("created"));s&&(i.push(s),r[s]=this.generatePost(e[a],this.thisIsMe))}for(var l in i.sort().reverse(),i)n.appendChild(r[i[l]]);return n},g.prototype.followsView=function(){var e=function(e){var r=u.any(e,n("id")),i=t.createElement("li");i.className="follow",r=r||e.uri;var o=u.any(void 0,a("holdsAccount"),e);return o=o?o.uri:e.uri,i.innerHTML='<a href="'+o+'">'+r+"</a>",i},r=t.createElement("div");if(r.id="xfollows",r.className="followlist-container view-container",this.creator&&u.whether(this.creator.sym,n("follows"))){var i=u.each(this.creator.sym,n("follows")),o=t.createElement("ul");for(var s in i)o.appendChild(e(i[s]));r.appendChild(o)}return this.Tab.create("tab-follows","Follows",r,!1),r},g.prototype.streamView=function(e,t){var r=t.createElement("div");r.id="postContainer",r.className="post-container view-container active";var i=[];if(u.whether(e,a("name"))&&u.whether(e,a("holdsAccount"))){l.lookUpThing(u.any(e,a("holdsAccount")));var o=u.each(u.any(e,a("holdsAccount")),n("follows"));for(var s in o){l.lookUpThing(o[s]);var c=u.each(o[s],n("creator_of"));for(var d in c){if(l.lookUpThing(c[d]),u.whether(c[d],n("topic"),o[s]))continue;i=i.concat(u.each(c[d],n("container_of")))}}}if(0<i.length){var h=this.generatePostList(i);h.id="postList",h.className="postList",r.appendChild(h)}return this.Tab.create("tab-stream","By Follows",r,!0),r},g.prototype.notificationsView=function(e,t){var r=t.createElement("div");r.id="postNotificationContainer",r.className="notification-container view-container";var o=t.createElement("div");o.id="postMentionContainer",o.className="mention-container view-container";var c=[],d=[],h=u.any(e,a("holdsAccount")),f=u.any(h,n("id")),p=u.each(h,n("creator_of"));for(var m in p)l.lookUpThing(p[m]),u.whether(p[m],n("topic"),h)?d=d.concat(u.each(p[m],n("container_of"))):u.whether(p[m],s("type"),i("Microblog"))&&(c=c.concat(u.each(p[m],n("container_of"))));var v=this.generatePostList(c);v.id="postNotificationList",v.className="postList",r.appendChild(v);var g=this.generatePostList(d);g.id="postMentionList",g.className="postList",o.appendChild(g),this.postMentionContainer=o,this.postNotificationContainer=r,this.Tab.create("tab-by-user","By "+f,r,!1),this.Tab.create("tab-at-user","@"+f,o,!1)},g.prototype.build=function(){var n=this.microblogPane;this.headerContainer=this.header(e,t),this.postContainer=this.streamView(e,t),this.notificationsView(e,t),this.xfollows=this.followsView(),n.className="ppane",n.appendChild(this.xviewReply),n.appendChild(this.xnotify),n.appendChild(this.headerContainer),void 0!==this.xfollows&&n.appendChild(this.xfollows),n.appendChild(this.postContainer),n.appendChild(this.postNotificationContainer),n.appendChild(this.postMentionContainer)};var b=t.createElement("div");return new g(e,t,b).build(),b}}},function(e,t,n){(function(e,t){const r=n(0),i=n(4);e.exports={icon:(e.__dirname||t)+"22-builder.png",name:"ui",label:function(e){var t=r.ns,n=r.store.findTypeURIs(e);return n[t.rdfs("Class").uri]?"creation forms":n[t.ui("Form").uri]?"edit form":null},render:function(e,t){var n=r.store,a=r.ns,o=t.createElement("div");o.setAttribute("class","formPane");var s,u=r.utils.label(e),l=function(e,n){var r=t.createElement("p");return r.setAttribute("style",n||"color: grey; background-color: white"),o.appendChild(r).textContent=e,r},c=function(e,t){l(e,"style")},d=function(e,t){e||c("Sorry, failed to save your change:\n"+t)},h=n.findTypeURIs(e),f=null;if(e.uri){var p=$rdf.Util.uri.docpart(e.uri);e.uri!==p&&r.store.updater.editable(p)&&(f=n.sym($rdf.Util.uri.docpart(e.uri)))}f||(f=n.any(n.sym(p),a.link("annotationStore"))),f||(f=r.widgets.defaultAnnotationStore(e)),f||(f=n.sym("http://tabulator.org/wiki/ontologyAnnotation/common")),h[a.rdfs("Class").uri];var m=l("(Loading data from: "+f+")");return n.fetcher.nowOrWhenFetched(f.uri,e,function(p,v){if(p)if(o.removeChild(m),h[a.rdfs("Class").uri]){var g=function(s,h){var p=n.statementsMatching(e,s);const m=i.getOutliner(t);if(p.length){for(var v=0;v<p.length;v++){m.appendPropertyTRs(o,[p[v]]);var g=p[v].object,b=t.createElement("td");o.lastChild.appendChild(b),h&&b.appendChild(r.widgets.newButton(t,n,null,null,e,g,f,function(e,t){e||c("Sorry, failed to save your change:\n"+t)}));var y=n.statementsMatching(g,a.rdf("type"));y.length||(y=n.statementsMatching(g)),y.length?r.widgets.editFormButton(t,o,g,y[0].why,d):c("No data about form")}o.appendChild(t.createElement("hr"))}else l("There are currently no known forms to make a "+u+".")};s=a.ui("creationForm"),o.appendChild(t.createElement("h2")).textContent=r.utils.label(s),l("Creation forms allow you to add information about a new thing, in this case a new "+u+"."),g(s,!0),o.appendChild(t.createElement("hr")),l("You can make a new creation form:"),o.appendChild(r.widgets.newButton(t,n,e,s,a.ui("Form"),null,f,d)),o.appendChild(t.createElement("hr")),s=a.ui("annotationForm"),o.appendChild(t.createElement("h2")).textContent=r.utils.label(s),l("Annotaion forms allow you to add extra information about a ,"+u+" we already know about."),g(s,!1),o.appendChild(t.createElement("hr")),l("You can make a new annotation form:"),o.appendChild(r.widgets.newButton(t,n,e,s,a.ui("Form"),null,f,d)),l("(Storing new forms in: "+f+")")}else h[a.ui("Form").uri]?r.widgets.appendForm(t,o,n,e,a.ui("FormForm"),f,d):c("ui/pane internal error -- Eh?");else c("Cannot load store "+f+" :"+v)}),o}}}).call(this,n(22)(e),"/")},function(e,t,n){var r=n(0),i=n(4);e.exports={icon:r.icons.originalIconBase+"about.png",name:"default",label:function(e){return"about "},render:function(e,t){var n=function(e,t){return void 0===i.internal.predicates[e.uri]&&(!t||"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"!==e.uri)},a=i.getOutliner(t),o=r.store;r.log.info("@defaultPane.render, dom is now "+t.location),e=o.canon(e);var s=t.createElement("div");s.setAttribute("class","defaultPane");var u=o.statementsMatching(e);if(a.appendPropertyTRs(s,u,!1,n),u=o.statementsMatching(void 0,void 0,e),a.appendPropertyTRs(s,u,!0,n),"Literal"===e.termType&&"http://"===e.value.slice(0,7)&&a.appendPropertyTRs(s,[$rdf.st(o.sym(e.value),r.ns.link("uri"),e)],!0,n),"NamedNode"===e.termType&&o.updater.editable(r.rdf.Util.uri.docpart(e.uri),o)||"BlankNode"===e.termType&&o.anyStatementMatching(e)&&o.anyStatementMatching(e).why&&o.anyStatementMatching(e).why.uri&&o.updater.editable(o.anyStatementMatching(e).why.uri)){var l=t.createElement("tr"),c=t.createElement("td");c.setAttribute("colspan","2"),c.setAttribute("notSelectable","true");var d=t.createElement("img");d.src=r.icons.originalIconBase+"tango/22-list-add-new.png",d.addEventListener("click",function(e){a.UserInput.addNewPredicateObject(e),e.stopPropagation(),e.preventDefault()}),d.className="bottom-border-active",s.appendChild(l).appendChild(c).appendChild(d)}return s}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.originalIconBase+"table.png",name:"tableOfClass",label:function(e){if(!r.store.any(void 0,r.ns.rdf("type"),e))return null;var t=r.store.statementsMatching(void 0,r.ns.rdf("type"),e).length;return 0===t?null:15<t?null:r.utils.label(e)+" table"},render:function(e,t){var n=t.createElement("div");return n.setAttribute("class","tablePane"),n.appendChild(r.table(t,{tableClass:e})),n}}},function(e,t,n){var r=n(0),i=n(4);e.exports={icon:r.icons.iconBase+"noun_25830.svg",name:"attachments",label:function(e){var t=r.store,n=t.findTypeURIs(e),i=$rdf.Namespace("http://www.w3.org/2000/10/swap/pim/qif#"),a=$rdf.Namespace("http://www.w3.org/2005/01/wf/flow#");return n["http://www.w3.org/ns/pim/trip#Trip"]||"http://www.w3.org/ns/pim/trip#Trip"===e.uri||n["http://www.w3.org/2005/01/wf/flow#Task"]||n["http://www.w3.org/2000/10/swap/pim/qif#Transaction"]||i("Transaction")in t.findSuperClassesNT(e)||t.holds(e,a("attachment"))?"attachments":null},render:function(e,t){var n=r.store,a=$rdf.Namespace("http://www.w3.org/2005/01/wf/flow#"),o=$rdf.Namespace("http://www.w3.org/2000/10/swap/pim/qif#"),s=function(e){var n=t.createElement("pre");n.setAttribute("style","background-color: pink"),l.appendChild(n),n.appendChild(t.createTextNode(e))},u=function(e,t){return e.updater.editable(t.doc(),e)?t.doc():e.any(t.doc(),o("annotationStore"))},l=t.createElement("div"),c=r.utils.escapeForXML;l.setAttribute("class","attachPane"),l.innerHTML="<h1>"+c(r.utils.label(e,!0))+" attachments</h1>";var d,h,f=a("attachment"),p=o("SupportingDocument"),m={},v=0,g=null,b=null,y=o("SupportingDocument"),w=function(t){var i=n.sym({"http://www.w3.org/2005/01/wf/flow#Task":"http://purl.org/dc/elements/1.1/created","http://www.w3.org/ns/pim/trip#Trip":"http://www.w3.org/2002/12/cal/ical#dtstart","http://www.w3.org/2000/10/swap/pim/qif#Transaction":"http://www.w3.org/2000/10/swap/pim/qif#date","http://www.w3.org/2000/10/swap/pim/qif#SupportingDocument":"http://purl.org/dc/elements/1.1/date"}[e.uri]);return i||(i=n.any(e,r.ns.ui("sortBy"))),i},_=function(e){var t,r,i,a=function(e){var t=w(e.uri);if(t)return t;var r=n.findSuperClassesNT(e);for(var i in r)if(t=w(n.fromNT(i).uri))return t}(e),o=n.findMemberURIs(e),u=[],l=[];for(t in o)o.hasOwnProperty(t)&&(r=n.sym(t),a?i=(i=n.any(r,a))?i.value:"8888-12-31":(s("No sortby "+a+" for "+r),i="9999-12-31"),u.push([i,r]));u.sort(),u.reverse();for(var c=0;c<u.length;c++)l.push(u[c][1]);return l};"http://www.w3.org/ns/pim/trip#Trip"===e.uri||o("Transaction")in n.findSuperClassesNT(e)?(h=!0,d=_(e)):(g=e,v=1,d=[e],h=!1);var x=_(p);x||s("objects:"+x.length);var M=function(){b=null,N.innerHTML=""},k=function(e){var i=0===e?x:1===e?null===g?x.filter(function(e){return!!n.holds(void 0,f,e)}):x.filter(function(e){return!!n.holds(g,f,e)}):x.filter(function(e){return 0===n.each(void 0,f,e).length});r.widgets.selectorPanelRefresh(I,t,n,y,f,!0,i,m,T,E),1===i.length?(b=i[0],T(b,null,!0)):M()},C=function(e,t,r,i){if(n.holds(e,f,t)!==r){var a=r?"attach":"detach",o=function(n,r,o){r?i():s("Error: Unable to "+a+" "+t.uri+" to "+e.uri+":\n"+o)},l=u(n,e);if(l){var c=[$rdf.st(e,f,t,l)];r?n.updater.update([],c,o):n.updater.update(c,[],o)}else s("There is no annotation store for: "+e.uri)}},E=function(e,t,r,i){var a,o;if(r){if(!g)return void s("No subject for the link has been selected");a=g,o=e}else{if(!b)return void s("No object for the link has been selected");a=e,o=b}C(a,o,!n.holds(a,f,o),i)};if(h){var A=r.widgets.selectorPanel(t,n,e,f,!1,d,m,function(e,t,n){n?g=e:(g=null,1==v&&M()),0!=v&&k(v)},E);A.setAttribute("style","background-color: white; width: 25em; height: 100%; padding: 0 em; overflow:scroll; float:left"),l.appendChild(A)}var T=function(e,r,a){if(!a)return M(),void(N.innerHTML="");b=e;try{N.innerHTML="Loading ....",e.uri&&n.fetcher.load(e.uri).then(()=>{var n=i.getOutliner(t).propertyTable(e);N.innerHTML="",N.appendChild(n)}).catch(t=>{N.textContent="Error loading "+e.uri+": "+t})}catch(e){N.innerHTML='<span style="background-color: pink;">Error:'+e+"</span>"}};l.setAttribute("style","background-color: white; width:40cm; height:20cm;");var S=t.createElement("div");S.setAttribute("style"," width: 30em; height: 100%; padding: 0em; float:left;"),l.appendChild(S),S.appendChild(function(e,t,n,r){var i=e.createElement("table"),a=n;i.setAttribute("style","float: left; width: 30em; padding: 0.5em; height: 1.5em; background-color: #ddd; color: #444; font-weight: bold");var o=e.createElement("tr"),s="border-radius: 0.6em; text-align: center;";i.appendChild(o);var u,l,c=function(){for(u=0;u<t.length;u++)d[u].setAttribute("style",u===a?"border-radius: 0.6em; text-align: center;background-color: #ccc; color: black;":s)},d=[];for(u=0;u<t.length;u++)(l=d[u]=e.createElement("td")).textContent=t[u],o.appendChild(d[u]),function(e,t){e.addEventListener("click",function(e){a=t,c(),r(t)})}(l,u);return c(),i}(t,["all","attached","not attached"],v,function(e){e!==v&&(v=e,M(),k(e))}));var I=r.widgets.selectorPanel(t,n,y,f,!0,x,m,T,E);I.setAttribute("style","background-color: #ffe; width: 30em; height: 100%; padding: 0em; overflow:scroll;"),S.appendChild(I);var N=t.createElement("div");if(N.setAttribute("style","padding: 0em; margin: 0; height: 100%; overflow:scroll;"),l.appendChild(N),k(v),0<d.length&&h){for(var j,O={},R=0;R<d.length;R++)(j=u(n,d[R]))&&(O[j.uri]=d[R]);for(var L in O){let i=n.sym(L);var P=t.createElement("div");P.setAttribute("style","clear: left; width: 20em; margin-top:2em; background-color:#ccc; border-radius: 1em; padding: 1em; font-weight: bold;"),P.textContent="+ New "+r.utils.label(e),P.textContent+=" in "+r.utils.label(i);var D=t.createElement("span");D.setAttribute("style","font-weight: normal; font-size: 80%; color: #777;"),D.textContent=L,P.appendChild(t.createElement("br")),P.appendChild(D),P.addEventListener("click",function(a){var o=r.widgets.promptForNew(t,n,e,f,e,null,i,function(e,t){});try{l.insertBefore(o,P.nextSibling)}catch(e){l.appendChild(o)}},!1),l.appendChild(P)}}return l}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.iconBase+"noun_122196.svg",name:"form",label:function(e){var t=r.widgets.formsFor(e).length;return r.log.debug("Form pane: forms for "+e+": "+t),t?t+" forms":null},render:function(e,t){var n=r.store,i=r.ns,a=function(e,n){var r=t.createElement("p");return r.setAttribute("style",n||"color: grey; background-color: white"),l.appendChild(r).textContent=e,r},o=function(e,t){a(e,"style")},s=function(e,t){e||o("Sorry, failed to save your change:\n"+t)},u=r.authn.currentUser(),l=t.createElement("div");(l.setAttribute("class","formPane"),u)?0===n.each(u,i.ui("workspace")).length&&a("You don't seem to have any workspaces defined. A workspace is a place on the web (http://..) or in the file system (file:///) to store application data.\n"):a("You are not logged in. If you log in and have workspaces then you would be able to select workspace in which to put this new information");var c=function(e,i){n.fetcher.nowOrWhenFetched(e.uri,i,function(n,a){if(!n)return o("Cannot load store "+e.uri+": "+a);for(var u=r.widgets.formsFor(i),c=0;c<u.length;c++){var d=u[c],h=t.createElement("h4");if(l.appendChild(h),d.uri){var f=$rdf.Util.uri.document(d);if(f.uri!==d.uri)l.appendChild(r.widgets.editFormButton(t,l,d,f,s)).setAttribute("style","float: right;")}var p=t.createElement("a");p.setAttribute("href",d.uri),h.appendChild(p),p.textContent=r.utils.label(d,!0),r.widgets.appendForm(t,l,{},i,d,e,s)}})},d=null,h=$rdf.Util.uri.docpart(e.uri);if(e.uri!==h&&n.updater.editable(h,n)&&(d=e.doc()),!(d=d||n.any(n.sym(h),i.link("annotationStore")))){var f={},p=[];for(var m in n.statementsMatching(e).map(function(e){f[e.why.uri]=1}),n.statementsMatching(void 0,void 0,e).map(function(e){f[e.why.uri]=2}),f)p.push(f[m],m);p.sort();for(var v,g=0;g<p.length;g++)if((v=p[g][1])&&n.updater.editable(v)){d=n.sym(v);break}}var b="2014";if(d)c(d,e);else{o("No suitable store is known, to edit <"+e.uri+">.");var y=r.authn.selectWorkspace(t,function(t){a("Workspace selected OK: "+t);for(var r=n.each(void 0,i.space("workspace"),t);0<r.length;g++){var s=r[0],u=n.any(t,i.space("store")),l=n.any(t,i.cal("dtstart")).value(),d=n.any(t,i.cal("dtend")).value();if(u&&l&&d&&l<=b&&d>b){c(u,e);break}o("Note no suitable annotation store in activity: "+s)}});l.appendChild(y)}return l}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.originalIconBase+"22-text-xml4.png",name:"RDFXML",label:function(e){if("http://www.w3.org/2007/ont/link#ProtocolEvent"in r.store.findTypeURIs(e))return null;var t=r.store.statementsMatching(void 0,void 0,void 0,e).length;return 0===t?null:"As RDF/XML ("+t+")"},render:function(e,t){var n=r.store,i=t.createElement("div");i.setAttribute("class","RDFXMLPane");var a=n.statementsMatching(void 0,void 0,void 0,e),o=r.rdf.Serializer(n);o.suggestNamespaces(n.namespaces),o.setBase(e.uri);var s=o.statementsToXML(a),u=t.createElement("PRE");return u.appendChild(t.createTextNode(s)),i.appendChild(u),i}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.originalIconBase+"w3c/n3_smaller.png",name:"n3",label:function(e){if("http://www.w3.org/2007/ont/link#ProtocolEvent"in r.store.findTypeURIs(e))return null;var t=r.store.statementsMatching(void 0,void 0,void 0,e).length;return 0===t?null:"Data ("+t+") as N3"},render:function(e,t){var n=r.store,i=t.createElement("div");i.setAttribute("class","n3Pane");var a=n.statementsMatching(void 0,void 0,void 0,e),o=r.rdf.Serializer(n);o.suggestNamespaces(n.namespaces),o.setBase(e.uri);var s=o.statementsToN3(a),u=t.createElement("PRE");return u.appendChild(t.createTextNode(s)),i.appendChild(u),i}}},function(e,t,n){const r=n(0),i=n(91),a=r.store,o={icon:r.icons.iconBase+"noun_109873.svg",name:"source",label:function(e){var t=a.findTypeURIs(e),n=$rdf.Util.mediaTypeClass("text/*").uri.split("*")[0];for(var r in t){if(r.startsWith(n))return"Source";if(r.includes("xml"))return"XML Source"}return null},mintNew:function(e){var t=e.newInstance;if(!t){let n=e.newBase;n.endsWith("/")&&(n=n.slice(0,-1),e.newBase=n),t=a.sym(n),e.newInstance=t}var n=i.lookup(t.uri);if(!n||!n.startsWith("text")&&!n.includes("xml")){let e="A new text file has to have an file extension like .txt .ttl etc.";throw alert(e),new Error(e)}return new Promise(function(r,i){a.fetcher.webOperation("PUT",t.uri,{data:"\n",contentType:n}).then(function(n){console.log("New text file created: "+t.uri),e.newInstance=t,r(e)},e=>{alert("Cant make new file: "+e),i(e)})})},render:function(e,t){function n(){f||(h=!0,y.style.color="black",w.style.visibility="visible",_.style.visibility="visible",x.style.visibility="collapse",y.removeAttribute("readonly"))}function i(e){if(!e.ok){let n="HTTP error! Status: "+e.statusRow;console.log(n),412===e.status&&(n="Error: File changed by someone else"),g.appendChild(r.widgets.errorMessageBlock(t,n))}return e.ok}function a(n){s.webOperation("GET",e.uri).then(function(n){if(i(n)){var a=n.responseText;return y.rows=a?a.split("\n").length+2:2,y.cols=80,y.value=a,f||(h=!1,x.style.visibility="visible",y.style.color="#888",w.style.visibility="collapse",_.style.visibility="collapse",y.setAttribute("readonly","true")),n.headers&&n.headers.get("content-type")&&(u=n.headers.get("content-type"),l=n.headers.get("allow"),c=n.headers.get("etag")),o.each(null,o.sym("http://www.w3.org/2007/ont/link#requestedURI"),e.uri).forEach(e=>{let t=o.any(e,o.sym("http://www.w3.org/2007/ont/link#response"));t&&(u=o.anyValue(t,r.ns.httph("content-type")),l=o.anyValue(t,r.ns.httph("allow")),!(c=o.anyValue(t,r.ns.httph("etag")))&&console.log("sourcePane: No eTag on GET"))}),u?(console.log(" source content-type "+u),l?d=0>l.indexOf("PUT"):(console.log("@@@@@@@@@@ No Allow: header from this server"),d=!1),void(y.readonly=d)):(d=!0,f=!0,void g.appendChild(r.widgets.errorMessageBlock(t,"Error: No content-type available!")))}}).catch(e=>{p.appendChild(r.widgets.errorMessageBlock(t,"Error reading file: "+e))})}const o=r.store,s=o.fetcher;var u,l,c,d=!0,h=!1,f=!1,p=t.createElement("div");p.setAttribute("class","sourcePane");var m=p.appendChild(t.createElement("table")),v=m.appendChild(t.createElement("tr")),g=m.appendChild(t.createElement("tr")),b=m.appendChild(t.createElement("tr"));b.setAttribute("style","text-align: right;");var y=v.appendChild(t.createElement("textarea"));y.setAttribute("style","font-family: monospace; font-size: 100%; min-width:60em; margin: 1em 0.2em 1em 0.2em; padding: 1em; border: 0.1em solid #888; border-radius: 0.5em;");var w=b.appendChild(r.widgets.cancelButton(t)),_=b.appendChild(r.widgets.continueButton(t)),x=b.appendChild(function(e){return r.widgets.button(e,r.icons.iconBase+"noun_253504.svg","Edit")}(t));return y.addEventListener("keyup",function(e){f||!h||(y.style.color="green",w.style.visibility="visible",_.style.visibility="visible",x.style.visibility="collapse",y.removeAttribute("readonly"))}),x.addEventListener("click",n),w.addEventListener("click",a),_.addEventListener("click",function(a){var o={data:y.value,contentType:u};c&&(o.headers={"if-match":c}),s.webOperation("PUT",e.uri,o).then(function(e){i(e)&&n()}).catch(function(e){p.appendChild(r.widgets.errorMessageBlock(t,"Error saving back: "+e))})}),a(),p}};e.exports=o},function(e,t,n){var r=n(0),i=n(4);e.exports={icon:r.icons.originalIconBase+"rdf_flyer.24.gif",name:"dataContents",label:function(e){if("http://www.w3.org/2007/ont/link#ProtocolEvent"in r.store.findTypeURIs(e))return null;var t=r.store.statementsMatching(void 0,void 0,void 0,e).length;return 0===t?null:"Data ("+t+")"},statementsAsTables:function(e,t,n){function a(e){var n=t.createElement("table"),i=null,a=d[u.toStr(e)];if(!a)return n.appendChild(t.createTextNode("...")),n;a.sort();for(var s,l=0,c=0;c<a.length;c++){var h=a[c],f=t.createElement("tr");if(h.predicate.uri!==i){i&&1<l&&s.setAttribute("rowspan",""+l),(s=t.createElement("td")).setAttribute("class","pred");var p=t.createElement("a");p.setAttribute("href",h.predicate.uri),p.addEventListener("click",r.widgets.openHrefInOutlineMode,!0),p.appendChild(t.createTextNode(r.utils.predicateLabelForXML(h.predicate))),s.appendChild(p),f.appendChild(s),i=h.predicate.uri,l=0}l++;var m=t.createElement("td");m.appendChild(o(h.object)),f.appendChild(m),n.appendChild(f)}return i&&1<l&&s.setAttribute("rowspan",""+l),n}function o(e){var n;switch(e.termType){case"NamedNode":let c=t.createElement("a");return c.setAttribute("href",e.uri),c.addEventListener("click",r.widgets.openHrefInOutlineMode,!0),c.appendChild(t.createTextNode(r.utils.label(e))),c;case"Literal":return e.datatype&&e.datatype.uri?"http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"===e.datatype.uri?((n=t.createElement("div")).setAttribute("class","embeddedXHTML"),n.innerHTML=e.value,n):t.createTextNode(e.value):((n=t.createElement("div")).setAttribute("style","white-space: pre-wrap;"),n.textContent=e.value,n);case"BlankNode":if(e.toNT()in p){m[e.toNT()]=!0;let n=t.createElement("a");return n.setAttribute("href","#"+e.toNT().slice(2)),n.setAttribute("class","bnodeRef"),n.textContent="*"+e.toNT().slice(3),n}p[e.toNT()]=!0;var s=a(e);return p[e.toNT()]=s,s.style.backgroundColor=r.utils.ancestor(s,"TABLE")&&"white"===r.utils.ancestor(s,"TABLE").style.backgroundColor?"#eee":"white",s;case"Collection":(n=t.createElement("table")).setAttribute("class","collectionAsTables");for(var u,l=0;l<e.elements.length;l++)u=t.createElement("tr"),n.appendChild(u),u.appendChild(o(e.elements[l]));return n;case"Graph":return(n=i.dataContents.statementsAsTables(e.statements,t)).setAttribute("class","nestedFormula"),n;case"Variable":return n=t.createTextNode("?"+e.uri)}throw new Error("Unhandled node type: "+e.termType)}var s=t.createElement("table"),u=r.rdf.Serializer(r.store),l=u.rootSubjects(e),c=l.roots,d=l.subjects,h=l.loopBreakers;for(var f in h)console.log("\tdataContentPane: loopbreaker:"+f);var p={},m={};n&&(c=n.concat(c.filter(function(e){for(var t=0;t<n.length;t++)if(e.sameTerm(n[t]))return!1;return!0})));for(var v,g=0;g<c.length;g++){v=t.createElement("tr"),s.appendChild(v);var b=t.createElement("td");v.appendChild(b);var y=t.createElement("td");v.appendChild(y);var w=c[g];"BlankNode"===w.termType?b.appendChild(t.createTextNode(r.utils.label(w))):b.appendChild(o(w)),y.appendChild(a(w))}for(var _ in m){let e=p[_];var x=t.createElement("a");x.setAttribute("id",_.slice(2)),x.setAttribute("class","bnodeDef"),x.textContent=_.slice(3)+")",e.insertBefore(x,e.firstChild)}return s},render:function(e,t){var n=i.getOutliner(t),a=r.store,o=t.createElement("div");o.setAttribute("class","dataContentPane");var s=a.statementsMatching(void 0,void 0,void 0,e);return $rdf.keepThisCodeForLaterButDisableFerossConstantConditionPolice?function(){for(var i=r.rdf.Serializer(r.store).rootSubjects(s).roots,u={render:function(r){var i=t.createElement("div");i.setAttribute("class","withinDocumentPane");var o=a.statementsMatching(r,void 0,void 0,e);return n.appendPropertyTRs(i,o,!1,function(e,t){return!0}),i}},l=0;l<i.length;l++){var c=t.createElement("TR"),d=i[l];c.style.verticalAlign="top";var h=n.outlineObjectTD(d,void 0,c);c.appendChild(h),o.appendChild(c),n.outlineExpand(h,d,{pane:u})}}():function(){var n=[];a.holds(e,void 0,void 0,e)&&n.push(e);var u=a.any(e,r.ns.foaf("primaryTopic"),void 0,e);u&&n.push(u),o.appendChild(i.dataContents.statementsAsTables(s,t,n))}(),o}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.originalIconBase+"tango/22-text-x-generic.png",name:"humanReadable",label:function(e,t){var n=r.store,i=r.ns,a=["text/plain","text/html","application/xhtml+xml","image/png","image/jpeg","application/pdf","video/mp4"];return e.uri?n.findTypeURIs(e)[i.link("WebPage").uri]?"view":function(e,t,n){var r=e.fetcher.getHeader(t,"content-type");if(r)for(var i=0;i<r.length;i++)for(var a=0;a<n.length;a++)if(0<=r[i].indexOf(n[a]))return!0;return!1}(n,e,a)||function(t,n,r){for(var i=t.findTypeURIs(e),a=0;a<r.length;a++)if($rdf.Util.mediaTypeClass(r[a]).uri in i)return!0;return!1}(n,0,a)?"View":null:null},render:function(e,t){var n=t.createElement("div"),i=r.store;n.setAttribute("class","docView");var a=t.createElement("IFRAME");a.setAttribute("src",e.uri),a.setAttribute("class","doc");var o=i.fetcher.getHeader(e.doc(),"content-type"),s=o?o[0]:null;s?console.log("humanReadablePane: c-t:"+s):console.log("humanReadablePane: unknown content-type?"),a.setAttribute("style","resize = both; height: 120em; width:80em;");var u=t.createElement("TR");return u.appendChild(a),n.appendChild(u),n}}},function(e,t,n){var r=n(0),i=n(4);e.exports={icon:r.icons.originalIconBase+"foaf/foafTiny.gif",name:"social",label:function(e){var t=r.store.findTypeURIs(e);return t[r.ns.foaf("Person").uri]||t[r.ns.vcard("Individual").uri]?"Friends":null},render:function(e,t){var n=function(e){console.log(e);var n=t.createElement("p");n.textContent=e,w.appendChild(n)},a=function(e,n){if(!n)return e;var r=t.createElement("a");return r.setAttribute("href",n),r.appendChild(e),r},o=function(e){return t.createTextNode(e)},s=function(e,n){return r.widgets.personTR(t,r.ns.foaf("knows"),e,{})},u=i.getOutliner(t),l=r.store,c=t.createElement("div");c.setAttribute("class","socialPane");const d=r.ns.foaf,h=r.ns.vcard,f="background-color: #eee; width: 25%; border: 0; padding: 0.5em; margin: 0;";var p=c.appendChild(t.createElement("table")).appendChild(t.createElement("tr")),m=p.appendChild(t.createElement("td")),v=p.appendChild(t.createElement("td")),g=p.appendChild(t.createElement("td")),b=m;b.style.cssText=f;var y=v.appendChild(t.createElement("table"));y.style.cssText="background-color: #fff; color: #000; width: 46%; margin: 0; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; padding: 0;";var w=g;w.style.cssText=f;var _=l.any(e,d("img"))||l.any(e,d("depiction"));if(_){var x=t.createElement("IMG");x.setAttribute("src",_.uri),x.style.cssText=" width: 100% ; border: none; margin: 0; padding: 0;",b.appendChild(x)}var M=l.anyValue(e,d("name"))||"???",k=t.createElement("H3");k.appendChild(t.createTextNode(M));var C=r.authn.currentUser(),E=C?C.uri:null;let A=r.authn.loginStatusBox(t,e=>{C=l.sym(e),r.widgets.refreshTree(c)});w.appendChild(A);var T=C&&l.sameThings(C,e),S=d("knows"),I=l.anyValue(e,d("givenname"))||l.anyValue(e,d("firstName"))||l.anyValue(e,d("nick"))||l.anyValue(e,d("name"))||l.anyValue(e,h("fn")),N=l.each(e,S),j=null,O=!1;if(C){for(var R=l.each(void 0,d("primaryTopic"),C),L="",P=0;P<R.length;P++)if(l.whether(R[P],r.ns.rdf("type"),d("PersonalProfileDocument"))){if(O=u.UserInput.sparqler.editable(R[P].uri,l)){j=R[P];break}L+="Your profile <"+r.utils.escapeForXML(R[P].uri)+"> is not remotely editable."}if(j?(n("Editing your profile "+j+"."),O=u.UserInput.sparqler.editable(j.uri,l)):n(L+"\nI couldn't find your editable personal profile document."),T);else{(k=t.createElement("h3")).appendChild(t.createTextNode("You and "+I)),b.appendChild(k);var D=l.canon(C),B=l.whether(e,S,D),U=!1,q=l.statementsMatching(D,S,e);q.length&&(U=!0,!j&&(j=q[0].why));let n=t.createElement("tr");b.appendChild(n);var F=function(){n.appendChild(a(o("You"),E)),n.appendChild(o(" and ")),n.appendChild(a(o(I),e.uri))};if(B?U?(F(),n.appendChild(o(" say you know each other."))):(n.appendChild(a(o(I),e.uri)),n.appendChild(o(" knows ")),n.appendChild(a(o("you"),E)),n.appendChild(o(" (unconfirmed).")),n.appendChild(o(" confirm you know ")),n.appendChild(a(o(I),e.uri)),n.appendChild(o("."))):U?(n.appendChild(a(o("You"),E)),n.appendChild(o(" know ")),n.appendChild(a(o(I),e.uri)),n.appendChild(o(" (unconfirmed)"))):(F(),n.appendChild(o(" have not said you know each other."))),O){var z=function(e,n,i){var a=t.createElement("form"),o=t.createElement("input");a.appendChild(o);var s=t.createTextNode(e);s.className="question",a.appendChild(s),o.setAttribute("type","checkbox");return o.checked=i,o.addEventListener("click",function(e){if(s.className="pendingedit",this.checked)try{u.UserInput.sparqler.insert_statement(n,function(e,t,i){return s.className="question",t?void l.add(n.subject,n.predicate,n.object,n.why):(r.log.alert(null,"Message","Error occurs while inserting "+n+"\n\n"+i),void(o.checked=!1))})}catch(e){r.log.error("Data write fails:"+e),r.log.alert("Data write fails:"+e),o.checked=!1,s.className="question"}else try{u.UserInput.sparqler.delete_statement(n,function(e,t,i){s.className="question",t?l.removeMany(n.subject,n.predicate,n.object,n.why):(r.log.alert("Error occurs while deleting "+n+"\n\n"+i),this.checked=!0)})}catch(e){r.log.alert("Delete fails:"+e),this.checked=!0}},!1),a}("You know "+I,new r.rdf.Statement(C,S,e,j),U);b.appendChild(z)}if(N){var H=l.each(C,d("knows"));if(H.length){var W=function(e,t){for(var n=[],r=0;r<e.length;r++)for(var i=0;i<t.length;i++)if(t[i].sameTerm(e[r])){n.push(t[i]);break}return n}(N,H);let e=t.createElement("tr");if(b.appendChild(e),e.appendChild(t.createTextNode("You"+(I?" and "+I:"")+" know"+function(e){var t=" ";return t+=e||"no",1===e?t+" person":t+" people"}(W.length)+" found in common")),W)for(let n=0;n<W.length;n++)e.appendChild(t.createTextNode(", "+r.utils.label(W[n])))}let e=t.createElement("tr");b.appendChild(e)}}}r.widgets.attachmentList(t,e,y,{doc:j,modify:!!O,predicate:d("knows"),noun:"friend"}),$rdf.keepThisCodeForLaterButDisableFerossConstantConditionPolice&&function(e){U=l.each(e,d("knows")),B=l.each(void 0,d("knows"),e);var n=[],i=[],a=[];for(let e=0;e<U.length;e++){let t=U[e],r=!1;for(let e=0;e<B.length;e++)if(B[e].sameTerm(t)){r=!0;break}r?n.push(t):i.push(t)}for(let e=0;e<B.length;e++){let t=B[e],n=!1;for(let e=0;e<U.length;e++)if(U[e].sameTerm(t)){n=!0;break}n||a.push(t)}var o=[["Acquaintances",U],["Mentioned as acquaintances by: ",a]];for(let e=0;e<o.length;e++){let n=o[e],i=n[1];if(0===i.length)continue;let a=t.createElement("h3");a.textContent=n[0];let l=t.createElement("tr");l.appendChild(a),y.appendChild(l);for(var u=[],c=0;c<i.length;c++)u.push([r.utils.label(i[c]),i[c]]);u.sort();for(var h,f=null,p=0;p<u.length;p++)(h=u[p][1]).sameTerm(f)||(f=h,"..."!==r.utils.label(h)&&y.appendChild(s(h)))}}(e),(k=t.createElement("h3")).appendChild(t.createTextNode("Basic Information")),b.appendChild(k);for(var V=[r.ns.foaf("homepage"),r.ns.foaf("weblog"),r.ns.foaf("workplaceHomepage"),r.ns.foaf("schoolHomepage")],J=0;J<V.length;J++){var G=V[J],K=l.statementsMatching(e,G);if(0===K.length);else{for(var $,X=[],Z=0;Z<K.length;Z++)($=K[Z]).object.uri&&X.push($.object.uri);X.sort();for(var Y,Q="",ee=0;ee<X.length;ee++){let e=X[ee];if(e!==Q){Q=e;var te="";if(Y=r.utils.label(G),1<X.length){var ne=e.indexOf("//");if(0<ne){var re=e.indexOf("/",ne+2),ie=e.lastIndexOf(".",re);0<ie&&(re=ie),te=e.slice(ne+2,re)}}te&&(Y=te+" "+Y);var ae=t.createTextNode(Y),oe=t.createElement("a");oe.appendChild(ae),oe.setAttribute("href",e);var se=t.createElement("div");se.style.cssText="width: 80%; background-color: #fff; border: solid 0.05em #ccc; margin-top: 0.1em; margin-bottom: 0.1em; padding: 0.1em; text-align: center;",se.appendChild(oe),b.appendChild(se)}}}}for(var ue=[r.ns.foaf("openid"),r.ns.foaf("nick")],le=0;le<ue.length;le++){let t=ue[le];var ce=l.statementsMatching(e,t);0===ce.length||u.appendPropertyTRs(b,ce,!1,function(e){return!0})}return c}}},function(e,t){void 0!==e&&e.exports&&(e.exports=function(e,t){if(void 0===n)var n=t.dom;var r=n.querySelectorAll(e),i={init:function(e,t){this.counter=0,this.el=e,this.$items=e.querySelectorAll("figure"),this.numItems=this.$items.length,(t=t||{}).auto=t.auto||!1,this.opts={auto:void 0!==t.auto&&t.auto,speed:void 0===t.auto.speed?1500:t.auto.speed,pauseOnHover:void 0!==t.auto.pauseOnHover&&t.auto.pauseOnHover,fullScreen:void 0!==t.fullScreen&&t.fullScreen,swipe:void 0!==t.swipe&&t.swipe},this.$items[0].classList.add("bss-show"),this.injectControls(e),this.addEventListeners(e),this.opts.auto&&this.autoCycle(this.el,this.opts.speed,this.opts.pauseOnHover),this.opts.fullScreen&&this.addFullScreen(this.el),this.opts.swipe&&this.addSwipe(this.el)},showCurrent:function(e){this.counter=0<e?this.counter+1===this.numItems?0:this.counter+1:0>this.counter-1?this.numItems-1:this.counter-1,[].forEach.call(this.$items,function(e){e.classList.remove("bss-show")}),this.$items[this.counter].classList.add("bss-show")},injectControls:function(e){var t=n.createElement("span"),r=n.createElement("span"),i=n.createDocumentFragment();t.classList.add("bss-prev"),r.classList.add("bss-next"),t.innerHTML="&laquo;",r.innerHTML="&raquo;",i.appendChild(t),i.appendChild(r),e.appendChild(i)},addEventListeners:function(e){var t=this;e.querySelector(".bss-next").addEventListener("click",function(){t.showCurrent(1)},!1),e.querySelector(".bss-prev").addEventListener("click",function(){t.showCurrent(-1)},!1),e.onkeydown=function(e){37===(e=e||window.event).keyCode?t.showCurrent(-1):39===e.keyCode&&t.showCurrent(1)}},autoCycle:function(e,t,n){var r=this,i=window.setInterval(function(){r.showCurrent(1)},t);n&&(e.addEventListener("mouseover",function(){i=clearInterval(i)},!1),e.addEventListener("mouseout",function(){i=window.setInterval(function(){r.showCurrent(1)},t)},!1))},addFullScreen:function(e){var t=this,r=n.createElement("span");r.classList.add("bss-fullscreen"),e.appendChild(r),e.querySelector(".bss-fullscreen").addEventListener("click",function(){t.toggleFullScreen(e)},!1)},addSwipe:function(e){var t=this,n=new Hammer(e);n.on("swiperight",function(e){t.showCurrent(-1)}),n.on("swipeleft",function(e){t.showCurrent(1)})},toggleFullScreen:function(e){n.fullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement||n.msFullscreenElement?n.exitFullscreen?n.exitFullscreen():n.msExitFullscreen?n.msExitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.webkitExitFullscreen&&n.webkitExitFullscreen():n.documentElement.requestFullscreen?e.requestFullscreen():n.documentElement.msRequestFullscreen?e.msRequestFullscreen():n.documentElement.mozRequestFullScreen?e.mozRequestFullScreen():n.documentElement.webkitRequestFullscreen&&e.webkitRequestFullscreen(e.ALLOW_KEYBOARD_INPUT)}};[].forEach.call(r,function(e){Object.create(i).init(e,t)})})},function(e,t,n){var r=n(0),i=n(246);e.exports={icon:r.icons.iconBase+"noun_138712.svg",name:"slideshow",label:function(e){var t=r.store,n=r.ns,i=t.findTypeURIs(e);if(i[n.ldp("Container").uri]||i[n.ldp("BasicContainer").uri]){var a=0;return t.each(e,n.ldp("contains")).map(function(e){r.widgets.isImage(e)&&a++}),0<a?"Slideshow":null}return null},render:function(e,t){r.widgets.addStyleSheet(t,"https://leemark.github.io/better-simple-slideshow/css/simple-slideshow-styles.css");var n=r.store,a=r.ns,o=t.createElement("div");o.setAttribute("class","bss-slides");var s,u=n.findTypeURIs(e);(u[a.ldp("BasicContainer").uri]||u[a.ldp("Container").uri])&&(s=a.ldp("contains"));var l=n.each(e,s);l.sort();for(let e=0;e<l.length;e++)if(r.widgets.isImage(l[e])){var c=o.appendChild(t.createElement("figure")),d=c.appendChild(t.createElement("img"));d.setAttribute("src",l[e].uri),d.setAttribute("width","100%"),c.appendChild(t.createElement("figcaption"))}var h={dom:t};return setTimeout(function(){i(".bss-slides",h)},1e3),o}}},function(e,t,n){var r=n(0),i=n(4),a=r.ns;e.exports={icon:r.icons.originalIconBase+"tango/22-folder-open.png",name:"classInstance",label:function(e){var t=r.store.each(void 0,a.rdf("type"),e).length;return 0<t?"List ("+t+")":null},render:function(e,t){var n=i.getOutliner(t),o=r.store,s=function(e,n){var r=t.createElement("pre");r.setAttribute("style","background-color: "+n||"#eed;"),u.appendChild(r),r.appendChild(t.createTextNode(e))},u=t.createElement("div");u.setAttribute("class","instancePane"),u.setAttribute("style"," border-top: solid 1px #777; border-bottom: solid 1px #777; margin-top: 0.5em; margin-bottom: 0.5em ");var l=o.statementsMatching(void 0,a.rdf("type"),e);if(0<l.length){var c={},d=[];for(var h in l.map(e=>{c[e.subject.toNT()]=e}),o.findMembersNT(e))c[h]||d.push($rdf.st(o.fromNT(h),a.rdf("type"),e));if(d.length&&s("There are "+l.length+" explicit and "+d.length+" implicit members of "+r.utils.label(e)),e.sameTerm(a.rdf("Property")));else if(e.sameTerm(a.rdfs("Class"))){var f=o.statementsMatching(void 0,a.rdf("type"),void 0),p={};f.map(function(e){p[e.object]=e});var m=[];for(var v in p)m.push($rdf.st($rdf.sym(v),a.rdf("type"),a.rdfs("Class")));s("Total of "+f.length+" type statments and "+m.length+" unique types.")}if(10<l.length){var g=t.createElement("TR");g.appendChild(t.createTextNode(""+l.length)),u.appendChild(g)}n.appendPropertyTRs(u,l,!0,function(e){return!0}),d.length&&(s("Implcit:"),n.appendPropertyTRs(u,d,!0,function(e){return!0}))}return u}}},function(e,t,n){var r=n(0),i=n(4),a=r.ns;e.exports={icon:r.icons.iconBase+"noun_973694_expanded.svg",name:"folder",mintNew:function(e){var t=r.store,n=e.newInstance||t.sym(e.newBase),i=n.uri;return i.endsWith("/")&&(i=i.slice(0,-1)),e.newInstance=t.sym(i+"/"),t.fetcher.webOperation("PUT",n.uri+".dummy").then(function(){return console.log("New folder created: "+n.uri),t.fetcher.delete(n.uri+".dummy")}).then(function(){return console.log("Dummy file deleted : "+n.uri+".dummy"),console.log("New container created: "+n.uri),e})},label:function(e){var t=r.store,n=t.each(e,a.ldp("contains")).length;return 0<n?"Contents ("+n+")":t.holds(e,a.rdf("type"),a.ldp("Container"))?"Container (0)":null},render:function(e,t){var n,o=i.getOutliner(t),s=r.store,u=function(e,n){var r=t.createElement("pre");console.log(e),r.setAttribute("style","background-color: "+n||"#eed;"),l.appendChild(r),r.appendChild(t.createTextNode(e))},l=t.createElement("div");l.setAttribute("class","instancePane"),l.setAttribute("style"," border-top: solid 1px #777; border-bottom: solid 1px #777; margin-top: 0.5em; margin-bottom: 0.5em ");var c=function(e){var t=e.uri.slice(e.dir().uri.length);return!(t.startsWith(".")||t.endsWith(".acl")||t.endsWith("~"))};let d=e.uri.endsWith("/")?e.uri:e.uri+"/",h=s.sym(d+"index.ttl#this");if(s.holds(e,a.ldp("contains"),h.doc())){console.log("View of folder with be view of indexThing. Loading "+h);let e=l.appendChild(t.createElement("div"));return e.style.cssText="border-top: 0.2em solid #ccc;",s.fetcher.load(h.doc()).then(function(){n=e.appendChild(t.createElement("table")),i.getOutliner(t).GotoSubject(h,!0,void 0,!1,void 0,n)}),l}var f=function(){var i=s.each(e,a.ldp("contains")).filter(c);(i=i.map(e=>[r.utils.label(e).toLowerCase(),e])).sort(),i=i.map(e=>e[1]),r.utils.syncTableToArray(n,i,function(n){let r=s.statementsMatching(e,a.ldp("contains"),n)[0],i=o.VIEWAS_boring_default,u=o.propertyTR(t,r,!1);return u.firstChild.textContent="",u.firstChild.style.cssText+="min-width: 3em;",u.appendChild(o.outlineObjectTD(n,i,void 0,r)),u})};(n=l.appendChild(t.createElement("table"))).refresh=f,f();var p=l.appendChild(t.createElement("div")),m=r.authn.currentUser(),v={folder:e,div:p,dom:t,statusArea:p,me:m};v.refreshTarget=n,r.create.newThingUI(v,i);r.aclControl.preventBrowserDropEvents(t);var g;return g=p.firstChild,r.widgets.makeDropTarget(g,null,function(t){for(var i,o=0;t[o];o++){i=t[o],console.log(" folder: dropped filename: "+i.name+", type: "+(i.type||"n/a")+" size: "+i.size+" bytes, last modified: "+(i.lastModifiedDate?i.lastModifiedDate.toLocaleDateString():"n/a"));var l=new FileReader;l.onload=function(t){return function(i){var o=i.target.result;if(console.log(" File read byteLength : "+o.byteLength),e.uri.endsWith("/")){var l=s.sym(e.uri+encodeURIComponent(t.name));return s.holds(e,a.ldp("contains"),l)?(u("Sorry, "+e.uri+" already has something called "+t.name),void console.log("Drag-drop upload aborted: folder already contains "+l)):void r.store.fetcher.webOperation("PUT",l,{data:o,contentType:t.type}).then(function(){console.log(" Upload: put OK: "+l),s.add(e,a.ldp("contains"),l,e.doc()),n.refresh()}).catch(function(e){u(" Upload: FAILED "+l+", Error: "+e)})}console.log("FAIL: - folder name should end in /")}}(i),l.readAsArrayBuffer(i)}}),l}}},function(e,t){e.exports='\n<!DOCTYPE html>\n<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta charset="utf-8" />\n <title></title>\n <meta content="width=device-width, initial-scale=1" name="viewport" />\n <link href="https://dokie.li/media/css/basic.css" media="all" rel="stylesheet" title="Basic" />\n <link href="https://dokie.li/media/css/do.css" media="all" rel="stylesheet" />\n <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="all" rel="stylesheet" />\n <script src="https://dokie.li/scripts/simplerdf.js"><\/script>\n <script src="https://dokie.li/scripts/medium-editor.min.js"><\/script>\n <script src="https://dokie.li/scripts/medium-editor-tables.min.js"><\/script>\n <script src="https://dokie.li/scripts/do.js"><\/script>\n </head>\n\n <body about="" prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# cc: https://creativecommons.org/ns# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# dio: https://w3id.org/dio#" typeof="schema:CreativeWork sioc:Post prov:Entity">\n <main>\n <article about="" typeof="schema:Article">\n\n </article>\n </main>\n </body>\n</html>\n'},function(e,t,n){var r=n(0);const i=n(250);e.exports={icon:r.icons.iconBase+"dokieli-logo.png",name:"Dokieli",mintClass:r.ns.solid("DokieliDocument"),label:function(e,t){var n=r.store,i=r.ns,a=["text/html","application/xhtml+xml"];return e.uri?n.findTypeURIs(e)[i.link("WebPage").uri]?"view":function(e,t,n){var r=e.fetcher.getHeader(t,"content-type");if(r)for(var i=0;i<r.length;i++)for(var a=0;a<n.length;a++)if(0<=r[i].indexOf(n[a]))return!0;return!1}(n,e,a)||function(t,n,r){for(var i=t.findTypeURIs(e),a=0;a<r.length;a++)if($rdf.Util.mediaTypeClass(r[a]).uri in i)return!0;return!1}(n,0,a)?"Dok":null:null},mintNew:function(e){var t=r.store,n=e.newInstance||t.sym(e.newBase);console.log("New dok called with "+n);var a=n.uri;return a.endsWith("/")&&(a+="index.html"),a.endsWith(".html")||(a+=".html"),e.newInstance=n=t.sym(a),console.log("New dok will make: "+n),new Promise(function(r,a){t.fetcher.webOperation("PUT",n.uri,{data:i,contentType:"text/html"}).then(function(){console.log("new Dokieli document created at "+e.newInstance),r(e)}).catch(function(t){console.log("Error creating dokelili dok at "+e.newInstance+": "+t)})})},render:function(e,t){var n=t.createElement("div"),i=r.store;n.setAttribute("class","docView");var a=t.createElement("IFRAME");a.setAttribute("src",e.uri),a.setAttribute("class","doc");var o=i.fetcher.getHeader(e.doc(),"content-type"),s=o?o[0]:null;s?console.log("humanReadablePane: c-t:"+s):console.log("humanReadablePane: unknown content-type?"),a.setAttribute("style","resize = both; height: 120em; width:80em;");var u=t.createElement("TR");return u.appendChild(a),n.appendChild(u),n}}},function(e,t,n){const r=n(0),i=r.ns,a=r.store;e.exports={icon:r.icons.iconBase+"noun_534313.svg",name:"audio",label:function(e){var t=r.store.findTypeURIs(e),n=$rdf.Util.mediaTypeClass("audio/*").uri.split("*")[0];for(var i in t)if(i.startsWith(n))return"Play audio";return null},render:function(e,t){var n=!1,r=!0,o=!0,s=!1,u=function(e){var t=e.lastIndexOf(".");return 0>t?e:t<e.lastIndexOf("/")?e:e.slice(0,t)},l=function(e){var t=a.any(void 0,i.ldp("contains"),e);if(!t)return!1;var n=a.each(t,i.ldp("contains"));if(2>n.length)return!1;for(var r,o=e.uri,s=0;s<n.length;s++){if(r=n[s].uri,o.length>r.length&&o.startsWith(u(r)))return!0;if(o.endsWith(".m4a")&&r.endsWith(".mp3")&&u(o)===u(r))return!0}return!1},c=function(e){var t=e.uri.split("/").slice(-3),n=function(e){try{return decodeURIComponent(e)}catch(t){return e}};g.textContent=n(t[0]),b.textContent=n(t[1]),y.textContent=n(u(t[2]))},d=function(e,t){return new Promise(function(n,u){if(t=t||0,!r)return n(null);var l=a.any(void 0,i.ldp("contains"),e)||e.dir();return l?void a.fetcher.load(l).then(function(r){var u,c=a.each(l,i.ldp("contains"));c.sort();for(var h=0;h<c.length;h++)if(e.uri===c[h].uri){if(0!=(u=(h+1)%c.length))return n(c[u]);if(!o)return n(s?c[u]:null);if(1===t||!o)return n(null);d(l,t+1).then(function(e){e&&a.fetcher.load(e).then(function(t){var r=a.each(e,i.ldp("contains"));return 0===r.length?n(null):(r.sort(),console.log("New Album: "+e),n(r[0]))})})}}):n(null)})},h=function(e){var t=a.sym(e.target.getAttribute("src"));if(r){var n=function(t){var r=t;d(r).then(function(t){return t?void(l(t)?(console.log("Ignoring redundant "+t),n(t)):(console.log("Moving on to "+t),c(t),w.appendChild(f(t,!0)),w.removeChild(e.target))):void console.log("No successor to "+r)})};n(t)}},f=function(e,n){var r=t.createElement("audio");return r.setAttribute("controls","yes"),r.setAttribute("src",e.uri),n&&r.setAttribute("autoplay","autoplay"),r.addEventListener("ended",h,!1),r},p=t.createElement("div"),m=p.appendChild(t.createElement("table")),v="padding: 0.3em; color:white; background-color: black;",g=m.appendChild(t.createElement("tr"));g.style.cssText=v;var b=m.appendChild(t.createElement("tr"));b.style.cssText=v;var y=m.appendChild(t.createElement("tr"));y.style.cssText=v;var w=m.appendChild(t.createElement("tr"));return c(e),w.appendChild(f(e,n)),!a.holds(void 0,i.ldp("contains"),e)&&e.dir()&&a.fetcher.load(e.dir()),p}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.iconBase+"noun_1619.svg",name:"video",label:function(e){var t=r.store.findTypeURIs(e),n=$rdf.Util.mediaTypeClass("video/*").uri.split("*")[0];for(var i in t)if(i.startsWith(n))return"Play video";return null},render:function(e,t){var n=t.createElement("div"),r=n.appendChild(t.createElement("video"));return r.setAttribute("controls","yes"),r.setAttribute("src",e.uri),r.setAttribute("width","100%"),n}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.iconBase+"noun_1619.svg",name:"playlistSlot",label:function(e){var t=r.store;return t.anyStatementMatching(e,r.ns.rdf("type"),t.sym("http://purl.org/ontology/pbo/core#PlaylistSlot"))?"playlist slot":null},render:function(e,t){var n,i=function(e,n){if(!n)return e;var i=t.createElement("a");return i.setAttribute("href",n),i.appendChild(e),i.addEventListener("click",r.widgets.openHrefInOutlineMode,!0),i},a=function(e){return t.createTextNode(e)},o=r.store,s=o.any(e,$rdf.sym("http://purl.org/ontology/pbo/core#playlist_item")),u=o.any(e,$rdf.sym("http://purl.org/ontology/olo/core#index")),l=s.uri,c=function(e,t){if(!e)return{html5:!0};var n=e.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-_%]+)/i),r=e.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i),i=e.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i),a=e.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);return n?{youtube:n}:r?{vimeo:r}:i?{dailymotion:i}:a?{vk:a}:void 0}(l),d=t.createElement("div");if(c&&c.youtube?(l=l.replace("watch?v=","embed/"),d.setAttribute("class","imageView"),(n=t.createElement("IFRAME")).setAttribute("src",l),n.setAttribute("width",560),n.setAttribute("height",315),n.setAttribute("frameborder",0),n.setAttribute("style","max-width: 850px; max-height: 100%;"),n.setAttribute("allowfullscreen","true")):(d.setAttribute("class","imageView"),(n=t.createElement("IMG")).setAttribute("src",s.value),n.setAttribute("width",560),n.setAttribute("height",315),n.setAttribute("style","max-width: 560; max-height: 315;")),u){for(var h=o.statementsMatching(null,$rdf.sym("http://purl.org/ontology/olo/core#index")),f=[],p=0;p<h.length;p++)h[p]&&f.push(parseInt(h[p].object.value,10));u=parseInt(u.value,10);var m=t.createElement("div"),v=f[(f.indexOf(u)-1+f.length)%f.length],g=f[(f.indexOf(u)+1+f.length)%f.length],b=i(a("<<"),e.uri.split("#")[0]+"#"+v);m.appendChild(b);var y=t.createElement("span");y.innerHTML=" Playlist slot : "+u+" ",m.appendChild(y);var w=i(a(">>"),e.uri.split("#")[0]+"#"+g);m.appendChild(w)}var _=t.createElement("TR");return _.appendChild(n),m&&_.appendChild(m),d.appendChild(_),d}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.originalIconBase+"tango/22-image-x-generic.png",name:"image",label:function(e){var t=r.store;if(!t.anyStatementMatching(e,r.ns.rdf("type"),t.sym("http://purl.org/dc/terms/Image")))return null;return function(e,t,n){var r=e.fetcher.getHeader(t,"content-type");if(r)for(var i=0;i<r.length;i++)for(var a=0;a<n.length;a++)if(0<=r[i].indexOf(n[a]))return!0;return!1}(t,e,["application/pdf"])?null:"view"},render:function(e,t){var n=t.createElement("div");n.setAttribute("class","imageView");var r=t.createElement("IMG");r.setAttribute("src",e.uri),r.setAttribute("style","max-width: 100%; max-height: 100%;");var i=t.createElement("TR");return i.appendChild(r),n.appendChild(i),n}}},function(e,t,n){var r=n(0);e.exports={icon:r.icons.iconBase+"noun_62007.svg",name:"travel expenses",label:function(e){var t=r.store,n=t.findTypeURIs(e);return r.ns.qu("Transaction")in t.findSuperClassesNT(e)?"by Trip":n["http://www.w3.org/ns/pim/trip#Trip"]?"Trip $":null},render:function(e,t){var n=r.store,i=r.ns,a=$rdf.Namespace("http://www.w3.org/2002/12/cal/ical#"),o=$rdf.Namespace("http://www.w3.org/ns/pim/trip#"),s=t.createElement("div");s.setAttribute("class","transactionPane"),s.innerHTML="<h2>Trip transactions</h2>";var u=function(e,n){void 0===n&&(n="color: grey");var r=t.createElement("pre");r.setAttribute("style",n),s.appendChild(r),r.appendChild(t.createTextNode(e))},l=n.findTypeURIs(e),c=function(e,a){var s=new $rdf.Query(r.utils.label(e)),l={};["date","transaction","comment","type","in_USD"].map(function(e){s.vars.push(l[e]=$rdf.variable(e))}),s.pat.add(l.transaction,o("trip"),e);var c=n.formula();c.add(l.transaction,i.rdf("type"),l.type),s.pat.optional.push(c),s.pat.add(l.transaction,r.ns.qu("date"),l.date),c.add(l.transaction,i.rdfs("comment"),l.comment),s.pat.optional.push(c),s.pat.add(l.transaction,r.ns.qu("in_USD"),l.in_USD);var d=r.table(t,{query:s,onDone:function(){var t={},a=n.each(void 0,o("trip"),e);a.map(function(e){var a=n.the(e,i.rdf("type"));if(a||(a=r.ns.qu("ErrorNoType")),a&&a.uri){var o=a.uri;t[o]||(t[o]=0);var s=n.any(e,r.ns.qu("in_USD"));s||u(" @@ No amount in USD: "+s+" for "+e),s&&(t[o]+=parseFloat(s.value))}});var s="",l=0,c=0;for(var d in t)s+=r.utils.label(n.sym(d))+": "+t[d]+"; ",l++,c+=t[d];u("Totals of "+a.length+" transactions: "+s,""),1<l&&u("Overall net: "+c,"text-treatment: bold;")}});a.appendChild(d)};if(r.ns.qu("Transaction")in n.findSuperClassesNT(e)){let t=n.each(void 0,i.rdf("type"),e),u=[];for(var d=[],h=0;h<t.length;h++){var f=t[h],p=n.any(f,o("trip"));if(p){f in d||(d[p]={total:0,transactions:[]});var m=n.any(f,r.ns.qu("in_USD"));m&&(d[p].total+=m);var v=n.any(f,r.ns.qu("date"));d[p.toNT()].transactions.push([v,f])}else u.push(f)}var g=[];for(var b in d){var y=n.fromNT(b);g.push([n.any(y,a("dtstart")),y])}g.sort();for(var w=0;w<g.length;w++)c(g[w][1],s)}else l["http://www.w3.org/ns/pim/trip#Trip"]&&c(e,s);return s}}},function(e,t,n){const r=n(0),i=r.ns,a=r.store,o=i.wf("attachment");e.exports={icon:r.icons.iconBase+"noun_160581.svg",name:"link",label:function(e){var t=a.any(e,i.meeting("target"))||e,n=a.each(t,o).length;return 0<n?r.utils.label(o)+" "+n:null},mintNew:function(e){return new Promise(function(t,n){t(e)})},render:function(e,t){const n=t.createElement("div");r.widgets.attachmentList(t,e,n,{});const i=n.appendChild(t.createElement("p"));return i.textContent="Drag web pages or things onto the target to add to list of links.",i.setAttribute("style","color: #888; padding: 2em;"),n}}},function(e,t){e.exports='\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix ical: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n ical:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n "Schedule event (single form).";\n a ui:Group;\n ui:part\n <#form1>, <#form2>, <#form3>.\n\n<#form1>\n dc:title\n "Schedule an event (wizard)";\n a ui:Form;\n ui:part\n <#form1header>,\n <#eventTitle>,\n <#eventLocation>,\n <#eventComment>,\n <#eventAuthor>.\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n "128";\n ui:property\n ical:summary;\n ui:size\n "40".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n "512";\n ui:property\n ical:location;\n ui:size\n "40".\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# "1048";\n# ui:size\n# "40".\n ui:property\n ical:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:part <#authorName>, <#authorEmail> .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label "email"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title "Select possible days"; a ui:Form;\n ui:part <#id1118132113134>, <#id1417314641301> .\n\n <#id1118132113134> a ui:Heading; ui:contents "Time proposals" .\n\n <#id1417314641301>\n a ui:Multiple; ui:min 2; ui:part <#id1417314674292>; ui:property sched:option.\n\n <#id1417314674292> a ui:DateField; ui:property ical:dtstart; ui:label "Date".\n\n ##################################\n\n <#form3> dc:title "Select invited people"; a ui:Form; ui:part <#id1118132113135>, <#id1417314641301b> .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label "email"; ui:property foaf:mbox .\n <#form1header> a ui:Heading; ui:contents "Schedule an event" .\n <#id1118132113135> a ui:Heading; ui:contents "Who to invite" .\n'},function(e,t,n){const r=n(0),i=r.rdf,a=r.ns,o=[a.sched("No"),a.sched("Maybe"),a.sched("Yes")];e.exports={icon:r.icons.iconBase+"noun_346777.svg",name:"schedule",label:function(e){return r.store.findTypeURIs(e)["http://www.w3.org/ns/pim/schedule#SchedulableEvent"]?"Scheduling poll":null},mintClass:a.sched("SchedulableEvent"),mintNew:function(e){return new Promise(function(t,n){var a=r.ns,o=r.store,s=e.newBase,u=e.useExisting||i.sym(e.newBase+"index.ttl#this"),l=function(e,t){e||(console.log("Error in Schedule Pane: Error constructing new scheduler: "+t),n(new Error(t)))},c=function(e,t,n){var o=i.graph(),s=i.Namespace("http://www.w3.org/ns/auth/acl#"),u=o.sym(t+"#a1"),l=o.sym(t),c=o.sym(e);return o.add(u,r.ns.rdf("type"),s("Authorization"),l),o.add(u,s("accessTo"),c,l),o.add(u,s("agent"),p,l),o.add(u,s("mode"),s("Read"),l),o.add(u,s("mode"),s("Write"),l),o.add(u,s("mode"),s("Control"),l),u=o.sym(t+"#a2"),o.add(u,r.ns.rdf("type"),s("Authorization"),l),o.add(u,s("accessTo"),c,l),o.add(u,s("agentClass"),a.foaf("Agent"),l),o.add(u,s("mode"),s("Read"),l),n&&o.add(u,s("mode"),s("Write"),l),i.serialize(l,o,t,"text/turtle")},d=function(e,t,n){var r=o.any(o.sym(e),o.sym("http://www.iana.org/assignments/link-relations/acl"));if(r){var i=c(e,r.uri,t);return h.webOperation("PUT",r.uri,{data:i,contentType:"text/turtle"}).then(e=>n(!0)).catch(e=>{n(!1,e.message)})}return h.load(e).catch(e=>{n(!1,"Getting headers for ACL: "+e)}).then(()=>{var n=o.any(o.sym(e),o.sym("http://www.iana.org/assignments/link-relations/acl"));if(!n)throw new Error("No Link rel=ACL header for "+e);var r=c(e,n.uri,t);return h.webOperation("PUT",n.uri,{data:r,contentType:"text/turtle"})}).then(e=>n(!0)).catch(e=>{n(!1,e.message)})},h=o.fetcher,f=o.updater,p=e.me||r.authn.currentUser();if(!p)return console.log("MUST BE LOGGED IN"),void alert("NOT LOGGED IN");var m,v,g=u.dir().uri;if(e.useExisting){if(v=e.useExisting,s=u.dir().uri,m=v.doc(),e.newBase)throw new Error("mint new scheduler: Illegal - have both new base and existing event")}else m=o.sym(s+"details.ttl"),v=o.sym(m.uri+"#event");for(var b=o.sym(s+"results.ttl"),y=e.noIndexHTML?{}:[{local:"index.html",contentType:"text/html"}],w=[],_=0;_<y.length;_++){!function(e){w.push(function(){var t=s+e.local;console.log("Copying "+g+e.local+" to "+t);var n=function(){d(t,!1,function(e,n){e?w.shift()():(l(e,"FAILED to set ACL "+t+" : "+n),console.log("FAILED to set ACL "+t+" : "+n))})};o.fetcher.webCopy(g+e.local,s+e.local,e.contentType).then(()=>r.authn.checkUser()).then(e=>{p=e,n()}).catch(t=>{console.log("FAILED to copy "+g+e.local+" : "+t.message),l(!1,"FAILED to copy "+g+e.local+" : "+t.message)})})}(y[_])}w.push(function(){o.add(v,a.rdf("type"),a.sched("SchedulableEvent"),m),p&&(o.add(v,a.dc("author"),p,m),o.add(v,a.foaf("maker"),p,m)),o.add(v,a.dc("created"),new Date,m),o.add(v,a.sched("resultsDocument"),m),f.put(m,o.statementsMatching(void 0,void 0,void 0,m),"text/turtle",function(e,t,n){t?w.shift()():(l(t,"FAILED to save new scheduler at: "+m+" : "+n),console.log("FAILED to save new scheduler at: "+m+" : "+n))})}),w.push(function(){o.fetcher.webOperation("PUT",b.uri,{data:"",contentType:"text/turtle"}).then(()=>{w.shift()()}).catch(e=>{l(!1,"Failed to initialize empty results file: "+e.message)})}),w.push(function(){d(b.uri,!0,function(e,t){l(e,"Failed to set Read-Write ACL on results file: "+t),e&&w.shift()()})}),w.push(function(){d(m.uri,!1,function(e,t){l(e,"Failed to set read ACL on configuration file: "+t),e&&w.shift()()})}),w.push(function(){console.log("Finished minting new scheduler"),t(e)}),w.shift()()})},render:function(e,t){var a=r.store,s=r.ns,u=e,l="app-when-can-we.w3.org",c=r.store.fetcher,d=a.updater,h=!1,f=e,p=e.doc(),m=p.dir().uri,v=i.sym(m+"results.ttl"),g="https://solid.github.io/solid-panes/schedule/formsForSchedule.ttl",b=a.sym(g+"#form1"),y=a.sym(g+"#form2"),w=a.sym(g+"#form3"),_=n(258);i.parse(_,a,g,"text/turtle");var x,M="background-color: #eef; padding: 0.5em; border: .5em solid white; font-size: 100%",k="width: 1.8em; height: 1.8em;",C=function(e,n){e||U.appendChild(r.widgets.errorMessageBlock(t,n,"pink"))},E=function(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e},A=function(e,t){var n=a.any(t,r.ns.ui("backgroundColor"));n&&e.setAttribute("style","padding: 0.3em; text-align: center; background-color: "+n+";")};r.authn.checkUser().then(e=>{x=e,z&&z.refresh(),e&&h&&(h=!1,j())}),console.log("me: "+x);var T=function(){var e=r.authn.newAppInstance(t,{noun:"scheduler"},S);return e.firstChild.setAttribute("style",M),e},S=function(e){var t=a.any(e,s.space("uriPrefix"));"/"!==(t=t?t.value:e.uri.split("#")[0]).slice(-1)&&(i.log.error(l+": No / at end of uriPrefix "+t),t+="/");var n=new Date;t+=l+"/id"+n.getTime()+"/",I(f,t)},I=function(e,n){var r={thisInstance:e,newBase:n};this.mintNew(r).then(function(e){var n=U.appendChild(t.createElement("p"));n.setAttribute("style","font-size: 140%;"),n.innerHTML="Your <a href='"+e.newInstance.uri+"'><b>new scheduler</b></a> is ready to be set up. <br/><br/><a href='"+e.newInstance.uri+"'>Say when you what days work for you.</a>"}).catch(function(e){C(!1,"Error createing new scheduler at "+r.newInstance+": "+e)})},N=function(){console.log("getDetails()"),c.nowOrWhenFetched(p.uri,void 0,function(e,t){return console.log("getDetails() ok? "+e),e?void j():C(e,t)})},j=function(){console.log("showAppropriateDisplay()"),r.authn.checkUser().then(t=>{if(!t)return O();r.store.updater.editable(p.uri,a)&&!a.holds(e,s.rdf("type"),s.wf("TemplateInstance"))?a.any(e,s.sched("ready"))?D():P():R(U)})},O=function(){E(H);let e={div:U,dom:t};r.authn.logIn(e).then(e=>{x=e.me,h=!1,j()})},R=function(){var e=E(H);e.appendChild(r.authn.newAppInstance(t,{noun:"poll"},S)),e.appendChild(t.createElement("hr")),e.appendChild(t.createElement("p")).textContent="Where would you like to store the data for the poll? Give the URL of the directory where you would like the data stored.";var n=e.appendChild(t.createElement("input"));n.setAttribute("type","text"),n.size=80,n.label="base URL",n.autocomplete="on",e.appendChild(t.createElement("br"));var i=e.appendChild(t.createElement("button"));i.setAttribute("style",M),i.textContent="Start new poll at this URI",i.addEventListener("click",function(e){var t=n.value;"/"!==t.slice(-1)&&(t+="/"),I(f,t)})},L=t.createElement("button"),P=function(){E(J);var n=0,o=!1;{let i=[b,y,w],a=[];n=0;for(var u=0;u<i.length;u++){let n=t.createElement("div");r.widgets.appendForm(document,n,{},e,i[u],p,C),a.push(n)}var l=function(){E(H).appendChild(a[n]),0==n?c.setAttribute("disabled",""):c.removeAttribute("disabled"),n==a.length-1?(d.setAttribute("disabled",""),!o&&(J.appendChild(f),J.appendChild(L),o=!0)):d.removeAttribute("disabled")},c=E(V).appendChild(t.createElement("button"));c.setAttribute("style",M),c.textContent="<- go back",c.addEventListener("click",function(e){0<n&&(n-=1,l())},!1);var d=E(G).appendChild(t.createElement("button"));d.setAttribute("style",M),d.textContent="continue ->",d.addEventListener("click",function(e){n<a.length-1&&(n+=1,l())},!1),l()}var h=[];h.push(i.st(e,s.sched("availabilityOptions"),s.sched("YesNoMaybe"),p)),h.push(i.st(e,s.sched("ready"),new Date,p)),h.push(i.st(e,s.sched("results"),v,p)),L.setAttribute("style",M),L.textContent="Go to poll",L.addEventListener("click",function(t){a.any(e,s.sched("ready"))?(D(),G.appendChild(f)):(G.appendChild(f),r.store.updater.update([],h,function(e,t,n){t?D():C(t,n)}))},!1);var f=t.createElement("button");f.setAttribute("style",M);let m=f.appendChild(t.createElement("img"));m.setAttribute("src",r.icons.iconBase+"noun_480183.svg"),m.setAttribute("style",k),f.addEventListener("click",function(t){var n=a.anyValue(e,s.cal("summary"))||a.anyValue(e,s.dc("title"))||"",r="mailto:"+a.each(e,s.sched("invitee")).map(function(e){var t=a.any(e,s.foaf("mbox"));return t?t.uri.replace("mailto:",""):""}).join(",")+"?subject="+encodeURIComponent(n+"-- When can we meet?")+"&body="+encodeURIComponent(n+"\n\nWhen can you?\n\nSee "+e+"\n");console.log("Mail: "+r),window.location.href=r},!1)},D=function(){c.nowOrWhenFetched(v.uri,(e,t,n)=>{e?(E(H),B()):404===n.status?(console.log("Initializing details file "+v),d.put(v,[],"text/turtle",function(e,t,n){t?(E(H),B()):(C(t,"FAILED to create results file at: "+v.uri+" : "+n),console.log("FAILED to craete results file at: "+v.uri+" : "+n))})):C(e,"FAILED to read results file: "+t)})},B=function(){var n=a.any(u,s.cal("summary")),l=a.any(u,s.cal("comment")),c=a.any(u,s.cal("location")),d=H;n&&(d.appendChild(t.createElement("h3")).textContent=n),c&&(d.appendChild(t.createElement("address")).textContent=c.value),l&&(d.appendChild(t.createElement("p")).textContent=l.value);var h=a.any(u,s.dc("author"));if(h){var f=a.any(h,s.foaf("name"));f&&(d.appendChild(t.createElement("p")).textContent=f)}var p=new i.Query("Responses"),m={};["time","author","value","resp","cell"].map(function(e){p.vars.push(m[e]=i.variable(e))}),p.pat.add(u,s.sched("response"),m.resp),p.pat.add(m.resp,s.dc("author"),m.author),p.pat.add(m.resp,s.sched("cell"),m.cell),p.pat.add(m.cell,s.sched("availabilty"),m.value),p.pat.add(m.cell,s.cal("dtstart"),m.time);var g={};g.set_x=a.each(e,s.sched("option")),g.set_x=g.set_x.map(function(e){return a.any(e,s.cal("dtstart"))}),g.set_y=a.each(e,s.sched("response")),g.set_y=g.set_y.map(function(e){return a.any(e,s.dc("author"))});var b=a.each(u,s.sched("option")).map(function(e){return a.any(e,s.cal("dtstart"))}),y=function(){var e=d.appendChild(r.matrix.matrixForQuery(t,p,m.time,m.author,m.value,g,function(){}));e.setAttribute("class","matrix");var n=t.createElement("button");n.setAttribute("style",M);let i=t.createElement("img");i.setAttribute("src",r.icons.iconBase+"noun_479395.svg"),i.setAttribute("style",k),n.appendChild(i),n.addEventListener("click",function(t){n.disabled=!0,r.store.fetcher.refresh(v,function(t,r){t?(e.refresh(),n.disabled=!1):console.log("Cant refresh matrix"+r)})},!1),E(J),J.appendChild(n)},w=[],_={div:J,dom:t};r.authn.logIn(_).then(e=>{const n=e.me;var l=v;g.set_y=g.set_y.filter(function(e){return!e.sameTerm(n)}),g.set_y.push(n),g.cellFunction=function(e,i,u,l){if(null!==l&&a.fetcher.nowOrWhenFetched(l.uri.split("#")[0],void 0,function(t,n){t&&A(e,l)}),u.sameTerm(n)){var c=s.sched("availabilty"),d=w[i.toNT()],h=r.widgets.makeSelectForOptions(t,a,d,c,o,{},v,function(){A(e,l)});e.appendChild(h)}else null!==l&&(e.textContent=r.utils.label(l))};var c=null;a.each(u,s.sched("response")).map(function(e){a.holds(e,s.dc("author"),n)&&(c=e)});var d=[],h=r.widgets.newThing(l).uri;null===c?(c=i.sym(h+"_response"),d.push(i.st(u,s.sched("response"),c,l)),d.push(i.st(c,s.dc("author"),n,l))):a.each(c,s.sched("cell")).map(function(e){var t=a.any(e,s.cal("dtstart"));w[t.toNT()]=e});for(var f=0;f<b.length;f++)if(!w[b[f].toNT()]){var p=i.sym(h+"_"+f);d.push(i.st(c,s.sched("cell"),p,l)),d.push(i.st(p,s.cal("dtstart"),b[f],l)),w[b[f].toNT()]=p}d.length?r.store.updater.update([],d,function(e,t,n){t?y():C(t,n)}):y()});var S=a.any(e,s.foaf("maker"));if(!S||S.sameTerm(x)){var I=t.createElement("button");I.setAttribute("style",M);let e=t.createElement("img");e.setAttribute("src",r.icons.iconBase+"noun_344563.svg"),e.setAttribute("style",k),I.appendChild(e),I.addEventListener("click",function(e){E(d),P()},!1),E(V),V.appendChild(I)}E(G),G.appendChild(T())},U=t.createElement("div"),q=U.appendChild(t.createElement("table"));q.setAttribute("style","background-color: white; min-width: 40em; min-height: 13em;");var F=q.appendChild(t.createElement("tr"));F.appendChild(t.createElement("td")),F.appendChild(t.createElement("td")),F.appendChild(t.createElement("td"));var z=null,H=q.appendChild(t.createElement("tr")).appendChild(t.createElement("td"));H.setAttribute("colspan","3");var W=q.appendChild(t.createElement("tr"));W.setAttribute("class","naviMenu"),W.setAttribute("style"," text-align: middle; vertical-align: middle; padding-top: 4em; ");var V=W.appendChild(t.createElement("td")),J=W.appendChild(t.createElement("td")),G=W.appendChild(t.createElement("td"));return console.log("getforms()"),N(),U}}},function(e,t,n){const r=n(0),i=n(4),a=r.ns,o=r.store;e.exports={icon:r.icons.iconBase+"noun_688606.svg",name:"tabbed",label:function(e){var t=r.store,n=r.ns,i=t.findTypeURIs(e);return n.meeting("Cluster").uri in i?"Tabbed":null},render:function(e,t){var n=t.createElement("div");return o.fetcher.load(e).then(function(s){var u=o.the(e,a.meeting("predicate")),l={dom:t,subject:e};l.predicate=o.any(e,a.meeting("predicate"))||a.meeting("toolList"),l.ordered=!0,l.orientation=o.anyValue(e,a.meeting("orientation"))||0,l.renderMain=function(e,n){e.innerHTML="";var r=e.appendChild(t.createElement("table"));i.getOutliner(t).GotoSubject(n,!0,null,!1,void 0,r)},l.renderTab=function(e,n){e.appendChild(r.widgets.personTR(t,u,n,{}))},l.backgroundColor=o.anyValue(e,a.ui("backgroundColor"))||"#ddddcc",n.appendChild(r.tabs.tabWidget(l))}),n}}},function(e,t){e.exports='@prefix : <http://www.w3.org/ns/ui#> .\n@prefix f: <#> .\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix meeting: <http://www.w3.org/ns/pim/meeting#>.\n@prefix ns: <http://www.w3.org/2006/vcard/ns#> .\n@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix te: <http://purl.org/dc/terms/> .\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n\n f:main a :Form;\n cal:summary "Meeting Details";\n :part f:titleField, f:locationField, f:startField,\n f:endField, f:eventComment, f:colorField .\n\n f:titleField a :SingleLineTextField;\n :maxLength 256;\n :property cal:summary;\n :label "Name of meeting";\n :size 80 .\n\n f:locationField a :SingleLineTextField;\n :maxLength 128;\n :property cal:location;\n :size 40 .\n\n f:startField a :DateField;\n :label "Start";\n :property cal:dtstart .\n\n f:endField a :DateField;\n :label "End";\n :property cal:dtend .\n\n f:colorField a :ColorField;\n :label "Tab color";\n # :default "#ddddcc"^^xsd:color;\n :property ui:backgroundColor .\n\n f:eventComment\n a ui:MultiLineTextField;\n # ui:maxLength\n # "1048";\n # ui:size\n # "40".\n ui:property\n cal:comment.\n\n###################################################\n\nf:settings a :Form;\n dc:title "Tab settings";\n :part f:labelField, f:targetField, f:viewField.\n\n f:labelField a :SingleLineTextField;\n :maxLength 128;\n :property rdfs:label;\n :label "Label on tab";\n :size 40 .\n\n f:targetField a :NamedNodeURIField;\n :maxLength 1024; # Longer?\n :property meeting:target;\n :label "URL of resource";\n :size 80 .\n\n f:colorField2 a :ColorField;\n :label "Tab color";\n # :default "#ddddcc"^^xsd:color;\n :property ui:backgroundColor .\n\n f:viewField a :SingleLineTextField;\n :maxLength 128;\n :property meeting:view;\n :label "View mode (experts only)";\n :size 40 .\n\n#\n'},function(e,t,n){var r=n(0),i=n(4),a=n(261);e.exports={icon:r.icons.iconBase+"noun_66617.svg",name:"meeting",label:function(e){var t=r.store,n=r.ns;return t.holds(e,n.rdf("type"),n.meeting("Meeting"))?"Meeting":null},mintClass:r.ns.meeting("Meeting"),mintNew:function(e){return new Promise(function(t,n){var i=r.store,a=r.ns;e.newInstance=e.newInstance||i.sym(e.newBase+"index.ttl#this");var o=e.newInstance,s=o.doc(),u=r.authn.currentUser();u&&i.add(o,a.dc("author"),u,s),i.add(o,a.rdf("type"),a.meeting("Meeting"),s),i.add(o,a.dc("created"),new Date,s),i.add(o,a.ui("backgroundColor"),new $rdf.Literal("#ddddcc",void 0,a.xsd("color")),s);var l=new $rdf.Collection;i.add(o,a.meeting("toolList"),l,s),l.elements.push(o),i.updater.put(s,i.statementsMatching(void 0,void 0,void 0,s),"text/turtle",function(r,i,a){i?t(e):n(new Error("Error writing meeting configuration: "+a))})})},render:function(e,t){function n(e){const t=/https:\/\/www\.google\..*\/maps\//,n="https://www.google.com/maps/embed/v1/",r=e.uri;if(!r.match(t))return e;if(r.startsWith(n))return e;const i=r.replace(t,n)+"&key=AIzaSyB8aaT6bY9tcLCmc2oPCkdUYLmTOWM8R54";return console.log("Converted Google Map URI! "+i),$rdf.sym(i)}function o(e,t){return new Promise(function(n,i){var a=r.store;if(!t.useExisting){var o=a.any(f,t.predicate);if(o){if(e.limit&&1===e.limit&&!e.shareTab)return d("Already have "+o+" as "+r.utils.label(t.predicate)),d("Cant have two"),n(null);if(e.shareTab)return console.log("Using existing "+o+" as "+r.utils.label(t.predicate)),n({me:_,newInstance:o,instanceClass:t.instanceClass})}}_||t.me||i(new Error("Username not defined for new tool")),t.me=t.me||_,t.newInstance=t.useExisting||t.newInstance||a.sym(t.newBase+"index.ttl#this"),t.pane.mintNew(t).then(function(e){var t=k(e.newInstance,e.predicate,e.tabTitle,e.pane.icon);e.view&&a.add(t,r.ns.meeting("view"),e.view,p),x(),a.fetcher.putBack(p,{contentType:"text/turtle"}).then(function(t){n(e)}).catch(function(e){i(e)})}).catch(function(e){d(e),i(e)})})}var s=r.store,u=r.ns,l=s.updater,c=this,d=function(e,n){console.log(e);var r=t.createElement("pre");r.setAttribute("style","background-color: "+n||"#eed;"),v.appendChild(r),r.appendChild(t.createTextNode(e))},h=function(e,t){e||d(t)},f=e,p=e.doc(),m=e.dir().uri,v=t.createElement("div"),g=v.appendChild(t.createElement("table")),b=g.appendChild(t.createElement("tr"));b.appendChild(t.createElement("div"));var y=g.appendChild(t.createElement("tr")),w=g.appendChild(t.createElement("td")).appendChild(t.createElement("table")).appendChild(t.createElement("tr"));b.setAttribute("style","height: 2em;");var _=null,x=function(){l.put(p,s.statementsMatching(void 0,void 0,void 0,p),"text/turtle",function(e,t,n){t?(G.refresh(),W()):d(n="FAILED to save new thing at: "+p+" : "+n)})},M=function(e,t,n){var r=t.doc();n&&s.add(f,n,t,r),s.add(t,u.meeting("parentMeeting"),f,r),l.put(r,s.statementsMatching(void 0,void 0,void 0,r),"text/turtle",function(e,n,r){n?x():d("FAILED to save new tool at: "+t+" : "+r)})},k=function(e,t,n,i){t&&s.add(f,t,e,p);var a=r.widgets.newThing(p);return n&&s.add(a,u.rdfs("label"),n,p),i&&s.add(a,u.meeting("icon"),s.sym(i),p),s.add(a,u.rdf("type"),u.meeting("Tool"),p),s.add(a,u.meeting("target"),e,p),s.the(f,u.meeting("toolList")).elements.push(a),a},C=function(t){return new Promise(function(a,l){var c=function(e){var t=s.any(e,u.foaf("preferredURI")),n=t?s.sym(t):e,i=s.any(f,u.meeting("attendeeGroup")),a=function(e,t){var n=[$rdf.st(t,r.ns.vcard("hasMember"),e,t.doc())],i=s.any(e,u.vcard("fn"))||s.any(e,u.foaf("name"));i&&n.push($rdf.st(e,r.ns.vcard("fn"),i,t.doc())),s.fetcher.nowOrWhenFetched(t.doc(),void 0,function(r,i){return r?void s.updater.update([],n,function(t,n,r){h(n,r),n&&console.log("Addded to particpants OK: "+e)}):void d("Can't read group to add person"+t)})};return i?void a(n,i):void I().then(function(e){var t=e.newInstance;a(n,t),s.fetcher.putBack(p,{contentType:"text/turtle"}).then(function(e){console.log("Particiants Group created: "+t)})}).catch(function(e){d(e)})};console.log("Dropped on thing "+t);var m=t.uri;return m.startsWith("http:")&&0>m.indexOf("#")?(function(t){const n=u.wf("attachment");s.add(e,n,t,e.doc());o({icon:"noun_160581.svg",limit:1,shareTab:!0},{newInstance:e,pane:i.link,predicate:u.meeting("attachmentTool"),tabTitle:"Links",view:"link",noIndexHTML:!0})}(t),a(t)):void s.fetcher.nowOrWhenFetched(t,function(e,i){function o(e){e=n(e),console.log("make web page attachement tab "+e);var t=k(e,r.ns.wf("attachment"),r.utils.label(e),null);return s.add(t,r.ns.meeting("view"),"iframe",p),a(e)}if(!e)return console.log("Error looking up dropped thing, will just add it anyway. "+t+": "+i),o(t);var l=t,d=s.findTypeURIs(l);for(var h in d)console.log(" drop object type includes: "+h);if(u.vcard("Individual").uri in d||u.foaf("Person").uri in d||u.foaf("Agent").uri in d)return c(t),a(t);if(m.startsWith("https:")&&0>m.indexOf("#")){var f=s.fetcher.getHeader(t,"x-frame-options"),v=!0;if(f)for(var g=0;g<f.length;g++)console.log("x-frame-options: "+f[g]),0>f[g].indexOf("sameorigin")&&(v=!1),0>f[g].indexOf("deny")&&(v=!1);if(v)return function(e){var t=k(e,r.ns.wf("attachment"),r.utils.label(e),null);s.add(t,r.ns.meeting("view"),"iframe",p)}(t=n(t)),a(t)}return console.log("Default: assume web page attachement "+t),o(t)})})},E=function(e){Promise.all(e.map(function(e){var t=$rdf.sym(e);return C(t)})).then(function(e){x()})},A=function(e){r.widgets.uploadFiles(s.fetcher,e,f.dir().uri+"Files",f.dir().uri+"Pictures",function(e,t){e.type.startsWith("image/")?T("Files"):S("Pictures")})},T=function(e){return o({icon:"noun_598334.svg",limit:1,shareTab:!0},{newInstance:s.sym(f.dir().uri+e+"/"),pane:i.folder,predicate:u.meeting("pictures"),shareTab:!0,tabTitle:e,view:"slideshow",noIndexHTML:!0})},S=function(e){return o({icon:"noun_681601.svg",limit:1,shareTab:!0},{newInstance:s.sym(f.dir().uri+"Files/"),pane:i.folder,predicate:u.meeting("materialsFolder"),tabTitle:"Materials",noIndexHTML:!0})},I=function(){return o({icon:"noun_339237.svg",limit:1,shareTab:!0},{newInstance:s.sym(f.dir().uri+"Attendees/index.ttl#this"),pane:i.contact,predicate:u.meeting("attendeeGroup"),tabTitle:"Attendees",instanceClass:u.vcard("Group"),instanceName:r.utils.label(e)+" attendees",noIndexHTML:!0})},N=function(){var e=r.widgets.selectWorkspace(t,{noun:"meeting"},function(n,i){c.mintNew({newBase:i}).then(function(n){var r=n.newInstance;P.removeChild(e);var i=P.appendChild(t.createElement("p"));i.setAttribute("style","font-size: 140%;"),i.innerHTML="Your <a target='_blank' href='"+r.uri+"'><b>new meeting</b></a> is ready to be set up. <br/><br/><a target='_blank' href='"+r.uri+"'>Go to your new meeting.</a>"}).catch(function(n){P.removeChild(e),P.appendChild(r.widgets.errorMessageBlock(t,n))})});P.appendChild(e)},j=[{icon:"noun_339237.svg",maker:function(e){var t=m+"Group/",n=r.store,i=n.any(f,u.meeting("particpants"));i||(i=$rdf.sym(t+"index.ttl#this")),console.log("Participant group: "+i);var a=k(i,u.meeting("particpants"),"Particpants",r.icons.iconBase+"noun_339237.svg");n.add(a,r.ns.meeting("view"),"peoplePicker",p),x()},hint:"Make a group of people",limit:1},{icon:"noun_346777.svg",maker:function(e){return o(e,{useExisting:f,pane:i.schedule,view:"schedule",tabTitle:"Schedule poll",noIndexHTML:!0})},hint:"Make a poll to schedule the meeting"},{icon:"noun_48218.svg",maker:function(e){},limit:1,hint:"Add an agenda list",disabled:!0},{icon:"noun_79217.svg",maker:function(e){return o(e,{newBase:m+"SharedNotes/",predicate:r.ns.meeting("sharedNotes"),tabTitle:"Shared Notes",pane:i.pad})},hint:"Add a shared notepad"},{icon:"noun_346319.svg",maker:function(e){var t=m+"Chat/",n=r.store;if(n.holds(f,u.meeting("chat")))console.log("Ignored - already have chat");else{var i=n.sym(t+"chat.ttl");n.add(i,u.rdf("type"),u.meeting("Chat"),i),k(i,u.meeting("chat"),"Chat",r.icons.iconBase+"noun_346319.svg"),M(0,i,u.meeting("chat"))}},limit:1,hint:"Add a chat channel for the meeting"},{icon:"noun_17020.svg",maker:function(e){var t=m+"Actions/",n=r.store;if(n.holds(f,u.meeting("actions")))console.log("Ignored - already have actions");else{var i=n.sym(t+"config.ttl"),a=n.sym(t+"config.ttl#this"),o=n.sym(t+"state.ttl");n.add(a,u.dc("title"),(n.anyValue(f,u.cal("summary"))||"Meeting ")+" actions",i),n.add(a,u.wf("issueClass"),u.wf("Task"),i),n.add(a,u.wf("initialState"),u.wf("Open"),i),n.add(a,u.wf("stateStore"),o,i),n.add(a,u.wf("assigneeClass"),u.foaf("Person"),i),n.add(a,u.rdf("type"),u.wf("Tracker"),i),n.add(a,u.rdf("type"),u.wf("Tracker"),i),k(a,u.meeting("actions"),"Actions",r.icons.iconBase+"noun_17020.svg"),M(0,a,u.meeting("actions"))}},limit:1,hint:"Add a list of action items"},{icon:"noun_260227.svg",maker:function(e){var t=r.store,n=$rdf.sym("https://meet.jit.si/rdflib-rdfext "+r.utils.genUuid());if(t.holds(f,u.meeting("videoCallPage")))console.log("Ignored - already have a videoCallPage");else{t.add(n,u.rdf("type"),u.meeting("VideoCallPage"),p);var i=k(n,u.meeting("videoCallPage"),"Video call",r.icons.iconBase+"noun_260227.svg");t.add(i,u.meeting("view"),"iframe",p),x()}},limit:1,hint:"Add a video call for the meeting"},{icon:"noun_25830.svg",maker:function(e){r.widgets.askName(t,s,P,u.log("uri"),r.ns.rdf("Resource")).then(function(e){if(!e)return W();var t=r.store,n=r.ns,i=t.sym(e),a=k(i,n.wf("attachment"),r.utils.label(i),null);t.add(a,n.meeting("view"),"iframe",p),x()}).catch(function(e){d("Error making new sub-meeting: "+e)})},hint:"Attach meeting materials",disabled:!1},{icon:"noun_123691.svg",maker:function(e){var t=r.store,n=r.ns,i=f.dir();if(e.limit&&1===e.limit&&t.holds(f,n.wf("sharingControl")))d("Ignored - already have "+r.utils.label(J.predicate));else{var a=k(i,n.wf("sharingControl"),"Sharing",r.icons.iconBase+"noun_123691.svg");t.add(a,n.meeting("view"),"sharing",p),x()}},limit:1,hint:"Control Sharing",disabled:!1},{icon:"noun_66617.svg",maker:function(e){r.widgets.askName(t,s,P,u.foaf("name"),r.ns.meeting("Meeting")).then(function(t){if(!t)return W();var n=encodeURIComponent(t),a={newBase:m+n+"/",predicate:r.ns.meeting("subMeeting"),tabTitle:t,pane:i.meeting};return o(e,a)}).catch(function(e){d("Error making new sub-meeting: "+e)})},hint:"Make a sub meeting",disabled:!1}],O=$rdf.sym("https://solid.github.io/solid-panes/meeting/meetingDetailsForm.ttl#settings");$rdf.parse(a,s,O.doc().uri,"text/turtle");var R="padding: 1em; width: 3em; height: 3em;",L=w.appendChild(t.createElement("td")),P=w.appendChild(t.createElement("td")),D=L.appendChild(t.createElement("img")),B=!1;D.setAttribute("src",r.icons.iconBase+"noun_19460_green.svg"),D.setAttribute("style",R+"opacity: 50%;"),D.setAttribute("title","Add another tool to the meeting");var U,q=function(e){B=!B,D.setAttribute("style",R+(B?"background-color: yellow;":"")),H(B?"":"display: none;")};r.authn.checkUser().then(e=>e?(_=e,D.addEventListener("click",q),void D.setAttribute("style",R)):(U=r.authn.loginStatusBox(t,e=>{e?(_=s.sym(e),P.removeChild(U),D.addEventListener("click",q),D.setAttribute("style",R)):(console.log("(Logged out)"),_=null)}),U.setAttribute("style","margin: 0.5em 1em;"),void P.appendChild(U)));for(var F=[],z=0;z<j.length;z++)(function(){var e=j[z],n=L.appendChild(t.createElement("img"));n.setAttribute("src",r.icons.iconBase+e.icon),n.setAttribute("style",R+"display: none;"),F.push(n),n.tool=e;var i=e.maker;e.disabled||n.addEventListener("click",function(t){V(n),i(e)})})();var H=function(e){for(var t,n=0;n<F.length;n++)t=R+e,j[n].disabled&&(t+="opacity: 0.3;"),F[n].setAttribute("style",t)},W=function(){H("display: none;"),D.setAttribute("style",R)},V=function(e){H("display: none;"),e.setAttribute("style",R+"background-color: yellow;")},J={dom:t};J.predicate=u.meeting("toolList"),J.subject=e,J.ordered=!0,J.orientation=1,J.renderMain=function(e,n){var a,o=null,l=null;e.innerHTML="";var c=function(t,n){t||(e.textContent=""+n)},h=function(){e.appendChild(t.createElement("h3")).textContent="Details of meeting";var n=$rdf.sym("https://solid.github.io/solid-panes/meeting/meetingDetailsForm.ttl#main");r.widgets.appendForm(document,e,{},f,n,f.doc(),c),e.appendChild(function(e){var n=t.createElement("div"),r=n.appendChild(t.createElement("p"));return r.setAttribute("style","margin: 0em; padding:3em; color: #888;"),r.textContent="Tip: "+e,n}("Drag URL-bar icons of web pages into the tab bar on the left to add new meeting materials.")),(_=r.authn.currentUser())&&s.add(f,u.dc("author"),_,p);var i={noun:"meeting",me:_,statusArea:e,div:e,dom:t};r.authn.registrationControl(i,f,u.meeting("Meeting")).then(function(e){console.log("Registration control finsished.")}),r.pad.manageParticipation(t,e,p,f,_,{});var a="height: 2em; width: 2em; margin:0.5em;",o=e.appendChild(t.createElement("div")),l=o.appendChild(t.createElement("img"));l.setAttribute("src",r.icons.iconBase+"noun_145978.svg"),l.setAttribute("title","Make a fresh new meeting"),l.addEventListener("click",N),l.setAttribute("style",a);var d=o.appendChild(t.createElement("a"));d.setAttribute("href","https://github.com/solid/solid-panes"),d.setAttribute("target","_blank");var h=d.appendChild(t.createElement("img"));h.setAttribute("src",r.icons.iconBase+"noun_368567.svg"),h.setAttribute("title","Fork me on github"),h.setAttribute("style",a+"opacity: 50%;")};if(s.holds(n,u.rdf("type"),u.meeting("Tool"))){var m=s.any(n,u.meeting("target"));if(m.sameTerm(f)&&!s.any(n,u.meeting("view")))h();else{var v=s.any(n,u.meeting("view"));"details"===(v=v?v.value:null)?h():"peoplePicker"===v?function(){var n={div:e,dom:t};e.appendChild(t.createElement("h4")).textContent="Meeting Participants";var i=function(e){var t=[$rdf.st(f,u.meeting("particpantGroup"),e,f.doc())];s.updater.update([],t,function(t,n,r){n?l=e:d("Cant save participants group: "+r)})};l=s.any(f,u.meeting("particpantGroup")),r.authn.loadTypeIndexes(n).then(function(e){var t={defaultNewGroupName:"Meeting Participants",selectedGroup:l};new r.widgets.PeoplePicker(e.div,e.index.private[0],i,t).render()})}():"iframe"===v?function(n){var r=e.appendChild(t.createElement("iframe"));r.setAttribute("src",n.uri),r.setAttribute("style","border: none; margin: 0; padding: 0; height: 100%; width: 100%; resize: both; overflow:scroll;"),e.style.resize="none",e.style.padding=0}(m):(o=v?i.byName(v):null,(a=e.appendChild(t.createElement("table"))).style.width="100%",i.getOutliner(t).GotoSubject(m,!0,o,!1,void 0,a))}}else n.sameTerm(f)?h():(!n.sameTerm(n.doc())||s.holds(n,r.ns.rdf("type"),r.ns.meeting("Chat"))||s.holds(n,r.ns.rdf("type"),r.ns.meeting("PaneView")))&&(a=e.appendChild(t.createElement("table")),i.getOutliner(t).GotoSubject(n,!0,void 0,!1,void 0,a))},J.renderTab=function(e,n){if(s.holds(n,u.rdf("type"),u.meeting("Tool"))){var i=s.any(n,u.meeting("target")),a=s.any(n,u.rdfs("label"));a=a?a.value:r.utils.label(i);var o=e.appendChild(t.createElement("div"));o.textContent=a,o.setAttribute("style","margin-left: 0.7em");var l=s.any(n,u.meeting("icon"));if(l){var c=e.appendChild(t.createElement("table")).appendChild(t.createElement("tr")),d=c.appendChild(t.createElement("td")),h=c.appendChild(t.createElement("td")),f=d.appendChild(t.createElement("img"));f.setAttribute("src",l.uri),f.setAttribute("style","width: 1.5em; height: 1.5em;"),f.setAttribute("title",a),h.appendChild(o)}else e.appendChild(o)}else e.textContent=r.utils.label(n)},J.renderTabSettings=function(e,n){if(e.innerHTML="",e.style+="border-color: #eed;",e.appendChild(t.createElement("h3")).textContent="Adjust this tab",s.holds(n,u.rdf("type"),u.meeting("Tool"))){var i=$rdf.sym("https://solid.github.io/solid-panes/meeting/meetingDetailsForm.ttl#settings");r.widgets.appendForm(document,e,{},n,i,f.doc(),h),r.widgets.deleteButtonWithCheck(t,e,"tab",function(){for(var e=s.the(f,u.meeting("toolList")),t=0;t<e.elements.length;t++)if(e.elements[t].sameTerm(n)){e.elements.splice(t,1);break}var r=s.any(n,u.meeting("target")),i=s.statementsMatching(n).concat(s.statementsMatching(void 0,void 0,n)).concat(s.statementsMatching(f,void 0,r));s.remove(i),x()}).setAttribute("style","width: 1.5em; height: 1.5em;")}else e.appendChild(t.createElement("h4")).textContent="(No adjustments available)"},J.backgroundColor=s.anyValue(e,u.ui("backgroundColor"))||"#ddddcc";var G=y.appendChild(r.tabs.tabWidget(J));return r.aclControl.preventBrowserDropEvents(t),r.widgets.makeDropTarget(G.tabContainer,E,A),r.widgets.makeDropTarget(L,E,A),v}}},function(e,t,n){const r=n(0),i=r.ns,a=r.store,o=i.meeting("LongChat");e.exports={icon:r.icons.iconBase+"noun_1689339.svg",name:"long chat",label:function(e){return a.holds(e,i.rdf("type"),i.meeting("LongChat"))?"Chat channnel":null},mintClass:o,mintNew:function(e){var t=a.updater;if(e.me&&!e.me.uri)throw new Error("chat mintNew: Invalid userid "+e.me);var n=e.newInstance=e.newInstance||a.sym(e.newBase+"index.ttl#this"),r=n.doc();return a.add(n,i.rdf("type"),i.meeting("LongChat"),r),a.add(n,i.dc("title"),"Chat channel",r),a.add(n,i.dc("created"),new Date,r),e.me&&a.add(n,i.dc("author"),e.me,r),new Promise(function(n,i){t.put(r,a.statementsMatching(void 0,void 0,void 0,r),"text/turtle",function(t,r,a){r?n(e):i(new Error("FAILED to save new chat channel at: "+t+" : "+a))})})},render:function(e,t){const n=a.sym("https://solid.github.io/solid-panes/longCharPane/preferencesForm.ttl#this"),s=n.doc();a.holds(void 0,void 0,void 0,s)||$rdf.parse('\n @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n @prefix solid: <http://www.w3.org/ns/solid/terms#>.\n @prefix ui: <http://www.w3.org/ns/ui#>.\n @prefix : <#>.\n\n :this\n <http://purl.org/dc/elements/1.1/title> "Chat preferences" ;\n a ui:Form ;\n ui:part :colorizeByAuthor, :expandImagesInline, :newestFirst, :inlineImageHeightEms;\n ui:parts ( :colorizeByAuthor :expandImagesInline :newestFirst :inlineImageHeightEms ).\n\n:colorizeByAuthor a ui:BooleanField; ui:property solid:colorizeByAuthor;\n ui:label "Color user input by user".\n:expandImagesInline a ui:BooleanField; ui:property solid:expandImagesInline;\n ui:label "Expand image URLs inline".\n:newestFirst a ui:BooleanField; ui:property solid:newestFirst;\n ui:label "Newest messages at the top".\n\n:inlineImageHeightEms a ui:IntegerField; ui:property solid:inlineImageHeightEms;\n ui:label "Inline image height (lines)".\n\n',a,s.uri,"text/turtle");let u=a.statementsMatching(null,i.ui.property,null,s).map(e=>e.object);var l=t.createElement("div");l.setAttribute("class","chatPane");let c={infinite:!0,menuHandler:function(e,t,i){let s=i.div,u=i.dom;if(s.menuExpaded=!s.menuExpaded,s.menuExpaded){let e=s.appendChild(u.createElement("div"));e.style="border-radius: 1em; border: 0.1em solid purple; padding: 1em;";let d=e.appendChild(u.createElement("table")),h=d.appendChild(u.createElement("tr")),f=d.appendChild(u.createElement("tr")),p=d.appendChild(u.createElement("tr")),m=d.appendChild(u.createElement("tr"));r.pad.manageParticipation(u,h,t.doc(),t,i.me,{});var l={noun:"chat room",me:i.me,statusArea:m,div:f,dom:u};r.authn.registrationControl(l,t,o).then(function(e){console.log("Registration control finsished.")});var c={noun:"chat room",me:i.me,statusArea:m,div:p,dom:u,kb:a};i.me||alert("menu: no me!"),p.appendChild(r.preferences.renderPreferencesForm(t,o,n,c)),s.menuArea=e}else s.removeChild(s.menuArea)}},d={noun:"chat room",div:l,dom:t};return d.me=r.authn.currentUser(),r.preferences.getPreferencesForClass(e,o,u,d).then(n=>{for(let e in n)c[e.split("#")[1]]=n[e];l.appendChild(r.infiniteMessageArea(t,a,e,c))},e=>r.widgets.complain(e)),l}}},function(e,t,n){const r=n(0),i=r.ns,a=r.store;e.exports={icon:r.icons.iconBase+"noun_346319.svg",name:"chat",label:function(e){var t=r.store.each(e,i.wf("message")).length;return 0<t?"Chat ("+t+")":a.holds(e,i.rdf("type"),i.meeting("Chat"))?"Meeting chat":a.holds(void 0,i.rdf("type"),i.foaf("ChatChannel"),e)?"IRC log":null},mintClass:i.meeting("Chat"),mintNew:function(e){var t=a.updater;if(e.me&&!e.me.uri)throw new Error("chat mintNew: Invalid userid "+e.me);var n=e.newInstance=e.newInstance||a.sym(e.newBase+"index.ttl#this"),r=n.doc();return a.add(n,i.rdf("type"),i.meeting("Chat"),r),a.add(n,i.dc("title"),"Chat",r),a.add(n,i.dc("created"),new Date,r),e.me&&a.add(n,i.dc("author"),e.me,r),new Promise(function(n,i){t.put(r,a.statementsMatching(void 0,void 0,void 0,r),"text/turtle",function(t,r,a){r?n(e):i(new Error("FAILED to save new tool at: "+t+" : "+a))})})},render:function(e,t){var n=t.createElement("div");n.setAttribute("class","chatPane");let o={};var s;if(a.holds(e,i.rdf("type"),i.meeting("Chat")))s=e.doc();else if(a.any(e,r.ns.wf("message")))s=r.store.any(e,r.ns.wf("message")).doc();else if(a.holds(void 0,i.rdf("type"),i.foaf("ChatChannel"),e)||a.holds(e,i.rdf("type"),i.foaf("ChatChannel"))){s=e.doc(),o.query=function(){var e=new $rdf.Query("IRC log entries"),t=[];return["chan","msg","date","list","pred","creator","content"].map(function(n){e.vars.push(t[n]=$rdf.variable(n))}),e.pat.add(t.chan,i.foaf("chatEventList"),t.list),e.pat.add(t.list,t.pred,t.msg),e.pat.add(t.msg,i.dc("date"),t.date),e.pat.add(t.msg,i.dc("creator"),t.creator),e.pat.add(t.msg,i.dc("description"),t.content),e}()}else!function(e,r){var i=t.createElement("pre");i.setAttribute("style","background-color: "+r||"#eed;"),n.appendChild(i),i.appendChild(t.createTextNode(e))}("Unknown chat type");return n.appendChild(r.messageArea(t,a,e,s,o)),a.updater.addDownstreamChangeListener(s,function(){r.widgets.refreshTree(n)}),n}}},function(e,t,n){var r=n(0),i=n(4);e.exports={icon:r.icons.iconBase+"noun_142708.svg",name:"period",label:function(e){return r.store.findTypeURIs(e)["http://www.w3.org/2000/10/swap/pim/qif#Period"]?"period":null},render:function(e,t){var n=r.store,a=r.ns,o=t.createElement("div");o.setAttribute("class","periodPane");var s=function(e,n){n||(n="color: grey;");var r=t.createElement("pre");r.setAttribute("style",n),o.appendChild(r),r.appendChild(t.createTextNode(e))},u=function(e){return s("✓ "+e,"color: #010; background-color: #efe")},l=function(e){return s(e,"color: #100; background-color: #fee")},c=function(){var s=n.any(e,a.cal("dtstart"));void 0===s&&l("(Error: There is no start date known for this period <"+e.uri+">,\n -- every period needs one.)");var c=n.any(e,a.cal("dtend"));void 0===c&&l("(Error: There is no end date known for this period <"+e.uri+">,\n -- every period needs one.)");var d={};!function(e){d[e.uri]=!0}(a.rdf("type"));var h=function(e){return function(e){return!!(e&&e>=s&&e<c)}(n.any(e,a.qu("date")))},f=function(e,t){let n=r.store.any(e,a.qu("date")),i=r.store.any(t,a.qu("date"));if(void 0!==n&&void 0!==i){if(n.value<i.value)return-1;if(n.value>i.value)return 1}return e.uri<t.uri?-1:e.uri>t.uri?1:0};o.appendChild(t.createElement("h2")).textContent="Period "+s.value.slice(0,10)+" - "+c.value.slice(0,10);var p,m,v,g,b=function(e,t,n){var r=i.byName(n).render(t,e);return r.setAttribute("style","border: 0.1em solid green;"),r},y=function(e,t,n,r,i){t.expanded?(t.parentNode.removeChild(t.expanded),t.expanded=!1):function(e,t,n,r,i){var a=t.parentNode.children;if(i)for(var o=a.length-1;0<=o;o--)a[o].expanded&&(a[o].parentNode.removeChild(a[o].expanded),a[o].expanded=!1);var s=e.createElement("tr"),u=s.appendChild(e.createElement("td"));u.setAttribute("style","width: 98%; padding: 1em; border: 0.1em solid grey;");var l=t.children.length;t.nextSibling?t.parentNode.insertBefore(s,t.nextSibling):t.parentNode.appendChild(s),t.expanded=s,u.setAttribute("colspan",""+l),u.appendChild(b(e,n,r))}(e,t,n,r,i)},w=function(e,t){var i=e.createElement("table");i.setAttribute("style","margin-left: 100; font-size: 9pt; width: 85%;");var o=function(e,t){var i=e.createElement("tr"),o=n.any(t,a.qu("toAccount"));!function(e,t){var i="margin-left: 8em; padding-left: 5em;";if(t){var a=n.any(t,r.ns.ui("backgroundColor"));a&&(i+="background-color: "+a.value+"; ")}e.setAttribute("style",i)}(i,o);var s=i.appendChild(e.createElement("td")),u=n.any(t,a.qu("date"));s.textContent=u?u.value.slice(0,10):"???",s.setAttribute("style","width: 7em;");var l=i.appendChild(e.createElement("td"));l.setAttribute("style","width: 36em;");var c=n.any(t,a.qu("payee"));l.textContent=c?c.value:"???";var d=l.appendChild(e.createElement("a"));d.textContent=" ➜",d.setAttribute("href",t.uri);var h=i.appendChild(e.createElement("td")),f=n.any(t,a.qu("in_USD"));return h.textContent=f?function(e){var t=""+e;return 0<=t.indexOf(".")?t.split(".")[0]+"."+(t.split(".")[1]+"00").slice(0,2):t+".00"}(f.value):"???",h.setAttribute("style","width: 6em; text-align: right; "),i.addEventListener("click",function(n){y(e,i,t,"transaction",!n.shiftKey)},!1),i},s=t.filter(h);s.sort(f);for(var u=0;u<s.length;u++)i.appendChild(o(e,s[u]));return i},_={"http://www.w3.org/2000/10/swap/pim/qif#Transaction":!0,"http://www.w3.org/2000/10/swap/pim/qif#Unclassified":!0,"http://www.w3.org/2000/10/swap/pim/qif#UnclassifiedOutgoing":!0,"http://www.w3.org/2000/10/swap/pim/qif#UnclassifiedIncome":!0},x=n.findMemberURIs(a.qu("Transaction")),M=[],k=[];for(var C in x)if(x.hasOwnProperty(C)){m=n.sym(C);let e=n.each(m,a.rdf("type"));var E=!1;for(let t,n=0;n<e.length;n++)void 0===_[(t=e[n]).uri]&&(E=!0);E||(void 0===(p=n.any(m,a.qu("in_USD")))&&(p=n.any(m,a.qu("amount"))),p&&0<=(""+p.value).indexOf("-")?k.push(n.sym(C)):M.push(n.sym(C)))}M.length?(g=(v=w(t,M)).children.length,o.appendChild(t.createElement("h3")).textContent="Unclassified Income"+(4>g?"":" ("+g+")"),o.appendChild(v)):u("No unclassified income"),k.length?(g=(v=w(t,k)).children.length,o.appendChild(t.createElement("h3")).textContent="Unclassified Outgoings"+(4>g?"":" ("+g+")"),o.appendChild(v)):u("No unclassified outgoings ");var A=function(e,i){var s,u=function(e){var t=n.findSubClassesNT(a.qu("Transaction"));for(var r in t)if(t.hasOwnProperty(r)&&r.slice(1,-1).split("#")[1]===e)return n.sym(r.slice(1,-1));return null}(e),c=[],d=0;if(!u)return l("Error: No category correspnding to "+e),null;for(var h=n.each(void 0,a.rdf("type"),u),f=0;f<h.length;f++)n.any(h[f],i)||c.push(h[f]);return c.length&&(d=(s=w(t,c)).children.length,o.appendChild(t.createElement("h3")).textContent=r.utils.label(u)+" with no "+r.utils.label(i)+(4>d?"":" ("+d+")"),o.appendChild(s)),d};0===A("Reimbursables",a.trip("trip"))&&u("Reimbursables all have trips"),0===A("Other_Inc_Speaking",a.trip("trip"))&&u("Speaking income all has trips")};if(n.findTypeURIs(e)["http://www.w3.org/2000/10/swap/pim/qif#Period"]){let t=n.each(e,a.rdfs("seeAlso"));console.log("Loading before render: "+t.length),n.fetcher.load(t).then(function(e){c()})}return o}}},function(e,t,n){var r=n(0),i=n(4);const a=r.ns;e.exports={icon:r.icons.iconBase+"noun_106746.svg",name:"transaction",label:function(e){var t=r.store,n=t.findTypeURIs(e);return n["http://www.w3.org/2000/10/swap/pim/qif#Transaction"]?"$$":t.any(e,r.ns.qu("amount"))?"$$$":n["http://www.w3.org/ns/pim/trip#Trip"]?"Trip $":null},render:function(e,t){var n=r.store,o=n.fetcher,s=$rdf.Namespace("http://www.w3.org/2000/10/swap/pim/qif#"),u=$rdf.Namespace("http://www.w3.org/ns/pim/trip#"),l=t.createElement("div");l.setAttribute("class","transactionPane");var c=function(e){return function(e,n){void 0===n&&(n="color: grey");var r=t.createElement("pre");r.setAttribute("style",n),l.appendChild(r),r.appendChild(t.createTextNode(e))}(e,"color: #100; background-color: #fee")},d=n.statementsMatching(e),h=n.statementsMatching(void 0,void 0,e),f=n.findTypeURIs(e),p={},m=function(e){p[e.uri]=!0},v=function(e){if(void 0===e)return"";var t=""+e;return 0<=t.indexOf(".")?t.split(".")[0]+"."+(t.split(".")[1]+"00").slice(0,2):t+".00"},g=function(e,n){var r=t.createElement("td");return 0===0+e&&n||(r.textContent=v(e)),r.setAttribute("style","width: 6em; text-align: right; "),r},b=function(e){var n=t.createElement("th");return n.textContent=e,n.setAttribute("style","text-align: right; "),n},y=function(e,t){let n=r.store.any(e,a.qu("date")),i=r.store.any(t,a.qu("date"));if(void 0!==n&&void 0!==i){if(n.value<i.value)return-1;if(n.value>i.value)return 1}return e.uri<t.uri?-1:e.uri>t.uri?1:0},w=function(e,t,n){var r=i.byName(n).render(t,e);return r.setAttribute("style","border: 0.1em solid green;"),r},_=function(e,t,n,r,i){t.expanded?(t.parentNode.removeChild(t.expanded),t.expanded=!1):function(e,t,n,r,i){var a=t.parentNode.children;if(i)for(var o=a.length-1;0<=o;o--)a[o].expanded&&(a[o].parentNode.removeChild(a[o].expanded),a[o].expanded=!1);var s=e.createElement("tr"),u=s.appendChild(e.createElement("td"));u.setAttribute("style","width: 98%; padding: 1em; border: 0.1em solid grey;");var l=t.children.length;t.nextSibling?t.parentNode.insertBefore(s,t.nextSibling):t.parentNode.appendChild(s),t.expanded=s,u.setAttribute("colspan",""+l),u.appendChild(w(e,n,r))}(e,t,n,r,i)},x=function(e,t,i){var o=e.createElement("table");o.setAttribute("style","padding-left: 0.5em; padding-right: 0.5em; font-size: 9pt; width: 85%;");var s=function(e,t){var i=e.createElement("tr"),o=n.any(t,a.qu("toAccount"));!function(e,t){var i="'padding-left: 0.5em; padding-right: 0.5em; padding-top: 0.1em;";if(t){var a=n.any(t,r.ns.ui("backgroundColor"));a&&(i+="background-color: "+a.value+"; ")}e.setAttribute("style",i)}(i,o);var s=i.appendChild(e.createElement("td")),u=n.any(t,a.qu("date"));s.textContent=u?u.value.slice(0,10):"???",s.setAttribute("style","width: 7em;");var l=i.appendChild(e.createElement("td"));l.setAttribute("style","width: 36em;");var c=n.any(t,a.qu("payee"));l.textContent=c?c.value:"???";var d=l.appendChild(e.createElement("a"));d.textContent=" ➜",d.setAttribute("href",t.uri);var h=i.appendChild(e.createElement("td")),f=n.any(t,a.qu("in_USD"));return h.textContent=f?v(f.value):"???",h.setAttribute("style","width: 6em; text-align: right; "),i.addEventListener("click",function(n){_(e,i,t,"transaction",!n.shiftKey)},!1),i},u=i?t.filter(i):t.slice();u.sort(y);for(var l=0;l<u.length;l++)o.appendChild(s(e,u[l]));return o};if(f["http://www.w3.org/2000/10/swap/pim/qif#Transaction"]||n.any(e,a.qu("toAccount"))){m(a.rdf("type"));var M=n.any(e,r.ns.qu("toAccount"));(function(e){var t="padding: 0.5em 1.5em 1em 1.5em; ";if(e){var i=n.any(e,r.ns.ui("backgroundColor"));i&&(t+="background-color: "+i.value+"; ")}l.setAttribute("style",t)})(M),M||c("(Error: There is no bank account known for this transaction <"+e.uri+">,\n -- every transaction needs one.)");var k=null,C=n.any(e,r.ns.qu("accordingTo"));void 0===C?c("(Error: There is no back link to the original data source foir this transaction <"+e.uri+">,\nso I can't tell how to annotate it.)"):void 0===(k=void 0===C?null:n.any(C,r.ns.qu("annotationStore")))&&c("(There is no annotation document for this statement\n<"+C.uri+">,\nso you cannot classify this transaction.)");var E=t.createElement("div");E.setAttribute("style","float:right"),l.appendChild(E);var A=function(i,a){m(i);var o=n.any(e,i);if(o){var s=t.createElement("a");s.setAttribute("href",o.uri),s.setAttribute("style","float:right"),E.appendChild(s).textContent=a||r.utils.label(o),E.appendChild(t.createElement("br"))}};A(r.ns.qu("toAccount")),A(r.ns.qu("accordingTo"),"Statement"),A(u("trip"));var T=t.createElement("table");l.appendChild(T);var S=["date","payee","amount","in_USD","currency"].map(s).map(function(t){m(t);var i=n.any(e,t),a=i?r.utils.labelForXML(i):"";return'<tr><td style="text-align: right; padding-right: 0.6em">'+r.utils.labelForXML(t)+'</td><td style="font-weight: bold;">'+a+"</td></tr>"}).join("\n");T.innerHTML=S;var I=function(e,t){e||c("Sorry, failed to save your change:\n"+t)};k&&n.fetcher.nowOrWhenFetched(k.uri,e,function(s,f){s||c("Cannot load store "+k+" "+f);var v=n.any(k,a.qu("calendarYear")),g=function(){l.insertBefore(r.widgets.makeSelectForNestedCategory(t,n,e,r.ns.qu("Classified"),k,I),T.nextSibling)};n.any(void 0,a.rdfs("subClassOf"),a.qu.Classified)?g():v?o.load(v).then(function(e){o.load(n.each(v,a.rdfs("seeAlso"))).then(function(){g()}).catch(function(e){console.log("Error loading background data: "+e)})}).catch(function(e){console.log("Error loading calendarYear: "+e)}):console.log("Can't get categories, because no calendarYear"),l.appendChild(r.widgets.makeDescription(t,n,e,r.ns.rdfs("comment"),k,I));var b=n.statementsMatching(void 0,u("trip"),void 0,k).map(function(e){return e.object}),y=n.each(void 0,r.ns.rdf("type"),u("Trip"));b=b.concat(y).sort();1<(b=function(e,t,n,r){let i=t.map(function(t){var r=e.any(t,n);return[r=r?r.value:"9999-12-31",t]});return i.sort(),r&&i.reverse(),i.map(function(e){return e[1]})}(n,b,r.ns.cal("dtstart"),!0)).length&&l.appendChild(r.widgets.makeSelectForOptions(t,n,e,u("trip"),b,{multiple:!1,nullLabel:"-- what trip? --",mint:"New Trip *",mintClass:u("Trip"),mintStatementsFun:function(e){return[$rdf.st(e,r.ns.rdf("type"),u("Trip"),e.doc())]}},k,I)),l.appendChild(t.createElement("br"));var w=i.getOutliner(t);m(a.rdfs("comment")),r.widgets.attachmentList(t,e,l),m(a.wf("attachment")),l.appendChild(t.createElement("tr")).setAttribute("style","height: 1em"),w.appendPropertyTRs(l,d,!1,function(e,t){return!(e.uri in p)}),w.appendPropertyTRs(l,h,!0,function(e,t){return!(e.uri in p)})})}else if(f["http://www.w3.org/ns/pim/trip#Trip"]){!function(){var i={},o={},s={},d=n.each(void 0,u("trip"),e),h=d.map(function(e){return e.doc()});n.fetcher.load(h).then(function(){d.map(function(e){var t=n.the(e,a.qu("date")),u=t?(""+t.value).slice(0,4):"????",l=n.the(e,a.rdf("type"));if(l||(l=r.ns.qu("ErrorNoType")),l&&l.uri){var d=l.uri;o[u]||(o[u]=0),s[u]||(s[u]={}),i[d]||(i[d]=0),s[u][d]||(s[u][d]=0);var h=n.any(e,r.ns.qu("in_USD"));if(h||c("@@ No amount in USD: "+h+" for "+e),h){var f=parseFloat(h.value);i[d]+=f,s[u][d]+=f,o[u]+=f}}});var u,h=[],f=0,p=[];for(var m in s)s.hasOwnProperty(m)&&p.push(m);p.sort();var y=p.length,w=l.appendChild(t.createElement("table"));if(w.setAttribute("style","font-size: 120%; margin-left:auto; margin-right:1em; margin-top: 1em; border: 0.05em solid gray; padding: 1em;"),1<y){var _=w.appendChild(t.createElement("tr"));for(_.appendChild(b("")),u=0;u<y;u++)_.appendChild(b(p[u]));_.appendChild(b("total"))}for(var M in i)i.hasOwnProperty(M)&&(h.push(M),f+=i[M]);h.sort();for(var k,C,E,A=0;A<h.length;A++){if(E=n.sym(h[A]),(k=w.appendChild(t.createElement("tr"))).appendChild(t.createElement("td")).textContent=r.utils.label(E),1<y)for(u=0;u<y;u++)C=s[p[u]][h[A]],k.appendChild(g(C,!0));k.appendChild(g(i[h[A]],!0))}if(1<h.length){if((k=w.appendChild(t.createElement("tr"))).appendChild(b("total")),1<y)for(u=0;u<y;u++)C=o[p[u]],k.appendChild(g(C?v(C):""));k.appendChild(g(f)).setAttribute("style","font-weight: bold; text-align: right;")}var T=x(t,d);T.setAttribute("style","margin-left:auto; margin-right:1em; margin-top: 1em; border: padding: 1em;"),l.appendChild(T),r.widgets.attachmentList(t,e,l)}).catch(function(e){c("Error loading transactions: "+e)})}()}return l}}},function(e,t,n){var r=n(0),i=r.ns;e.exports={icon:r.icons.iconBase+"noun_79217.svg",name:"pad",label:function(e){return r.store.findTypeURIs(e)["http://www.w3.org/ns/pim/pad#Notepad"]?"pad":null},mintClass:i.pad("Notepad"),mintNew:function(e){var t=r.store,n=r.ns,i=t.updater;if(e.me&&!e.me.uri)throw new Error("notepad mintNew: Invalid userid");var a=e.newInstance=e.newInstance||t.sym(e.newBase+"index.ttl#this"),o=a.doc();t.add(a,n.rdf("type"),n.pad("Notepad"),o),t.add(a,n.dc("title"),"Shared Notes",o),t.add(a,n.dc("created"),new Date,o),e.me&&t.add(a,n.dc("author"),e.me,o);var s=t.sym(a.uri+"_line0");return t.add(a,n.pad("next"),s,o),t.add(s,n.pad("next"),a,o),t.add(s,n.dc("author"),e.me,o),t.add(s,n.sioc("content"),"",o),new Promise(function(n,r){i.put(o,t.statementsMatching(void 0,void 0,void 0,o),"text/turtle",function(t,i,a){i?n(e):r(new Error("FAILED to save new tool at: "+t+" : "+a))})})},render:function(e,t,n){var i,a,o=function(e,n){e||M.appendChild(r.widgets.errorMessageBlock(t,n,"pink"))},s=function(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e},u=function(e,t,n){var a=$rdf.graph(),o=$rdf.Namespace("http://www.w3.org/ns/auth/acl#"),s=a.sym(t+"#a1"),u=a.sym(t),l=a.sym(e);return a.add(s,r.ns.rdf("type"),o("Authorization"),u),a.add(s,o("accessTo"),l,u),a.add(s,o("agent"),i,u),a.add(s,o("mode"),o("Read"),u),a.add(s,o("mode"),o("Write"),u),a.add(s,o("mode"),o("Control"),u),s=a.sym(t+"#a2"),a.add(s,r.ns.rdf("type"),o("Authorization"),u),a.add(s,o("accessTo"),l,u),a.add(s,o("agentClass"),y.foaf("Agent"),u),a.add(s,o("mode"),o("Read"),u),n&&a.add(s,o("mode"),o("Write"),u),$rdf.serialize(u,a,t,"text/turtle")},l=function(e,t,n){var r=v.any(v.sym(e),v.sym("http://www.iana.org/assignments/link-relations/acl"));if(r){var i=u(e,r.uri,t);return g.webOperation("PUT",r.uri,{data:i,contentType:"text/turtle"}).then(e=>n(!0)).catch(e=>{n(!1,e.message)})}return g.load(e).catch(e=>{n(!1,"Getting headers for ACL: "+e)}).then(()=>{var n=v.any(v.sym(e),v.sym("http://www.iana.org/assignments/link-relations/acl"));if(!n)throw new Error("No Link rel=ACL header for "+e);var r=u(e,n.uri,t);return g.webOperation("PUT",n.uri,{data:r,contentType:"text/turtle"})}).then(e=>n(!0)).catch(e=>{n(!1,e.message)})},c=function(){var n=M.appendChild(t.createElement("button"));return n.textContent="Start another pad",n.addEventListener("click",function(){return d(e,j,"pad")}),n},d=function(e,n,i){var a=s(n);a.appendChild(r.authn.newAppInstance(t,{noun:"notepad"},h)),a.appendChild(t.createElement("hr")),a.appendChild(t.createElement("p")).textContent="Where would you like to store the data for the "+i+"? Give the URL of the directory where you would like the data stored.";var o=a.appendChild(t.createElement("input"));o.setAttribute("type","text"),o.size=80,o.label="base URL",o.autocomplete="on",a.appendChild(t.createElement("br"));var u=a.appendChild(t.createElement("button"));u.textContent="Start new "+i+" at this URI",u.addEventListener("click",function(t){var n=o.value;"/"!==n.slice(-1)&&(n+="/"),f(e,n)})},h=function(e){var t=v.any(e,y.space("uriPrefix"));"/"!==(t=t?t.value:e.uri.split("#")[0]).slice(-1)&&($rdf.log.error(m+": No / at end of uriPrefix "+t),t+="/");var n=new Date;t+=m+"/id"+n.getTime()+"/",f(_,t)},f=function(e,n){var a=$rdf.sym(e.uri.split("#")[0]),s=r.store,u=s.sym(n+"pad.ttl"),c=s.sym(n+"index.html"),d=[{local:"index.html",contentType:"text/html"}];let h=s.sym(u.uri+"#thisPad");var f,p=[];for(f=0;f<d.length;f++){!function(e){p.push(function(){var t=n+e.local;console.log("Copying "+a+e.local+" to "+t);var u=function(){l(t,!1,function(e,n){e?p.shift()():(o(e,"FAILED to set ACL "+t+" : "+n),console.log("FAILED to set ACL "+t+" : "+n))})};s.fetcher.webCopy(a+e.local,n+e.local,e.contentType).then(()=>r.authn.checkUser()).then(e=>{i=e,u()}).catch(t=>{console.log("FAILED to copy "+a+e.local+" : "+t.message),o(!1,"FAILED to copy "+a+e.local+" : "+t.message)})})}(d[f])}p.push(function(){s.add(h,y.rdf("type"),w("Notepad"),u),s.add(h,y.dc("created"),new Date,u),i&&s.add(h,y.dc("author"),i,u),s.add(h,w("next"),h,u),s.add(h,r.ns.space("inspiration"),e,x),s.add(h,r.ns.space("inspiration"),e,u),b.put(u,s.statementsMatching(void 0,void 0,void 0,u),"text/turtle",function(e,t,n){t?p.shift()():(o(t,"FAILED to save new notepad at: "+u.uri+" : "+n),console.log("FAILED to save new notepad at: "+u.uri+" : "+n))})}),p.push(function(){l(u.uri,!0,function(e,t){o(e,"Failed to set Read-Write ACL on pad data file: "+t),e&&p.shift()()})}),p.push(function(){var e=M.appendChild(t.createElement("p"));e.setAttribute("style","font-size: 140%;"),e.innerHTML="Your <a href='"+c.uri+"'><b>new notepad</b></a> is ready. <br/><br/><a href='"+c.uri+"'>Go to new pad</a>"}),p.shift()()},p=function(o){console.log("showResults()"),i=r.authn.currentUser(),r.authn.checkUser().then(e=>{i=e});var s=v.any(e,y.dc("title"))||v.any(e,y.vcard("fn"));n.solo&&"undefined"!=typeof window&&s&&(window.document.title=s.value),R.exists=o,a=r.pad.notepad(t,x,e,i,R),E.appendChild(a);var u=v.any(e,y.meeting("parentMeeting"))||e;r.pad.manageParticipation(t,S,x,u,i,R),r.store.updater.setRefreshHandler(x,a.reloadAndSync)},m="app-pad.timbl.com",v=r.store,g=r.store.fetcher,b=r.store.updater,y=r.ns,w=$rdf.Namespace("http://www.w3.org/ns/pim/pad#"),_=e,x=e.doc(),M=t.createElement("div"),k=M.appendChild(t.createElement("table"));k.setAttribute("style","background-color: white; min-width: 94%; margin-right:3% margin-left: 3%; min-height: 13em;");var C=k.appendChild(t.createElement("tr"));C.appendChild(t.createElement("td")),C.appendChild(t.createElement("td")),C.appendChild(t.createElement("td"));var E=k.appendChild(t.createElement("tr")).appendChild(t.createElement("td"));E.setAttribute("colspan","3");var A=k.appendChild(t.createElement("tr")),T=A.appendChild(t.createElement("td")),S=A.appendChild(t.createElement("td")),I=A.appendChild(t.createElement("td")),N=k.appendChild(t.createElement("tr")).appendChild(t.createElement("div")),j=k.appendChild(t.createElement("tr")).appendChild(t.createElement("div")),O=k.appendChild(t.createElement("tr"));O.setAttribute("class","naviMenu"),O.appendChild(t.createElement("td")),O.appendChild(t.createElement("td")),O.appendChild(t.createElement("td"));var R={statusArea:N,timingArea:T};return g.nowOrWhenFetched(x.uri,void 0,function(t,n,r){t?(s(E),v.holds(e,y.rdf("type"),y.wf("TemplateInstance"))&&d(e,E,"pad"),p(!0),I.appendChild(c())):404===r.status?(console.log("Initializing results file "+x),b.put(x,[],"text/turtle",function(e,t,n){t?(s(E),p(!1)):(o(t,"FAILED to create results file at: "+x.uri+" : "+n),console.log("FAILED to craete results file at: "+x.uri+" : "+n))})):o(t,"FAILED to read results file: "+n)}),M}}},function(e,t){e.exports='\n@prefix : <http://www.w3.org/2006/vcard/ns#> .\n@prefix owl: <http://www.w3.org/2002/07/owl#> .\n@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix xml: <http://www.w3.org/XML/1998/namespace> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\n:Acquaintance a owl:Class ;\n rdfs:label "Acquaintance"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Agent a owl:Class ;\n rdfs:label "Agent"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:BBS a owl:Class ;\n rdfs:label "BBS"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType ;\n owl:deprecated true .\n\n:Car a owl:Class ;\n rdfs:label "Car"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType ;\n owl:deprecated true .\n\n:Cell a owl:Class ;\n rdfs:label "Cell"@en ;\n rdfs:comment "Also called mobile telephone"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType .\n\n:Child a owl:Class ;\n rdfs:label "Child"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Colleague a owl:Class ;\n rdfs:label "Colleague"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Contact a owl:Class ;\n rdfs:label "Contact"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Coresident a owl:Class ;\n rdfs:label "Coresident"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Coworker a owl:Class ;\n rdfs:label "Coworker"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Crush a owl:Class ;\n rdfs:label "Crush"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Date a owl:Class ;\n rdfs:label "Date"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Dom a owl:Class ;\n rdfs:label "Dom"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Emergency a owl:Class ;\n rdfs:label "Emergency"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Fax a owl:Class ;\n rdfs:label "Fax"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType .\n\n:Female a owl:Class ;\n rdfs:label "Female"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Gender .\n\n:Friend a owl:Class ;\n rdfs:label "Friend"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Home a owl:Class ;\n rdfs:label "Home"@en ;\n rdfs:comment "This implies that the property is related to an individual\'s personal life"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type .\n\n:ISDN a owl:Class ;\n rdfs:label "ISDN"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Internet a owl:Class ;\n rdfs:label "Internet"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Intl a owl:Class ;\n rdfs:label "Intl"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Kin a owl:Class ;\n rdfs:label "Kin"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Label a owl:Class ;\n rdfs:label "Label"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Male a owl:Class ;\n rdfs:label "Male"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Gender .\n\n:Me a owl:Class ;\n rdfs:label "Me"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Met a owl:Class ;\n rdfs:label "Met"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Modem a owl:Class ;\n rdfs:label "Modem"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType ;\n owl:deprecated true .\n\n:Msg a owl:Class ;\n rdfs:label "Msg"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType ;\n owl:deprecated true .\n\n:Muse a owl:Class ;\n rdfs:label "Muse"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Neighbor a owl:Class ;\n rdfs:label "Neighbor"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:None a owl:Class ;\n rdfs:label "None"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Gender .\n\n:Other a owl:Class ;\n rdfs:label "Other"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Gender .\n\n:PCS a owl:Class ;\n rdfs:label "PCS"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType ;\n owl:deprecated true .\n\n:Pager a owl:Class ;\n rdfs:label "Pager"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType .\n\n:Parcel a owl:Class ;\n rdfs:label "Parcel"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Parent a owl:Class ;\n rdfs:label "Parent"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Postal a owl:Class ;\n rdfs:label "Postal"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Pref a owl:Class ;\n rdfs:label "Pref"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:Sibling a owl:Class ;\n rdfs:label "Sibling"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Spouse a owl:Class ;\n rdfs:label "Spouse"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Sweetheart a owl:Class ;\n rdfs:label "Sweetheart"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :RelatedType .\n\n:Tel a owl:Class ;\n rdfs:label "Tel"@en ;\n rdfs:comment "This class is deprecated. Use the hasTelephone object property."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:Text a owl:Class ;\n rdfs:label "Text"@en ;\n rdfs:comment "Also called sms telephone"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType .\n\n:TextPhone a owl:Class ;\n rdfs:label "Text phone"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType .\n\n:Unknown a owl:Class ;\n rdfs:label "Unknown"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Gender .\n\n:Video a owl:Class ;\n rdfs:label "Video"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType .\n\n:Voice a owl:Class ;\n rdfs:label "Voice"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :TelephoneType .\n\n:Work a owl:Class ;\n rdfs:label "Work"@en ;\n rdfs:comment "This implies that the property is related to an individual\'s work place"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type .\n\n:X400 a owl:Class ;\n rdfs:label "X400"@en ;\n rdfs:comment "This class is deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Type ;\n owl:deprecated true .\n\n:adr a owl:ObjectProperty ;\n rdfs:label "address"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasAddress .\n\n:agent a owl:ObjectProperty ;\n rdfs:label "agent"@en ;\n rdfs:comment "This object property has been deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:anniversary a owl:DatatypeProperty ;\n rdfs:label "anniversary"@en ;\n rdfs:comment "The date of marriage, or equivalent, of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range [ a rdfs:Datatype ;\n owl:unionOf ( xsd:dateTime xsd:gYear ) ] .\n\n:bday a owl:DatatypeProperty ;\n rdfs:label "birth date"@en ;\n rdfs:comment "To specify the birth date of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range [ a rdfs:Datatype ;\n owl:unionOf ( xsd:dateTime xsd:dateTimeStamp xsd:gYear ) ] .\n\n:category a owl:DatatypeProperty ;\n rdfs:label "category"@en ;\n rdfs:comment "The category information about the object, also known as tags"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:class a owl:DatatypeProperty ;\n rdfs:label "class"@en ;\n rdfs:comment "This data property has been deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:email a owl:ObjectProperty ;\n rdfs:label "email"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasEmail .\n\n:extended-address a owl:DatatypeProperty ;\n rdfs:label "extended address"@en ;\n rdfs:comment "This data property has been deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:geo a owl:ObjectProperty ;\n rdfs:label "geo"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasGeo .\n\n:hasAdditionalName a owl:ObjectProperty ;\n rdfs:label "has additional name"@en ;\n rdfs:comment "Used to support property parameters for the additional name data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasCalendarBusy a owl:ObjectProperty ;\n rdfs:label "has calendar busy"@en ;\n rdfs:comment "To specify the busy time associated with the object. (Was called FBURL in RFC6350)"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasCalendarLink a owl:ObjectProperty ;\n rdfs:label "has calendar link"@en ;\n rdfs:comment "To specify the calendar associated with the object. (Was called CALURI in RFC6350)"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasCalendarRequest a owl:ObjectProperty ;\n rdfs:label "has calendar request"@en ;\n rdfs:comment "To specify the calendar user address to which a scheduling request be sent for the object. (Was called CALADRURI in RFC6350)"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasCategory a owl:ObjectProperty ;\n rdfs:label "has category"@en ;\n rdfs:comment "Used to support property parameters for the category data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasCountryName a owl:ObjectProperty ;\n rdfs:label "has country name"@en ;\n rdfs:comment "Used to support property parameters for the country name data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasFN a owl:ObjectProperty ;\n rdfs:label "has formatted name"@en ;\n rdfs:comment "Used to support property parameters for the formatted name data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasFamilyName a owl:ObjectProperty ;\n rdfs:label "has family name"@en ;\n rdfs:comment "Used to support property parameters for the family name data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasGender a owl:ObjectProperty ;\n rdfs:label "has gender"@en ;\n rdfs:comment "To specify the sex or gender identity of the object. URIs are recommended to enable interoperable sex and gender codes to be used."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasGivenName a owl:ObjectProperty ;\n rdfs:label "has given name"@en ;\n rdfs:comment "Used to support property parameters for the given name data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasHonorificPrefix a owl:ObjectProperty ;\n rdfs:label "has honorific prefix"@en ;\n rdfs:comment "Used to support property parameters for the honorific prefix data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasHonorificSuffix a owl:ObjectProperty ;\n rdfs:label "has honorific suffix"@en ;\n rdfs:comment "Used to support property parameters for the honorific suffix data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasInstantMessage a owl:ObjectProperty ;\n rdfs:label "has messaging"@en ;\n rdfs:comment "To specify the instant messaging and presence protocol communications with the object. (Was called IMPP in RFC6350)"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasLanguage a owl:ObjectProperty ;\n rdfs:label "has language"@en ;\n rdfs:comment "Used to support property parameters for the language data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasLocality a owl:ObjectProperty ;\n rdfs:label "has locality"@en ;\n rdfs:comment "Used to support property parameters for the locality data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasNickname a owl:ObjectProperty ;\n rdfs:label "has nickname"@en ;\n rdfs:comment "Used to support property parameters for the nickname data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:seeAlso :nickname .\n\n:hasNote a owl:ObjectProperty ;\n rdfs:label "has note"@en ;\n rdfs:comment "Used to support property parameters for the note data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasOrganizationName a owl:ObjectProperty ;\n rdfs:label "has organization name"@en ;\n rdfs:comment "Used to support property parameters for the organization name data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasOrganizationUnit a owl:ObjectProperty ;\n rdfs:label "has organization unit name"@en ;\n rdfs:comment "Used to support property parameters for the organization unit name data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasPostalCode a owl:ObjectProperty ;\n rdfs:label "has postal code"@en ;\n rdfs:comment "Used to support property parameters for the postal code data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasRegion a owl:ObjectProperty ;\n rdfs:label "has region"@en ;\n rdfs:comment "Used to support property parameters for the region data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasRelated a owl:ObjectProperty ;\n rdfs:label "has related"@en ;\n rdfs:comment "To specify a relationship between another entity and the entity represented by this object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasRole a owl:ObjectProperty ;\n rdfs:label "has role"@en ;\n rdfs:comment "Used to support property parameters for the role data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasSource a owl:ObjectProperty ;\n rdfs:label "has source"@en ;\n rdfs:comment "To identify the source of directory information of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasStreetAddress a owl:ObjectProperty ;\n rdfs:label "has street address"@en ;\n rdfs:comment "Used to support property parameters for the street address data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasTitle a owl:ObjectProperty ;\n rdfs:label "has title"@en ;\n rdfs:comment "Used to support property parameters for the title data property"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasUID a owl:ObjectProperty ;\n rdfs:label "has uid"@en ;\n rdfs:comment "To specify a value that represents a globally unique identifier corresponding to the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasValue a owl:ObjectProperty ;\n rdfs:label "has value"@en ;\n rdfs:comment "Used to indicate the resource value of an object property that requires property parameters"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:label a owl:DatatypeProperty ;\n rdfs:label "label"@en ;\n rdfs:comment "This data property has been deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:language a owl:DatatypeProperty ;\n rdfs:label "language"@en ;\n rdfs:comment "To specify the language that may be used for contacting the object. May also be used as a property parameter."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:latitude a owl:DatatypeProperty ;\n rdfs:label "latitude"@en ;\n rdfs:comment "This data property has been deprecated. See hasGeo"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:longitude a owl:DatatypeProperty ;\n rdfs:label "longitude"@en ;\n rdfs:comment "This data property has been deprecated. See hasGeo"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:mailer a owl:DatatypeProperty ;\n rdfs:label "mailer"@en ;\n rdfs:comment "This data property has been deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:note a owl:DatatypeProperty ;\n rdfs:label "note"@en ;\n rdfs:comment "A note associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:org a owl:ObjectProperty ;\n rdfs:label "organization"@en ;\n rdfs:comment "This object property has been mapped. Use the organization-name data property."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :organization-name .\n\n:organization-unit a owl:DatatypeProperty ;\n rdfs:label "organizational unit name"@en ;\n rdfs:comment "To specify the organizational unit name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string ;\n rdfs:subPropertyOf :organization-name .\n\n:post-office-box a owl:DatatypeProperty ;\n rdfs:label "post office box"@en ;\n rdfs:comment "This data property has been deprecated"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:prodid a owl:DatatypeProperty ;\n rdfs:label "product id"@en ;\n rdfs:comment "To specify the identifier for the product that created the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:rev a owl:DatatypeProperty ;\n rdfs:label "revision"@en ;\n rdfs:comment "To specify revision information about the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:dateTime .\n\n:role a owl:DatatypeProperty ;\n rdfs:label "role"@en ;\n rdfs:comment "To specify the function or part played in a particular situation by the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:sort-string a owl:DatatypeProperty ;\n rdfs:label "sort as"@en ;\n rdfs:comment "To specify the string to be used for national-language-specific sorting. Used as a property parameter only."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:title a owl:DatatypeProperty ;\n rdfs:label "title"@en ;\n rdfs:comment "To specify the position or job of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:tz a owl:DatatypeProperty ;\n rdfs:label "time zone"@en ;\n rdfs:comment "To indicate time zone information that is specific to the object. May also be used as a property parameter."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:value a owl:DatatypeProperty ;\n rdfs:label "value"@en ;\n rdfs:comment "Used to indicate the literal value of a data property that requires property parameters"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:Address a owl:Class ;\n rdfs:label "Address"@en ;\n rdfs:comment "To specify the components of the delivery address for the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentClass [ a owl:Class ;\n owl:unionOf ( [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :country-name ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:maxCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onProperty :country-name ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :locality ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:maxCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onProperty :locality ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :postal-code ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:maxCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onProperty :postal-code ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :region ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:maxCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onProperty :region ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :street-address ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:maxCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onProperty :street-address ] ) ] ) ] .\n\n:Email a owl:Class ;\n rdfs:label "Email"@en ;\n rdfs:comment "To specify the electronic mail address for communication with the object the vCard represents. Use the hasEmail object property."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:deprecated true .\n\n:Group a owl:Class ;\n rdfs:label "Group"@en ;\n rdfs:comment "Object representing a group of persons or entities. A group object will usually contain hasMember properties to specify the members of the group."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Kind ;\n owl:disjointWith :Individual,\n :Location,\n :Organization ;\n owl:equivalentClass [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :hasMember ;\n owl:someValuesFrom :Kind ] [ a owl:Restriction ;\n owl:minQualifiedCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onClass :Kind ;\n owl:onProperty :hasMember ] ) ] .\n\n:Individual a owl:Class ;\n rdfs:label "Individual"@en ;\n rdfs:comment "An object representing a single person or entity"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Kind ;\n owl:disjointWith :Location,\n :Organization .\n\n:Name a owl:Class ;\n rdfs:label "Name"@en ;\n rdfs:comment "To specify the components of the name of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentClass [ a owl:Class ;\n owl:unionOf ( [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :additional-name ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:minCardinality "0"^^xsd:nonNegativeInteger ;\n owl:onProperty :additional-name ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :family-name ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:maxCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onProperty :family-name ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :given-name ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:maxCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onProperty :given-name ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :honorific-prefix ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:minCardinality "0"^^xsd:nonNegativeInteger ;\n owl:onProperty :honorific-prefix ] ) ] [ a owl:Class ;\n owl:intersectionOf ( [ a owl:Restriction ;\n owl:onProperty :honorific-suffix ;\n owl:someValuesFrom xsd:string ] [ a owl:Restriction ;\n owl:minCardinality "0"^^xsd:nonNegativeInteger ;\n owl:onProperty :honorific-suffix ] ) ] ) ] .\n\n:VCard a owl:Class ;\n rdfs:label "VCard"@en ;\n rdfs:comment "The vCard class is equivalent to the new Kind class, which is the parent for the four explicit types of vCards (Individual, Organization, Location, Group)"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentClass :Kind .\n\n:fn a owl:DatatypeProperty ;\n rdfs:label "formatted name"@en ;\n rdfs:comment "The formatted text corresponding to the name of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:hasAddress a owl:ObjectProperty ;\n rdfs:label "has address"@en ;\n rdfs:comment "To specify the components of the delivery address for the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range :Address .\n\n:hasEmail a owl:ObjectProperty ;\n rdfs:label "has email"@en ;\n rdfs:comment "To specify the electronic mail address for communication with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range :Email .\n\n:hasGeo a owl:ObjectProperty ;\n rdfs:label "has geo"@en ;\n rdfs:comment "To specify information related to the global positioning of the object. May also be used as a property parameter."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:hasKey a owl:ObjectProperty ;\n rdfs:label "has key"@en ;\n rdfs:comment "To specify a public key or authentication certificate associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :key .\n\n:hasLogo a owl:ObjectProperty ;\n rdfs:label "has logo"@en ;\n rdfs:comment "To specify a graphic image of a logo associated with the object "@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :logo .\n\n:hasName a owl:ObjectProperty ;\n rdfs:label "has name"@en ;\n rdfs:comment "To specify the components of the name of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range :Name ;\n owl:equivalentProperty :n .\n\n:hasPhoto a owl:ObjectProperty ;\n rdfs:label "has photo"@en ;\n rdfs:comment "To specify an image or photograph information that annotates some aspect of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :photo .\n\n:hasSound a owl:ObjectProperty ;\n rdfs:label "has sound"@en ;\n rdfs:comment "To specify a digital sound content information that annotates some aspect of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :sound .\n\n:hasTelephone a owl:ObjectProperty ;\n rdfs:label "has telephone"@en ;\n rdfs:comment "To specify the telephone number for telephony communication with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :tel .\n\n:hasURL a owl:ObjectProperty ;\n rdfs:label "has url"@en ;\n rdfs:comment "To specify a uniform resource locator associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :url .\n\n:key a owl:ObjectProperty ;\n rdfs:label "key"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasKey .\n\n:logo a owl:ObjectProperty ;\n rdfs:label "logo"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasLogo .\n\n:n a owl:ObjectProperty ;\n rdfs:label "name"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasName .\n\n:nickname a owl:DatatypeProperty ;\n rdfs:label "nickname"@en ;\n rdfs:comment "The nick name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:photo a owl:ObjectProperty ;\n rdfs:label "photo"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasPhoto .\n\n:sound a owl:ObjectProperty ;\n rdfs:label "sound"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasSound .\n\n:tel a owl:ObjectProperty ;\n rdfs:label "telephone"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasTelephone .\n\n:url a owl:ObjectProperty ;\n rdfs:label "url"@en ;\n rdfs:comment "This object property has been mapped"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentProperty :hasURL .\n\n:Location a owl:Class ;\n rdfs:label "Location"@en ;\n rdfs:comment "An object representing a named geographical place"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Kind ;\n owl:disjointWith :Organization .\n\n:additional-name a owl:DatatypeProperty ;\n rdfs:label "additional name"@en ;\n rdfs:comment "The additional name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:country-name a owl:DatatypeProperty ;\n rdfs:label "country name"@en ;\n rdfs:comment "The country name associated with the address of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:family-name a owl:DatatypeProperty ;\n rdfs:label "family name"@en ;\n rdfs:comment "The family name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:given-name a owl:DatatypeProperty ;\n rdfs:label "given name"@en ;\n rdfs:comment "The given name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:hasMember a owl:ObjectProperty ;\n rdfs:label "has member"@en ;\n rdfs:comment "To include a member in the group this object represents. (This property can only be used by Group individuals)"@en ;\n rdfs:domain :Group ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range :Kind .\n\n:honorific-prefix a owl:DatatypeProperty ;\n rdfs:label "honorific prefix"@en ;\n rdfs:comment "The honorific prefix of the name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:honorific-suffix a owl:DatatypeProperty ;\n rdfs:label "honorific suffix"@en ;\n rdfs:comment "The honorific suffix of the name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:locality a owl:DatatypeProperty ;\n rdfs:label "locality"@en ;\n rdfs:comment "The locality (e.g. city or town) associated with the address of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:organization-name a owl:DatatypeProperty ;\n rdfs:label "organization name"@en ;\n rdfs:comment "To specify the organizational name associated with the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:postal-code a owl:DatatypeProperty ;\n rdfs:label "postal code"@en ;\n rdfs:comment "The postal code associated with the address of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:region a owl:DatatypeProperty ;\n rdfs:label "region"@en ;\n rdfs:comment "The region (e.g. state or province) associated with the address of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:street-address a owl:DatatypeProperty ;\n rdfs:label "street address"@en ;\n rdfs:comment "The street address associated with the address of the object"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:range xsd:string .\n\n:Organization a owl:Class ;\n rdfs:label "Organization"@en ;\n rdfs:comment """An object representing an organization. An organization is a single entity, and might represent a business or government, a department or division within a business or government, a club, an association, or the like.\n"""@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n rdfs:subClassOf :Kind .\n\n:Gender a owl:Class ;\n rdfs:label "Gender"@en ;\n rdfs:comment "Used for gender codes. The URI of the gender code must be used as the value for Gender."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:Kind a owl:Class ;\n rdfs:label "Kind"@en ;\n rdfs:comment "The parent class for all objects"@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> ;\n owl:equivalentClass [ a owl:Restriction ;\n owl:minQualifiedCardinality "1"^^xsd:nonNegativeInteger ;\n owl:onDataRange xsd:string ;\n owl:onProperty :fn ],\n :VCard .\n\n:Type a owl:Class ;\n rdfs:label "Type"@en ;\n rdfs:comment "Used for type codes. The URI of the type code must be used as the value for Type."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:TelephoneType a owl:Class ;\n rdfs:label "Phone"@en ;\n rdfs:comment "Used for telephone type codes. The URI of the telephone type code must be used as the value for the Telephone Type."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n:RelatedType a owl:Class ;\n rdfs:label "Relation Type"@en ;\n rdfs:comment "Used for relation type codes. The URI of the relation type code must be used as the value for the Relation Type."@en ;\n rdfs:isDefinedBy <http://www.w3.org/2006/vcard/ns> .\n\n<http://www.w3.org/2006/vcard/ns> a owl:Ontology ;\n rdfs:label "Ontology for vCard"@en ;\n rdfs:comment "Ontology for vCard based on RFC6350"@en ;\n owl:versionInfo "Final"@en .\n\n\n'},function(e,t){e.exports='\n@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix : <#>.\n\n<http://www.w3.org/2006/vcard/ns#Individual>\n ui:creationForm <#form1> .\n\n\n<#form1>\n <http://purl.org/dc/elements/1.1/title> "Contact Details" ;\n a ui:Form ;\n ui:part\n <#fullNameField>, <#roleField>, <#fullNameFieldC>, <#addressesComment>, <#addresses>,\n <#emailComment>, <#eMails>,\n <#telephoneComment>, <#telephones>, <#noteComment>, <#noteField> ;\n ui:parts (\n <#fullNameField> <#roleField> <#fullNameFieldC>\n <#addressesComment> <#addresses>\n <#emailComment> <#eMails>\n <#telephoneComment> <#telephones> <#noteComment> <#noteField> ) .\n\n <#fullNameField>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n ui:label "Name";\n <http://www.w3.org/ns/ui#maxLength> "128" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#fn> ;\n <http://www.w3.org/ns/ui#size> "40" .\n\n <#roleField>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n <http://www.w3.org/ns/ui#maxLength> "128" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#role> ;\n <http://www.w3.org/ns/ui#size> "40" .\n\n <#fullNameFieldC>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n <http://www.w3.org/ns/ui#maxLength> "128" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#organization-name> ;\n <http://www.w3.org/ns/ui#size> "40" .\n\n\n<#addressesComment>\n a <http://www.w3.org/ns/ui#Comment> ;\n <http://www.w3.org/ns/ui#contents> "Address" .\n\n\n<#addresses>\n <http://purl.org/dc/elements/1.1/title> "Address details" ;\n a <http://www.w3.org/ns/ui#Multiple> ;\n <http://www.w3.org/ns/ui#part> <#oneAddress> ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#hasAddress> .\n\n<#oneAddress>\n a <http://www.w3.org/ns/ui#Group> ;\n <http://www.w3.org/ns/ui#parts> ( <#id1409437207443> <#id1409437292400> <#id1409437421996> <#id1409437467649> <#id1409437569420> <#id1409437646712> ).\n\n<#id1409437207443>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n <http://www.w3.org/ns/ui#maxLength> "128" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#street-address> ;\n <http://www.w3.org/ns/ui#size> "40" .\n\n<#id1409437292400>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n <http://www.w3.org/ns/ui#maxLength> "128" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#locality> ;\n <http://www.w3.org/ns/ui#size> "40" .\n\n<#id1409437421996>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n <http://www.w3.org/ns/ui#maxLength> "25" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#postal-code> ;\n <http://www.w3.org/ns/ui#size> "25" .\n\n<#id1409437467649>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n <http://www.w3.org/ns/ui#maxLength> "128" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#region> ;\n <http://www.w3.org/ns/ui#size> "40" .\n\n<#id1409437569420>\n a <http://www.w3.org/ns/ui#SingleLineTextField> ;\n <http://www.w3.org/ns/ui#maxLength> "128" ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#country-name> ;\n <http://www.w3.org/ns/ui#size> "40" .\n\n<#id1409437646712>\n a <http://www.w3.org/ns/ui#Classifier> ;\n <http://www.w3.org/ns/ui#from> rdf:Class ;\n <http://www.w3.org/ns/ui#property> <http://purl.org/dc/terms/type> .\n\n\n##############################\n\n<#emailComment>\n a <http://www.w3.org/ns/ui#Comment> ;\n <http://www.w3.org/ns/ui#contents> "Email" .\n\n\n<#eMails>\n a <http://www.w3.org/ns/ui#Multiple> ;\n <http://www.w3.org/ns/ui#part> <#oneEMail> ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#hasEmail> .\n\n<#oneEMail>\n a <http://www.w3.org/ns/ui#Group> ;\n <http://www.w3.org/ns/ui#part> <#emailValue>, <#emailType> .\n\n<#emailValue>\n a <http://www.w3.org/ns/ui#EmailField> ; ui:label "email";\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#value> ;\n <http://www.w3.org/ns/ui#size> "50" .\n\n<#emailType>\n a <http://www.w3.org/ns/ui#Classifier> ;\n <http://www.w3.org/ns/ui#canMintNew> "0" ;\n <http://www.w3.org/ns/ui#category> <http://www.w3.org/2006/vcard/ns#Type> ;\n <http://www.w3.org/ns/ui#from> <http://www.w3.org/2006/vcard/ns#Type> ;\n <http://www.w3.org/ns/ui#property> <http://purl.org/dc/terms/type> .\n\n##############################\n\n<#telephoneComment>\n a <http://www.w3.org/ns/ui#Comment> ;\n <http://www.w3.org/ns/ui#contents> "Phones" .\n\n\n<#telephones>\n a <http://www.w3.org/ns/ui#Multiple> ;\n <http://www.w3.org/ns/ui#part> <#onetelephone> ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#hasTelephone> .\n\n<#onetelephone>\n a <http://www.w3.org/ns/ui#Group> ;\n <http://www.w3.org/ns/ui#part> <#telephoneValue>, <#telephoneType> .\n\n<#telephoneValue>\n a <http://www.w3.org/ns/ui#PhoneField> ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#value> ;\n <http://www.w3.org/ns/ui#size> "50" .\n\n<#telephoneType>\n a <http://www.w3.org/ns/ui#Classifier> ;\n <http://www.w3.org/ns/ui#canMintNew> "0" ;\n <http://www.w3.org/ns/ui#category> <http://www.w3.org/2006/vcard/ns#Type> ;\n <http://www.w3.org/ns/ui#from> <http://www.w3.org/2006/vcard/ns#Type> ;\n <http://www.w3.org/ns/ui#property> <http://purl.org/dc/terms/type> .\n\n##############################\n\n<#noteComment>\n a <http://www.w3.org/ns/ui#Comment> ;\n <http://www.w3.org/ns/ui#contents> "General Notes" .\n\n<#noteField>\n a <http://www.w3.org/ns/ui#MultiLineTextField> ;\n <http://www.w3.org/ns/ui#property> <http://www.w3.org/2006/vcard/ns#note> .\n'},function(e,t,n){var r=n(0);e.exports={},e.exports.toolsPane=function(e,t,n,i,a,o){function s(e){console.log(e),y.textContent+=e+"\n"}var u=r.store;const l=r.ns,c=l.vcard,d="font-size: 100%; margin: 0.8em; padding:0.5em;";var h=a.createElement("div"),f=h.appendChild(a.createElement("table"));f.setAttribute("style","font-size:120%; margin: 1em; border: 0.1em #ccc ;");var p=f.appendChild(a.createElement("tr"));p.textContent=r.utils.label(i)+" - tools",p.setAttribute("style","min-width: 20em; padding: 1em; font-size: 150%; border-bottom: 0.1em solid red; margin-bottom: 2em;");var m=f.appendChild(a.createElement("tr")).appendChild(a.createElement("div"));m.setAttribute("style","padding: 2em;");var v=f.appendChild(a.createElement("tr")),g=v.appendChild(a.createElement("table"));f.appendChild(a.createElement("tr"));let b={target:i,me:o,noun:"address book",div:h,dom:a,statusRegion:m};g.appendChild(r.aclControl.ACLControlBox5(i.dir(),a,"book",u,function(e,t){e||(g.innerHTML="ACL control box Failed: "+t)})),r.authn.registrationControl(b,i,l.vcard("AddressBook")).then(function(e){console.log("Registration control finished.")}).catch(function(e){r.widgets.complain(b,e)});var y=v.appendChild(a.createElement("pre")),w=h.appendChild(a.createElement("button"));w.textContent="Load main index",w.style.cssText=d,w.addEventListener("click",function(e){w.setAttribute("style","background-color: #ffc;");var t=u.any(i,l.vcard("nameEmailIndex"));r.store.fetcher.nowOrWhenFetched(t,void 0,function(e,t){e?(w.setAttribute("style","background-color: #cfc;"),s(" People index has been loaded\n")):(w.setAttribute("style","background-color: #fcc;"),s("Error: People index has NOT been loaded"+t+"\n"))})});var _=h.appendChild(a.createElement("button"));_.textContent="Statistics",_.style.cssText=d,_.addEventListener("click",function(){s(u.each(void 0,c("inAddressBook"),i).length+" cards loaded. "),s(u.each(i,c("includesGroup")).length+" total groups. ");var e=[];for(let n in t)e.push(n);s(e.length+" selected groups. ")});var x=v.appendChild(a.createElement("button"));x.textContent="Check inidividual card access of selected groups",x.style.cssText=d,x.addEventListener("click",function(e){function n(e){r.widgets.fixIndividualCardACL(e,s,function(t,n){s(t?"Sucess for "+r.utils.label(e):"Failure for "+r.utils.label(e)+": "+n)})}var i=[];for(let e in t)i.push(e);for(var a=0;a<i.length;a++){var o=u.sym(i[a]),c=u.each(o,l.vcard("hasMember"));s(r.utils.label(o)+": "+c.length+" members");for(var d,h=0;h<c.length;h++)d=c[h],s(r.utils.label(d)),n(d)}});var M=v.appendChild(a.createElement("button"));M.textContent="Find duplicate cards",M.style.cssText=d,M.addEventListener("click",function(e){var t={};t.book=i,t.nameEmailIndex=u.any(i,l.vcard("nameEmailIndex")),s("Loading name index..."),r.store.fetcher.nowOrWhenFetched(t.nameEmailIndex,void 0,function(e,n){function r(e){var n;return Promise.resolve().then(()=>{var r=e.uri.replace("/Group/","/NewGroup/");n=u.sym(r);var i=[];for(let n=0;n<t.uniques.length;n++)i=i.concat(u.connectedStatements(t.uniques[n],e.doc()));var a=new $rdf.Serializer(u).setBase(e.uri);s(" Regenerating group of uniques..."+n);var o=a.statementsToN3(i);return u.fetcher.webOperation("PUT",n,{data:o})}).then(()=>(s(" Done uniques group "+n),!0)).catch(e=>{s("Error saving : "+e)})}s("Loaded name index."),t.cards=[],t.duplicates=[],t.definitive=[],t.nameless=[],t.exactDuplicates=[],t.nameOnlyDuplicates=[],t.uniquesSet=[],t.groupProblems=[],t.nameDupLog=u.sym(i.dir().uri+"dedup-nameDupLog.ttl"),t.exactDupLog=u.sym(i.dir().uri+"dedup-exactDupLog.ttl"),t.nameOnlyErrors=[],t.nameLessZeroData=[],t.nameLessIndex=[],t.namelessUniques=[],t.nameOnlyDuplicatesGroupDiff=[];var a=function(){let e=[];return t.book&&([t.book].map(function(t){var n=(t?u.each(t,l.vcard("includesGroup")):[]).map(function(e){return[t,u.any(e,l.vcard("fn")),e]});e=e.concat(n)}),e.sort()),e}();t.groupObjects=a.map(e=>e[2]),s("Loading "+t.groupObjects.length+" groups... "),u.fetcher.load(t.groupObjects).then(function(){return new Promise(function(e,n){var r,i,a;for(t.cards=u.each(void 0,c("inAddressBook"),t.book),s(t.cards.length+" total cards"),r=0;r<t.cards.length;r++)i=t.cards[r],(a=u.anyValue(i,l.vcard("fn")))?t.definitive[a]===i||(t.definitive[a]?(t.duplicates.length,t.duplicates.push(i)):t.definitive[a]=i):t.nameless.push(i);t.duplicateSet=[];for(var o=0;o<t.duplicates.length;o++)t.duplicateSet[t.duplicates[o].uri]=t.duplicates[o];for(t.namelessSet=[],o=0;o<t.nameless.length;o++)t.namelessSet[t.nameless[o].uri]=t.nameless[o];for(t.uniques=[],t.uniqueSet=[],o=0;o<t.cards.length;o++){var d=t.cards[o].uri;t.duplicateSet[d]||t.namelessSet[d]||(t.uniques.push(t.cards[o]),t.uniqueSet[d]=t.cards[o])}s("Uniques: "+t.uniques.length),s(t.nameless.length+" nameless cards."),s(t.duplicates.length+" name-duplicate cards, leaving "+(t.cards.length-t.duplicates.length)),e(!0)})}).then(function(){return new Promise(function(e,n){s("Groups loaded");for(let e=0;e<t.uniques.length;e++)t.uniquesSet[t.uniques[e].uri]=!0;t.groupMembers=u.statementsMatching(null,l.vcard("hasMember")).map(e=>e.object),s(" Naive group members "+t.groupMembers.length),t.groupMemberSet=[];for(var r=0;r<t.groupMembers.length;r++)t.groupMemberSet[t.groupMembers[r].uri]=t.groupMembers[r];for(var i in t.groupMembers2=[],t.groupMemberSet)t.groupMembers2.push(t.groupMemberSet[i]);if(s(" Compact group members "+t.groupMembers2.length),$rdf.keepThisCodeForLaterButDisableFerossConstantConditionPolice){for(let e=0;e<t.groupMembers.length;e++){var a=t.groupMembers[e];t.uniquesSet[a.uri]||(s(" Not in uniques: "+a),t.groupProblems.push(a),t.duplicateSet[a.uri]?s(" ** IN duplicates alas:"+a):s(" **** WTF?"))}s("Problem cards: "+t.groupProblems.length)}e(!0)})}).then(function e(){return t.namelessToCheck=t.namelessToCheck||t.nameless.slice(),s("Nameless check left: "+t.namelessToCheck.length),new Promise(function(n,r){var i=t.namelessToCheck.shift();if(!i){if(s("namelessUniques: "+t.namelessUniques.length),s("namelessUniques: "+t.namelessUniques),confirm("Add all "+t.namelessUniques.length+" nameless cards to the rescued set?")){t.uniques=t.uniques.concat(t.namelessUniques);for(var a=0;a<t.namelessUniques.length;a++)t.uniqueSet[t.namelessUniques[a].uri]=!0}return n(!0)}(function(e){return new Promise(function(n,r){u.fetcher.load(e).then(function(r){s(" Nameless check "+e);var i={};i[l.vcard("hasUID").uri]=!0,i[l.dc("created").uri]=!0,i[l.dc("modified").uri]=!0;var a=function(e){return u.statementsMatching(null,null,null,e.doc()).filter(function(e){return!i[e.predicate.uri]})}(e);if(!a.length)return s(" Zero length "+e),t.nameLessZeroData.push(e),n(!1);var o=new $rdf.Serializer(u).setBase(e.doc().uri).statementsToN3(a),c=t.nameLessIndex[o];if(c){s(" Matches with "+c);for(var d,h=u.each(null,l.vcard("hasMember"),e),f=u.each(null,l.vcard("hasMember"),c),p=0;p<h.length;p++){d=!1;for(var m=0;m<f.length;m++)f[m].sameTerm(h[p])&&(d=!0);if(!d)return s("This one groups: "+h),s("Other one groups: "+f),s("Cant skip this one because it has a group, "+h[p]+", which the other does not."),t.nameOnlyDuplicatesGroupDiff.push(e),n(!1)}console.log("Group check done -- exact duplicate: "+e)}else s("First nameless like: "+e.doc()),s("___________________________________________"),s(o),s("___________________________________________"),t.nameLessIndex[o]=e,t.namelessUniques.push(e);n(!0)}).catch(function(r){s("Cant load a nameless card!: "+r),t.nameOnlyErrors.push(e),n(!1)})})})(i).then(function(t){s(" Namelessc check returns "+t),e()})})}).then((e,t)=>{confirm("Write new clean versions?")?e(!0):t()}).then(function(){var e;return Promise.resolve().then(()=>{e=u.sym(t.book.dir().uri+"clean-people.ttl");var n=[];for(let e=0;e<t.uniques.length;e++)n=n.concat(u.connectedStatements(t.uniques[e],t.nameEmailIndex));var r=new $rdf.Serializer(u).setBase(t.nameEmailIndex.uri);s("Serializing index of uniques...");var i=r.statementsToN3(n);return u.fetcher.webOperation("PUT",e,{data:i,contentType:"text/turtle"})}).then(function(){return s("Done uniques log "+e),!0}).catch(function(e){s("Error saving uniques: "+e)})}).then(function(){return s("Saving ALL GROUPS"),Promise.all(t.groupObjects.map(r))}).then(function(e,t){s("Done!")})})});var k=v.appendChild(a.createElement("button"));return k.style.cssText=d,k.textContent="Find inidividuals with no group",k.addEventListener("click",function(a){s("Loading groups..."),e(t,n,function(e,t){if(e){var n=u.any(i,l.vcard("nameEmailIndex"));r.store.fetcher.nowOrWhenFetched(n,void 0,function(e,t){s("Loaded groups and name index.");var n={},a=[],o=u.each(i,c("includesGroup"));s(o.length+" total groups. ");for(var d=0;d<o.length;d++){var h=o[d],f=u.each(h,l.vcard("hasMember"));s(r.utils.label(h)+": "+f.length+" members");for(var p=0;p<f.length;p++)u.allAliases(f[p]).forEach(function(e){n[e.uri]=h})}var m=u.each(void 0,c("inAddressBook"),i);s(m.length+" total cards");for(let e=0;e<m.length;e++)n[m[e].uri]||(a.push(m[e]),s(" groupless "+r.utils.label(m[e])));s(a.length+" groupless cards.")})}else s("Failed: "+t)})}),h}},function(e,t,n){const r=n(0),i=n(4);var a=n(91),o=n(270).toolsPane;const s=r.rdf,u=r.ns,l=r.store;e.exports={icon:r.icons.iconBase+"noun_99101.svg",name:"contact",label:function(e){var t=l.findTypeURIs(e);return t[u.vcard("Individual").uri]?"Contact":t[u.vcard("Organization").uri]?"contact":t[u.foaf("Person").uri]?"Person":t[u.schema("Person").uri]?"Person":t[u.vcard("Group").uri]?"Group":t[u.vcard("AddressBook").uri]?"Address book":null},mintClass:r.ns.vcard("AddressBook"),mintNew:function(e){return new Promise(function(t,n){function i(e){u.appendChild(r.widgets.errorMessageBlock(a,e,"pink"))}var a=e.dom,o=e.me,u=e.div,l=r.store,c=r.ns,d=e.newBase||e.newInstance.dir().uri;if((e.instanceClass||c.vcard("AddressBook")).sameTerm(c.vcard("Group"))){var h=e.newInstance||l.sym(e.newBase+"index.ttl#this"),f=h.doc();return l.add(h,c.rdf("type"),c.vcard("Group"),f),l.add(h,c.vcard("fn"),e.instanceName||"untitled group",f),void l.fetcher.putBack(f,{contentType:"text/turtle"}).then(function(n){t(e)}).catch(function(e){n(new Error("Error creating document for new group "+e))})}var p='@prefix vcard: <http://www.w3.org/2006/vcard/ns#>.\n @prefix ab: <http://www.w3.org/ns/pim/ab#>.\n @prefix dc: <http://purl.org/dc/elements/1.1/>.\n @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.\n\n <#this> a vcard:AddressBook;\n dc:title "New address Book";\n vcard:nameEmailIndex <people.ttl>;\n vcard:groupIndex <groups.ttl>.\n',m=[{to:"index.ttl",content:p+="<#this> <http://www.w3.org/ns/auth/acl#owner> <"+o.uri+">.\n\n",contentType:"text/turtle"},{to:"groups.ttl",content:"",contentType:"text/turtle"},{to:"people.ttl",content:"",contentType:"text/turtle"},{to:"",existing:!0,aclOptions:{defaultForNew:!0}}],v=d+"index.html";r.authn.offlineTestID()&&(m.push({to:"local.html",from:"local.html",contentType:"text/html"}),v=d+"local.html");var g=function(n,r){console.log("Files created. App ready at "+n);var i=u.appendChild(a.createElement("p"));i.setAttribute("style","font-size: 140%;"),i.innerHTML="Your <a href='"+n+"'><b>new "+r+"</b></a> is ready. <br/><br/><a href='"+n+"'>Go to new "+r+"</a>",t(e)},b=function(){if(0===m.length)g(v,"address book");else{var e=m.shift();console.log("Creating new file "+e.to+" in new instance ");var t=s.uri.join(e.to,d),a=e.aclOptions||{},u=function(s,u){return u?void r.authn.setACLUserPublic(t,o,a).then(()=>b()).catch(t=>{let r="Error setting access permissions for "+e.to+" : "+t.message;return i(r),n(new Error(r))}):(i("Error writing new file "+e.to),n(new Error("Error writing new file "+e.to)))};"content"in e?l.fetcher.webOperation("PUT",t,{data:e.content,saveMetadata:!0,contentType:e.contentType}).then(()=>u(0,!0)):"existing"in e?u(0,!0):n(new Error("copy not expected buiding new app"))}};b()})},render:function(e,t,c){c=c||{};var d=t.createElement("div"),h=e.doc();r.aclControl.preventBrowserDropEvents(t),d.setAttribute("class","contactPane");var f=function(e){console.log(e),d.appendChild(r.widgets.errorMessageBlock(t,e,"pink"))},p=function(e,t){e||f("Error: "+t)},m=this,v=function(e){return r.authn.newAppInstance(t,{noun:"address book",appPathSegment:"contactorator.timbl.com"},function(n,r){m.clone(e,r,{me:y,div:d,dom:t})})},g=r.store.updater;r.aclControl.preventBrowserDropEvents(t);var b=l.findTypeURIs(e),y=r.authn.currentUser(),w={target:e,me:y,noun:"address book",div:d,dom:t},_=function(e,t,n){l.fetcher.load(e).then(function(r){x(e,t,n)}).catch(function(e){f(e)})},x=function(e,n,a){function h(e){Q.innerHTML="loading...",(C={})[e.uri]=!0,m();var n=x?L(e):e;r.store.fetcher.nowOrWhenFetched(n.doc(),void 0,function(i,a){if(Q.innerHTML="",!i)return p(i,"Can't load card: "+n+": "+a);Q.appendChild(O(t,n,"contact")),Q.appendChild(t.createElement("br")),Q.appendChild(r.widgets.linkIcon(t,n)),r.widgets.deleteButtonWithCheck(t,Q,"contact",function(){let t=e.dir();alert("Conatiner to delete is "+t);let n=l.any(e,u.vcard("fn"));confirm("Delete contact "+n+" completely?? "+t)&&(console.log("Deleting a contact "+n),b(e),function e(t,n){return new Promise(function(r,i){t.fetcher.load(n).then(function(){let i=t.each(n,u.ldp("contains")).map(n=>{if(t.holds(n,u.rdf("type"),u.ldp("BasicContainer")))return e(t,n);if(console.log("deleteRecirsive file: "+n),!confirm(" Really DELETE File "+n))throw new Error("User aborted delete file");return t.fetcher.webOperation("DELETE",n)});if(console.log("deleteRecirsive folder: "+n),!confirm(" Really DELETE folder "+n))throw new Error("User aborted delete file");i.push(t.fetcher.webOperation("DELETE",n)),Promise.all(i).then(e=>{r()})})})}(l,t).then(e=>{P(),Q.innerHTML="Contact Data Deleted."}))}).style="height: 2em;"})}function m(e){for(var t,n=0,r=null,i=0;i<K.children.length;i++){t=K.children[i];let e=I(S(t.subject));e&&(n++,r=t),t.setAttribute("style",e?C[t.subject.uri]?"background-color: #cce;":"":"display: none;")}if(1==n&&e){h(r.subject)}}function b(e){console.log("deleteThing: "+e);var t=l.statementsMatching(e).concat(l.statementsMatching(void 0,void 0,e)),n={};t.map(function(e){n[e.why.uri]=e});var r=[];for(var i in n)r.push(t.filter(function(e){return e.why.uri===i})),console.log(" Deleting "+r[r.length-1].length+" triples from "+i);!function t(){0<r.length?g.update(r.shift(),[],function(n,r,i){return r?void t():void f("Error deleting all trace of: "+e+": "+i)}):(console.log("Deleting resoure "+e.doc()),l.fetcher.delete(e.doc()).then(function(){console.log("Delete thing "+e+": complete.")}).catch(function(t){f("Error deleting thing "+e+": "+t)}))}()}function w(){return function(e,t){for(var n,r=0;r<e.children.length;r++)(n=e.children[r]).subject&&n.setAttribute("style",t[n.subject.uri]?"background-color: #cce;":"")}(J,k)}var _=r.utils.label(u.vcard("AddressBook")),x=e[0],M=l.any(x,u.vcard("groupIndex")),k={},C={},E=a.foreignGroup||x,A=l.any(E,u.dc("title"))||l.any(E,u.vcard("fn"));c.solo&&A&&"undefined"!=typeof document&&(document.title=A.value),A=A?A.value:_;var T=function(e){if(e)return e;var t;for(let e in k){t=l.sym(e);let n=l.any(void 0,u.vcard("includesGroup"),t);if(n)return n}throw new Error("findBookFromGroups: Cant find address book which this group is part of")},S=function(e){var t=l.any(e,u.vcard("fn"))||l.any(e,u.foaf("name"))||l.any(e,u.vcard("organization-name"));return t?t.value:"???"},I=function(e){var t=Y.value.trim().toLowerCase();if(0===t.length)return!0;for(var n,r=t.split(" "),i=0;i<r.length;i++)if(n=r[i],0>e.toLowerCase().indexOf(n))return!1;return!0},N=function(e,t,n){for(var r=t.children.length,i=[],a=0;a<t.children.length;a++){var o=t.children[a];!function(t,a){a.setAttribute("style","background-color: #ffe;"),l.fetcher.nowOrWhenFetched(t.doc(),void 0,function(o,s){if(!o){var u="Can't load group file: "+t+": "+s;return i.push(u),p(o,u)}a.setAttribute("style","background-color: #cce;"),e[t.uri]=!0,w(),P(),!(r-=1)&&n&&n(0===i.length,i)})}(o.subject,o)}},j=function(){te=[],a.foreignGroup&&te.push(["",l.any(a.foreignGroup,u.vcard("fn")),a.foreignGroup]),x&&(e.map(function(e){var t=(e?l.each(e,u.vcard("includesGroup")):[]).map(function(t){return[e,l.any(t,u.vcard("fn")),t]});te=te.concat(t)}),te.sort())},O=function(e,t,n){var r=i.byName(n).render(t,e);return r.setAttribute("style","border: 0.1em solid #444; border-radius: 0.5em"),r},R=function(e,t){var n=S(e),r=S(t);if(n&&r){if((n=n.toLowerCase())>(r=r.toLowerCase()))return 1;if(n<r)return-1}return e.uri>t.uri?1:e.uri<t.uri?-1:0},L=function(e,t){for(var n=l.allAliases(e),r=x.dir().uri,i=0;i<n.length;i++)if(n[i].uri.slice(0,r.length)===r)return n[i];throw new Error("No local URI for "+e)},P=function(){var e=[];for(var n in k)if(k[n]){var i=l.each(l.sym(n),u.vcard("hasMember"));e=e.concat(i)}e.sort(R);for(var a=0;a<e.length-1;)e[a].uri===e[a+1].uri?e.splice(a,1):a++;K.innerHTML="",H.textContent=5<e.length?e.length+" contacts":"contact";for(var o=0;o<e.length;o++){var s=K.appendChild(t.createElement("tr")),c=s.appendChild(t.createElement("td"));c.setAttribute("style",ee);var d=e[o];s.subject=d;var f=S(d);c.textContent=f,s.subject=d,r.widgets.makeDraggable(s,d);!function(e,t){s.addEventListener("click",function(e){e.preventDefault(),h(t)})}(0,d)}m()},D=function(){var e,n;for(j(),n=0;n<J.children.length;n++){J.children[n].trashMe=!0}for(var i=0;i<te.length;i++){var a=te[i][1],o=te[i][2];for(e=!1,n=0;n<J.children.length;n++){let t=J.children[n];if(t.subject&&t.subject.sameTerm(o)){t.trashMe=!1,e=!0;break}}if(!e){var c=J.appendChild(t.createElement("tr"));c.subject=o,r.widgets.makeDraggable(c,o),c.setAttribute("style",ee),c.textContent=a;!function(e,n,i){r.widgets.makeDropTarget(e,function(e){e.forEach(function(e){console.log("Dropped on group: "+e);var t=l.sym(e),r=[t.doc(),n.doc()];l.fetcher.load(r).then(function(e){var r=l.findTypeURIs(t);for(var a in r)console.log(" drop object type includes: "+a);if(u.vcard("Individual").uri in r||u.vcard("Organization").uri in r){var o=l.any(t,u.vcard("fn"));if(!o)return alert("No vcard name known for "+t);if(l.holds(n,u.vcard("hasMember"),t,n.doc()))return alert("ALREADY added "+o+" to group "+i);if(confirm("Add "+o+" to group "+i+"?")){var c=[s.st(n,u.vcard("hasMember"),t,n.doc()),s.st(t,u.vcard("fn"),o,n.doc())];l.updater.update([],c,function(e,t,r){return t?void console.log("Added "+o+" to group "+i):f("Error adding member to group "+n+": "+r)})}}}).catch(function(e){f("Error looking up dropped thing "+t+" and group: "+e)})})}),r.widgets.deleteButtonWithCheck(t,e,"group "+i,function(){b(n),D()}),e.addEventListener("click",function(e){e.preventDefault();var i=l.sym(n.uri.split("#")[0]);e.metaKey||(k={}),k[n.uri]=!k[n.uri],w(),K.innerHTML="",l.fetcher.nowOrWhenFetched(i.uri,void 0,function(a,o){if(!a)return p(a,"Can't load group file: "+i+": "+o);if(P(),!e.metaKey){Q.innerHTML="";var s=!1,u=r.aclControl.ACLControlBox5(n,t,"group",l,function(e,t){e||(Q.innerHTML="Failed: "+t)}),c=Q.appendChild(t.createElement("button"));c.style.cssText="padding: 1em; margin: 1em";var d=c.appendChild(t.createElement("img"));d.style.cssText="width: 1.5em; height: 1.5em",d.setAttribute("src",r.icons.iconBase+"noun_123691.svg"),c.addEventListener("click",function(){(s=!s)?Q.appendChild(u):Q.removeChild(u)})}})},!0)}(c,o,a)}}for(n=0;n<J.children.length;n++){let e=J.children[n];e.trashMe&&J.removeChild(e)}w()},B=t.createElement("table");B.setAttribute("style","border-collapse: collapse; margin-right: 0; max-height: 9in;"),d.appendChild(B);var U=B.appendChild(t.createElement("tr")),q=B.appendChild(t.createElement("tr")),F=B.appendChild(t.createElement("tr")),z=U.appendChild(t.createElement("td")),H=U.appendChild(t.createElement("td")),W=U.appendChild(t.createElement("td")),V=q.appendChild(t.createElement("td")),J=V.appendChild(t.createElement("table")),G=q.appendChild(t.createElement("td")),K=G.appendChild(t.createElement("table")),$=F.appendChild(t.createElement("td")),X=F.appendChild(t.createElement("td")),Z=F.appendChild(t.createElement("td"));W.appendChild(t.createElement("div"));var Y=W.appendChild(t.createElement("input"));Y.setAttribute("type","text"),Y.setAttribute("style","border: 0.1em solid #444; border-radius: 0.5em; width: 100%; font-size: 100%; padding: 0.1em 0.6em"),Y.addEventListener("input",function(e){m(!0)});var Q=q.appendChild(t.createElement("td"));Q.setAttribute("style","margin: 0;");var ee="padding: 0.1em;";z.textContent="groups",z.setAttribute("style","min-width: 10em; padding-bottom 0.2em;");var te,ne=function(e){var t=e?"":"display: none;";z.setAttribute("style","min-width: 10em; padding-bottom 0.2em;"+t);var n="padding: 0.1em;";V.setAttribute("style",n+t),$.setAttribute("style",n+t)};if(ne(!0),a.foreignGroup&&(k[a.foreignGroup.uri]=!0),x){var re=z.appendChild(t.createElement("button"));re.textContent="All";var ie="margin-left: 1em; font-size: 100%;";re.setAttribute("style",ie),re.addEventListener("click",function(e){re.state=re.state?0:1,K.innerHTML="",re.state?(re.setAttribute("style",ie+"background-color: #ff8;"),N(k,J,function(e,t){return e?(re.setAttribute("style",ie+"background-color: black; color: white"),void w()):f(t)})):(re.setAttribute("style",ie+"background-color: #cfc;"),k={},w())}),r.store.fetcher.nowOrWhenFetched(M.uri,x,function(e,t){return e?(D(),void P()):console.log("Cannot load group index: "+t)})}else D(),P(),console.log("No book, only one group -> hide list of groups"),ne(!1);H.textContent="name",H.setAttribute("style","min-width: 18em;"),G.setAttribute("style","overflow:scroll;");var ae=t.createElement("button"),oe=t.createElement("div");if(ae.setAttribute("type","button"),y||ae.setAttribute("disabled","true"),r.authn.checkUser().then(e=>{e&&(y=e,ae.removeAttribute("disabled"))}),oe.appendChild(ae),ae.innerHTML="New Contact",X.appendChild(oe),ae.addEventListener("click",function(e){Q.innerHTML="";var n=T(x);l.fetcher.load(n).then(function(e){if(!e.ok)throw new Error("Book won't load:"+n);var t=l.any(n,u.vcard("nameEmailIndex"));if(!t)throw new Error("Wot no nameEmailIndex?");return l.fetcher.load(t)}).then(function(e){console.log("Name index loaded async"+e.url)}),r.widgets.askName(t,l,Q,r.ns.foaf("name"),u.vcard("Individual"),"person").then(function(e){e&&function(e,t,n,i){e=T(e);var a=l.any(e,u.vcard("nameEmailIndex")),o=r.utils.genUuid(),c=l.sym(e.dir().uri+"Person/"+o+"/index.ttl#this"),d=c.doc(),h=[[s.st(c,u.vcard("inAddressBook"),e,a),s.st(c,u.vcard("fn"),t,a)]];for(var f in n){var p=l.sym(f),m=p.doc();h.push([s.st(p,u.vcard("hasMember"),c,m),s.st(c,u.vcard("fn"),t,m)])}var v=function(e,t,n){t?0<h.length?(console.log("Patching "+h[0]+"\n"),g.update([],h.shift(),v)):(console.log("Done patching. Now reading back in.\n"),r.store.fetcher.nowOrWhenFetched(d,void 0,function(e,t){e?(console.log("Read back in OK.\n"),i(!0,c)):(console.log("Read back in FAILED: "+t+"\n"),i(!1,t))})):(console.log("Error: can't update "+e+" for new contact:"+n+"\n"),i(!1,"Error: can't update "+e+" for new contact:"+n))};r.store.fetcher.nowOrWhenFetched(a,void 0,function(e,n){e?(console.log(" People index must be loaded\n"),g.put(d,[s.st(c,u.vcard("fn"),t,d),s.st(c,u.rdf("type"),u.vcard("Individual"),d)],"text/turtle",v)):(console.log("Error loading people index!"+a.uri+": "+n),i(!1,"Error loading people index!"+a.uri+": "+n+"\n"))})}(x,e,k,function(e,n){if(e){let e=n;Q.innerHTML="indexing...",(C={})[e.uri]=!0,P(),Q.appendChild(O(t,e,"contact"))}else console.log("Error: can't save new contact:"+n)})})},!1),x){var se=$.appendChild(t.createElement("button"));se.setAttribute("type","button"),se.innerHTML="New Group",se.addEventListener("click",function(e){Q.innerHTML="";var n=l.any(x,u.vcard("groupIndex"));r.store.fetcher.nowOrWhenFetched(n,void 0,function(e,t){e?console.log(" Group index has been loaded\n"):console.log("Error: Group index has NOT been loaded"+t+"\n")}),r.widgets.askName(t,l,Q,r.ns.foaf("name"),u.vcard("Group"),"group").then(function(e){e&&function(e,t,n){var i=l.any(e,u.vcard("groupIndex")),a=e.uri.split("#")[0],o=t.replace(" ","_"),c=l.sym(a.slice(0,a.lastIndexOf("/")+1)+"Group/"+o+".ttl"),d=l.sym(c.uri+"#this");console.log(" New group will be: "+d+"\n"),r.store.fetcher.nowOrWhenFetched(i,function(r,a){if(r){console.log(" Group index must be loaded\n");var o=[s.st(e,u.vcard("includesGroup"),d,i),s.st(d,u.rdf("type"),u.vcard("Group"),i),s.st(d,u.vcard("fn"),t,i)];g.update([],o,function(a,o,l){if(r){var h=[s.st(e,u.vcard("includesGroup"),d,i),s.st(d,u.rdf("type"),u.vcard("Group"),c),s.st(d,u.vcard("fn"),t,c)];g.put(c,h,"text/turtle",function(e,t,r){n(t,t?d:"Can't save new group file "+c+r)})}else n(r,"Could not update group index "+l)})}else console.log("Error loading people index!"+i.uri+": "+a),n(!1,"Error loading people index!"+i.uri+": "+a+"\n")})}(x,e,function(e,n){e?((k={})[n.uri]=!0,D(),Q.innerHTML="",Q.appendChild(r.aclControl.ACLControlBox5(n,t,"group",l,function(e,t){e||(Q.innerHTML="Group sharing setup failed: "+t)}))):(console.log("Error: can't save new group:"+n),Q.innerHTML="Failed to save group"+n)})})},!1);var ue=Z.appendChild(t.createElement("button"));ue.setAttribute("type","button"),ue.innerHTML="Tools",ue.addEventListener("click",function(e){Q.innerHTML="",Q.appendChild(o(N,k,J,x,t,y))})}Z.appendChild(v(x)),d.appendChild(t.createElement("hr"))};return b[u.vcard("Individual").uri]||b[u.vcard("Organization").uri]||b[u.foaf("Person").uri]||b[u.schema("Person").uri]?function(e){var i,o=e,c=function(e){l.fetcher.nowOrWhenFetched(e.doc(),function(t,n){if(t){var r=l.findTypeURIs(e);for(var i in r)console.log(" drop object type includes: "+i);console.log("Default: assume web page "+e),l.add(o,u.wf("attachment"),e,o.doc())}else console.log("Error looking up dropped thing "+e+": "+n)})},m=function(t,n,r){var s=a.extension(n);n!==a.lookup(t)&&(t+="_."+s,console.log("MIME TYPE MISMATCH -- adding extension: "+t));let c,d,h=n.startsWith("image");var p,m;for(h?(c="image_",d=u.vcard("hasPhoto")):(c="attachment_",d=u.wf("attachment")),p=0;m=l.sym(o.dir().uri+t),l.holds(e,u.vcard("hasPhoto"),m);p++)t=c+p+"."+s;console.log("Putting "+r.byteLength+" bytes of "+n+" to "+m),l.fetcher.webOperation("PUT",m.uri,{data:r,contentType:n}).then(function(t){return t.ok?(console.log(" Upload: put OK: "+m),l.add(e,d,m,e.doc()),void l.fetcher.putBack(e.doc(),{contentType:"text/turtle"}).then(function(e){h&&i.refresh()},function(e){console.log(" Write back image link FAIL "+m+", Error: "+e)})):void f("Error uploading "+m+":"+t.status)})},v=function(e){e.map(function(e){var t=s.sym(e);return console.log("Dropped on mugshot thing "+t),e.startsWith("http")&&0>e.indexOf("#")?void l.fetcher.webOperation("GET",t.uri).then(e=>{let n=e.headers.get("Content-Type"),r=t.uri.split("/").slice(-1)[0];r=r.split("?")[0],e.arrayBuffer().then(function(i){return e.ok?void m(r,n,i):void f("Error downloading "+t+":"+e.status)})}):(console.log("Not a web document URI, cannot copy as picture: "+t),void c(t))})},g=function(e){for(var t=0;t<e.length;t++){let r=e[t];console.log(" meeting: Filename: "+r.name+", type: "+(r.type||"n/a")+" size: "+r.size+" bytes, last modified: "+(r.lastModifiedDate?r.lastModifiedDate.toLocaleDateString():"n/a"));var n=new FileReader;n.onload=function(e){return function(t){var n=t.target.result;console.log(" File read byteLength : "+n.byteLength);var r=encodeURIComponent(e.name),i=e.type;m(r,i,n)}}(r),n.readAsArrayBuffer(r)}},b=l.sym("https://solid.github.io/solid-panes/contact/individualForm.ttl#form1"),y=b.doc();if(!l.holds(void 0,void 0,void 0,y)){var w=n(269);s.parse(w,l,y.uri,"text/turtle")}var _=r.ns.vcard("Type").doc();l.holds(void 0,void 0,void 0,_)||s.parse(n(268),l,_.uri,"text/turtle");var x=[e.doc()];r.store.fetcher.load(x).catch(function(e){console.log("Error: Failed to load subject: "+e)}).then(function(n){function a(e){let n=t.createElement("img");return n.setAttribute("style","max-height: 10em; border-radius: 1em; margin: 0.7em;"),r.widgets.makeDropTarget(n,v,g),e&&n.setAttribute("src",e.uri),n}function o(){let t=l.each(e,u.vcard("hasPhoto"));t.sort(),0===(t=t.slice(0,5)).length?(i.innerHTML="",i.appendChild(y)):r.utils.syncTableToArray(i,t,a)}function c(n){var i={deleteFunction:function(){C(e,n)},noun:"membership"};return r.widgets.personTR(t,null,n,i)}function m(){var t=l.each(null,u.vcard("hasMember"),e);r.utils.syncTableToArray(E,t,c)}(function(){var t=l.findTypeURIs(e),n="padding: 0.5em 1.5em 1em 1.5em; ",r=null;for(var i in t)if(r=l.any(l.sym(i),l.sym("http://www.w3.org/ns/ui#backgroundColor")))break;n+="background-color: "+(r=r?r.value:"#fff")+"; ",d.setAttribute("style",n)})(),r.authn.checkUser(),i=d.appendChild(t.createElement("div"));var y=a();r.widgets.setImage(y,e),o(),i.refresh=o,r.widgets.appendForm(t,d,{},e,b,h,p),d.appendChild(t.createElement("tr")).setAttribute("style","height: 1em");var w=function(e,t,n){var i=_.appendChild(e.createElement("tr"));i.setAttribute("style","margin-top: 0.1em solid #ccc;");var a=i.appendChild(e.createElement("td")),o=i.appendChild(e.createElement("td"));a.textContent=n.uri.split("/")[2],l.fetcher.load(n).then(function(e){a.textContent=n.uri.split("/")[2]+" ("+l.statementsMatching(void 0,void 0,void 0,n.doc()).length+")"}).catch(function(t){o.appendChild(r.widgets.errorMessageBlock(e,t,"pink"))}),o.appendChild(r.widgets.linkIcon(e,n))},_=d.appendChild(t.createElement("table")),x=l.allAliases(e);if(1<x.length)for(var M,k=0;k<x.length;k++)(M=x[k]).sameTerm(e)||w(t,0,M);r.widgets.attachmentList(t,e,d,{predicate:r.ns.vcard("url")}),d.appendChild(t.createElement("hr")),l.each(e,u.vcard("url")).forEach(function(e){var n=l.any(e,u.rdf("type")),i=l.any(e,u.vcard("value"));if(i){var a=_.appendChild(t.createElement("tr"));a.setAttribute("style","margin-top: 0.1em solid #ccc;"),a.appendChild(t.createElement("td")).textContent=r.utils.label(n);var o=a.appendChild(t.createElement("td")).appendChild(t.createElement("a"));o.setAttribute("href",i.uri),o.appendChild(t.createElement("span")).textContent=i.uri}}),d.appendChild(t.createElement("hr"));var C=function(e,t){var n=l.any(e,u.vcard("fn")),r=l.any(t,u.vcard("fn"));if(2>l.each(null,u.vcard("hasMember"),e).length)alert("Must be a member of at least one group. Add to another group first.");else if(confirm("Remove "+n+" from group "+r+"?")){var i=[s.st(t,u.vcard("hasMember"),e,t.doc()),s.st(e,u.vcard("fn"),n,t.doc())];l.updater.update(i,[],function(e,i,a){return i?(console.log("Removed "+n+" from group "+r),void m()):f("Error removing member from group "+t+": "+a)})}},E=d.appendChild(t.createElement("table"));E.refresh=m,m()})}(e):b[u.vcard("Group").uri]?r.authn.findAppInstances(w,u.vcard("AddressBook")).then(function(t){var n=t.instances,r={foreignGroup:e};0<n.length?_(n,t,r):_([],t,r)}).catch(function(e){r.widgets.complain(w,e)}):b[u.vcard("AddressBook").uri]?_([e],w,{}):console.log("Error: Contact pane: No evidence that "+e+" is anything to do with contacts."),(y=r.authn.currentUser())||(console.log("(You do not have your Web Id set. Sign in or sign up to make changes.)"),r.authn.logInLoadProfile(w).then(e=>{console.log("Logged in as "+e.me),y=e.me},e=>{d.appendChild(r.widgets.errorMessageBlock(e))})),"undefined"!=typeof document&&document.location&&"http://localhost"===(""+document.location).slice(0,16)&&(y=l.any(e,r.ns.acl("owner")),console.log("Assuming user is "+y)),d}}},function(e,t,n){var r=n(0),i=n(4);const a=!1;e.exports={icon:r.icons.iconBase+"noun_97839.svg",name:"issue",label:function(e){var t=r.store,n=t.findTypeURIs(e);return n["http://www.w3.org/2005/01/wf/flow#Task"]||t.holds(e,r.ns.wf("tracker"))?"issue":n["http://www.w3.org/2005/01/wf/flow#Tracker"]?"tracker":null},render:function(e,t){function n(t,n,r){if(a){if(!b(v,"trackLastModified"))return;var i=n.statementsMatching(e,f("modified"));i=i.concat(n.statementsMatching(e,d("modifiedBy")));var o=[$rdf.st(e,f("modified"),new Date,r)];E&&o.push($rdf.st(e,d("modifiedBy"),E,r)),k.update(i,o,function(e,t,n){})}}function o(e,n){var r=t.createElement("pre");return r.setAttribute("style",n||"color: grey"),m.appendChild(r),r.appendChild(t.createTextNode(e)),r}function s(e){console.warn(e),m.appendChild(r.widgets.errorMessageBlock(t,e))}function u(e,t){e||s("Sorry, failed to save your change:\n"+t)}var l=r.store,c=r.ns,d=$rdf.Namespace("http://www.w3.org/2005/01/wf/flow#"),h=$rdf.Namespace("http://purl.org/dc/elements/1.1/"),f=$rdf.Namespace("http://purl.org/dc/terms/"),p=i.getOutliner(t),m=t.createElement("div");m.setAttribute("class","issuePane");var v,g,b=function(e,t){var n=l.any(e,c.ui(t));return!(!n||!n.value)},y=this,w=function(n){var r=n.parentNode,i=y.render(e,t);r.replaceChild(i,n)},_=function(){return""+(new Date).getTime()},x=function(e,t,n,i){var a=e.createElement("div"),o=t.any(n,d("stateStore")),s=function(){v.setAttribute("class","pendingedit"),v.disabled=!0;var e,r,s=[],u=t.anyValue(n,d("issueURITemplate"));u?(u=$rdf.uri.join(u,o.uri),e=t.sym(function(e){const t=new $rdf.Literal(new Date),n=""+(new Date).getTime();let r=t.value.slice(0,4);var i=t.value.slice(5,7),a=t.value.slice(8,10);return e.replace("{N}",n).replace("{YYYY}",r).replace("{MM}",i).replace("{DD}",a)}(u))):e=t.sym(o.uri+"#Iss"+_()),r=e.doc();var l=t.literal(v.value);s.push(new $rdf.Statement(e,d("tracker"),n,o)),s.push(new $rdf.Statement(e,h("title"),l,o)),s.push(new $rdf.Statement(e,f("created"),new Date,o));var g=t.each(n,d("initialState"));0===g.length&&console.log("This tracker has no initialState");for(var b=0;b<g.length;b++)s.push(new $rdf.Statement(e,c.rdf("type"),g[b],o));i&&s.push(new $rdf.Statement(i,d("dependent"),e,o)),u&&(s.push(new $rdf.Statement(e,d("tracker"),n,r)),s.push(new $rdf.Statement(e,c.rdfs("seeAlso"),o,r)));k.update([],s,function(t,n,r){n?(a.parentNode.removeChild(a),w(m),p.GotoSubject(e,!0,void 0,!0,void 0)):console.log("Error: can't save new issue:"+r)})};r.store.fetcher.removeCallback("done","expand"),r.store.fetcher.removeCallback("fail","expand");var u=t.any(n,d("issueClass")),l=r.utils.label(u);a.innerHTML="<h2>Add new "+(i?"sub ":"")+l+"</h2><p>Title of new "+l+":</p>";var v=e.createElement("input");return v.setAttribute("type","text"),v.setAttribute("style","margin: 0.5em; font-size: 100%; padding: 0.3em;"),v.setAttribute("size","100"),v.setAttribute("maxLength","2048"),v.select(),v.addEventListener("keyup",function(e){13===e.keyCode&&s()},!1),a.appendChild(v),a},M=function(e){var n=r.authn.newAppInstance(t,{noun:"tracker"},function(t,n){var i="issuetracker.w3.org",a=r.ns.space,o=r.store;if(n||("/"!==(n=o.any(t,a("uriPrefix")).value).slice(-1)&&($rdf.log.error(i+": No / at end of uriPrefix "+n),n+="/"),n+=i+"/"+_()+"/",confirm("Make new tracker at "+n+"?"))){for(var s,u=o.any(v,d("stateStore")),l=o.sym(n+"store.ttl"),c=e.doc(),h=c.uri.slice(0,c.uri.lastIndexOf("/")+1),f=function(e){if(void 0!==e.elements)return e.elements.map(f);if(void 0===e.uri)return e;var t=e.uri;return t===u.uri?l:(t.slice(0,h.length)===h&&(t=n+t.slice(h.length),$rdf.log.debug(" Map "+e.uri+" to "+t)),o.sym(t))},p=f(c),m=f(e),g=o.statementsMatching(void 0,void 0,void 0,c),b=0;b<g.length;b++)s=g[b],o.add(f(s.subject),f(s.predicate),f(s.object),p);o.add(m,r.ns.space("inspiration"),e,u),o.add(m,r.ns.space("inspiration"),e,p),k.put(p,o.statementsMatching(void 0,void 0,void 0,p),"text/turtle",function(e,t,n){t?k.put(l,[],"text/turtle",function(e,t,n){t?console.info("Ok The tracker created OK at: "+m.uri+"\nMake a note of it, bookmark it. "):console.log("FAILED to set up new store at: "+l.uri+" : "+n)}):console.log("FAILED to save new tracker at: "+p.uri+" : "+n)})}});return n.setAttribute("style","margin: 0.5em 1em;"),n},k=l.updater,C=l.findTypeURIs(e),E=r.authn.currentUser(),A=function(e){if(e.refresh)e.refresh();else for(var t=0;t<e.children.length;t++)A(e.children[t])},T=function(e,i){var a=r.ns,c={},h=function(e){c[e.uri]=!0};h(a.rdf("type")),h(a.dc("title"));!function(){var t=l.findTypeURIs(e),n="padding: 0.5em 1.5em 1em 1.5em; ",r=null;for(var a in t)if(r=l.any(l.sym(a),l.sym("http://www.w3.org/ns/ui#backgroundColor")))break;n+="background-color: "+(r=r?r.value:"#eee")+"; ",i.setAttribute("style",n)}();var f=l.any(v,d("stateStore")),m=l.sym(e.uri.split("#")[0]);r.authn.checkUser();var g=l.any(v,d("issueClass"));if(!g)throw new Error("This tracker "+v+" has no issueClass");var y=r.widgets.makeSelectForCategory(t,l,e,g,f,function(e,t){e?(n(0,l,m),A(i)):console.log("Failed to change state:\n"+t)});i.appendChild(y);for(var w=l.each(v,d("issueCategory")),M=0;M<w.length;M++)i.appendChild(r.widgets.makeSelectForCategory(t,l,e,w[M],f,function(e,t){e?(n(0,l,m),A(i)):console.log("Failed to change category:\n"+t)}));let C=t.createElement("a");C.setAttribute("href",v.uri),C.setAttribute("style","float:right"),i.appendChild(C).textContent=r.utils.label(v),C.addEventListener("click",r.widgets.openHrefInOutlineMode,!0),h(a.wf("tracker")),i.appendChild(r.widgets.makeDescription(t,l,e,d("description"),m,function(e,t){e?n(0,l,m):console.log("Failed to description:\n"+t)})),h(d("description"));var E=l.statementsMatching(e,a.wf("assignee"));if(1<E.length){o("Weird, was assigned to more than one person. Fixing ..");var T=E.slice(1);k.update(T,[],function(e,t,n){t?o("Now fixed."):s("Fixed failed: "+n)})}var S=l.statementsMatching(e),I=l.statementsMatching(void 0,void 0,e),N=l.statementsMatching(void 0,a.wf("assignee")).map(e=>e.object),j=l.any(void 0,a.doap("bug-database"),v);if(j&&(N=N.concat(l.each(j,a.doap("developer")))),N.length){N.map(function(e){l.fetcher.lookUpThing(e)});var O={mint:"** Add new person **",nullLabel:"(unassigned)",mintStatementsFun:function(e){var t=[$rdf.st(e,a.rdf("type"),a.foaf("Person"))];return j&&t.push($rdf.st(j,a.doap("developer"),e)),t}};i.appendChild(r.widgets.makeSelectForOptions(t,l,e,a.wf("assignee"),N,O,m,function(e,t){e?n(0,l,m):console.log("Failed to description:\n"+t)}))}if(h(a.wf("assignee")),b(v,"allowSubIssues")&&(p.appendPropertyTRs(i,S,!1,function(e,t){return!t&&e.sameTerm(d("dependent"))}),p.appendPropertyTRs(i,I,!0,function(e,t){return t&&e.sameTerm(d("dependent"))}),h(d("dependent"))),i.appendChild(t.createElement("br")),b(v,"allowSubIssues")){var R=t.createElement("button");R.setAttribute("type","button"),i.appendChild(R);var L=r.utils.label(g);R.innerHTML="New sub "+L,R.setAttribute("style","float: right; margin: 0.5em 1em;"),R.addEventListener("click",function(n){i.appendChild(x(t,l,v,e))},!1)}var P=l.any(v,a.wf("extrasEntryForm"));P&&(r.widgets.appendForm(t,i,{},e,P,f,u),l.each(P,a.ui("part")).map(function(e){var t=l.any(e,a.ui("property"));t&&h(t)}));var D,B=i.appendChild(t.createElement("tr"));B.setAttribute("style","height: 1em"),l.anyValue(v,d("issueURITemplate"))?D=e.doc():(!(D=l.any(v,a.wf("messageStore")))&&(D=l.any(v,d("stateStore"))),l.sym(D.uri+"#Chat"+_())),l.fetcher.nowOrWhenFetched(D,function(n,a,o){if(n){var s=r.messageArea(t,l,e,D);i.insertBefore(s,B)}else{var u=t.createElement("p");u.textContent=a,i.insertBefore(u,B)}}),h(a.wf("message")),r.widgets.attachmentList(t,e,i,{promptIcon:r.icons.iconBase+"noun_25830.svg",predicate:a.wf("attachment")}),h(a.wf("attachment")),p.appendPropertyTRs(i,S,!1,function(e,t){return!(e.uri in c)}),p.appendPropertyTRs(i,I,!0,function(e,t){return!(e.uri in c)});var U=t.createElement("button");U.textContent="refresh",U.addEventListener("click",function(e){r.store.fetcher.unload(D),r.store.fetcher.nowOrWhenFetched(D.uri,void 0,function(e,t){e?A(i):console.log("Cant refresh messages"+t)})},!1),U.setAttribute("style","margin: 0.5em 1em;"),i.appendChild(U)};if(C["http://www.w3.org/2005/01/wf/flow#Task"]||l.holds(e,r.ns.wf("tracker"))){if(!(v=l.any(e,d("tracker"))))throw new Error("This issue "+e+"has no tracker");var S=v.uri.split("#")[0];r.store.fetcher.load([v.doc(),c.wf("").doc()]).then(function(t){var n=l.any(v,d("stateStore"));r.store.fetcher.nowOrWhenFetched(n,e,function(t,r){return t?(T(e,m),void k.addDownstreamChangeListener(n,function(){A(m)})):console.log("Failed to load state "+n+" "+r)})}).catch(e=>{return s("Failed to load config "+S+" "+e)}),r.store.fetcher.nowOrWhenFetched(S,e,function(e,t){if(!e)return console.log("Failed to load config "+S+" "+t)})}else if(C["http://www.w3.org/2005/01/wf/flow#Tracker"]){v=e;var I,N=l.any(e,d("issueClass"));if(!N)throw new Error("This tracker has no issueClass");var j=l.any(e,d("stateStore"));if(!j)throw new Error("This tracker has no stateStore");r.authn.checkUser();var O=t.createElement("h2");O.setAttribute("style","font-size: 150%"),m.appendChild(O);var R=r.utils.label(N);O.appendChild(t.createTextNode(R+" list"));var L=t.createElement("button"),P=t.createElement("div");L.setAttribute("type","button"),L.setAttribute("style","padding: 0.3em; font-size: 100%; margin: 0.5em;"),P.appendChild(L),m.appendChild(P);var D=t.createElement("img");D.setAttribute("src",r.icons.iconBase+"noun_19460_green.svg"),D.setAttribute("style","width: 1em; height: 1em; margin: 0.2em;"),L.appendChild(D);var B=t.createElement("span");B.innerHTML="New "+R,L.appendChild(B),L.addEventListener("click",function(n){L.setAttribute("disabled","true"),P.appendChild(x(t,l,e))},!1),r.store.fetcher.load([j,c.wf("").doc()]).then(function(n){var i=new $rdf.Query(r.utils.label(e)),a=l.each(v,d("issueCategory")),o=["issue","state","created"];for(let e=0;e<a.length;e++)o.push("_cat_"+e);var s={};o.map(function(e){i.vars.push(s[e]=$rdf.variable(e))}),i.pat.add(s.issue,d("tracker"),v),i.pat.add(s.issue,c.dct("created"),s.created),i.pat.add(s.issue,c.rdf("type"),s.state),i.pat.add(s.state,c.rdfs("subClassOf"),N);for(let e=0;e<a.length;e++)i.pat.add(s.issue,c.rdf("type"),s["_cat_"+e]),i.pat.add(s["_cat_"+e],c.rdfs("subClassOf"),a[e]);i.pat.optional=[];var u=l.any(v,d("propertyList"));if(u)for(var h=u.elements,f=0;f<h.length;f++){var p=h[f],g="_prop_"+f;0<=p.uri.indexOf("#")&&(g=p.uri.split("#")[1]);var b=new $rdf.IndexedFormula;i.pat.optional.push(b),i.vars.push(s[g]=$rdf.variable(g)),b.add(s.issue,p,s[g])}var y={};l.each(void 0,c.rdfs("subClassOf"),N).map(function(e){(l.holds(e,c.rdfs("subClassOf"),d("Open"))||e.sameTerm(d("Open")))&&(y[e.uri]=!0)});var w,_=r.table(t,{query:i,keyVariable:"?issue",hints:{"?issue":{linkFunction:function(e){I.innerHTML="";var n=I.appendChild(t.createElement("button"));n.textContent="X",n.addEventListener("click",function(e){I.innerHTML=""}),T(l.sym(e),I)}},"?created":{cellFormat:"shortDate"},"?state":{initialSelection:y}}});if(m.appendChild(_),(w=m.appendChild(t.createElement("div"))).setAttribute("style"," position: absolute; top: 100px; right: 20px; margin: 1em white;"),I=w.appendChild(t.createElement("div")),_.refresh){var x=t.createElement("button");x.textContent="refresh",x.addEventListener("click",function(e){r.store.fetcher.unload(j),r.store.fetcher.nowOrWhenFetched(j.uri,void 0,function(e,t){e?_.refresh():console.log("Cant refresh data:"+t)})},!1),m.appendChild(x)}else console.log("No refresh function?!");m.appendChild(M(e)),k.addDownstreamChangeListener(j,_.refresh)}).catch(function(e){return console.log("Cannot load state store: "+e)})}else console.log("Error: Issue pane: No evidence that "+e+" is either a bug or a tracker.");return r.authn.checkUser().then(e=>e?(console.log("Web ID set already: "+e),void(E=e)):(g=r.authn.loginStatusBox(t,e=>{e?(E=l.sym(e),console.log("Web ID set from login button: "+e),m.removeChild(g)):E=null}),g.setAttribute("style","margin: 0.5em 1em;"),void m.appendChild(g))),m}}},function(e,t,n){function r(e){for(var t=e;;){if(t.getAttribute("predTR"))return t;if(!t.previousSibling||"TR"!==t.previousSibling.nodeName)return console.log("Could not find predParent"),e;t=t.previousSibling}}function i(e,t,n){var s=a.store,u=t.AJAR_inverse;let l,c,d,h,f;var p=null;for(h=t.parentNode;h;h=h.parentNode)if(void 0!==h.AJAR_statement){h.setAttribute("bla",h.AJAR_statement),h.AJAR_variable||i(e,h),d=h.AJAR_variable;var m=r(h);m.getAttribute("optionalSubqueriesIndex")&&(p=m.getAttribute("optionalSubqueriesIndex"),f=o[p]);break}f||(f=e.pat);var v=r(t),g=v.getAttribute("optional");if(g||(p?v.setAttribute("optionalSubqueriesIndex",p):v.removeAttribute("optionalSubqueriesIndex")),g){var b=s.formula();o.push(b),v.setAttribute("optionalSubqueriesIndex",o.length-1),f.optional.push(b),f=b}var y=t.AJAR_statement,w=t.AJAR_inverse?y.subject:y.object,_=!0;return w.isBlank&&n&&window.alert("You cannot constrain a query with a blank node. No constraint will be added."),d||(_=!1,d=u?y.object:y.subject),c=t.AJAR_variable?t.AJAR_variable:s.variable(a.utils.newVariableName()),e.vars.push(c),c.label=_?d.label:a.utils.label(d),c.label+=" "+a.utils.predicateLabelForXML(y.predicate,u),l=function(e,t){return u?new a.rdf.Statement(e,y.predicate,t):new a.rdf.Statement(t,y.predicate,e)}(c,d),c.label=c.label.slice(0,1).toUpperCase()+c.label.slice(1),n&&(f.constraints[c]=new function(e){return this.describe=function(t){return t+" = "+e.toNT()},this.test=function(t){return e.sameTerm(t)},this}(w)),a.log.info("Pattern: "+l),l.tr=t,t.AJAR_pattern=l,t.AJAR_variable=c,a.log.debug("Query pattern: "+l),f.statements.push(l),c}var a=n(0);e.exports={makeQueryRow:i,QuerySource:function(){this.queries=[],this.listeners=[],this.addQuery=function(e){var t;for((null===e.name||""===e.name)&&(e.name="Query #"+(this.queries.length+1)),e.id=this.queries.length,this.queries.push(e),t=0;t<this.listeners.length;t++)null!==this.listeners[t]&&this.listeners[t].addQuery(e)},this.removeQuery=function(e){var t;for(t=0;t<this.listeners.length;t++)null!==this.listeners[t]&&this.listeners[t].removeQuery(e);null!==this.queries[e.id]&&delete this.queries[e.id]},this.addListener=function(e){var t;for(this.listeners.push(e),t=0;t<this.queries.length;t++)null!==this.queries[t]&&e.addQuery(this.queries[t])},this.removeListener=function(e){var t;for(t=0;t<this.queries.length;t++)null!==this.queries[t]&&e.removeQuery(this.queries[t]);for(t=0;t<this.listeners.length;t++)this.listeners[t]===e&&delete this.listeners[t]}},viewAndSaveQuery:function(e,t){var n=e.qs;a.log.info("outline.doucment is now "+e.document.location);var r=function(e,t){var n,r,o,s,u=new a.rdf.Query,l=e.length;for(n=0;n<l;n++)o=(s=(r=e[n]).parentNode).AJAR_statement,a.log.debug("Statement "+o),0<=r.getAttribute("class").indexOf("pred")&&(a.log.info(" We have a predicate"),i(u,s)),0<=r.getAttribute("class").indexOf("obj")&&(a.log.info(" We have an object"),i(u,s,!0));return t.addQuery(u),function e(t){var n,r=t.statements.length;for(let e=0;e<r;e++)void 0!==(n=t.statements[e].tr)&&(n.AJAR_pattern=null,n.AJAR_variable=null);for(let n in t.optional)e(t.optional[n])}(u.pat),u}(t,n);for(let e=0;e<n.listeners.length;e++)n.listeners[e].getActiveView().view.drawQuery(r),n.listeners[e].updateQueryControls(n.listeners[e].getActiveView())}};var o=[]},function(e,t,n){var r,i,a=n(0),o=n(4);e.exports=function e(t){var n=a.store,s=t.document;this.menuId="predicateMenu1";var u=function(e){console.log(e+"\n")};const l=a.ns.rdf;var c=a.rdf.Namespace("http://purl.org/ontology/bibo/"),d=a.rdf.Namespace("http://purl.org/dc/elements/1.1/"),h=!1;return r||((r=new a.rdf.Formula).superFormula=n),i||(i=new a.rdf.IndexedFormula),i.name="TempFormula",a.store.updater||(a.store.updater=new a.rdf.UpdateManager(n)),{sparqler:a.store.updater,lastModified:null,lastModifiedStat:null,statIsInverse:!1,addNewPredicateObject:function(e){if("bottom-border-active"===a.utils.getTarget(e).className){var r=t.UserInput,i=a.utils.getTarget(e),o=s.createElement("tr");a.utils.ancestor(i,"DIV").insertBefore(o,a.utils.ancestor(i,"TR"));var u=s.createElement("tr"),l=r.generateRequest("(TBD)",u,!0);o.appendChild(u.firstChild);var c=r.generateRequest("(Enter text or drag an object onto this field)",u,!1);if(o.appendChild(u.firstChild),a.utils.ancestor(i,"TR").previousSibling&&a.utils.ancestor(i,"TR").previousSibling.AJAR_statement){let e=a.utils.ancestor(i,"TR").previousSibling.AJAR_statement;r.formUndetStat(o,e.subject,l,c,e.why,!1)}else{var d=a.utils.getAbout(n,a.utils.ancestor(i.parentNode.parentNode,"TD")),h=n.sym(a.rdf.Util.uri.docpart(d.uri));r.formUndetStat(o,d,l,c,h,!1)}t.walk("moveTo",o.firstChild),a.log.info("addNewPredicateObject: selection = "+t.getSelection().map(function(e){return e.textContent}).join(", ")),this.startFillInText(t.getSelection()[0])}},addNewObject:function(e){var n=a.utils.getTarget(e).parentNode.parentNode,r=n.parentNode.AJAR_inverse;this.lastModifiedStat=n.parentNode.AJAR_statement;var i=this.appendToPredicate(n),o=this.generateRequest(" (Error) ",i,!1);let s=i.previousSibling.AJAR_statement;r?this.formUndetStat(i,o,s.predicate,s.object,s.why,!0):this.formUndetStat(i,s.subject,s.predicate,o,s.why,!1),t.walk("moveTo",i.lastChild),this.startFillInText(i.lastChild)},Delete:function(e){this.deleteTriple(e,!1)},Enter:function(e){this.literalModification(e)},Click:function(e){var t=a.utils.getTarget(e);"Literal"!==a.utils.getTerm(t).termType||(this.literalModification(t),e.preventDefault(),e.stopPropagation())},pasteFromClipboard:function(e,n){function r(e){var n=t.clipboard[e].shift();if(null!==n){switch(e){case"predicates":case"objects":for(var r=t.clipboard.all,i=0;;i++)if(n.sameTerm(r[i])){r.splice(i,1);break}break;case"all":throw new Error("hostorical code not understood - what is theCollection?")}return n}a.log.warn("no more element in clipboard!")}var i;switch(n.className){case"undetermined selected":if(!(i=n.nextSibling?r("predicates"):r("objects")))return;break;case"pred selected":if(!(i=r("objects")))return;break;case"selected":var o=r("all");return o?(i=o[0],void this.insertTermTo(n,i,o[1])):void 0}this.insertTermTo(n,i)},startFillInText:function(e){switch(this.whatSortOfEditCell(e)){case"DatatypeProperty-like":a.utils.emptyNode(e),this.lastModified=this.createInputBoxIn(e," (Please Input) "),this.lastModified.isNew=!1,this.lastModified.select();break;case"predicate":this.performAutoCompleteEdit(e,"PredicateAutoComplete");break;case"ObjectProperty-like":case"no-idea":this.performAutoCompleteEdit(e,"GeneralAutoComplete")}},literalModification:function(e){if(a.log.debug("entering literal Modification with "+e+e.textContent),-1!==e.className.indexOf(" pendingedit"))return a.log.warn("The node you attempted to edit has a request still pending.\nPlease wait for the request to finish (the text will turn black)\nbefore editing this node again."),!0;var t,r=e;if(this.getStatementAbout(r)){try{var i=a.utils.getTerm(r),o=a.utils.ancestor(r,"TR")}catch(t){a.log.warn("userinput.js: "+t+a.utils.getAbout(n,e)),a.log.error(r+" getStatement Error:"+t)}try{var u=o.lastChild}catch(e){a.log.error(e+"@"+r)}if("Literal"===i.termType){if(u.removeChild(u.firstChild),i.value.match("\n")){var l=s.createElement("textarea");l.appendChild(s.createTextNode(i.value)),l.setAttribute("rows",(i.value.match(/\n/g).length+1).toString()),l.setAttribute("cols","100"),l.setAttribute("class","textinput"),u.appendChild(l),this.lastModified=l}else this.lastModified=this.createInputBoxIn(u,i.value);this.lastModified.isNew=!1,this.lastModified.select()}return!0}},performAutoCompleteEdit:function(e,t){a.utils.emptyNode(e),u("perform AutoCompleteEdit. THIS IS="+this),this.lastModified=this.createInputBoxIn(e,""),this.lastModified.select(),this.lastModified.addEventListener("keypress",this.getAutoCompleteHandler(t),!1),this.getAutoCompleteHandler(t)(1)},backOut:function(){this.deleteTriple(this.lastModified.parentNode,!0),this.lastModified=null},clearMenu:function(){var e=s.getElementById(this.menuID);e&&e.parentNode.removeChild(e)},clearInputAndSave:function e(r){if(this.lastModified){if(!this.lastModified.isNew)try{var i=this.getStatementAbout(this.lastModified).object}catch(e){return}var s=this.lastModifiedStat;if(this.lastModified.value!==this.lastModified.defaultValue){if(""===this.lastModified.value)return this.lastModified.value=this.lastModified.defaultValue,void this.clearInputAndSave();if(this.lastModified.isNew){s=new a.rdf.Statement(s.subject,s.predicate,n.literal(this.lastModified.value),s.why);var u=this.views.defaults[s.predicate.uri],c=a.utils.ancestor(this.lastModified,"TR");try{a.store.updater.update([],[s],function(e,n,r){n||(a.log.error("Error occurs while inserting "+s+"\n\n"+r+"\n"),t.UserInput.deleteTriple(c.lastChild,!0))})}catch(e){return void a.log.error("Error inserting fact "+s+":\n\t"+e+"\n")}s=n.add(s.subject,s.predicate,n.literal(this.lastModified.value),s.why)}else{if(this.statIsInverse)return a.log.error("Invalid Input: a literal can't be a subject in RDF/XML"),void this.backOut();var d,h,f;switch(i.termType){case"Literal":var p=this.lastModified.value;c=a.utils.ancestor(this.lastModified,"TR");var m=this.lastModified.defaultValue;h=$rdf.st(s.subject,s.predicate,n.literal(this.lastModified.value),s.why);try{a.store.updater.update([s],[h],function(e,t,n){t?i.value=p:(a.log.warn("Error occurs while editing "+s+"\n\n"+n),c.lastChild.textContent=m),c.lastChild.className=c.lastChild.className.replace(/ pendingedit/g,"")})}catch(e){return void a.log.warn("Error occurs while editing "+s+":\n\t"+e)}break;case"BlankNode":var v=n.literal(this.lastModified.value,"");if("Collection"!==s.predicate.termType)return void this.fillInRequest("object",this.lastModified.parentNode,n.literal(this.lastModified.value));{var g=s.predicate.elements[0];if(n.any(void 0,g,v)){if(!r){var b=this.lastModified.parentNode;(r={}).pageX=a.utils.findPos(b)[0],r.pageY=a.utils.findPos(b)[1]+b.clientHeight}this.showMenu(r,"DidYouMeanDialog",void 0,{dialogTerm:n.any(void 0,g,v),bnodeTerm:s.subject})}else{d=a.utils.ancestor(a.utils.ancestor(this.lastModified,"TR").parentNode,"TR").AJAR_statement,h=$rdf.st(s.subject,g,v,s.why);var y=n.the(s.subject,l("type"));f=n.anyStatementMatching(s.subject,l("type"),y,s.why),c=a.utils.ancestor(a.utils.ancestor(this.lastModified,"TR"),"TD").parentNode;try{a.store.updater.update([],[d,h,f],function(e,n,r){n||(console.log("Error occurs while editing "+d+"\n\n"+r),t.UserInput.deleteTriple(c.lastChild,!0))})}catch(e){return void console.log("Error occurs while editing "+d+":\n\t"+e)}n.remove(s),n.add(s.subject,g,v,s.why)}var w=a.utils.ancestor(this.lastModified.parentNode.parentNode,"TD");const i=o.default;t.outlineExpand(w,s.subject,{pane:i,already:!0}),t.walk("right",t.focusTd)}}}}else{if(this.lastModified.isNew){var _=a.utils.ancestor(this.lastModified,"TR"),x=this.generateRequest("(To be determined. Re-type of drag an object onto this field)"),M=_.previousSibling.AJAR_statement;return this.formUndetStat(_,M.subject,M.predicate,x,M.why,!1),void(this.lastModified=null)}if("Collection"===s.predicate.termType){n.removeMany(s.subject);var k=a.utils.ancestor(a.utils.ancestor(this.lastModified,"TR").parentNode,"TR");return M=k.AJAR_statement,x=this.generateRequest("(To be determined. Re-type of drag an object onto this field)"),this.formUndetStat(k,M.subject,M.predicate,x,M.why,!1),t.replaceTD(t.outlineObjectTD(x,u),k.lastChild),void(this.lastModified=null)}if(this.statIsInverse){if("BlankNode"===s.subject.termType)return void this.backOut()}else if("BlankNode"===s.object.termType)return void this.backOut()}_=a.utils.ancestor(this.lastModified,"TR"),this.statIsInverse?t.replaceTD(t.outlineObjectTD(s.subject,u),_.lastChild):t.replaceTD(t.outlineObjectTD(n.literal(this.lastModified.value),u),_.lastChild),this.lastModified.value!==this.lastModified.defaultValue&&(_.lastChild.className+=" pendingedit"),this.lastModified=null}},deleteTriple:function(e,r){function i(){var e;for(e=o;1===e.childNodes.length;e=e.previousSibling);if(e===o){var t=e.nextSibling;if(t.nextSibling&&1===t.childNodes.length){var n=e.firstChild;n.setAttribute("rowspan",parseInt(n.getAttribute("rowspan"))-1),t.insertBefore(e.firstChild,t.firstChild)}o.parentNode.removeChild(o)}else(n=e.firstChild).setAttribute("rowspan",parseInt(n.getAttribute("rowspan"))-1),o.parentNode.removeChild(o)}if(a.log.debug("deleteTriple entered"),!r&&-1!==e.className.indexOf(" pendingedit"))return console.log("The node you attempted to edit has a request still pending.\nPlease wait for the request to finish (the text will turn black)\nbefore editing this node again."),void t.walk("up");var o,s=this.getStatementAbout(e);if(!(r||n.whether(s.object,l("type"),a.ns.link("Request"))||n.whether(s.predicate,l("type"),a.ns.link("Request"))||n.whether(s.subject,l("type"),a.ns.link("Request")))){a.log.debug("about to send SPARQLUpdate");try{a.store.updater.update([s],[],function(t,n,r){n?i():(console.log("Error occurs while deleting "+s+"\n\n"+r),e.className=e.className.replace(/ pendingedit/g,""))}),e.className+=" pendingedit"}catch(e){return a.log.error(e),void a.log.warn("Error deleting statement "+s+":\n\t"+e)}a.log.debug("SPARQLUpdate sent")}a.log.debug("about to remove "+s),a.log.debug("removed"),t.walk("up"),o=e.parentNode,r&&i()},clipboardInit:function(){t.clipboard={},t.clipboard.objects=[],t.clipboard.predicates=[],t.clipboard.all=[]},copyToClipboard:function(e,n){var r=a.utils.getTerm(n);switch(n.className){case"selected":case"obj selected":t.clipboard.objects.unshift(r);break;case"pred selected":case"pred internal selected":t.clipboard.predicates.unshift(r)}t.clipboard.all.unshift(r)},insertTermTo:function(e,i,o){switch(e.className){case"undetermined selected":var u=this.views.defaults[e.parentNode.AJAR_statement.predicate.uri];this.fillInRequest(e.nextSibling?"predicate":"object",e,i);break;case"pred selected":var l=this.appendToPredicate(e),c=e.parentNode.AJAR_statement;u=this.views.defaults[c.predicate.uri],l.appendChild(t.outlineObjectTD(i,u));var d=e.parentNode.AJAR_inverse;d?l.AJAR_statemnet=n.add(i,c.predicate,c.object,c.why):l.AJAR_statement=n.add(c.subject,c.predicate,i,c.why);try{a.store.updater.update([],[l.AJAR_statement],function(e,t,n){t||a.log.error("userinput.js (pred selected): Fail trying to insert statement "+l.AJAR_statement+": "+n)})}catch(e){return void a.log.error("Exception trying to insert statement "+l.AJAR_statement+": "+a.utils.stackString(e))}l.AJAR_inverse=d,r.statements.push(l.AJAR_statement);break;case"selected":var h=a.utils.ancestor(e,"TABLE").lastChild,f=h.insertBefore(s.createElement("tr"),h.lastChild);if(c=f.previousSibling.AJAR_statement,void 0===o&&(o=!0),o)this.formUndetStat(f,c.subject,this.generateRequest("(TBD)",f,!0),i,c.why,!1),f.appendChild(t.outlineObjectTD(i)),t.walk("moveTo",f.firstChild),this.startFillInText(f.firstChild);else{var p=this.generateRequest("(To be determined. Re-type of drag an object onto this field)",f);this.formUndetStat(f,c.subject,i,p,c.why,!1),f.insertBefore(t.outlinePredicateTD(i,f,!1,!1),f.firstChild),t.walk("moveTo",f.lastChild),this.startFillInText(f.lastChild)}}},Refill:function(e,t){a.log.info("Refill"+t.textContent);var r,i=t.nextSibling;if(i){if("undetermined"===t.nextSibling.className){var o=a.utils.getAbout(n,a.utils.ancestor(t,"TABLE").parentNode),s=n.any(o,l("type")),u=[];u[0]="SELECT ?pred WHERE{\n?pred "+l("type")+l("Property")+".\n?pred "+a.ns.rdfs("domain")+s+".}",u[1]="SELECT ?pred ?class\nWHERE{\n?pred "+l("type")+l("Property")+".\n"+s+a.ns.rdfs("subClassOf")+" ?class.\n?pred "+a.ns.rdfs("domain")+" ?class.\n}",u[2]="SELECT ?pred WHERE{\n"+o+l("type")+n.variable("subjectClass")+".\n"+n.variable("pred")+a.ns.rdfs("domain")+n.variable("subjectClass")+".\n}",r=u.map($rdf.SPARQLToQuery)}else{o=a.utils.getAbout(n,a.utils.ancestor(t,"TABLE").parentNode),s=n.any(o,l("type"));var c=t.parentNode.AJAR_statement.object;u="SELECT ?pred WHERE{"+o+l("type")+"?subjectClass.\n"+c+l("type")+"?objectClass.\n?pred "+a.ns.rdfs("domain")+"?subjectClass.\n?pred "+a.ns.rdfs("range")+"?objectClass.\n}",r=$rdf.SPARQLToQuery(u)}this.showMenu(e,"GeneralPredicateChoice",r,{isPredicate:i,selectedTd:t})}else{var d=t.parentNode.AJAR_statement.predicate;if((n.whether(d,l("type"),a.ns.owl("DatatypeProperty"))||"Collection"===d.termType||n.whether(d,a.ns.rdfs("range"),a.ns.rdfs("Literal")))&&(t.className="",a.utils.emptyNode(t),this.lastModified=this.createInputBoxIn(t," (Please Input) "),this.lastModified.isNew=!1,this.lastModified.select()),t.parentNode.AJAR_statement.predicate.sameTerm(l("type"))){let n="SELECT ?class WHERE{?class "+l("type")+a.ns.rdfs("Class")+".}";var h=$rdf.SPARQLToQuery(n);this.showMenu(e,"TypeChoice",h,{isPredicate:i,selectedTd:t})}}},getAutoCompleteHandler:function(e){var r;return u("\n\n***** In getAutoCompleteHandler ****** mode = "+e),"PredicateAutoComplete"===e?e="predicate":"JournalTAC"!==e&&(e="all"),r="JournalTAC"===e?s.getElementById("inpid_journal_title"):this.lastModified||t.getSelection()[0].firstChild,u("InputBox="+r),u("InputBox.value="+r.value),function(i){function o(e){e&&(d.lastHighlight&&(d.lastHighlight.className=""),d.lastHighlight=e,d.lastHighlight.className="activeItem",t.showURI(a.utils.getAbout(n,d.lastHighlight)))}u("ENTER EVENT="+i),u("1. outside (if eneterEvent)");var l={},c=r.parentNode;e||(e=c.nextSibling?"predicate":"all"),l.pageX=a.utils.findPos(c)[0],l.pageY=a.utils.findPos(c)[1]+c.clientHeight,u("epX="+l.pageX+", epY="+l.pageY+", mode="+e);var d=s.getElementById(t.UserInput.menuID);if(i){u("2. in (if enterEvent). with type = "+typeof i);var f=r.value;if("object"==typeof i)switch(u("3. in typeof enterEvent is object, will switch to keys, arrows, etc. keycode = "+i.keyCode),i.stopPropagation(),d&&!d.lastHighlight&&o(d.firstChild.firstChild),i.keyCode){case 13:case 9:if(u("handler: Enter or Tab"),!d)return void t.UserInput.clearInputAndSave();if(!d.lastHighlight)return"JournalTAC"===e?(t.UserInput.clearMenu(),u("no lastH"),"no lastH"):void 0;if("INPUT"===d.lastHighlight.tagName)switch(d.lastHighlight.value){case"New...":u("subcase New"),t.UserInput.createNew();break;case"GiveURI":u("subcase GiveURI"),t.UserInput.inputURI()}else{if("JournalTAC"===e){if(u("movedArrow? "+h),h&&d.lastHighlight){var p=d.lastHighlight.firstChild.firstChild.innerHTML,m=d.lastHighlight.firstChild.nextSibling.innerHTML;return["gotdptitle",p,m=m.slice(4,-4)]}return"asGivenTxt"}var v=a.utils.getAbout(n,d.lastHighlight),g="predicate"===e?"predicate":"object";t.UserInput.clearMenu(),t.UserInput.fillInRequest(g,r.parentNode,v)}return void u("outside");case 38:return u("handler: Arrow UP"),h=!0,""!==f||"TR"!==d.lastHighlight.tagName||d.lastHighlight.previousSibling?o(d.lastHighlight.previousSibling):o(d.firstChild.firstChild),"I'm a little Arrow Up";case 40:return u("handler: Arrow Down"),h=!0,"INPUT"===d.lastHighlight.tagName?o(d.childNodes[1].firstChild):o(d.lastHighlight.nextSibling),"I'm a little Down Arrow";case 37:case 39:return u("handler: Arrow left, right"),void("INPUT"===d.lastHighlight.tagName&&(37===i.keyCode?o(d.lastHighlight.previousSibling):o(d.lastHighlight.nextSibling)));case 8:u("handler: Backspace"),f=f.slice(0,-1);break;case 27:return u("handler: Esc"),d?void t.UserInput.clearMenu():void t.UserInput.backOut();default:u("handler: Default"),h=!1,u("oldtext="+f),f+=_StringfromCharCode(i.charCode),u("charcodent="+i.charCode),u("strcharcod="+_StringfromCharCode(i.charCode)),console.log("DEFAULT txtstr="+f+"\n")}return"all"===e?(u("generalAC after switch, newText="+f+"mode is all"),t.UserInput.clearMenu(),t.UserInput.showMenu(l,"GeneralAutoComplete",void 0,{inputText:f,selectedTd:c}),0===f.length&&t.UserInput.WildCardButtons()):"predicate"===e?(u("predicateAC after switch, newText="+f+"mode is predicate"),t.UserInput.clearMenu(),t.UserInput.showMenu(l,"PredicateAutoComplete",void 0,{inputText:f,isPredicate:!0,selectedTd:c})):"JournalTAC"===e&&(u("JouralTAC after switch, newText="+f),t.UserInput.clearMenu(),t.UserInput.showMenu(l,"JournalTitleAutoComplete",void 0,{inputText:f},"orderisuseless")),(d=s.getElementById(t.UserInput.menuID))?(u("at end of handler\n^^^^^^^^^^^^^^^^^\n\n"),o(d.firstChild.firstChild),t.showURI(a.utils.getAbout(n,d.lastHighlight)),"nothing to return"):void u("No menu element. Do not show menu.")}}},WildCardButtons:function(){var e=s.getElementById(t.UserInput.menuID),n=e.insertBefore(s.createElement("div"),e.firstChild),r=n.appendChild(s.createElement("input")),i=n.appendChild(s.createElement("input"));r.type="button",r.value="New...",i.type="button",i.value="Know its URI",n.addEventListener("mouseover",function(e){var n=s.getElementById(t.UserInput.menuID);n.lastHighlight&&(n.lastHighlight.className=""),n.lastHighlight=a.utils.ancestor(a.utils.getTarget(e),"INPUT"),n.lastHighlight&&(n.lastHighlight.className="activeItem")},!1),r.addEventListener("click",this.createNew,!1),i.addEventListener("click",this.inputURI,!1)},Keypress:function(e){if(13===e.keyCode)if("TEXTAREA"!==t.targetOf(e).tagName)this.clearInputAndSave();else{var n=parseInt(this.lastModified.getAttribute("rows"));this.lastModified.setAttribute("rows",(n+1).toString()),e.stopPropagation()}},Mousedown:function(t){u("MOUSING DOWN"),window.addEventListener("keypress",function(t){t.ctrlKey&&(115===t.charCode||113===t.charCode)&&e.switchMode()},!1),window.addEventListener("mousedown",e.Mousedown,!1),document.getElementById("outline").oncontextmenu=function(){return!1},2===t.button&&(e.switchMode(),t&&(t.preventDefault(),t.stopPropagation()))},Mouseover:function(e){if(this.className="bottom-border-active",1===this._tabulatorMode)switch(a.utils.getTarget(e).tagName){case"TD":var t=a.utils.getTarget(e);"pred"===t.className&&(t.style.cursor="copy");break;case"DIV":var n=a.utils.getTarget(e);"bottom-border"===a.utils.getTarget(e).className&&(n.style.borderColor="rgb(100%,65%,0%)",n.style.cursor="copy")}},Mouseout:function(e){if(this.className="bottom-border",1===this._tabulatorMode){var t=a.utils.getTarget(e);"bottom-border"===a.utils.getTarget(e).className&&(t.style.borderColor="transparent",t.style.cursor="auto")}},whatSortOfEditCell:function(e){if(e.nextSibling)return"predicate";var t=this.getStatementAbout(e).predicate;return n.whether(t,a.ns.rdf("type"),a.ns.owl("DatatypeProperty"))||n.whether(t,a.ns.rdfs("range"),a.ns.rdfs("Literal"))||"Collection"===t.termType?"DatatypeProperty-like":n.whether(t,l("type"),a.ns.owl("ObjectProperty"))?"ObjectProperty-like":"no-idea"},getStatementAbout:function(e){var t=a.utils.ancestor(e,"TR");if(!t)throw new Error("No ancestor TR for the TD we clicked on:"+e);try{var n=t.AJAR_statement}catch(n){throw new Error("No AJAR_statement!"+e+e.textContent+" has ancestor "+t)}return this.lastModifiedStat=t.AJAR_statement,this.statIsInverse=t.AJAR_inverse,n},createInputBoxIn:function(e,n){a.log.info("myDocument in createInputBoxIn is now "+s.location),a.log.info("outline.document is now "+t.document.location);var r=s.createElement("input");return r.setAttribute("value",n),r.setAttribute("class","textinput"),"undetermined selected"!==e.className&&(r.setAttribute("size","100"),r.addEventListener("keypress",function(e){(38===e.keyCode||40===e.keyCode)&&(t.OutlinerKeypressPanel(e),t.UserInput.clearInputAndSave())},!1)),e.appendChild(r),r},createNew:function(e){t.UserInput.clearMenu();var r=t.getSelection()[0],i=r.parentNode.AJAR_statement.why,a=n.nextSymbol(i);t.UserInput.fillInRequest("object",r,a),t.outlineExpand(t.getSelection()[0],a)},inputURI:function(e){var r=t.UserInput;r.clearMenu();var i=t.getSelection()[0];a.utils.emptyNode(i);var o=" (Type a URI) ";r.lastModified=r.createInputBoxIn(i,o),r.lastModified.select(),r.lastModified.addEventListener("keypress",function(e){switch(e.stopPropagation(),e.keyCode){case 13:case 9:if(this.value!==o){var t=this.value;r.fillInRequest("object",i,n.sym(t))}}},!1)},appendToPredicate:function(e){var t,n=!1;try{for(t=e.parentNode.nextSibling;1===t.childNodes.length&&t.AJAR_statement;t=t.nextSibling);}catch(e){n=!0}var r=s.createElement("tr");if(r.style.colspan="1",r.style.display="block",r.style.display="",e.hasAttribute("rowspan")&&e.setAttribute("rowspan",parseInt(e.getAttribute("rowspan"))+1),e.hasAttribute("rowspan")||e.setAttribute("rowspan","2"),n){var i=e.parentNode.parentNode;"defaultPane"===i.className?i.insertBefore(r,i.lastChild):i.appendChild(r)}else t.parentNode.insertBefore(r,t);return r},bnode2symbol:function(e,t){n.copyTo(e,t,["two-direction","delete"])},generateRequest:function(e,n,r,o){var s;o||(s=n||a.utils.ancestor(this.lastModified,"TR"),a.utils.emptyNode(s));var u,l=i,c=l.bnode();(l.add(c,a.ns.rdf("type"),a.ns.link("Request")),e.length,l.add(c,a.ns.link("message"),l.literal(e)),l.add(c,a.ns.link("to"),l.literal("The User")),l.add(c,a.ns.link("from"),l.literal("The User")),o)||((u=r?s.appendChild(t.outlinePredicateTD(c,s,!1,!1)):s.appendChild(t.outlineObjectTD(c))).className="undetermined",u.textContent=e);return c},showMenu:function e(r,i,o,h,f){function p(e){w.firstChild&&"no-suggest"===w.firstChild.className&&w.removeChild(w.firstChild);var t=a.utils.predicateLabelForXML(e,!1);if(e.uri){var n="??";for(var r in E)if(a.log.debug(E[r]),a.rdf.Util.string_startswith(e.uri,E[r])){n=r;break}var i=w.appendChild(s.createElement("tr"));i.setAttribute("about",e),i.appendChild(s.createElement("th")).appendChild(s.createElement("div")).appendChild(s.createTextNode(t)),i.appendChild(s.createElement("td")).appendChild(s.createTextNode(n.toUpperCase()))}}function m(e){return function(t){p(t[e.vars[0]])}}a.log.info("myDocument is now "+s.location),a.log.info("outline.doucment is now "+t.document.location);var v=this,g=s.createElement("div");if(u("\n**** In showMenu, menuType = "+i+"\n"),h)for(var b in h)console.log("\t extra "+b+": "+h[b]+"\n");console.log("CREATED MENU\n"),g.id=this.menuID,g.className="outlineMenu",g.style.top=r.pageY+"px",g.style.left=r.pageX+"px";if("JournalTitleAutoComplete"===i){var y=function(e){for(var t=0,n=0,r=0,i=0,a=0,o=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)a=e.offsetLeft,o=e.offsetTop,a!==r&&(t+=e.offsetLeft-e.scrollLeft),o!==i&&(n+=e.offsetTop-e.scrollTop),r=a,i=o,e=e.parentNode;return{top:n+54,left:t-38}}(s.getElementById("inpid_journal_title"));y.left-=s.getElementById("inpid_journal_title").scrollTop,g.style.top=y.top+"px",g.style.left=y.left+"px"}console.log("menu at top="+g.style.top+" left="+g.style.left+"\n"),s.body.appendChild(g);var w=g.appendChild(s.createElement("table"));switch(g.lastHighlight=null,w.addEventListener("mouseover",function(e){g.lastHighlight&&(g.lastHighlight.className=""),g.lastHighlight=a.utils.ancestor(a.utils.getTarget(e),"TR"),g.lastHighlight&&(g.lastHighlight.className="activeItem")},!1),i){case"DidYouMeanDialog":var _=function(e){u("DID YOU MEAN SELECT ITEM!!!!!");var r=a.utils.ancestor(a.utils.getTarget(e),"TR");2===r.childNodes.length&&r.nextSibling?(n.add(T,j,O),t.UserInput.clearMenu()):2===r.childNodes.length&&t.UserInput.clearMenu()};break;case"LimitedPredicateChoice":var x=h.clickedTd;_=function(e){u("LIMITED P SELECT ITEM!!!!");for(var r=a.utils.getAbout(n,a.utils.getTarget(e)),i=x.parentNode.AJAR_statement.predicate.elements,o=0;o<i.length;o++)i[o].sameTerm(r)&&i.unshift(i.splice(o,1)[0]);t.UserInput.clearMenu();var s=x.parentNode,l=t.outlinePredicateTD(s.AJAR_statement.predicate,s);s.insertBefore(l,x),s.removeChild(x),v.lastModified.select()};break;case"PredicateAutoComplete":case"GeneralAutoComplete":case"GeneralPredicateChoice":case"JournalTitleAutoComplete":case"TypeChoice":var M=h.isPredicate,k=h.selectedTd;_=function(e){u("WOOHOO");var r=a.utils.getAbout(n,a.utils.getTarget(e));u("GENERAL SELECT ITEM!!!!!!="+r),u("target="+a.utils.getTarget(e)),M?(u("1"),t.UserInput.fillInRequest("predicate",k,r)&&(u("2"),t.UserInput.clearMenu())):(u("3"),t.UserInput.fillInRequest("object",k,r)&&(u("4"),t.UserInput.clearMenu()))};break;default:throw new Error("userinput: unexpected mode")}w.addEventListener("click",_,!1);var C,E={};switch(n.each(void 0,a.ns.rdf("type"),a.ns.owl("Ontology")).map(function(e){var t=a.utils.label(e);if(t){var n=t.value.match(/\((.+?)\)/);n?E[n[1]]=e.uri:E[t.value]=e.uri}}),i){case"DidYouMeanDialog":var A=h.dialogTerm,T=h.bnodeTerm;g.style.width="auto";var S=w.appendChild(s.createElement("tr")).appendChild(s.createElement("th"));S.appendChild(s.createTextNode("Did you mean..."));var I,N=n.statementsMatching(A);for(I=0;I<N.length&&!n.whether(N[I].predicate,l("type"),a.ns.owl("InverseFunctionalProperty"));I++);var j=N[I].predicate,O=n.any(A,N[I].predicate),R=a.utils.label(A)+" who has "+a.utils.label(j)+" "+O+"?",L=w.appendChild(s.createElement("tr")).appendChild(s.createElement("th"));L.appendChild(s.createTextNode(R)),S.setAttribute("colspan","2"),L.setAttribute("colspan","2");var P=w.appendChild(s.createElement("tr"));P.appendChild(s.createElement("th")).appendChild(s.createTextNode("Yes")),P.appendChild(s.createElement("td")).appendChild(s.createTextNode("BOOLEAN"));var D=w.appendChild(s.createElement("tr"));D.appendChild(s.createElement("th")).appendChild(s.createTextNode("No")),D.appendChild(s.createElement("td")).appendChild(s.createTextNode("BOOLEAN"));break;case"PredicateAutoComplete":C=h.inputText;let r=t.labeller.searchAdv(C,void 0,"predicate"),f=[];for(let t=0;t<r.length;t++){var B={vars:[]};B.vars.push("Kenny");var U={Kenny:n.fromNT(r[t].NT)};try{m(B)(U)}catch(e){throw new Error("I'll deal with bnodes later...[Kenny]"+e)}}let b=f[0];if(0===b.length)return console.log("cm length 0\n"),void this.clearMenu();for(let e=0;e<b.length&&10>e;e++)p(b[e][1]);break;case"GeneralAutoComplete":C=h.inputText;try{f=t.labeller.search(C)}catch(e){console.log("GeneralAutoComplete: debug me "+h.selectedTd.textContent+"\n"+e+"\n")}b=f[0];var q=f[1];if(0===b.length)return console.log("cm length 0\n"),void this.clearMenu();for(let e=0;e<b.length&&10>e;e++){var F=b[e][1].toNT(),z=w.appendChild(s.createElement("tr"));z.setAttribute("about",F);var H=z.appendChild(s.createElement("th"));H.appendChild(s.createElement("div")).appendChild(s.createTextNode(b[e][0]));var W=q[e],V=W?a.utils.label(W):"";z.appendChild(s.createElement("td")).appendChild(s.createTextNode(V))}break;case"JournalTitleAutoComplete":C=h.inputText,console.log("testing searching text= "+C+" =====\n"),console.log("\n===start JournalTitleAutoComplete\n");var J=n.each(void 0,l("type"),c("Journal")),G=[];for(let e=0;e<J.length;e++){var K=J[e],$=n.each(K,d("title"),void 0),X=$+"",Z=C.toLowerCase();if(-1!==X.toLowerCase().search(Z)){u("FOUND A Journal Title Match!!!!!!"),G.push($);let e=w.appendChild(s.createElement("tr"));e.setAttribute("about","journalTitle"),e.appendChild(s.createElement("th")).appendChild(s.createElement("div")).appendChild(s.createTextNode($)),e.appendChild(s.createElement("td")).appendChild(s.createTextNode(K))}}console.log("matched: "+G+"\n"),console.log("\\\\done showMenu's JTAutocomplete\n");break;case"LimitedPredicateChoice":var Y=a.utils.getAbout(n,h.clickedTd);Y.termType="Collection";var Q=n.each(Y,a.ns.link("element"));for(let e=0;e<Q.length;e++)p(Q[e]);break;default:(z=w.appendChild(s.createElement("tr"))).className="no-suggest",(H=z.appendChild(s.createElement("th"))).appendChild(s.createElement("div")).appendChild(s.createTextNode("No suggested choices. Try to type instead.")),z.appendChild(s.createElement("td")).appendChild(s.createTextNode("OK")),z.addEventListener("click",function(e){v.clearMenu(),e.stopPropagation()},"false");var ee=function(){};switch(o.constructor.name){case"Array":for(let e=0;e<o.length;e++)n.query(o[e],m(o[e]),ee);break;case"undefined":throw new Error("addPredicateChoice: query is not defined");default:n.query(o,m(o),ee)}}},fillInRequest:function(e,o,s){var u,l,c=o.parentNode;u=c.AJAR_statement,l=c.AJAR_inverse;var d,h="object"===e?u.object:u.predicate,f=!1;if(n.any(h,a.ns.link("onfillin")),"predicate"===e){let r=t.outlinePredicateTD(s,c,!1,!1);if("undetermined"!==o.nextSibling.className){var p=new a.rdf.Statement(u.subject,s,u.object,u.why);try{a.store.updater.update([],[p],function(e,t,i){t?(d=n.anyStatementMatching(u.subject,s,u.object,u.why),c.AJAR_statement=d,r.className=r.className.replace(/ pendingedit/g,"")):a.log.warn("Failure occurs (#2) while inserting "+c.AJAR_statement+"\n\n"+i)})}catch(e){return a.log.error(e),void a.log.warn("Error when insert (#2) of statement "+p+":\n\t"+e)}r.className+=" pendingedit",this.lastModified=null}else this.formUndetStat(c,u.subject,s,u.object,u.why,!1),t.walk("right"),f=!0;t.replaceTD(r,o),i.remove(u)}else if("object"===e){let e=t.outlineObjectTD(s);if(t.replaceTD(e,o),o.previousSibling&&"undetermined"===o.previousSibling.className)t.walk("left"),f=!0;else{let t;t=l?new a.rdf.Statement(s,u.predicate,u.object,u.why):new a.rdf.Statement(u.subject,u.predicate,s,u.why);try{a.store.updater.update([],[t],function(r,i,o){var d;a.log.info("@@ usinput.js (object) callback ok="+i+" for statement:"+t+"\n "),i?(e.className=e.className.replace(/ pendingedit/g,""),!(d=l?n.statementsMatching(s,u.predicate,u.object,u.why):n.statementsMatching(u.subject,u.predicate,s,u.why)).length&&a.log.error("userinput.js 1711: Can't find statememt!"),c.AJAR_statement=d[0]):a.log.warn("userinput.js (object): Fail trying to insert statement "+t)})}catch(e){return a.log.error("userinput.js (object): exception trying to insert statement "+t+": "+a.utils.stackString(e)),void a.log.warn("Error trying to insert statement "+t+":\n"+e)}this.lastModified=null,e.className+=" pendingedit"}i.remove(u)}return r.statements.push(d),!f||void this.startFillInText(t.getSelection()[0])},formUndetStat:function(e,t,n,r,a,o){return e.AJAR_inverse=o,e.AJAR_statement=i.add(t,n,r,a),e.AJAR_statement}}}},function(e,t,n){var r=e.exports={},i=n(0);r.src=[],r.tooltips=[],r.src.icon_expand=i.icons.originalIconBase+"tbl-expand-trans.png",r.src.icon_more=i.icons.originalIconBase+"tbl-more-trans.png",r.src.icon_collapse=i.icons.originalIconBase+"tbl-collapse.png",r.src.icon_internals=i.icons.originalIconBase+"tango/22-emblem-system.png",r.src.icon_instances=i.icons.originalIconBase+"tango/22-folder-open.png",r.src.icon_foaf=i.icons.originalIconBase+"foaf/foafTiny.gif",r.src.icon_social=i.icons.originalIconBase+"social/social.gif",r.src.icon_mb=i.icons.originalIconBase+"microblog/microblog.png",r.src.icon_shrink=i.icons.originalIconBase+"tbl-shrink.png",r.src.icon_rows=i.icons.originalIconBase+"tbl-rows.png",r.src.icon_unrequested=i.icons.originalIconBase+"16dot-blue.gif",r.src.icon_fetched=i.icons.originalIconBase+"16dot-green.gif",r.src.icon_failed=i.icons.originalIconBase+"16dot-red.gif",r.src.icon_requested=i.icons.originalIconBase+"16dot-yellow.gif",r.src.icon_CVPane=i.icons.originalIconBase+"CV.png",r.src.icon_defaultPane=i.icons.originalIconBase+"about.png",r.src.icon_visit=i.icons.originalIconBase+"tango/22-text-x-generic.png",r.src.icon_dataContents=i.icons.originalIconBase+"rdf_flyer.24.gif",r.src.icon_n3Pane=i.icons.originalIconBase+"w3c/n3_smaller.png",r.src.icon_RDFXMLPane=i.icons.originalIconBase+"22-text-xml4.png",r.src.icon_imageContents=i.icons.originalIconBase+"tango/22-image-x-generic.png",r.src.icon_airPane=i.icons.originalIconBase+"1pt5a.gif",r.src.icon_LawPane=i.icons.originalIconBase+"law.jpg",r.src.icon_pushbackPane=i.icons.originalIconBase+"pb-logo.png",r.src.icon_photoPane=i.icons.originalIconBase+"photo_small.png",r.src.icon_tagPane=i.icons.originalIconBase+"tag_small.png",r.src.icon_TinyTag=i.icons.originalIconBase+"tag_tiny.png",r.src.icon_photoBegin=i.icons.originalIconBase+"photo_begin.png",r.src.icon_photoNext=i.icons.originalIconBase+"photo_next.png",r.src.icon_photoBack=i.icons.originalIconBase+"photo_back.png",r.src.icon_photoEnd=i.icons.originalIconBase+"photo_end.png",r.src.icon_photoImportPane=i.icons.originalIconBase+"flickr_small.png",r.src.icon_retract=i.icons.originalIconBase+"retract.gif",r.src.icon_refresh=i.icons.originalIconBase+"refresh.gif",r.src.icon_optoff=i.icons.originalIconBase+"optional_off.PNG",r.src.icon_opton=i.icons.originalIconBase+"optional_on.PNG",r.src.icon_map=i.icons.originalIconBase+"compassrose.png",r.src.icon_retracted=r.src.icon_unrequested,r.src.icon_retracted=r.src.icon_unrequested,r.src.icon_time=i.icons.originalIconBase+"icons/Wclocksmall.png",r.src.icon_telephone=i.icons.originalIconBase+"silk/telephone.png",r.src.icon_time=i.icons.originalIconBase+"Wclocksmall.png",r.src.icon_remove_node=i.icons.originalIconBase+"tbl-x-small.png",r.src.icon_add_triple=i.icons.originalIconBase+"tango/22-list-add.png",r.src.icon_add_new_triple=i.icons.originalIconBase+"tango/22-list-add-new.png",r.src.icon_show_choices=i.icons.originalIconBase+"userinput_show_choices_temp.png",r.src.icon_display_reasons=i.icons.originalIconBase+"tango/22-help-browser.png",r.tooltips[r.src.icon_display_reasons]="Display explanations",r.tooltips[r.src.icon_add_triple]="Add more",r.tooltips[r.src.icon_add_new_triple]="Add one",r.tooltips[r.src.icon_remove_node]="Remove",r.tooltips[r.src.icon_expand]="View details.",r.tooltips[r.src.icon_collapse]="Hide details.",r.tooltips[r.src.icon_shrink]="Shrink list.",r.tooltips[r.src.icon_internals]="Under the hood",r.tooltips[r.src.icon_instances]="List",r.tooltips[r.src.icon_foaf]="Friends",r.tooltips[r.src.icon_rows]="Make a table of data like this",r.tooltips[r.src.icon_unrequested]="Fetch this.",r.tooltips[r.src.icon_fetched]="Fetched successfully.",r.tooltips[r.src.icon_failed]="Failed to load. Click to retry.",r.tooltips[r.src.icon_requested]="This is being fetched. Please wait...",r.tooltips[r.src.icon_visit]="View document",r.tooltips[r.src.icon_retract]="Remove this source and all its data from tabulator.",r.tooltips[r.src.icon_refresh]="Refresh this source and reload its triples.",r.OutlinerIcon=function(e,t,n,r,i){return this.src=e,this.alt=n,this.width=t,this.tooltip=r,this.filter=i,this},r.termWidgets={},r.termWidgets.optOn=new r.OutlinerIcon(r.src.icon_opton,20,"opt on","Make this branch of your query mandatory."),r.termWidgets.optOff=new r.OutlinerIcon(r.src.icon_optoff,20,"opt off","Make this branch of your query optional."),r.termWidgets.addTri=new r.OutlinerIcon(r.src.icon_add_triple,18,"add tri","Add one")},function(e,t,n){var r=n(0),i=e.exports={};i.util={},i.util.Event=function(){var e=[];return{on:function(t,n,r,i,a){var o=function(e){return r.call(i,e,i)};t.addEventListener(n,o,!1);var s=[t,n,a,o];e.push(s)},off:function(t,n,r){var i=this._getCacheIndex(t,n,r);if(-1===i)return!1;var a=e[i];return t.removeEventListener(n,a[this.WFN],!1),delete e[i][this.WFN],delete e[i][this.FN],e.splice(i,1),!0},EL:0,TYPE:1,FNID:2,WFN:3,_getCacheIndex:function(t,n,r){for(var i,a=0,o=e.length;a<o;++a)if((i=e[a])&&i[this.FNID]===r&&i[this.EL]===t&&i[this.TYPE]===n)return a;return-1}}}(),i.util.DDExternalProxy=function(e){this.initTarget(e)},i.util.DDExternalProxy.prototype={initTarget:function(e){this.DDM=i.util.DDM,this.el=e},b4StartDrag:function(e,t){a.onDragStart(e,t,this.el)},b4Drag:function(e){},handleMouseDown:function(e,t){1<(e.which||e.button)||this.DDM.handleMouseDown(e,this)}},i.util.DDM={handleMouseDown:function(e,t){this.dragCurrent=t;var n=t.el;this.startX=e.pageX,this.startY=e.pageY,this.deltaX=this.startX-n.offsetLeft,this.deltaY=this.startY-n.offsetTop,this.dragThreshMet=!1},handleMouseMove:function(e){if(!this.dragCurrent)return!0;if(i.util.Event.isIE&&!e.button)return i.log("button failure","info","DragDropMgr"),this.stopEvent(e),this.handleMouseUp(e);if(!this.dragThreshMet){var t=_Mathabs(this.startX-e.pageX),n=_Mathabs(this.startY-e.pageY);(t>this.clickPixelThresh||n>this.clickPixelThresh)&&this.startDrag(this.startX,this.startY)}return this.dragThreshMet,e.preventDefault(),!0},handleMouseUp:function(e){this.dragCurrent&&(i.util.Event.off(this.dragCurrent.el,"mousemove","dragMouseMove"),i.util.Event.off(this.dragCurrent.el,"mouseup","dragMouseUp"),i.util.Event.off(this.dragCurrent.el,"mouseup","dragMouseUp"),this.dragThreshMet&&(a.onDropInside(e.target),this.dragThreshMet=!1),this.dragCurrent=null)},startDrag:function(e,t){this.dragCurrent&&this.dragCurrent.b4StartDrag(e,t),this.dragThreshMet=!0},clickPixelThresh:3};var a={onDrop:function(e,t,n){var i=r.utils.ancestor(r.utils.ancestor(e.originalTarget,"TABLE").parentNode,"TABLE").outline.selection,a=t.flavour.contentType,o=transferUtils.retrieveURLFromData(t.data,a);if(o){if("application/x-moz-file"===a&&0===t.data.fileSize){var s=$rdf.sym("chrome://tabulator/content/internalKnowledge.n3#defaultNew");r.store.copyTo(s,$rdf.sym(o))}var u=i[0];r.utils.ancestor(r.utils.ancestor(u,"TABLE").parentNode,"TABLE").outline.UserInput.insertTermTo(u,$rdf.sym(o))}},onDragEnter:function(e,t){try{var n=r.utils.ancestor(r.utils.ancestor(e.originalTarget,"TABLE").parentNode,"TABLE").outline.selection}catch(e){return}for(var a=e.originalTarget;a;a=a.parentNode)if(a.tabulatorSelect){if(n[0]){try{n[0].tabulatorDeselect()}catch(e){throw new Error(n[0]+" causes "+e)}i.util.Event.off(a,"mouseup","dragMouseUp")}a.tabulatorSelect();break}},onDragExit:function(e,t){},onDropInside:function(e){e.ownerDocument.getElementById("outline").outline.UserInput.insertTermTo(e,r.utils.getAbout(r.store,this.dragTarget))},onDragStart:function(e,t,n){this.dragTarget=n;var i=Components.interfaces.nsIDragService,a={action:i.DRAGDROP_ACTION_COPY+i.DRAGDROP_ACTION_MOVE+i.DRAGDROP_ACTION_LINK},o=n.ownerDocument.getBoxObjectFor(n),s=Components.classes["@mozilla.org/gfx/region;1"].createInstance(Components.interfaces.nsIScriptableRegion);s.init(),s.unionRect(o.screenX,o.screenY,o.width,o.height);var u={data:null},l=r.Util.getTerm(n);switch(l.termType){case"NamedNode":u.data=this.URItoTransferDataSet(l.uri);break;case"BlankNode":u.data=this.URItoTransferDataSet(l.toNT());break;case"Literal":u.data=this.URItoTransferDataSet(l.value)}u=u.data;var c=Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray),d=nsTransferable.set(u.dataList[0]);c.AppendElement(d.QueryInterface(Components.interfaces.nsISupports)),this.mDragService.invokeDragSession(n,c,s,a.action)},getSupportedFlavours:function(){var e=new FlavourSet;return e.appendFlavour("text/x-moz-url"),e.appendFlavour("text/unicode"),e.appendFlavour("application/x-moz-file","nsIFile"),e},URItoTransferDataSet:function(e){var t=new TransferDataSet,n=new TransferData;return n.addDataForFlavour("text/x-moz-url",e),n.addDataForFlavour("text/unicode",e),t.push(n),t},_mDS:null,get_mDragService:function(){if(!this._mDS){var e=Components.interfaces.nsIDragService;this._mDS=Components.classes["@mozilla.org/widget/dragservice;1"].getService(e)}return this._mDS},DDM:i.util.DDM}},function(e,t,n){(function(t){var r=n(4),i=n(276),a=n(275),o=n(274),s=n(0),u=n(273);e.exports=function(e){function n(e,t,n){var i=I.createElement("tr");i.setAttribute("class","hoverControl");var a=i.appendChild(I.createElement("td"));a.setAttribute("style","margin: 0.2em; border: none; padding: 0; vertical-align: top;"),a.setAttribute("notSelectable","false"),a.setAttribute("about",e.toNT()),a.setAttribute("colspan","2"),a.appendChild(s.utils.AJARImage(s.icons.originalIconBase+"tbl-collapse.png","collapse",void 0,I)).addEventListener("click",b);var o=a.appendChild(I.createElement("strong"));o.appendChild(I.createTextNode(s.utils.label(e))),s.widgets.makeDraggable(o,e),i.firstPane=null;var u=0,c=[],d=[];t&&(i.firstPane=t);for(var h=0;h<r.list.length;h++){let n=r.list[h];var f=n.label(e,I);f&&(c.push(n),n===t&&(u=c.length-1),d.push(f),!i.firstPane&&n.shouldGetFocus&&n.shouldGetFocus(e)&&(i.firstPane=n,u=c.length-1,s.log.info("the "+h+"th pane steals the focus")))}if(c.length||c.push(r.internalPane),i.firstPane=i.firstPane||c[0],1!==c.length)for(let t,r=0;r<c.length;r++){t=c[r];var p=s.utils.AJARImage(t.icon,d[r],d[r],I);p.style.maxWidth="24px",p.style.maxHeight="24px";(function(t,r){t.addEventListener("click",function(i){for(var o=a;o.parentNode&&"TABLE"!==o.nodeName;o=o.parentNode);if("TABLE"!==o.nodeName)throw new Error("outline: internal error.");var u=function(e){for(var t=o.firstChild;t;t=t.nextSibling)void 0!==t.pane&&(e&&t.pane!==e||(t.paneButton&&t.paneButton.setAttribute("class","paneHidden"),l(t),t.pane.requireQueryButton&&o.parentNode.className&&1===c&&I.getElementById("queryButton")&&I.getElementById("queryButton").setAttribute("style","display:none;")))};"paneHidden"===t.getAttribute("class")?(!i.shiftKey&&u(),function(r){var i;if(s.log.info("outline: Rendering pane (2): "+r.name),s.no_catch_pane_errors)i=r.render(e,I,n);else try{i=r.render(e,I,n)}catch(r){(i=I.createElement("div")).setAttribute("class","exceptionPane");var a=I.createElement("pre");i.appendChild(a),a.appendChild(I.createTextNode(s.utils.stackString(r)))}r.requireQueryButton&&I.getElementById("queryButton")&&I.getElementById("queryButton").removeAttribute("style");var u=o.firstChild.nextSibling;u?o.insertBefore(i,u):o.appendChild(i),i.pane=r,i.paneButton=t}(r),t.setAttribute("class","paneShown")):(u(r),t.setAttribute("class","paneHidden"));for(var c=0,d=o.firstChild;d;d=d.nextSibling)d.pane&&d.pane.requireQueryButton&&c++},!1)})(p,t),p.setAttribute("class",r===u?"paneShown":"paneHidden"),r===u&&(i.paneButton=p),i.firstChild.childNodes[1].appendChild(p)}return i.firstChild.tabulatorSelect=function(){m(this,!0)},i.firstChild.tabulatorDeselect=function(){m(this,!1)},i}function l(e){var t=e.parentNode,n=t.parentNode,r=I.createElement("table");r.setAttribute("style","width: 100%;"),n.replaceChild(r,t),t.removeChild(e),n.replaceChild(t,r)}function c(e,t,n){var r=e.createElement("TR");r.AJAR_statement=t,r.AJAR_inverse=n,r.setAttribute("predTR","true");var i=R.outlinePredicateTD(t.predicate,r,n);return r.appendChild(i),r}function d(e){var t=e.getAttribute("class");return t&&0<=t.indexOf("selected")}function h(e){var t=R.targetOf(e).parentNode;q.replaceIcon(t.parentNode,a.termWidgets.optOn,a.termWidgets.optOff,f),t.parentNode.parentNode.removeAttribute("optional")}function f(e){var t=R.targetOf(e).parentNode;q.replaceIcon(t.parentNode,a.termWidgets.optOff,a.termWidgets.optOn,h),t.parentNode.parentNode.setAttribute("optional","true")}function p(e,t){for(var n=a.termWidgets.optOn,r=a.termWidgets.optOff,i=e;i.parentNode;i=i.parentNode)for(;;){if(i.getAttribute("predTR")){var o=i.getAttribute("parentOfSelected");0===(o=o?parseInt(o):0)&&0<t&&q.addIcon(i.childNodes[0],i.getAttribute("optional")?n:r,i.getAttribute("optional")?h:f),o+=t,i.setAttribute("parentOfSelected",o),0===o&&(i.removeAttribute("parentOfSelected"),q.removeIcon(i.childNodes[0],i.getAttribute("optional")?n:r));break}if(!i.previousSibling||"TR"!==i.previousSibling.nodeName)break;i=i.previousSibling}}function m(e,t){if("TD"!==e.nodeName)throw s.log.debug("down"+e.nodeName),new Error("Expected TD in setSelected: "+e.nodeName+" : "+e.textContent);s.log.debug("pass");var n=e.getAttribute("class");if(n||(n=""),t){(0<=(n+=" selected").indexOf("pred")||0<=n.indexOf("obj"))&&p(e,1),L.push(e);var r=s.utils.getTerm(e);R.showURI(r);var i=e.AJAR_statement;if(void 0===i&&(i=e.parentNode.AJAR_statement),i){var o=i.why,u=s.store.updater.editable(o.uri,P);u&&0<=n.indexOf("pred")&&q.addIcon(e,a.termWidgets.addTri)}}else s.log.debug("cla=$"+n+"$"),"selected"===n&&(n=""),(0<=(n=n.replace(" selected","")).indexOf("pred")||0<=n.indexOf("obj"))&&p(e,-1),0<=n.indexOf("pred")&&q.removeIcon(e,a.termWidgets.addTri),L=L.filter(function(t){return t===e}),s.log.info("Deselecting "+e.textContent);"undefined"!=typeof sourceWidget&&R.showSource(),e.setAttribute("class",n)}function v(){for(let e=L.length-1;0<=e;e--)m(L[e],!1);L=[]}function g(e){var t=R.targetOf(e),n=t.parentNode,i=s.utils.getAbout(P,t);e.altKey&&r.internalPane;e.shiftKey?E(n,i):e.altKey?k(n,i,{pane:r.internalPane,immediate:!0}):k(n,i)}function b(e){var t=R.targetOf(e),n=s.utils.getAbout(P,t);e.altKey&&r.internalPane;C(t.parentNode,n)}function y(e){var t=R.targetOf(e).getAttribute("uri");e.altKey?D.fetch(s.rdf.uri.docpart(t),{force:!0}):D.refresh(P.sym(s.rdf.uri.docpart(t)))}function w(e){var t=R.targetOf(e).getAttribute("uri");e.altKey?D.fetch(s.rdf.uri.docpart(t),{force:!0}):D.refresh(P.sym(s.rdf.uri.docpart(t)))}function _(e){var t=R.targetOf(e).getAttribute("uri");D.fetch(s.rdf.uri.docpart(t))}function x(e){var t=R.targetOf(e),n=t.node;1<n.childNodes.length&&(n=t.parentNode),l(n)}function M(e){if(R.UserInput._tabulatorMode)return R.UserInput.Click(e);var t,n=R.targetOf(e);for(t=s.utils.ancestor(n,"TD");t&&"false"!==t.getAttribute("notSelectable");t=s.utils.ancestor(t.parentNode,"TD"));if(t){var r=d(t);if(s.log.debug("Was node selected before: "+r),e.altKey)m(t,!d(t));else if(e.shiftKey)m(t,!0);else{if(v(),R.UserInput.clearInputAndSave(e),m(t,!0),2===e.detail)return void e.stopPropagation();var i=t.parentNode.AJAR_statement;if(!i)return;let n=i.why;var a=s.store.updater.editable(n.uri,P);r&&a&&R.UserInput.Click(e,L[0])}s.log.debug("Was node selected after: "+d(t)+", count="+L.length),e.stopPropagation()}}function k(e,t,n){function r(){if(c=P.canon(c),!e||!e.parentNode||!e.parentNode.parentNode)return!1;var t;if(s.log.info("@@ REPAINTING "),u){for(s.log.info(" ... p is "+e),t=e.firstChild;t.nextSibling&&(s.log.info(" ... checking node "+t),"table"!==t.nodeName);t=t.nextSibling);t=U(c,t,o,n)}else t=U(c,void 0,o,n);u=!0,t.style.backgroundColor=s.utils.ancestor(e,"TABLE")&&"white"===s.utils.ancestor(e,"TABLE").style.backgroundColor?"#eee":"white";try{i.util.Event.off&&i.util.Event.off(e,"mousedown","dragMouseDown")}catch(t){console.log("YAHOO "+t)}s.utils.emptyNode(e).appendChild(t),R.focusTd=e,s.log.debug("expand: Node for "+c+" expanded");for(var r=P.each(c,s.ns.rdfs("seeAlso")),a=0;a<r.length;a++)25===a&&s.log.warn("expand: Warning: many ("+r.length+") seeAlso links for "+c),D.lookUpThing(r[a],c)}function a(e){if(arguments[3])return!0;var t=P.canon(c);s.log.info("@@ expand: relevant subject="+t+", uri="+e+", already="+u);var n=P.sym(s.rdf.uri.docpart(e));if(0<=e.indexOf("#"))throw new Error("Internal error: hash in "+e);return!function(){if(!t.uri)return!0;var r=P.uris(t);if(!r)return!1;for(var i=0;i<r.length;i++)for(var a=s.rdf.uri.docpart(r[i]);a;a=P.HTTPRedirects[a])if(e===a)return!0;return!!P.anyStatementMatching(t,void 0,void 0,n)}()||(s.log.success("@@ expand OK: relevant subject="+t+", uri="+e+", source="+u),r(),!1)}var o=(n=n||{}).pane,u=!!n.already,l=n.immediate;s.log.info("@outlineExpand, dom is now "+I.location),D.removeCallback("done","expand"),D.removeCallback("fail","expand");var c=P.canon(t);n.solo&&(I.title=s.utils.label(c)),s.log.debug("outlineExpand: dereferencing "+c);var d=I.createElement("span");e.appendChild(d),D.addCallback("done",a),D.addCallback("fail",a);var h=[];if(c.uri&&"rdf"===c.uri.split(":")[0])r();else{for(var f=0;f<h.length;f++){var p;if(p===h[f](c))return r(),s.log.debug("outline 1815"),void(p[1]&&B.removeChild(B.lastChild))}!c.uri||l||s.widgets.isAudio(c)||s.widgets.isVideo(c)||P.holds(c,s.ns.rdf("type"),$rdf.Util.mediaTypeClass("application/pdf"))?r():D.nowOrWhenFetched(c.doc(),void 0,function(t,i){if(t)D.lookUpThing(c),r(),n.solo&&(I.title=s.utils.label(c));else{var a=I.createElement("pre");a.textContent=i,a.setAttribute("style","background-color: #fee;"),a.textContent="Outline.expand: Unable to fetch "+c.doc()+": "+i,e.appendChild(a)}})}}function C(e,t){var n,r,i=s.utils.ancestor(e,"TR");if(i=s.utils.ancestor(i.parentNode,"TR"))var a=i.AJAR_statement;for(n=e.parentNode;"TD"!==n.tagName;n=n.parentNode)if(void 0===n)return void alert("Not enclosed in TD!");if(s.log.debug("Collapsing subject "+t),a&&(s.log.debug("looking up pred "+a.predicate.uri+"in defaults"),r=F.defaults[a.predicate.uri]),s.log.debug("view= "+r),"outline"===n.parentNode.parentNode.id)var o=n.parentNode;R.replaceTD(R.outlineObjectTD(t,r,o,a),n)}function E(e,t){if(s.isExtension&&"symbol"===t.termType&&0>t.uri.indexOf("#"))j.selectedBrowser.loadURI(t.uri);else{for(var n=null,r=e.parentNode;r;r=r.parentNode)s.log.debug("level "+r.tagName),"TD"===r.tagName&&(n=r);s.utils.emptyNode(n).appendChild(U(t)),I.title=s.utils.label(t),n.setAttribute("about",t.toNT())}}function A(e,t,n){F.properties[e]||(F.properties[e]=[]),F.properties[e].push(t),n&&(F.defaults[e]=t)}function T(e){var t;if("Literal"===e.termType){(t=I.createElement("span")).textContent=e.value;var n="";if(e.datatype&&e.datatype.uri){var i=s.ns.xsd("").uri;e.datatype.uri.slice(0,i.length)===i&&(n={integer:"text-align: right;",decimal:"text-align: '.';",double:"text-align: '.';"}[e.datatype.uri.slice(i.length)])}t.setAttribute("style",n||"white-space: pre-wrap;")}else if("NamedNode"===e.termType||"BlankNode"===e.termType)if((t=I.createElement("span")).setAttribute("about",e.toNT()),R.appendAccessIcons(P,t,e),"NamedNode"!==e.termType)t.appendChild(I.createTextNode(s.utils.label(e)));else if("tel:"===e.uri.slice(0,4)){var o=e.uri.slice(4),u=I.createElement("a");t.appendChild(I.createTextNode(o)),u.setAttribute("href",e.uri),u.appendChild(s.utils.AJARImage(a.src.icon_telephone,"phone","phone "+o,I)),t.appendChild(u),u.firstChild.setAttribute("class","phoneIcon")}else t.appendChild(I.createTextNode(s.utils.label(e))),s.widgets.makeDraggable(t,e);else if("Collection"===e.termType){(t=I.createElement("table")).setAttribute("style","width: 100%;"),t.setAttribute("about",e.toNT());for(var l=0;l<e.elements.length;l++){var c=e.elements[l],d=t.appendChild(I.createElement("tr")),h=d.appendChild(I.createElement("td"));h.setAttribute("style","margin: 0.2em; border: none; padding: 0; vertical-align: top;"),h.setAttribute("notSelectable","false"),h.setAttribute("about",e.toNT()),h.innerHTML=l+1+")",d.appendChild(R.outlineObjectTD(c))}}else"Graph"===e.termType?(t=r.dataContentPane.statementsAsTables(e.statements,I)).setAttribute("class","nestedFormula"):(s.log.error("Object "+e+" has unknown term type: "+e.termType),t=I.createTextNode("[unknownTermType:"+e.termType+"]"));return s.log.debug("contents: "+t.innerHTML),t}function S(e){var t=s.utils.AJARImage(e.uri,s.utils.label(e),s.utils.label(e),I);return t.setAttribute("class","outlineImage"),t}var I;if(s.isExtension){var N=Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser"),j=N.getBrowser();I=e||N.document}else I=e;this.document=e,this.outlineIcons=a,this.labeller=this.labeller||{},this.labeller.LanguagePreference="";var O=this,R=this,L=[];this.selection=L,this.ancestor=s.utils.ancestor,this.sparql=s.rdf.UpdateManager,this.kb=s.store;var P=s.store,D=s.store.fetcher;I.outline=this,this.qs=new u.QuerySource,this.UserInput=new o(this),this.clipboardAddress="tabulator:clipboard",this.UserInput.clipboardInit(this.clipboardAddress);var B=this.outlineElement;this.init=function(){I.getElementById("outline").outline=this},this.appendAccessIcons=function(e,t,n){if("NamedNode"===n.termType){var r=e.uris(n);r.sort();for(var i=null,a=0;a<r.length;a++)r[a]!==i&&(i=r[a],R.appendAccessIcon(t,i))}},this.appendAccessIcon=function(e,t){if(!t)return"";var n=s.rdf.uri.docpart(t);if("http:"!==n.slice(0,5))return"";var r,i,o,u=D.getState(n);"unrequested"===u?(r=a.src.icon_unrequested,i="fetch",o=_):"requested"===u?(r=a.src.icon_requested,i="fetching",o=y):"fetched"===u?(r=a.src.icon_fetched,o=w,i="loaded"):"failed"===u?(r=a.src.icon_failed,i="failed",o=y):"unpermitted"===u?(r=a.src.icon_failed,o=y,i="no perm"):"unfetchable"===u?(r=a.src.icon_failed,o=y,i="cannot fetch"):s.log.error("?? state = "+u);var l=s.utils.AJARImage(r,i,a.tooltips[r].replace(/[Tt]his resource/,n),I);return l.setAttribute("uri",t),l.addEventListener("click",o),function(e,t){s.log.debug("Button callbacks for "+t+" added");var n=function(n){return function(r){return 0<=r.indexOf("#")&&console.log("@@ makeIconCallback: Not expecting # in URI whose state changed: "+r),!!e&&!!O.ancestor(e,"DIV")&&(r===t&&(e.src=n,e.title=a.tooltips[n]),!0)}};D.addCallback("request",n(a.src.icon_requested)),D.addCallback("done",n(a.src.icon_fetched)),D.addCallback("fail",n(a.src.icon_failed))}(l,n),e.appendChild(l),l},this.outlineObjectTD=function(e,t,n,r){var i=I.createElement("td");i.setAttribute("style","margin: 0.2em; border: none; padding: 0; vertical-align: top;"),i.setAttribute("notSelectable","false");var o="obj";if(r&&r.why&&s.licenceOptions&&s.licenceOptions.checkLicence()&&(o+=" licOkay"),("NamedNode"===e.termType||"BlankNode"===e.termType||"Literal"===e.termType&&e.value.slice&&("ftp://"===e.value.slice(0,6)||"https://"===e.value.slice(0,8)||"http://"===e.value.slice(0,7)))&&(i.setAttribute("about",e.toNT()),i.appendChild(s.utils.AJARImage(s.icons.originalIconBase+"tbl-expand-trans.png","expand",void 0,I)).addEventListener("click",g)),i.setAttribute("class",o),P.whether(e,s.ns.rdf("type"),s.ns.link("Request"))&&(i.className="undetermined"),t||(t=T),i.appendChild(t(e)),n&&function(e,t,n){var r=s.utils.AJARImage(a.src.icon_remove_node,"remove",void 0,I);r.addEventListener("click",x),r.node=n,r.setAttribute("about",t.toNT()),r.style.marginLeft="5px",r.style.marginRight="10px",e.appendChild(r)}(i,e,n),i.tabulatorSelect=function(){m(this,!0)},i.tabulatorDeselect=function(){m(this,!1)},r){var u=new s.rdf.IndexedFormula;u.statements.push(r);var l=P.each(u,P.sym("http://dig.csail.mit.edu/TAMI/2007/amord/tms#justification"));if(l.length){var c=I.createElement("span");1<l.length&&(c.innerHTML=" &times; "+l.length),c.setAttribute("class","inquiry"),c.insertBefore(s.utils.AJARImage(a.src.icon_display_reasons,"explain",void 0,I),c.firstChild),i.appendChild(c)}}return i.addEventListener("click",M),i},this.outlinePredicateTD=function(e,t,n,r){var i=I.createElement("TD");switch(i.setAttribute("about",e.toNT()),i.setAttribute("class",r?"pred internal":"pred"),e.termType){case"BlankNode":i.className="undetermined";break;case"NamedNode":var o=s.utils.predicateLabelForXML(e,n);break;case"Collection":o=s.utils.predicateLabelForXML(e.elements[0],n)}o=o.slice(0,1).toUpperCase()+o.slice(1);var u=I.createElement("TD");for(var l in u.setAttribute("style","margin: 0.2em; border: none; padding: 0; vertical-align: top;"),u.setAttribute("notSelectable","true"),u.appendChild(I.createTextNode(o)),i.appendChild(u),u.style.width="100%",i.appendChild(q.construct(I)),a.termWidgets){if(!t||!t.AJAR_statement)break;a.termWidgets[l].filter&&a.termWidgets[l].filter(t.AJAR_statement,"pred",n)&&q.addIcon(i,a.termWidgets[l])}return i.tabulatorSelect=function(){m(this,!0)},i.tabulatorDeselect=function(){m(this,!1)},i.addEventListener("click",M),i};var U=this.propertyTable=function(e,t,r,i){if(s.log.debug("Property table for: "+e),e=P.canon(e),!t){(t=I.createElement("table")).setAttribute("style","width: 100%;");var a=n(e,r,i);if(t.appendChild(a),a.firstPane){var o;try{s.log.info("outline: Rendering pane (1): "+a.firstPane.name),o=a.firstPane.render(e,I,i)}catch(e){(o=I.createElement("div")).setAttribute("class","exceptionPane");var u=I.createElement("pre");o.appendChild(u),u.appendChild(I.createTextNode(s.utils.stackString(e)))}a.firstPane.requireQueryButton&&I.getElementById("queryButton")&&I.getElementById("queryButton").removeAttribute("style"),t.appendChild(o),o.pane=a.firstPane,o.paneButton=a.paneButton}return t}return s.log.info("Re-expand: "+t),t};this.propertyTR=c,this.appendPropertyTRs=function(e,t,n,r){if(s.log.debug("Property list length = "+t.length),0===t.length)return"";var i,a,o;n?(i=function(e){return e.subject},t=t.sort(s.utils.RDFComparePredicateSubject)):(i=function(e){return e.object},t=t.sort(s.utils.RDFComparePredicateObject));var u=t.length;for(a=0;a<u;a++){var l=t[a];if(!r||r(l.predicate,n)){var d=c(I,l,n);e.appendChild(d);var h=d.firstChild,f=F.defaults[l.predicate.uri],p=0,m=0,v=0;for(o=0;o+a<u&&t[a+o].predicate.sameTerm(l.predicate);o++)0<o&&i(t[a+o]).sameTerm(i(t[a+o-1]))&&p++,i(t[a+o]).lang&&O.labeller.LanguagePreference&&(m+=1,0<=i(t[a+o]).lang.indexOf(O.labeller.LanguagePreference)&&v++);if(0<v&&m==p+1){for(let e=a;e<=a+p;e++)if(O.labeller.LanguagePreference&&0<=i(t[e]).lang.indexOf(O.labeller.LanguagePreference)){d.appendChild(R.outlineObjectTD(i(t[e]),f,void 0,l));break}a+=p;continue}d.appendChild(R.outlineObjectTD(i(l),f,void 0,l)),d.showNobj=function(r){var u=o-p,c=2*r<u?r:u,d=[];if(1!=u){var m;h.setAttribute("rowspan",c===u?u:r+1),c<u&&1===c&&h.setAttribute("rowspan",2);var v=0;for(m=1;m<o;m++)if(P.canon(i(t[a+m])).sameTerm(P.canon(i(t[a+m-1]))))s.log.info("there are duplicates here: %s",t[a+m-1]);else{v++,l=t[a+m],f=F.defaults[l.predicate.uri];var g=I.createElement("tr");g.style.colspan="1",g.appendChild(R.outlineObjectTD(i(t[a+m]),f,void 0,l)),g.AJAR_statement=l,g.AJAR_inverse=n,e.appendChild(g),v>=c&&(g.style.display="none",d.push(g))}c===u&&h.setAttribute("rowspan",v+1)}if(c<u){var b=I.createElement("tr"),y=b.appendChild(I.createElement("td"));if(y.setAttribute("style","margin: 0.2em; border: none; padding: 0; vertical-align: top;"),y.setAttribute("notSelectable","false"),u>r){var w=I.createElement("a");y.appendChild(w);var _=function(e,t,n,r){return function(t){w.innerHTML="","none"===t?(w.appendChild(s.utils.AJARImage(s.icons.originalIconBase+"tbl-more-trans.png","more","See all",I)),w.appendChild(I.createTextNode(u-r+" more...")),e.setAttribute("rowspan",r+1)):(w.appendChild(s.utils.AJARImage(s.icons.originalIconBase+"tbl-shrink.png","(less)",void 0,I)),e.setAttribute("rowspan",u+1));for(var n=0;n<d.length;n++)d[n].style.display=t}}(h,0,0,r),x="none",M=function(e){return _(x),x="none"==x?"":"none",e&&e.stopPropagation(),!1};M(),w.addEventListener("click",M,!1)}e.appendChild(b)}},d.showAllobj=function(){d.showNobj(o-p)},d.showNobj(10),a+=o-1}}};var q={};t.termWidget=q,q.construct=function(e){var t=(e=e||document).createElement("TD");return t.setAttribute("style","margin: 0.2em; border: none; padding: 0; vertical-align: top;"),t.setAttribute("class","iconTD"),t.setAttribute("notSelectable","true"),t.style.width="0px",t},q.addIcon=function(e,t,n){var r=e.childNodes[1];if(r){var i=r.style.width,a=s.utils.AJARImage(t.src,t.alt,t.tooltip,I);i=parseInt(i),i+=t.width,r.style.width=i+"px",r.appendChild(a),n&&a.addEventListener("click",n)}},q.removeIcon=function(e,t){var n,r=e.childNodes[1];if(r){var i=r.style.width;i=parseInt(i),i-=t.width,r.style.width=i+"px";for(var a=0;a<r.childNodes.length;a++){var o=r.childNodes[a],u=o.src;try{n=I.location.href.split("?")[0]}catch(t){console.log(t),n=""}u===s.rdf.uri.join(t.src,n)&&r.removeChild(o)}}},q.replaceIcon=function(e,t,n,r){q.removeIcon(e,t),q.addIcon(e,n,r)};new function(){this.pat=P.formula(),this.vars=[]},this.statusBarClick=function(e){var t=s.utils.getTarget(e);t.label&&(N.content.location=t.label)},this.showURI=function(e){if(e&&I.getElementById("UserURI"))I.getElementById("UserURI").value="NamedNode"===e.termType?e.uri:"";else if(e&&s.isExtension){var t=j.ownerDocument.getElementById("tabulator-display");t.setAttribute("style","display:block"),t.label="NamedNode"===e.termType?e.uri:"",""===t.label?t.setAttribute("style","display:none"):t.addEventListener("click",this.statusBarClick,!1)}},this.showSource=function(){if("undefined"!=typeof sourceWidget){for(var e in sourceWidget.sources)sourceWidget.sources[e].setAttribute("class","");for(var t=0;t<L.length;t++)if(L[t].parentNode){var n=L[t].parentNode.AJAR_statement;if(n){var r=n.why;r&&r.uri?sourceWidget.highlight(r,!0):s.isExtension&&"BlankNode"===r.termType&&sourceWidget.highlight(P.sym("resource://tabulator/"),!0)}}else console.log("showSource: EH? no parentNode? "+L[t]+"\n")}},this.getSelection=function(){return L},this.targetOf=function(e){var t;if(e||(e=N.event),e.target)t=e.target;else{if(!e.srcElement)return s.log.error("can't get target for event "+e),!1;t=e.srcElement}return 3===t.nodeType&&(t=t.parentNode),t},this.walk=function(e,t){var n,r=t||L[0];switch(e){case"down":try{n=r.parentNode.nextSibling.lastChild}catch(e){return void this.walk("up")}v(),m(n,!0);break;case"up":try{n=r.parentNode.previousSibling.lastChild}catch(e){return}v(),m(n,!0);break;case"right":if(v(),r.nextSibling||"strong"===r.lastChild.tagName)m(r.nextSibling,!0);else m(I.evaluate("table/div/tr/td[2]",r,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,!0);break;case"left":if(v(),r.previousSibling&&"undetermined"===r.previousSibling.className)return m(r.previousSibling,!0),!0;m(s.utils.ancestor(r.parentNode,"TD"),!0);break;case"moveTo":v(),m(t,!0)}"down"!==e&&"up"!==e||n.tabulatorSelect||this.walk(e)},this.OutlinerKeypressPanel=function(e){function t(e){e&&I.getElementById("UserURI")&&(I.getElementById("UserURI").value="NamedNode"===e.termType?e.uri:"")}function n(e){return!!arguments[3]||(c("right",o),t(s.utils.getAbout(P,L[0])),!0)}var i,a;if(s.log.info("Key "+e.keyCode+" pressed"),"TEXTAREA"!==s.utils.getTarget(e).tagName&&"UserURI"!==s.utils.getTarget(e).id&&!(1<L.length)){if(0===L.length)return void((13===e.keyCode||38===e.keyCode||40===e.keyCode||37===e.keyCode||39===e.keyCode)&&(this.walk("right",R.focusTd),t(s.utils.getAbout(P,L[0]))));var o=L[0];switch(D.removeCallback("done","setSelectedAfterward"),D.removeCallback("fail","setSelectedAfterward"),e.keyCode){case 13:if("HTML"===s.utils.getTarget(e).tagName){var u=s.utils.getAbout(P,o);i=o.parentNode.AJAR_statement.why,a=s.store.updater.editable(i.uri,P),u?O.GotoSubject(u,!0):a&&R.UserInput.Enter(o)}else this.UserInput.Keypress(e),this.walk("down"),e.stopPropagation();return;case 38:this.walk("up"),e.stopPropagation(),e.preventDefault();break;case 40:this.walk("down"),e.stopPropagation(),e.preventDefault()}if("INPUT"!==s.utils.getTarget(e).tagName){switch(e.keyCode){case 46:case 8:i=o.parentNode.AJAR_statement.why,(a=s.store.updater.editable(i.uri,P))&&(e.preventDefault(),this.UserInput.Delete(o));break;case 37:if(this.walk("left"))return;var l=s.utils.ancestor(o.parentNode,"TD");C(o,s.utils.getAbout(P,l));break;case 39:let t=s.utils.getAbout(P,o);if(t){var c=this.walk;if(o.nextSibling)return void this.walk("right");"TABLE"!==o.firstChild.tagName&&(D.addCallback("done",n),D.addCallback("fail",n),k(o,t,{pane:r.defaultPane})),n()}break;case 38:case 40:break;default:switch(e.charCode){case 99:if(e.ctrlKey){R.UserInput.copyToClipboard(R.clipboardAddress,o);break}break;case 118:case 112:if(e.ctrlKey){R.UserInput.pasteFromClipboard(R.clipboardAddress,o);break}break;default:s.utils.getTarget(e).tagName}}if(t(s.utils.getAbout(P,L[0])),L[0]){var d=s.utils.findPos(L[0])[1];d+L[0].clientHeight>N.scrollY+N.innerHeight&&s.utils.getEyeFocus(L[0],!0,!0,N),d<N.scrollY+54&&s.utils.getEyeFocus(L[0],!0,void 0,N)}}}},this.OutlinerMouseclickPanel=function(e){switch(R.UserInput._tabulatorMode){case 0:!function(e){s.log.info("@TabulatorMousedown, dom.location is now "+I.location);var t=R.targetOf(e);if(t){var n=t.tagName;"INPUT"===n||"TEXTAREA"===n||(R.UserInput.clearMenu(),R.UserInput.lastModified&&R.UserInput.lastModified.parentNode.nextSibling&&R.UserInput.backOut(),(!t.src||t.src.slice(t.src.indexOf("/icons/")+1)!==a.src.icon_show_choices&&t.src.slice(t.src.indexOf("/icons/")+1)!==a.src.icon_add_triple)&&R.UserInput.clearInputAndSave(e),(!t.src||t.src.slice(t.src.indexOf("/icons/")+1)!==a.src.icon_show_choices)&&R.UserInput.clearMenu(),e&&e.stopPropagation())}}(e);break;case 1:R.UserInput.Click(e)}},this.replaceTD=function(e,t){var n;d(t)&&(n=!0);for(var r=L.length-1;-1<r;r--)for(var i=L[r];i.parentNode;i=i.parentNode)i===t&&m(L[r],!1);t.parentNode.replaceChild(e,t),n&&m(e,!0)},O.outlineRefocus=E,this.GotoFormURI_enterKey=function(e){13===e.keyCode&&O.GotoFormURI(e)},this.GotoFormURI=function(e){!function(e){var t=P.sym(e);this.GotoSubject(t,!0)}(I.getElementById("UserURI").value)},this.GotoURIinit=function(e){var t=P.sym(e);this.GotoSubject(t)},this.GotoSubject=function(e,t,n,r,i,a){if(a||(a=I.getElementById("outline")),r&&s.utils.emptyNode(a),s.isExtension)var o=function(e){var t=Components.interfaces.nsIURI,n=Components.classes["@mozilla.org/network/simple-uri;1"].createInstance(t);return n.spec=e,n};var u=function(){var t=I.createElement("TR");t.style.verticalAlign="top",a.appendChild(t);var n=R.outlineObjectTD(e,void 0,t);return t.appendChild(n),n}();if(r&&(I.title=s.utils.label(e)),t){k(u,e,{pane:n,solo:r});var l=u.parentNode;s.utils.getEyeFocus(l,!1,void 0,N)}if(r&&I&&I.defaultView&&I.defaultView.history){let t=n?{paneName:n.name}:{};I.defaultView.history.pushState(t,e.uri,e.uri)}r&&s.isExtension&&Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIGlobalHistory2).addURI(o(e.uri),!1,!0,i);return e};var F={properties:[],defaults:[],classes:[]},z=s.ns;return A(z.foaf("depiction").uri,S,!0),A(z.foaf("img").uri,S,!0),A(z.foaf("thumbnail").uri,S,!0),A(z.foaf("logo").uri,S,!0),A(z.foaf("mbox").uri,function(e){var t=I.createElement("a"),n="NamedNode"===e.termType?e.uri:e.value;if(!n)return T(e);var r=n.indexOf("mailto:");return n=0<=r?n.slice(r+7):n,t.setAttribute("href","mailto:"+n),t.appendChild(I.createTextNode(n)),t},!0),this.createTabURI=function(){I.getElementById("UserURI").value=I.URL+"?uri="+I.getElementById("UserURI").value},this.UserInput.setSelected=m,this.UserInput.deselectAll=v,this.UserInput.views=F,this.outlineExpand=k,s.isExtension&&(N.addEventListener("unload",function(){var e=j.ownerDocument.getElementById("tabulator-display");e.label="",e.setAttribute("style","display:none")},!0),j.mPanelContainer.addEventListener("select",function(){var e=j.ownerDocument.getElementById("tabulator-display");e.label="",e.setAttribute("style","display:none")},!0)),this}}).call(this,n(5))},function(e,t,n){"use strict";var r={};e.exports=r;var i={icons:n(16),log:n(15),ns:n(6),store:n(8),tabs:r,widgets:n(14)},a=n(21);i.tabs.tabWidget=function(e){var t,n,r,o,s,u,l,c=i.store,d=e.subject,h=e.dom,f=h.createElement("div"),p=parseInt(e.orientation||"0"),m=e.backgroundColor||"#ddddcc",v=2&p,g=1&p,b=f.appendChild(h.createElement("table")),y=function(e,t,n){for(var r,i,a="#",o="0123456789abcdef",s=0;3>s;s++){r=parseInt(e.slice(2*s+1,2*s+3),16),i=parseInt(t.slice(2*s+1,2*s+3),16);var u=parseInt((""+(r*(1-n)+i*n)).split(".")[0]),l=parseInt((""+u/16).split(".")[0]),c=parseInt((""+u%16).split(".")[0]);a+=o[l]+o[c]}return a};!function(e){for(var t=0,n=0;3>n;n++)t+=parseInt(e.slice(2*n+1,2*n+3),16);return 384<t}(m)?(l=y(m,"#000000",.3),t="#ffffff"):(l=y(m,"#ffffff",.3),t="#000000");var w="resize: both; overflow: scroll; margin:0; border: 0.5em; border-style: solid; border-color: "+l+"; padding: 1em; min-width: 30em; min-height: 450px; width:100%;";if(g){var _=b.appendChild(h.createElement("tr"));(r=h.createElement("td")).setAttribute("style","margin: 0;");var x=h.createElement("td");x.setAttribute("style","margin: 0;"),v?(_.appendChild(r),_.appendChild(x)):(_.appendChild(x),_.appendChild(r)),s=x.appendChild(h.createElement("table")),u="tr"}else s=h.createElement("tr"),n=b.appendChild(h.createElement("tr")),v?(n=b.appendChild(h.createElement("tr")),o=b.appendChild(h.createElement("tr"))):(o=b.appendChild(h.createElement("tr")),n=b.appendChild(h.createElement("tr"))),s=o,r=n.appendChild(h.createElement("td")),u="td";var M=r.appendChild(h.createElement("table"));f.tabContainer=s,f.bodyContainer=M;var k=function(){return e.ordered?c.the(d,e.predicate).elements:c.each(d,e.predicate)},C=["2em","2em","0","0"];C="border-radius: "+(C=C.concat(C).slice(p,p+4)).join(" ")+";";var E=["0.3em","0.3em","0","0.3em"];E="margin: "+(E=E.concat(E).slice(p,p+4)).join(" ")+";";var A=C+"padding: 0.7em; max-width: 20em;",T=(A+="color: "+t+";")+"opacity: 50%; margin: 0.3em; background-color: "+m+";",S=A+E+" background-color: "+l+";",I=function(t){var n=h.createElement(u);n.subject=t;var r=n.appendChild(h.createElement("div"));return r.setAttribute("style",T),r.addEventListener("click",function(i){i.metaKey||(function(){for(var e=0;e<s.children.length;e++)s.children[e].firstChild.setAttribute("style",T)}(),function(){for(var e=0;e<M.children.length;e++)M.children[e].setAttribute("style","display: none;")}()),r.setAttribute("style",S),n.bodyTR.setAttribute("style","");var a=n.bodyTR.firstChild;a||(a=n.bodyTR.appendChild(h.createElement("div"))).setAttribute("style",w),e.renderTabSettings&&i.altKey?!0!==a.asSetttings&&(a.innerHTML="loading settings ..."+t,e.renderTabSettings(a,n.subject),a.asSetttings=!0):!1!==a.asSetttings&&(a.innerHTML="loading item ..."+t,e.renderMain(a,n.subject),a.asSetttings=!1)}),e.renderTab?e.renderTab(r,t):r.textContent=a.label(t),n},N=function(){e.ordered?function(){var e=k();g||r.setAttribute("colspan",e.length);var t,n,i,a,o,u=!1;for(a=0;a<s.children.length;a++)if(t=s.children[a],a>=e.length||!t.subject.sameTerm(e[a])){u=!0;break}if(u||e.length!==s.children.length){for(o=s.children.length-1;0<=o&&(t=s.children[o],i=o-s.children.length+e.length,t.subject.sameTerm(e[i]));o--);for(var l=e.slice(a,o-s.children.length+e.length+1);o>=a;)s.removeChild(s.children[a]),M.removeChild(M.children[a]),o-=1;for(n=0;n<l.length;n++){var c=I(l[n]),d=h.createElement("tr");c.bodyTR=d,h.createElement("tr"),a===s.children.length?(s.appendChild(c),M.appendChild(d)):(s.insertBefore(c,s.children[a+n]),M.insertBefore(d,M.children[a+n]))}}}():function(){var e=k();g||r.setAttribute("colspan",e.length);var t,n,i,a,o,u=[];for(n=0;n<s.children.length;n++)(t=s.children[n]).deleteMe=!0;for(i=0;i<e.length;i++){for(a=!1,n=0;n<s.children.length;n++)s.children[n].subject===e[i]&&(a=!0);a||u.push([i,e[i]])}for(i=0;i<u.length;i++)n=(o=u[i])[0],t=I(o[1]),n>=s.length?s.appendChild(t):s.insertBefore(t,s.children[n+1]);for(n=0;n<s.children.length;n++)(t=s.children[n]).deleteMe&&s.removeChild(t)}()};return f.refresh=N,N(),!e.startEmpty&&s.children.length&&s.children[0].firstChild.click(),f}},function(e,t,n){"use strict";var r={icons:n(16),log:n(15),ns:n(6),store:n(8),widgets:n(14)},i=n(21),a=n(23);e.exports=function(e,t){function n(e){var t=new a.Query,n=V.variable(Z.slice(1));return function(e,t){for(var n,r=t.getColumns(),i=0;i<r.length;++i)n=V.variable("_col"+i),e.vars.push(n),r[i].setVariable(n)}(t,e),function(e,t,n){var i=n.type;i||(i=V.variable("_any")),e.pat.add(t,r.ns.rdf("type"),i)}(t,n,e),function(e,t,n){for(var r=n.getColumns(),i=0;i<r.length;++i){var a=r[i],o=V.formula();o.add(t,a.predicate,a.getVariable()),e.pat.optional.push(o)}}(t,n,e),t}function o(e){s(U),U.appendChild(h(e)),function(e,t){Q&&(Q.running=!1);var n=L(e,t);s(te),te.appendChild(n),Q=e}(n(e),e)}function s(e){for(;0<e.childNodes.length;)e.removeChild(e.childNodes[0])}function u(e){this.type=e,this.columns=null,this.allColumns=null,this.useCount=0,this.getAllColumns=function(){return this.allColumns},this.getColumns=function(){if(!this.columns){var e=this.getAllColumns();this.columns=e.slice(0,7)}return this.columns},this.getUnusedColumns=function(){for(var e=this.getAllColumns(),t=this.getColumns(),n=[],r=0;r<e.length;++r)-1===t.indexOf(e[r])&&n.push(e[r]);return n},this.addColumn=function(e){this.columns.push(e)},this.removeColumn=function(e){this.columns=this.columns.filter(function(t){return t!==e})},this.getLabel=function(){return i.label(this.type)},this.addUse=function(){this.useCount+=1}}function l(){this.useCount=0,this.checkedAnyValues=!1,this.possiblyLiteral=!0,this.possiblyNumber=!0,this.constraints=[],this.checkValue=function(e){var t=e.termType;if(this.possiblyLiteral&&"Literal"!==t&&"NamedNode"!==t)this.possiblyNumber=!1,this.possiblyLiteral=!1;else if(this.possiblyNumber)if("Literal"!==t)this.possiblyNumber=!1;else{e.value.match(/^-?\d+(\.\d*)?$/)||(this.possiblyNumber=!1)}this.checkedAnyValues=!0},this.getVariable=function(){return this.variable},this.setVariable=function(e){this.variable=e},this.getKey=function(){return this.variable.toString()},this.addUse=function(){this.useCount+=1},this.getLabel=function(){return this.predicate?this.predicate.sameTerm(W.rdf("type"))&&this.superClass?i.label(this.superClass):i.label(this.predicate):this.variable?this.variable.toString():"unlabeled column?"},this.setPredicate=function(e,t,n){t?(this.inverse=e,this.constraints=this.constraints.concat(V.each(e,r.ns.rdfs("domain"))),e.sameTerm(W.rdfs("subClassOf"))&&"NamedNode"===n.termType&&(this.superClass=n,this.alternatives=V.each(void 0,W.rdfs("subClassOf"),n))):(this.predicate=e,this.constraints=this.constraints.concat(V.each(e,r.ns.rdfs("range"))))},this.getConstraints=function(){return this.constraints},this.filterFunction=function(){return!0},this.sortKey=function(){return this.getLabel().toLowerCase()},this.isImageColumn=function(){for(var e=0;e<this.constraints.length;e++)if(this.constraints[e].uri in X)return!0;return!1}}function c(e,t){var n=[];for(var r in e){var i=e[r];(!t||t(r,i))&&n.push(i)}return n}function d(t,n){var r=e.createElement("option");return r.setAttribute("value",n),r.appendChild(e.createTextNode(t)),r}function h(t){var n=e.createElement("div"),r=t.getUnusedColumns();if(r.sort(function(e,t){var n=e.sortKey(),r=t.sortKey();return(n>r)-(n<r)}),0<r.length){n.appendChild(e.createTextNode("Add column: "));var i=e.createElement("select");i.appendChild(d("","-1"));for(var a,s=0;s<r.length;++s)a=r[s],i.appendChild(d(a.getLabel(),""+s));n.appendChild(i),i.addEventListener("click",function(){var e=+i.value;0<=e&&(t.addColumn(r[e]),o(t))},!1)}return n}function f(e,t){var n;return t.uri in e?n=e[t.uri]:((n=new l).setPredicate(t),e[t.uri]=n),n}function p(e,t){var n;return t.uri in e?n=e[t.uri]:(n=new u(t),e[t.uri]=n),n}function m(){for(var e,t={},n=V.statementsMatching(void 0,r.ns.rdf("type"),F,q),i={},a=0;a<n.length;++a)if("NamedNode"===(e=n[a].object).termType){var o=p(t,e);e.uri in i||(i[e.uri]=[]),i[e.uri].push(n[a].subject),o.addUse()}return[i,t]}function v(e,t){for(var n,r=V.statementsMatching(e,void 0,void 0,q),i={},a=0;a<r.length;++a)if(!((n=r[a].predicate).uri in G)){var o=f(t,n);o.checkValue(r[a].object),i[n.uri]=o}return i}function g(e,t){for(var n,r={},i=0;i<t.length;++i)for(var a in n=v(t[i],r)){n[a].addUse()}var o=c(r);(function(e){e.sort(function(e,t){return(e.useCount<t.useCount)-(e.useCount>t.useCount)})})(o),e.allColumns=o}function b(t,n){var r=e.createElement("a");return r.appendChild(e.createTextNode("[x]")),r.addEventListener("click",function(){t.removeColumn(n),o(t)},!1),r}function y(e,t){for(var n=!0,r=0;r<t.length;++r){var i=t[r],a=i.getKey(),o=null;if(a in e.values&&(o=e.values[a][0]),!i.filterFunction(o)){n=!1;break}}e._htmlRow.style.display=n?"":"none"}function w(e,t){for(var n=0;n<e.length;++n)y(e[n],t)}function _(e,t,n){function r(e){return e?"Literal"===e.termType?e.value.toLowerCase():"NamedNode"===e.termType?i.label(e).toLowerCase():e.value.toLowerCase():""}!function(e,t,n,r){var i=t.getKey();if(e.sort(function(e,t){var a=null,o=null;i in e.values&&(a=e.values[i][0]),i in t.values&&(o=t.values[i][0]);var s=n(a,o);return r?-s:s}),e.length){for(var a=e[0]._htmlRow.parentNode,o=0;o<e.length;++o)a.removeChild(e[o]._htmlRow);for(var s=0;s<e.length;++s)a.appendChild(e[s]._htmlRow)}}(e,t,function(e,t){var n=r(e),i=r(t);return n<i?-1:n>i?1:0},n)}function x(t,n,r){var a=e.createElement("div"),o=e.createElement("input");o.setAttribute("type","text"),o.style.width="70%",a.appendChild(o);var s=e.createElement("span");s.appendChild(e.createTextNode("▼")),s.addEventListener("click",function(){_(t,r,!1)},!1),a.appendChild(s);var u=e.createElement("span");u.appendChild(e.createTextNode("▲")),u.addEventListener("click",function(){_(t,r,!0)},!1),a.appendChild(u);var l=null;return r.filterFunction=function(e){return!l||!!e&&0<=("Literal"===e.termType?e.value:"NamedNode"===e.termType?i.label(e):"").toLowerCase().indexOf(l)},o.addEventListener("keyup",function(){l=""===o.value?null:o.value.toLowerCase(),w(t,n)},!1),a}function M(t,n,r,a){for(var o,s=e.createElement("div"),u=e.createElement("select"),l={},c=0;c<a.length;++c)o=a[c],l[o.uri]=!0;var h=T(r).initialSelection;h&&(l=h),u.setAttribute("multiple","true");for(var f=0;f<a.length;++f){var p=a[f],m=d(i.label(p),f);l[p.uri]&&(m.selected=!0),u.appendChild(m)}return s.appendChild(u),r.filterFunction=function(e){return!l||e&&l[e.uri]},u.addEventListener("click",function(){l={};for(var e=u.options,r=0;r<e.length;r++){var i=+e[r].value;e[r].selected&&(l[a[i].uri]=!0)}w(t,n)},!0),s}function k(t,n,r){function i(){u=""===o.value?null:+o.value,l=""===s.value?null:+s.value,w(t,n)}var a=e.createElement("div"),o=e.createElement("input");o.setAttribute("type","text"),o.style.width="40px",a.appendChild(o);var s=e.createElement("input");s.setAttribute("type","text"),s.style.width="40px",a.appendChild(s);var u=null,l=null;return r.filterFunction=function(e){return e&&(e=+e),!(u&&(!e||e<u))&&!(l&&(!e||e>l))},o.addEventListener("keyup",i,!1),s.addEventListener("keyup",i,!1),a}function C(e,t,n){if(n.superClass&&0<n.alternatives.length)return M(e,t,n,n.alternatives);for(var i,a=n.getConstraints(),o=0;o<a.length;o++){if(i=a[o],n.checkedAnyValues&&n.possiblyNumber||i.uri in K)return k(e,t,n);if(i.uri===H)return x(e,t,n);var s=V.each(i,r.ns.owl("oneOf"));if(0<s.length)return M(e,t,n,s.elements)}return function(e,t,n){return n.checkedAnyValues&&n.possiblyNumber?k(e,t,n):n.possiblyLiteral?x(e,t,n):null}(e,t,n)}function E(t,n,a){a=a||{};var o=e.createElement("a"),s=a.linkFunction;return o.setAttribute("href",t),o.appendChild(e.createTextNode(n)),s?o.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=i.getTarget(e).getAttribute("href");t||console.log("No href found \n"),s(t)},!0):o.addEventListener("click",r.widgets.openHrefInOutlineMode,!0),o}function A(e,t){var n=!1;return e.uri&&(n=e.uri.match(/^mailto:(.*)/)),E(e.uri,n?n[1]:i.label(e),t)}function T(e){return t&&t.hints&&e.variable&&t.hints[e.variable.toNT()]?t.hints[e.variable.toNT()]:{}}function S(t,n){var i=T(n),a=i.cellFormat;if(!a){if("Literal"===t.termType){if(t.datatype){if($[t.datatype.uri])return e.createTextNode(r.widgets.shortDate(t.value));if(K[t.datatype.uri]){var o=e.createElement("span");return o.textContent=t.value,o.setAttribute("style","text-align: right"),o}}return e.createTextNode(t.value)}if("NamedNode"===t.termType&&n.isImageColumn())return function(t){var n=e.createElement("img");return n.setAttribute("src",t.uri),n.style.height="40px",n}(t);if("NamedNode"===t.termType||"BlankNode"===t.termType)return A(t,i);if("Collection"===t.termType){var s=e.createElement("span");return s.appendChild(e.createTextNode("[")),t.elements.map(function(t){s.appendChild(S(t,n)),s.appendChild(e.createTextNode(", "))}),s.removeChild(s.lastChild),s.appendChild(e.createTextNode("]")),s}return e.createTextNode("unknown termtype '"+t.termType+"'!")}switch(a){case"shortDate":return e.createTextNode(r.widgets.shortDate(t.value))}}function I(t,n,r,i){var a=e.createElement("td");n._subject&&"uri"in n._subject&&a.appendChild(E(n._subject.uri,"→")),t.appendChild(a);for(var o=0;o<r.length;++o){var s,u=r[o],l=e.createElement("td"),c=u.getKey();if(c in n.values){var d=n.values[c],h=!1;n.originalValues&&n.originalValues[c]&&d.length!==n.originalValues[c].length&&(h=!0);for(var f,p=0;p<d.length;++p)f=d[p],n.originalValues&&n.originalValues[c]&&n.originalValues[c].length>p&&(s=n.originalValues[c][p],f.toString()!==s.toString()&&(h=!0)),l.appendChild(S(f,u)),p!==d.length-1&&l.appendChild(e.createTextNode(",\n")),h&&(l.style.background="#efe")}t.appendChild(l)}return n._htmlRow=t,t}function N(e,t){var n,r=null;if("Literal"===e.termType)r="value";else{if("NamedNode"!==e.termType)return 0<=t.indexOf(e);r="uri"}for(n=0;n<t.length;++n)if(t[n].termType===e.termType&&t[n][r]===e[r])return!0;return!1}function j(e){if("uri"in e)return e.uri;if("_subject_id"in e)return e._subject_id;var t=""+Y;return e._subject_id=t,++Y,t}function O(n,r,i,a){n.running=!0;var o=Date.now(),u=e.createElement("tr");a.appendChild(u),u.textContent="Loading ...";for(var l=0;l<r.length;l++)r[l].original=!0,r[l].originalValues||(r[l].originalValues=r[l].values),r[l].values={};V.query(n,function(t){if(n.running){u.textContent+=".";var o,l=null,c=null;if(Z in t&&(o=j(c=t[Z]))in J&&(l=J[o]),!l){var d=e.createElement("tr");a.appendChild(d),l={_htmlRow:d,_subject:c,values:{}},r.push(l),c&&(J[o]=l)}delete l.original,function(e,t,n){var r,i=!1;for(r in n){var a=n[r];r in e.values||(e.values[r]=[]),N(a,e.values[r])||(e.values[r].push(a),i=!0)}i&&(s(e._htmlRow),I(e._htmlRow,e,t)),y(e,t)}(l,i,t)}},void 0,function(){u&&u.parentNode&&u.parentNode.removeChild&&(u.parentNode.removeChild(u),u=null);var e=Date.now()-o;console.log("Query done: "+r.length+" rows, "+e+"ms");for(var n=r.length-1;0<=n;n--)if(r[n].original){console.log(" deleting row "+r[n]._subject);var i=r[n]._htmlRow;i.parentNode.removeChild(i),delete J[j(r[n]._subject)],r.splice(n,1)}t.onDone&&t.onDone()})}function R(e){for(var t=[],n={},i=0;i<e.vars.length;++i){var a=new l,o=e.vars[i];r.log.debug("column "+i+" : "+o),a.setVariable(o),n[o]=a,t.push(a)}return function e(t,n){r.log.debug(">> processing formula");for(var i,a=0;a<n.statements.length;++a){if("NamedNode"===(i=n.statements[a]).predicate.termType&&"Variable"===i.object.termType){var o=i.object.toString();o in t&&t[o].setPredicate(i.predicate,!1,i.subject)}if("NamedNode"===i.predicate.termType&&"Variable"===i.subject.termType){var s=i.subject.toString();s in t&&t[s].setPredicate(i.predicate,!0,i.object)}}for(var u=0;u<n.optional.length;++u)r.log.debug("recurse to optional subformula "+u),e(t,n.optional[u]);r.log.debug("<< finished processing formula")}(n,e.pat),t}function L(t,n){var r;r=z?R(t):n.getColumns();var i=[],a=e.createElement("table");return a.appendChild(function(t,n){var r=e.createElement("tr"),i=e.createElement("th");r.appendChild(i);for(var a=0;a<t.length;++a){var o=e.createElement("th"),s=t[a];o.appendChild(e.createTextNode(s.getLabel())),n&&o.appendChild(b(n,s)),r.appendChild(o)}return r}(r,n)),a.appendChild(function(t,n){var r=e.createElement("tr");r.className="selectors",r.appendChild(e.createElement("td"));for(var i=0;i<n.length;++i){var a=e.createElement("td"),o=C(t,n,n[i]);o&&a.appendChild(o),r.appendChild(a)}return r}(i,r)),a.logicalRows=i,a.columns=r,a.query=t,O(t,i,r,a),a}var P,D,B,U,q=t.sourceDocument,F=t.tableClass,z=t.query,H="http://www.w3.org/2000/01/rdf-schema#Literal",W=r.ns,V=r.store,J={},G={"http://www.w3.org/2002/07/owl#sameAs":!0,"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":!0},K={"http://www.w3.org/2001/XMLSchema#decimal":!0,"http://www.w3.org/2001/XMLSchema#float":!0,"http://www.w3.org/2001/XMLSchema#double":!0,"http://www.w3.org/2001/XMLSchema#integer":!0,"http://www.w3.org/2001/XMLSchema#nonNegativeInteger":!0,"http://www.w3.org/2001/XMLSchema#positiveInteger":!0,"http://www.w3.org/2001/XMLSchema#nonPositiveInteger":!0,"http://www.w3.org/2001/XMLSchema#negativeInteger":!0,"http://www.w3.org/2001/XMLSchema#long":!0,"http://www.w3.org/2001/XMLSchema#int":!0,"http://www.w3.org/2001/XMLSchema#short":!0,"http://www.w3.org/2001/XMLSchema#byte":!0,"http://www.w3.org/2001/XMLSchema#unsignedLong":!0,"http://www.w3.org/2001/XMLSchema#unsignedInt":!0,"http://www.w3.org/2001/XMLSchema#unsignedShort":!0,"http://www.w3.org/2001/XMLSchema#unsignedByte":!0},$={"http://www.w3.org/2001/XMLSchema#dateTime":!0,"http://www.w3.org/2001/XMLSchema#date":!0},X={"http://xmlns.com/foaf/0.1/Image":!0,"http://purl.org/dc/terms/Image":!0},Z=t.keyVariable||"?_row",Y=0,Q=null,ee=e.createElement("div");ee.className="tableViewPane",ee.appendChild(function(){var t=e.createElement("table");t.setAttribute("class","toolbar");var n=e.createElement("tr");return B=e.createElement("td"),n.appendChild(B),U=e.createElement("td"),n.appendChild(U),t.appendChild(n),t}());var te=e.createElement("div");if(ee.appendChild(te),ee.refresh=function(){O(ne.query,ne.logicalRows,ne.columns,ne)},z){var ne=L(z);te.appendChild(ne)}else{var re=function(){var e,t,n=m();for(var r in e=n[0],t=n[1],e){var i=e[r];g(t[r],i)}return[new u(null),c(t)]}();P=re[0],D=re[1],F||B.appendChild(function(t,n){var r=e.createElement("div");r.appendChild(e.createTextNode("Select type: "));var i=e.createElement("select");for(var a in i.appendChild(d("All types","null")),n)i.appendChild(d(n[a].getLabel(),a));return i.addEventListener("click",function(){!function(e){o(e)}("null"===i.value?t:n[i.value])},!1),r.appendChild(i),r}(P,D)),o(function(e){var t=-1,n=null;for(var r in e){var i=e[r];i.useCount>t&&(n=i,t=i.useCount)}return n}(D)||P)}return ee}},function(e,t,n){"use strict";function r(e,t){return new Promise(function(n,r){var i=o.any(e,s.ui("sharedPreferences"));if(i)t.sharedPreferences=i,n(t);else{var a=$rdf.sym(e.doc().uri+"#SharedPreferences"),u=[$rdf.st(e,s.ui("sharedPreferences"),a,e.doc())];console.log("Creating shared preferences "+a),o.updater.update([],u,function(e,i,o){i?(t.sharedPreferences=a,n(t)):r(new Error("create shard prefs: "+o))})}})}function i(e,t){return new Promise(function(n,r){u.logInLoadPreferences(t).then(function(t){var i,a,u=o.each(null,s.solid("forClass"),e),c=[];u.length?(u.forEach(function(e){i=i||o.any(e,s.solid("personalDefaults"))}),i?(t.personalDefaults=i,n(t)):(i=l.newThing(t.preferencesFile),a=u[0])):(a=l.newThing(t.preferencesFile),c=[$rdf.st(a,s.rdf("type"),s.solid("Regsitration"),t.preferencesFile),$rdf.st(a,s.solid("forClass"),e,t.preferencesFile)]),i=l.newThing(t.preferencesFile),c.push($rdf.st(a,s.solid("personalDefaults"),i,t.preferencesFile)),o.updater.update([],c,function(a,o,s){o?(t.personalDefaults=i,n(t)):r(new Error("Setting preferences for "+e+": "+s))})},function(e){r(e)})})}function a(e){return e.datatype?e.datatype.equals(s.xsd("boolean"))?"1"===e.value:e.datatype.equals(s.xsd("dateTime"))||e.datatype.equals(s.xsd("date"))?new Date(e.value):e.datatype.equals(s.xsd("integer"))||e.datatype.equals(s.xsd("float"))||e.datatype.equals(s.xsd("decimal"))?+e.value:e.value:e}var o=n(8),s=n(6),u=n(41),l=n(14),c=n(90);e.exports={value:[],get:function(e){return this.value[e]},set:function(e,t){if("string"!=typeof t)throw console.log("Non-string value of preference "+e+": "+t),new Error("Non-string value of preference "+e+": "+t);this.value[e]=t},renderPreferencesForm:function(e,t,n,a){var o=a.dom.createElement("div");return c.participationObject(e,e.doc(),a.me).then(function(s){function u(e){o.appendChild(c.createElement("h5")).textContent=e}var c=a.dom;u("My view of this "+a.noun),l.appendForm(c,o,{},s,n,e.doc(),function(e,t){e||l.complain(a,t)}),u("Everyone's view of this "+a.noun),r(e,a).then(function(r){var a=r.sharedPreferences;l.appendForm(c,o,{},a,n,e.doc(),function(e,t){e||l.complain(r,t)}),u("My default view of any "+r.noun),i(t,r).then(function(e){l.appendForm(c,o,{},e.personalDefaults,n,e.preferencesFile,function(t,n){t||l.complain(e,n)})},function(e){l.complain(r,e)})})},function(e){o.appendChild(l.errorMessageBlock(a.dom,e))}),o},recordSharedPreferences:r,getPreferencesForClass:function(e,t,n,s){return new Promise(function(u,l){r(e,s).then(function(r){if(r.me)c.participationObject(e,e.doc(),r.me).then(function(s){i(t,r).then(function(t){var r=[],i=t.personalDefaults;n.forEach(function(t){var n=o.any(s,t)||o.any(e,t)||o.any(i,t);n&&(r[t.uri]=a(n))}),u(r)},l)},l);else{var s=[];n.forEach(function(t){var n=o.any(e,t);n&&(s[t.uri]=a(n))}),u(s)}})})}}},function(e,t,n){"use strict";var r={authn:n(41),icons:n(16),log:n(15),ns:n(6),pad:n(90),rdf:n(23),store:n(8),style:n(42),widgets:n(14)},i=n(21);e.exports=function(e,t,n,a){function o(){function i(i){var a=m();i||(s.setAttribute("style",E+"color: #bbb;"),s.disabled=!0);var o=[],u=""+a.getTime(),l=$rdf.term(a),h=f(a),p=t.sym(h.uri+"#Msg"+u),v=t.literal(i||s.value);o.push(new $rdf.Statement(n,_.wf("message"),p,h)),o.push(new $rdf.Statement(p,_.sioc("content"),v,h)),o.push(new $rdf.Statement(p,M("created"),l,h)),b&&o.push(new $rdf.Statement(p,_.foaf("maker"),b,h));T.update([],o,function(t,n,a){n?(c(y,{"?msg":p,"?content":v,"?date":l,"?creator":b},!1),i||(s.value="",s.setAttribute("style",E),s.disabled=!1)):d.appendChild(r.widgets.errorMessageBlock(e,"Error writing message: "+a))})}function o(e){r.widgets.uploadFiles(t.fetcher,e,w.dir().uri+"Files",w.dir().uri+"Pictures",function(e,t){i(t)})}var s,l,d=e.createElement("tr"),h=e.createElement("td"),p=e.createElement("td"),v=e.createElement("td");d.appendChild(h),d.appendChild(p),d.appendChild(v),d.AJAR_date="9999-01-01T00:00:00Z",d.appendChild(e.createElement("br"));var x=function(e){i(e[0])},k={div:p,dom:e};return r.authn.logIn(k).then(function(t){b=t.me,function(){if(a.menuHandler&&g){var t={me:b,dom:e,div:A,newBase:y.chatDocument.dir().uri};g.addEventListener("click",function(e){a.menuHandler(e,n,t)},!1)}u(h,b,"",null),s=e.createElement("textarea"),p.innerHTML="",p.appendChild(s),s.rows=3,s.setAttribute("style",E+"background-color: #eef;"),s.addEventListener("keydown",function(e){13!==e.keyCode||e.altKey||i()},!1),r.widgets.makeDropTarget(s,x,o),v.innerHTML="",(l=r.widgets.button(e,r.icons.iconBase+"noun_383448.svg","Send")).setAttribute("style",r.style.buttonStyle+"float: right;"),l.addEventListener("click",function(e){return i()},!1),v.appendChild(l),r.pad.recordParticipation(n,n.doc())}()}),d}function s(e){var t=r.store.any(e,r.ns.foaf("nick"));return t?""+t.value:""+i.label(e)}function u(t,n,i,a){var o=t.appendChild(S(s(n),n));n.uri&&r.store.fetcher.nowOrWhenFetched(n.doc(),void 0,function(e,t){o.textContent=s(n)}),t.appendChild(e.createElement("br")),t.appendChild(S(i,a))}function l(e,n){var r,i,a={};for(r=n.firstChild;r;r=r.nextSibling)r.AJAR_subject&&(a[r.AJAR_subject.uri]=!0);var o={};for(t.statementsMatching(e,_.wf("message"),null,n.chatDocument).map(function(e){return e.object}).map(function(e){o[e.uri]=!0,a[e.uri]||O(e,n)}),r=n.firstChild;r;)i=r.nextSibling,r.AJAR_subject&&!o[r.AJAR_subject.uri]&&n.removeChild(r),r=i}function c(t,n,i){var o=n["?creator"],s=n["?msg"],l=n["?date"],c=n["?content"],d=l.value,h=e.createElement("tr");h.AJAR_date=d,h.AJAR_subject=s;for(var f=!1,p=t.firstChild;p;p=p.nextSibling)if(d>p.AJAR_date&&k||d<p.AJAR_date&&!k){t.insertBefore(h,p),f=!0;break}f||t.appendChild(h);var m=e.createElement("td");h.appendChild(m),u(m,o,r.widgets.shortDate(d),s);var v=e.createElement("td"),g=c.value;if(h.appendChild(v),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)&&a.expandImagesInline){var b=function(t,n){var i=e.createElement("img"),a="10";n.inlineImageHeightEms&&(a=(""+n.inlineImageHeightEms).trim()),i.setAttribute("style","max-height: "+a+"em; border-radius: 1em; margin: 0.7em;"),t&&i.setAttribute("src",t);var o=e.createElement("a");return o.setAttribute("href",t),o.setAttribute("target","images"),o.appendChild(i),r.widgets.makeDraggable(i,$rdf.sym(t)),o}(g,a);v.appendChild(b)}else{var y=e.createElement("p"),w=C?r.pad.lightColorHash(o):i?"#e8ffe8":"white";y.setAttribute("style",E+"background-color: "+w+";"),v.appendChild(y),y.textContent=g}var _=e.createElement("td");h.appendChild(_);var x=e.createElement("button");_.appendChild(x),x.textContent="-",h.setAttribute("class","hoverControl"),x.setAttribute("class","hoverControlHide"),x.setAttribute("style","color: red;"),x.addEventListener("click",function(t){_.removeChild(x);var n=e.createElement("button");n.textContent="cancel",_.appendChild(n).addEventListener("click",function(e){_.removeChild(r),_.removeChild(n),_.appendChild(x)},!1);var r=e.createElement("button");r.textContent="Delete message",_.appendChild(r).addEventListener("click",function(e){_.removeChild(r),_.removeChild(n),j(s)},!1)},!1)}function d(e,t){var n=p(new Date(t.date.getTime()-864e5),!1);k?A.appendChild(n):A.insertBefore(n,A.firstChild)}function h(n,i){t.fetcher.load(i).then(function(e){t.statementsMatching(null,x("message"),null,i).forEach(function(e){O(e.object,n)}),n.fresh=!0},function(t){var i=n.appendChild(e.createElement("tr"));t.response&&t.response.status&&404===t.response.status?i.appendChild(r.widgets.errorMessageBlock(e,"no messages","white")):i.appendChild(r.widgets.errorMessageBlock(e,t,"pink"))})}function f(e){var t=e.toISOString().split("T")[0].replace(/-/g,"/");return t=n.dir().uri+t+"/chat.ttl",$rdf.sym(t)}function p(t,n){var i,s=e.createElement("table");s.date=t;var u=f(t);if(s.chatDocument=u,s.fresh=!1,s.setAttribute("style","width: 100%;"),n){var l=o();k?s.insertBefore(l,s.firstChild):s.appendChild(l),s.inputRow=l}if(a.infinite){var c=e.createElement("tr"),p=k?"noun_1369241.svg":"noun_1369237.svg";i=r.widgets.button(e,r.icons.iconBase+p,"Previous messages ...");var m=c.appendChild(e.createElement("td"));m.appendChild(i),m.style="width:3em; height:3em;";var v=c.appendChild(e.createElement("td"));if(v.style="text-align: center; vertical-align: middle; color: #888; font-style: italic;",v.textContent=r.widgets.shortDate(t.toISOString(),!0),a.menuHandler&&n){g=r.widgets.button(e,r.icons.iconBase+"noun_897914.svg","Menu ...");var b=c.appendChild(e.createElement("td"));b.appendChild(g),b.style="width:3em; height:3em;"}i.addEventListener("click",function(e){var t=s.extended^k?"noun_1369237.svg":"noun_1369241.svg";i.firstChild.setAttribute("src",r.icons.iconBase+t),s.extended?function(e,t){if(k)for(;t.nextSibling;)A.removeChild(t.nextSibling);else for(;t.previousSibling;)A.removeChild(t.previousSibling)}(0,s):d(0,s),s.extended=!s.extended},!1),s.extended=!1,k?s.appendChild(c):s.insertBefore(c,s.firstChild)}return h(s,u),s.fresh=!1,s}function m(){var e=new Date,n=f(e);if(!n.sameTerm(w)){y.inputRow&&(y.removeChild(y.inputRow),delete y.inputRow);var r=w;if(v(),!t.holds(r,_.rdfs("seeAlso"),n,r)){var i=[$rdf.st(r,_.rdfs("seeAlso"),n,r)];T.update([],i,function(e,t){e||alert("Unable to link old message block to new one."+t)})}}return e}function v(){var i=new Date;(function(e){return new Promise(function(n,r){t.fetcher.load(e).then(function(e){n(e)},function(i){404===i.response.status?t.fetcher.webOperation("PUT",e.uri,{data:"",contentType:"text/turtle"}).then(function(e){n(e)},function(e){r(e)}):r(i)})})})(w=f(i)).then(function(e){y=p(i,!0),A.appendChild(y),A.refresh=function(){m(),l(n,y)},t.updater.addDownstreamChangeListener(w,A.refresh)},function(t){A.appendChild(r.widgets.errorMessageBlock(e,"Problem accessing chat log file: "+t))})}t=t||r.store;var g,b,y,w,_=r.ns,x=$rdf.Namespace("http://www.w3.org/2005/01/wf/flow#"),M=$rdf.Namespace("http://purl.org/dc/terms/"),k="1"===(a=a||{}).newestFirst||!0===a.newestFirst,C="1"===a.colorizeByAuthor||!0===a.colorizeByAuthor,E="white-space: pre-wrap; width: 90%; font-size:100%; border: 0.07em solid #eee; padding: .2em 0.5em; margin: 0.1em 1em 0.1em 1em;",A=e.createElement("div"),T=r.store.updater,S=function(t,n){var i=e.createElement("a");return n&&n.uri&&(i.setAttribute("href",n.uri),i.addEventListener("click",r.widgets.openHrefInOutlineMode,!0),i.setAttribute("style","color: #3B5998; text-decoration: none; ")),i.textContent=t,i},I=function(t,n){var r=e.createElement("pre");return r.setAttribute("style",n||"color: grey"),A.appendChild(r),r.appendChild(e.createTextNode(t)),r},N=function(e){I(e,"color: #800;")},j=function(e){var r=t.statementsMatching(e).concat(t.statementsMatching(void 0,void 0,e));T.update(r,[],function(e,t,r){t?l(n,y):N("Cant delete messages:"+r)})},O=function(e,n){c(n,{"?msg":e,"?creator":t.any(e,_.foaf("maker")),"?date":t.any(e,M("created")),"?content":t.any(e,_.sioc("content"))},n.fresh)};return v(),A}},function(e,t,n){"use strict";var r={authn:n(41),icons:n(16),log:n(15),ns:n(6),pad:n(0),rdf:n(23),store:n(8),style:n(42),widgets:n(14)},i=n(21);e.exports=function(e,t,n,a,o){function s(e){var t=r.store.any(e,r.ns.foaf("nick"));return t?""+t.value:""+i.label(e)}function u(t,n,i,a){var o=t.appendChild(y(s(n),n));n.uri&&r.store.fetcher.nowOrWhenFetched(n.doc(),void 0,function(e,t){o.textContent=s(n)}),t.appendChild(e.createElement("br")),t.appendChild(y(i,a))}function l(e,n){var r,i,a={};for(r=n.firstChild;r;r=r.nextSibling)r.AJAR_subject&&(a[r.AJAR_subject.uri]=!0);var o={};for(t.each(e,h.wf("message")).map(function(e){o[e.uri]=!0,a[e.uri]||M(e)}),r=n.firstChild;r;)i=r.nextSibling,r.AJAR_subject&&!o[r.AJAR_subject.uri]&&n.removeChild(r),r=i}t=t||r.store,a=a.doc();var c,d,h=r.ns,f=$rdf.Namespace("http://www.w3.org/2005/01/wf/flow#"),p=$rdf.Namespace("http://purl.org/dc/terms/"),m=!!(o=o||{}).newestFirst,v="white-space: pre-wrap; width: 90%; font-size:100%; border: 0.07em solid #eee; padding: .2em 0.5em; margin: 0.1em 1em 0.1em 1em;",g=e.createElement("div"),b=r.store.updater,y=function(t,n){var i=e.createElement("a");return n&&n.uri&&(i.setAttribute("href",n.uri),i.addEventListener("click",r.widgets.openHrefInOutlineMode,!0),i.setAttribute("style","color: #3B5998; text-decoration: none; ")),i.textContent=t,i},w=function(t,n){var r=e.createElement("pre");return r.setAttribute("style",n||"color: grey"),g.appendChild(r),r.appendChild(e.createTextNode(t)),r},_=function(e){w(e,"color: #800;")},x=function(e){var r=t.statementsMatching(e).concat(t.statementsMatching(void 0,void 0,e));b.update(r,[],function(e,t,r){t?l(n,c):_("Cant delete messages:"+r)})},M=function(e){var n={"?msg":e,"?creator":t.any(e,h.foaf("maker")),"?date":t.any(e,p("created")),"?content":t.any(e,h.sioc("content"))};k(n,!0)},k=function(t,n){var i=t["?creator"],a=t["?msg"],o=t["?date"],s=t["?content"],l=o.value,d=e.createElement("tr");d.AJAR_date=l,d.AJAR_subject=a;for(var h=!1,f=c.firstChild;f;f=f.nextSibling)if(l>f.AJAR_date&&m||l<f.AJAR_date&&!m){c.insertBefore(d,f),h=!0;break}h||c.appendChild(d);var p=e.createElement("td");d.appendChild(p),u(p,i,r.widgets.shortDate(l),a);var g=e.createElement("td");d.appendChild(g);var b=e.createElement("p");b.setAttribute("style",v+(n?"background-color: #e8ffe8;":"background-color: #white;")),g.appendChild(b),b.textContent=s.value;var y=e.createElement("td");d.appendChild(y);var w=e.createElement("button");y.appendChild(w),w.textContent="-",d.setAttribute("class","hoverControl"),w.setAttribute("class","hoverControlHide"),w.setAttribute("style","color: red;"),w.addEventListener("click",function(t){y.removeChild(w);var n=e.createElement("button");n.textContent="cancel",y.appendChild(n).addEventListener("click",function(e){y.removeChild(r),y.removeChild(n),y.appendChild(w)},!1);var r=e.createElement("button");r.textContent="Delete message",y.appendChild(r).addEventListener("click",function(e){y.removeChild(r),y.removeChild(n),x(a)},!1)},!1)};(c=e.createElement("table")).fresh=!1,g.appendChild(c),c.setAttribute("style","width: 100%;");var C,E=function(){var i=e.createElement("tr"),o=e.createElement("td"),s=e.createElement("td"),l=e.createElement("td");i.appendChild(o),i.appendChild(s),i.appendChild(l),i.AJAR_date="9999-01-01T00:00:00Z";var c=function(){f.setAttribute("class","pendingedit"),f.disabled=!0;var o=[],s=new Date,u=""+s.getTime(),l=$rdf.term(s),c=t.sym(a.uri+"#Msg"+u);o.push(new $rdf.Statement(n,h.wf("message"),c,a)),o.push(new $rdf.Statement(c,h.sioc("content"),t.literal(f.value),a)),o.push(new $rdf.Statement(c,p("created"),l,a)),d&&o.push(new $rdf.Statement(c,h.foaf("maker"),d,a)),b.update([],o,function(n,a,o){if(a){var s={"?msg":c,"?content":t.literal(f.value),"?date":l,"?creator":d};k(s,!1),f.value="",f.setAttribute("class",""),f.disabled=!1}else i.appendChild(r.widgets.errorMessageBlock(e,"Error writing message: "+o))})};i.appendChild(e.createElement("br"));var f,m,g={div:s,dom:e};return r.authn.logIn(g).then(function(t){d=t.me,u(o,d,"",null),f=e.createElement("textarea"),s.innerHTML="",s.appendChild(f),f.rows=3,f.setAttribute("style",v+"background-color: #eef;"),f.addEventListener("keyup",function(e){13!==e.keyCode||e.altKey||c()},!1),l.innerHTML="",(m=r.widgets.button(e,r.icons.iconBase+"noun_383448.svg","Send")).setAttribute("style",r.style.buttonStyle+"float: right;"),m.addEventListener("click",c,!1),l.appendChild(m)}),i}();if(m?c.insertBefore(E,c.firstChild):c.appendChild(E),o.query)C=o.query;else{C=new $rdf.Query("Messages");var A={};["msg","date","creator","content"].map(function(e){C.vars.push(A[e]=$rdf.variable(e))}),C.pat.add(n,f("message"),A.msg),C.pat.add(A.msg,h.dct("created"),A.date),C.pat.add(A.msg,h.foaf("maker"),A.creator),C.pat.add(A.msg,h.sioc("content"),A.content)}return t.query(C,k,void 0,function(){c.fresh=!0}),g.refresh=function(){l(n,c)},g}},function(e,t,n){"use strict";var r={icons:n(16),log:n(15),ns:n(6),pad:n(0),rdf:n(23),store:n(8),widgets:n(14)},i=n(21),a=r.store;e.exports.matrixForQuery=function(e,t,n,r,o,s,u){var l=e.createElement("table"),c=e.createElement("tr");c.appendChild(e.createElement("td")).setAttribute("class","MatrixCorner"),l.appendChild(c),l.lastHeader=c;var d=[],h=[],f=function(e,t,n,r){for(;e.firstChild;)e.removeChild(e.firstChild);e.setAttribute("style",""),e.style.textAlign="center",s.cellFunction?s.cellFunction(e,t,n,r):(e.textContent=i.label(r),e.setAttribute("style","padding: 0.3em")),delete e.old},p=function(t){var n=t.toNT();if(h[n])return h[n];var r=e.createElement("tr"),o=r.appendChild(e.createElement("td"));o.setAttribute("style","padding: 0.3em;"),o.textContent=i.label(t),"NamedNode"===t.termType&&a.fetcher.nowOrWhenFetched(t.uri.split("#")[0],void 0,function(e,n,r){e&&(o.textContent=i.label(t))});for(var u=0;u<d.length;u++)f(r.appendChild(e.createElement("td")),$rdf.fromNT(d[u]),t,null);r.dataValueNT=n,h[n]=r;for(var c=l.lastHeader.nextSibling;c;c=c.nextSibling)if(n>c.dataValueNT&&s&&s.yDecreasing||n<c.dataValueNT&&(!s||!s.yDecreasing))return l.insertBefore(r,c);return l.appendChild(r)},m=function(t){for(var n=t.toNT(),r=null,a=0;a<d.length;a++){if(d[a]===n)return a;if(n>d[a]&&s.xDecreasing||n<d[a]&&!s.xDecreasing){d=d.slice(0,a).concat([n]).concat(d.slice(a)),r=a;break}}null===r&&(r=d.length,d.push(n));for(var o=l.firstChild;o;o=o.nextSibling){var u=o.dataValueNT,c=e.createElement("td");if(c.style.textAlign="center",o===l.firstChild?c.textContent=i.label(t):f(c,t,$rdf.fromNT(u),null),r===d.length-1)o.appendChild(c);else{for(var h=o.firstChild,p=0;p<r+1;p++)h=h.nextSibling;o.insertBefore(c,h)}}return r},v=function(){var e,t,n=[],r=[];if(s.set_y)for(var i=0;i<s.set_y.length;i++)r[s.set_y[i]]=!0;if(s.set_x)for(i=0;i<s.set_x.length;i++)n[m(s.set_x[i])+1]=!0;for(var a=1;a<l.children.length;a++){e=l.children[a];for(var o=1;o<e.children.length;o++)if((t=e.children[o]).old){var u=$rdf.fromNT(e.dataValueNT),c=$rdf.fromNT(d[o-1]);f(t,c,u,null)}else r[e.dataValueNT]=!0,n[o]=!0}for(var p=0;p<l.children.length;p++)if(e=l.children[p],0<p&&!r[e.dataValueNT])delete h[e.dataValueNT],l.removeChild(e);else for(var v,g=e.children.length-1;0<g;g--)v=e.children[g],n[g]||e.removeChild(v);for(var b=[],y=0;y<d.length;y++)n[y+1]&&b.push(d[y]);d=b};l.refresh=function(){(function(){for(var e,t=1;t<l.children.length;t++){e=l.children[t];for(var n=1;n<e.children.length;n++)e.children[n].old=!0}})(),a.query(t,g,void 0,v)};var g=function(e){var t=e[n],i=e[r],a=e[o],s=p(i),u=m(t),l=s.children[u+1];f(l,t,i,a)};if(s.set_y)for(var b=0;b<s.set_y.length;b++)p(s.set_y[b]);if(s.set_x)for(b=0;b<s.set_x.length;b++)m(s.set_x[b]);return a.query(t,g,void 0,u),l}},function(e,t,n){"use strict";var r={authn:n(41),icons:n(16),log:n(15),ns:n(6),store:n(8),style:n(42),utils:n(21),widgets:n(14)},i=r.store;e.exports={newThingUI:function(e,t){function n(e){return new Promise(function(t,n){var o,s=function(t,o){var s={newBase:o,workspace:t};for(var u in e)s[u]=e[u];console.log("newThingUI: Minting new "+s.pane.name+" at "+s.newBase),e.pane.mintNew(s).then(function(t){if(!t||!t.newInstance)throw new Error("Cannot mint new - missing newInstance");if(t.folder)i.add(t.folder,r.ns.ldp("contains"),i.sym(t.newBase),t.folder.doc()),t.refreshTarget&&t.refreshTarget.refresh();else{var n=e.div.appendChild(a.createElement("p"));n.setAttribute("style","font-size: 120%;"),n.innerHTML="Your <a target='_blank' href='"+t.newInstance.uri+"'><b>new "+e.noun+"</b></a> is ready to be set up. <br/><br/><a target='_blank' href='"+t.newInstance.uri+"'>Go to your new "+e.noun+".</a>"}d()}).catch(function(e){c(e),n(e)})},u=e.pane;e.appPathSegment="edu.mit.solid.pane."+u.name,e.noun=u.mintClass?r.utils.label(u.mintClass):u.name,e.folder?r.widgets.askName(a,r.store,e.div,r.ns.foaf("name"),null,e.noun).then(function(t){if(t){var n=e.folder.uri;n.endsWith("/")||(n+="/"),n=n+encodeURIComponent(t)+"/",s(null,n)}else d()}):(o=r.authn.selectWorkspace(a,e,s),e.div.appendChild(o))})}var a=e.dom,o=e.div;if(e.me&&!e.me.uri)throw new Error("newThingUI: Invalid userid: "+e.me);var s="padding: 0.7em; width: 2em; height: 2em;",u=o.appendChild(a.createElement("img")),l=!1;u.setAttribute("src",r.icons.iconBase+"noun_34653_green.svg"),u.setAttribute("style",s),u.setAttribute("title","Add another tool to the meeting");var c=function(e){var t=o.appendChild(a.createElement("pre"));t.setAttribute("style","background-color: pink"),t.appendChild(a.createTextNode(e))},d=function(e){l=!l,u.setAttribute("style",s+(l?"background-color: yellow;":"")),g(l?"":"display: none;")};u.addEventListener("click",d);var h=[];for(var f in t){var p=t[f];if(p.mintNew){var m=e.div.appendChild(a.createElement("img"));m.setAttribute("src",p.icon);var v=p.mintClass?r.utils.label(p.mintClass):p.name+" @@";m.setAttribute("title","Make new "+v),m.setAttribute("style",s+"display: none;"),h.push(m),function(t,r,i){var a=r,o=t,s=i;r.disabled||r.addEventListener("click",function(t){b(a),n({event:t,folder:e.folder,iconEle:a,pane:o,noun:s,noIndexHTML:!0,div:e.div,me:e.me,dom:e.dom,refreshTarget:e.refreshTarget})})}(p,m,v)}}var g=function(e){for(var t,n=0;n<h.length;n++)t=s+e,h[n].disabled&&(t+="opacity: 0.3;"),h[n].setAttribute("style",t)},b=function(e){g("display: none;"),e.setAttribute("style",s+"background-color: yellow;")}}}},function(e,t,n){"use strict";function r(e){this.config=e||i}var i=n(135);r.prototype.listen=function(){return new Promise(function(e,t){var n=window.addEventListener?"addEventListener":"attachEvent";(0,window[n])("attachEvent"==n?"onmessage":"message",function(n){var r=n.data;if("User:"===r.slice(0,5)){var i=r.slice(5,r.length);return i&&0<i.length&&"http"===i.slice(0,4)?e(i):t(i)}},!0)})},r.prototype.signup=function(e){e=e||this.config.signupEndpoint;var t=this.config.signupWindowWidth,n=this.config.signupWindowHeight,r=window.screen.width/2-(t/2+10),i=window.screen.height/2-(n/2+50),a=e+"?origin="+encodeURIComponent(window.location.origin),o="resizable,scrollbars,status,width="+t+",height="+n+",left="+r+",top="+i;window.open(a,"Solid signup",o);var s=this;return new Promise(function(e){s.listen().then(function(t){return e(t)})})},e.exports=r},function(e,t,n){"use strict";function r(e){return e=Object.assign({},a,e),i(o.PRIMARY,e).then(function(t){return t||i(o.SECONDARY,e)})}function i(e,t){return function(e,t){var n;return e===o.PRIMARY?n=t.authEndpoint||window.location.origin+window.location.pathname:e===o.SECONDARY&&(n=t.fallbackAuthEndpoint),new Promise(function(e,t){var r=new XMLHttpRequest;r.withCredentials=!0,r.addEventListener("load",function(){e(r.getResponseHeader("user")||null)}),r.addEventListener("error",function(e){t(e)}),r.open("HEAD",n),r.send()})}(e,t)}var a=n(135),o={PRIMARY:0,SECONDARY:1},s=r;e.exports={currentUser:s,login:r}},function(e,t,n){"use strict";var r=n(286);e.exports={Signup:n(285),login:r.login,currentUser:r.currentUser}},function(e,t,n){"use strict";var r={};r.acl=n(169),r.icons=n(16),r.ns=n(6),r.widgets=n(14),r.style=n(42),r.utils=n(21),r.aclControl=e.exports={},r.aclControl.preventBrowserDropEvents=function(e){function t(e){e.stopPropagation(),e.preventDefault()}if(console.log("preventBrowserDropEvents called."),"undefined"!=typeof window){if(window.preventBrowserDropEventsDone)return;window.preventBrowserDropEventsDone=!0}e.addEventListener("drop",function(e){0<e.dataTransfer.files.length&&!confirm("Are you sure you want to drop this file here? (Cancel opens it in a new tab)")&&(e.stopPropagation(),e.preventDefault(),console.log("@@@@ document-level DROP suppressed: "+e.dataTransfer.dropEffect))},!1),e.addEventListener("dragenter",t,!1),e.addEventListener("dragover",t,!1)},r.aclControl.shortNameForFolder=function(e){var t=e.uri;"/"===t.slice(-1)&&(t=t.slice(0,-1));var n=t.lastIndexOf("/");return 0<=n&&(t=t.slice(n+1)),t||"/"},r.aclControl.ACLControlBox5=function(e,t,n,i,a){function o(n,i,a,o,s){var l=s.doingDefault?"default":"main";s=s||{};var c,d=r.acl.readACL(i,a,o,s.doingDefaults);n[l]=c=r.acl.ACLbyCombination(d);var h=function(e){for(var t=["Read","Append","Write","Control"],n=[],r=0;4>r;r++)e&1<<r&&n.push("http://www.w3.org/ns/auth/acl#"+t[r]);return n.sort(),n=n.join("\n")},f={1:"Viewers",2:"Submitters",3:"Posters",5:"Editors",9:"Owners (write locked)",13:"Owners"},p={1:!0,2:!0,3:!0,5:!0,13:!0},m={1:"can read but not change information",2:"can add new information but not read any",3:"can add new information, and read but not change existing information",5:"can read and change information",9:"can read and control sharing, currently write-locked.",13:"can read, write, and control sharing."},v={1:"green",2:"#cc0",3:"orange",5:"red",9:"blue",13:"purple"},g=function(e){for(var t="",n=["Read","Append","Write","Control"],r=0;4>r;r++)e&1<<r&&(t+=n[r]);return t},b=function(e){for(var t,n=0;16>n;n++)if(t=c[h(n)])for(var r=0;r<t.length;r++)for(;r<t.length&&t[r][1]===e;)t.splice(r,1)},y=function(e){var t=r.ns,n=$rdf.sym(e),i=o.findTypeURIs(n);for(var a in i)console.log(" drop object type includes: "+a);if(e.startsWith("http")&&3===e.split("/").length)return{pred:"origin",obj:n};if(t.vcard("WebID").uri in i)return{pred:"agent",obj:n};if(t.vcard("Group").uri in i)return{pred:"agentGroup",obj:n};if(n.sameTerm(t.foaf("Agent"))||n.sameTerm(t.rdf("Resource"))||n.sameTerm(t.owl("Thing")))return{pred:"agentClass",obj:n};if(t.vcard("Individual").uri in i||t.foaf("Person").uri in i||t.foaf("Agent").uri in i){var s=o.any(n,t.foaf("preferredURI"));return s?{pred:"agent",obj:$rdf.sym(s)}:{pred:"agent",obj:n}}return t.solid("AppProvider").uri in i?{pred:"origin",obj:n}:t.solid("AppProviderClass").uri in i?{pred:"originClass",obj:n}:void console.log(" Triage fails for "+e)};n.saveBack=function(e){var t=$rdf.graph();n.isContainer?n.defaultsDiffer?(r.acl.makeACLGraphbyCombo(t,i,n.mainByCombo,a,!0),r.acl.makeACLGraphbyCombo(t,i,n.defByCombo,a,!1,!0)):r.acl.makeACLGraphbyCombo(t,i,n.mainByCombo,a,!0,!0):r.acl.makeACLGraphbyCombo(t,i,n.mainByCombo,a,!0),(t.updater||new $rdf.UpdateManager(t)).put(a,t.statementsMatching(void 0,void 0,void 0,a),"text/turtle",function(n,r,i){var s=null;r?(o.fetcher.unload(a),o.add(t.statements),o.fetcher.requested[a.uri]="done",console.log("ACL modification: success!")):(s="ACL file save failed: "+i,console.log(s)),e(r,s)})};var w,_,x=function(i,a){var l=n.appendChild(t.createElement("tr"));l.combo=a,l.setAttribute("style","color: "+(s.modify?v[w]||"black":"#888")+";");var c=l.appendChild(t.createElement("td"));c.textContent=f[w]||g[w],c.setAttribute("style","padding-bottom: 2em;");var d=l.appendChild(t.createElement("td")).appendChild(t.createElement("table"));d.style.width="100%";var h=l.appendChild(t.createElement("td"));h.textContent=m[w]||"Unusual combination",h.setAttribute("style","max-width: 30%;");var p=function(e,o){d.NoneTR&&(d.removeChild(d.NoneTR),delete d.NoneTR);var l={};s.modify&&(l.deleteFunction=function(){for(var t=i[a],r=0;r<t.length;r++)if(t[r][0]===e&&t[r][1]===o){t.splice(r,1);break}n.saveBack(function(e,t){e?d.removeChild(c):alert(t)})});var c=d.appendChild(r.widgets.personTR(t,u(e),$rdf.sym(o),l));c.predObj=[e.uri,o.uri]},_=function(e){var n,a=i[e];if(a&&a.length){var o=d.children;a.sort();for(var s=0;s<o.length;s++)o[s].trashme=!0;for(var u,l=0;l<a.length;l++){for(u=!1,n=0;n<o.length;n++)if(o[n].predObj&&o[n].predObj[0]===a[l][0]&&o[n].predObj[1]===a[l][1]){u=!0,delete o[n].trashme;break}u||p(a[l][0],a[l][1])}for(n=o.length-1;0<=n;n--)o[n].trashme&&d.removeChild(o[n])}else{r.widgets.clearElement(d);var c=d.appendChild(t.createElement("tr"));c.textContent="None",c.setAttribute("style","padding: 1em;"),d.NoneTR=c}};_(a),l.refresh=function(){_(a)},s.modify&&(l.addEventListener("dragover",function(e){e.preventDefault(),e.dataTransfer.dropEffect="copy"}),l.addEventListener("dragenter",function(e){console.log("dragenter event dropEffect: "+e.dataTransfer.dropEffect),this.style.backgroundColor="#ccc",e.dataTransfer.dropEffect="link",console.log("dragenter event dropEffect 2: "+e.dataTransfer.dropEffect)}),l.addEventListener("dragleave",function(e){console.log("dragleave event dropEffect: "+e.dataTransfer.dropEffect),this.style.backgroundColor="white"}),l.addEventListener("drop",function(t){t.preventDefault&&t.preventDefault(),console.log("Drop event. dropEffect: "+t.dataTransfer.dropEffect),console.log("Drop event. types: "+(t.dataTransfer.types?t.dataTransfer.types.join(", "):"NOPE"));var r,s=null,u=this;if(t.dataTransfer.types){for(var l,c=0;c<t.dataTransfer.types.length;c++)"text/uri-list"===(l=t.dataTransfer.types[c])?(s=t.dataTransfer.getData(l).split("\n"),console.log("Dropped text/uri-list: "+s)):"text/plain"===l&&(r=t.dataTransfer.getData(l));null===s&&r&&"http"===r.slice(0,4)&&(s=r,console.log("Waring: Poor man's drop: using text for URI"))}else s=[t.dataTransfer.getData("Text")],console.log("@@ WARNING non-standrad drop event: "+s[0]);return console.log("Dropped URI list (2): "+s),s&&s.map(function(t){var r=function(){a in i||(i[a]=[]),b(t),i[a].push([s.pred,s.obj.uri]),console.log("ACL: setting access to "+e+" by "+s.pred+": "+s.obj),n.saveBack(function(e,t){e?(u.style.backgroundColor="white",M()):alert(t)})},s=y(t);s?r():(console.log(" looking up dropped thing "+t),o.fetcher.nowOrWhenFetched(t,function(e,n){e?(s=y(t))?r():console.log("Error: Drop fails to drop appropriate thing! "+t):console.log("Error looking up dropped thing "+t+": "+n)}))}),!1}))},M=function(){for(var e=n.children,t=0;t<e.length;t++)e[t].refresh&&e[t].refresh()};for(w=15;0<w;w--)_=h(w),(s.modify&&p[w]||c[_])&&x(c,_);return c}var s=i.updater||new $rdf.UpdateManager(i),u=r.ns.acl,l=e.doc(),c=t.createElement("table");c.setAttribute("style","margin: 1em; border: 0.1em #ccc ;");var d=c.appendChild(t.createElement("tr"));d.textContent="Sharing for "+n+" "+r.utils.label(e),d.setAttribute("style","min-width: 20em; padding: 1em; font-size: 120%; border-bottom: 0.1em solid red; margin-bottom: 2em;");var h=c.appendChild(t.createElement("tr")).appendChild(t.createElement("td")).appendChild(t.createElement("div"));h.setAttribute("style","padding: 2em;");var f=c.appendChild(t.createElement("tr")).appendChild(t.createElement("table")),p=c.appendChild(t.createElement("tr")),m=p.appendChild(t.createElement("td")).appendChild(r.widgets.button(t,r.icons.iconBase+"noun_98053.svg","Public"));r.widgets.makeDraggable(m,r.ns.foaf("Agent"));var v="border-radius: 0.3em; background-color: white; border: 0.1em solid #888;";return function e(){f.innerHTML="",r.acl.getACLorDefault(l,function(a,c,d,m,g,b){var y=!c;if(a)if(f.isContainer="/"===d.uri.slice(-1),y)if(i.each(void 0,u("defaultForNew"),g,b).length){h.innerHTML="",h.textContent="The sharing for this "+n+" is the default for folder ";var w=h.appendChild(t.createElement("a"));w.setAttribute("href",g.uri),w.textContent=r.aclControl.shortNameForFolder(g);var _=r.acl.adoptACLDefault(l,m,g,b);o(f,l,m,_,{modify:!1}),f.style.cssText="color: #777;";var x=p.appendChild(t.createElement("button"));x.textContent="Set specific sharing\nfor this "+n,x.style.cssText=v,x.addEventListener("click",function(t){s.put(m,_.statements,"text/turtle",function(t,r,a){r?(i.add(_.statements),h.textContent=" (Now editing specific access for this "+n+")",p.removeChild(x),e()):h.textContent+=" (Error writing back access control file: "+a+")"})})}else h.textContent+=" (No defaults given.)";else{var M,k,C=function(a){(M=p.appendChild(t.createElement("button"))).textContent="Stop specific sharing for this "+n+" -- just use default",a&&(M.textContent+=" for "+r.utils.label(a)),M.style.cssText=v,M.addEventListener("click",function(t){i.fetcher.delete(m.uri).then(function(){h.textContent=" The sharing for this "+n+" is now the default.",p.removeChild(M),f.style.cssText="color: #777;",e()}).catch(function(e){h.textContent+=" (Error deleting access control file: "+m+": "+e+")"})})},E=d.uri.split("#")[0],A=E.slice(0,-1).lastIndexOf("/"),T=E.indexOf("//"),S=0<=T&&A<T+2||0>A?null:E.slice(0,A+1);if(S?r.acl.getACLorDefault($rdf.sym(S),function(e,t,n,r,i,a){e&&(k=t?n:i),C(k)}):C(),f.addControlForDefaults=function(){f.notice.textContent="Access to things within this folder:",f.notice.style.cssText="font-size: 120%; color: black;";var e=r.widgets.clearElement(f.offer).appendChild(t.createElement("button"));e.innerHTML="<p>Set default for folder contents to<br />just track the sharing for the folder</p>",e.style.cssText=v,e.addEventListener("click",function(e){delete f.defaultsDiffer,delete f.defByCombo,f.saveBack(function(e,t){e?f.removeControlForDefaults():alert(t)})},!1),f.defaultsDiffer=!0,f.defByCombo=o(f,d,m,i,{modify:!0,doingDefaults:!0})},f.removeControlForDefaults=function(){h.textContent="This is also the default for things in this folder.",f.notice.textContent="Sharing for things within the folder currently tracks sharing for the folder.",f.notice.style.cssText="font-size: 80%; color: #888;";var e=r.widgets.clearElement(f.offer).appendChild(t.createElement("button"));for(e.innerHTML="<p>Set the sharing of folder contets <br />separately from the sharing for the folder</p>",e.style.cssText=v,e.addEventListener("click",function(e){f.addControlForDefaults(),h.textContent=""});f.divider.nextSibling;)f.removeChild(f.divider.nextSibling);h.textContent="This is now also the default for things in this folder."},f.mainByCombo=o(f,d,m,i,{modify:!0}),f.divider=f.appendChild(t.createElement("tr")),f.notice=f.divider.appendChild(t.createElement("td")),f.notice.style.cssText="font-size: 80%; color: #888;",f.offer=f.divider.appendChild(t.createElement("td")),f.notice.setAttribute("colspan","2"),f.isContainer){var I=r.acl.readACL(d,m,i),N=r.acl.readACL(d,m,i,!0);f.defaultsDiffer=!r.acl.sameACL(I,N),console.log("Defaults differ ACL: "+f.defaultsDiffer),f.defaultsDiffer?f.addControlForDefaults():f.removeControlForDefaults()}}else h.textContent+="Error reading "+(y?" default ":"")+"ACL. status "+d+": "+m})}(),c}},function(e,t,n){(function(e){function n(e,t){for(var n,r=0,i=e.length-1;0<=i;i--)"."===(n=e[i])?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--);if(t)for(;r--;r)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return i.exec(e).slice(1)};t.resolve=function(){for(var t,i="",a=!1,o=arguments.length-1;-1<=o&&!a;o--){if("string"!=typeof(t=0<=o?arguments[o]:e.cwd()))throw new TypeError("Arguments to path.resolve must be strings");t&&(i=t+"/"+i,a="/"===t.charAt(0))}return i=n(r(i.split("/"),function(e){return!!e}),!a).join("/"),(a?"/":"")+i||"."},t.normalize=function(e){var i=t.isAbsolute(e),a="/"===o(e,-1);return(e=n(r(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&a&&(e+="/"),(i?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;0<=n&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),a=r(n.split("/")),o=_Mathmin(i.length,a.length),s=o,u=0;u<o;u++)if(i[u]!==a[u]){s=u;break}var l=[];for(u=s;u<i.length;u++)l.push("..");return(l=l.concat(a.slice(s))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=a(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},t.basename=function(e,t){var n=a(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){return a(e)[3]};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return 0>t&&(t=e.length+t),e.substr(t,n)}}).call(this,n(11))},function(e){e.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana"},"application/3gpp-ims+xml":{source:"iana"},"application/a2l":{source:"iana"},"application/activemessage":{source:"iana"},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana"},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",extensions:["atomsvc"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana"},"application/bacnet-xdd+zip":{source:"iana"},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana"},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana"},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/cbor":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana"},"application/ccxml+xml":{source:"iana",extensions:["ccxml"]},"application/cdfx+xml":{source:"iana"},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana"},"application/cellml+xml":{source:"iana"},"application/cfw":{source:"iana"},"application/clue_info+xml":{source:"iana"},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana"},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana"},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana"},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana"},"application/cstadata+xml":{source:"iana"},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",extensions:["mpd"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana"},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana"},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/docbook+xml":{source:"apache",extensions:["dbk"]},"application/dskpp+xml":{source:"iana"},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/emergencycalldata.comment+xml":{source:"iana"},"application/emergencycalldata.control+xml":{source:"iana"},"application/emergencycalldata.deviceinfo+xml":{source:"iana"},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana"},"application/emergencycalldata.serviceinfo+xml":{source:"iana"},"application/emergencycalldata.subscriberinfo+xml":{source:"iana"},"application/emergencycalldata.veds+xml":{source:"iana"},"application/emma+xml":{source:"iana",extensions:["emma"]},"application/emotionml+xml":{source:"iana"},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana"},"application/epub+zip":{source:"iana",extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana"},"application/fhir+xml":{source:"iana"},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1,extensions:["woff"]},"application/framework-attributes+xml":{source:"iana"},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geoxacml+xml":{source:"iana"},"application/gml+xml":{source:"iana",extensions:["gml"]},"application/gpx+xml":{source:"apache",extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana"},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana"},"application/ibe-pkg-reply+xml":{source:"iana"},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana"},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana"},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana"},"application/kpml-response+xml":{source:"iana"},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana"},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana"},"application/lost+xml":{source:"iana",extensions:["lostxml"]},"application/lostsync+xml":{source:"iana"},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",extensions:["mads"]},"application/manifest+json":{charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",extensions:["mathml"]},"application/mathml-content+xml":{source:"iana"},"application/mathml-presentation+xml":{source:"iana"},"application/mbms-associated-procedure-description+xml":{source:"iana"},"application/mbms-deregister+xml":{source:"iana"},"application/mbms-envelope+xml":{source:"iana"},"application/mbms-msk+xml":{source:"iana"},"application/mbms-msk-response+xml":{source:"iana"},"application/mbms-protection-description+xml":{source:"iana"},"application/mbms-reception-report+xml":{source:"iana"},"application/mbms-register+xml":{source:"iana"},"application/mbms-register-response+xml":{source:"iana"},"application/mbms-schedule+xml":{source:"iana"},"application/mbms-user-service-description+xml":{source:"iana"},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana"},"application/media_control+xml":{source:"iana"},"application/mediaservercontrol+xml":{source:"iana",extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",extensions:["metalink"]},"application/metalink4+xml":{source:"iana",extensions:["meta4"]},"application/mets+xml":{source:"iana",extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mmt-usd+xml":{source:"iana"},"application/mods+xml":{source:"iana",extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana"},"application/mrb-publish+xml":{source:"iana"},"application/msc-ivr+xml":{source:"iana"},"application/msc-mixer+xml":{source:"iana"},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana"},"application/n-triples":{source:"iana"},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana"},"application/news-groupinfo":{source:"iana"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana"},"application/node":{source:"iana"},"application/nss":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p2p-overlay+xml":{source:"iana"},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana"},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana"},"application/pidf-diff+xml":{source:"iana"},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",extensions:["pls"]},"application/poc-settings+xml":{source:"iana"},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana"},"application/provenance+xml":{source:"iana"},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.hpub+zip":{source:"iana"},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana"},"application/pskc+xml":{source:"iana",extensions:["pskcxml"]},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf"]},"application/reginfo+xml":{source:"iana",extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",extensions:["rld"]},"application/rfc+xml":{source:"iana"},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana"},"application/rls-services+xml":{source:"iana",extensions:["rs"]},"application/route-apd+xml":{source:"iana"},"application/route-s-tsid+xml":{source:"iana"},"application/route-usd+xml":{source:"iana"},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana"},"application/samlmetadata+xml":{source:"iana"},"application/sbml+xml":{source:"iana",extensions:["sbml"]},"application/scaip+xml":{source:"iana"},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/sep+xml":{source:"iana"},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",extensions:["shf"]},"application/sieve":{source:"iana"},"application/simple-filter+xml":{source:"iana"},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",extensions:["srx"]},"application/spirits-event+xml":{source:"iana"},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",extensions:["grxml"]},"application/sru+xml":{source:"iana",extensions:["sru"]},"application/ssdl+xml":{source:"apache",extensions:["ssdl"]},"application/ssml+xml":{source:"iana",extensions:["ssml"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/tei+xml":{source:"iana",extensions:["tei","teicorpus"]},"application/thraud+xml":{source:"iana",extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tnauthlist":{source:"iana"},"application/trig":{source:"iana"},"application/ttml+xml":{source:"iana"},"application/tve-trigger":{source:"iana"},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana"},"application/urc-ressheet+xml":{source:"iana"},"application/urc-targetdesc+xml":{source:"iana"},"application/urc-uisocketdesc+xml":{source:"iana"},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana"},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana"},"application/vnd.3gpp-prose+xml":{source:"iana"},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana"},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana"},"application/vnd.3gpp.bsf+xml":{source:"iana"},"application/vnd.3gpp.gmop+xml":{source:"iana"},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana"},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana"},"application/vnd.3gpp.mcptt-info+xml":{source:"iana"},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana"},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana"},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana"},"application/vnd.3gpp.mid-call+xml":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana"},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana"},"application/vnd.3gpp.srvcc-info+xml":{source:"iana"},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana"},"application/vnd.3gpp.ussd+xml":{source:"iana"},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana"},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",extensions:["mpkg"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana"},"application/vnd.balsamiq.bmml+xml":{source:"iana"},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana"},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana"},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana"},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",extensions:["wbs"]},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana"},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana"},"application/vnd.cybank":{source:"iana"},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume-movie":{source:"iana"},"application/vnd.desmume.movie":{source:"apache"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana"},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana"},"application/vnd.dvb.notif-container+xml":{source:"iana"},"application/vnd.dvb.notif-generic+xml":{source:"iana"},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana"},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana"},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana"},"application/vnd.dvb.notif-init+xml":{source:"iana"},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana"},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana"},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana"},"application/vnd.eszigno3+xml":{source:"iana",extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana"},"application/vnd.etsi.asic-e+zip":{source:"iana"},"application/vnd.etsi.asic-s+zip":{source:"iana"},"application/vnd.etsi.cug+xml":{source:"iana"},"application/vnd.etsi.iptvcommand+xml":{source:"iana"},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana"},"application/vnd.etsi.iptvprofile+xml":{source:"iana"},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana"},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana"},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana"},"application/vnd.etsi.iptvservice+xml":{source:"iana"},"application/vnd.etsi.iptvsync+xml":{source:"iana"},"application/vnd.etsi.iptvueprofile+xml":{source:"iana"},"application/vnd.etsi.mcid+xml":{source:"iana"},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana"},"application/vnd.etsi.pstn+xml":{source:"iana"},"application/vnd.etsi.sci+xml":{source:"iana"},"application/vnd.etsi.simservs+xml":{source:"iana"},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana"},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana"},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana"},"application/vnd.gov.sk.e-form+zip":{source:"iana"},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana"},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana"},"application/vnd.imagemeter.image+zip":{source:"iana"},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana"},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana"},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana"},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana"},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana"},"application/vnd.iptc.g2.newsitem+xml":{source:"iana"},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana"},"application/vnd.iptc.g2.packageitem+xml":{source:"iana"},"application/vnd.iptc.g2.planningitem+xml":{source:"iana"},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",extensions:["lasxml"]},"application/vnd.liberty-request+xml":{source:"iana"},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",extensions:["lbe"]},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana"},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana"},"application/vnd.marlin.drm.conftoken+xml":{source:"iana"},"application/vnd.marlin.drm.license+xml":{source:"iana"},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana"},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana"},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana"},"application/vnd.ms-printing.printticket+xml":{source:"apache"},"application/vnd.ms-printschematicket+xml":{source:"iana"},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana"},"application/vnd.nokia.iptv.config+xml":{source:"iana"},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana"},"application/vnd.nokia.landmarkcollection+xml":{source:"iana"},"application/vnd.nokia.n-gage.ac+xml":{source:"iana"},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana"},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana"},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana"},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana"},"application/vnd.oipf.dae.xhtml+xml":{source:"iana"},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana"},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana"},"application/vnd.oipf.spdlist+xml":{source:"iana"},"application/vnd.oipf.ueprofile+xml":{source:"iana"},"application/vnd.oipf.userprofile+xml":{source:"iana"},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana"},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana"},"application/vnd.oma.bcast.imd+xml":{source:"iana"},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana"},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana"},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana"},"application/vnd.oma.bcast.sprov+xml":{source:"iana"},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana"},"application/vnd.oma.cab-feature-handler+xml":{source:"iana"},"application/vnd.oma.cab-pcc+xml":{source:"iana"},"application/vnd.oma.cab-subs-invite+xml":{source:"iana"},"application/vnd.oma.cab-user-prefs+xml":{source:"iana"},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana"},"application/vnd.oma.group-usage-list+xml":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana"},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana"},"application/vnd.oma.poc.final-report+xml":{source:"iana"},"application/vnd.oma.poc.groups+xml":{source:"iana"},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana"},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana"},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana"},"application/vnd.oma.xcap-directory+xml":{source:"iana"},"application/vnd.omads-email+xml":{source:"iana"},"application/vnd.omads-file+xml":{source:"iana"},"application/vnd.omads-folder+xml":{source:"iana"},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana"},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana"},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana"},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana"},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana"},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana"},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos+xml":{source:"iana"},"application/vnd.paos.xml":{source:"apache"},"application/vnd.patentdive":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana"},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana"},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana"},"application/vnd.radisys.msml+xml":{source:"iana"},"application/vnd.radisys.msml-audit+xml":{source:"iana"},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana"},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana"},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana"},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana"},"application/vnd.radisys.msml-conf+xml":{source:"iana"},"application/vnd.radisys.msml-dialog+xml":{source:"iana"},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana"},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana"},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana"},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana"},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana"},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana"},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana"},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.software602.filler.form+xml":{source:"iana"},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana"},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana"},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.tmd.mediaflex.api+xml":{source:"iana"},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana"},"application/vnd.wv.ssp+xml":{source:"iana"},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana"},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",extensions:["zaz"]},"application/voicexml+xml":{source:"iana",extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana"},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"apache",extensions:["der","crt","pem"]},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana"},"application/xaml+xml":{source:"apache",extensions:["xaml"]},"application/xcap-att+xml":{source:"iana"},"application/xcap-caps+xml":{source:"iana"},"application/xcap-diff+xml":{source:"iana",extensions:["xdf"]},"application/xcap-el+xml":{source:"iana"},"application/xcap-error+xml":{source:"iana"},"application/xcap-ns+xml":{source:"iana"},"application/xcon-conference-info+xml":{source:"iana"},"application/xcon-conference-info-diff+xml":{source:"iana"},"application/xenc+xml":{source:"iana",extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache"},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana"},"application/xmpp+xml":{source:"iana"},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",extensions:["xpl"]},"application/xslt+xml":{source:"iana",extensions:["xslt"]},"application/xspf+xml":{source:"apache",extensions:["xspf"]},"application/xv+xml":{source:"iana",extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana"},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana"},"application/yin+xml":{source:"iana",extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana"},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana"},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tone":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana"},"image/apng":{compressible:!1,extensions:["apng"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana"},"image/emf":{source:"iana"},"image/fits":{source:"iana"},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana"},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana"},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana"},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/tiff-fx":{source:"iana"},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana"},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana"},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana"},"image/vnd.valve.source.texture":{source:"iana"},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana"},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana"},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/vnd.collada+xml":{source:"iana",extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana"},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana"},"model/vnd.parasolid.transmit.binary":{source:"iana"},"model/vnd.parasolid.transmit.text":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.valve.source.compiled-map":{source:"iana"},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana"},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana"},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana",compressible:!1},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fwdred":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shex":{extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana"},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vp8":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}},function(e,t,n){e.exports=n(290)},function(e,t,n){"use strict";(function(e,r){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}function a(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>f||0>e)throw new TypeError("offset must be a uint32");if(e>d||e>t)throw new RangeError("offset out of range")}function o(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>f||0>e)throw new TypeError("size must be a uint32");if(e+t>n||e>d)throw new RangeError("buffer too small")}function s(e,t,n,i){if(r.browser){var a=e.buffer,o=new Uint8Array(a,t,n);return h.getRandomValues(o),i?void r.nextTick(function(){i(null,e)}):e}if(!i)return l(n).copy(e,t),e;l(n,function(n,r){return n?i(n):(r.copy(e,t),void i(null,e))})}var u=n(3),l=n(44),c=u.Buffer,d=u.kMaxLength,h=e.crypto||e.msCrypto,f=4294967295;h&&h.getRandomValues||!r.browser?(t.randomFill=function(t,n,r,i){if(!(c.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof n)i=n,n=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-n;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return a(n,t.length),o(r,n,t.length),s(t,n,r,i)},t.randomFillSync=function(t,n,r){if(void 0===n&&(n=0),!(c.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return a(n,t.length),void 0===r&&(r=t.length-n),o(r,n,t.length),s(t,n,r)}):(t.randomFill=i,t.randomFillSync=i)}).call(this,n(5),n(11))},function(e,t,n){(function(t){function r(e,n){e.modulus;var r=e.modulus.byteLength(),i=(n.length,l("sha1").update(new t("")).digest()),s=i.length;if(0!==n[0])throw new Error("decryption error");var u=n.slice(1,s+1),c=n.slice(s+1),d=o(u,a(c,s)),h=o(c,a(d,r-s-1));if(function(e,n){e=new t(e),n=new t(n);var r=0,i=e.length;e.length!==n.length&&(r++,i=_Mathmin(e.length,n.length));for(var a=-1;++a<i;)r+=e[a]^n[a];return r}(i,h.slice(0,s)))throw new Error("decryption error");for(var f=s;0===h[f];)f++;if(1!==h[f++])throw new Error("decryption error");return h.slice(f)}var i=n(67),a=n(139),o=n(138),s=n(92),u=n(94),l=n(54),c=n(137);e.exports=function(e,n,a){var o;o=e.padding?e.padding:a?1:4;var l,d=i(e),h=d.modulus.byteLength();if(n.length>h||0<=new s(n).cmp(d.modulus))throw new Error("decryption error");l=a?c(new s(n),d):u(n,d);var f=new t(h-l.length);if(f.fill(0),l=t.concat([f,l],h),4===o)return r(d,l);if(1===o)return function(e,t,n){for(var r=t.slice(0,2),i=2,a=0;0!==t[i++];)if(i>=t.length){a++;break}var o=t.slice(2,i-1);if(t.slice(i-1,i),("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&a++,8>o.length&&a++,a)throw new Error("decryption error");return t.slice(i)}(0,l,a);if(3===o)return l;throw new Error("unknown padding")}}).call(this,n(2).Buffer)},function(e,t){},function(e,t,n){(function(t){function r(e,n){var r=e.modulus.byteLength(),i=n.length,a=u("sha1").update(new t("")).digest(),o=a.length,h=2*o;if(i>r-h-2)throw new Error("message too long");var f=new t(r-i-h-2);f.fill(0);var p=r-o-1,m=s(o),v=c(t.concat([a,f,new t([1]),n],p),l(m,p)),g=c(m,l(v,o));return new d(t.concat([new t([0]),g,v],r))}function i(e,n,r){var i,o=n.length,s=e.modulus.byteLength();if(o>s-11)throw new Error("message too long");return r?(i=new t(s-o-3)).fill(255):i=a(s-o-3),new d(t.concat([new t([0,r?1:2]),i,new t([0]),n],s))}function a(e,n){for(var r,i=new t(e),a=0,o=s(2*e),u=0;a<e;)u===o.length&&(o=s(2*e),u=0),(r=o[u++])&&(i[a++]=r);return i}var o=n(67),s=n(44),u=n(54),l=n(139),c=n(138),d=n(92),h=n(137),f=n(94);e.exports=function(e,t,n){var a;a=e.padding?e.padding:n?1:4;var s,u=o(e);if(4===a)s=r(u,t);else if(1===a)s=i(u,t,n);else{if(3!==a)throw new Error("unknown padding");if(0<=(s=new d(t)).cmp(u.modulus))throw new Error("data too long for modulus")}return n?f(s,u):h(s,u)}}).call(this,n(2).Buffer)},function(e,t,n){t.publicEncrypt=n(295),t.privateDecrypt=n(293),t.privateEncrypt=function(e,n){return t.publicEncrypt(e,n,!0)},t.publicDecrypt=function(e,n){return t.privateDecrypt(e,n,!0)}},function(e,t){},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(297).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t,n){(function(t){function r(e){this.curveType=s[e],this.curveType||(this.curveType={name:e}),this.curve=new a.ec(this.curveType.name),this.keys=void 0}function i(e,n,r){Array.isArray(e)||(e=e.toArray());var i=new t(e);if(r&&i.length<r){var a=new t(r-i.length);a.fill(0),i=t.concat([a,i])}return n?i.toString(n):i}var a=n(7),o=n(298);e.exports=function(e){return new r(e)};var s={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};s.p224=s.secp224r1,s.p256=s.secp256r1=s.prime256v1,s.p192=s.secp192r1=s.prime192v1,s.p384=s.secp384r1,s.p521=s.secp521r1,r.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},r.prototype.computeSecret=function(e,n,r){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),i(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},r.prototype.getPublicKey=function(e,t){var n=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(n[n.length-1]%2?n[0]=7:n[0]=6),i(n,e)},r.prototype.getPrivateKey=function(e){return i(this.keys.getPrivate(),e)},r.prototype.setPublicKey=function(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this.keys._importPublic(e),this},r.prototype.setPrivateKey=function(e,n){n=n||"utf8",t.isBuffer(e)||(e=new t(e,n));var r=new o(e);return r=r.toString(16),this.keys._importPrivate(r),this}}).call(this,n(2).Buffer)},function(e,t,n){(function(t){function r(e,t,n){var r=l[n.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var i=new s(r),a=n.data.subjectPrivateKey.data;return i.verify(t,e,a)}function i(e,t,n){var r=n.data.p,i=n.data.q,s=n.data.g,l=n.data.pub_key,c=u.signature.decode(e,"der"),d=c.s,h=c.r;a(d,i),a(h,i);var f=o.mont(r),p=d.invm(i);return 0===s.toRed(f).redPow(new o(t).mul(p).mod(i)).fromRed().mul(l.toRed(f).redPow(h.mul(p).mod(i)).fromRed()).mod(r).mod(i).cmp(h)}function a(e,t){if(0>=e.cmpn(0))throw new Error("invalid sig");if(e.cmp(t)>=t)throw new Error("invalid sig")}var o=n(145),s=n(7).ec,u=n(67),l=n(140);e.exports=function(e,n,a,s,l){var c=u(a);if("ec"===c.type){if("ecdsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");return r(e,n,c)}if("dsa"===c.type){if("dsa"!==s)throw new Error("wrong public key type");return i(e,n,c)}if("rsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");n=t.concat([l,n]);for(var d=c.modulus.byteLength(),h=[1],f=0;n.length+h.length+2<d;)h.push(255),f++;h.push(0);for(var p=-1;++p<n.length;)h.push(n[p]);h=new t(h);var m=o.mont(c.modulus);e=(e=new o(e).toRed(m)).redPow(new o(c.publicExponent)),e=new t(e.fromRed().toArray());var v=8>f?1:0;for(d=_Mathmin(e.length,h.length),e.length!==h.length&&(v=1),p=-1;++p<d;)v|=e[p]^h[p];return 0==v}}).call(this,n(2).Buffer)},function(e,t,n){(function(t){var r=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m,a=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,o=n(69),s=n(96);e.exports=function(e,n){var u,l=e.toString(),c=l.match(r);if(c){var d="aes"+c[1],h=new t(c[2],"hex"),f=new t(c[3].replace(/[\r\n]/g,""),"base64"),p=o(n,h.slice(0,8),parseInt(c[1],10)).key,m=[],v=s.createDecipheriv(d,p,h);m.push(v.update(f)),m.push(v.final()),u=t.concat(m)}else{var g=l.match(a);u=new t(g[2].replace(/[\r\n]/g,""),"base64")}return{tag:l.match(i)[1],data:u}}}).call(this,n(2).Buffer)},function(e){e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},function(e,t,n){"use strict";var r=n(51),i=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),a=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),o=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),s=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())}),u=r.define("RelativeDistinguishedName",function(){this.setof(a)}),l=r.define("RDNSequence",function(){this.seqof(u)}),c=r.define("Name",function(){this.choice({rdnSequence:this.use(l)})}),d=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),h=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),f=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(o),this.key("issuer").use(c),this.key("validity").use(d),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(h).optional())}),p=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(f),this.key("signatureAlgorithm").use(o),this.key("signatureValue").bitstr())});e.exports=p},function(e,t,n){function r(e){a.call(this,e),this.enc="pem"}var i=n(1),a=n(141);i(r,a),e.exports=r,r.prototype.encode=function(e,t){for(var n=a.prototype.encode.call(this,e).toString("base64"),r=["-----BEGIN "+t.label+"-----"],i=0;i<n.length;i+=64)r.push(n.slice(i,i+64));return r.push("-----END "+t.label+"-----"),r.join("\n")}},function(e,t,n){var r=t;r.der=n(141),r.pem=n(304)},function(e,t,n){function r(e){o.call(this,e),this.enc="pem"}var i=n(1),a=n(2).Buffer,o=n(142);i(r,o),e.exports=r,r.prototype.decode=function(e,t){for(var n,r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,u=-1,l=-1,c=0;c<r.length;c++)if(null!==(n=r[c].match(s))&&n[2]===i){if(-1!=u){if("END"!==n[1])break;l=c;break}if("BEGIN"!==n[1])break;u=c}if(-1===u||-1===l)throw new Error("PEM section not found for: "+i);var d=r.slice(u+1,l).join("");d.replace(/[^a-z0-9\+\/=]+/gi,"");var h=new a(d,"base64");return o.prototype.decode.call(this,h,t)}},function(e,t,n){var r=t;r.der=n(142),r.pem=n(306)},function(e,t,n){var r=n(143);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=r._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=r._reverse(t.tag)},function(e,t,n){function r(e,t){var n={};this._baseState=n,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}var i=n(50).Reporter,a=n(50).EncoderBuffer,o=n(50).DecoderBuffer,s=n(13),u=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],l=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(u);e.exports=r;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];r.prototype.clone=function(){var e=this._baseState,t={};c.forEach(function(n){t[n]=e[n]});var n=new this.constructor(t.parent);return n._baseState=t,n},r.prototype._wrap=function(){var e=this._baseState;l.forEach(function(t){this[t]=function(){var n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},r.prototype._init=function(e){var t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),s.equal(t.children.length,1,"Root node can have only one child")},r.prototype._useArgs=function(e){var t=this._baseState,n=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===t.children),t.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0);var r=e[n];t[r]=n}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){r.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),u.forEach(function(e){r.prototype[e]=function(){var t=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(n),this}}),r.prototype.use=function(e){s(e);var t=this._baseState;return s(null===t.use),t.use=e,this},r.prototype.optional=function(){return this._baseState.optional=!0,this},r.prototype.def=function(e){var t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},r.prototype.explicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},r.prototype.implicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},r.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},r.prototype.key=function(e){var t=this._baseState;return s(null===t.key),t.key=e,this},r.prototype.any=function(){return this._baseState.any=!0,this},r.prototype.choice=function(e){var t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},r.prototype.contains=function(e){var t=this._baseState;return s(null===t.use),t.contains=e,this},r.prototype._decode=function(e,t){var n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));var r,i=n.default,a=!0,s=null;if(null!==n.key&&(s=e.enterKey(n.key)),n.optional){var u=null;if(null===n.explicit?null===n.implicit?null!==n.tag&&(u=n.tag):u=n.implicit:u=n.explicit,null!==u||n.any){if(a=this._peekTag(e,u,n.any),e.isError(a))return a}else{var l=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),a=!0}catch(e){a=!1}e.restore(l)}}if(n.obj&&a&&(r=e.enterObject()),a){if(null!==n.explicit){var c=this._decodeTag(e,n.explicit);if(e.isError(c))return c;e=c}var d=e.offset;if(null===n.use&&null===n.choice){if(n.any)l=e.save();var h=this._decodeTag(e,null===n.implicit?n.tag:n.implicit,n.any);if(e.isError(h))return h;n.any?i=e.raw(l):e=h}if(t&&t.track&&null!==n.tag&&t.track(e.path(),d,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),i=n.any?i:null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function(n){n._decode(e,t)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){var f=new o(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(f,t)}}return n.obj&&a&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,n.key,i),i},r.prototype._decodeGeneric=function(e,t,n){var r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null===r.use?t.error("unknown tag: "+e):this._getUse(r.use,t._reporterState.obj)._decode(t,n)},r.prototype._getUse=function(e,t){var n=this._baseState;return n.useDecoder=this._use(e,t),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},r.prototype._decodeChoice=function(e,t){var n=this._baseState,r=null,i=!1;return Object.keys(n.choice).some(function(a){var o=e.save(),s=n.choice[a];try{var u=s._decode(e,t);if(e.isError(u))return!1;r={type:a,value:u},i=!0}catch(t){return e.restore(o),!1}return!0},this),i?r:e.error("Choice not matched")},r.prototype._createEncoderBuffer=function(e){return new a(e,this.reporter)},r.prototype._encode=function(e,t,n){var r=this._baseState;if(null===r.default||r.default!==e){var i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i}},r.prototype._encodeValue=function(e,t,n){var r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new i);var a=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}var o=null,s=!1;if(r.any)a=this._createEncoderBuffer(e);else if(r.choice)a=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),s=!0;else if(r.children)o=r.children.map(function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");var r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(n){var r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)},u))}else null===r.use?(o=this._encodePrimitive(r.tag,e),s=!0):a=this._getUse(r.use,n)._encode(e,t);if(!r.any&&null===r.choice){var l=null===r.implicit?r.tag:r.implicit,c=null===r.implicit?"universal":"context";null===l?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(a=this._encodeComposite(l,s,c,o))}return null!==r.explicit&&(a=this._encodeComposite(r.explicit,!1,"context",a)),a},r.prototype._encodeChoice=function(e,t){var n=this._baseState,r=n.choice[e.type];return r||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},r.prototype._encodePrimitive=function(e,t){var n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},r.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},r.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},function(e,t,n){function r(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function i(e,t){this.path=e,this.rethrow(t)}var a=n(1);t.Reporter=r,r.prototype.isError=function(e){return e instanceof i},r.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},r.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},r.prototype.enterKey=function(e){return this._reporterState.path.push(e)},r.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},r.prototype.leaveKey=function(e,t,n){var r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},r.prototype.leaveObject=function(e){var t=this._reporterState,n=t.obj;return t.obj=e,n},r.prototype.error=function(e){var t,n=this._reporterState,r=e instanceof i;if(t=r?e:new i(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},r.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},a(i,Error),i.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t){var n=[].indexOf;e.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}},function(module,exports,__webpack_require__){function Context(){}var indexOf=__webpack_require__(311),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)t.push(n);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,n){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:n})}}catch(e){return function(e,t,n){e[t]=n}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];Context.prototype={};var Script=exports.Script=function(e){return this instanceof Script?void(this.code=e):new Script(e)};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var n=t.contentWindow,r=n.eval,i=n.execScript;!r&&i&&(i.call(n,"null"),r=n.eval),forEach(Object_keys(e),function(t){n[t]=e[t]}),forEach(globals,function(t){e[t]&&(n[t]=e[t])});var a=Object_keys(n),o=r.call(n,this.code);return forEach(Object_keys(n),function(t){(t in e||-1===indexOf(a,t))&&(e[t]=n[t])}),forEach(globals,function(t){t in e||defineProp(e,t,n[t])}),document.body.removeChild(t),o},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),n=this.runInContext(t);return forEach(Object_keys(t),function(n){e[n]=t[n]}),n},forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var n=Script(t);return n[e].apply(n,[].slice.call(arguments,1))}}),exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"==typeof e&&forEach(Object_keys(e),function(n){t[n]=e[n]}),t}},function(e,t,n){function r(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}var i=n(51),a=n(1);t.define=function(e,t){return new r(e,t)},r.prototype._createNamed=function(e){var t;try{t=n(312).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return a(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},r.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i.decoders[e])),this.decoders[e]},r.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},r.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i.encoders[e])),this.encoders[e]},r.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}},function(e,t){},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(314).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t,n){"use strict";var r=n(51);t.certificate=n(303);var i=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});t.RSAPrivateKey=i;var a=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.RSAPublicKey=a;var o=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});t.PublicKey=o;var s=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=r.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});t.PrivateKey=u;var l=r.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});t.EncryptedPrivateKey=l;var c=r.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});t.DSAPrivateKey=c,t.DSAparam=r.define("DSAparam",function(){this.int()});var d=r.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())});t.ECPrivateKey=d;var h=r.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});t.signature=r.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},function(e,t){},function(e,t,n){"use strict";function r(e,t){this.eddsa=e,"object"!=typeof t&&(t=u(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}var i=n(25),a=n(7).utils,o=a.assert,s=a.cachedProperty,u=a.parseBytes;s(r,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),s(r,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),s(r,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),s(r,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),r.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},r.prototype.toHex=function(){return a.encode(this.toBytes(),"hex").toUpperCase()},e.exports=r},function(e,t,n){"use strict";function r(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}var i=n(7).utils,a=i.assert,o=i.parseBytes,s=i.cachedProperty;r.fromPublic=function(e,t){return t instanceof r?t:new r(e,{pub:t})},r.fromSecret=function(e,t){return t instanceof r?t:new r(e,{secret:t})},r.prototype.secret=function(){return this._secret},s(r,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),s(r,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),s(r,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),s(r,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),s(r,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),s(r,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),r.prototype.sign=function(e){return a(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},r.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},r.prototype.getSecret=function(e){return a(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},r.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},e.exports=r},function(e,t,n){"use strict";function r(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof r))return new r(e);e=a.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=_Mathceil(e.n.bitLength()/8),this.hash=i.sha512}var i=n(93),a=n(7),o=a.utils,s=o.assert,u=o.parseBytes,l=n(319),c=n(318);e.exports=r,r.prototype.sign=function(e,t){e=u(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),a=this.encodePoint(i),o=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),s=r.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:a})},r.prototype.verify=function(e,t,n){e=u(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(a)},r.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return o.intFromLE(e.digest()).umod(this.curve.n)},r.prototype.keyFromPublic=function(e){return l.fromPublic(this,e)},r.prototype.keyFromSecret=function(e){return l.fromSecret(this,e)},r.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},r.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},r.prototype.decodePoint=function(e){var t=(e=o.parseBytes(e)).length-1,n=e.slice(0,t).concat(-129&e[t]),r=0!=(128&e[t]),i=o.intFromLE(n);return this.curve.pointFromY(i,r)},r.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},r.prototype.decodeInt=function(e){return o.intFromLE(e)},r.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,n){"use strict";function r(e,t){return e instanceof r?e:void(this._importDER(e,t)||(l(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),this.recoveryParam=void 0===e.recoveryParam?null:e.recoveryParam))}function i(e,t){var n=e[t.place++];if(!(128&n))return n;for(var r=15&n,i=0,a=0,o=t.place;a<r;a++,o++)i<<=8,i|=e[o];return t.place=o,i}function a(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0==t?e:e.slice(t)}function o(e,t){if(128>t)e.push(t);else{var n=1+(_Mathlog(t)/_MathLN>>>3);for(e.push(128|n);--n;)e.push(255&t>>>(n<<3));e.push(t)}}var s=n(25),u=n(7).utils,l=u.assert;e.exports=r,r.prototype._importDER=function(e,t){e=u.toArray(e,t);var n=new function(){this.place=0};if(48!==e[n.place++])return!1;if(i(e,n)+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var r=i(e,n),a=e.slice(n.place,r+n.place);if(n.place+=r,2!==e[n.place++])return!1;var o=i(e,n);if(e.length!==o+n.place)return!1;var l=e.slice(n.place,o+n.place);return 0===a[0]&&128&a[1]&&(a=a.slice(1)),0===l[0]&&128&l[1]&&(l=l.slice(1)),this.r=new s(a),this.s=new s(l),this.recoveryParam=null,!0},r.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=a(t),n=a(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];o(r,t.length),(r=r.concat(t)).push(2),o(r,n.length);var i=r.concat(n),s=[48];return o(s,i.length),s=s.concat(i),u.encode(s,e)}},function(e,t,n){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var i=n(25),a=n(7).utils.assert;e.exports=r,r.fromPublic=function(e,t,n){return t instanceof r?t:new r(e,{pub:t,pubEnc:n})},r.fromPrivate=function(e,t,n){return t instanceof r?t:new r(e,{priv:t,privEnc:n})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},r.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(e,t){return e.x||e.y?("mont"===this.ec.curve.type?a(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&a(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y))):void(this.pub=this.ec.curve.decodePoint(e,t))},r.prototype.derive=function(e){return e.mul(this.priv).getX()},r.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},r.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,n){"use strict";function r(e){if(!(this instanceof r))return new r(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=a.toArray(e.entropy,e.entropyEnc||"hex"),n=a.toArray(e.nonce,e.nonceEnc||"hex"),i=a.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,i)}var i=n(93),a=n(149),o=n(13);e.exports=r,r.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},r.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},r.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},r.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=a.toArray(e,t),n=a.toArray(n,r),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},r.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=a.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(n),this._reseed++,a.encode(o,t)}},function(e,t,n){"use strict";function r(e){return this instanceof r?("string"==typeof e&&(s(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),void(this.hash=e.hash||e.curve.hash)):new r(e)}var i=n(25),a=n(323),o=n(7),s=o.utils.assert,u=n(322),l=n(321);e.exports=r,r.prototype.keyPair=function(e){return new u(this,e)},r.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});for(var t=new a({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new i(2));;){var s=new i(t.generate(n));if(!(0<s.cmp(r)))return s.iaddn(1),this.keyFromPrivate(s)}},r.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return 0<n&&(e=e.ushrn(n)),!t&&0<=e.cmp(this.n)?e.sub(this.n):e},r.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new i(e,16));for(var o,s=this.n.byteLength(),u=t.getPrivate().toArray("be",s),c=e.toArray("be",s),d=new a({hash:this.hash,entropy:u,nonce:c,pers:r.pers,persEnc:r.persEnc||"utf8"}),h=this.n.sub(new i(1)),f=0;;f++)if(o=r.k?r.k(f):new i(d.generate(this.n.byteLength())),!(0>=(o=this._truncateToN(o,!0)).cmpn(1)||0<=o.cmp(h))){var p=this.g.mul(o);if(!p.isInfinity()){var m=p.getX(),v=m.umod(this.n);if(0!==v.cmpn(0)){var g=o.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0===m.cmp(v)?0:2);return r.canonical&&0<g.cmp(this.nh)&&(g=this.n.sub(g),b^=1),new l({r:v,s:g,recoveryParam:b})}}}}},r.prototype.verify=function(e,t,n,r){e=this._truncateToN(new i(e,16)),n=this.keyFromPublic(n,r);var a=(t=new l(t,"hex")).r,o=t.s;if(0>a.cmpn(1)||0<=a.cmp(this.n))return!1;if(0>o.cmpn(1)||0<=o.cmp(this.n))return!1;var s,u=o.invm(this.n),c=u.mul(e).umod(this.n),d=u.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,n.getPublic(),d)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(c,n.getPublic(),d)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},r.prototype.recoverPubKey=function(e,t,n,r){s((3&n)===n,"The recovery param is more than two bits"),t=new l(t,r);var a=this.n,o=new i(e),u=t.r,c=t.s,d=1&n,h=n>>1;if(0<=u.cmp(this.curve.p.umod(this.curve.n))&&h)throw new Error("Unable to find sencond key candinate");u=h?this.curve.pointFromX(u.add(this.curve.n),d):this.curve.pointFromX(u,d);var f=t.r.invm(a),p=a.sub(o).mul(f).umod(a),m=c.mul(f).umod(a);return this.g.mulAdd(p,u,m)},r.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new l(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;4>i;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch(e){continue}if(a.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,n){"use strict";function r(e,t,n){return this instanceof r?(this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,void this._init(i.toArray(t,n))):new r(e,t,n)}var i=n(24),a=n(13);e.exports=r,r.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),a(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},r.prototype.update=function(e,t){return this.inner.update(e,t),this},r.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},function(e,t,n){"use strict";function r(){return this instanceof r?(f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.endian="little")):new r}function i(e,t,n,r){return 15>=e?t^n^r:31>=e?t&n|~t&r:47>=e?(t|~n)^r:63>=e?t&r|n&~r:t^(n|~r)}function a(e){return 15>=e?0:31>=e?1518500249:47>=e?1859775393:63>=e?2400959708:2840853838}function o(e){return 15>=e?1352829926:31>=e?1548603684:47>=e?1836072691:63>=e?2053994217:0}var s=n(24),u=n(52),l=s.rotl32,c=s.sum32,d=s.sum32_3,h=s.sum32_4,f=u.BlockHash;s.inherits(r,f),t.ripemd160=r,r.blockSize=512,r.outSize=160,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(e,t){for(var n,r=this.h[0],s=this.h[1],u=this.h[2],f=this.h[3],b=this.h[4],y=r,w=s,_=u,x=f,M=b,k=0;80>k;k++)n=c(l(h(r,i(k,s,u,f),e[p[k]+t],a(k)),v[k]),b),r=b,b=f,f=l(u,10),u=s,s=n,n=c(l(h(y,i(79-k,w,_,x),e[m[k]+t],o(k)),g[k]),M),y=M,M=x,x=l(_,10),_=w,w=n;n=d(this.h[1],u,x),this.h[1]=d(this.h[2],f,M),this.h[2]=d(this.h[3],b,y),this.h[3]=d(this.h[4],r,w),this.h[4]=d(this.h[0],s,_),this.h[0]=n},r.prototype._digest=function(e){return"hex"===e?s.toHex32(this.h,"little"):s.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],v=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(e,t,n){"use strict";function r(){return this instanceof r?(a.call(this),void(this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])):new r}var i=n(24),a=n(146);i.inherits(r,a),e.exports=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},function(e,t,n){"use strict";function r(){return this instanceof r?(a.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])):new r}var i=n(24),a=n(147);i.inherits(r,a),e.exports=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},function(e,t,n){"use strict";function r(){return this instanceof r?(d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=Array(80))):new r}var i=n(24),a=n(52),o=n(148),s=i.rotl32,u=i.sum32,l=i.sum32_5,c=o.ft_1,d=a.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];i.inherits(r,d),e.exports=r,r.blockSize=512,r.outSize=160,r.hmacStrength=80,r.padLength=64,r.prototype._update=function(e,t){for(var n=this.W,r=0;16>r;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=s(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],a=this.h[1],o=this.h[2],d=this.h[3],f=this.h[4];for(r=0;r<n.length;r++){var p=~~(r/20),m=l(s(i,5),c(p,a,o,d),f,n[r],h[p]);f=d,d=o,o=s(a,30),a=i,i=m}this.h[0]=u(this.h[0],i),this.h[1]=u(this.h[1],a),this.h[2]=u(this.h[2],o),this.h[3]=u(this.h[3],d),this.h[4]=u(this.h[4],f)},r.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,n){"use strict";t.sha1=n(330),t.sha224=n(329),t.sha256=n(147),t.sha384=n(328),t.sha512=n(146)},function(e,t,n){"use strict";function r(e){this.curve="short"===e.type?new u.curve.short(e):"edwards"===e.type?new u.curve.edwards(e):new u.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,l(this.g.validate(),"Invalid curve"),l(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var n=new r(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:n}),n}})}var a,o=t,s=n(93),u=n(7),l=u.utils.assert;o.PresetCurve=r,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=n(325)}catch(t){a=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(e,t,n){"use strict";function r(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,l.call(this,"edwards",e),this.a=new s(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new s(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new s(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function i(e,t,n,r,i){l.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new s(t,16),this.y=new s(n,16),this.z=r?new s(r,16):this.curve.one,this.t=i&&new s(i,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.y.red&&(this.y=this.y.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),!this.zOne&&(this.t=this.t.redMul(this.z.redInvm()))))}var a=n(68),o=n(7),s=n(25),u=n(1),l=a.base,c=o.utils.assert;u(r,l),e.exports=r,r.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},r.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},r.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},r.prototype.pointFromX=function(e,t){(e=new s(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=r.redMul(i.redInvm()),o=a.redSqrt();if(0!==o.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=o.fromRed().isOdd();return(t&&!u||!t&&u)&&(o=o.redNeg()),this.point(e,o)},r.prototype.pointFromY=function(e,t){(e=new s(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.one),i=n.redMul(this.d).redAdd(this.one),a=r.redMul(i.redInvm());if(0===a.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var o=a.redSqrt();if(0!==o.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return o.isOdd()!==t&&(o=o.redNeg()),this.point(o,e)},r.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},u(i,l.BasePoint),r.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},r.prototype.point=function(e,t,n,r){return new i(this,e,t,n,r)},i.fromJSON=function(e,t){return new i(e,t[0],t[1],t[2])},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=r.redAdd(t),o=a.redSub(n),s=r.redSub(t),u=i.redMul(o),l=a.redMul(s),c=i.redMul(s),d=o.redMul(a);return this.curve.point(u,l,d,c)},i.prototype._projDbl=function(){var e,t,n,r=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),a=this.y.redSqr();if(this.curve.twisted){var o=(l=this.curve._mulA(i)).redAdd(a);if(this.zOne)e=r.redSub(i).redSub(a).redMul(o.redSub(this.curve.two)),t=o.redMul(l.redSub(a)),n=o.redSqr().redSub(o).redSub(o);else{var s=this.z.redSqr(),u=o.redSub(s).redISub(s);e=r.redSub(i).redISub(a).redMul(u),t=o.redMul(l.redSub(a)),n=o.redMul(u)}}else{var l=i.redAdd(a);s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=l.redSub(s).redSub(s);e=this.curve._mulC(r.redISub(l)).redMul(u),t=this.curve._mulC(l).redMul(i.redISub(a)),n=l.redMul(u)}return this.curve.point(e,t,n)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(t),o=i.redSub(r),s=i.redAdd(r),u=n.redAdd(t),l=a.redMul(o),c=s.redMul(u),d=a.redMul(u),h=o.redMul(s);return this.curve.point(l,c,h,d)},i.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(o),u=i.redSub(s),l=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),d=r.redMul(u).redMul(c);return this.curve.twisted?(t=r.redMul(l).redMul(o.redSub(this.curve._mulA(a))),n=u.redMul(l)):(t=r.redMul(l).redMul(o.redSub(a)),n=this.curve._mulC(u).redMul(l)),this.curve.point(d,t,n)},i.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},i.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},i.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},i.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},i.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},function(e,t,n){"use strict";function r(e){u.call(this,"mont",e),this.a=new o(e.a,16).toRed(this.red),this.b=new o(e.b,16).toRed(this.red),this.i4=new o(4).toRed(this.red).redInvm(),this.two=new o(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(e,t,n){u.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new o(t,16),this.z=new o(n,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var a=n(68),o=n(25),s=n(1),u=a.base,l=n(7).utils;s(r,u),e.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},s(i,u.BasePoint),r.prototype.decodePoint=function(e,t){return this.point(l.toArray(e,t),1)},r.prototype.point=function(e,t){return new i(this,e,t)},r.prototype.pointFromJSON=function(e){return i.fromJSON(this,e)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(e,t){return new i(e,t[0],t[1]||e.one)},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(n),o=i.redMul(r),s=t.z.redMul(a.redAdd(o).redSqr()),u=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,u)},i.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var a=i.length-1;0<=a;a--)0===i[a]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,n){"use strict";function r(e){c.call(this,"short",e),this.a=new u(e.a,16).toRed(this.red),this.b=new u(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function i(e,t,n,r){c.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new u(t,16),this.y=new u(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.y.red&&(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function a(e,t,n,r){c.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new u(0)):(this.x=new u(t,16),this.y=new u(n,16),this.z=new u(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var o=n(68),s=n(7),u=n(25),l=n(1),c=o.base,d=s.utils.assert;l(r,c),e.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new u(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=0>r[0].cmp(r[1])?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new u(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],d(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new u(e.a,16),b:new u(e.b,16)}}):this._getEndoBasis(n)}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:u.mont(e),n=new u(2).toRed(t).redInvm(),r=n.redNeg(),i=new u(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},r.prototype._getEndoBasis=function(e){for(var t,n,r,i,a,o,s,l,c,d,h=this.n.ushrn(_Mathfloor(this.n.bitLength()/2)),f=e,p=this.n.clone(),m=new u(1),v=new u(0),g=new u(0),b=new u(1),y=0;0!==f.cmpn(0);){d=p.div(f),l=p.sub(d.mul(f)),c=g.sub(d.mul(m));var w=b.sub(d.mul(v));if(!r&&0>l.cmp(h))t=s.neg(),n=m,r=l.neg(),i=c;else if(r&&2==++y)break;s=l,p=f,f=l,g=m,m=c,b=v,v=w}a=l.neg(),o=c;var _=r.sqr().add(i.sqr());return 0<=a.sqr().add(o.sqr()).cmp(_)&&(a=t,o=n),r.negative&&(r=r.neg(),i=i.neg()),a.negative&&(a=a.neg(),o=o.neg()),[{a:r,b:i},{a:a,b:o}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),s=a.mul(r.a),u=i.mul(n.b),l=a.mul(r.b);return{k1:e.sub(o).sub(s),k2:u.add(l).neg()}},r.prototype.pointFromX=function(e,t){(e=new u(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],u=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),u=u.neg(!0)),r[2*a]=s,r[2*a+1]=u,i[2*a]=o.k1,i[2*a+1]=o.k2}for(var l=this._wnafMulAdd(1,r,i,2*a,n),c=0;c<2*a;c++)r[c]=null,i[c]=null;return l},l(i,c.BasePoint),r.prototype.point=function(e,t,n){return new i(this,e,t,n)},r.prototype.pointFromJSON=function(e,t){return i.fromJSON(this,e,t)},i.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},i.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},i.fromJSON=function(e,t,n){function r(t){return e.point(t[0],t[1],n)}"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(r))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(r))}},i},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return this.inf},i.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},i.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),a=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(e){return e=new u(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},i.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},i.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},i.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},i.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},i.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},l(a,c.BasePoint),r.prototype.jpoint=function(e,t,n){return new a(this,e,t,n)},a.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},a.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},a.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=a.redSub(o);if(0===s.cmpn(0))return 0===u.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var l=s.redSqr(),c=l.redMul(s),d=r.redMul(l),h=u.redSqr().redIAdd(c).redISub(d).redISub(d),f=u.redMul(d.redISub(h)).redISub(a.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,f,p)},a.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),o=n.redSub(r),s=i.redSub(a);if(0===o.cmpn(0))return 0===s.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var u=o.redSqr(),l=u.redMul(o),c=n.redMul(u),d=s.redSqr().redIAdd(l).redISub(c).redISub(c),h=s.redMul(c.redISub(d)).redISub(i.redMul(l)),f=this.z.redMul(o);return this.curve.jpoint(d,h,f)},a.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}var r=this.curve.a,i=this.curve.tinv,a=this.x,o=this.y,s=this.z,u=s.redSqr().redSqr(),l=o.redAdd(o);for(n=0;n<e;n++){var c=a.redSqr(),d=l.redSqr(),h=d.redSqr(),f=c.redAdd(c).redIAdd(c).redIAdd(r.redMul(u)),p=a.redMul(d),m=f.redSqr().redISub(p.redAdd(p)),v=p.redISub(m),g=f.redMul(v);g=g.redIAdd(g).redISub(h);var b=l.redMul(s);n+1<e&&(u=u.redMul(h)),a=m,s=b,l=g}return this.curve.jpoint(a,l.redMul(i),s)},a.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},a.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(o).redISub(o),l=a.redIAdd(a);l=(l=l.redIAdd(l)).redIAdd(l),e=u,t=s.redMul(o.redISub(u)).redISub(l),n=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),f=this.x.redAdd(d).redSqr().redISub(c).redISub(h);f=f.redIAdd(f);var p=c.redAdd(c).redIAdd(c),m=p.redSqr(),v=h.redIAdd(h);v=(v=v.redIAdd(v)).redIAdd(v),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(v),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},a.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(o).redISub(o);e=u;var l=a.redIAdd(a);l=(l=l.redIAdd(l)).redIAdd(l),t=s.redMul(o.redISub(u)).redISub(l),n=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),f=this.x.redSub(c).redMul(this.x.redAdd(c));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(c);var v=d.redSqr();v=(v=(v=v.redIAdd(v)).redIAdd(v)).redIAdd(v),t=f.redMul(p.redISub(e)).redISub(v)}return this.curve.jpoint(e,t,n)},a.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),a=t.redSqr(),o=n.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(i)),u=t.redAdd(t),l=(u=u.redIAdd(u)).redMul(o),c=s.redSqr().redISub(l.redAdd(l)),d=l.redISub(c),h=o.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=s.redMul(d).redISub(h),p=n.redAdd(n).redMul(r);return this.curve.jpoint(c,f,p)},a.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),a=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(r),s=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(a)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var l=i.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(u),c=t.redMul(l);c=(c=c.redIAdd(c)).redIAdd(c);var d=this.x.redMul(s).redISub(c);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(l.redMul(u.redISub(l)).redISub(o.redMul(s)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(o).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,h,f)},a.prototype.mul=function(e,t){return e=new u(e,t),this.curve._wnafMul(this,e)},a.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},a.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}return!1},a.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},a.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,n){"use strict";function r(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,];var n=this.n&&this.p.div(this.n);!n||0<n.cmpn(100)?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function i(e,t){this.curve=e,this.type=t,this.precomputed=null}var a=n(25),o=n(7).utils,s=o.getNAF,u=o.getJSF,l=o.assert;e.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(e,t){l(e.precomputed);var n=e._getDoubles(),r=s(t,1),i=(1<<n.step+1)-(0==n.step%2?2:1);i/=3;for(var a=[],o=0;o<r.length;o+=n.step){h=0;for(t=o+n.step-1;t>=o;t--)h=(h<<1)+r[t];a.push(h)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;0<d;d--){var h;for(o=0;o<a.length;o++)(h=a[o])===d?c=c.mixedAdd(n.points[o]):h===-d&&(c=c.mixedAdd(n.points[o].neg()));u=u.add(c)}return u.toP()},r.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,a=s(t,n),o=this.jpoint(null,null,null),u=a.length-1;0<=u;u--){for(t=0;0<=u&&0===a[u];u--)t++;if(0<=u&&t++,o=o.dblp(t),0>u)break;var c=a[u];l(0!==c),o="affine"===e.type?0<c?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):0<c?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},r.prototype._wnafMulAdd=function(e,t,n,r,i){for(var a=this._wnafT1,o=this._wnafT2,l=this._wnafT3,c=0,d=0;d<r;d++){var h=(C=t[d])._getNAFPoints(e);a[d]=h.wnd,o[d]=h.points}for(d=r-1;1<=d;d-=2){var f=d-1,p=d;if(1===a[f]&&1===a[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],g=u(n[f],n[p]);c=_Mathmax(g[0].length,c),l[f]=Array(c),l[p]=Array(c);for(var b=0;b<c;b++){var y=0|g[0][b],w=0|g[1][b];l[f][b]=v[3*(y+1)+(w+1)],l[p][b]=0,o[f]=m}}else l[f]=s(n[f],a[f]),l[p]=s(n[p],a[p]),c=_Mathmax(l[f].length,c),c=_Mathmax(l[p].length,c)}var _,x=this.jpoint(null,null,null),M=this._wnafT4;for(d=c;0<=d;d--){for(_=0;0<=d;){var k=!0;for(b=0;b<r;b++)M[b]=0|l[b][d],0!==M[b]&&(k=!1);if(!k)break;_++,d--}if(0<=d&&_++,x=x.dblp(_),0>d)break;for(b=0;b<r;b++){var C,E=M[b];0!==E&&(0<E?C=o[b][E-1>>1]:0>E&&(C=o[b][-E-1>>1].neg()),x="affine"===C.type?x.mixedAdd(C):x.add(C))}}for(d=0;d<r;d++)o[d]=null;return i?x:x.toP()},r.BasePoint=i,i.prototype.eq=function(){throw new Error("Not implemented")},i.prototype.validate=function(){return this.curve.validate(this)},r.prototype.decodePoint=function(e,t){e=o.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?l(0==e[e.length-1]%2):7===e[0]&&l(1==e[e.length-1]%2),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},i.prototype.encodeCompressed=function(e){return this.encode(e,!0)},i.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},i.prototype.encode=function(e,t){return o.encode(this._encode(t),e)},i.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},i.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=_Mathceil((e.bitLength()+1)/t.step)},i.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var a=0;a<e;a++)r=r.dbl();n.push(r)}return{step:e,points:n}},i.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1==n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},i.prototype._getBeta=function(){return null},i.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},function(e,t){},function(e,t,n){"use strict";var r=t,i=n(25),a=n(13),o=n(149);r.assert=a,r.toArray=o.toArray,r.zero2=o.zero2,r.toHex=o.toHex,r.encode=o.encode,r.getNAF=function(e,t){for(var n=[],r=1<<t+1,i=e.clone();0<=i.cmpn(1);){var a;if(i.isOdd()){var o=i.andln(r-1);a=o>(r>>1)-1?(r>>1)-o:o,i.isubn(a)}else a=0;n.push(a);for(var s=0!==i.cmpn(0)&&0===i.andln(r-1)?t+1:1,u=1;u<s;u++)n.push(0);i.iushrn(s)}return n},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0;0<e.cmpn(-r)||0<t.cmpn(-i);){var a,o,s,u=3&e.andln(3)+r,l=3&t.andln(3)+i;3==u&&(u=-1),3==l&&(l=-1),a=0==(1&u)?0:3!=(s=7&e.andln(7)+r)&&5!=s||2!=l?u:-u,n[0].push(a),o=0==(1&l)?0:3!=(s=7&t.andln(7)+i)&&5!=s||2!=u?l:-l,n[1].push(o),2*r===a+1&&(r=1-r),2*i===o+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0===this[r]?this[r]=n.call(this):this[r]}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},function(e){e.exports={_args:[["elliptic@6.4.0","/home/travis/build/linkeddata/mashlib"]],_from:"elliptic@6.4.0",_id:"elliptic@6.4.0",_inBundle:!1,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"6.4.0",saveSpec:null,fetchSpec:"6.4.0"},_requiredBy:["/@trust/keyto","/browserify-sign","/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_spec:"6.4.0",_where:"/home/travis/build/linkeddata/mashlib",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},function(e,t){},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(340).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t,n){(function(t){function r(e,t,n){for(var r,s=t.params.priv_key,c=t.params.p,d=t.params.q,h=t.params.g,p=new f(0),m=o(e,d).mod(d),v=!1,g=a(s,d,e,n);0==v;)p=l(h,r=u(d,g,n),c,d),0===(v=r.invm(d).imul(m.add(s.mul(p))).mod(d)).cmpn(0)&&(v=!1,p=new f(0));return i(p,v)}function i(e,n){e=e.toArray(),n=n.toArray(),128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n));var r=[48,e.length+n.length+4,2,e.length];return r=r.concat(e,[2,n.length],n),new t(r)}function a(e,n,r,i){if((e=new t(e.toArray())).length<n.byteLength()){var a=new t(n.byteLength()-e.length);a.fill(0),e=t.concat([a,e])}var o=r.length,u=s(r,n),l=new t(o);l.fill(1);var d=new t(o);return d.fill(0),d=c(i,d).update(l).update(new t([0])).update(e).update(u).digest(),l=c(i,d).update(l).digest(),{k:d=c(i,d).update(l).update(new t([1])).update(e).update(u).digest(),v:l=c(i,d).update(l).digest()}}function o(e,t){var n=new f(e),r=(e.length<<3)-t.bitLength();return 0<r&&n.ishrn(r),n}function s(e,n){e=(e=o(e,n)).mod(n);var r=new t(e.toArray());if(r.length<n.byteLength()){var i=new t(n.byteLength()-r.length);i.fill(0),r=t.concat([i,r])}return r}function u(e,n,r){var i,a;do{for(i=new t(0);8*i.length<e.bitLength();)n.v=c(r,n.k).update(n.v).digest(),i=t.concat([i,n.v]);a=o(i,e),n.k=c(r,n.k).update(n.v).update(new t([0])).digest(),n.v=c(r,n.k).update(n.v).digest()}while(-1!==a.cmp(e));return a}function l(e,t,n,r){return e.toRed(f.mont(n)).redPow(t).fromRed().mod(r)}var c=n(165),d=n(94),h=n(7).ec,f=n(145),p=n(67),m=n(140);e.exports=function(e,n,i,a,o){var s=p(n);if(s.curve){if("ecdsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong private key type");return function(e,n){var r=m[n.curve.join(".")];if(!r)throw new Error("unknown curve "+n.curve.join("."));var i=new h(r).keyFromPrivate(n.privateKey).sign(e);return new t(i.toDER())}(e,s)}if("dsa"===s.type){if("dsa"!==a)throw new Error("wrong private key type");return r(e,s,i)}if("rsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong private key type");e=t.concat([o,e]);for(var u=s.modulus.byteLength(),l=[0,1];e.length+l.length+1<u;)l.push(255);l.push(0);for(var c=-1;++c<e.length;)l.push(e[c]);return d(l,s)},e.exports.getKey=a,e.exports.makeKey=u}).call(this,n(2).Buffer)},function(e,t,n){(function(t){function r(e){u.Writable.call(this);var t=h[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=s(t.hash),this._tag=t.id,this._signType=t.sign}function i(e){u.Writable.call(this);var t=h[e];if(!t)throw new Error("Unknown message digest");this._hash=s(t.hash),this._tag=t.id,this._signType=t.sign}function a(e){return new r(e)}function o(e){return new i(e)}var s=n(54),u=n(64),l=n(1),c=n(342),d=n(300),h=n(163);Object.keys(h).forEach(function(e){h[e].id=new t(h[e].id,"hex"),h[e.toLowerCase()]=h[e]}),l(r,u.Writable),r.prototype._write=function(e,t,n){this._hash.update(e),n()},r.prototype.update=function(e,n){return"string"==typeof e&&(e=new t(e,n)),this._hash.update(e),this},r.prototype.sign=function(e,t){this.end();var n=this._hash.digest(),r=c(n,e,this._hashType,this._signType,this._tag);return t?r.toString(t):r},l(i,u.Writable),i.prototype._write=function(e,t,n){this._hash.update(e),n()},i.prototype.update=function(e,n){return"string"==typeof e&&(e=new t(e,n)),this._hash.update(e),this},i.prototype.verify=function(e,n,r){"string"==typeof n&&(n=new t(n,r)),this.end();var i=this._hash.digest();return d(n,i,e,this._signType,this._tag)},e.exports={Sign:a,Verify:o,createSign:a,createVerify:o}}).call(this,n(2).Buffer)},function(e,t,n){(function(t){function r(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this._pub=new s(e),this}function i(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this._priv=new s(e),this}function a(e,t,n){this.setGenerator(t),this.__prime=new s(e),this._prime=s.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=r,this.setPrivateKey=i):this._primeCode=8}function o(e,n){var r=new t(e.toArray());return n?r.toString(n):r}var s=n(152),u=new(n(151)),l=new s(24),c=new s(11),d=new s(10),h=new s(3),f=new s(7),p=n(153),m=n(44);e.exports=a;var v={};Object.defineProperty(a.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var n=t.toString("hex"),r=[n,e.toString(16)].join("_");if(r in v)return v[r];var i,a=0;return!e.isEven()&&p.simpleSieve&&p.fermatTest(e)&&u.test(e)?(u.test(e.shrn(1))||(a+=2),"02"===n?e.mod(l).cmp(c)&&(a+=8):"05"===n?(i=e.mod(d)).cmp(h)&&i.cmp(f)&&(a+=8):a+=4,v[r]=a,a):(a+=1,a+="02"===n||"05"===n?8:4,v[r]=a,a)}(this.__prime,this.__gen)),this._primeCode}}),a.prototype.generateKeys=function(){return this._priv||(this._priv=new s(m(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},a.prototype.computeSecret=function(e){var n=(e=(e=new s(e)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new t(n.toArray()),i=this.getPrime();if(r.length<i.length){var a=new t(i.length-r.length);a.fill(0),r=t.concat([a,r])}return r},a.prototype.getPublicKey=function(e){return o(this._pub,e)},a.prototype.getPrivateKey=function(e){return o(this._priv,e)},a.prototype.getPrime=function(e){return o(this.__prime,e)},a.prototype.getGenerator=function(e){return o(this._gen,e)},a.prototype.setGenerator=function(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this.__gen=e,this._gen=new s(e),this}}).call(this,n(2).Buffer)},function(e){e.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},function(e,t){},function(e,t){},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))))}function o(e,t,n){for(var r,i=0,a=_Mathmin(e.length,n),o=t;o<a;o++)i<<=4,i|=49<=(r=e.charCodeAt(o)-48)&&54>=r?r-49+10:17<=r&&22>=r?r-17+10:15&r;return i}function s(e,t,n,r){for(var i,a=0,o=_Mathmin(e.length,n),s=t;s<o;s++)a*=r,a+=49<=(i=e.charCodeAt(s)-48)?i-49+10:17<=i?i-17+10:i;return a}function u(e,t,n){n.negative=t.negative^e.negative;var r=0|e.length+t.length;n.length=r,r=0|r-1;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=0|o/67108864;n.words[0]=s;for(var l=1;l<r;l++){for(var c,d=u>>>26,h=67108863&u,f=_Mathmin(l,t.length-1),p=_Mathmax(0,l-e.length+1);p<=f;p++)c=0|l-p,d+=0|(o=(i=0|e.words[c])*(a=0|t.words[p])+h)/67108864,h=67108863&o;n.words[l]=0|h,u=0|d}return 0==u?n.length--:n.words[l]=0|u,n.strip()}function l(e,t,n){return(new c).mulp(e,t,n)}function c(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function h(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function f(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){v.call(this,e),this.shift=this.m.bitLength(),0!=this.shift%26&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var b;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{b=n(347).Buffer}catch(t){}a.isBN=function(e){return!!(e instanceof a)||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return 0<e.cmp(t)?e:t},a.min=function(e,t){return 0>e.cmp(t)?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&2<=t&&36>=t);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initNumber=function(e,t,n){0>e&&(this.negative=1,e=-e),67108864>e?(this.words=[67108863&e],this.length=1):4503599627370496>e?(this.words=[67108863&e,67108863&e/67108864],this.length=2):(r(9007199254740992>e),this.words=[67108863&e,67108863&e/67108864,1],this.length=3),"le"!==n||this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),0>=e.length)return this.words=[0],this.length=1,this;this.length=_Mathceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;0<=i;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=67108863&o<<s,this.words[a+1]=67108863&o>>>26-s,26<=(s+=24)&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=_Mathceil((e.length-t)/6),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,a=0;for(n=e.length-6,r=0;n>=t;n-=6)i=o(e,n,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a,26<=(a+=24)&&(a-=26,r++);n+6!==t&&(i=o(e,t,n+6),this.words[r]|=67108863&i<<a,this.words[r+1]|=4194303&i>>>26-a),this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;67108863>=i;i*=t)r++;r--,i=0|i/t;for(var a=e.length-n,o=a%r,u=_Mathmin(a,a-o)+n,l=0,c=n;c<u;c+=r)l=s(e,c,c+r,t),this.imuln(i),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l);if(0!=o){var d=1;for(l=s(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),67108864>this.words[0]+l?this.words[0]+=l:this._iaddn(l)}},a.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);n=0!=(a=16777215&s>>>24-i)||o!==this.length-1?y[6-u.length]+u+n:u+n,26<=(i+=2)&&(i-=26,o--)}for(0!=a&&(n=a.toString(16)+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&2<=e&&36>=e){var l=w[e],c=_[e];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var h=d.modn(c).toString(e);n=(d=d.idivn(c)).isZero()?h+n:y[l-h.length]+h+n}for(this.isZero()&&(n="0"+n);0!=n.length%t;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&r(!1,"Number can only safely store up to 53 bits"),0===this.negative?e:-e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return r(void 0!==b),this.toArrayLike(b,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),a=n||_Mathmax(1,i);r(i<=a,"byte array longer than desired length"),r(0<a,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,l=new e(a),c=this.clone();if(u){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[s]=o;for(;s<a;s++)l[s]=0}else{for(s=0;s<a-i;s++)l[s]=0;for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),l[a-s-1]=o}return l},a.prototype._countBits=_Mathclz?function(e){return 32-_Mathclz(e)}:function(e){var t=e,n=0;return 4096<=t&&(n+=13,t>>>=13),64<=t&&(n+=7,t>>>=7),8<=t&&(n+=4,t>>>=4),2<=t&&(n+=2,t>>>=2),n+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e,t=0,n=0;n<this.length&&(t+=e=this._zeroBits(this.words[n]),26===e);n++);return t},a.prototype.byteLength=function(){return _Mathceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0===this.negative?this.clone():this.abs().inotn(e).iaddn(1)},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]|=e.words[t];return this.strip()},a.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]&=e.words[n];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){r("number"==typeof e&&0<=e);var t=0|_Mathceil(e/26),n=e%26;this._expand(t),0<n&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return 0<n&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){r("number"==typeof e&&0<=e);var n=0|e/26,i=e%26;return this._expand(n+1),t?this.words[n]|=1<<i:this.words[n]&=~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!=i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!=i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0<i?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!=a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0==a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=_Mathmax(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var x=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,h=c>>>13,f=0|o[1],p=8191&f,m=f>>>13,v=0|o[2],g=8191&v,b=v>>>13,y=0|o[3],w=8191&y,_=y>>>13,x=0|o[4],M=8191&x,k=x>>>13,C=0|o[5],E=8191&C,A=C>>>13,T=0|o[6],S=8191&T,I=T>>>13,N=0|o[7],j=8191&N,O=N>>>13,R=0|o[8],L=8191&R,P=R>>>13,D=0|o[9],B=8191&D,U=D>>>13,q=0|s[0],F=8191&q,z=q>>>13,H=0|s[1],W=8191&H,V=H>>>13,J=0|s[2],G=8191&J,K=J>>>13,$=0|s[3],X=8191&$,Z=$>>>13,Y=0|s[4],Q=8191&Y,ee=Y>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,he=ce>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ve=0|(0|l+(r=_Mathimul(d,F)))+((8191&(i=0|(i=_Mathimul(d,z))+_Mathimul(h,F)))<<13);l=0|(0|(a=_Mathimul(h,z))+(i>>>13))+(ve>>>26),ve&=67108863,r=_Mathimul(p,F),i=0|(i=_Mathimul(p,z))+_Mathimul(m,F),a=_Mathimul(m,z);var ge=0|(0|l+(r=0|r+_Mathimul(d,W)))+((8191&(i=0|(i=0|i+_Mathimul(d,V))+_Mathimul(h,W)))<<13);l=0|(0|(a=0|a+_Mathimul(h,V))+(i>>>13))+(ge>>>26),ge&=67108863,r=_Mathimul(g,F),i=0|(i=_Mathimul(g,z))+_Mathimul(b,F),a=_Mathimul(b,z),r=0|r+_Mathimul(p,W),i=0|(i=0|i+_Mathimul(p,V))+_Mathimul(m,W),a=0|a+_Mathimul(m,V);var be=0|(0|l+(r=0|r+_Mathimul(d,G)))+((8191&(i=0|(i=0|i+_Mathimul(d,K))+_Mathimul(h,G)))<<13);l=0|(0|(a=0|a+_Mathimul(h,K))+(i>>>13))+(be>>>26),be&=67108863,r=_Mathimul(w,F),i=0|(i=_Mathimul(w,z))+_Mathimul(_,F),a=_Mathimul(_,z),r=0|r+_Mathimul(g,W),i=0|(i=0|i+_Mathimul(g,V))+_Mathimul(b,W),a=0|a+_Mathimul(b,V),r=0|r+_Mathimul(p,G),i=0|(i=0|i+_Mathimul(p,K))+_Mathimul(m,G),a=0|a+_Mathimul(m,K);var ye=0|(0|l+(r=0|r+_Mathimul(d,X)))+((8191&(i=0|(i=0|i+_Mathimul(d,Z))+_Mathimul(h,X)))<<13);l=0|(0|(a=0|a+_Mathimul(h,Z))+(i>>>13))+(ye>>>26),ye&=67108863,r=_Mathimul(M,F),i=0|(i=_Mathimul(M,z))+_Mathimul(k,F),a=_Mathimul(k,z),r=0|r+_Mathimul(w,W),i=0|(i=0|i+_Mathimul(w,V))+_Mathimul(_,W),a=0|a+_Mathimul(_,V),r=0|r+_Mathimul(g,G),i=0|(i=0|i+_Mathimul(g,K))+_Mathimul(b,G),a=0|a+_Mathimul(b,K),r=0|r+_Mathimul(p,X),i=0|(i=0|i+_Mathimul(p,Z))+_Mathimul(m,X),a=0|a+_Mathimul(m,Z);var we=0|(0|l+(r=0|r+_Mathimul(d,Q)))+((8191&(i=0|(i=0|i+_Mathimul(d,ee))+_Mathimul(h,Q)))<<13);l=0|(0|(a=0|a+_Mathimul(h,ee))+(i>>>13))+(we>>>26),we&=67108863,r=_Mathimul(E,F),i=0|(i=_Mathimul(E,z))+_Mathimul(A,F),a=_Mathimul(A,z),r=0|r+_Mathimul(M,W),i=0|(i=0|i+_Mathimul(M,V))+_Mathimul(k,W),a=0|a+_Mathimul(k,V),r=0|r+_Mathimul(w,G),i=0|(i=0|i+_Mathimul(w,K))+_Mathimul(_,G),a=0|a+_Mathimul(_,K),r=0|r+_Mathimul(g,X),i=0|(i=0|i+_Mathimul(g,Z))+_Mathimul(b,X),a=0|a+_Mathimul(b,Z),r=0|r+_Mathimul(p,Q),i=0|(i=0|i+_Mathimul(p,ee))+_Mathimul(m,Q),a=0|a+_Mathimul(m,ee);var _e=0|(0|l+(r=0|r+_Mathimul(d,ne)))+((8191&(i=0|(i=0|i+_Mathimul(d,re))+_Mathimul(h,ne)))<<13);l=0|(0|(a=0|a+_Mathimul(h,re))+(i>>>13))+(_e>>>26),_e&=67108863,r=_Mathimul(S,F),i=0|(i=_Mathimul(S,z))+_Mathimul(I,F),a=_Mathimul(I,z),r=0|r+_Mathimul(E,W),i=0|(i=0|i+_Mathimul(E,V))+_Mathimul(A,W),a=0|a+_Mathimul(A,V),r=0|r+_Mathimul(M,G),i=0|(i=0|i+_Mathimul(M,K))+_Mathimul(k,G),a=0|a+_Mathimul(k,K),r=0|r+_Mathimul(w,X),i=0|(i=0|i+_Mathimul(w,Z))+_Mathimul(_,X),a=0|a+_Mathimul(_,Z),r=0|r+_Mathimul(g,Q),i=0|(i=0|i+_Mathimul(g,ee))+_Mathimul(b,Q),a=0|a+_Mathimul(b,ee),r=0|r+_Mathimul(p,ne),i=0|(i=0|i+_Mathimul(p,re))+_Mathimul(m,ne),a=0|a+_Mathimul(m,re);var xe=0|(0|l+(r=0|r+_Mathimul(d,ae)))+((8191&(i=0|(i=0|i+_Mathimul(d,oe))+_Mathimul(h,ae)))<<13);l=0|(0|(a=0|a+_Mathimul(h,oe))+(i>>>13))+(xe>>>26),xe&=67108863,r=_Mathimul(j,F),i=0|(i=_Mathimul(j,z))+_Mathimul(O,F),a=_Mathimul(O,z),r=0|r+_Mathimul(S,W),i=0|(i=0|i+_Mathimul(S,V))+_Mathimul(I,W),a=0|a+_Mathimul(I,V),r=0|r+_Mathimul(E,G),i=0|(i=0|i+_Mathimul(E,K))+_Mathimul(A,G),a=0|a+_Mathimul(A,K),r=0|r+_Mathimul(M,X),i=0|(i=0|i+_Mathimul(M,Z))+_Mathimul(k,X),a=0|a+_Mathimul(k,Z),r=0|r+_Mathimul(w,Q),i=0|(i=0|i+_Mathimul(w,ee))+_Mathimul(_,Q),a=0|a+_Mathimul(_,ee),r=0|r+_Mathimul(g,ne),i=0|(i=0|i+_Mathimul(g,re))+_Mathimul(b,ne),a=0|a+_Mathimul(b,re),r=0|r+_Mathimul(p,ae),i=0|(i=0|i+_Mathimul(p,oe))+_Mathimul(m,ae),a=0|a+_Mathimul(m,oe);var Me=0|(0|l+(r=0|r+_Mathimul(d,ue)))+((8191&(i=0|(i=0|i+_Mathimul(d,le))+_Mathimul(h,ue)))<<13);l=0|(0|(a=0|a+_Mathimul(h,le))+(i>>>13))+(Me>>>26),Me&=67108863,r=_Mathimul(L,F),i=0|(i=_Mathimul(L,z))+_Mathimul(P,F),a=_Mathimul(P,z),r=0|r+_Mathimul(j,W),i=0|(i=0|i+_Mathimul(j,V))+_Mathimul(O,W),a=0|a+_Mathimul(O,V),r=0|r+_Mathimul(S,G),i=0|(i=0|i+_Mathimul(S,K))+_Mathimul(I,G),a=0|a+_Mathimul(I,K),r=0|r+_Mathimul(E,X),i=0|(i=0|i+_Mathimul(E,Z))+_Mathimul(A,X),a=0|a+_Mathimul(A,Z),r=0|r+_Mathimul(M,Q),i=0|(i=0|i+_Mathimul(M,ee))+_Mathimul(k,Q),a=0|a+_Mathimul(k,ee),r=0|r+_Mathimul(w,ne),i=0|(i=0|i+_Mathimul(w,re))+_Mathimul(_,ne),a=0|a+_Mathimul(_,re),r=0|r+_Mathimul(g,ae),i=0|(i=0|i+_Mathimul(g,oe))+_Mathimul(b,ae),a=0|a+_Mathimul(b,oe),r=0|r+_Mathimul(p,ue),i=0|(i=0|i+_Mathimul(p,le))+_Mathimul(m,ue),a=0|a+_Mathimul(m,le);var ke=0|(0|l+(r=0|r+_Mathimul(d,de)))+((8191&(i=0|(i=0|i+_Mathimul(d,he))+_Mathimul(h,de)))<<13);l=0|(0|(a=0|a+_Mathimul(h,he))+(i>>>13))+(ke>>>26),ke&=67108863,r=_Mathimul(B,F),i=0|(i=_Mathimul(B,z))+_Mathimul(U,F),a=_Mathimul(U,z),r=0|r+_Mathimul(L,W),i=0|(i=0|i+_Mathimul(L,V))+_Mathimul(P,W),a=0|a+_Mathimul(P,V),r=0|r+_Mathimul(j,G),i=0|(i=0|i+_Mathimul(j,K))+_Mathimul(O,G),a=0|a+_Mathimul(O,K),r=0|r+_Mathimul(S,X),i=0|(i=0|i+_Mathimul(S,Z))+_Mathimul(I,X),a=0|a+_Mathimul(I,Z),r=0|r+_Mathimul(E,Q),i=0|(i=0|i+_Mathimul(E,ee))+_Mathimul(A,Q),a=0|a+_Mathimul(A,ee),r=0|r+_Mathimul(M,ne),i=0|(i=0|i+_Mathimul(M,re))+_Mathimul(k,ne),a=0|a+_Mathimul(k,re),r=0|r+_Mathimul(w,ae),i=0|(i=0|i+_Mathimul(w,oe))+_Mathimul(_,ae),a=0|a+_Mathimul(_,oe),r=0|r+_Mathimul(g,ue),i=0|(i=0|i+_Mathimul(g,le))+_Mathimul(b,ue),a=0|a+_Mathimul(b,le),r=0|r+_Mathimul(p,de),i=0|(i=0|i+_Mathimul(p,he))+_Mathimul(m,de),a=0|a+_Mathimul(m,he);var Ce=0|(0|l+(r=0|r+_Mathimul(d,pe)))+((8191&(i=0|(i=0|i+_Mathimul(d,me))+_Mathimul(h,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(h,me))+(i>>>13))+(Ce>>>26),Ce&=67108863,r=_Mathimul(B,W),i=0|(i=_Mathimul(B,V))+_Mathimul(U,W),a=_Mathimul(U,V),r=0|r+_Mathimul(L,G),i=0|(i=0|i+_Mathimul(L,K))+_Mathimul(P,G),a=0|a+_Mathimul(P,K),r=0|r+_Mathimul(j,X),i=0|(i=0|i+_Mathimul(j,Z))+_Mathimul(O,X),a=0|a+_Mathimul(O,Z),r=0|r+_Mathimul(S,Q),i=0|(i=0|i+_Mathimul(S,ee))+_Mathimul(I,Q),a=0|a+_Mathimul(I,ee),r=0|r+_Mathimul(E,ne),i=0|(i=0|i+_Mathimul(E,re))+_Mathimul(A,ne),a=0|a+_Mathimul(A,re),r=0|r+_Mathimul(M,ae),i=0|(i=0|i+_Mathimul(M,oe))+_Mathimul(k,ae),a=0|a+_Mathimul(k,oe),r=0|r+_Mathimul(w,ue),i=0|(i=0|i+_Mathimul(w,le))+_Mathimul(_,ue),a=0|a+_Mathimul(_,le),r=0|r+_Mathimul(g,de),i=0|(i=0|i+_Mathimul(g,he))+_Mathimul(b,de),a=0|a+_Mathimul(b,he);var Ee=0|(0|l+(r=0|r+_Mathimul(p,pe)))+((8191&(i=0|(i=0|i+_Mathimul(p,me))+_Mathimul(m,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(m,me))+(i>>>13))+(Ee>>>26),Ee&=67108863,r=_Mathimul(B,G),i=0|(i=_Mathimul(B,K))+_Mathimul(U,G),a=_Mathimul(U,K),r=0|r+_Mathimul(L,X),i=0|(i=0|i+_Mathimul(L,Z))+_Mathimul(P,X),a=0|a+_Mathimul(P,Z),r=0|r+_Mathimul(j,Q),i=0|(i=0|i+_Mathimul(j,ee))+_Mathimul(O,Q),a=0|a+_Mathimul(O,ee),r=0|r+_Mathimul(S,ne),i=0|(i=0|i+_Mathimul(S,re))+_Mathimul(I,ne),a=0|a+_Mathimul(I,re),r=0|r+_Mathimul(E,ae),i=0|(i=0|i+_Mathimul(E,oe))+_Mathimul(A,ae),a=0|a+_Mathimul(A,oe),r=0|r+_Mathimul(M,ue),i=0|(i=0|i+_Mathimul(M,le))+_Mathimul(k,ue),a=0|a+_Mathimul(k,le),r=0|r+_Mathimul(w,de),i=0|(i=0|i+_Mathimul(w,he))+_Mathimul(_,de),a=0|a+_Mathimul(_,he);var Ae=0|(0|l+(r=0|r+_Mathimul(g,pe)))+((8191&(i=0|(i=0|i+_Mathimul(g,me))+_Mathimul(b,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(b,me))+(i>>>13))+(Ae>>>26),Ae&=67108863,r=_Mathimul(B,X),i=0|(i=_Mathimul(B,Z))+_Mathimul(U,X),a=_Mathimul(U,Z),r=0|r+_Mathimul(L,Q),i=0|(i=0|i+_Mathimul(L,ee))+_Mathimul(P,Q),a=0|a+_Mathimul(P,ee),r=0|r+_Mathimul(j,ne),i=0|(i=0|i+_Mathimul(j,re))+_Mathimul(O,ne),a=0|a+_Mathimul(O,re),r=0|r+_Mathimul(S,ae),i=0|(i=0|i+_Mathimul(S,oe))+_Mathimul(I,ae),a=0|a+_Mathimul(I,oe),r=0|r+_Mathimul(E,ue),i=0|(i=0|i+_Mathimul(E,le))+_Mathimul(A,ue),a=0|a+_Mathimul(A,le),r=0|r+_Mathimul(M,de),i=0|(i=0|i+_Mathimul(M,he))+_Mathimul(k,de),a=0|a+_Mathimul(k,he);var Te=0|(0|l+(r=0|r+_Mathimul(w,pe)))+((8191&(i=0|(i=0|i+_Mathimul(w,me))+_Mathimul(_,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(_,me))+(i>>>13))+(Te>>>26),Te&=67108863,r=_Mathimul(B,Q),i=0|(i=_Mathimul(B,ee))+_Mathimul(U,Q),a=_Mathimul(U,ee),r=0|r+_Mathimul(L,ne),i=0|(i=0|i+_Mathimul(L,re))+_Mathimul(P,ne),a=0|a+_Mathimul(P,re),r=0|r+_Mathimul(j,ae),i=0|(i=0|i+_Mathimul(j,oe))+_Mathimul(O,ae),a=0|a+_Mathimul(O,oe),r=0|r+_Mathimul(S,ue),i=0|(i=0|i+_Mathimul(S,le))+_Mathimul(I,ue),a=0|a+_Mathimul(I,le),r=0|r+_Mathimul(E,de),i=0|(i=0|i+_Mathimul(E,he))+_Mathimul(A,de),a=0|a+_Mathimul(A,he);var Se=0|(0|l+(r=0|r+_Mathimul(M,pe)))+((8191&(i=0|(i=0|i+_Mathimul(M,me))+_Mathimul(k,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(k,me))+(i>>>13))+(Se>>>26),Se&=67108863,r=_Mathimul(B,ne),i=0|(i=_Mathimul(B,re))+_Mathimul(U,ne),a=_Mathimul(U,re),r=0|r+_Mathimul(L,ae),i=0|(i=0|i+_Mathimul(L,oe))+_Mathimul(P,ae),a=0|a+_Mathimul(P,oe),r=0|r+_Mathimul(j,ue),i=0|(i=0|i+_Mathimul(j,le))+_Mathimul(O,ue),a=0|a+_Mathimul(O,le),r=0|r+_Mathimul(S,de),i=0|(i=0|i+_Mathimul(S,he))+_Mathimul(I,de),a=0|a+_Mathimul(I,he);var Ie=0|(0|l+(r=0|r+_Mathimul(E,pe)))+((8191&(i=0|(i=0|i+_Mathimul(E,me))+_Mathimul(A,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(A,me))+(i>>>13))+(Ie>>>26),Ie&=67108863,r=_Mathimul(B,ae),i=0|(i=_Mathimul(B,oe))+_Mathimul(U,ae),a=_Mathimul(U,oe),r=0|r+_Mathimul(L,ue),i=0|(i=0|i+_Mathimul(L,le))+_Mathimul(P,ue),a=0|a+_Mathimul(P,le),r=0|r+_Mathimul(j,de),i=0|(i=0|i+_Mathimul(j,he))+_Mathimul(O,de),a=0|a+_Mathimul(O,he);var Ne=0|(0|l+(r=0|r+_Mathimul(S,pe)))+((8191&(i=0|(i=0|i+_Mathimul(S,me))+_Mathimul(I,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(I,me))+(i>>>13))+(Ne>>>26),Ne&=67108863,r=_Mathimul(B,ue),i=0|(i=_Mathimul(B,le))+_Mathimul(U,ue),a=_Mathimul(U,le),r=0|r+_Mathimul(L,de),i=0|(i=0|i+_Mathimul(L,he))+_Mathimul(P,de),a=0|a+_Mathimul(P,he);var je=0|(0|l+(r=0|r+_Mathimul(j,pe)))+((8191&(i=0|(i=0|i+_Mathimul(j,me))+_Mathimul(O,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(O,me))+(i>>>13))+(je>>>26),je&=67108863,r=_Mathimul(B,de),i=0|(i=_Mathimul(B,he))+_Mathimul(U,de),a=_Mathimul(U,he);var Oe=0|(0|l+(r=0|r+_Mathimul(L,pe)))+((8191&(i=0|(i=0|i+_Mathimul(L,me))+_Mathimul(P,pe)))<<13);l=0|(0|(a=0|a+_Mathimul(P,me))+(i>>>13))+(Oe>>>26),Oe&=67108863;var Re=0|(0|l+(r=_Mathimul(B,pe)))+((8191&(i=0|(i=_Mathimul(B,me))+_Mathimul(U,pe)))<<13);return l=0|(0|(a=_Mathimul(U,me))+(i>>>13))+(Re>>>26),Re&=67108863,u[0]=ve,u[1]=ge,u[2]=be,u[3]=ye,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Ce,u[10]=Ee,u[11]=Ae,u[12]=Te,u[13]=Se,u[14]=Ie,u[15]=Ne,u[16]=je,u[17]=Oe,u[18]=Re,0!=l&&(u[19]=l,n.length++),n};_Mathimul||(x=u),a.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):63>n?u(this,e,t):1024>n?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r,i=0,a=0,o=0;o<n.length-1;o++){r=a,a=0;for(var s=67108863&i,u=_Mathmin(o,t.length-1),l=_Mathmax(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),h=67108863&d;s=67108863&(h=0|h+s),a+=(r=0|(r=0|r+(0|d/67108864))+(h>>>26))>>>26,r&=67108863}n.words[o]=s,i=r,r=a}return 0==i?n.length--:n.words[o]=i,n.strip()}(this,e,t):l(this,e,t)},c.prototype.makeRBT=function(e){for(var t=Array(e),n=a.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},c.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},c.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},c.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,u=_Mathcos(2*_MathPI/s),l=_Mathsin(2*_MathPI/s),c=0;c<i;c+=s)for(var d=u,h=l,f=0;f<o;f++){var p=n[c+f],m=r[c+f],v=n[c+f+o],g=r[c+f+o],b=d*v-h*g;g=d*g+h*v,v=b,n[c+f]=p+v,r[c+f]=m+g,n[c+f+o]=p-v,r[c+f+o]=m-g,f!==s&&(b=u*d-l*h,h=u*h+l*d,d=b)}},c.prototype.guessLen13b=function(e,t){var n=1|_Mathmax(t,e),r=1&n,i=0;for(n=0|n/2;n;n>>>=1)i++;return 1<<i+1+r},c.prototype.conjugate=function(e,t,n){if(!(1>=n))for(var r,i=0;i<n/2;i++)r=e[i],e[i]=e[n-i-1],e[n-i-1]=r,r=t[i],t[i]=-t[n-i-1],t[n-i-1]=-r},c.prototype.normalize13b=function(e,t){for(var n,r=0,i=0;i<t/2;i++)n=8192*_Mathround(e[2*i+1]/t)+_Mathround(e[2*i]/t)+r,e[i]=67108863&n,r=67108864>n?0:0|n/67108864;return e},c.prototype.convert13b=function(e,t,n,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],n[2*o]=8191&a,a>>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0==a),r(0==(-8192&a))},c.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},c.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),u=Array(r),l=Array(r),c=Array(r),d=Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,u,r,i),this.transform(l,a,c,d,r,i);for(var f,p=0;p<r;p++)f=s[p]*c[p]-u[p]*d[p],u[p]=s[p]*d[p]+u[p]*c[p],s[p]=f;return this.conjugate(s,u,r),this.transform(s,u,h,a,r,i),this.conjugate(h,a,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=Array(this.length+e.length),l(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){r("number"==typeof e),r(67108864>e);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=0|i/67108864,t+=a>>>26,this.words[n]=67108863&a}return 0!=t&&(this.words[n]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=0|n/26,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},a.prototype.iushln=function(e){r("number"==typeof e&&0<=e);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<n;this.words[t]=u|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!=i){for(t=this.length-1;0<=t;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&0<=e),i=t?(t-t%26)/26:0;var a=e%26,o=_Mathmin((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=n;if(i=_Mathmax(0,i-=o),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;0<=l&&(0!=c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!=c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},a.prototype.imaskn=function(e){r("number"==typeof e&&0<=e);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=t&&n++,this.length=_Mathmin(n,this.length),0!=t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return r("number"==typeof e),r(67108864>e),0>e?this.isubn(-e):0===this.negative?this._iaddn(e):1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=_Mathmax(this.length,t+1),this},a.prototype.isubn=function(e){if(r("number"==typeof e),r(67108864>e),0>e)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&0>this.words[t];t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,n){var i,a=e.length+n;this._expand(a);var o,s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(0|u/67108864),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0==s)return this.strip();for(r(-1==s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(i,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d,h=u-1;0<=h;h--){for(d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]),d=_Mathmin(0|d/o,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!=n&&r.iushrn(n),{div:s||null,mod:r}},a.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0==(this.negative&e.negative)?e.length>this.length||0>this.cmp(e)?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o});var i,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0===t.div.negative?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return 0>a||1===i&&0===a?t.div:0===t.div.negative?t.div.iaddn(1):t.div.isubn(1)},a.prototype.modn=function(e){r(67108863>=e);for(var t=67108864%e,n=0,i=this.length-1;0<=i;i--)n=(t*n+(0|this.words[i]))%e;return n},a.prototype.idivn=function(e){r(67108863>=e);for(var t,n=0,i=this.length-1;0<=i;i--)t=(0|this.words[i])+67108864*n,this.words[i]=0|t/e,n=t%e;return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0===t.negative?t.clone():t.umod(e);for(var i=new a(1),o=new a(0),s=new a(0),u=new a(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&26>h;++h,f<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(0<p)for(n.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);0<=t.cmp(n)?(t.isub(n),i.isub(s),o.isub(u)):(n.isub(t),s.isub(i),u.isub(o))}return{a:s,b:u,gcd:n.iushln(l)}},a.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0===n.negative?n.clone():n.umod(e);for(var o=new a(1),s=new a(0),u=i.clone();0<n.cmpn(1)&&0<i.cmpn(1);){for(var l=0,c=1;0==(n.words[0]&c)&&26>l;++l,c<<=1);if(0<l)for(n.iushrn(l);0<l--;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,h=1;0==(i.words[0]&h)&&26>d;++d,h<<=1);if(0<d)for(i.iushrn(d);0<d--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=n.cmp(i)?(n.isub(i),o.isub(s)):(i.isub(n),s.isub(o))}return 0>(t=0===n.cmpn(1)?o:s).cmpn(0)&&t.iadd(e),t},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(0>i){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a,o=i,s=n;0!=o&&s<this.length;s++)a=0|this.words[s],o=(a+=o)>>>26,a&=67108863,this.words[s]=a;return 0!=o&&(this.words[s]=o,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,n=0>e;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)t=1;else{n&&(e=-e),r(67108863>=e,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0===this.negative?t:0|-t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0===this.negative?t:0|-t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|e.words[n];if(r!=i){r<i?t=-1:r>i&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return 0<=this.cmpn(e)},a.prototype.gte=function(e){return 0<=this.cmp(e)},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return 0>=this.cmpn(e)},a.prototype.lte=function(e){return 0>=this.cmp(e)},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new v(e)},a.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new a(null);return e.words=Array(_Mathceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},i(h,d),h.prototype.split=function(e,t){for(var n=4194303,r=_Mathmin(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,9>=e.length)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,e.length-=0===a&&10<e.length?10:9},h.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t,n=0,r=0;r<e.length;r++)n+=977*(t=0|e.words[r]),e.words[r]=67108863&n,n=64*t+(0|n/67108864);return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(f,d),i(p,d),i(m,d),m.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!=t&&(e.words[e.length++]=t),e},a._prime=function(e){if(M[e])return M[e];var t;if("k256"===e)t=new h;else if("p224"===e)t=new f;else if("p192"===e)t=new p;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new m}return M[e]=t,t},v.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},v.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},v.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},v.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},v.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},v.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return 0<=n.cmp(this.m)&&n.isub(this.m),n},v.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},v.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},v.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},v.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},v.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},v.prototype.isqr=function(e){return this.imul(e,e.clone())},v.prototype.sqr=function(e){return this.mul(e,e)},v.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(1==t%2),3===t){var n=this.m.add(new a(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);r(!i.isZero());var s=new a(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=o;0!==f.cmp(s);){for(var m=f,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(v<p);var g=this.pow(d,new a(1).iushln(p-v-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=v}return h},v.prototype.invm=function(e){var t=e._invmp(this.m);return 0===t.negative?this.imod(t):(t.negative=0,this.imod(t).redNeg())},v.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=Array(16);n[0]=new a(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],o=0,s=0,u=t.bitLength()%26;for(0==u&&(u=26),r=t.length-1;0<=r;r--){for(var l,c=t.words[r],d=u-1;0<=d;d--)l=1&c>>d,i!==n[0]&&(i=this.sqr(i)),0!=l||0!=o?(o<<=1,o|=l,4!=++s&&(0!==r||0!==d)||(i=this.mul(i,n[o]),s=0,o=0)):s=0;u=26}return i},v.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},v.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new g(e)},i(g,v),g.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},g.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},g.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return 0<=i.cmp(this.m)?a=i.isub(this.m):0>i.cmpn(0)&&(a=i.iadd(this.m)),a._forceRed(this)},g.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},g.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(22)(e))},function(e,t){},function(e,t,n){(function(e){var r=n(153),i=n(345),a=n(344),o={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var n=new e(i[t].prime,"hex"),r=new e(i[t].gen,"hex");return new a(n,r)},t.createDiffieHellman=t.DiffieHellman=function t(n,i,s,u){return e.isBuffer(i)||void 0===o[i]?t(n,"binary",i,s):(i=i||"binary",u=u||"binary",s=s||new e([2]),e.isBuffer(s)||(s=new e(s,u)),"number"==typeof n?new a(r(n,s),s,!0):(e.isBuffer(n)||(n=new e(n,i)),new a(n,s,!0)))}}).call(this,n(2).Buffer)},function(e,t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},function(e,t,n){function r(e,t,n){c.call(this),this._cache=new i,this._last=void 0,this._cipher=new d.AES(t),this._prev=s.from(n),this._mode=e,this._autopadding=!0}function i(){this.cache=s.allocUnsafe(0)}function a(e,t,n){var i=u[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=s.from(n)),"GCM"!==i.mode&&n.length!==i.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof t&&(t=s.from(t)),t.length!==i.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===i.type?new l(i.module,t,n,!0):"auth"===i.type?new o(i.module,t,n,!0):new r(i.module,t,n)}var o=n(155),s=n(3).Buffer,u=n(95),l=n(154),c=n(28),d=n(70),h=n(69);n(1)(r,c),r.prototype._update=function(e){this._cache.add(e);for(var t,n,r=[];t=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,t),r.push(n);return s.concat(r)},r.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(1>t||16<t)throw new Error("unable to decrypt data");for(var n=-1;++n<t;)if(e[n+(16-t)]!==t)throw new Error("unable to decrypt data");return 16===t?void 0:e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},r.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},i.prototype.add=function(e){this.cache=s.concat([this.cache,e])},i.prototype.get=function(e){var t;if(e){if(16<this.cache.length)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(16<=this.cache.length)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},i.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var n=u[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=h(t,!1,n.key,n.iv);return a(e,r.key,r.iv)},t.createDecipheriv=a},function(e,t,n){function r(e){var t=a.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function i(e){this.h=e,this.state=a.alloc(16,0),this.cache=a.allocUnsafe(0)}var a=n(3).Buffer,o=a.alloc(16,0);i.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},i.prototype._multiply=function(){for(var e,t,n=function(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}(this.h),i=[0,0,0,0],a=-1;128>++a;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),t=0!=(1&n[3]),e=3;0<e;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]>>>=1,t&&(n[0]^=-520093696)}this.state=r(i)},i.prototype.update=function(e){this.cache=a.concat([this.cache,e]);for(var t;16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},i.prototype.final=function(e,t){return this.cache.length&&this.ghash(a.concat([this.cache,o],16)),this.ghash(r([0,e,0,t])),this.state},e.exports=i},function(e,t,n){(function(e){function r(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}var i=n(53);t.encrypt=function(t,n){for(;t._cache.length<n.length;)t._cache=e.concat([t._cache,r(t)]);var a=t._cache.slice(0,n.length);return t._cache=t._cache.slice(n.length),i(n,a)}}).call(this,n(2).Buffer)},function(e,t,n){function r(e,t,n){for(var r,a,o,s=-1,u=0;++s<8;)r=e._cipher.encryptBlock(e._prev),a=t&1<<7-s?128:0,u+=(128&(o=r[0]^a))>>s%8,e._prev=i(e._prev,n?a:o);return u}function i(e,t){var n=e.length,r=-1,i=a.allocUnsafe(e.length);for(e=a.concat([e,a.from([t])]);++r<n;)i[r]=e[r]<<1|e[r+1]>>7;return i}var a=n(3).Buffer;t.encrypt=function(e,t,n){for(var i=t.length,o=a.allocUnsafe(i),s=-1;++s<i;)o[s]=r(e,t[s],n);return o}},function(e,t,n){function r(e,t,n){var r=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([n?t:r])]),r}var i=n(3).Buffer;t.encrypt=function(e,t,n){for(var a=t.length,o=i.allocUnsafe(a),s=-1;++s<a;)o[s]=r(e,t[s],n);return o}},function(e,t,n){function r(e,t,n){var r=t.length,o=a(t,e._cache);return e._cache=e._cache.slice(r),e._prev=i.concat([e._prev,n?t:o]),o}var i=n(3).Buffer,a=n(53);t.encrypt=function(e,t,n){for(var a,o=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){o=i.concat([o,r(e,t,n)]);break}a=e._cache.length,o=i.concat([o,r(e,t.slice(0,a),n)]),t=t.slice(a)}return o}},function(e,t,n){var r=n(53);t.encrypt=function(e,t){var n=r(t,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},t.decrypt=function(e,t){var n=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return r(i,n)}},function(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},function(e,t,n){function r(e,t,n){c.call(this),this._cache=new i,this._cipher=new d.AES(t),this._prev=u.from(n),this._mode=e,this._autopadding=!0}function i(){this.cache=u.allocUnsafe(0)}function a(e,t,n){var i=o[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=u.from(t)),t.length!==i.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=u.from(n)),"GCM"!==i.mode&&n.length!==i.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===i.type?new l(i.module,t,n):"auth"===i.type?new s(i.module,t,n):new r(i.module,t,n)}var o=n(95),s=n(155),u=n(3).Buffer,l=n(154),c=n(28),d=n(70),h=n(69);n(1)(r,c),r.prototype._update=function(e){this._cache.add(e);for(var t,n,r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return u.concat(r)};var f=u.alloc(16,16);r.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},r.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},i.prototype.add=function(e){this.cache=u.concat([this.cache,e])},i.prototype.get=function(){if(15<this.cache.length){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},i.prototype.flush=function(){for(var e=16-this.cache.length,t=u.allocUnsafe(e),n=-1;++n<e;)t.writeUInt8(e,n);return u.concat([this.cache,t])},t.createCipheriv=a,t.createCipher=function(e,t){var n=o[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=h(t,!1,n.key,n.iv);return a(e,r.key,r.iv)}},function(e,t,n){"use strict";function r(e){s.call(this,e);var t=new function(e,t){i.equal(t.length,24,"Invalid key length");var n=t.slice(0,8),r=t.slice(8,16),a=t.slice(16,24);this.ciphers="encrypt"===e?[u.create({type:"encrypt",key:n}),u.create({type:"decrypt",key:r}),u.create({type:"encrypt",key:a})]:[u.create({type:"decrypt",key:a}),u.create({type:"encrypt",key:r}),u.create({type:"decrypt",key:n})]}(this.type,this.options.key);this._edeState=t}var i=n(13),a=n(1),o=n(97),s=o.Cipher,u=o.DES;a(r,s),e.exports=r,r.create=function(e){return new r(e)},r.prototype._update=function(e,t,n,r){var i=this._edeState;i.ciphers[0]._update(e,t,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},r.prototype._pad=u.prototype._pad,r.prototype._unpad=u.prototype._unpad},function(e,t,n){"use strict";var r=n(13),i=n(1),a={};t.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}i(t,e);for(var n,r=Object.keys(a),o=0;o<r.length;o++)n=r[o],t.prototype[n]=a[n];return t.create=function(e){return new t(e)},t},a._cbcInit=function(){var e=new function(e){r.equal(e.length,8,"Invalid IV length"),this.iv=Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}(this.options.iv);this._cbcState=e},a._update=function(e,t,n,r){var i=this._cbcState,a=this.constructor.super_.prototype,o=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)o[s]^=e[t+s];a._update.call(this,o,0,n,r);for(s=0;s<this.blockSize;s++)o[s]=n[r+s]}else{a._update.call(this,e,t,n,r);for(s=0;s<this.blockSize;s++)n[r+s]^=o[s];for(s=0;s<this.blockSize;s++)o[s]=e[t+s]}}},function(e,t,n){"use strict";function r(e){u.call(this,e);var t=new function(){this.tmp=[,,],this.keys=null};this._desState=t,this.deriveKeys(t,e.key)}var i=n(13),a=n(1),o=n(97),s=o.utils,u=o.Cipher;a(r,u),e.exports=r,r.create=function(e){return new r(e)};var l=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];r.prototype.deriveKeys=function(e,t){e.keys=Array(32),i.equal(t.length,this.blockSize,"Invalid key length");var n=s.readUInt32BE(t,0),r=s.readUInt32BE(t,4);s.pc1(n,r,e.tmp,0),n=e.tmp[0],r=e.tmp[1];for(var a,o=0;o<e.keys.length;o+=2)a=l[o>>>1],n=s.r28shl(n,a),r=s.r28shl(r,a),s.pc2(n,r,e.keys,o)},r.prototype._update=function(e,t,n,r){var i=this._desState,a=s.readUInt32BE(e,t),o=s.readUInt32BE(e,t+4);s.ip(a,o,i.tmp,0),a=i.tmp[0],o=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,o,i.tmp,0):this._decrypt(i,a,o,i.tmp,0),a=i.tmp[0],o=i.tmp[1],s.writeUInt32BE(n,a,r),s.writeUInt32BE(n,o,r+4)},r.prototype._pad=function(e,t){for(var n=e.length-t,r=t;r<e.length;r++)e[r]=n;return!0},r.prototype._unpad=function(e){for(var t=e[e.length-1],n=e.length-t;n<e.length;n++)i.equal(e[n],t);return e.slice(0,e.length-t)},r.prototype._encrypt=function(e,t,n,r,i){for(var a=t,o=n,u=0;u<e.keys.length;u+=2){var l=e.keys[u],c=e.keys[u+1];s.expand(o,e.tmp,0),l^=e.tmp[0],c^=e.tmp[1];var d=s.substitute(l,c),h=o;o=(a^s.permute(d))>>>0,a=h}s.rip(o,a,r,i)},r.prototype._decrypt=function(e,t,n,r,i){for(var a=n,o=t,u=e.keys.length-2;0<=u;u-=2){var l=e.keys[u],c=e.keys[u+1];s.expand(a,e.tmp,0),l^=e.tmp[0],c^=e.tmp[1];var d=s.substitute(l,c),h=a;a=(o^s.permute(d))>>>0,o=h}s.rip(a,o,r,i)}},function(e,t,n){"use strict";function r(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=Array(this.blockSize),this.bufferOff=0}var i=n(13);e.exports=r,r.prototype._init=function(){},r.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},r.prototype._buffer=function(e,t){for(var n=_Mathmin(this.buffer.length-this.bufferOff,e.length-t),r=0;r<n;r++)this.buffer[this.bufferOff+r]=e[t+r];return this.bufferOff+=n,n},r.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},r.prototype._updateEncrypt=function(e){var t=0,n=0,r=0|(this.bufferOff+e.length)/this.blockSize,i=Array(r*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var a=e.length-(e.length-t)%this.blockSize;t<a;t+=this.blockSize)this._update(e,t,i,n),n+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},r.prototype._updateDecrypt=function(e){for(var t=0,n=0,r=_Mathceil((this.bufferOff+e.length)/this.blockSize)-1,i=Array(r*this.blockSize);0<r;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},r.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},r.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},r.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=Array(this.blockSize);return this._update(this.buffer,0,e,0),e},r.prototype._unpad=function(e){return e},r.prototype._finalDecrypt=function(){i.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}},function(e,t,n){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,n){e[0+n]=t>>>24,e[1+n]=255&t>>>16,e[2+n]=255&t>>>8,e[3+n]=255&t},t.ip=function(e,t,n,r){for(var i=0,a=0,o=6;0<=o;o-=2){for(var s=0;24>=s;s+=8)i<<=1,i|=1&t>>>s+o;for(s=0;24>=s;s+=8)i<<=1,i|=1&e>>>s+o}for(o=6;0<=o;o-=2){for(s=1;25>=s;s+=8)a<<=1,a|=1&t>>>s+o;for(s=1;25>=s;s+=8)a<<=1,a|=1&e>>>s+o}n[r+0]=i>>>0,n[r+1]=a>>>0},t.rip=function(e,t,n,r){for(var i=0,a=0,o=0;4>o;o++)for(var s=24;0<=s;s-=8)i<<=1,i|=1&t>>>s+o,i<<=1,i|=1&e>>>s+o;for(o=4;8>o;o++)for(s=24;0<=s;s-=8)a<<=1,a|=1&t>>>s+o,a<<=1,a|=1&e>>>s+o;n[r+0]=i>>>0,n[r+1]=a>>>0},t.pc1=function(e,t,n,r){for(var i=0,a=0,o=7;5<=o;o--){for(var s=0;24>=s;s+=8)i<<=1,i|=1&t>>s+o;for(s=0;24>=s;s+=8)i<<=1,i|=1&e>>s+o}for(s=0;24>=s;s+=8)i<<=1,i|=1&t>>s+o;for(o=1;3>=o;o++){for(s=0;24>=s;s+=8)a<<=1,a|=1&t>>s+o;for(s=0;24>=s;s+=8)a<<=1,a|=1&e>>s+o}for(s=0;24>=s;s+=8)a<<=1,a|=1&e>>s+o;n[r+0]=i>>>0,n[r+1]=a>>>0},t.r28shl=function(e,t){return 268435455&e<<t|e>>>28-t};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,n,i){for(var a=0,o=0,s=r.length>>>1,u=0;u<s;u++)a<<=1,a|=1&e>>>r[u];for(u=s;u<r.length;u++)o<<=1,o|=1&t>>>r[u];n[i+0]=a>>>0,n[i+1]=o>>>0},t.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var a=23;15<=a;a-=4)r<<=6,r|=63&e>>>a;for(a=11;3<=a;a-=4)i|=63&e>>>a,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var n=0,r=0;4>r;r++){n<<=4,n|=i[64*r+(63&e>>>18-6*r)]}for(r=0;4>r;r++){n<<=4,n|=i[256+64*r+(63&t>>>18-6*r)]}return n>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,n=0;n<a.length;n++)t<<=1,t|=1&e>>>a[n];return t>>>0},t.padSplit=function(e,t,n){for(var r=e.toString(2);r.length<t;)r="0"+r;for(var i=[],a=0;a<t;a+=n)i.push(r.slice(a,a+n));return i.join(" ")}},function(e,t,n){(function(t){function r(e){i.call(this);var n,r=e.mode.toLowerCase(),a=s[r];n=e.decrypt?"decrypt":"encrypt";var o=e.key;("des-ede"===r||"des-ede-cbc"===r)&&(o=t.concat([o,o.slice(0,8)]));var u=e.iv;this._des=a.create({key:o,iv:u,type:n})}var i=n(28),a=n(97),o=n(1),s={"des-ede3-cbc":a.CBC.instantiate(a.EDE),"des-ede3":a.EDE,"des-ede-cbc":a.CBC.instantiate(a.EDE),"des-ede":a.EDE,"des-cbc":a.CBC.instantiate(a.DES),"des-ecb":a.DES};s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],e.exports=r,o(r,i),r.prototype._update=function(e){return new t(this._des.update(e))},r.prototype._final=function(){return new t(this._des.final())}}).call(this,n(2).Buffer)},function(e,t,n){function r(e,t,n){if(e=e.toLowerCase(),s[e])return o.createCipheriv(e,t,n);if(u[e])return new a({key:t,iv:n,mode:e});throw new TypeError("invalid suite type")}function i(e,t,n){if(e=e.toLowerCase(),s[e])return o.createDecipheriv(e,t,n);if(u[e])return new a({key:t,iv:n,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}var a=n(366),o=n(96),s=n(95),u=n(351),l=n(69);t.createCipher=t.Cipher=function(e,t){var n,i;if(e=e.toLowerCase(),s[e])n=s[e].key,i=s[e].iv;else{if(!u[e])throw new TypeError("invalid suite type");n=8*u[e].key,i=u[e].iv}var a=l(t,!1,n,i);return r(e,a.key,a.iv)},t.createCipheriv=t.Cipheriv=r,t.createDecipher=t.Decipher=function(e,t){var n,r;if(e=e.toLowerCase(),s[e])n=s[e].key,r=s[e].iv;else{if(!u[e])throw new TypeError("invalid suite type");n=8*u[e].key,r=u[e].iv}var a=l(t,!1,n,r);return i(e,a.key,a.iv)},t.createDecipheriv=t.Decipheriv=i,t.listCiphers=t.getCiphers=function(){return Object.keys(u).concat(o.getCiphers())}},function(e,t,n){(function(t,r){function i(e){if(t.process&&!t.process.browser)return Promise.resolve(!1);if(!d||!d.importKey||!d.deriveBits)return Promise.resolve(!1);if(void 0!==f[e])return f[e];var n=a(o=o||c.alloc(8),o,10,128,e).then(function(){return!0}).catch(function(){return!1});return f[e]=n,n}function a(e,t,n,r,i){return d.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return d.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:i}},e,r<<3)}).then(function(e){return c.from(e)})}var o,s=n(161),u=n(160),l=n(159),c=n(3).Buffer,d=t.crypto&&t.crypto.subtle,h={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},f=[];e.exports=function(e,n,o,d,f,p){"function"==typeof f&&(p=f,f=void 0);var m=h[(f=f||"sha1").toLowerCase()];if(!m||"function"!=typeof t.Promise)return r.nextTick(function(){var t;try{t=l(e,n,o,d,f)}catch(t){return p(t)}p(null,t)});if(s(e,n,o,d),"function"!=typeof p)throw new Error("No callback provided to pbkdf2");c.isBuffer(e)||(e=c.from(e,u)),c.isBuffer(n)||(n=c.from(n,u)),function(e,t){e.then(function(e){r.nextTick(function(){t(null,e)})},function(e){r.nextTick(function(){t(e)})})}(i(m).then(function(t){return t?a(e,n,o,d,m):l(e,n,o,d,f)}),p)}}).call(this,n(5),n(11))},function(e,t,n){e.exports=n(163)},function(e,t,n){"use strict";function r(e,t){o.call(this,"digest"),"string"==typeof t&&(t=a.from(t)),this._alg=e,this._key=t,t.length>u?t=e(t):t.length<u&&(t=a.concat([t,s],u));for(var n=this._ipad=a.allocUnsafe(u),r=this._opad=a.allocUnsafe(u),i=0;i<u;i++)n[i]=54^t[i],r[i]=92^t[i];this._hash=[n]}var i=n(1),a=n(3).Buffer,o=n(28),s=a.alloc(128),u=64;i(r,o),r.prototype._update=function(e){this._hash.push(e)},r.prototype._final=function(){var e=this._alg(a.concat(this._hash));return this._alg(a.concat([this._opad,e]))},e.exports=r},function(e,t,n){function r(){this.init(),this._w=u,o.call(this,128,112)}var i=n(1),a=n(166),o=n(43),s=n(3).Buffer,u=Array(160);i(r,a),r.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},r.prototype._hash=function(){function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}var t=s.allocUnsafe(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=r},function(e,t,n){function r(){this.init(),this._w=u,o.call(this,64,56)}var i=n(1),a=n(167),o=n(43),s=n(3).Buffer,u=Array(64);i(r,a),r.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},r.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=r},function(e,t,n){function r(){this.init(),this._w=h,l.call(this,64,56)}function i(e){return e<<1|e>>>31}function a(e){return e<<5|e>>>27}function o(e){return e<<30|e>>>2}function s(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}var u=n(1),l=n(43),c=n(3).Buffer,d=[1518500249,1859775393,-1894007588,-899497514],h=Array(80);u(r,l),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,u=0|this._c,l=0|this._d,c=0|this._e,h=0;16>h;++h)t[h]=e.readInt32BE(4*h);for(;80>h;++h)t[h]=i(t[h-3]^t[h-8]^t[h-14]^t[h-16]);for(var f=0;80>f;++f){var p=~~(f/20),m=0|a(n)+s(p,r,u,l)+c+t[f]+d[p];c=l,l=u,u=o(r),r=n,n=m}this._a=0|n+this._a,this._b=0|r+this._b,this._c=0|u+this._c,this._d=0|l+this._d,this._e=0|c+this._e},r.prototype._hash=function(){var e=c.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=r},function(e,t,n){function r(){this.init(),this._w=d,u.call(this,64,56)}function i(e){return e<<5|e>>>27}function a(e){return e<<30|e>>>2}function o(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}var s=n(1),u=n(43),l=n(3).Buffer,c=[1518500249,1859775393,-1894007588,-899497514],d=Array(80);s(r,u),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,s=0|this._c,u=0|this._d,l=0|this._e,d=0;16>d;++d)t[d]=e.readInt32BE(4*d);for(;80>d;++d)t[d]=t[d-3]^t[d-8]^t[d-14]^t[d-16];for(var h=0;80>h;++h){var f=~~(h/20),p=0|i(n)+o(f,r,s,u)+l+t[h]+c[f];l=u,u=s,s=a(r),r=n,n=p}this._a=0|n+this._a,this._b=0|r+this._b,this._c=0|s+this._c,this._d=0|u+this._d,this._e=0|l+this._e},r.prototype._hash=function(){var e=l.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=r},function(e,t,n){"use strict";t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=n(44),t.createHash=t.Hash=n(54),t.createHmac=t.Hmac=n(165);var r=n(369),i=Object.keys(r),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);t.getHashes=function(){return a};var o=n(162);t.pbkdf2=o.pbkdf2,t.pbkdf2Sync=o.pbkdf2Sync;var s=n(367);t.Cipher=s.Cipher,t.createCipher=s.createCipher,t.Cipheriv=s.Cipheriv,t.createCipheriv=s.createCipheriv,t.Decipher=s.Decipher,t.createDecipher=s.createDecipher,t.Decipheriv=s.Decipheriv,t.createDecipheriv=s.createDecipheriv,t.getCiphers=s.getCiphers,t.listCiphers=s.listCiphers;var u=n(350);t.DiffieHellmanGroup=u.DiffieHellmanGroup,t.createDiffieHellmanGroup=u.createDiffieHellmanGroup,t.getDiffieHellman=u.getDiffieHellman,t.createDiffieHellman=u.createDiffieHellman,t.DiffieHellman=u.DiffieHellman;var l=n(343);t.createSign=l.createSign,t.Sign=l.Sign,t.createVerify=l.createVerify,t.Verify=l.Verify,t.createECDH=n(299);var c=n(296);t.publicEncrypt=c.publicEncrypt,t.privateEncrypt=c.privateEncrypt,t.publicDecrypt=c.publicDecrypt,t.privateDecrypt=c.privateDecrypt;var d=n(292);t.randomFill=d.randomFill,t.randomFillSync=d.randomFillSync,t.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/crypto-browserify/crypto-browserify")},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(e,t,n){(function(r){var i;!function(a){"use strict";function o(e,t){var n=t||0,r=f;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}function s(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new h(16):null,e=null);var i=(e=e||{}).random||(e.rng||u)();if(i[6]=64|15&i[6],i[8]=128|63&i[8],t)for(var a=0;16>a;a++)t[r+a]=i[a];return t||o(i)}var u,l,c,d;a?function(){var e=a.crypto||a.msCrypto;if(!u&&e&&e.getRandomValues)try{var t=new Uint8Array(16);d=u=function(){return e.getRandomValues(t),t},u()}catch(t){}if(!u){var n=Array(16);l=u=function(){for(var e,t=0;16>t;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=255&e>>>((3&t)<<3);return n},"undefined"!=typeof console&&console.warn&&console.warn("[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()")}}():function(){try{var e=n(375).randomBytes;c=u=e&&function(){return e(16)},u()}catch(e){}}();for(var h="function"==typeof r?r:Array,f=[],p={},m=0;256>m;m++)f[m]=(m+256).toString(16).substr(1),p[f[m]]=m;var v=u(),g=[1|v[0],v[1],v[2],v[3],v[4],v[5]],b=16383&(v[6]<<8|v[7]),y=0,w=0,_=s;_.v1=function(e,t,n){var r=t&&n||0,i=t||[],a=null==(e=e||{}).clockseq?b:e.clockseq,s=null==e.msecs?(new Date).getTime():e.msecs,u=null==e.nsecs?w+1:e.nsecs,l=s-y+(u-w)/1e4;if(0>l&&null==e.clockseq&&(a=16383&a+1),(0>l||s>y)&&null==e.nsecs&&(u=0),1e4<=u)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=s,w=u,b=a;var c=(1e4*(268435455&(s+=122192928e5))+u)%4294967296;i[r++]=255&c>>>24,i[r++]=255&c>>>16,i[r++]=255&c>>>8,i[r++]=255&c;var d=268435455&s/4294967296*1e4;i[r++]=255&d>>>8,i[r++]=255&d,i[r++]=16|15&d>>>24,i[r++]=255&d>>>16,i[r++]=128|a>>>8,i[r++]=255&a;for(var h=e.node||g,f=0;6>f;f++)i[r+f]=h[f];return t||o(i)},_.v4=s,_.parse=function(e,t,n){var r=t&&n||0,i=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){16>i&&(t[r+i++]=p[e])});16>i;)t[r+i++]=0;return t},_.unparse=o,_.BufferClass=h,_._rng=u,_._mathRNG=l,_._nodeRNG=c,_._whatwgRNG=d,void 0!==e&&e.exports?e.exports=_:void 0===(i=function(){return _}.call(t,n,t,e))||(e.exports=i)}("undefined"==typeof window?null:window)}).call(this,n(2).Buffer)},function(e,t,n){"use strict";
119
- /*!
120
- * escape-html
121
- * Copyright(c) 2012-2013 TJ Holowaychuk
122
- * Copyright(c) 2015 Andreas Lubbe
123
- * Copyright(c) 2015 Tiancheng "Timothy" Gu
124
- * MIT Licensed
125
- */var r=/["'&<>]/;e.exports=function(e){var t=""+e,n=r.exec(t);if(!n)return t;var i,a="",o=0,s=0;for(o=n.index;o<t.length;o++){switch(t.charCodeAt(o)){case 34:i="&quot;";break;case 38:i="&amp;";break;case 39:i="&#39;";break;case 60:i="&lt;";break;case 62:i="&gt;";break;default:continue}s!==o&&(a+=t.substring(s,o)),s=o+1,a+=i}return s===o?a:a+t.substring(s,o)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n){var r=g.default.any(e,t);return r?r.value:n}function o(e,t){var n=t.toDel,r=t.toIns;return new Promise(function(e,t){g.default.updater.update(n,r,function(n,r,i){return r?void e():t(new Error("PATCH failed for resource <"+n+">: "+i))})})}function s(e){return{groupIndex:g.default.any(e,v.default.vcard("groupIndex")),groupContainer:g.default.sym(e.dir().uri+"Group/")}}Object.defineProperty(t,"__esModule",{value:!0}),t.GroupBuilder=t.Group=t.GroupPicker=t.PeoplePicker=void 0;var u=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n To add someone to this group, drag and drop their WebID URL onto the box.\n "],["\n To add someone to this group, drag and drop their WebID URL onto the box.\n "]),c=r(n(377)),d=r(n(376)),h=r(n(23)),f=n(136),p=n(66),m=n(16),v=r(n(6)),g=r(n(8)),b=(t.PeoplePicker=function(){function e(t,n,r,a){i(this,e),this.options=a||{},this.element=t,this.typeIndex=n,this.groupPickedCb=r,this.selectedgroup=this.options.selectedgroup,this.onSelectGroup=this.onSelectGroup.bind(this)}return u(e,[{key:"render",value:function(){var e=this,t=document.createElement("div");if(t.style.maxWidth="350px",t.style.minHeight="200px",t.style.outline="1px solid black",t.style.display="flex",this.selectedgroup){t.style.flexDirection="column";var n=document.createElement("div");new y(n,this.selectedgroup).render();var r=document.createElement("button");r.textContent=(0,c.default)("Change group"),r.addEventListener("click",function(t){e.selectedgroup=null,e.render()}),t.appendChild(n),t.appendChild(r)}else this.findAddressBook(this.typeIndex).then(function(n){var r=n.book,i=document.createElement("button");i.textContent=(0,c.default)("Pick an existing group"),i.style.margin="auto",i.addEventListener("click",function(n){new b(t,r,e.onSelectGroup).render()});var a=document.createElement("button");a.textContent=(0,c.default)("Create a new group"),a.style.margin="auto",a.addEventListener("click",function(t){e.createNewGroup(r).then(function(t){var n=t.group;new w(e.element,r,n,e.onSelectGroup).render()}).catch(function(t){e.element.appendChild((0,p.errorMessageBlock)(document,(0,c.default)("Error creating a new group. ("+t+")")))})}),t.appendChild(i),t.appendChild(a),e.element.innerHTML="",e.element.appendChild(t)}).catch(function(t){e.element.appendChild((0,p.errorMessageBlock)(document,(0,c.default)("Could find your groups. ("+t+")")))});return this.element.innerHTML="",this.element.appendChild(t),this}},{key:"findAddressBook",value:function(e){return new Promise(function(t,n){g.default.fetcher.nowOrWhenFetched(e,function(r,i){if(!r)return n(i);var a=g.default.any(null,v.default.solid("forClass"),v.default.vcard("AddressBook"));if(!a)return n(new Error("no address book registered in the solid type index "+e));var o=g.default.any(a,v.default.solid("instance"));return o?void g.default.fetcher.load(o).then(function(e){return t({book:o})}).catch(function(e){return n(new Error("Could not load address book "+e))}):n(new Error("incomplete address book registration"))})})}},{key:"createNewGroup",value:function(e){var t=s(e),n=t.groupIndex,r=t.groupContainer,i=h.default.sym(""+r.uri+d.default.v4().slice(0,8)+".ttl#this"),a=this.options.defaultNewGroupName||"Untitled Group",u=[i.doc(),n].map(function(t){var r=h.default.st(i,v.default.rdf("type"),v.default.vcard("Group"),t),s=h.default.st(i,v.default.vcard("fn"),a,i.doc(),t),u=h.default.st(e,v.default.vcard("includesGroup"),i,t),l=t.equals(n)?[r,s,u]:[r,s];return o(t.uri,{toIns:l}).then(function(){l.forEach(function(e){g.default.add(e)})})});return Promise.all(u).then(function(){return{group:i}}).catch(function(e){throw console.log("Could not create new group. PATCH failed "+e),new Error("Couldn't create new group. PATCH failed for ("+(e.xhr?e.xhr.responseURL:"")+" )")})}},{key:"onSelectGroup",value:function(e){this.selectedgroup=e,this.groupPickedCb(e),this.render()}}]),e}(),t.GroupPicker=function(){function e(t,n,r){i(this,e),this.element=t,this.book=n,this.onSelectGroup=r}return u(e,[{key:"render",value:function(){var e=this;return this.loadGroups().then(function(t){var n=document.createElement("div");n.style.display="flex",n.style.flexDirection="column",t.forEach(function(t){var r=document.createElement("button");r.addEventListener("click",e.handleClickGroup(t)),new y(r,t).render(),n.appendChild(r)}),e.element.innerHTML="",e.element.appendChild(n)}).catch(function(t){e.element.appendChild((0,p.errorMessageBlock)(document,(0,c.default)("There was an error loading your groups. ("+t+")")))}),this}},{key:"loadGroups",value:function(){var e=this;return new Promise(function(t,n){var r=s(e.book).groupIndex;g.default.fetcher.nowOrWhenFetched(r,function(r,i){if(!r)return n(i);var a=g.default.each(e.book,v.default.vcard("includesGroup"));return t(a)})})}},{key:"handleClickGroup",value:function(e){var t=this;return function(n){t.onSelectGroup(e)}}}]),e}()),y=t.Group=function(){function e(t,n){i(this,e),this.element=t,this.group=n}return u(e,[{key:"render",value:function(){var e=document.createElement("div");return e.textContent=(0,c.default)(a(this.group,v.default.vcard("fn"),"["+this.group.value+"]")),this.element.innerHTML="",this.element.appendChild(e),this}}]),e}(),w=t.GroupBuilder=function(){function e(t,n,r,a,o){i(this,e),this.element=t,this.book=n,this.group=r,this.onGroupChanged=function(e,t,n){o&&o(e,t,n)},this.groupChangedCb=o,this.doneBuildingCb=a}return u(e,[{key:"refresh",value:function(){}},{key:"render",value:function(){var e=this,t=document.createElement("div");t.style.maxWidth="350px",t.style.minHeight="200px",t.style.outline="1px solid black",t.style.display="flex",t.style.flexDirection="column",(0,f.makeDropTarget)(t,function(t){t.map(function(t){e.add(t).catch(function(t){e.element.appendChild((0,p.errorMessageBlock)(document,(0,c.default)("Could not add the given WebId. ("+t+")")))})})});var n=document.createElement("input");n.type="text",n.value=a(this.group,v.default.vcard("fn"),"Untitled Group"),n.addEventListener("change",function(t){e.setGroupName(t.target.value).catch(function(t){e.element.appendChild((0,p.errorMessageBlock)(document,"Error changing group name. ("+t+")"))})});var r=document.createElement("label");if(r.textContent=(0,c.default)("Group Name:"),r.appendChild(n),t.appendChild(r),g.default.any(this.group,v.default.vcard("hasMember")))g.default.match(this.group,v.default.vcard("hasMember")).forEach(function(n){var r=n.object,i=document.createElement("div");new _(i,r,e.handleRemove(r)).render(),t.appendChild(i)});else{var i=document.createElement("p");i.textContent=(0,c.default)(l),t.appendChild(i)}var o=document.createElement("button");return o.textContent=(0,c.default)("Done"),o.addEventListener("click",function(t){e.doneBuildingCb(e.group)}),t.appendChild(o),this.element.innerHTML="",this.element.appendChild(t),this}},{key:"add",value:function(e){var t=this;return new Promise(function(n,r){g.default.fetcher.nowOrWhenFetched(e,function(i,a){if(!i)return t.onGroupChanged(a),r(a);var o=h.default.namedNode(e),s=g.default.any(o,v.default.rdf("type"));return s&&s.equals(v.default.foaf("Person"))?n(o):r(new Error("Only people supported right now. (tried to add something of type "+s.value+")"))})}).then(function(e){var n=h.default.st(t.group,v.default.vcard("hasMember"),e);return g.default.holdsStatement(n)?e:o(t.group.doc().uri,{toIns:[n]}).then(function(){n.why=t.group.doc(),g.default.add(n),t.onGroupChanged(null,"added",e),t.render()})})}},{key:"handleRemove",value:function(e){var t=this;return function(n){var r=h.default.st(t.group,v.default.vcard("hasMember"),e);return o(t.group.doc().uri,{toDel:[r]}).then(function(){return g.default.remove(r),t.onGroupChanged(null,"removed",e),t.render(),!0}).catch(function(t){var n=g.default.any(e,v.default.foaf("name")),r=n&&n.value?"Could not remove "+n.value+". ("+t+")":"Could not remove "+e.value+". ("+t+")";throw new Error(r)})}}},{key:"setGroupName",value:function(e){var t=this,n=s(this.book).groupIndex,r=[this.group.doc(),n].map(function(n){var r=g.default.match(t.group,v.default.vcard("fn"),null,n),i=h.default.st(t.group,v.default.vcard("fn"),h.default.literal(e));return o(n.value,{toDel:r,toIns:[i]}).then(function(e){g.default.removeStatements(r),i.why=n,g.default.add(i)})});return Promise.all(r)}}]),e}(),_=function(){function e(t,n,r){i(this,e),this.webIdNode=n,this.element=t,this.handleRemove=r}return u(e,[{key:"render",value:function(){var e=this,t=document.createElement("div");t.style.display="flex";var n=a(this.webIdNode,v.default.foaf("img"),m.iconBase+"noun_15059.svg"),r=document.createElement("img");r.src=(0,c.default)(n),r.width="50",r.height="50",r.style.margin="5px";var i=a(this.webIdNode,v.default.foaf("name"),"["+this.webIdNode+"]"),o=document.createElement("span");o.innerHTML=(0,c.default)(i),o.style.flexGrow="1",o.style.margin="auto 0";var s=document.createElement("button");return s.textContent="Remove",s.addEventListener("click",function(t){return e.handleRemove().catch(function(t){e.element.appendChild((0,p.errorMessageBlock)(document,(0,c.default)(""+t)))})}),s.style.margin="5px",t.appendChild(r),t.appendChild(o),t.appendChild(s),this.element.innerHTML="",this.element.appendChild(t),this}}]),e}()},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){return e&&e.__esModule?e:{default:e}}(n(89)),o=n(20).docpart,s=n(123),u=n(83).namedNode,l=n(62),c=n(124),d=n(20).join,h=n(27),f=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store=t,t.updater)throw new Error("You can't have two UpdateManagers for the same store");t.fetcher||(t.fetcher=new s(t)),t.updater=this,this.ifps={},this.fps={},this.ns={},this.ns.link=l("http://www.w3.org/2007/ont/link#"),this.ns.http=l("http://www.w3.org/2007/ont/http#"),this.ns.httph=l("http://www.w3.org/2007/ont/httph#"),this.ns.ldp=l("http://www.w3.org/ns/ldp#"),this.ns.rdf=l("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.rdfs=l("http://www.w3.org/2000/01/rdf-schema#"),this.ns.rdf=l("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.owl=l("http://www.w3.org/2002/07/owl#"),this.patchControl=[]}return i(e,[{key:"patchControlFor",value:function(e){return this.patchControl[e.uri]||(this.patchControl[e.uri]=[]),this.patchControl[e.uri]}},{key:"editable",value:function(e,t){if(!e)return!1;if(t||(t=this.store),"file:///"===e.slice(0,8)){if(t.holds(t.sym(e),u("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),u("http://www.w3.org/2007/ont/link#MachineEditableDocument")))return"LOCALFILE";var n=t.statementsMatching(t.sym(e));return console.log("sparql.editable: Not MachineEditableDocument file "+e+"\n"),console.log(n.map(function(e){return e.toNT()}).join("\n")),!1}var r,i=!1,a=t.each(void 0,this.ns.link("requestedURI"),o(e));if(t.holds(u(e),this.ns.rdf("type"),this.ns.ldp("Resource")))return"SPARQL";for(var s,l,c=0;c<a.length;c++)if(void 0!==(r=a[c])){var d=t.any(r,this.ns.link("response"));if(void 0!==r){var h=t.each(d,this.ns.httph("accept-patch"));if(h.length)for(s=0;s<h.length;s++)if(0<=(l=h[s].value.trim()).indexOf("application/sparql-update"))return"SPARQL";var f=t.each(d,this.ns.httph("ms-author-via"));if(f.length)for(s=0;s<f.length;s++){if(0<=(l=f[s].value.trim()).indexOf("SPARQL"))return"SPARQL";if(0<=l.indexOf("DAV"))return"DAV"}var p=t.each(d,this.ns.http("status"));if(p.length)for(s=0;s<p.length;s++)(200===p[s]||404===p[s])&&(i=!0)}else console.log("sparql.editable: No response for "+e+"\n")}if(0===a.length)console.log("sparql.editable: No request for "+e+"\n");else if(i)return!1;console.log("sparql.editable: inconclusive for "+e+"\n")}},{key:"anonymize",value:function(e){return"_:"===e.toNT().substr(0,2)&&this.mentioned(e)?"?"+e.toNT().substr(2):e.toNT()}},{key:"anonymizeNT",value:function(e){return this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" ."}},{key:"statementBnodes",value:function(e){return[e.subject,e.predicate,e.object].filter(function(e){return e.isBlank})}},{key:"statementArrayBnodes",value:function(e){for(var t=[],n=0;n<e.length;n++)t=t.concat(this.statementBnodes(e[n]));t.sort();for(var r=[],i=0;i<t.length;i++)0!==i&&t[i].sameTerm(t[i-1])||r.push(t[i]);return r}},{key:"cacheIfps",value:function(){this.ifps={};for(var e=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("InverseFunctionalProperty")),t=0;t<e.length;t++)this.ifps[e[t].uri]=!0;for(this.fps={},e=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("FunctionalProperty")),t=0;t<e.length;t++)this.fps[e[t].uri]=!0}},{key:"bnodeContext2",value:function(e,t,n){for(var r,i,a=this.store.statementsMatching(void 0,void 0,e,t),o=0;o<a.length;o++)if(this.fps[a[o].predicate.uri]){if(!(r=a[o].subject).isBlank)return[a[o]];if(n&&(i=this.bnodeContext2(r,t,n-1)))return i.concat([a[o]])}for(a=this.store.statementsMatching(e,void 0,void 0,t),o=0;o<a.length;o++)if(this.ifps[a[o].predicate.uri]){if(!(r=a[o].object).isBlank)return[a[o]];if(n&&(i=this.bnodeContext2(r,t,n-1)))return i.concat([a[o]])}return null}},{key:"bnodeContext1",value:function(e,t){for(var n,r=0;3>r;r++)if(null!==(n=this.bnodeContext2(e,t,r)))return n;return this.store.connectedStatements(e,t)}},{key:"mentioned",value:function(e){return 0!==this.store.statementsMatching(e).length||0!==this.store.statementsMatching(void 0,e).length||0!==this.store.statementsMatching(void 0,void 0,e).length}},{key:"bnodeContext",value:function(e,t){var n=[];if(e.length){this.cacheIfps();for(var r,i=0;i<e.length;i++)r=e[i],this.mentioned(r)&&(n=n.concat(this.bnodeContext1(r,t)))}return n}},{key:"statementContext",value:function(e){var t=this.statementBnodes(e);return this.bnodeContext(t,e.why)}},{key:"contextWhere",value:function(e){var t=this;return e&&0!==e.length?"WHERE { "+e.map(function(e){return t.anonymizeNT(e)}).join("\n")+" }\n":""}},{key:"fire",value:function(e,t,n){var r=this;return Promise.resolve().then(function(){if(!e)throw new Error("No URI given for remote editing operation: "+t);console.log("sparql: sending update to <"+e+">");var n={noMeta:!0,contentType:"application/sparql-update",body:t};return r.store.fetcher.webOperation("PATCH",e,n)}).then(function(r){if(!r.ok){var i="sparql: update failed for <"+e+"> status="+r.status+", "+r.statusText+"\n for query: "+t;throw console.log(i),new Error(i)}console.log("sparql: update Ok for <"+e+">"),n(e,r.ok,r.responseText,r)}).catch(function(t){n(e,!1,t.message,t)})}},{key:"update_statement",value:function(e){if(!e||e.why){var t=this,n=this.statementContext(e);return{statement:e?[e.subject,e.predicate,e.object,e.why]:void 0,statementNT:e?this.anonymizeNT(e):void 0,where:t.contextWhere(n),set_object:function(e,n){var r=this.where;r+="DELETE DATA { "+this.statementNT+" } ;\n",r+="INSERT DATA { "+this.anonymize(this.statement[0])+" "+this.anonymize(this.statement[1])+" "+this.anonymize(e)+" . }\n",t.fire(this.statement[3].uri,r,n)}}}}},{key:"insert_statement",value:function(e,t){var n=e instanceof Array?e[0]:e,r=this.contextWhere(this.statementContext(n));if(e instanceof Array){for(var i="",a=0;a<e.length;a++)i+=e[a]+"\n";r+="INSERT DATA { "+i+" }\n"}else r+="INSERT DATA { "+this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" . }\n";this.fire(n.why.uri,r,t)}},{key:"delete_statement",value:function(e,t){var n=e instanceof Array?e[0]:e,r=this.contextWhere(this.statementContext(n));if(e instanceof Array){for(var i="",a=0;a<e.length;a++)i+=e[a]+"\n";r+="DELETE DATA { "+i+" }\n"}else r+="DELETE DATA { "+this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" . }\n";this.fire(n.why.uri,r,t)}},{key:"requestDownstreamAction",value:function(e,t){var n=this.patchControlFor(e);if(n.pendingUpstream)if(n.downstreamAction){if(""+n.downstreamAction!=""+t)throw new Error("Can't wait for > 1 different downstream actions")}else n.downstreamAction=t;else t(e)}},{key:"clearUpstreamCount",value:function(e){this.patchControlFor(e).upstreamCount=0}},{key:"getUpdatesVia",value:function(e){var t=this.store.fetcher.getHeader(e,"updates-via");return t&&t.length?t[0].trim():null}},{key:"addDownstreamChangeListener",value:function(e,t){var n=this,r=this.patchControlFor(e);r.downstreamChangeListeners||(r.downstreamChangeListeners=[]),r.downstreamChangeListeners.push(t),this.setRefreshHandler(e,function(e){n.reloadAndSync(e)})}},{key:"reloadAndSync",value:function(e){var t=this.patchControlFor(e),n=this;if(t.reloading)console.log(" Already reloading - stop");else{t.reloading=!0;var r=1e3;!function i(){console.log("try reload - timeout = "+r),n.reload(n.store,e,function(n,a,o){if(t.reloading=!1,n){if(t.downstreamChangeListeners)for(var s=0;s<t.downstreamChangeListeners.length;s++)console.log(" Calling downstream listener "+s),t.downstreamChangeListeners[s]()}else 0===o.status?(console.log("Network error refreshing the data. Retrying in "+r/1e3),t.reloading=!0,r*=2,setTimeout(i,r)):console.log("Error "+o.status+"refreshing the data:"+a+". Stopped"+e)})}()}}},{key:"setRefreshHandler",value:function(e,t){var n=this.getUpdatesVia(e),r=t,i=this,a=this,o=1500,s=0;if(!n)return console.log("Server doies not support live updates thoughUpdates-Via :-("),!1;n=(n=d(n,e.uri)).replace(/^http:/,"ws:").replace(/^https:/,"wss:"),console.log("Web socket URI "+n);return function t(){var u;if("undefined"!=typeof WebSocket)u=new WebSocket(n);else if("undefined"!=typeof Services)u=Services.wm.getMostRecentWindow("navigator:browser").WebSocket(n);else{if("undefined"==typeof window||!window.WebSocket)return void console.log("Live update disabled, as WebSocket not supported by platform :-(");u=window.WebSocket(n)}u.onopen=function(){console.log(" websocket open"),o=1500,this.send("sub "+e.uri),s&&(console.log("Web socket has been down, better check for any news."),a.requestDownstreamAction(e,r))};var l=i.patchControlFor(e);l.upstreamCount=0,u.onerror=function(e){console.log("Error on Websocket:",e)},u.onclose=function(e){console.log("*** Websocket closed with code "+e.code+", reason '"+e.reason+"' clean = "+e.clean),o*=2,s+=1,console.log("Retrying in "+o+"ms"),setTimeout(function(){console.log("Trying websocket again"),t()},o)},u.onmessage=function(t){if(t.data&&"pub"===t.data.slice(0,3)){if("upstreamCount"in l&&(l.upstreamCount-=1,0<=l.upstreamCount))return void console.log("just an echo: "+l.upstreamCount);console.log("Assume a real downstream change: "+l.upstreamCount+" -> 0"),l.upstreamCount=0,i.requestDownstreamAction(e,r)}}}(),!0}},{key:"update",value:function(e,t,n){try{var i=this.store,o=e?e instanceof a.default?e.statements:e instanceof Array?e:[e]:[],s=t?t instanceof a.default?t.statements:t instanceof Array?t:[t]:[];if(!(o instanceof Array))throw new Error("Type Error "+(void 0===o?"undefined":r(o))+": "+o);if(!(s instanceof Array))throw new Error("Type Error "+(void 0===s?"undefined":r(s))+": "+s);if(0===o.length&&0===s.length)return n(null,!0);var u=o.length?o[0].why:s[0].why;if(!u){var l="Error patching: statement does not specify which document to patch:"+o[0]+", "+s[0];throw console.log(l),new Error(l)}var c=this.patchControlFor(u),d=Date.now(),h=["subject","predicate","object","why"],f={delete:o,insert:s};["insert","delete"].map(function(e){f[e].map(function(e){if(!u.sameTerm(e.why))throw new Error("update: destination "+u+" inconsistent with delete quad "+e.why);h.map(function(t){if(void 0===e[t])throw new Error("update: undefined "+t+" of statement.")})})});var p,m=this.editable(u.uri,i);if(!m)throw new Error("Can't make changes in uneditable "+u);if(0<=m.indexOf("SPARQL")){var v=[];o.length&&(v=this.statementArrayBnodes(o)),s.length&&(v=v.concat(this.statementArrayBnodes(s)));var g=this.bnodeContext(v,u),b=this.contextWhere(g),y="";if(b.length){if(o.length){for(y+="DELETE { ",p=0;p<o.length;p++)y+=this.anonymizeNT(o[p])+"\n";y+=" }\n"}if(s.length){for(y+="INSERT { ",p=0;p<s.length;p++)y+=this.anonymizeNT(s[p])+"\n";y+=" }\n"}y+=b}else{if(o.length){for(y+="DELETE DATA { ",p=0;p<o.length;p++)y+=this.anonymizeNT(o[p])+"\n";y+=" } \n"}if(s.length){for(o.length&&(y+=" ; "),y+="INSERT DATA { ",p=0;p<s.length;p++)y+=this.anonymizeNT(s[p])+"\n";y+=" }\n"}}c.pendingUpstream=c.pendingUpstream?c.pendingUpstream+1:1,"upstreamCount"in c&&(c.upstreamCount+=1,console.log("upstream count up to : "+c.upstreamCount)),this.fire(u.uri,y,function(e,t,r,a){if(a.elapsedTimeMs=Date.now()-d,console.log(" sparql: Return "+(t?"success ":"FAILURE ")+a.status+" elapsed "+a.elapsedTimeMs+"ms"),t){try{i.remove(o)}catch(e){t=!1,r="Remote Ok BUT error deleting "+o.length+" from store!!! "+e}for(var l=0;l<s.length;l++)i.add(s[l].subject,s[l].predicate,s[l].object,u)}if(n(e,t,r,a),c.pendingUpstream-=1,0===c.pendingUpstream&&c.downstreamAction){var h=c.downstreamAction;delete c.downstreamAction,console.log("delayed downstream action:"),h(u)}})}else if(0<=m.indexOf("DAV"))this.updateDav(u,o,s,n);else{if(!(0<=m.indexOf("LOCALFILE")))throw new Error("Unhandled edit method: '"+m+"' for "+u);try{this.updateLocalFile(u,o,s,n)}catch(e){n(u.uri,!1,"Exception trying to write back file <"+u.uri+">\n")}}}catch(e){n(void 0,!1,"Exception in update: "+e+"\n"+$rdf.Util.stackString(e))}}},{key:"updateDav",value:function(e,t,n,r){var i=this.store,a=i.any(e,this.ns.link("request"));if(!a)throw new Error("No record of our HTTP GET request for document: "+e);var o=i.any(a,this.ns.link("response"));if(!o)return null;var s,u=i.the(o,this.ns.httph("content-type")).value,l=i.statementsMatching(void 0,void 0,void 0,e).slice();for(s=0;s<t.length;s++)h.RDFArrayRemove(l,t[s]);for(s=0;s<n.length;s++)l.push(n[s]);var c,f=this.serialize(e.uri,l,u),p=i.the(o,this.ns.httph("content-location"));p&&(c=d(p.value,c));var m={contentType:u,noMeta:!0,body:f};return i.fetcher.webOperation("PUT",c,m).then(function(a){if(!a.ok)throw new Error(a.error);for(var o=0;o<t.length;o++)i.remove(t[o]);for(o=0;o<n.length;o++)i.add(n[o].subject,n[o].predicate,n[o].object,e);r(e.uri,a.ok,a.responseText,a)}).catch(function(t){r(e.uri,!1,t.message,t)})}},{key:"updateLocalFile",value:function(e,t,n,r){var i=this.store;console.log("Writing back to local file\n");var a,o=i.statementsMatching(void 0,void 0,void 0,e).slice();for(a=0;a<t.length;a++)h.RDFArrayRemove(o,t[a]);for(a=0;a<n.length;a++)o.push(n[a]);var u=e.uri.lastIndexOf(".");if(1>u)throw new Error("Rewriting file: No filename extension: "+e.uri);var l=e.uri.slice(u+1),c=s.CONTENT_TYPE_BY_EXT[l];if(!c)throw new Error("File extension ."+l+" not supported for data write");var d=this.serialize(e.uri,o,c);console.log("Writing back: <<<"+d+">>>");var f=e.uri.slice(7),p=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);if(p.initWithPath(f),!p.exists())throw new Error("Rewriting file <"+e.uri+"> but it does not exist!");var m=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);for(m.init(p,42,parseInt("0666",8),0),m.write(d,d.length),m.close(),a=0;a<t.length;a++)i.remove(t[a]);for(a=0;a<n.length;a++)i.add(n[a].subject,n[a].predicate,n[a].object,e);r(e.uri,!0,"")}},{key:"serialize",value:function(e,t,n){var r,i=this.store;if("string"==typeof t)return t;var a=c(i);switch(a.suggestNamespaces(i.namespaces),a.setBase(e),n){case"text/xml":case"application/rdf+xml":r=a.statementsToXML(t);break;case"text/n3":case"text/turtle":case"application/x-turtle":case"application/n3":r=a.statementsToN3(t);break;default:throw new Error("Content-type "+n+" not supported for data serialization")}return r}},{key:"put",value:function(e,t,n,r){var i,a=this,o=this.store;return Promise.resolve().then(function(){return i=a.serialize(e.uri,t,n),o.fetcher.webOperation("PUT",e.uri,{contentType:n,body:i})}).then(function(n){return n.ok?(delete o.fetcher.nonexistent[e.uri],delete o.fetcher.requested[e.uri],"string"!=typeof t&&t.map(function(e){o.addStatement(e)}),void r(e.uri,n.ok,"",n)):r(e.uri,n.ok,n.error,n)}).catch(function(t){r(e.uri,!1,t.message)})}},{key:"reload",value:function(e,t,n){var r=Date.now();e.fetcher.nowOrWhenFetched(t.uri,{force:!0,noMeta:!0,clearPreviousData:!0},function(e,i,a){if(e)if(a.onErrorWasCalled||200!==a.status)console.log(" Non-HTTP error reloading data! onErrorWasCalled="+a.onErrorWasCalled+" status: "+a.status),n(!1,"Non-HTTP error reloading data: "+i,a);else{var o=Date.now()-r;t.reloadTimeTotal||(t.reloadTimeTotal=0),t.reloadTimeCount||(t.reloadTimeCount=0),t.reloadTimeTotal+=o,t.reloadTimeCount+=1,console.log(" Fetch took "+o+"ms, av. of "+t.reloadTimeCount+" = "+t.reloadTimeTotal/t.reloadTimeCount+"ms."),n(!0)}else console.log(" ERROR reloading data: "+i),n(!1,"Error reloading data: "+i,a)})}}]),e}();e.exports=f},function(e,t,n){"use strict";var r=n(39),i=n(84).Query;e.exports=function(e,t,n){function a(e){if(E[e])return E[e];var t=n.variable(e);return E[e]=t,t}function o(e){return"string"==typeof e&&e.match(/[^ \n\t]/)}function s(e){return"string"==typeof e&&e.match(/^[\?\$]/)}function u(e){return"string"==typeof e?e.replace(/^&lt;/,"<").replace(/&gt;$/,">"):e}function l(e){return"string"==typeof e&&e.match(/^<[^>]*>$/)}function c(e){return"string"==typeof e&&(e.match(/^_:/)||e.match(/^$/))}function d(e){return"string"==typeof e&&e.match(/:$/)}function h(e){return"string"==typeof e&&e.match(/^:|^[^_][^:]*:/)}function f(e){return e.split(":")[0]}function p(e){return e.split(":")[1]}function m(e){return l(e)?e.slice(1,e.length-1):e}function v(e){var t=-1===e.indexOf("'")?null:e.indexOf("'"),i=-1===e.indexOf('"')?null:e.indexOf('"');if(!t&&!i){var a=[,];return a[0]=e,a}var o,s,u=[,,];if(!t||i&&i<t)o='"',s=i;else{if(i&&!(t&&t<i))return r.error("SQARQL QUERY OOPS!"),u;o="'",s=t}u[0]=e.slice(0,s);var l,c=e.slice(s+1).indexOf(o);return-1===c?(r.error("SPARQL parsing error: no matching parentheses in literal "+e),e):(e.slice(c+s+2).match(/^\^\^/)?(l=e.slice(c+s+2).indexOf(" "),u[1]=n.literal(e.slice(s+1,s+1+c),"",n.sym(m(e.slice(s+4+c,s+2+c+l)))),u=u.concat(v(e.slice(c+s+3+l)))):e.slice(c+s+2).match(/^@/)?(l=e.slice(c+s+2).indexOf(" "),u[1]=n.literal(e.slice(s+1,s+1+c),e.slice(s+3+c,s+2+c+l),null),u=u.concat(v(e.slice(c+s+2+l)))):(u[1]=n.literal(e.slice(s+1,s+1+c),"",null),r.info("Literal found: "+u[1]),u=u.concat(v(e.slice(c+s+2)))),u)}function g(e){e=e.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/</g," <").replace(/>/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),r.info("New str into spaceDelimit: \n"+e);var t=[],n=e.split(" ");for(var i in n)o(n[i])&&(t=t.concat(n[i]));return t}function b(e){for(var t=[],i=0;i<e.length;i++)"string"==typeof e[i]?(e[i]=u(e[i]),s(e[i])?t[i]=a(e[i].slice(1)):c(e[i])?(r.info(e[i]+" was identified as a bnode."),t[i]=n.bnode()):l(e[i])?(r.info(e[i]+" was identified as a symbol."),t[i]=n.sym(m(e[i]))):h(e[i])?(r.info(e[i]+" was identified as a prefixed symbol"),S[f(e[i])]?t[i]=n.sym(e[i]=S[f(e[i])]+p(e[i])):(r.error("SPARQL error: "+e[i]+" with prefix "+f(e[i])+" does not have a correct prefix entry."),t[i]=e[i])):t[i]=e[i]):t[i]=e[i];return t}function y(e,t){for(var n=0;n<t.length;n++)if("string"==typeof t[n]&&t[n].toLowerCase()===e.toLowerCase())return n;return null}function w(e,t){for(var n=[],r=0;r<t.length;r++)"string"==typeof t[r]&&t[r].toLowerCase()===e.toLowerCase()&&n.push(r);return n}function _(e,t,n){r.info("Looking for a close bracket of type "+n+" in "+e);for(var i=0,a=0;a<e.length;a++)if(e[a]===t&&i++,e[a]===n&&i--,0>i)return a;return r.error("Statement had no close parenthesis in SPARQL query"),0}function x(e){return this.describe=function(t){return t+" = "+e.toNT()},this.test=function(t){return e.sameTerm(t)},this}function M(e,t){3!==e.length||"Variable"!==e[0].termType||"NamedNode"!==e[2].termType&&"Literal"!==e[2].termType?6===e.length&&"string"==typeof e[0]&&"regexp"===e[0].toLowerCase()&&"("===e[1]&&")"===e[5]&&","===e[3]&&"Variable"===e[4].termType&&"Literal"===e[2].termType&&(r.debug("Constraint added: "+e),t.constraints[e[4]]=new function(e){this.describe=function(t){return"REGEXP( '"+e+"' , "+t+" )"},this.test=function(t){var n=new RegExp(e);return!!t.value&&n.test(t.value)}}(e[2].value)):"="===e[1]?(r.debug("Constraint added: "+e),t.constraints[e[0]]=new x(e[2])):">"===e[1]?(r.debug("Constraint added: "+e),t.constraints[e[0]]=new x(e[2])):"<"===e[1]?(r.debug("Constraint added: "+e),t.constraints[e[0]]=new x(e[2])):r.warn("I don't know how to handle the constraint: "+e)}function k(e,t){r.debug("Optional query: "+e+" not yet implemented.");var i=n.formula();C(e,i),t.optional.push(i)}function C(e,t){var n,i,a=b(e);for(r.debug("WHERE: "+a);y("OPTIONAL",a);)i=y("OPTIONAL",a),r.debug("OPT: "+i+" "+a[i]+" in "+a),"{"!==a[i+1]&&r.warn("Bad optional opening bracket in word "+i),-1===(n=_(a.slice(i+2),"{","}"))?r.error("No matching bracket in word "+i):(k(a.slice(i+2,i+2+n),t),i=y("OPTIONAL",a),n=_(a.slice(i+2),"{","}"),a.splice(i,n+3));for(r.debug("WHERE after optionals: "+a);y("FILTER",a);){var o=y("FILTER",a);"("!==a[o+1]&&r.warn("Bad filter opening bracket in word "+o),-1===(n=_(a.slice(o+2),"(",")"))?r.error("No matching bracket in word "+o):(M(a.slice(o+2,o+2+n),t),o=y("FILTER",a),n=_(a.slice(o+2),"(",")"),a.splice(o,n+3))}r.debug("WHERE after filters and optionals: "+a),function(e,t){var n=[,];n[0]=-1;for(var i=n.concat(w(".",e)),a=[],o=0;o<i.length-1;o++)a[o]=e.slice(i[o]+1,i[o+1]);for(o in a){r.info("s+p+o "+o+" = "+a[o]);var s=a[o][0];a[o].splice(0,1);var u=n.concat(w(";",a[o]));u.push(a[o].length);for(var l=[],c=0;c<u.length-1;c++)l[c]=a[o].slice(u[c]+1,u[c+1]);for(o in l){r.info("p+o "+o+" = "+a[o]);var d=l[o][0];l[o].splice(0,1);var h=n.concat(w(",",l[o]));h.push(l[o].length);var f=[];for(c=0;c<h.length-1;c++)f[c]=l[o].slice(h[c]+1,h[c+1]);for(o in f){var p=f[o][0];r.info("Subj="+s+" Pred="+d+" Obj="+p),t.add(s,d,p)}}}}(a,t)}var E=[];r.info("SPARQL input: \n"+e);var A=new i,T=function(e){var t=v(e),n=[];for(var i in t)n="string"==typeof t[i]?n.concat(g(t[i])):n.concat(t[i]);return n=function(e){for(var t=e,n=0;n<t.length;n++)if("a"===t[n]&&(t[n]="<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"),"is"===t[n]&&"of"===t[n+2]){t.splice(n,1),t.splice(n+1,1);var r=t[n-1];t[n-1]=t[n+1],t[n+1]=r}return t}(n),r.info("SPARQL Tokens: "+n),n}(e),S=function(e){var t=w("PREFIX",e),n=[];for(var i in t){var a=e[t[i]+1],o=e[t[i]+2];if(d(a))if(l(o)){r.info("Prefix found: "+a+" -> "+o);var s=f(a),u=m(o);n[s]=u}else r.error("Invalid SPARQL symbol: "+o);else r.error("Invalid SPARQL prefix: "+a)}return n}(T);S.rdf||(S.rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"),S.rdfs||(S.rdfs="http://www.w3.org/2000/01/rdf-schema#");var I=y("SELECT",T),N=y("WHERE",T);if(0>I||0>N||I>N)return r.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(function(e,t){for(var n in r.info("SPARQL vars: "+e),e)if(s(e[n])){r.info("Added "+e[n]+" to query variables from SPARQL");var i=a(e[n].slice(1));t.vars.push(i),i.label=e[n].slice(1)}else r.warn("Incorrect SPARQL variable in SELECT: "+e[n])}(T.slice(I+1,N),A),C(T.slice(N+2,T.length-1),A.pat),t)return A;for(var j in A.pat.statements){var O=A.pat.statements[j];"NamedNode"===O.subject.termType&&n.fetcher&&n.fetcher.lookUpThing(O.subject,"sparql:"+O.subject),"NamedNode"===O.object.termType&&n.fetcher&&n.fetcher.lookUpThing(O.object,"sparql:"+O.object)}return A}},function(e,t,n){"use strict";var r=n(39);e.exports=function(e){function t(e){var t="",n=e.statements;for(var i in n)r.debug("Found statement: "+n),t+=a()+n[i]+"\n";return t}function n(e){var t="";for(var n in e.constraints){var r=e.constraints[n];t+=a()+"FILTER ( "+r.describe(n)+" ) \n"}return t}function i(e){var i=a()+"WHERE \n{ \n";return o++,i+=t(e),i+=n(e),i+=function e(i){for(var s="",u=0;u<i.optional.length;u++)r.debug("Found optional query"),s+=a()+"OPTIONAL { \n",o++,s+=t(i.optional[u]),s+=n(i.optional[u]),s+=e(i.optional[u]),o--,s+=a()+"}\n";return s}(e),o--,i+="}"}function a(){for(var e="",t=0;t<o;t++)e+=" ";return e}var o=0;return function(e){return function(e){for(var t=a()+"SELECT ",n=0;n<e.vars.length;n++)t+=e.vars[n]+" ";return t+="\n"}(e)+i(e.pat)}(e)}},function(e,t,n){"use strict";var r={parseJSON:function(e,t,n){var r,i,a,o={},s=n.sym(t);for(var u in e){0===u.indexOf("_:")?o[u]?r=o[u]:(r=n.bnode(u),o[u]=r):r=n.sym(u);var l=e[u];for(var c in l){var d=l[c];for(var h in i=n.sym(c),d){var f=d[h];if("uri"===f.type)a=n.sym(f.value),n.add(r,i,a,s);else if("BlankNode"===f.type)o[f.value]?a=o[f.value]:(a=n.bnode(f.value),o[f.value]=a),n.add(r,i,a,s);else{if("Literal"!==f.type)throw new Error("error: unexpected termtype: "+h.type);a=f.datatype?n.literal(f.value,void 0,n.sym(f.datatype)):f.lang?n.literal(f.value,f.lang):n.literal(f.value),n.add(r,i,a,s)}}}}}};e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(19),a=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.termType=t.termType,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i),r(t,[{key:"toString",value:function(){return"()"}}]),t}();a.termType="empty",e.exports=a},function(e,t,n){"use strict";var r=n(26),i=n(59);e.exports=function(e,t,n){t in e?r.f(e,t,i(0,n)):e[t]=n}},function(e,t,n){"use strict";var r=n(61),i=n(31),a=n(111),o=n(202),s=n(201),u=n(117),l=n(384),c=n(200);i(i.S+i.F*!n(195)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,i,d,h=a(e),f="function"==typeof this?this:Array,p=arguments.length,m=1<p?arguments[1]:void 0,v=void 0!==m,g=0,b=c(h);if(v&&(m=r(m,2<p?arguments[2]:void 0,2)),void 0==b||f==Array&&s(b))for(n=new f(t=u(h.length));t>g;g++)l(n,g,v?m(h[g],g):h[g]);else for(d=b.call(h),n=new f;!(i=d.next()).done;g++)l(n,g,v?o(d,m,[i.value,g],!0):i.value);return n.length=g,n}})},function(e,t,n){n(110),n(385),e.exports=n(18).Array.from},function(e,t,n){e.exports={default:n(386),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(387));t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return(0,r.default)(e)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.openIdpSelector=t.startPopupServer=t.appOriginHandler=t.loginHandler=t.storageHandler=void 0;var i=r(n(76)),a=r(n(388)),o=n(193),s=n(101),u=t.storageHandler=function(e){return function(t){var n=t.id,r=t.method,i=t.args;return"storage/getItem"===r?e.getItem.apply(e,(0,a.default)(i)).then(function(e){return{id:n,ret:e}}):"storage/setItem"===r?e.setItem.apply(e,(0,a.default)(i)).then(function(){return{id:n,ret:null}}):"storage/removeItem"===r?e.removeItem.apply(e,(0,a.default)(i)).then(function(){return{id:n,ret:null}}):null}},l=t.loginHandler=function(e,t){return function(n){var r=n.id,a=n.method,o=n.args;return"getLoginOptions"===a?i.default.resolve({id:r,ret:{popupUri:e.popupUri,callbackUri:e.callbackUri}}):"foundSession"===a?(t(o[0]),i.default.resolve({id:r,ret:null})):null}},c=t.appOriginHandler=function(e){var t=e.id;return"getAppOrigin"===e.method?i.default.resolve({id:t,ret:window.location.origin}):null};t.startPopupServer=function(e,t,n){return new i.default(function(r,i){if(!n.popupUri||!n.callbackUri)return i(new Error('Cannot serve a popup without both "options.popupUri" and "options.callbackUri"'));var a=(0,o.server)(t,(0,s.originOf)(n.popupUri))(function(e,t,n){return(0,o.combineHandlers)(u(e),l(t,n),c)}(e,n,function(e){a.stop(),r(e)}));a.start()})},t.openIdpSelector=function(e){if(!e.popupUri||!e.callbackUri)throw new Error('Cannot open IDP select UI. Must provide both "options.popupUri" and "options.callbackUri".');return window.open(e.popupUri,"_blank","width=650,height=400,left="+(window.innerWidth-650)/2+",top="+(window.innerHeight-400)/2)}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(47).URL,a=n(55),o=a.JWT,s=a.JWK,u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o),r(t,null,[{key:"issueFor",value:function(e,n){if(!e)throw new Error("Cannot issue PoPToken - missing resource server URI");if(!n.sessionKey)throw new Error("Cannot issue PoPToken - missing session key");if(!n.idToken)throw new Error("Cannot issue PoPToken - missing id token");var r=JSON.parse(n.sessionKey);return s.importKey(r).then(function(r){var a={aud:new i(e).origin,key:r,iss:n.clientId,id_token:n.idToken};return t.issue(a)}).then(function(e){return e.encode()})}},{key:"issue",value:function(e){var n=e.aud,r=e.iss,i=e.key,a=i.alg,o=e.iat||_Mathfloor(Date.now()/1e3);return new t({header:{alg:a},payload:{iss:r,aud:n,exp:o+(e.max||3600),iat:o,id_token:e.id_token,token_type:"pop"},key:i.cryptoKey},{filter:!1})}}]),t}();e.exports=u},function(e,t,n){const{JSONSchema:r}=n(17),i=new r({type:"object",properties:{provider:{type:"object",properties:{name:{type:"string"},url:{type:"string",format:"uri"},configuration:{},jwks:{}},required:["url"]},defaults:{type:"object",properties:{authenticate:{type:"object",properties:{redirect_uri:{type:"string",format:"uri"},response_type:{type:"string",default:"id_token token",enum:["code","token","id_token token","id_token token code"]},display:{type:"string",default:"page",enum:["page","popup"]},scope:{type:["string","array"],default:["openid"]}}},register:{}}},registration:{},store:{type:"object",default:{}}}});e.exports=i},function(e,t,n){"use strict";class r{constructor(e){this.idp=e.idp,this.clientId=e.clientId,this.sessionKey=e.sessionKey,this.decoded=e.decoded,this.accessToken=e.accessToken,this.idToken=e.idToken}static fromAuthResponse(e){const t=n(189),i=e.decoded.payload,a=e.rp.registration;let o={sessionKey:e.session[t.SESSION_PRIVATE_KEY],idp:i.iss,clientId:a.client_id,decoded:e.decoded,accessToken:e.params.access_token,idToken:e.params.id_token};return new r(o)}}e.exports=r},function(e,t,n){const{JWTSchema:r}=n(55),i=r.extend({properties:{header:{},payload:{properties:{iss:{type:"string",format:"url"},sub:{type:"string",maxLength:255},auth_time:{type:"integer",format:"NumericDate"},nonce:{type:"string"},acr:{type:"string"},amr:{type:"array",items:{type:"string"}},azp:{type:"string",format:"StringOrURI"}},required:["iss","sub","aud","exp","iat"]}}});e.exports=i},function(e,t,n){const{JWT:r}=n(55),i=n(393);e.exports=class extends r{static get schema(){return i}}},function(e,t,n){(function(t,r){const{URL:i}=n(47),a=n(104),o=n(72),s=n(32),u=n(56),l=u.Headers?u.Headers:t.Headers,c=n(173),d=n(394),h=n(392),f=n(172);class p{static validateResponse(e){return Promise.resolve(e).then(this.parseResponse).then(this.matchRequest).then(this.validateStateParam).then(this.errorResponse).then(this.validateResponseMode).then(this.validateResponseParams).then(this.exchangeAuthorizationCode).then(this.validateIDToken).then(h.fromAuthResponse)}static parseResponse(e){let{redirect:t,body:n}=e;if(t&&n||!t&&!n)throw new Error("Invalid response mode");if(t){let n=new i(t),{search:r,hash:a}=n;if(r&&a||!r&&!a)throw new Error("Invalid response mode");r&&(e.params=c.decode(r.substring(1)),e.mode="query"),a&&(e.params=c.decode(a.substring(1)),e.mode="fragment")}return n&&(e.params=c.decode(n),e.mode="form_post"),e}static matchRequest(e){let{rp:t,params:n,session:r}=e,i=n.state,a=t.provider.configuration.issuer;if(!i)throw new Error("Missing state parameter in authentication response");let o=r[`${a}/requestHistory/${i}`];if(!o)throw new Error("Mismatching state parameter in authentication response");return e.request=JSON.parse(o),e}static validateStateParam(e){let t=new Uint8Array(e.request.state),n=e.params.state;return o.subtle.digest({name:"SHA-256"},t).then(t=>{if(n!==s(r.from(t)))throw new Error("Mismatching state parameter in authentication response");return e})}static errorResponse(e){let t=e.params.error;return t?Promise.reject(t):Promise.resolve(e)}static validateResponseMode(e){if("code"!==e.request.response_type&&"query"===e.mode)throw new Error("Invalid response mode");return e}static validateResponseParams(e){let{request:t,params:n}=e,r=t.response_type.split(" ");return r.includes("code")&&a(n.code,"Missing authorization code in authentication response"),r.includes("id_token")&&a(n.id_token,"Missing id_token in authentication response"),r.includes("token")&&(a(n.access_token,"Missing access_token in authentication response"),a(n.token_type,"Missing token_type in authentication response")),e}static exchangeAuthorizationCode(e){let{rp:t,params:n,request:i}=e,o=n.code;if(!o||"code"!==i.response_type)return Promise.resolve(e);let{provider:s,registration:d}=t,h=d.client_id,p=d.client_secret;if(!p)return Promise.reject(new Error("Client cannot exchange authorization code because it is not a confidential client"));let m=s.configuration.token_endpoint,v=new l({"Content-Type":"application/x-www-form-urlencoded"}),g={grant_type:"authorization_code",code:o,redirect_uri:i.redirect_uri},b=d.token_endpoint_auth_method||"client_secret_basic";if("client_secret_basic"===b){let e=new r(`${h}:${p}`).toString("base64");v.set("Authorization",`Basic ${e}`)}"client_secret_post"===b&&(g.client_id=h,g.client_secret=p);let y=c.encode(g);return u(m,{method:"POST",headers:v,body:y}).then(f("Error exchanging authorization code")).then(e=>e.json()).then(t=>(a(t.access_token,"Missing access_token in token response"),a(t.token_type,"Missing token_type in token response"),a(t.id_token,"Missing id_token in token response"),e.params=Object.assign(e.params,t),e))}static validateIDToken(e){return e.params.id_token?Promise.resolve(e).then(p.decryptIDToken).then(p.decodeIDToken).then(p.validateIssuer).then(p.validateAudience).then(p.resolveKeys).then(p.verifySignature).then(p.validateExpires).then(p.verifyNonce).then(p.validateAcr).then(p.validateAuthTime).then(p.validateAccessTokenHash).then(p.validateAuthorizationCodeHash):Promise.resolve(e)}static decryptIDToken(e){return Promise.resolve(e)}static decodeIDToken(e){let t=e.params.id_token;return t&&(e.decoded=d.decode(t)),e}static validateIssuer(e){let t=e.rp.provider.configuration;if(e.decoded.payload.iss!==t.issuer)throw new Error("Mismatching issuer in ID Token");return e}static validateAudience(e){let t=e.rp.registration,{aud:n,azp:r}=e.decoded.payload;if("string"==typeof n&&n!==t.client_id)throw new Error("Mismatching audience in id_token");if(Array.isArray(n)&&!n.includes(t.client_id))throw new Error("Mismatching audience in id_token");if(Array.isArray(n)&&!r)throw new Error("Missing azp claim in id_token");if(r&&r!==t.client_id)throw new Error("Mismatching azp claim in id_token");return e}static resolveKeys(e){let t=e.rp,n=t.provider,r=e.decoded;return Promise.resolve(n.jwks).then(e=>e||t.jwks()).then(t=>{if(r.resolveKeys(t))return Promise.resolve(e);throw new Error("Cannot resolve signing key for ID Token")})}static verifySignature(e){let t=e.decoded.header.alg,n=e.rp.registration.id_token_signed_response_alg||"RS256";if(t!==n)throw new Error(`Expected ID Token to be signed with ${n}`);return e.decoded.verify().then(t=>{if(!t)throw new Error("Invalid ID Token signature");return e})}static validateExpires(e){if(e.decoded.payload.exp<=_Mathfloor(Date.now()/1e3))throw new Error("Expired ID Token");return e}static verifyNonce(e){let t=new Uint8Array(e.request.nonce),n=e.decoded.payload.nonce;if(!n)throw new Error("Missing nonce in ID Token");return o.subtle.digest({name:"SHA-256"},t).then(t=>{if(n!==s(r.from(t)))throw new Error("Mismatching nonce in ID Token");return e})}static validateAcr(e){return e}static validateAuthTime(e){return e}static validateAccessTokenHash(e){return e}static validateAuthorizationCodeHash(e){return e}}e.exports=p}).call(this,n(5),n(2).Buffer)},function(e,t,n){(function(t){const r=n(104),i=n(32),a=n(72),{JWT:o}=n(55),s=n(173),{URL:u}=n(47);class l{static create(e,n,o){const{provider:c,defaults:d,registration:h}=e;let f,p,m,v;return Promise.resolve().then(()=>(r(c.configuration,"RelyingParty provider OpenID Configuration is missing"),r(d.authenticate,"RelyingParty default authentication parameters are missing"),r(h,"RelyingParty client registration is missing"),f=c.configuration.issuer,p=c.configuration.authorization_endpoint,m={client_id:h.client_id},v=Object.assign(d.authenticate,m,n),r(f,"Missing issuer in provider OpenID Configuration"),r(p,"Missing authorization_endpoint in provider OpenID Configuration"),r(v.scope,"Missing scope parameter in authentication request"),r(v.response_type,"Missing response_type parameter in authentication request"),r(v.client_id,"Missing client_id parameter in authentication request"),r(v.redirect_uri,"Missing redirect_uri parameter in authentication request"),v.state=Array.from(a.getRandomValues(new Uint8Array(16))),v.nonce=Array.from(a.getRandomValues(new Uint8Array(16))),Promise.all([a.subtle.digest({name:"SHA-256"},new Uint8Array(v.state)),a.subtle.digest({name:"SHA-256"},new Uint8Array(v.nonce))]))).then(e=>{let n=i(t.from(e[0])),r=i(t.from(e[1]));o[`${f}/requestHistory/${n}`]=JSON.stringify(v),v.state=n,v.nonce=r}).then(()=>l.generateSessionKeys()).then(e=>{l.storeSessionKeys(e,v,o)}).then(()=>{if(c.configuration.request_parameter_supported)return l.encodeRequestParams(v).then(e=>{v=e})}).then(()=>{let e=new u(p);return e.search=s.encode(v),e.href})}static generateSessionKeys(){return a.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(e=>Promise.all([a.subtle.exportKey("jwk",e.publicKey),a.subtle.exportKey("jwk",e.privateKey)])).then(e=>{let[t,n]=e;return{public:t,private:n}})}static storeSessionKeys(e,t,n){n["oidc.session.privateKey"]=JSON.stringify(e.private),t.key=e.public}static encodeRequestParams(e){const t=["scope","client_id","response_type","state"];let n={};return Object.keys(e).filter(e=>!t.includes(e)).forEach(t=>{n[t]=e[t]}),new o({header:{alg:"none"},payload:n},{filter:!1}).encode().then(t=>{return{scope:e.scope,client_id:e.client_id,response_type:e.response_type,request:t,state:e.state}})}}e.exports=l}).call(this,n(2).Buffer)},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(32),o=n(17).JSONDocument,s=n(178),u=n(174),l=n(181),c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o),i(t,[{key:"isJWE",value:function(){return!!this.header.enc}},{key:"resolveKeys",value:function(e){var t,n,i=this.header.kid;if(Array.isArray(e)&&(t=e),e.keys&&(t=e.keys),e.keys||"object"!==(void 0===e?"undefined":r(e))||(t=[e]),!t)throw new l("Invalid JWK argument");return!!(n=i?t.find(function(e){return e.kid===i}):t.find(function(e){return"sig"===e.use}))&&(this.key=n.cryptoKey,!0)}},{key:"encode",value:function(){var e=this.validate();if(!e.valid)return Promise.reject(e);return this.isJWE()?JWE.encrypt(this):u.sign(this)}},{key:"verify",value:function(){var e=this.validate();return e.valid?u.verify(this):Promise.reject(e)}}],[{key:"decode",value:function(e){var t;if("string"!=typeof e)throw new l("JWT must be a string");if(e.startsWith("{")){try{e=JSON.parse(e,function(){})}catch(e){throw new l("Invalid JWT serialization")}e.serialization=e.signatures||e.recipients?"json":"flattened",t=new this(e,{filter:!1})}else try{var n=e.split("."),r=n.length;if(3!==r&&5!==r)throw new Error("Malformed JWT");var i=JSON.parse(a.decode(n[0]));if(3===r){t=new this({type:"JWS",segments:n,header:i,payload:JSON.parse(a.decode(n[1])),signature:n[2],serialization:"compact"},{filter:!1})}}catch(e){throw new l("Invalid JWT compact serialization")}return t}},{key:"encode",value:function(e,n,r){return new t(e,n).encode(r)}},{key:"verify",value:function(e,n){var r=t.decode(n);return r.key=e,r.verify().then(function(e){return r})}},{key:"schema",get:function(){return s}}]),t}();e.exports=c},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(17).JSONDocument,a=n(179),o=n(180),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i),r(t,null,[{key:"importKeys",value:function e(n){var r,i,a=this.schema.validate(n);if(!a.valid)return Promise.reject(new Error("Invalid JWKSet: "+JSON.stringify(a,null,2)));if(!n.keys)return Promise.reject(new Error("Cannot import JWKSet: keys property is empty"));try{r=new t(n),i=n.keys.map(function(e){return o.importKey(e)})}catch(e){return Promise.reject(e)}return Promise.all(i).then(function(e){return r.keys=e,r})}},{key:"schema",get:function(){return a}}]),t}();e.exports=s},function(e,t,n){"use strict";var r=n(17).Formats;r.register("StringOrURI",/(?:)/),r.register("NumericDate",/(?:)/),r.register("URI",/(?:)/),r.register("url",/(?:)/),r.register("base64",/(?:)/),r.register("base64url",/(?:)/),r.register("MediaType",/(?:)/)},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(183),a=["sign","verify","encrypt","decrypt","importKey"],o=function(){function e(){var t=this;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),a.forEach(function(e){t[e]={}})}return r(e,[{key:"define",value:function(e,t,n){this[t][e]=n}},{key:"normalize",value:function(e,t){var n=this[e];if(!n)return new SyntaxError;var r=n[t];return r||new i(t)}}],[{key:"operations",get:function(){return a}}]),e}();e.exports=o},function(e,t,n){"use strict";(function(t){var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(32),a=n(72),o=n(184),s=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.params=t}return r(e,[{key:"sign",value:function(e,n){var r=this.params;return n=(new o).encode(n),a.subtle.sign(r,e,n).then(function(e){return i(t.from(e))})}},{key:"verify",value:function(e,t,n){var r=this.params;return"string"==typeof t&&(t=Uint8Array.from(i.toBuffer(t))),"string"==typeof n&&(n=(new o).encode(n)),a.subtle.verify(r,e,t,n)}},{key:"importKey",value:function(e){var t=Object.assign({},e),n=this.params,r=e.key_ops||[];return"sig"===e.use&&r.push("verify"),"enc"===e.use?Promise.resolve(e):(e.key_ops&&(r=e.key_ops),a.subtle.importKey("jwk",t,n,!0,r).then(function(e){return Object.defineProperty(t,"cryptoKey",{enumerable:!1,value:e}),t}))}}]),e}();e.exports=s}).call(this,n(2).Buffer)},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__402__},function(e,t,n){"use strict";(function(t){var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(32),a=n(72),o=n(184),s=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.params=t}return r(e,[{key:"sign",value:function(e,n){var r=this.params;return n=(new o).encode(n),a.subtle.sign(r,e,n).then(function(e){return i(t.from(e))})}},{key:"verify",value:function(e,t,n){var r=this.params;return"string"==typeof t&&(t=Uint8Array.from(i.toBuffer(t))),"string"==typeof n&&(n=(new o).encode(n)),a.subtle.verify(r,e,t,n)}},{key:"assertSufficientKeyLength",value:function(e){if(e.length<this.bitlength)throw new Error("The key is too short.")}}]),e}();e.exports=s}).call(this,n(2).Buffer)},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"sign",value:function(){return Promise.resolve("")}},{key:"verify",value:function(){}}]),e}();e.exports=i},function(e,t,n){"use strict";var r=n(404),i=n(403),a=n(401),o=new(n(400));o.define("HS256","sign",new i({name:"HMAC",hash:{name:"SHA-256"}})),o.define("HS384","sign",new i({name:"HMAC",hash:{name:"SHA-384"}})),o.define("HS512","sign",new i({name:"HMAC",hash:{name:"SHA-512"}})),o.define("RS256","sign",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}})),o.define("RS384","sign",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}})),o.define("RS512","sign",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}})),o.define("none","sign",new r({})),o.define("HS256","verify",new i({name:"HMAC",hash:{name:"SHA-256"}})),o.define("HS384","verify",new i({name:"HMAC",hash:{name:"SHA-384"}})),o.define("HS512","verify",new i({name:"HMAC",hash:{name:"SHA-512"}})),o.define("RS256","verify",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}})),o.define("RS384","verify",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}})),o.define("RS512","verify",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}})),o.define("none","verify",new r({})),o.define("RS256","importKey",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}})),o.define("RS384","importKey",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}})),o.define("RS512","importKey",new a({name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}})),e.exports=o},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var n=t.length,r=n%4;if(!r)return t;var i=n,a=4-r,o=new e(n+a);for(o.write(t);a--;)o.write("=",i++);return o.toString()}}).call(this,n(2).Buffer)},function(e,t,n){"use strict";(function(e){function r(t,n){return void 0===n&&(n="utf8"),e.isBuffer(t)?a(t.toString("base64")):a(new e(t,n).toString("base64"))}function i(e){return e=e.toString(),o.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function a(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var o=n(406),s=r;s.encode=r,s.decode=function(t,n){return void 0===n&&(n="utf8"),new e(i(t),"base64").toString(n)},s.toBase64=i,s.fromBase64=a,s.toBuffer=function(t){return new e(i(t),"base64")},Object.defineProperty(t,"__esModule",{value:!0}),t.default=s}).call(this,n(2).Buffer)},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(187),s=n(185),u=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),Object.assign(this,t),Object.defineProperties(this,{initialize:{enumerable:!1,writeable:!1,value:o.compile(t)},validate:{enumerable:!1,writeable:!1,value:s.compile(t)}})}return a(e,[{key:"extend",value:function(t){function n(e){return e&&"object"===(void 0===e?"undefined":i(e))&&null!==e&&!Array.isArray(e)}return new e(function e(t,i){var a=Object.assign({},t);return n(t)&&n(i)&&Object.keys(i).forEach(function(o){n(i[o])&&o in t?a[o]=e(t[o],i[o]):Object.assign(a,r({},o,i[o]))}),a}(this,t))}}]),e}();e.exports=u},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(103),a=1,o=function(){function e(t){var n=this;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),Object.defineProperty(this,"mapping",{enumerable:!1,value:new Map}),Object.keys(t).forEach(function(e){var r=t[e];n.mapping.set(new i(e,a),new i(r,a))})}return r(e,[{key:"map",value:function(e,t){this.mapping.forEach(function(n,r){r.add(e,n.get(t))})}},{key:"project",value:function(e,t){this.mapping.forEach(function(n,r){n.add(t,r.get(e))})}}]),e}();e.exports=o},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(186),a=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.initialize(t,n)}return r(e,null,[{key:"schema",get:function(){throw new Error("Schema must be defined by classes extending JSONDocument")}}]),r(e,[{key:"initialize",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};this.constructor.schema.initialize(this,e,t)}},{key:"validate",value:function(e){var t=this.constructor.schema;return(e||t).validate(this)}},{key:"patch",value:function(e){var t=new i(e);t.apply(this)}},{key:"select",value:function(){}},{key:"project",value:function(e){return e.project(this)}}],[{key:"serialize",value:function(e){return JSON.stringify(e)}},{key:"deserialize",value:function(e){try{return JSON.parse(e)}catch(e){throw new Error("Failed to parse JSON")}}}]),e}();e.exports=a},function(e,t,n){"use strict";e.exports=n(189)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(190),i=/((?:[a-zA-Z0-9._~+\/-]+=*(?:\s+|$))|[^\u0000-\u001F\u007F()<>@,;:\\"/?={}\[\]\u0020\u0009]+)(?:=([^\\"=\s,]+|"(?:[^"\\]|\\.)*"))?/g,a=function(e,t){var n='"'===t.charAt(0)?(0,r.unquote)(t):t.trim();return Array.isArray(e)?e.concat(n):e?[e,n]:n};t.default=function(e){if("string"!=typeof e)throw new TypeError("Header value must be a string.");var t=e.indexOf(" "),n=e.substr(0,t);if(!(0,r.isScheme)(n))throw new TypeError("Invalid scheme "+n);return function(e,t){for(var n=null,r=null,o={};null!==(n=i.exec(t));)n[2]?o[n[1]]=a(o[n[1]],n[2]):r=a(r,n[1]);return{scheme:e,params:o,token:r}}(n,e.substr(t))}},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n,r=[],i=!0,a=!1;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){a=!0,n=e}finally{try{!i&&s.return&&s.return()}finally{if(a)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(190),s=function(e){return e.reduce(function(e,t){var n=a(t,2),i=n[0],s=n[1],u=function(e){return function(t){return e+"="+(t&&!(0,o.isToken)(t)?(0,o.quote)(t):t)}}(i);if(!(0,o.isToken)(i))throw new TypeError;return Array.isArray(s)?[].concat(r(e),r(s.map(u))):[].concat(r(e),[u(s)])},[])};t.default=function(e,t,n){var a="string"==typeof e?{scheme:e,token:t,params:n}:e;if("object"!==(void 0===a?"undefined":i(a)))throw new TypeError;if(!(0,o.isScheme)(a.scheme))throw new TypeError("Invalid scheme.");return[a.scheme].concat(r(void 0===a.token?[]:[a.token]),r(void 0===a.params?[]:function e(t,n){if(Array.isArray(t))return s(t);if("object"===(void 0===t?"undefined":i(t)))return e(Object.keys(t).map(function(e){return[e,t[e]]}),n);throw new TypeError}(a.params))).join(" ")}},function(e,t){for(var n=[],r=0;256>r;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return i[e[r++]]+i[e[r++]]+i[e[r++]]+i[e[r++]]+"-"+i[e[r++]]+i[e[r++]]+"-"+i[e[r++]]+i[e[r++]]+"-"+i[e[r++]]+i[e[r++]]+"-"+i[e[r++]]+i[e[r++]]+i[e[r++]]+i[e[r++]]+i[e[r++]]+i[e[r++]]}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=Array(16);e.exports=function(){for(var e,t=0;16>t;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=255&e>>>((3&t)<<3);return i}}},function(e,t,n){var r=n(415),i=n(414);e.exports=function(e,t,n){var a=t&&n||0;"string"==typeof e&&(t="binary"===e?Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||r)();if(o[6]=64|15&o[6],o[8]=128|63&o[8],t)for(var s=0;16>s;++s)t[a+s]=o[s];return t||i(o)}},function(e,t,n){n(106)("observable")},function(e,t,n){n(106)("asyncIterator")},function(e,t,n){var r=n(77),i=n(59),a=n(45),o=n(119),s=n(35),u=n(212),l=Object.getOwnPropertyDescriptor;t.f=n(29)?l:function(e,t){if(e=a(e),t=o(t,!0),u)try{return l(e,t)}catch(e){}return s(e,t)?i(!r.f.call(e,t),e[t]):void 0}},function(e,t,n){var r=n(45),i=n(192).f,a={}.toString,o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return o&&"[object Window]"==a.call(e)?function(e){try{return i(e)}catch(e){return o.slice()}}(e):i(r(e))}},function(e,t,n){var r=n(58);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(79),i=n(112),a=n(77);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var o,s=n(e),u=a.f,l=0;s.length>l;)u.call(e,o=s[l++])&&t.push(o);return t}},function(e,t,n){var r=n(78)("meta"),i=n(36),a=n(35),o=n(26).f,s=0,u=Object.isExtensible||function(){return!0},l=!n(60)(function(){return u(Object.preventExtensions({}))}),c=function(e){o(e,r,{value:{i:"O"+ ++s,w:{}}})},d=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!a(e,r)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!a(e,r)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return l&&d.NEED&&u(e)&&!a(e,r)&&c(e),e}}},function(e,t,n){"use strict";var r=n(10),i=n(35),a=n(29),o=n(31),s=n(207),u=n(423).KEY,l=n(60),c=n(114),d=n(74),h=n(78),f=n(9),p=n(107),m=n(106),v=n(422),g=n(421),b=n(30),y=n(36),w=n(45),_=n(119),x=n(59),M=n(206),k=n(420),C=n(419),E=n(26),A=n(79),T=C.f,S=E.f,I=k.f,N=r.Symbol,j=r.JSON,O=j&&j.stringify,R="prototype",L=f("_hidden"),P=f("toPrimitive"),D={}.propertyIsEnumerable,B=c("symbol-registry"),U=c("symbols"),q=c("op-symbols"),F=Object[R],z="function"==typeof N,H=r.QObject,W=!H||!H[R]||!H[R].findChild,V=a&&l(function(){return 7!=M(S({},"a",{get:function(){return S(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=T(F,t);r&&delete F[t],S(e,t,n),r&&e!==F&&S(F,t,r)}:S,J=function(e){var t=U[e]=M(N[R]);return t._k=e,t},G=z&&"symbol"==typeof N.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof N},K=function(e,t,n){return e===F&&K(q,t,n),b(e),t=_(t,!0),b(n),i(U,t)?(n.enumerable?(i(e,L)&&e[L][t]&&(e[L][t]=!1),n=M(n,{enumerable:x(0,!1)})):(!i(e,L)&&S(e,L,x(1,{})),e[L][t]=!0),V(e,t,n)):S(e,t,n)},$=function(e,t){b(e);for(var n,r=v(t=w(t)),i=0,a=r.length;a>i;)K(e,n=r[i++],t[n]);return e},X=function(e){var t=D.call(this,e=_(e,!0));return!(this===F&&i(U,e)&&!i(q,e))&&(!(t||!i(this,e)||!i(U,e)||i(this,L)&&this[L][e])||t)},Z=function(e,t){if(e=w(e),t=_(t,!0),e!==F||!i(U,t)||i(q,t)){var n=T(e,t);return n&&i(U,t)&&!(i(e,L)&&e[L][t])&&(n.enumerable=!0),n}},Y=function(e){for(var t,n=I(w(e)),r=[],a=0;n.length>a;)i(U,t=n[a++])||t==L||t==u||r.push(t);return r},Q=function(e){for(var t,n=e===F,r=I(n?q:w(e)),a=[],o=0;r.length>o;)i(U,t=r[o++])&&(!n||i(F,t))&&a.push(U[t]);return a};z||(s((N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var e=h(0<arguments.length?arguments[0]:void 0),t=function(n){this===F&&t.call(q,n),i(this,L)&&i(this[L],e)&&(this[L][e]=!1),V(this,e,x(1,n))};return a&&W&&V(F,e,{configurable:!0,set:t}),J(e)})[R],"toString",function(){return this._k}),C.f=Z,E.f=K,n(192).f=k.f=Y,n(77).f=X,n(112).f=Q,a&&!n(75)&&s(F,"propertyIsEnumerable",X,!0),p.f=function(e){return J(f(e))}),o(o.G+o.W+o.F*!z,{Symbol:N});for(var ee=["hasInstance","isConcatSpreadable","iterator","match","replace","search","species","split","toPrimitive","toStringTag","unscopables"],te=0;ee.length>te;)f(ee[te++]);for(var ne=A(f.store),re=0;ne.length>re;)m(ne[re++]);o(o.S+o.F*!z,"Symbol",{for:function(e){return i(B,e+="")?B[e]:B[e]=N(e)},keyFor:function(e){if(!G(e))throw TypeError(e+" is not a symbol!");for(var t in B)if(B[t]===e)return t},useSetter:function(){W=!0},useSimple:function(){W=!1}}),o(o.S+o.F*!z,"Object",{create:function(e,t){return void 0===t?M(e):$(M(e),t)},defineProperty:K,defineProperties:$,getOwnPropertyDescriptor:Z,getOwnPropertyNames:Y,getOwnPropertySymbols:Q}),j&&o(o.S+o.F*(!z||l(function(){var e=N();return"[null]"!=O([e])||"{}"!=O({a:e})||"{}"!=O(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(y(t)||void 0!==e)&&!G(e))return g(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!G(t))return t}),r[1]=t,O.apply(j,r)}}),N[R][P]||n(37)(N[R],P,N[R].valueOf),d(N,"Symbol"),d(Math,"Math",!0),d(r.JSON,"JSON",!0)},function(e,t,n){n(424),n(209),n(418),n(417),e.exports=n(18).Symbol},function(e,t,n){e.exports={default:n(425),__esModule:!0}},function(e,t,n){n(110),n(204),e.exports=n(107).f("iterator")},function(e,t,n){e.exports={default:n(427),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=r(n(428)),a=r(n(426)),o="function"==typeof a.default&&"symbol"==typeof i.default?function(e){return typeof e}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":typeof e};t.default="function"==typeof a.default&&"symbol"===o(i.default)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":void 0===e?"undefined":o(e)}},function(e,t,n){var r=n(18),i=r.JSON||(r.JSON={stringify:JSON.stringify});e.exports=function(e){return i.stringify.apply(i,arguments)}},function(e,t,n){e.exports={default:n(430),__esModule:!0}},function(e,t,n){var r=n(31);r(r.S+r.F*!n(29),"Object",{defineProperty:n(26).f})},function(e,t,n){n(432);var r=n(18).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){e.exports={default:n(433),__esModule:!0}},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t,n=this;return t=(0,l.default)(u.default.mark(function t(r){var i=r.url,a=r.authType;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,d.updateStorage)(e,function(e){return(0,s.default)({},e,{hosts:(0,s.default)({},e.hosts,(0,o.default)({},i,{authType:a}))})});case 2:return t.abrupt("return",{url:i,authType:a});case 3:case"end":return t.stop()}},t,n)})),function(e){return t.apply(this,arguments)}}Object.defineProperty(t,"__esModule",{value:!0}),t.hostNameFromRequestInfo=void 0;var o=i(n(194)),s=i(n(81)),u=i(n(34)),l=i(n(33));t.getHost=function(e){var t,n=this;return t=(0,l.default)(u.default.mark(function t(r){var i,a,o,s;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=p(r),t.next=3,(0,c.getSession)(e);case 3:if(!(a=t.sent)||p(a.idp)!==i){t.next=6;break}return t.abrupt("return",{url:i,authType:a.authType});case 6:return t.next=8,(0,d.getData)(e);case 8:if(o=t.sent,s=o.hosts){t.next=12;break}return t.abrupt("return",null);case 12:return t.abrupt("return",s[i]||null);case 13:case"end":return t.stop()}},t,n)})),function(e){return t.apply(this,arguments)}},t.saveHost=a,t.updateHostFromResponse=function(e){var t,n=this;return t=(0,l.default)(u.default.mark(function t(r){var i,o;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=void 0,i=h.requiresAuth(r)?"WebID-OIDC":f.requiresAuth(r)?"WebID-TLS":null,o=p(r.url),!i){t.next=6;break}return t.next=6,a(e)({url:o,authType:i});case 6:case"end":return t.stop()}},t,n)})),function(e){return t.apply(this,arguments)}};var c=n(108),d=n(73),h=r(n(105)),f=r(n(171)),p=t.hostNameFromRequestInfo=function(e){return(e instanceof URL?e:e instanceof Request?new URL(e.url):new URL(e)).host}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t,n=this;return t=(0,o.default)(a.default.mark(function t(r){var i,o;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,u.getSession)(e);case 2:if(i=t.sent){t.next=5;break}return t.abrupt("return",!1);case 5:return t.next=7,(0,s.getHost)(e)(r);case 7:return o=t.sent,t.abrupt("return",null!=o&&i.authType===o.authType);case 9:case"end":return t.stop()}},t,n)})),function(e){return t.apply(this,arguments)}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(n(34)),o=r(n(33));t.authnFetch=function(e){var t,n=this;return t=(0,o.default)(a.default.mark(function t(r,o){var l,d,h,f;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=o||{},t.next=3,(0,u.getSession)(e);case 3:return l=t.sent,t.next=6,i(e)(r);case 6:if(d=t.sent,!l||!d){t.next=9;break}return t.abrupt("return",c(l,r,o));case 9:return t.next=11,fetch(r,o);case 11:if(401!==(h=t.sent).status){t.next=20;break}return t.next=15,(0,s.updateHostFromResponse)(e)(h);case 15:return t.next=17,i(e)(r);case 17:if(f=t.sent,!l||!f){t.next=20;break}return t.abrupt("return",c(l,r,o));case 20:return t.abrupt("return",h);case 21:case"end":return t.stop()}},t,n)})),function(e,n){return t.apply(this,arguments)}},n(56);var s=n(435),u=n(108),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(105)),c=function(){var e=(0,o.default)(a.default.mark(function e(t,n,r){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.authType,e.next="WebID-OIDC"===e.t0?3:(e.t0,4);break;case 3:return e.abrupt("return",l.fetchWithCredentials(t)(n,r));case 4:return e.abrupt("return",fetch(n,r));case 5:case"end":return e.stop()}},e,void 0)}));return function(t,n,r){return e.apply(this,arguments)}}()},function(e,t,n){"use strict";var r=n(31),i=n(109),a=n(197);r(r.S,"Promise",{try:function(e){var t=i.f(this),n=a(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){"use strict";var r=n(31),i=n(18),a=n(10),o=n(199),s=n(196);r(r.P+r.R,"Promise",{finally:function(e){var t=o(this,i.Promise||a.Promise),n="function"==typeof e;return this.then(n?function(n){return s(t,e()).then(function(){return n})}:e,n?function(n){return s(t,e()).then(function(){throw n})}:e)}})},function(e,t,n){"use strict";var r=n(10),i=n(18),a=n(26),o=n(29),s=n(9)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:r[e];o&&t&&!t[s]&&a.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(37);e.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},function(e,t,n){var r=n(10),i=n(198).set,a=r.MutationObserver||r.WebKitMutationObserver,o=r.process,s=r.Promise,u="process"==n(58)(o);e.exports=function(){var e,t,n,l=function(){var r,i;for(u&&(r=o.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(i){throw e?n():t=void 0,i}}t=void 0,r&&r.enter()};if(u)n=function(){o.nextTick(l)};else if(!a||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var c=s.resolve();n=function(){c.then(l)}}else n=function(){i.call(r,l)};else{var d=!0,h=document.createTextNode("");new a(l).observe(h,{characterData:!0}),n=function(){h.data=d=!d}}return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(61),i=n(202),a=n(201),o=n(30),s=n(117),u=n(200),l={},c={};(t=e.exports=function(e,t,n,d,h){var f,p,m,v,g=h?function(){return e}:u(e),b=r(n,d,t?2:1),y=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(a(g)){for(f=s(e.length);f>y;y++)if((v=t?b(o(p=e[y])[0],p[1]):b(e[y]))===l||v===c)return v}else for(m=g.call(e);!(p=m.next()).done;)if((v=i(m,b,p.value,t))===l||v===c)return v}).BREAK=l,t.RETURN=c},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){"use strict";var r,i,a,o,s=n(75),u=n(10),l=n(61),c=n(203),d=n(31),h=n(36),f=n(80),p=n(444),m=n(443),v=n(199),g=n(198).set,b=n(441)(),y=n(109),w=n(197),_=n(196),x="Promise",M=u.TypeError,k=u.process,C=u[x],E="process"==c(k),A=function(){},T=i=y.f,S=!!function(){try{var e=C.resolve(1),t=(e.constructor={})[n(9)("species")]=function(e){e(A,A)};return(E||"function"==typeof PromiseRejectionEvent)&&e.then(A)instanceof t}catch(t){}}(),I=function(e){var t;return h(e)&&"function"==typeof(t=e.then)&&t},N=function(e,t){if(!e._n){e._n=!0;var n=e._c;b(function(){for(var r=e._v,i=1==e._s,a=0,o=function(t){var n,a,o,s=i?t.ok:t.fail,u=t.resolve,l=t.reject,c=t.domain;try{s?(!i&&(2==e._h&&R(e),e._h=1),!0===s?n=r:(c&&c.enter(),n=s(r),c&&(c.exit(),o=!0)),n===t.promise?l(M("Promise-chain cycle")):(a=I(n))?a.call(n,u,l):u(n)):l(r)}catch(t){c&&!o&&c.exit(),l(t)}};n.length>a;)o(n[a++]);e._c=[],e._n=!1,t&&!e._h&&j(e)})}},j=function(e){g.call(u,function(){var t,n,r,i=e._v,a=O(e);if(a&&(t=w(function(){E?k.emit("unhandledRejection",i,e):(n=u.onunhandledrejection)?n({promise:e,reason:i}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",i)}),e._h=E||O(e)?2:1),e._a=void 0,a&&t.e)throw t.v})},O=function(e){return 1!==e._h&&0===(e._a||e._c).length},R=function(e){g.call(u,function(){var t;E?k.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})})},L=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,!t._a&&(t._a=t._c.slice()),N(t,!0))},P=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw M("Promise can't be resolved itself");(t=I(e))?b(function(){var r={_w:n,_d:!1};try{t.call(e,l(P,r,1),l(L,r,1))}catch(e){L.call(r,e)}}):(n._v=e,n._s=1,N(n,!1))}catch(t){L.call({_w:n,_d:!1},t)}}};S||(C=function e(t){p(this,C,x,"_h"),f(t),r.call(this);try{t(l(P,this,1),l(L,this,1))}catch(e){L.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(440)(C.prototype,{then:function(e,t){var n=T(v(this,C));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=E?k.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&N(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r;this.promise=e,this.resolve=l(P,e,1),this.reject=l(L,e,1)},y.f=T=function(e){return e===C||e===o?new a(e):i(e)}),d(d.G+d.W+d.F*!S,{Promise:C}),n(74)(C,x),n(439)(x),o=n(18)[x],d(d.S+d.F*!S,x,{reject:function(e){var t=T(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(s||!S),x,{resolve:function(e){return _(s&&this===o?C:this,e)}}),d(d.S+d.F*!(S&&n(195)(function(e){C.all(e).catch(A)})),x,{all:function(e){var t=this,n=T(t),r=n.resolve,i=n.reject,a=w(function(){var n=[],a=0,o=1;m(e,!1,function(e){var s=a++,u=!1;n.push(void 0),o++,t.resolve(e).then(function(e){u||(u=!0,n[s]=e,--o||r(n))},i)}),--o||r(n)});return a.e&&i(a.v),n.promise},race:function(e){var t=this,n=T(t),r=n.reject,i=w(function(){m(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports=function(){}},function(e,t,n){"use strict";var r=n(447),i=n(446),a=n(57),o=n(45);e.exports=n(208)(Array,"Array",function(e,t){this._t=o(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},function(e,t,n){var r=n(35),i=n(111),a=n(115)("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,n){var r=n(26),i=n(30),a=n(79);e.exports=n(29)?Object.defineProperties:function(e,t){i(e);for(var n,o=a(t),s=o.length,u=0;s>u;)r.f(e,n=o[u++],t[n]);return e}},function(e,t,n){"use strict";var r=n(206),i=n(59),a=n(74),o={};n(37)(o,n(9)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(o,{next:i(1,n)}),a(e,t+" Iterator")}},function(e,t,n){var r=n(116),i=n(118);e.exports=function(e){return function(t,n){var a,o,s=i(t)+"",u=r(n),l=s.length;return 0>u||u>=l?e?"":void 0:55296>(a=s.charCodeAt(u))||56319<a||u+1===l||56320>(o=s.charCodeAt(u+1))||57343<o?e?s.charAt(u):a:e?s.slice(u,u+2):o-56320+(a-55296<<10)+65536}}},function(e,t,n){n(209),n(110),n(204),n(445),n(438),n(437),e.exports=n(18).Promise},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof i?t:i,o=Object.create(a.prototype),s=new f(r||[]);return o._invoke=l(e,n,s),o}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function a(){}function o(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function u(e){function t(n,i,a,o){var s=r(e[n],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&g.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,a,o)},function(e){t("throw",e,a,o)}):Promise.resolve(l).then(function(e){u.value=e,a(u)},o)}o(s.arg)}var n;this._invoke=function(e,r){function i(){return new Promise(function(n,i){t(e,r,n,i)})}return n=n?n.then(i,i):i()}}function l(e,t,n){var i=k;return function(a,o){if(i==E)throw new Error("Generator is already running");if(i==A){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var u=c(s,n);if(u){if(u===T)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i==k)throw i=A,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=E;var l=r(e,t,n);if("normal"===l.type){if(i=n.done?A:C,l.arg===T)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=A,n.method="throw",n.arg=l.arg)}}}function c(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,c(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,T;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function d(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function h(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(d,this),this.reset(!0)}function p(e){if(e){var t=e[y];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(g.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:m}}function m(){return{value:void 0,done:!0}}var v=Object.prototype,g=v.hasOwnProperty,b="function"==typeof Symbol?Symbol:{},y=b.iterator||"@@iterator",w=b.asyncIterator||"@@asyncIterator",_=b.toStringTag||"@@toStringTag",x="object"==typeof e,M=t.regeneratorRuntime;if(M)x&&(e.exports=M);else{(M=t.regeneratorRuntime=x?e.exports:{}).wrap=n;var k="suspendedStart",C="suspendedYield",E="executing",A="completed",T={},S={};S[y]=function(){return this};var I=Object.getPrototypeOf,N=I&&I(I(p([])));N&&N!==v&&g.call(N,y)&&(S=N);var j=o.prototype=i.prototype=Object.create(S);a.prototype=j.constructor=o,o.constructor=a,o[_]=a.displayName="GeneratorFunction",M.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},M.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,o):(e.__proto__=o,!(_ in e)&&(e[_]="GeneratorFunction")),e.prototype=Object.create(j),e},M.awrap=function(e){return{__await:e}},s(u.prototype),u.prototype[w]=function(){return this},M.AsyncIterator=u,M.async=function(e,t,r,i){var a=new u(n(e,t,r,i));return M.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(j),j[_]="Generator",j[y]=function(){return this},j.toString=function(){return"[object Generator]"},M.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},M.values=p,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(h),!e)for(var t in this)"t"===t.charAt(0)&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=void 0),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var o=g.call(i,"catchLoc"),s=g.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n,r=this.tryEntries.length-1;0<=r;--r)if((n=this.tryEntries[r]).tryLoc<=this.prev&&g.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t,n=this.tryEntries.length-1;0<=n;--n)if((t=this.tryEntries[n]).finallyLoc===e)return this.complete(t.completion,t.afterLoc),h(t),T},catch:function(e){for(var t,n=this.tryEntries.length-1;0<=n;--n)if((t=this.tryEntries[n]).tryLoc===e){var r=t.completion;if("throw"===r.type){var i=r.arg;h(t)}return i}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:p(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),T}}}}(function(){return this}()||Function("return this")())},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&0<=Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime"),a=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(454),i)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(e,t,n){var r=n(116),i=_Mathmax,a=_Mathmin;e.exports=function(e,t){return 0>(e=r(e))?i(e+t,0):a(e,t)}},function(e,t,n){var r=n(45),i=n(117),a=n(456);e.exports=function(e){return function(t,n,o){var s,u=r(t),l=i(u.length),c=a(o,l);if(e&&n!=n){for(;l>c;)if((s=u[c++])!=s)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){"use strict";var r=n(79),i=n(112),a=n(77),o=n(111),s=n(210),u=Object.assign;e.exports=!u||n(60)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=u({},e)[n]||Object.keys(u({},t)).join("")!=r})?function(e,t){for(var n=o(e),u=arguments.length,l=1,c=i.f,d=a.f;u>l;)for(var h,f=s(arguments[l++]),p=c?r(f).concat(c(f)):r(f),m=p.length,v=0;m>v;)d.call(f,h=p[v++])&&(n[h]=f[h]);return n}:u},function(e,t,n){var r=n(31);r(r.S+r.F,"Object",{assign:n(458)})},function(e,t,n){n(459),e.exports=n(18).Object.assign},function(e,t,n){e.exports={default:n(460),__esModule:!0}},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.logout=t.currentSession=t.popupLogin=t.login=t.fetch=void 0;var a=i(n(81)),o=i(n(34)),s=i(n(33)),u=function(){var e=(0,s.default)(o.default.mark(function e(t,n){var r;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==n.length){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,n[0]();case 5:if(!(r=e.sent)){e.next=8;break}return e.abrupt("return",(0,d.saveSession)(t)(r));case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),console.error(e.t0);case 13:return e.abrupt("return",u(t,n.slice(1)));case 14:case"end":return e.stop()}},e,this,[[2,10]])}));return function(t,n){return e.apply(this,arguments)}}(),l=(t.login=function(){var e=(0,s.default)(o.default.mark(function e(t,n){var r,i;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=(0,a.default)({},v(),n),e.next=3,p.login(t);case 3:if(!(r=e.sent)){e.next=6;break}return e.abrupt("return",(0,d.saveSession)(n.storage)(r));case 6:return e.next=8,m.login(t,n);case 8:return i=e.sent,e.abrupt("return",i);case 10:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),t.popupLogin=function(){var e=(0,s.default)(o.default.mark(function e(t){var n,r;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.popupUri){e.next=2;break}throw new Error("Must provide options.popupUri");case 2:return t.callbackUri||(t.callbackUri=t.popupUri),t=(0,a.default)({},v(),t),n=(0,c.openIdpSelector)(t),e.next=7,(0,c.startPopupServer)(t.storage,n,t);case 7:return r=e.sent,e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),t.currentSession=function(){var e=(0,s.default)(o.default.mark(function e(){var t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:(0,h.defaultStorage)();return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,d.getSession)(n);case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",t);case 5:return e.abrupt("return",u(n,[m.currentSession.bind(null,n)]));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),t.logout=function(){var e=(0,s.default)(o.default.mark(function e(){var t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:(0,h.defaultStorage)();return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,d.getSession)(n);case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return");case 5:e.t0=t.authType,e.next="WebID-OIDC"===e.t0?8:(e.t0,18);break;case 8:return e.prev=8,e.next=11,m.logout(n);case 11:e.next=17;break;case 13:e.prev=13,e.t1=e.catch(8),console.warn("Error logging out:"),console.error(e.t1);case 17:case 18:return e.abrupt("break",19);case 19:return e.abrupt("return",(0,d.clearSession)(n));case 20:case"end":return e.stop()}},e,this,[[8,13]])}));return function(){return e.apply(this,arguments)}}(),n(436)),c=n(389),d=n(108),h=n(73),f=n(101),p=r(n(171)),m=r(n(105)),v=function(){var e=(0,f.currentUrlNoParams)();return{callbackUri:e?e.split("#")[0]:null,popupUri:null,storage:(0,h.defaultStorage)()}};t.fetch=function(e,t){return(0,l.authnFetch)((0,h.defaultStorage)())(e,t)}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(19),a=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.termType="DefaultGraph",e.value="",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i),r(t,[{key:"toCanonical",value:function(){return this.value}}]),t}();e.exports=a},function(e,t){e.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t,n){e.exports=n(129).PassThrough},function(e,t,n){e.exports=n(129).Transform},function(e,t,n){e.exports=n(38)},function(e,t,n){e.exports=n(128)},function(e,t,n){"use strict";function r(e){return this instanceof r?void i.call(this,e):new r(e)}e.exports=r;var i=n(217),a=n(63);a.inherits=n(1),a.inherits(r,i),r.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===(n+"").toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,n(5))},function(e,t){},function(e,t,n){"use strict";function r(e,t,n){e.copy(t,n)}var i=n(3).Buffer,a=n(472);e.exports=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};0<this.length?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return this.head=1===this.length?this.tail=null:this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),n=this.head,a=0;n;)r(n.data,t,a),a+=n.data.length,n=n.next;return t},e}(),a&&a.inspect&&a.inspect.custom&&(e.exports.prototype[a.inspect.custom]=function(){var e=a.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t){t.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,a=f&(1<<-c)-1,f>>=-c,c+=s;0<c;a=256*a+e[t+d],d+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;0<c;o=256*o+e[t+d],d+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(f?-1:1);o+=_Mathpow(2,r),a-=l}return(f?-1:1)*o*_Mathpow(2,a-r)},t.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<<l)-1,d=c>>1,h=23===i?5.960464477539062e-8:0,f=r?0:a-1,p=r?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=_Mathabs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=_Mathfloor(_Mathlog(t)/_MathLN),1>t*(u=_Mathpow(2,-o))&&(o--,u*=2),2<=(t+=1<=o+d?h/u:h*_Mathpow(2,1-d))*u&&(o++,u/=2),o+d>=c?(s=0,o=c):1<=o+d?(s=(t*u-1)*_Mathpow(2,i),o+=d):(s=t*_Mathpow(2,d-1)*_Mathpow(2,i),o=0));8<=i;e[n+f]=255&s,f+=p,s/=256,i-=8);for(o=o<<i|s,l+=i;0<l;e[n+f]=255&o,f+=p,o/=256,l-=8);e[n+f-p]|=128*m}},function(e,t,n){"use strict";function r(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function i(e){return o[63&e>>18]+o[63&e>>12]+o[63&e>>6]+o[63&e]}function a(e,t,n){for(var r,a=[],o=t;o<n;o+=3)r=(16711680&e[o]<<16)+(65280&e[o+1]<<8)+(255&e[o+2]),a.push(i(r));return a.join("")}t.byteLength=function(e){var t=r(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){for(var t,n=r(e),i=n[0],a=n[1],o=new u(function(e,t,n){return 3*(t+n)/4-n}(0,i,a)),l=0,c=0<a?i-4:i,d=0;d<c;d+=4)t=s[e.charCodeAt(d)]<<18|s[e.charCodeAt(d+1)]<<12|s[e.charCodeAt(d+2)]<<6|s[e.charCodeAt(d+3)],o[l++]=255&t>>16,o[l++]=255&t>>8,o[l++]=255&t;return 2===a&&(t=s[e.charCodeAt(d)]<<2|s[e.charCodeAt(d+1)]>>4,o[l++]=255&t),1===a&&(t=s[e.charCodeAt(d)]<<10|s[e.charCodeAt(d+1)]<<4|s[e.charCodeAt(d+2)]>>2,o[l++]=255&t>>8,o[l++]=255&t),o},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i=[],s=16383,u=0,l=n-r;u<l;u+=s)i.push(a(e,u,u+s>l?l:u+s));return 1==r?(t=e[n-1],i.push(o[t>>2]+o[63&t<<4]+"==")):2==r&&(t=(e[n-2]<<8)+e[n-1],i.push(o[t>>10]+o[63&t>>4]+o[63&t<<2]+"=")),i.join("")};for(var o=[],s=[],u="undefined"==typeof Uint8Array?Array:Uint8Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,d=l.length;c<d;++c)o[c]=l[c],s[l.charCodeAt(c)]=c;s[45]=62,s[95]=63},function(e,t,n){function r(e){var t=i(e);return n(t)}function i(e){var t=a[e];if(!(t+1)){var n=new Error('Cannot find module "'+e+'".');throw n.code="MODULE_NOT_FOUND",n}return t}var a={"./N3Lexer":133,"./N3Lexer.js":133,"./N3Parser":132,"./N3Parser.js":132,"./N3Store":223,"./N3Store.js":223,"./N3StreamParser":222,"./N3StreamParser.js":222,"./N3StreamWriter":216,"./N3StreamWriter.js":216,"./N3Util":131,"./N3Util.js":131,"./N3Writer":125,"./N3Writer.js":125};r.keys=function(){return Object.keys(a)},r.resolve=i,e.exports=r,r.id=477},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t){},function(e,t,n){(function(e,t){!function(e,n){"use strict";function r(e){delete s[e]}function i(e){if(u)setTimeout(i,0,e);else{var t=s[e];if(t){u=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{r(e),u=!1}}}}if(!e.setImmediate){var a,o=1,s={},u=!1,l=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"==={}.toString.call(e.process)?a=function(e){t.nextTick(function(){i(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&i(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),a=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){i(e.data)},a=function(t){e.port2.postMessage(t)}}():l&&"onreadystatechange"in l.createElement("script")?function(){var e=l.documentElement;a=function(t){var n=l.createElement("script");n.onreadystatechange=function(){i(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():a=function(e){setTimeout(i,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var r={callback:e,args:t};return s[o]=r,a(o),o++},c.clearImmediate=r}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(5),n(11))},function(e,t,n){(function(n,r){var i;
126
- /*!
127
- * async
128
- * https://github.com/caolan/async
129
- *
130
- * Copyright 2010-2014 Caolan McMahon
131
- * Released under the MIT license
132
- */
133
- /*!
134
- * async
135
- * https://github.com/caolan/async
136
- *
137
- * Copyright 2010-2014 Caolan McMahon
138
- * Released under the MIT license
139
- */
140
- !function(){function a(e){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,e.apply(o,arguments)}}var o,s,u={};null!=(o=this)&&(s=o.async),u.noConflict=function(){return o.async=s,u};var l=Object.prototype.toString,c=Array.isArray||function(e){return"[object Array]"===l.call(e)},d=function(e,t){for(var n=0;n<e.length;n+=1)t(e[n],n,e)},h=function(e,t){if(e.map)return e.map(t);var n=[];return d(e,function(e,r,i){n.push(t(e,r,i))}),n},f=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t};void 0!==n&&n.nextTick?(u.nextTick=n.nextTick,u.setImmediate=void 0===r?u.nextTick:function(e){r(e)}):"function"==typeof r?(u.nextTick=function(e){r(e)},u.setImmediate=u.nextTick):(u.nextTick=function(e){setTimeout(e,0)},u.setImmediate=u.nextTick),u.each=function(e,t,n){function r(t){t?(n(t),n=function(){}):(i+=1)>=e.length&&n()}if(n=n||function(){},!e.length)return n();var i=0;d(e,function(e){t(e,a(r))})},u.forEach=u.each,u.eachSeries=function(e,t,n){if(n=n||function(){},!e.length)return n();var r=0,i=function(){t(e[r],function(t){t?(n(t),n=function(){}):(r+=1)>=e.length?n():i()})};i()},u.forEachSeries=u.eachSeries,u.eachLimit=function(e,t,n,r){p(t).apply(null,[e,n,r])},u.forEachLimit=u.eachLimit;var p=function(e){return function(t,n,r){if(r=r||function(){},!t.length||0>=e)return r();var i=0,a=0,o=0;!function s(){if(i>=t.length)return r();for(;o<e&&a<t.length;)o+=1,n(t[(a+=1)-1],function(e){e?(r(e),r=function(){}):(o-=1,(i+=1)>=t.length?r():s())})}()}},m=function(e){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[u.each].concat(t))}},v=function(e){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[u.eachSeries].concat(t))}},g=function(e,t,n,r){if(t=h(t,function(e,t){return{index:t,value:e}}),r){var i=[];e(t,function(e,t){n(e.value,function(n,r){i[e.index]=r,t(n)})},function(e){r(e,i)})}else e(t,function(e,t){n(e.value,function(e){t(e)})})};u.map=m(g),u.mapSeries=v(g),u.mapLimit=function(e,t,n,r){return b(t)(e,n,r)};var b=function(e){return function(e,t){return function(){var n=Array.prototype.slice.call(arguments);return t.apply(null,[p(e)].concat(n))}}(e,g)};u.reduce=function(e,t,n,r){u.eachSeries(e,function(e,r){n(t,e,function(e,n){t=n,r(e)})},function(e){r(e,t)})},u.inject=u.reduce,u.foldl=u.reduce,u.reduceRight=function(e,t,n,r){var i=h(e,function(e){return e}).reverse();u.reduce(i,t,n,r)},u.foldr=u.reduceRight;var y=function(e,t,n,r){var i=[];e(t=h(t,function(e,t){return{index:t,value:e}}),function(e,t){n(e.value,function(n){n&&i.push(e),t()})},function(e){r(h(i.sort(function(e,t){return e.index-t.index}),function(e){return e.value}))})};u.filter=m(y),u.filterSeries=v(y),u.select=u.filter,u.selectSeries=u.filterSeries;var w=function(e,t,n,r){var i=[];e(t=h(t,function(e,t){return{index:t,value:e}}),function(e,t){n(e.value,function(n){n||i.push(e),t()})},function(e){r(h(i.sort(function(e,t){return e.index-t.index}),function(e){return e.value}))})};u.reject=m(w),u.rejectSeries=v(w);var _=function(e,t,n,r){e(t,function(e,t){n(e,function(n){n?(r(e),r=function(){}):t()})},function(e){r()})};u.detect=m(_),u.detectSeries=v(_),u.some=function(e,t,n){u.each(e,function(e,r){t(e,function(e){e&&(n(!0),n=function(){}),r()})},function(e){n(!1)})},u.any=u.some,u.every=function(e,t,n){u.each(e,function(e,r){t(e,function(e){e||(n(!1),n=function(){}),r()})},function(e){n(!0)})},u.all=u.every,u.sortBy=function(e,t,n){u.map(e,function(e,n){t(e,function(t,r){t?n(t):n(null,{value:e,criteria:r})})},function(e,t){if(e)return n(e);n(null,h(t.sort(function(e,t){var n=e.criteria,r=t.criteria;return n<r?-1:n>r?1:0}),function(e){return e.value}))})},u.auto=function(e,t){t=t||function(){};var n=f(e),r=n.length;if(!r)return t();var i={},a=[],o=function(e){a.unshift(e)},s=function(e){for(var t=0;t<a.length;t+=1)if(a[t]===e)return void a.splice(t,1)},l=function(){r--,d(a.slice(0),function(e){e()})};o(function(){if(!r){var e=t;t=function(){},e(null,i)}}),d(n,function(n){var r=c(e[n])?e[n]:[e[n]],a=function(e){var r=Array.prototype.slice.call(arguments,1);if(1>=r.length&&(r=r[0]),e){var a={};d(f(i),function(e){a[e]=i[e]}),a[n]=r,t(e,a),t=function(){}}else i[n]=r,u.setImmediate(l)},h=r.slice(0,_Mathabs(r.length-1))||[],p=function(){return function(e,t,n){return e.reduce?e.reduce(t,n):(d(e,function(e,r,i){n=t(n,e,r,i)}),n)}(h,function(e,t){return e&&i.hasOwnProperty(t)},!0)&&!i.hasOwnProperty(n)};if(p())r[r.length-1](a,i);else{var m=function(){p()&&(s(m),r[r.length-1](a,i))};o(m)}})},u.retry=function(e,t,n){var r=[];"function"==typeof e&&(n=t,t=e,e=5),e=parseInt(e,10)||5;var i=function(i,a){for(var o=function(e,t){return function(n){e(function(e,r){n(!e||t,{err:e,result:r})},a)}};e;)r.push(o(t,!(e-=1)));u.series(r,function(e,t){t=t[t.length-1],(i||n)(t.err,t.result)})};return n?i():i},u.waterfall=function(e,t){if(t=t||function(){},!c(e)){var n=new Error("First argument to waterfall must be an array of functions");return t(n)}if(!e.length)return t();var r=function(e){return function(n){if(n)t.apply(null,arguments),t=function(){};else{var i=Array.prototype.slice.call(arguments,1),a=e.next();a?i.push(r(a)):i.push(t),u.setImmediate(function(){e.apply(null,i)})}}};r(u.iterator(e))()};var x=function(e,t,n){if(n=n||function(){},c(t))e.map(t,function(e,t){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);1>=n.length&&(n=n[0]),t.call(null,e,n)})},n);else{var r={};e.each(f(t),function(e,n){t[e](function(t){var i=Array.prototype.slice.call(arguments,1);1>=i.length&&(i=i[0]),r[e]=i,n(t)})},function(e){n(e,r)})}};u.parallel=function(e,t){x({map:u.map,each:u.each},e,t)},u.parallelLimit=function(e,t,n){x({map:b(t),each:p(t)},e,n)},u.series=function(e,t){if(t=t||function(){},c(e))u.mapSeries(e,function(e,t){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);1>=n.length&&(n=n[0]),t.call(null,e,n)})},t);else{var n={};u.eachSeries(f(e),function(t,r){e[t](function(e){var i=Array.prototype.slice.call(arguments,1);1>=i.length&&(i=i[0]),n[t]=i,r(e)})},function(e){t(e,n)})}},u.iterator=function(e){var t=function(n){var r=function(){return e.length&&e[n].apply(null,arguments),r.next()};return r.next=function(){return n<e.length-1?t(n+1):null},r};return t(0)},u.apply=function(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t.concat(Array.prototype.slice.call(arguments)))}};var M=function(e,t,n,r){var i=[];e(t,function(e,t){n(e,function(e,n){i=i.concat(n||[]),t(e)})},function(e){r(e,i)})};u.concat=m(M),u.concatSeries=v(M),u.whilst=function(e,t,n){e()?t(function(r){return r?n(r):void u.whilst(e,t,n)}):n()},u.doWhilst=function(e,t,n){e(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);t.apply(null,i)?u.doWhilst(e,t,n):n()})},u.until=function(e,t,n){e()?n():t(function(r){return r?n(r):void u.until(e,t,n)})},u.doUntil=function(e,t,n){e(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);t.apply(null,i)?n():u.doUntil(e,t,n)})},u.queue=function(e,t){function n(e,t,n,r){return e.started||(e.started=!0),c(t)||(t=[t]),0==t.length?u.setImmediate(function(){e.drain&&e.drain()}):void d(t,function(t){var i={data:t,callback:"function"==typeof r?r:null};n?e.tasks.unshift(i):e.tasks.push(i),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),u.setImmediate(e.process)})}void 0===t&&(t=1);var r=0,i={tasks:[],concurrency:t,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(e,t){n(i,e,!1,t)},kill:function(){i.drain=null,i.tasks=[]},unshift:function(e,t){n(i,e,!0,t)},process:function(){if(!i.paused&&r<i.concurrency&&i.tasks.length){var t=i.tasks.shift();i.empty&&0===i.tasks.length&&i.empty(),r+=1;var n=a(function(){r-=1,t.callback&&t.callback.apply(t,arguments),i.drain&&0===i.tasks.length+r&&i.drain(),i.process()});e(t.data,n)}},length:function(){return i.tasks.length},running:function(){return r},idle:function(){return 0===i.tasks.length+r},pause:function(){!0===i.paused||(i.paused=!0)},resume:function(){if(!1!==i.paused){i.paused=!1;for(var e=1;e<=i.concurrency;e++)u.setImmediate(i.process)}}};return i},u.priorityQueue=function(e,t){function n(e,t){return e.priority-t.priority}function r(e,t,r,i){return e.started||(e.started=!0),c(t)||(t=[t]),0==t.length?u.setImmediate(function(){e.drain&&e.drain()}):void d(t,function(t){var a={data:t,priority:r,callback:"function"==typeof i?i:null};e.tasks.splice(function(e,t,n){for(var r,i=-1,a=e.length-1;i<a;)0<=n(t,e[r=i+(a-i+1>>>1)])?i=r:a=r-1;return i}(e.tasks,a,n)+1,0,a),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),u.setImmediate(e.process)})}var i=u.queue(e,t);return i.push=function(e,t,n){r(i,e,t,n)},delete i.unshift,i},u.cargo=function(e,t){var n=!1,r=[],i={tasks:r,payload:t,saturated:null,empty:null,drain:null,drained:!0,push:function(e,n){c(e)||(e=[e]),d(e,function(e){r.push({data:e,callback:"function"==typeof n?n:null}),i.drained=!1,i.saturated&&r.length===t&&i.saturated()}),u.setImmediate(i.process)},process:function a(){if(!n){if(0===r.length)return i.drain&&!i.drained&&i.drain(),void(i.drained=!0);var o="number"==typeof t?r.splice(0,t):r.splice(0,r.length),s=h(o,function(e){return e.data});i.empty&&i.empty(),n=!0,e(s,function(){n=!1;var e=arguments;d(o,function(t){t.callback&&t.callback.apply(null,e)}),a()})}},length:function(){return r.length},running:function(){return n}};return i};var k=function(e){return function(t){var n=Array.prototype.slice.call(arguments,1);t.apply(null,n.concat([function(t){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[e]&&d(n,function(t){console[e](t)}))}]))}};u.log=k("log"),u.dir=k("dir"),u.memoize=function(e,t){var n={},r={};t=t||function(e){return e};var i=function(){var i=Array.prototype.slice.call(arguments),a=i.pop(),o=t.apply(null,i);o in n?u.nextTick(function(){a.apply(null,n[o])}):o in r?r[o].push(a):(r[o]=[a],e.apply(null,i.concat([function(){n[o]=arguments;var e=r[o];delete r[o];for(var t=0,i=e.length;t<i;t++)e[t].apply(null,arguments)}])))};return i.memo=n,i.unmemoized=e,i},u.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments)}},u.times=function(e,t,n){for(var r=[],i=0;i<e;i++)r.push(i);return u.map(r,t,n)},u.timesSeries=function(e,t,n){for(var r=[],i=0;i<e;i++)r.push(i);return u.mapSeries(r,t,n)},u.seq=function(){var e=arguments;return function(){var t=this,n=Array.prototype.slice.call(arguments),r=n.pop();u.reduce(e,n,function(e,n,r){n.apply(t,e.concat([function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);r(e,t)}]))},function(e,n){r.apply(t,[e].concat(n))})}},u.compose=function(){return u.seq.apply(null,Array.prototype.reverse.call(arguments))};var C=function(e,t){var n=function(){var n=this,r=Array.prototype.slice.call(arguments),i=r.pop();return e(t,function(e,t){e.apply(n,r.concat([t]))},i)};if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return n.apply(this,r)}return n};u.applyEach=m(C),u.applyEachSeries=v(C),u.forever=function(e,t){!function n(r){if(r){if(t)return t(r);throw r}e(n)}()},void 0!==e&&e.exports?e.exports=u:void 0===(i=function(){return u}.apply(t,[]))||(e.exports=i)}()}).call(this,n(11),n(65).setImmediate)},function(e,t,n){const r=n(4);if(e.exports=r,r.UI=n(0),r.OutlineManager=n(277),r.getOutliner=function(e){return e.outlineManager||(e.outlineManager=r.OutlineManager(e)),e.outlineManager},"undefined"!=typeof window){var i=window.document;r.getOutliner(i)}let a=r.register;a(n(272)),a(n(271)),a(n(267)),a(n(266)),a(n(265)),a(n(264)),a(n(263)),a(n(262)),a(n(260)),a(n(259)),a(n(257)),a(n(256)),a(n(255)),a(n(254)),a(n(253)),a(n(252)),a(n(251)),a(n(249)),a(n(248)),a(n(247)),a(n(245)),a(n(244)),a(n(243)),a(n(242)),a(n(241)),a(n(240)),a(n(239)),a(n(238)),a(n(237)),a(n(236)),a(n(235)),a(n(234)),a(n(233)),a(n(232)),a(n(231)),a(n(230))},function(e,t,n){"use strict";(function(t){t.dump=function(e){console.log(e.slice(0,-1))};var r=n(482),i=n(0),a=i.rdf;t.$rdf=a,a.log=i.log,"undefined"!=typeof window&&(window.UI=i,window.panes=r),window.onpopstate=function(e){window.document.outline.GotoSubject(a.sym(window.document.location.href),!0,void 0,!0,void 0)},r.UI=i,t.require=function(e){if("mashlib"===e)return r;throw new Error("Cannot require (this is a Mashlib-specific require stub)")},e.exports=r}).call(this,n(5))},function(e,t,n){e.exports=n(483)}])});
141
- //# sourceMappingURL=mashlib.min.js.map