mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-12-18 14:45:52 +00:00
20 lines
86 KiB
JavaScript
20 lines
86 KiB
JavaScript
//*******************************************************************************
|
|
//
|
|
// Copyright 2014 Microsoft
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
//*******************************************************************************
|
|
var msrCryptoVersion="1.4",msrCrypto=msrCrypto||function(){"use strict";function gt(){function f(n){var t,i=null;if(arguments.length&&typeof arguments[0]!="number"){if(typeof arguments[0]=="object")for(i=new Array(n.length),t=0;t<n.length;t+=1)i[t]=n[t]}else for(i=new Array(n),t=0;t<n;t+=1)i[t]=0;return i}function tt(n){for(var i=new Array(n.length),t=0;t<n.length;)i[t]=n[n.length-t-1],t+=1;return i}function ot(n,t){var i,f,r,e;for(n=n.replace(/^\s+|\s+$/g,""),i=[0],f=[0],t=t||10,r=0;r<n.length;r+=1){if(e=parseInt(n[r],t),isNaN(e))throw new Error("Failed to convert string to integer in radix "+t.toString());a(i,t,f);b(f,[e],i);u(i)}return i}function st(n,t){var l,a,y;if(t=t||10,r<=t)throw new Error("DIGIT_BASE is smaller than RADIX; cannot convert.");var p=n.length,h=[],v=[],w=[],b=[],o=[],e=[],f,i="",c="0";for(o[0]=t;Math.floor(r/o[0])>=t;)o[0]=o[0]*t,c=c.concat("0");for(f=0;f<p;f+=1)e[f]=n[f];do{for(l=!0,f=0;f<e.length;f+=1)if(e[f]!==0){l=!1;break}if(l)break;s(e,o,h,v,w,b);u(h,e.length,!0);a=v[0].toString(t);i=c.substring(0,c.length-a.length)+a+i;y=e;e=h;h=y}while(1);while(i.length!==0&&i[0]==="0")i=i.substring(1,i.length);return i.length===0&&(i="0"),i}function ht(n){var i=Math.ceil((n+1)/8),t=f(i);return t[0]=Math.pow(2,n%8),t}function ct(n){for(var r=f(n.length*8),u=0,i=n.length-1,t;i>=0;){for(t=0;t<8;){var e=1<<t,o=(n[i]&e)===e?1:0,s=8*(n.length-i-1)+t;o===1&&(u=s+1);r[s]=o;t+=1}i--}return r.slice(0,u)}function it(n){for(var i=r>>>1,u=t;u-->0;){if((n&i)===i)break;i=i>>>1}return u}function lt(n){for(var r=0,t=0,i,u;r<n.length;){if(t===0)for(i=7;i>=0&&t===0;)u=1<<i,(n[r]&u)===u&&(t=i+1),i--;else t+=8;r+=1}return t}function at(t,i,r){var u;t=t.slice();var f=[],e=Math.pow(2,i),o=Math.pow(2,i-1);for(u=0;u<r;u++)f[u]=t[0]%e-o,t[0]=t[0]-f[u],n.shiftRight(t,t,i-1);return f[u]=t[0],f}function e(n,t,i,r,u){while(u-->0)i[r+u]=n[t+u]}function w(n){for(var t=0;t<n.length;t+=1)if(n[t]!==0)return!1;return!0}function vt(n){return(n[0]&1)==0}function yt(n,t){if(n.length!==t.length)return!1;for(var i=0;i<n.length;i+=1)if(n[i]!==t[i])return!1;return!0}function d(n){var o=Math.floor((n.length+h-1)/h),i=new Array(o),u;i[0]=0;var t=0,e=0,f=0;for(u=n.length-1;u>=0;u--)t=t+v[f++]*(n[u]&255),v[f]===r&&(f=0,i[e++]=t,t=0);return t!==0&&(i[e]=t),i}function pt(n,t,i){var u,f,e,r=[0];for(typeof t=="undefined"&&(t=!0),u=0;u<n.length;u+=1)for(e=n[u],f=0;f<h;f+=1)r[u*h+f]=e&255,e=Math.floor(e/256);if(r=tt(r),i===undefined&&(i=1),t)while(r.length>i&&r[0]===0)r.shift();return r}function l(n,i){var f,u;for(typeof i=="undefined"&&(n<=1?i=1:(f=Math.log(n)/Math.LN2,i=Math.ceil(f/t))),u=[];n>0;)u.push(n%r),n=Math.floor(n/r);while(u.length<i)u.push(0);return u}function c(n){for(var t=n.length-1;t>=0;t--)if(n[t]!==undefined&&n[t]!==0)return t;return n[0]===0?-1:0}function o(n,t){var i=0,r=c(n)+1,u=c(t)+1;if(r>u)i=1;else if(u>r)i=-1;else while(r-->0&&i===0)i=n[r]-t[r];return i}function u(n,t,i){var r=c(n);if(n.length=t||r+1,i)while(++r<n.length)n[r]=0;return n.length<=0&&(n[0]=0,n.length=1),n}function wt(n,r,u,f){var o,s,e;if(u===undefined)u=1;else if(u>=t||u<0)throw new Error("Invalid bit count for shiftRight");for(f===undefined&&(f=n.length),o=f-1,s=t-u,e=0;e<o;e++)r[e]=(n[e+1]<<s|n[e]>>>u)&i;r[o]=n[o]>>>u}function g(n,r,u,f){var o,e;if(u===undefined)u=1;else if(u>=t||u<0)throw new Error("bit count must be smaller than DIGIT_BITS and positive in shiftLeft");for(f===undefined&&(f=n.length),o=t-u,r[f]=n[f-1]>>>t-u||r[f],e=f-1;e>0;e--)r[e]=(n[e]<<u|n[e-1]>>>o)&i;r[0]=n[0]<<u&i}function b(n,r,u){var s=n,o=r,h,f,e;for(r.length<n.length&&(s=r,o=n),h=s.length,f=0,e=0;e<h;e+=1)f+=s[e]+o[e],u[e]=f&i,f=f>>t;for(e=h;e<o.length;e+=1)f+=o[e],u[e]=f&i,f=f>>t;return u.length=o.length,f!==0&&(u[e]=f&i),f}function rt(n,r,u){var o=r.length,e,f;if(n.length<r.length&&(o=c(r)+1,n.length<o))throw new Error("Subtrahend is longer than minuend, not supported.");for(f=0,e=0;e<o;e+=1)f+=n[e]-r[e],u[e]=f&i,f=f>>t;while(e<n.length)f+=n[e],u[e++]=f&i,f=f>>t;return f}function a(n,t,u){for(var s=typeof t=="number"?[t]:t,h=Math.max(n.length,s.length),e,o,f=0;f<h;f+=1)u[f]=0;for(f=0;f<s.length;f+=1){for(o=0,e=0;e<n.length;e+=1)o+=n[e]*s[f]+u[f+e],u[f+e]=o&i,o=Math.floor(o/r);u[n.length+f]=o&i}return u.length=n.length+s.length,u}function s(n,f,o,s,h,l){var b=c(n)+1,a=c(f)+1,nt,k,tt,rt,w,p,v,ut,d,y;if(b<a){e(n,0,s,0,n.length);s.length=n.length;u(s);o[0]=0;o.length=1;return}if(a===0||a===1&&f[a-1]===0)throw new Error("Division by zero.");else if(a===1){for(w=f[0],k=0,v=b-1;v>=0;v--)rt=k*r+n[v],o[v]=rt/w&i,k=rt-o[v]*w&i;o.length=b;u(o);s[0]=k;s.length=1;return}for(ut=t-1-it(f[a-1]),d=h||[],d.length=a,g(f,d,ut,a),y=l||[],y.length=b,g(n,y,ut,b),y[b]=y[b]||0,o.length=b-a+1,s.length=a,v=b-a;v>=0;v--){for(nt=Math.floor((y[v+a]*r+y[v+a-1])/d[a-1]),k=y[v+a]*r+y[v+a-1]-nt*d[a-1];;)if(!(nt>=r)&&!(nt*d[a-2]>k*r+y[v+a-2])||(nt=nt-1,k=k+d[a-1],!(k<r)))break;for(tt=0,p=0;p<a;p++)rt=nt*d[p],w=y[p+v]-tt-(rt&i),y[p+v]=w&i,tt=Math.floor(rt/r)-Math.floor(w/r);if(w=y[v+a]-tt,y[v+a]=w&i,o[v]=nt&i,w<0){for(o[v]=o[v]-1,tt=0,p=0;p<a;p++)w=y[p+v]+d[p]+tt,y[p+v]=w&i,tt=w>>t;y[v+a]=y[v+a]+tt&i}}for(p=0;p<a;p++)s[p]=(y[p]>>>ut|y[p+1]<<t-ut)&i;u(o);u(s)}function bt(n,t,i,r,u){return s(n,t,[],i,r,u),i}function ut(n,t,i,r,u,f){var e=[];return a(n,t,e),s(e,i,e,r,u,f),r}function ft(n,t,i,r,f){var c,y,h,k;if(w(n))return e(t,0,f,0,t.length),f.length=t.length,0;if(w(t))return e(n,0,f,0,n.length),f.length=n.length,0;o(n,t)<0?(c=n.slice(0),e(t,0,f,0,t.length),f.length=t.length):(c=t.slice(0),e(n,0,f,0,n.length),f.length=n.length);u(f);u(c);var d=new Array(f.length),g=new Array(f.length),l=new Array(f.length),nt=r!==undefined,v;nt&&(v=new Array(f.length),v[0]=1,v.length=1,r[0]=0,r.length=1);h=new Array(f.length);k=i!==undefined;k&&(y=new Array(f.length),y[0]=0,y.length=1,i[0]=1,i.length=1);for(var tt=-1,it=i,rt=r,ut=f,p;!w(c);)s(f,c,d,g,h,l),k&&(a(d,y,h),b(h,i,h),u(h),p=i,i=y,y=h,h=p),nt&&(a(d,v,l),b(l,r,l),u(l),p=r,r=v,v=l,l=p),p=f,f=c,c=g,g=p,tt++;return k&&(e(i,0,it,0,i.length),it.length=i.length),nt&&(e(r,0,rt,0,r.length),rt.length=r.length),e(f,0,ut,0,f.length),ut.length=f.length,tt}function kt(n,t,i){var r=n,f=t;return o(n,t)>0&&(r=t,f=n),ft(r,f,undefined,undefined,i),u(i)}function dt(n,t,i){var r=new Array(t.length),s=new Array(t.length),f=new Array(t.length),h=ft(n,t,s,r,f);return i=i||[],o(f,p)!==0?(i[0]=NaN,i.length=1):((h&1)==1?rt(t,r,i):(e(r,0,i,0,r.length),i.length=r.length),u(i)),i}function gt(n,t,i,r){if(r=r||[],o(t,k)===0)r[0]=1;else if(o(t,p)===0)e(n,0,r,0,n.length),r.length=n.length;else{var f=new nt(i);u(n,f.s,!0);f.modExp(n,t,r);r.length=i.length}return r}function nt(n){function et(n){for(var f=1,r=2,u=3,e=u&n,o=2;o<=t;o+=1)r<e&&(f+=r),r=r<<1,u=u<<1|1,e=n*f&u;return(~f&i)+1}function b(n,u,f,e){var v,c;e=e||this;for(var l=0,a=e.m.length,b=a-1,k=e.mPrime,d=e.m0,g=n[0],s=0,y,p,h,w,o=0;o<a;o+=1)f[o]=0;for(o=0;o<a;o+=1){for(y=u[o],s=g*y+f[0],f[0]=s&i,s=Math.floor(s/r),h=1;h<a;h+=1)s=n[h]*y+f[h]+s,f[h]=s&i,s=Math.floor(s/r);for(l=l+s,p=f[0]*k&i,s=Math.floor((f[0]+d*p)/r),h=1,w=0;h<a;h+=1,w++)s=e.m[h]*p+f[h]+s,f[w]=s&i,s=Math.floor(s/r);l+=s;f[b]=l&i;l=Math.floor(l/r)}for(v=e.temp1===f?e.temp2:e.temp1,c=0,o=0;o<a;o+=1)c=f[o]-e.m[o]+(c>>t),v[o]=c&i;for(c=(l&i)+(c>>t),c=(l>>>t)+(c>>t),o=0;o<a;o+=1)f[o]=c&(v[o]^f[o])^v[o];return}function ot(n){var t,i;if(n.length<this.s)for(n.length=this.s,t=0;t<this.s;t++)n[t]=isNaN(n[t])?0:n[t];for(i=f(n.length),this.montgomeryMultiply(n,this.rSquaredModm,i),t=0;t<this.s;t+=1)n[t]=i[t]}function st(n){this.montgomeryMultiply(n,this.one,this.temp1);for(var t=0;t<this.s;t+=1)n[t]=this.temp1[t]}function ht(n,r,f){for(var s=2,b=i>>>t-s,l,a,y,d,o=r.length-1;o>0&&r[o]===0;o--);for(l=o*t+it(r[o])+1,l=l+(s-l%s),a=l%t-s,a<0&&(a+=t),y=b<<a,o=1;o<h.length;o++)ut(h[o-1],n,this.m,h[o],v,c),u(h[o],this.s,!0);var k=new Array(this.s),w=f,p=c;for(e(this.rModM,0,p,0,this.s);l>0;)this.montgomeryMultiply(p,p,w),this.montgomeryMultiply(w,w,k),d=(r[Math.floor((l-1)/t)]&y)>>>a,this.montgomeryMultiply(k,h[d],p),l=l-s,a=a-s,y=y>>>s,y===0&&(y=b<<t-s,a=t-s);return this.montgomeryMultiply(p,this.one,f),f}var a=n,y=a[0],o=a.length,k=f(o),w,ft,h;k[0]=1;var d=et(y),g=f(2*o+1),p=f(o+1),v=f(2*o+1),c=f(2*o+1),nt=p;nt[o]=1;s(nt,a,g,p,v,c);var tt=u(p,o,!0),l=f(2*o+1),rt=l;return rt[o*2]=1,s(rt,a,g,l,v,c),u(l,o,!0),w=f(o),ft={m:a,mPrime:d,m0:y,temp1:v,temp2:c},b(l,l,w,ft),h=new Array(4),h[0]=tt,h[1]=new Array(o),h[2]=new Array(o),h[3]=new Array(o),{m:n,m0:y,mPrime:d,rSquaredModm:l,s:o,rModM:tt,rCubedModm:w,one:k,temp1:v,temp2:c,convertToMontgomeryForm:ot,convertToStandardForm:st,montgomeryMultiply:b,modExp:ht}}function ni(r){function w(t){var i=d(t);if(n.compareDigits(i,this.m_modulus)>=0)throw new Error("The number provided is not an element of this group");return u(i,this.m_digitWidth,!0),s(i,this)}function b(n){var t=l(n,this.m_digitWidth);return s(t,this)}function k(t){return n.normalizeDigitArray(t,this.m_digitWidth,!0),s(t,this)}function g(n){return o(this.m_modulus,n.m_modulus)===0}function tt(r,u,f){var e,c=this.m_digitWidth,h=f.m_digits,l,s;for(n.add(r.m_digits,u.m_digits,h),l=o(h,this.m_modulus)>=0?i:0,s=0,e=0;e<c;e+=1)s=h[e]-(this.m_modulus[e]&l)+s,h[e]=s&i,s=s>>t;h.length=c}function it(r,u,f){var e,h=this.m_digitWidth,s=f.m_digits,o=n.subtract(r.m_digits,u.m_digits,f.m_digits);if(o===-1)for(o=0,e=0;e<h;e+=1)o+=s[e]+this.m_modulus[e],s[e]=o&i,o=o>>t}function rt(t,i){n.modInv(t.m_digits,this.m_modulus,i.m_digits)}function ut(t,i,r){return n.modMul(t.m_digits,i.m_digits,this.m_modulus,r.m_digits,v,y)}function ft(n,t,i){if(i=i||s([],this),o(t,c)===0)i.m_digits=l(1,this.m_digitWidth);else if(o(t,a)===0){for(var r=0;r<n.m_digits.length;r++)i.m_digits[r]=n.m_digits[r];i.m_digits.length=n.m_digits.length}else this.montmul.modExp(n.m_digits,t,i.m_digits),i.m_digits.length=this.montmul.s;return i}function s(n,t){return{m_digits:n,m_group:t,equals:function(n){return o(this.m_digits,n.m_digits)===0&&this.m_group.equals(this.m_group,n.m_group)}}}var h=d(r),e=h.length,c=l(0,e),a=l(1,e),v=f(e),y=f(e),p=new nt(h);return{m_modulus:h,m_digitWidth:e,montmul:p,createElementFromInteger:b,createElementFromBytes:w,createElementFromDigits:k,equals:g,add:tt,subtract:it,multiply:ut,inverse:rt,modexp:ft}}for(var k,p,t=24,h=Math.floor(t/8),i=(1<<t)-1,r=1<<t,et=i,v=[1,256],y=2;y<=h;y++)v[y]=v[y-1]*256;return k=[0],p=[1],{DIGIT_BITS:t,DIGIT_NUM_BYTES:h,DIGIT_MASK:i,DIGIT_BASE:r,DIGIT_MAX:et,Zero:k,One:p,normalizeDigitArray:u,swapEndianness:tt,bytesToDigits:d,stringToDigits:ot,digitsToString:st,intToDigits:l,digitsToBytes:pt,sequenceEqual:yt,isZero:w,isEven:vt,powerOfTwo:ht,shiftRight:wt,shiftLeft:g,compareDigits:o,computeBitArray:ct,bitLength:lt,fixedWindowRecode:at,IntegerGroup:ni,add:b,subtract:rt,multiply:a,divRem:s,reduce:bt,modInv:dt,modExp:gt,modMul:ut,MontgomeryMultiplier:nt,gcd:kt}}function ii(){function t(n){var t,i=null;if(arguments.length&&typeof arguments[0]!="number"){if(typeof arguments[0]=="object")for(i=[],t=0;t<n.length;t+=1)i[t]=n[t]}else for(i=[],t=0;t<n;t+=1)i[t]=0;return i}var i=n.bytesToDigits,u=function(t,i,u,f,e,o){var s=t.length,h=r(this,!1,e,o,null,!1);return{p:t,a:i,b:u,order:f,generator:h,allocatePointStorage:function(){return r(this,!1,n.intToDigits(0,s),n.intToDigits(0,s))},createPointAtInfinity:function(){return r(this,!0,n.intToDigits(0,s),n.intToDigits(0,s))}}},e=function(n){var t=new u(i(n.p),i(n.a),i(n.b),i(n.order),i(n.gx),i(n.gy));return t.type=n.type,t.name=n.name,t.generator.curve=t,t},o=function(t){var r=n.bytesToDigits,i=new u(r(t.p),r(t.a),r(t.d),r(t.order),r(t.gx),r(t.gy));return i.type=t.type,i.type==1&&(i.d=i.b.slice(),delete i.b),i.rbits=t.info[2],i.name=t.name,i.generator.curve=i,i},r=function(i,u,f,e,o,s){function c(t){return t?h.isInfinity&&t.isInfinity?!0:h.z===null&&t.z!==null?!1:h.z!==null&&t.z===null?!1:h.z===null?n.compareDigits(h.x,t.x)===0&&n.compareDigits(h.y,t.y)===0&&h.isInMontgomeryForm===t.isInMontgomeryForm:n.compareDigits(h.x,t.x)===0&&n.compareDigits(h.y,t.y)===0&&n.compareDigits(h.z,t.z)===0&&h.isInMontgomeryForm===t.isInMontgomeryForm:!1}function l(n,t){if(t.curve=n.curve,t.x=n.x.slice(),t.y=n.y.slice(),t.z=n.z!==null?n.z.slice():null,ot||(t.isAffine=n.isAffine),t.isInMontgomeryForm=n.isInMontgomeryForm,t.isInfinity=n.isInfinity,!t.equals(n))throw new Error("Instances should be equal.");}function a(){var n=r(h.curve,h.isInfinity,t(h.x),t(h.y),h.z?t(h.z):null,h.isInMontgomeryForm);return h.ta&&(n.ta=t(h.ta)),h.tb&&(n.tb=t(h.tb)),n}var h;return typeof o=="undefined"&&(o=null),typeof s=="undefined"&&(s=!1),h={equals:function(n){return c(n)},copy:function(n){l(this,n);return},clone:function(){return a()}},rt(h,"curve",i,function(){return i},function(n){i=n}),rt(h,"x",f,function(){return f},function(n){f=n}),rt(h,"y",e,function(){return e},function(n){e=n}),rt(h,"z",o,function(){return o},function(n){o=n}),rt(h,"isInMontgomeryForm",s,function(){return s},function(n){s=n}),rt(h,"isInfinity",u,function(){return u},function(n){u=n}),rt(h,"isAffine",o===null,function(){return o===null}),h},s=function(i){function e(n,t,i){var r=k.createElementFromInteger(0);r.m_digits=i;k.subtract(k.createElementFromDigits(n),k.createElementFromDigits(t),r)}function h(n,t,i){var r=k.createElementFromInteger(0);r.m_digits=i;k.add(k.createElementFromDigits(n),k.createElementFromDigits(t),r)}function yt(t,r){var e=t.length,o=i.p,u,f;if((t[0]&1)==1){for(u=0,f=0;f<e;f+=1)u+=t[f]+o[f],r[f]=u&n.DIGIT_MASK,u=u>>>n.DIGIT_BITS;u=u<<n.DIGIT_BITS-1;n.shiftRight(r,r);r[e-1]|=u}else n.shiftRight(t,r)}function s(n,t,i){v.montgomeryMultiply(n,t,i)}function y(n,t){v.montgomeryMultiply(n,n,t)}function ei(n,t){if(n.isInfinity){t.isInfinity=!0;return}y(n.z,r);s(n.z,n.y,o);h(n.x,r,f);e(n.x,r,r);t.z=o.slice();s(r,f,u);yt(u,f);h(u,f,r);y(n.y,f);y(r,o);s(n.x,f,u);e(o,u,o);e(o,u,t.x);e(u,t.x,o);y(f,u);s(r,o,f);e(f,u,t.y);t.isInfinity=!1;t.isInMontgomeryForm=!0}function oi(n,t){if(n.isInfinity){t.isInfinity=!0;return}y(n.y,u);y(n.x,o);h(o,o,l);h(l,o,o);s(n.x,u,c);y(u,l);yt(o,r);y(r,u);s(n.y,n.z,et);for(var i=0;i<et.length;i+=1)t.z[i]=et[i];e(u,c,t.x);e(t.x,c,t.x);e(c,t.x,o);s(r,o,f);e(f,l,t.y);t.isInfinity=!1;t.isInMontgomeryForm=!0}function pt(n,t){var o=t.clone(),i,e,r;if(nt(o),!gt(o))throw new Error("Invalid Parameter");i=t.clone();ct(i);var s=[t.clone()],u=i.clone(),f=i.clone();for(st(i,f),it(f),r=1;r<Math.pow(2,n-2);r++)bt(u,f,u),e=u.clone(),it(e),s[r]=e;return s}function st(n,t){if(typeof n=="undefined")throw new Error("point undefined");if(typeof t=="undefined")throw new Error("outputPoint undefined");if(n.isAffine)throw new Error("Given point was in Affine form. Use convertToJacobian() first.");if(!n.isInMontgomeryForm)throw new Error("Given point must be in Montgomery form. Use montgomeryize() first.");ui?oi(n,t):ei(n,t)}function wt(n,t,i){var v,a;if(n.isInfinity){t.copy(i);this.convertToJacobianForm(i);return}if(t.isInfinity){n.copy(i);return}for(y(n.z,c),s(n.z,c,w),s(t.x,c,o),s(t.y,w,c),e(o,n.x,r),e(c,n.y,f),y(f,o),y(r,w),s(w,n.x,c),s(r,w,l),e(o,c,u),e(u,c,u),s(n.z,r,o),e(u,c,u),s(l,n.y,w),e(u,l,u),v=!0,a=0;a<u.length;a++)if(u[1]!==0){v=!1;break}if(v){for(a=0;a<i.x.length;a++)i.x[a]=0,i.y[a]=0,i.z[a]=0;i.y[0]=1;return}h(w,w,r);s(o,u,i.z);s(f,u,o);y(u,l);h(r,o,r);s(l,c,o);y(r,vt);s(l,u,c);e(vt,o,i.x);e(i.x,o,i.x);e(i.x,c,i.x);e(i.x,o,u);s(c,w,l);s(r,u,o);e(o,l,i.y);i.isInfinity=!1;i.isInMontgomeryForm=!0}function bt(n,t,i){var v,p;if(n===null)throw new Error("jacobianPoint");if(t===null)throw new Error("affinePoint");if(i===null)throw new Error("outputPoint");if(n.curve!==t.curve||n.curve!==i.curve)throw new Error("All points must be from the same curve object.");if(n.isAffine)throw new Error("Given jacobianPoint was in Affine form. Use ConvertToJacobian() before calling DoubleJacobianAddAffinePoints().");if(!t.isAffine)throw new Error("Given affinePoint was in Jacobian form. Use ConvertToAffine() before calling DoubleJacobianAddAffinePoints().");if(i.isAffine)throw new Error("Given jacobianPoint was in Jacobian form. Use ConvertToJacobian() before calling DoubleJacobianAddAffinePoints().");if(!n.isInMontgomeryForm)throw new Error("Jacobian point must be in Montgomery form");if(!t.isInMontgomeryForm)throw new Error("Affine point must be in Montgomery form");if(n.isInfinity){t.copy(i);this.convertToJacobianForm(i);return}if(t.isInfinity){n.copy(i);return}for(y(n.z,r),s(r,n.z,f),s(r,t.x,u),s(f,t.y,o),e(u,n.x,r),e(o,n.y,f),v=0;v<r.length;v+=1)if(r[v]!==0){for(s(n.z,r,l),p=0;p<a;p+=1)i.z[p]=l[p];y(r,u);s(u,r,o);s(u,n.x,c);h(c,c,r);y(f,i.x);e(i.x,r,i.x);e(i.x,o,i.x);e(c,i.x,u);s(f,u,c);s(n.y,o,w);e(c,w,i.y);i.isInfinity=!1;i.isInMontgomeryForm=!0;return}for(v=0;v<f.length;v+=1)if(f[v]!==0){i.isInfinity=!0;i.isInMontgomeryForm=!0;return}t.copy(i);this.convertToJacobianForm(i);this.double(i,i);i.isInMontgomeryForm=!0}function kt(t,r,u,f){var e;if(r.isInfinity||n.isZero(t)){u.isInfinity=!0;return}if(n.compareDigits(t,i.order)>=0)throw new Error("The scalar k must be in the range 1 <= k < order.");if(t=t.slice(),r.curve.type===1)e=typeof r.ta!="undefined",e||lt(r),li(t,r,u,f),e||rt(r);else{var o=r.isInMontgomeryForm,s=u.isInMontgomeryForm,h=u.isAffine;o||ht(r);s||ht(u);si(t,r,u);h&&it(u);o||nt(r);s||nt(u)}return}function si(t,i,r){var w=i.clone(),c,o,u,p,h;if(nt(w),!gt(w))throw new Error("Invalid Parameters.");for(c=t[0]&1,o=[],e(i.curve.order,t,o),u=0;u<t.length;u++)t[u]=c-1&(t[u]^o[u])^t[u];var s=a<=8?5:6,k=i.curve.p.length*n.DIGIT_BITS,l=Math.ceil(k/(s-1)),v=n.fixedWindowRecode(t,s,l),b=pt(s,i),y=Math.floor(Math.abs(v[l])-1)/2,f=b[y].clone();for(ct(f),u=l-1;u>=0;u--){for(p=0;p<s-2;p++)st(f,f);y=Math.floor((Math.abs(v[u])-1)/2);h=hi(b,y);v[u]<0&&dt(h,h);wt(f,h,f)}for(e(i.curve.p,f.y,o),u=0;u<f.y.length;u++)f.y[u]=c-1&(f.y[u]^o[u])^f.y[u];f.copy(r);return}function hi(n,t){for(var u,i=(t+1)%n.length,r=0;r<n.length;r++)u=n[i].clone(),i=(i+1)%n.length;return u}function dt(n,t){n!==t&&n.copy(t);e(n.curve.p,n.y,t.y)}function ht(n){if(n.isInMontgomeryForm)throw new Error("The given point is already in Montgomery form.");n.isInfinity||(v.convertToMontgomeryForm(n.x),v.convertToMontgomeryForm(n.y),n.z!==null&&v.convertToMontgomeryForm(n.z),typeof n.ta!="undefined"&&(v.convertToMontgomeryForm(n.ta),v.convertToMontgomeryForm(n.tb)));n.isInMontgomeryForm=!0}function nt(n){if(!n.isInMontgomeryForm)throw new Error("The given point is not in montgomery form.");n.isInfinity||(v.convertToStandardForm(n.x),v.convertToStandardForm(n.y),n.z!==null&&v.convertToStandardForm(n.z),typeof n.ta!="undefined"&&(v.convertToStandardForm(n.ta),v.convertToStandardForm(n.tb)));n.isInMontgomeryForm=!1}function it(t){var u,r;if(t.isInfinity){t.z=null;ot||(t.isAffine=!0);return}for(n.modInv(t.z,i.p,b),t.isInMontgomeryForm&&(s(b,v.rCubedModm,d),u=b,b=d,d=u),y(b,g),s(t.x,g,d),r=0;r<a;r+=1)t.x[r]=d[r];s(t.y,g,d);s(d,b,t.y);t.z=null;delete t.ta;delete t.tb;ot||(t.isAffine=!0)}function ct(n){if(!n.isAffine)throw new Error("The given point is not in Affine form.");ot||(n.isAffine=!1);for(var u=n.isInMontgomeryForm?ft:fi,r=t(u.length),i=0;i<u.length;i+=1)r[i]=u[i];n.z=r;return}function gt(t){return t.isInfinity?!1:(n.modMul(t.y,t.y,t.curve.p,r),n.modMul(t.x,t.x,t.curve.p,f),n.modMul(t.x,f,t.curve.p,u),h(u,t.curve.b,f),n.modMul(t.x,t.curve.a,t.curve.p,u),h(f,u,f),e(r,f,r),n.isZero(r)==!1)?!1:!0}function ci(t){return(t.ta&&(t=t.clone(),rt(t)),n.modMul(t.y,t.y,t.curve.p,u),n.modMul(t.x,t.x,t.curve.p,f),n.add(f,u,r),n.reduce(o,t.curve.p,o),n.modMul(f,u,t.curve.p,o),n.modMul(t.curve.d,o,t.curve.p,u),n.add(u,[1],f),n.subtract(r,f,r),n.isZero(r)==!1)?!1:!0}function ni(n,t){var i=t.clone(),f=i.clone(),u=[],r;for(u[0]=ut(t),tt(i,i),f=ut(i),i=t.clone(),r=1;r<n;r++)at(f,i,i),u[r]=ut(i);return u}function lt(n){n.ta=n.x.slice();n.tb=n.y.slice();n.z=[1]}function li(t,i,r,u){var b,s,c,o,v,f,h;if(!ci(i))throw new Error("Invalid Parameter");b=i.curve.rbits;u=typeof u=="undefined"?!0:u;s=a<=8?5:6;c=Math.floor((b+(s-2))/(s-1));t=t.slice();f=i.clone();lt(f);u&&(tt(f,f),tt(f,f));var k=ni(1<<s-2,f),d=t[0]&1,l=[];for(e(i.curve.order,t,l),o=0;o<t.length;o++)t[o]=d-1&(t[o]^l[o])^t[o];var y=n.fixedWindowRecode(t,s,c),p=Math.floor(Math.abs(y[c])-1)/2,w=k[p];for(f.x=w.x.slice(),f.y=w.y.slice(),f.z=w.z.slice(),o=c-1;o>=0;o--){for(v=0;v<s-1;v++)tt(f,f);p=Math.floor((Math.abs(y[o])-1)/2);h=ai(k,p);y[o]<0&&(e(i.curve.p,h.x,h.x),e(i.curve.p,h.td,h.td));at(h,f,f)}for(e(i.curve.p,f.x,l),o=0;o<f.x.length;o++)f.x[o]=d-1&(f.x[o]^l[o])^f.x[o];rt(f);r.x=f.x.slice();r.y=f.y.slice();return}function ai(n,t){for(var u,i=(t+1)%n.length,r=0;r<n.length;r++)u={x:n[i].x.slice(),y:n[i].y.slice(),z:n[i].z.slice(),td:n[i].td.slice()},i=(i+1)%n.length;return u}function rt(t){n.modInv(t.z,i.p,b);n.modMul(t.x,b,i.p,t.x);n.modMul(t.y,b,i.p,t.y);delete t.ta;delete t.tb;t.z=null;return}function tt(t,i){if(typeof t.ta=="undefined")throw new Error("Point should be in Extended Projective form.");n.modMul(t.x,t.x,t.curve.p,l);n.modMul(t.y,t.y,t.curve.p,r);n.modMul(t.z,t.z,t.curve.p,t.ta);e(r,l,i.tb);h(l,r,l);h(t.ta,t.ta,t.ta);h(t.y,t.y,t.y);e(t.ta,l,r);n.modMul(t.x,t.y,t.curve.p,i.ta);n.modMul(l,i.tb,t.curve.p,i.y);n.modMul(r,i.ta,t.curve.p,i.x);n.modMul(l,r,t.curve.p,i.z);return}function vi(t,i,r){var f=n,e=t.curve.p,u;if(typeof t.ta=="undefined")throw new Error("Point1 should be in Extended Projective form.");if(typeof i.ta=="undefined")throw new Error("Point2 should be in Extended Projective form.");u=ut(t);at(u,i,r);return}function ut(t){var i=t.curve,r=i.p,u={x:t.x.slice(),y:t.y.slice(),z:t.z.slice(),td:[],curve:t.curve};return n.modMul(t.ta,t.tb,r,g),n.modMul(g,i.d,r,u.td),u}function at(t,i,o){var s=n,c=i.curve.p;r=[];f=[];u=[];s.modMul(i.z,t.z,c,u);s.modMul(i.ta,i.tb,c,r);h(i.x,i.y,i.ta);s.modMul(r,t.td,c,f);h(t.x,t.y,i.tb);e(u,f,r);h(u,f,u);s.modMul(i.ta,i.tb,c,f);s.modMul(i.x,t.x,c,i.z);s.modMul(i.y,t.y,c,i.x);e(f,i.z,f);e(i.x,i.z,o.ta);e(f,i.x,o.tb);s.modMul(o.ta,u,c,o.y);s.modMul(o.tb,r,c,o.x);s.modMul(u,r,c,o.z);return}function yi(t,i){var l=t.curve.a.slice(),a=t.curve.d.slice(),s=t.curve.p,c=n.modMul,v=n.modInv;r=[5];c(l,r,s,f);e(f,a,f);c(a,r,s,u);e(l,u,r);c(t.y,r,s,u);h(u,f,f);r=[1];e(r,t.y,u);r=[12];c(r,u,s,o);v(o,s,o);c(t.x,u,s,r);h(r,r,u);h(u,u,u);v(u,s,u);c(o,f,s,i.x);r=[1];h(t.y,r,r);e(l,a,f);c(r,f,s,o);c(o,u,s,i.y);return}function pi(t,i){var o=i.curve.a.slice(),s=i.curve.d.slice(),c=i.curve.p,l=n.modMul,a=n.modInv;h(t.x,t.x,r);h(t.x,r,r);h(r,r,r);e(r,o,f);e(f,s,f);h(t.y,t.y,u);h(t.y,u,u);h(u,u,u);a(u,c,u);l(f,u,c,i.x);h(r,r,r);h(r,s,f);h(r,o,r);h(o,o,u);e(f,u,f);e(f,u,f);e(f,o,f);h(s,s,u);e(r,u,r);e(r,u,r);e(r,s,r);a(r,c,r);l(r,f,c,i.y);return}var ti=i,ii=i.type===1,a=i.p.length,v=n.MontgomeryMultiplier(i.p),ri=i.a.slice(),p;v.convertToMontgomeryForm(ri);var ui=n.isZero(i.a),fi=n.One,ft=t(a);ft[0]=1;v.convertToMontgomeryForm(ft);var k=n.IntegerGroup(n.digitsToBytes(v.m),!0),l=t(a),r=t(a),f=t(a),u=t(a),o=t(a),c=t(a),w=t(a),vt=t(a),et=t(a),g=t(a),d=t(a),b=t(a);return p={convertToMontgomeryForm:ht,convertToStandardForm:nt,convertToAffineForm:it,convertToJacobianForm:ct,generatePrecomputationTable:function(n,t){return pt(n,t)}},ii?(p.double=tt,p.add=vi,p.scalarMultiply=kt,p.normalize=rt,p.convertToExtendedProjective=lt,p.convertTedToWeierstrass=yi,p.convertWeierstrassToTed=pi,p.generatePrecomputationTable=function(n,t){return ni(n,t)}):(p.double=st,p.mixedDoubleAdd=wt,p.mixedAdd=bt,p.scalarMultiply=kt,p.negate=dt),p},h=function(){return{encodePoint:function(i){var f,s,r;if(!i)throw new Error("point");if(!i.isAffine)throw new Error("Point must be in affine form.");if(i.isInMontgomeryForm)throw new Error("Point must not be in Montgomery form.");if(i.isInfinity)return t(1);var e=n.digitsToBytes(i.x),o=n.digitsToBytes(i.y),h=n.digitsToBytes(i.curve.p),u=h.length;if(u<e.length||u<o.length)throw new Error("Point coordinate(s) are bigger than the field order.");for(f=t(2*u+1),f[0]=4,s=u-e.length,r=0;r<e.length;r++)f[r+1+s]=e[r];for(s=u-o.length,r=0;r<o.length;r++)f[u+r+1+s]=o[r];return f},decodePoint:function(i,u){var h,e,o,s,f,c,l;if(i.length<1)throw new Error("Byte array must have non-zero length");if(h=n.digitsToBytes(u.p),e=h.length,i[0]===0&&i.length===1)return u.createPointAtInfinity();if(i[0]===4&&i.length===1+2*e){for(o=t(e),s=t(e),f=0;f<e;f++)o[f]=i[f+1],s[f]=i[e+f+1];return c=n.bytesToDigits(o),l=n.bytesToDigits(s),r(u,!1,c,l)}throw new Error("Unsupported encoding format");}}},c=function(t){function o(t){var i=n.intToDigits(0,16),f;return(u.modExp(t,r,i),f=[0],n.modMul(i,i,u.m,f),n.compareDigits(t,f)!==0)?null:i}var i=t,r=[],u,f,e;if(typeof t=="undefined")throw new Error("modulus");if(n.isEven(t))throw new Error("Only odd moduli are supported");return u=n.MontgomeryMultiplier(i),i[0]%4==3?(n.add(i,n.One,r),n.shiftRight(r,r,2)):r=null,f=new Array(i.length),e=new Array(i.length),{squareRoot:function(n){if(r!==null)return o(n);throw new Error("GeneralCase not supported.");},jacobiSymbol:function(t){var h=3,r,u,o,s,c,l,a;for(r=t.slice(),u=i.slice(),n.reduce(r,u,r,f,e),o=1;!n.isZero(r);){while(n.isEven(r))n.shiftRight(r,r),s=u[0]&7,(s===3||s===5)&&(o=-o);c=r;r=u;u=c;l=r[0]&h;a=u[0]&h;l===3&&a===3&&(o=-o);n.reduce(r,u,r,f,e)}return n.compareDigits(u,n.One)===0?o:0}}},f={},l=function(n){var t=f[n.toUpperCase()];if(!t)throw new Error(n+" Unsupported curve.");if(t.type===0)return e(t);if(t.type===1)return o(t);throw new Error(n+" Unsupported curve type.");};return{createCurve:l,curves:f,sec1EncodingFp:h,EllipticCurvePointFp:r,EllipticCurveOperatorFp:s,ModularSquareRootSolver:c}}function at(){function s(n){for(var t=n.length-1;t>=0;t-=1)if(n[t]+=1,n[t]>=256&&(n[t]=0),n[t])break}function h(){r=i.getVector(32);t=i.getVector(16);e=32;n=48;u=1}function c(t,r){var f,e;if(r=r||[0],r.length>n)throw new Error("Incorrect entropy or additionalEntropy length");for(r=r.concat(i.getVector(n-r.length)),t=t.concat(i.getVector((n-t.length%n)%n)),f=0;f<t.length;f+=n)e=i.xorVectors(t.slice(f,f+n),r),o(e);u=1}function o(u){for(var f=[],c=new k.aes(r),o,h;f.length<n;)s(t),o=t.slice(0,16),h=c.encrypt(o),f=f.concat(h);f=i.xorVectors(f,u);r=f.slice(0,e);t=f.slice(e)}function l(f,e){var h,c,l,v;if(f>=65536)throw new Error("too much random requested");if(u>a)throw new Error("Reseeding is required");if(e&&e.length>0){while(e.length<n)e=e.concat(i.getVector(n-e.length));o(e)}else e=i.getVector(n);for(h=[],c=new k.aes(r);h.length<f;)s(t),l=t.slice(0,t.length),v=c.encrypt(l),h=h.concat(v);return h=h.slice(0,f),o(e),u+=1,h}if(!(this instanceof at))throw new Error("create MsrcryptoPrng object with new keyword");var f=!1,r,t,e,n,u=1,a=16777216;return h(),{reseed:c,init:function(t,i){if(t.length<n)throw new Error("Initial entropy length too short");h();c(t,i);f=!0},getBytes:function(n,t){if(!f)throw new Error("can't get randomness before initialization");return l(n,t)},getNonZeroBytes:function(n,t){var r,u,i;if(!f)throw new Error("can't get randomness before initialization");for(r=[];r.length<n;)for(u=l(n,t),i=0;i<u.length;i+=1)u[i]!==0&&r.push(u[i]);return r.slice(0,n)}}}function ti(){function s(){for(var s=[],c,l,v,a,y,h=0;h<e;h+=1)s[h]=Math.floor(Math.random()*256);for(c=window.crypto||window.msCrypto,c&&typeof c.getRandomValues=="function"&&window.Uint8Array&&(l=new window.Uint8Array(e),c.getRandomValues(l),s=s.concat(Array.apply(null,l)),u=!0),v=new XMLHttpRequest,h=0;h<o.length;h+=1)try{a=v.getResponseHeader(o[h]);a&&(y=i.stringToBytes(a),s=s.concat(y))}catch(p){}u||(s=s.concat(n.splice(0,n.length)),f.startCollectors());r?t.reseed(s):t.init(s);r=!0}function h(t){for(var i=0;i<t.length;++i)n.push(t[i]);n.length>=c&&f.stopCollectors()}var e=48,n=[],c=128,l=0,t=new at,r=!1,u=!1,o=["Cookie","RedirectUri","ETag","x-ms-client-antiforgery-id","x-ms-client-request-id","x-ms-client-session-id","SubscriptionPool"],f=function(){return{startCollectors:function(){if(!this.collectorsRegistered){if(window.addEventListener)window.addEventListener("mousemove",this.MouseEventCallBack,!0),window.addEventListener("load",this.LoadTimeCallBack,!0);else if(document.attachEvent)document.attachEvent("onmousemove",this.MouseEventCallBack),document.attachEvent("onload",this.LoadTimeCallBack);else throw new Error("Can't attach events for entropy collection");this.collectorsRegistered=1}},stopCollectors:function(){this.collectorsRegistered&&(window.removeEventListener?(window.removeEventListener("mousemove",this.MouseEventCallBack,1),window.removeEventListener("load",this.LoadTimeCallBack,1)):window.detachEvent&&(window.detachEvent("onmousemove",this.MouseEventCallBack),window.detachEvent("onload",this.LoadTimeCallBack)),this.collectorsRegistered=0)},MouseEventCallBack:function(n){var t=(new Date).valueOf(),i=n.x||n.clientX||n.offsetX||0,r=n.y||n.clientY||n.offsetY||0,u=[t&255,t>>8&255,t>>16&255,t>>24&255,i&255,i>>8&255,r&255,r>>8&255];h(u)},LoadTimeCallBack:function(){var n=(new Date).valueOf(),t=[n&255,n>>8&255,n>>16&255,n>>24&255];h(t)}}}();return{init:function(){if(s(),!u&&!l)try{f.startCollectors()}catch(n){}},reseed:function(n){t.reseed(n)},read:function(n){if(!r)throw new Error("Entropy pool is not initialized.");var i=t.getBytes(n);return s(),i}}}var t={},c,n,vt,g,d,l,a,f,k,ht,w,e,v,h,s,p,r,nt,tt,b,ft,o,wt,lt,st,ut,kt;t.register=function(n,i,r){t[n]||(t[n]={});var u=t[n];u[i]||(u[i]=r)};t.exists=function(n,i){return t[n]?t[n][i]?!0:!1:!1};var yt=function(){if(typeof document!="undefined")try{throw new Error;}catch(t){if(t.stack){var n=/\w+:\/\/(.+?\/)*.+\.js/.exec(t.stack);return n&&n.length>0?n[0]:null}}else if(typeof self!="undefined")return self.location.href;return null}(),ui=!1,bt=typeof Worker!="undefined",ct=typeof importScripts!="undefined",fi=typeof Uint8Array!="undefined",ot=function(){try{return Object.defineProperty({},"oncomplete",{}),!0}catch(n){return!1}}(),it=bt,rt=function(n,t,i,r,u){if(!ot){n[t]=i;return}var f={};r&&(f.get=r);u&&(f.set=u);Object.defineProperty(n,t,f)},y={},i=function(){function f(t,r){var f="",h,e,o,l,a,c,s,u;if(r||(r=!1),(t.pop||t.subarray)&&(t=String.fromCharCode.apply(null,t)),i)f=btoa(t);else for(u=0;u<t.length;u+=3)h=t.charCodeAt(u),e=t.charCodeAt(u+1),o=t.charCodeAt(u+2),l=h>>2,a=(h&3)<<4|e>>4,c=(e&15)<<2|o>>6,s=o&63,isNaN(e)?c=s=64:isNaN(o)&&(s=64),f=f+n.charAt(l)+n.charAt(a)+n.charAt(c)+n.charAt(s);return r?f.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,""):f}function e(n){if(i){for(n=n.replace(/-/g,"+").replace(/_/g,"/");n.length%4!=0;)n+="=";return atob(n)}return String.fromCharCode.apply(null,t(n))}function t(t){for(t=t.replace(/-/g,"+").replace(/_/g,"/");t.length%4!=0;)t+="=";var r=[],o,s,h,c,f,u,e,i;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),i=0;i<t.length;i+=4)c=n.indexOf(t.charAt(i)),f=n.indexOf(t.charAt(i+1)),u=n.indexOf(t.charAt(i+2)),e=n.indexOf(t.charAt(i+3)),o=c<<2|f>>4,s=(f&15)<<4|u>>2,h=(u&3)<<6|e,r.push(o),u!==64&&r.push(s),e!==64&&r.push(h);return r}function r(n){return Object.prototype.toString.call(n).slice(8,-1)}function o(n,t){var r="",i,u;for(typeof t=="undefined"&&(t=!1),i=0;i<n.length;i++)t&&i%4==0&&i!==0&&(r+="-"),u=n[i].toString(16).toUpperCase(),u.length===1&&(r+="0"),r+=u;return r}function s(n,t){return t=t||0,n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3]}function h(n){for(var i=new Array(n.length),t=0;t<i.length;t++)i[t]=n.charCodeAt(t);return i}function c(n){n=n.replace(/\-/g,"");for(var t=[];n.length>=2;)t.push(parseInt(n.substring(0,2),16)),n=n.substring(2,n.length);return t}function l(n){var i={};for(var t in n)n.hasOwnProperty(t)&&(i[t]=n[t]);return i}function a(n,i,r){var e=t(n),f=[],u;if(isNaN(i))return e;for(u=0;u<e.length;u+=i)f.push(e.slice(u,u+i));if(r)for(u=0;u<f.length;u++)f[u]=(f[u][0]<<24)+(f[u][1]<<16)+(f[u][2]<<8)+f[u][3];return f}function u(n){return[n>>>24&255,n>>>16&255,n>>>8&255,n&255]}function v(n){for(var t=[],i=0;i<n.length;i++)t=t.concat(u(n[i]));return t}function y(n,t){for(var r=Math.min(n.length,t.length),u=new Array(r),i=0;i<r;i+=1)u[i]=n[i]^t[i];return u}function p(n,t){var r,i;for(t||(t=0),r=new Array(n),i=0;i<n;i+=1)r[i]=t;return r}function w(n){return n?n.pop?n:(n.isView&&(n=Uint8Array(n)),n.length===1?[n[0]]:Array.apply(null,n)):[]}function b(n,t,i){while(n.length<i)n.push(t);return n}function k(n,t,i){while(n.length<i)n.unshift(t);return n}function d(n,t){var r=!0,i;for(n.length!==t.length&&(r=!1),i=0;i<n.length;i++)n[i]!==t[i]&&(r=!1);return r}function g(n){var t,i;if(r(n)!=="Array")return!1;for(i=0;i<n.length;i++)if(t=n[i],isNaN(t)||t<0||t>255)return!1;return!0}var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=typeof btoa!="undefined";return{toBase64:f,base64ToString:e,base64ToBytes:t,getObjectType:r,bytesToHexString:o,bytesToInt32:s,stringToBytes:h,unpackData:a,hexToBytesArray:c,int32ToBytes:u,int32ArrayToBytes:v,toArray:w,arraysEqual:d,clone:l,xorVectors:y,padEnd:b,padFront:k,getVector:p,verifyByteArray:g}}(),pt=function(){function n(n){return ct&&self.postMessage(n),n}return{jsCryptoRunner:function(i){var e=i.data.operationType,u,f,r;if(!t.exists(e,i.data.algorithm.name))throw new Error("unregistered algorithm.");return f=t[e][i.data.algorithm.name],r=i.data,r.operationSubType==="process"?(f(r),u=n({type:"process"})):u=n(f(r)),u}}}();ct&&(self.onmessage=function(n){if(n.data.prngSeed){var t=n.data.prngSeed;s.init(t);return}pt.jsCryptoRunner(n)});c=function(){function r(n){for(var t=[],i=0;i<n.length;i++)t[i]=n.charCodeAt(i);return t[t.length-1]===0&&t.pop(),t}function t(n){var t=n.algorithm.name.slice(0,3).toLowerCase();return t==="rsa"?"RSA":t==="ecd"?"EC":"oct"}function f(i,r){var f={},e;if(f.kty=t(i),f.ext=i.extractable,f.alg=u[i.algorithm.name.toLowerCase()](i.algorithm),f.key_ops=i.keyUsage,r.pop)f.k=n.toBase64(r,!0);else for(e in r)r[e].pop&&(f[e]=n.toBase64(r[e],!0));return i.algorithm.namedCurve&&(f.crv=i.algorithm.namedCurve),f}function e(i,u){var f={},e,o;if(f.kty=t(i),f.extractable=i.extractable,u.pop)f.k=n.toBase64(u,!0);else for(e in u)u[e].pop&&(f[e]=n.toBase64(u[e],!0));return i.algorithm.namedCurve&&(f.crv=i.algorithm.namedCurve),o=JSON.stringify(f,null,"\t"),r(o)}function o(t,i,r){for(var e,f=JSON.parse(JSON.stringify(t)),u=0;u<r.length;u+=1)e=f[r[u]],e&&(f[r[u]]=n.base64ToBytes(e));return f}var n=i,u={hmac:function(n){return"HS"+n.hash.name.substring(n.hash.name.indexOf("-")+1)},"aes-cbc":function(n){return"A"+n.length.toString()+"CBC"},"aes-gcm":function(n){return"A"+n.length.toString()+"GCM"},"rsaes-pkcs1-v1_5":function(){return"RSA1_5"},"rsassa-pkcs1-v1_5":function(n){return"RS"+n.hash.name.substring(n.hash.name.indexOf("-")+1)},"rsa-oaep":function(n){return"RS-OAEP-"+n.hash.name.substring(n.hash.name.indexOf("-")+1)},"rsa-pss":function(n){return"PS-"+n.hash.name.substring(n.hash.name.indexOf("-")+1)},ecdsa:function(n){return"EC-"+n.namedCurve.substring(n.namedCurve.indexOf("-")+1)}};return{keyToJwkOld:e,keyToJwk:f,jwkToKey:o}}();n=n||gt();var u=u||ii();typeof u!="undefined"&&(u.curves["P-256"]={name:"P-256",type:0,p:[255,255,255,255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255],a:[255,255,255,255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,252],b:[90,198,53,216,170,58,147,231,179,235,189,85,118,152,134,188,101,29,6,176,204,83,176,246,59,206,60,62,39,210,96,75],order:[255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81],gx:[107,23,209,242,225,44,66,71,248,188,230,229,99,164,64,242,119,3,125,129,45,235,51,160,244,161,57,69,216,152,194,150],gy:[79,227,66,226,254,26,127,155,142,231,235,74,124,15,158,22,43,206,51,87,107,49,94,206,203,182,64,104,55,191,81,245],cf:1},u.curves["P-384"]={name:"P-384",type:0,p:[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255],a:[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,252],b:[179,49,47,167,226,62,231,228,152,142,5,107,227,248,45,25,24,29,156,110,254,129,65,18,3,20,8,143,80,19,135,90,198,86,57,141,138,46,209,157,42,133,200,237,211,236,42,239],order:[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115],gx:[170,135,202,34,190,139,5,55,142,177,199,30,243,32,173,116,110,29,59,98,139,167,155,152,89,247,65,224,130,84,42,56,85,2,242,93,191,85,41,108,58,84,94,56,114,118,10,183],gy:[54,23,222,74,150,38,44,111,93,158,152,191,146,146,220,41,248,244,29,189,40,154,20,124,233,218,49,19,181,240,184,192,10,96,177,206,29,126,129,157,122,67,29,124,144,234,14,95],cf:1},u.curves["P-521"]={name:"P-521",type:0,p:[16,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],a:[16,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252],b:[81,149,62,185,97,142,28,154,31,146,154,33,160,182,133,64,238,162,218,114,91,153,179,21,243,184,180,137,145,142,241,144,225,86,25,57,81,236,126,147,123,22,82,192,189,59,177,191,112,53,115,223,136,61,44,52,241,239,69,31,212,107,80,63,0],order:[16,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,16,72,247,144,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,144],gx:[198,133,142,96,183,64,64,233,205,158,62,203,102,35,149,180,66,156,100,129,57,80,63,181,33,248,40,175,96,107,77,61,186,161,75,94,119,239,231,89,40,254,29,193,39,162,255,168,222,51,72,179,193,133,106,66,155,249,126,126,49,194,229,189,102],gy:[16,24,57,41,106,120,154,59,192,64,92,138,95,180,44,125,27,217,152,245,68,73,87,155,68,104,23,175,189,23,39,62,102,44,151,238,114,153,94,244,38,64,197,80,185,16,63,173,112,97,53,60,112,134,162,114,194,64,136,190,148,118,159,209,102,80],cf:1});vt={name:"BN-254",type:0,p:[37,35,100,130,64,0,0,1,186,52,77,128,0,0,0,8,97,33,0,0,0,0,0,19,167,0,0,0,0,0,0,19],a:[0],b:[2],order:[37,35,100,130,64,0,0,1,186,52,77,128,0,0,0,7,255,159,128,0,0,0,0,16,161,0,0,0,0,0,0,13],gx:[37,35,100,130,64,0,0,1,186,52,77,128,0,0,0,8,97,33,0,0,0,0,0,19,167,0,0,0,0,0,0,18],gy:[1],cf:1};typeof u!="undefined"&&(u.curves["BN-254"]=vt);var dt={info:["numsp256d1",256,256,256],type:0,p:[67,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),a:[64,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),b:[129,85,2].reverse(),order:[37,168,81,71,41,32,171,32,96,92,38,234,117,130,60,228,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),gx:[177,172,26,178,30,238,82,188,58,199,212,3,9,155,87,131,9,203,66,79,160,149,122,41,97,219,170,90,182,214,158,188].reverse(),gy:[159,222,132,33,203,185,181,128,187,15,49,21,209,195,85,201,53,224,4,126,247,139,68,115,166,182,153,51,241,192,143,208].reverse(),cf:1},ri={info:["numsp256t1",256,255,256],name:"numsp256t1",type:1,p:[67,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),a:[1],d:[85,195,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),order:[245,74,221,238,144,177,71,26,155,67,89,47,165,90,149,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64].reverse(),gx:[218,19,237,46,144,192,222,160,134,53,8,227,14,138,57,12,214,155,32,105,95,61,30,205,125,35,234,106,251,20,117,138].reverse(),gy:[230,137,138,121,231,22,166,47,211,110,133,16,216,97,95,113,16,128,75,166,217,101,150,206,199,37,217,217,159,62,213,68].reverse(),cf:4},ei={info:["numsp384d1",384,384,384],name:"numsp384d1",type:0,p:[195,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),a:[192,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),b:[187,119,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),order:[185,97,14,123,246,129,77,96,122,226,55,76,61,157,218,190,129,104,93,235,30,175,30,214,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),gx:[42,21,152,32,4,186,156,235,123,196,97,15,16,237,46,82,66,199,108,42,27,41,189,243,244,249,129,251,205,193,37,2,166,241,5,65,34,202,128,72,28,24,111,177,240,86,121,117].reverse(),gy:[22,7,24,102,236,184,116,92,38,173,244,191,219,180,214,188,126,131,26,18,125,131,32,185,156,115,127,248,119,105,4,176,126,207,132,5,48,61,227,215,56,142,155,225,104,227,222,172].reverse(),cf:1},oi={info:["numsp384t1",384,382,384],name:"numsp384t1",type:1,p:[195,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),a:[1],d:[159,209,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255].reverse(),order:[125,137,163,230,196,220,185,32,121,200,53,171,90,85,228,97,207,225,107,180,28,26,71,226,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63].reverse(),gx:[222,107,32,108,228,64,213,80,19,148,69,101,177,146,242,111,64,99,49,243,168,255,99,87,0,76,190,229,70,244,11,179,181,93,229,154,18,162,182,192,108,38,169,69,251,17,177,97].reverse(),gy:[146,147,114,240,225,3,141,157,220,72,236,70,249,176,114,0,75,150,69,246,247,152,15,131,86,95,66,241,116,130,173,22,215,13,177,35,164,177,56,135,176,238,166,185,103,62,152,130].reverse(),cf:4};typeof u!="undefined"&&(u.curves.NUMSP256D1=dt,u.curves.NUMSP384D1=ei,u.curves.NUMSP256T1=ri,u.curves.NUMSP384T1=oi);g=function(n,t,r,u,f,e,o){function l(n){for(var t=Math.floor(n.length/f),i=0;i<t;i++)e(n,i,h,u,y);return c+=t,n.slice(t*f)}function p(){for(var n=[],t=0;t<h.length;t++)n=n.concat(a.int32ToBytes(h[t]));return n.length=o/8,n}function w(n){var t=f-n.length%f,i,r;return t<=f/8&&(t+=f),i=a.getVector(t),i[0]=128,r=(n.length+c*f)*8,i[t-4]=r>>>24&255,i[t-3]=r>>>16&255,i[t-2]=r>>>8&255,i[t-1]=r&255,n.concat(i)}function b(n){return s=l(n),v()}function k(n){s=s.concat(n);s.length>=f&&(s=l(s));return}function v(){if(l(w(s)).length!==0)throw new Error("buffer.length !== 0");var n=p();return s=[],h=r.slice(),c=0,n}var a=i,h=r.slice(),y=new Array(f),s=[],c=0;return{name:n,computeHash:b,process:k,finish:v,der:t,hashLen:o,maxMessageSize:4294967295}};d=function(){function r(n,i,r,u,f){for(var s,v,y,l=4294967295,a=r[0],o=r[1],h=r[2],c=r[3],p=r[4],e=0;e<16;e++)f[e]=t.bytesToInt32(n,i*64+e*4);for(s=16;s<80;s++)y=f[s-3]^f[s-8]^f[s-14]^f[s-16],f[s]=y<<1|y>>>31;for(e=0;e<80;e++)v=a<<5|a>>>27,v+=e>=60?o^h^c:e>=40?o&h^o&c^h&c:e>=20?o^h^c:o&h^~o&c,v+=p+u[e]+f[e],p=c,c=h,h=o<<30|o>>>2,o=a,a=v;return r[0]+=a&l,r[1]+=o&l,r[2]+=h&l,r[3]+=c&l,r[4]+=p&l,r}var t=i,n=t.unpackData,u=n("Z0UjAe/Nq4mYutz+EDJUdsPS4fA=",4,1),f=n("WoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroY8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdY",4,1),e=n("MCEwCQYFKw4DAhoFAAQU");return{sha1:g("SHA-1",e,u,f,64,r,160)}}();typeof t!="undefined"&&(d.hash=function(n){if(n.operationSubType==="process"){d.sha1.process(n.buffer);return}return n.operationSubType==="finish"?d.sha1.finish():d.sha1.computeHash(n.buffer)},t.register("digest","sha-1",d.hash));y["sha-1"]=d.sha1;l=function(){function u(n,t,i,u,f){for(var o,p,l,a,c=4294967295,h=i[0],v=i[1],y=i[2],w=i[3],e=i[4],b=i[5],k=i[6],d=i[7],s=0;s<16;s++)f[s]=r.bytesToInt32(n,t*64+s*4);for(o=16;o<64;o++)l=f[o-15],a=f[o-2],f[o]=((a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10)+f[o-7]+((l>>>7|l<<25)^(l>>>18|l<<14)^l>>>3)+f[o-16],f[o]=f[o]&c;for(s=0;s<64;s++)p=d+((e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7))+(e&b^~e&k)+u[s]+f[s],w+=p,p+=((h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10))+(h&(v^y)^v&y),d=k,k=b,b=e,e=w,w=y,y=v,v=h,h=p;return i[0]+=h&c,i[1]+=v&c,i[2]+=y&c,i[3]+=w&c,i[4]+=e&c,i[5]+=b&c,i[6]+=k&c,i[7]+=d&c,i}var r=i,t,f,e,o,s,n=r.unpackData;return f=n("wQWe2DZ81QcwcN0X9w5ZOf/ACzFoWBURZPmPp776T6Q",4,1),e=n("agnmZ7tnroU8bvNypU/1OlEOUn+bBWiMH4PZq1vgzRk",4,1),t=n("QoovmHE3RJG1wPvP6bXbpTlWwltZ8RHxkj+CpKscXtXYB6qYEoNbASQxhb5VDH3Dcr5ddIDesf6b3AanwZvxdOSbacHvvkeGD8GdxiQMocwt6SxvSnSEqlywqdx2+YjamD5RUqgxxm2wAyfIv1l/x8bgC/PVp5FHBspjURQpKWcntwqFLhshOE0sbfxTOA0TZQpzVHZqCruBwskuknIshaK/6KGoGmZLwkuLcMdsUaPRkugZ1pkGJPQONYUQaqBwGaTBFh43bAgnSHdMNLC8tTkcDLNO2KpKW5zKT2gub/N0j4LueKVjb4TIeBSMxwIIkL7/+qRQbOu++aP3xnF48g",4,1),o=n("MC0wDQYJYIZIAWUDBAIEBQAEHA"),s=n("MDEwDQYJYIZIAWUDBAIBBQAEIA"),{sha224:g("SHA-224",o,f,t,64,u,224),sha256:g("SHA-256",s,e,t,64,u,256)}}();typeof t!="undefined"&&(l.hash256=function(n){if(n.operationSubType==="process"){l.sha256.process(n.buffer);return}return n.operationSubType==="finish"?l.sha256.finish():l.sha256.computeHash(n.buffer)},l.hash224=function(n){if(n.operationSubType==="process"){l.sha224.process(n.buffer);return}return n.operationSubType==="finish"?l.sha224.finish():l.sha224.computeHash(n.buffer)},t.register("digest","sha-224",l.hash224),t.register("digest","sha-256",l.hash256));y["sha-224"]=l.sha224;y["sha-256"]=l.sha256;a=function(){function n(n,t,i,r,u){var f=t+r|0,e=f>>>0<r>>>0;u[0]=n+i+e|0;u[1]=f;return}function u(t,i,r,u,f){for(var b,a,v,k,d,s,h,e=[],ht=[],w=[],ct,y=r[0],p=r[1],g=r[2],nt=r[3],tt=r[4],it=r[5],rt=r[6],ut=r[7],c=r[8],l=r[9],ft=r[10],et=r[11],ot=r[12],st=r[13],lt=r[14],at=r[15],o=0;o<32;o++)ct=i*128+o*4,f[o]=t.slice(ct,ct+4),f[o]=f[o][0]<<24|f[o][1]<<16|f[o][2]<<8|f[o][3];for(o=32;o<160;o+=2)s=f[o-30],h=f[o-29],a=(s>>>1|h<<31)^(s>>>8|h<<24)^s>>>7,v=(h>>>1|s<<31)^(h>>>8|s<<24)^(h>>>7|s<<25),s=f[o-4],h=f[o-3],k=(s>>>19|h<<13)^(h>>>29|s<<3)^s>>>6,d=(h>>>19|s<<13)^(s>>>29|h<<3)^(h>>>6|s<<26),n(k,d,f[o-14],f[o-13],e),n(a,v,e[0],e[1],e),n(f[o-32],f[o-31],e[0],e[1],e),f[o]=e[0],f[o+1]=e[1];for(b=0;b<160;b+=2)a=(c>>>14|l<<18)^(c>>>18|l<<14)^(l>>>9|c<<23),v=(l>>>14|c<<18)^(l>>>18|c<<14)^(c>>>9|l<<23),k=c&ft^ot&~c,d=l&et^st&~l,n(lt,at,a,v,e),n(k,d,u[b],u[b+1],ht),n(e[0],e[1],f[b],f[b+1],w),n(ht[0],ht[1],w[0],w[1],w),n(w[0],w[1],rt,ut,e),rt=e[0],ut=e[1],v=(p>>>28|y<<4)^(y>>>2|p<<30)^(y>>>7|p<<25),a=(y>>>28|p<<4)^(p>>>2|y<<30)^(p>>>7|y<<25),d=p&(nt^it)^nt&it,k=y&(g^tt)^g&tt,n(w[0],w[1],a,v,e),a=e[0],v=e[1],n(k,d,a,v,e),a=e[0],v=e[1],lt=ot,at=st,ot=ft,st=et,ft=c,et=l,c=rt,l=ut,rt=tt,ut=it,tt=g,it=nt,g=y,nt=p,y=a,p=v;return n(r[0],r[1],y,p,e),r[0]=e[0],r[1]=e[1],n(r[2],r[3],g,nt,e),r[2]=e[0],r[3]=e[1],n(r[4],r[5],tt,it,e),r[4]=e[0],r[5]=e[1],n(r[6],r[7],rt,ut,e),r[6]=e[0],r[7]=e[1],n(r[8],r[9],c,l,e),r[8]=e[0],r[9]=e[1],n(r[10],r[11],ft,et,e),r[10]=e[0],r[11]=e[1],n(r[12],r[13],ot,st,e),r[12]=e[0],r[13]=e[1],n(r[14],r[15],lt,at,e),r[14]=e[0],r[15]=e[1],r}var l=i,e,f,r,o,s,h,c,t=l.unpackData;return e=t("y7udXcEFnthimikqNnzVB5FZAVowcN0XFS/s2PcOWTlnMyZn/8ALMY60SodoWBUR2wwuDWT5j6dHtUgdvvpPpA==",4,1),f=t("agnmZ/O8yQi7Z66FhMqnOzxu83L+lPgrpU/1Ol8dNvFRDlJ/reaC0ZsFaIwrPmwfH4PZq/tBvWtb4M0ZE34heQ",4,1),r=t("QoovmNcoriJxN0SRI+9lzbXA+8/sTTsv6bXbpYGJ27w5VsJb80i1OFnxEfG2BdAZkj+CpK8ZT5urHF7V2m2BGNgHqpijAwJCEoNbAUVwb74kMYW+TuSyjFUMfcPV/7Ticr5ddPJ7iW+A3rH+OxaWsZvcBqclxxI1wZvxdM9pJpTkm2nBnvFK0u++R4Y4TyXjD8GdxouM1bUkDKHMd6ycZS3pLG9ZKwJ1SnSEqm6m5INcsKncvUH71Hb5iNqDEVO1mD5RUu5m36uoMcZtLbQyELADJ8iY+yE/v1l/x77vDuTG4AvzPaiPwtWnkUeTCqclBspjUeADgm8UKSlnCg5ucCe3CoVG0i/8LhshOFwmySZNLG38WsQq7VM4DROdlbPfZQpzVIuvY952agq7PHeyqIHCyS5H7a7mknIshRSCNTuiv+ihTPEDZKgaZku8QjABwkuLcND4l5HHbFGjBlS+MNGS6BnW71IY1pkGJFVlqRD0DjWFV3EgKhBqoHAyu9G4GaTBFrjS0MgeN2wIUUGrUydId0zfjuuZNLC8teGbSKg5HAyzxclaY07YqkrjQYrLW5zKT3dj43NoLm/z1rK4o3SPgu5d77L8eKVjb0MXL2CEyHgUofCrcozHAggaZDnskL7/+iNjHiikUGzr3oK96b75o/eyxnkVxnF48uNyUyvKJz7O6iZhnNGGuMchwMIH6tp91s3g6x71fU9/7m7ReAbwZ6pyF2+6CmN9xaLImKYRP5gEvvkNrhtxCzUTHEcbKNt39SMEfYQyyqt7QMckkzyevgoVyb68Qx1nxJwQDUxMxdS+yz5Ctll/KZz8ZX4qX8tvqzrW+uxsRBmMSkdYFw==",4,1),o=t("MEEwDQYJYIZIAWUDBAICBQAEMA"),s=t("MFEwDQYJYIZIAWUDBAIDBQAEQA"),h=t("MC0wDQYJYIZIAWUDBAIFBQAEHA"),c=t("MDEwDQYJYIZIAWUDBAIGBQAEIA"),{sha384:g("SHA-384",o,e,r,128,u,384),sha512:g("SHA-512",s,f,r,128,u,512),sha512_224:g("SHA-512.224",h,f,r,128,u,224),sha512_256:g("SHA-512.256",c,f,r,128,u,256)}}();typeof t!="undefined"&&(a.hash384=function(n){if(n.operationSubType==="process"){a.sha384.process(n.buffer);return}return n.operationSubType==="finish"?a.sha384.finish():a.sha384.computeHash(n.buffer)},a.hash512=function(n){if(n.operationSubType==="process"){a.sha512.process(n.buffer);return}return n.operationSubType==="finish"?a.sha512.finish():a.sha512.computeHash(n.buffer)},t.register("digest","sha-384",a.hash384),t.register("digest","sha-512",a.hash512));y["sha-384"]=a.sha384;y["sha-512"]=a.sha512;f=function(){function v(n,t){for(var r=new Array(n),i=0;i<n.length;i++)r[i]=n[i]^t[i];return r}function y(n,t){for(var i=n.slice(),r=n.length;r<t;r++)i.push(0);return i}function k(){return i.length===t?i:i.length>t?y(n.computeHash(i),t):y(i,t)}function h(i){var f,e,u;if(r)n.process(i);else{for(o=new Array(t),s=new Array(t),u=0;u<t;u++)o[u]=54,s[u]=92;r=k();f=v(r,o);p=v(r,s);e=f.concat(i);n.process(e)}return}function w(){var t=n.finish(),i=p.concat(t);return n.computeHash(i)}function b(){i=null;n=null;r=null}function c(i){switch(i.toLowerCase()){case"sha-1":if(e===undefined)throw new Error("Sha1 object not found");n=e.sha1;t=64;break;case"sha-224":n=f.sha224;t=64;break;case"sha-256":n=f.sha256;t=64;break;case"sha-384":if(u===undefined)throw new Error("Sha512 object not found");n=u.sha384;t=128;break;case"sha-512":if(u===undefined)throw new Error("Sha512 object not found");n=u.sha512;t=128;break;default:throw new Error("unsupported hash alorithm (sha-224, sha-256, sha-384, sha-512)");}}var f,u,e,n,t,i,o,s,r,p;return typeof l!="undefined"&&(f=l),typeof a!="undefined"&&(u=a),typeof d!="undefined"&&(e=d),r=null,{computeHmac:function(n,t,r){i=t;c(r);h(n);var u=w();return b(),u},process:function(t,r,u){n||(i=r,c(u));h(t)},finish:function(t,r){n||(i=t,c(r),h([]));var u=w();return b(),u}}}();typeof t!="undefined"&&(f.signHmac=function(n){var t=n.algorithm.hash.name;if(n.operationSubType==="process"){f.process(n.buffer,n.keyData,t);return}return n.operationSubType==="finish"?f.finish(n.keyData,t):f.computeHmac(n.buffer,n.keyData,t)},f.verifyHmac=function(n){var t=n.algorithm.hash.name;if(n.operationSubType==="process"){f.process(n.buffer,n.keyData,t);return}return n.operationSubType==="finish"?i.arraysEqual(f.finish(n.keyData,t),n.signature):i.arraysEqual(f.computeHmac(n.buffer,n.keyData,t),n.signature)},f.generateKey=function(n){var t=n.algorithm.length;return t||(t={"sha-256":32,"sha-384":48,"sha-512":64}[n.algorithm.hash.name.toLowerCase()]),{type:"keyGeneration",keyData:s.getBytes(t),keyHandle:{algorithm:n.algorithm,extractable:n.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},f.importKey=function(n){var t=c.jwkToKey(n.keyData,n.algorithm,["k"]);return t.alg=t.alg.replace("HS","sha-"),{type:"keyImport",keyData:t.k,keyHandle:{algorithm:{name:"hmac",hash:{name:t.alg}},extractable:n.extractable||t.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},f.exportKey=function(n){var t=c.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("importKey","hmac",f.importKey),t.register("exportKey","hmac",f.exportKey),t.register("generateKey","hmac",f.generateKey),t.register("sign","hmac",f.signHmac),t.register("verify","hmac",f.verifyHmac));k=function(){var o,n,t,r,u,f,e,s,h,c;return{aes:function(l){var d,b,a,p,v,y;o||(o=i.unpackData("AAIEBggKDA4QEhQWGBocHiAiJCYoKiwuMDI0Njg6PD5AQkRGSEpMTlBSVFZYWlxeYGJkZmhqbG5wcnR2eHp8foCChIaIioyOkJKUlpianJ6goqSmqKqsrrCytLa4ury+wMLExsjKzM7Q0tTW2Nrc3uDi5Obo6uzu8PL09vj6/P4bGR8dExEXFQsJDw0DAQcFOzk/PTMxNzUrKS8tIyEnJVtZX11TUVdVS0lPTUNBR0V7eX99c3F3dWtpb21jYWdlm5mfnZORl5WLiY+Ng4GHhbu5v72zsbe1q6mvraOhp6Xb2d/d09HX1cvJz83DwcfF+/n//fPx9/Xr6e/t4+Hn5QADBgUMDwoJGBseHRQXEhEwMzY1PD86OSgrLi0kJyIhYGNmZWxvaml4e359dHdycVBTVlVcX1pZSEtOTURHQkHAw8bFzM/Kydjb3t3U19LR8PP29fz/+vno6+7t5Ofi4aCjpqWsr6qpuLu+vbS3srGQk5aVnJ+amYiLjo2Eh4KBm5idnpeUkZKDgIWGj4yJiquora6npKGis7C1tr+8ubr7+P3+9/Tx8uPg5ebv7Onqy8jNzsfEwcLT0NXW39zZ2ltYXV5XVFFSQ0BFRk9MSUpraG1uZ2RhYnNwdXZ/fHl6Ozg9Pjc0MTIjICUmLywpKgsIDQ4HBAECExAVFh8cGRoADhwSODYkKnB+bGJIRlRa4O788tjWxMqQnoyCqKa0utvVx8nj7f/xq6W3uZOdj4E7NScpAw0fEUtFV1lzfW9hraOxv5WbiYfd08HP5ev5901DUV91e2lnPTMhLwULGRd2eGpkTkBSXAYIGhQ+MCIslpiKhK6gsrzm6Pr03tDCzEFPXVN5d2VrMT8tIwkHFRuhr72zmZeFi9HfzcPp5/X7mpSGiKKsvrDq5Pb40tzOwHp0ZmhCTF5QCgQWGDI8LiDs4vD+1NrIxpySgI6kqri2DAIQHjQ6KCZ8cmBuREpYVjc5KyUPARMdR0lbVX9xY23X2cvF7+Hz/aepu7WfkYONAA0aFzQ5LiNoZXJ/XFFGS9Ddysfk6f7zuLWir4yBlpu7tqGsj4KVmNPeycTn6v3wa2ZxfF9SRUgDDhkUNzotIG1gd3pZVENOBQgfEjE8Kya9sKeqiYSTntXYz8Lh7Pv21tvMweLv+PW+s6SpioeQnQYLHBEyPyglbmN0eVpXQE3a18DN7uP0+bK/qKWGi5yRCgcQHT4zJClib3h1VltMQWFse3ZVWE9CCQQTHj0wJyqxvKumhYifktnUw87t4Pf6t7qtoIOOmZTf0sXI6+bx/GdqfXBTXklEDwIVGDs2ISwMARYbODUiL2RpfnNQXUpH3NHGy+jl8v+0ua6jgI2alwALFh0sJzoxWFNORXR/Ymmwu6atnJeKgejj/vXEz9LZe3BtZldcQUojKDU+DwQZEsvA3dbn7PH6k5iFjr+0qaL2/eDr2tHMx66luLOCiZSfRk1QW2phfHceFQgDMjkkL42Gm5Chqre81d7DyPny7+Q9NisgERoHDGVuc3hJQl9U9/zh6tvQzcavpLmyg4iVnkdMUVprYH12HxQJAjM4JS6Mh5qRoKu2vdTfwsn48+7lPDcqIRAbBg1kb3J5SENeVQEKFxwtJjswWVJPRHV+Y2ixuqesnZaLgOni//TFztPYenFsZ1ZdQEsiKTQ/DgUYE8rB3Nfm7fD7kpmEj761qKMACRIbJC02P0hBWlNsZX53kJmCi7S9pq/Y0crD/PXu5zsyKSAfFg0Ec3phaFdeRUyrormwj4adlOPq8fjHztXcdn9kbVJbQEk+NywlGhMIAebv9P3Cy9DZrqe8tYqDmJFNRF9WaWB7cgUMFx4hKDM63dTPxvnw6+KVnIeOsbijquzl/vfIwdrTpK22v4CJkpt8dW5nWFFKQzQ9Ji8QGQIL197FzPP64eiflo2Eu7KpoEdOVVxjanF4DwYdFCsiOTCak4iBvrespdLbwMn2/+TtCgMYES4nPDVCS1BZZm90faGos7qFjJee6eD78s3E39YxOCMqFRwHDnlwa2JdVE9GY3x3e/Jrb8UwAWcr/terdsqCyX36WUfwrdSir5ykcsC3/ZMmNj/3zDSl5fFx2DEVBMcjwxiWBZoHEoDi6yeydQmDLBobblqgUjvWsynjL4RT0QDtIPyxW2rLvjlKTFjP0O+q+0NNM4VF+QJ/UDyfqFGjQI+SnTj1vLbaIRD/89LNDBPsX5dEF8Snfj1kXRlzYIFP3CIqkIhG7rgU3l4L2+AyOgpJBiRcwtOsYpGV5HnnyDdtjdVOqWxW9Opleq4IunglLhymtMbo3XQfS72LinA+tWZIA/YOYTVXuYbBHZ7h+JgRadmOlJseh+nOVSjfjKGJDb/mQmhBmS0PsFS7FlIJatUwNqU4v0CjnoHz1/t84zmCmy//hzSOQ0TE3unLVHuUMqbCIz3uTJULQvrDTgguoWYo2SSydluiSW2L0SVy+PZkhmiYFtSkXMxdZbaSbHBIUP3tudpeFUZXp42dhJDYqwCMvNMK9+RYBbizRQbQLB6Pyj8PAsGvvQMBE4prOpERQU9n3OqX8s/O8LTmc5asdCLnrTWF4vk36Bx1325H8RpxHSnFiW+3Yg6qGL4b/FY+S8bSeSCa28D+eM1a9B/dqDOIB8cxsRIQWSeA7F9gUX+pGbVKDS3lep+TyZzvoOA7Ta4q9bDI67s8g1OZYRcrBH66d9Ym4WkUY1UhDH2NAQIECBAgQIAbNmzYq02aL168Y8aXNWrUs33678WROXLk071hwp8lSpQzZsyDHTp06MuNAQIECBAgQIAbNmzYq02aL168Y8aXNWrUs33678WROXLk071hwp8lSpQzZsyDHTp06MuNAQIECBAgQIAbNmzYq02aL168Y8aXNWrUs33678WROXLk071hwp8lSpQzZsyDHTp06MuNAQIECBAgQIAbNmzYq02aL168Y8aXNWrUs33678WROXLk071hwp8lSpQzZsyDHTp06MuNAQIECBAgQIAbNmzYq02aL168Y8aXNWrUs33678WROXLk071hwp8lSpQzZsyDHTp06MuN",256,!1),n=o[0],t=o[1],r=o[2],u=o[3],f=o[4],e=o[5],s=o[6],h=o[7],c=o[8]);d=128;p=4;switch(l.length*8){case 128:b=128;a=4;v=10;break;case 192:b=192;a=6;v=12;break;case 256:b=256;a=8;v=14;break;default:throw new Error("Unsupported keyLength");}var g=function(n){var t=n[1];n[1]=n[5];n[5]=n[9];n[9]=n[13];n[13]=t;t=n[2];n[2]=n[10];n[10]=t;t=n[6];n[6]=n[14];n[14]=t;t=n[15];n[15]=n[11];n[11]=n[7];n[7]=n[3];n[3]=t},nt=function(n){var t=n[13];n[13]=n[9];n[9]=n[5];n[5]=n[1];n[1]=t;t=n[10];n[10]=n[2];n[2]=t;t=n[14];n[14]=n[6];n[6]=t;t=n[3];n[3]=n[7];n[7]=n[11];n[11]=n[15];n[15]=t},ut=function(i){var r=i[0],u=i[1],f=i[2],e=i[3],o=i[4],s=i[5],h=i[6],c=i[7],l=i[8],a=i[9],v=i[10],y=i[11],p=i[12],w=i[13],b=i[14],k=i[15];i[0]=n[r]^t[u]^f^e;i[1]=r^n[u]^t[f]^e;i[2]=r^u^n[f]^t[e];i[3]=t[r]^u^f^n[e];i[4]=n[o]^t[s]^h^c;i[5]=o^n[s]^t[h]^c;i[6]=o^s^n[h]^t[c];i[7]=t[o]^s^h^n[c];i[8]=n[l]^t[a]^v^y;i[9]=l^n[a]^t[v]^y;i[10]=l^a^n[v]^t[y];i[11]=t[l]^a^v^n[y];i[12]=n[p]^t[w]^b^k;i[13]=p^n[w]^t[b]^k;i[14]=p^w^n[b]^t[k];i[15]=t[p]^w^b^n[k]},ft=function(n){var t=n[0],i=n[1],o=n[2],s=n[3],h=n[4],c=n[5],l=n[6],a=n[7],v=n[8],y=n[9],p=n[10],w=n[11],b=n[12],k=n[13],d=n[14],g=n[15];n[0]=r[t]^f[i]^u[o]^e[s];n[1]=e[t]^r[i]^f[o]^u[s];n[2]=u[t]^e[i]^r[o]^f[s];n[3]=f[t]^u[i]^e[o]^r[s];n[4]=r[h]^f[c]^u[l]^e[a];n[5]=e[h]^r[c]^f[l]^u[a];n[6]=u[h]^e[c]^r[l]^f[a];n[7]=f[h]^u[c]^e[l]^r[a];n[8]=r[v]^f[y]^u[p]^e[w];n[9]=e[v]^r[y]^f[p]^u[w];n[10]=u[v]^e[y]^r[p]^f[w];n[11]=f[v]^u[y]^e[p]^r[w];n[12]=r[b]^f[k]^u[d]^e[g];n[13]=e[b]^r[k]^f[d]^u[g];n[14]=u[b]^e[k]^r[d]^f[g];n[15]=f[b]^u[k]^e[d]^r[g]},tt=function(n,t){return[n[0]^t[0],n[1]^t[1],n[2]^t[2],n[3]^t[3]]},w=function(n,t,i){for(var r=0;r<n.length;r+=1)n[r]^=t[r+i]},et=function(n){var t=n[0];n[0]=n[1];n[1]=n[2];n[2]=n[3];n[3]=t},k=function(n){for(var t=0;t<n.length;t+=1)n[t]=s[n[t]]},it=function(n){for(var t=0;t<n.length;t+=1)n[t]=h[n[t]]},rt=function(n,t){return[n[4*t],n[4*t+1],n[4*t+2],n[4*t+3]]},ot=function(n,t,i,r){n[4*i]=t[4*r];n[4*i+1]=t[4*r+1];n[4*i+2]=t[4*r+2];n[4*i+3]=t[4*r+3]},st=function(n){for(var i,r=[],t=0,u,f,e;t<4*a;)r.push(n[t++]);for(t=a;t<p*(v+1);)i=rt(r,t-1),t%a==0?(u=t/a,f=[c[u],0,0,0],et(i),k(i),i=tt(i,f)):a>6&&t%a==4&&k(i),e=tt(rt(r,t-a),i),ot(r,e,t,0),t+=1;return r};return y=st(l),{encrypt:function(n){var t=n,i;for(w(t,y,0),i=1;i<=v-1;i+=1)k(t),g(t),ut(t),w(t,y,4*i*p);return k(t),g(t),w(t,y,4*v*p),t},decrypt:function(n){var t=n,i;for(w(t,y,4*v*p),i=v-1;i>=1;i-=1)nt(t),it(t),w(t,y,4*i*p),ft(t);return nt(t),it(t),w(t,y,0),t},clear:function(){},keyLength:b,blockSize:d}}}}();ht=ht||{};ht.pkcsv7=function(n){function t(t){var o=t.length-1>=0?t.length-1:0,i=t[o],f=i.length,s=f===n,r,u,e;if(s){for(r=[],u=0;u<n;u+=1)r.push(n);t.push(r)}else for(e=n-f&255;i.length!==n;)i.push(e)}function i(t){var i=!0,u,f,r,e,o,s;for(t.length%n!=0&&(i=!1),u=t.slice(-n),f=u[u.length-1],r=0;r<n;r++)e=n-r<=f,o=u[r]===f,i=(e?o:!0)&&i;return s=i?f:0,t.length-=s,i}return{pad:t,unpad:i}};w=function(n){function s(n){var f=[],r,i;for(t=t.concat(n),r=Math.floor(t.length/u),i=0;i<r;i++)f.push(t.slice(i*u,(i+1)*u));return t=t.slice(r*u),f}function h(t){for(var u=[],e,r=0;r<t.length;r++)e=i.xorVectors(f,t[r]),u.push(n.encrypt(e)),f=u[r];return u}function l(t){for(var u=[],e,o,r=0;r<t.length;r+=1)e=t[r].slice(0,t[r].length),o=n.decrypt(e),u.push(i.xorVectors(f,o)),f=t[r];return u}function c(){t=[];r=[];f=null}var u=n.blockSize/8,o=ht.pkcsv7(u),e=function(n){for(var u=[],i,r,t=0;t<n.length;t+=1)for(r=n[t],i=0;i<r.length;i+=1)u.push(r[i]);return u},t=[],r=[],f;return{init:function(n){if(n.length!==u)throw new Error("Invalid iv size");f=n.slice()},encrypt:function(n){return this.processEncrypt(n),this.finishEncrypt()},processEncrypt:function(n){var t=h(s(n));r=r.concat(e(t));return},finishEncrypt:function(){var n=t.length===1?[[t[0]]]:[t],i;return o.pad(n),i=r.concat(e(h(n))),c(),i},decrypt:function(n){return this.processDecrypt(n),this.finishDecrypt()},processDecrypt:function(n){var t=l(s(n));r=r.concat(e(t));return},finishDecrypt:function(){var n=r,t=o.unpad(n);return c(),n}}};e=null;typeof t!="undefined"&&(w.workerEncrypt=function(n){var t;if(e||(e=w(k.aes(n.keyData)),e.init(n.algorithm.iv)),n.operationSubType==="process"){e.processEncrypt(n.buffer);return}return n.operationSubType==="finish"?(t=e.finishEncrypt(),e=null,t):(t=e.encrypt(n.buffer),e=null,t)},w.workerDecrypt=function(n){var t;if(e||(e=w(k.aes(n.keyData)),e.init(n.algorithm.iv)),n.operationSubType==="process"){e.processDecrypt(n.buffer);return}return n.operationSubType==="finish"?(t=e.finishDecrypt(),e=null,t):(t=e.decrypt(n.buffer),e=null,t)},w.generateKey=function(n){if(n.algorithm.length%8!=0)throw new Error;return{type:"keyGeneration",keyData:s.getBytes(Math.floor(n.algorithm.length/8)),keyHandle:{algorithm:n.algorithm,extractable:n.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},w.importKey=function(n){var t=c.jwkToKey(n.keyData,n.algorithm,["k"]);return n.algorithm.length=t.k.length*8,{type:"keyImport",keyData:t.k,keyHandle:{algorithm:n.algorithm,extractable:n.extractable||t.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},w.exportKey=function(n){var t=c.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("importKey","aes-cbc",w.importKey),t.register("exportKey","aes-cbc",w.exportKey),t.register("generateKey","aes-cbc",w.generateKey),t.register("encrypt","aes-cbc",w.workerEncrypt),t.register("decrypt","aes-cbc",w.workerDecrypt));v=function(n){function a(n,t){for(var u=Math.floor(t.length/16),f,i=0;i<u;i++)f=t.slice(i*16,i*16+16),p=tt(r.xorVectors(p,f),n);return k=t.slice(u*16),p}function w(){var n=16*Math.ceil(e/16)-e,t=d(v.length*8),i=d(e*8),u=k.concat(r.getVector(n)).concat(t).concat(i);return a(l,u)}function tt(n,t){for(var u=r.getVector(16),i=t.slice(),o=[225,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e,f=0;f<128;f++)e=it(n,f),e===1&&(u=r.xorVectors(u,i)),i[15]&1?(g(i),i=r.xorVectors(i,o)):g(i);return u}function g(n){for(var t=n.length-1;t>0;t--)n[t]=(n[t-1]&1)<<7|n[t]>>>1;return n[0]=n[0]>>>1,n}function it(n,t){var i=Math.floor(t/8);return n[i]>>7-t%8&1}function nt(n){for(var i=256,t=1;t<=4;t++)i=(i>>>8)+n[n.length-t],n[n.length-t]=i&255;return n}function o(t,i){var h=Math.ceil(i.length/16),o,e=[],u,s;for(f!==t&&(f=t.slice()),u=0;u<h;u++)o=i.slice(u*16,u*16+16),s=n.encrypt(f.slice()),e=e.concat(r.xorVectors(o,s)),f=nt(f);return e}function d(n){return[0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,n&255]}function rt(n){var t=16*Math.ceil(v.length/16)-v.length;return n.concat(r.getVector(t))}function b(){e=0;t=[];u=[];p=r.getVector(16);k=[];f=s=v=null}function ut(n,t,i){if(v=t||[],h=isNaN(i)?128:i,h%8!=0)throw new Error("DataError");if(s=n,s.length===12)c=s.concat([0,0,0,1]);else{var u=16*Math.ceil(s.length/16)-s.length;c=a(l,s.concat(r.getVector(u+8)).concat(d(s.length*8)));p=r.getVector(16)}y=nt(c.slice());a(l,rt(v))}function ft(n){var t,i,r;return e=n.length,t=o(y,n),a(l,t),i=w(),r=o(c,i).slice(0,h/8),b(),t.slice().concat(r)}function et(n,t){var i,u,f;return e=n.length,i=o(y,n),a(l,n),u=w(),f=o(c,u).slice(0,h/8),b(),r.arraysEqual(f,t)?i:null}function ot(n){var i,r;t=t.concat(n);i=t.slice(0,Math.floor(t.length/16)*16);e+=i.length;t=t.slice(i.length);r=o(f||y,i);u=u.concat(r);a(l,r)}function st(n){var i,r;t=t.concat(n);i=t.slice(0,Math.floor((t.length-h/8)/16)*16);e+=i.length;t=t.slice(i.length);r=o(f||y,i);u=u.concat(r);a(l,i)}function ht(){var n=o(f,t);u=u.concat(n);e+=t.length;var i=w(),r=o(c,i).slice(0,h/8),s=u.slice().concat(r);return b(),s}function ct(){var n=Math.floor(h/8),s=t.slice(-n),i;t=t.slice(0,t.length-n);i=o(f,t);u=u.concat(i);e+=t.length;var l=w(),a=o(c,l).slice(0,h/8),v=u.slice();if(b(),r.arraysEqual(a,s))return v;throw new Error("OperationError");}var r=i,t=[],s,v,h,c,y,l=n.encrypt(r.getVector(16)),p=r.getVector(16),k=[],u=[],f,e=0;return{init:ut,encrypt:ft,decrypt:et,processEncrypt:ot,processDecrypt:st,finishEncrypt:ht,finishDecrypt:ct}};typeof t!="undefined"&&(v.encrypt=function(n){var t;if(h||(h=v(k.aes(n.keyData)),h.init(n.algorithm.iv,n.algorithm.additionalData,n.algorithm.tagLength)),n.operationSubType==="process"){h.processEncrypt(n.buffer);return}return n.operationSubType==="finish"?(t=h.finishEncrypt(),h=null,t):(t=h.encrypt(n.buffer),h=null,t)},v.decrypt=function(n){var t;if(h||(h=v(k.aes(n.keyData)),h.init(n.algorithm.iv,n.algorithm.additionalData,n.algorithm.tagLength)),n.operationSubType==="process"){h.processDecrypt(n.buffer);return}if(n.operationSubType==="finish")return t=h.finishDecrypt(),h=null,t;var i=Math.floor(n.algorithm.tagLength/8),r=n.buffer.slice(0,n.buffer.length-i),u=n.buffer.slice(-i);return t=h.decrypt(r,u),h=null,t},v.generateKey=function(n){if(n.algorithm.length%8!=0)throw new Error;return{type:"keyGeneration",keyData:s.getBytes(Math.floor(n.algorithm.length/8)),keyHandle:{algorithm:n.algorithm,extractable:n.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},v.importKey=function(n){var t=c.jwkToKey(n.keyData,n.algorithm,["k"]);return{type:"keyImport",keyData:t.k,keyHandle:{algorithm:n.algorithm,extractable:n.extractable||t.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},v.exportKey=function(n){var t=c.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("importKey","aes-gcm",v.importKey),t.register("exportKey","aes-gcm",v.exportKey),t.register("generateKey","aes-gcm",v.generateKey),t.register("encrypt","aes-gcm",v.encrypt),t.register("decrypt","aes-gcm",v.decrypt));s=new at;var ni=function(t){function r(t){var i=n.digitsToBytes(t);return f.padFront(i,0,s),i}function u(t,i,r){var f=n.bytesToDigits(i),u=n.IntegerGroup(r),e=u.createElementFromBytes(t),o=u.modexp(e,f);return o.m_digits}function h(n){var i=u(n,t.d,t.n);return r(i)}function c(i){var l=t.p,a=t.q,v=t.dp,y=t.dq,p=t.qi,f=n.bytesToDigits(l),o=n.bytesToDigits(a),u=new Array(f.length+o.length),s=new Array(f.length+1),h=new Array(o.length+1),e=n.bytesToDigits(i),c;return n.reduce(e,f,u),n.modExp(u,n.bytesToDigits(v),f,s),n.reduce(e,o,u),n.modExp(u,n.bytesToDigits(y),o,h),c=n.subtract(s,h,u),c!==0&&n.subtract(h,s,u),n.modMul(u,n.bytesToDigits(p),f,e),c!==0&&n.subtract(f,e,e),n.multiply(e,o,u),n.add(h,u,s),r(s)}var f=i,e=t.hasOwnProperty("n")&&t.hasOwnProperty("d"),o=t.hasOwnProperty("p")&&t.hasOwnProperty("q"),s=t.n.length;return{encrypt:function(n){return r(u(n,t.e,t.n))},decrypt:function(n){if(o)return c(n);if(e)return h(n);throw new Error("missing private key");}}},et={mgf1:function(n,t,i){for(var u=[],f,e,o=i.hashLen/8,r=0;r<=Math.floor(t/o);r+=1)f=[r>>>24&255,r>>>16&255,r>>>8&255,r&255],e=i.computeHash(n.concat(f)),u=u.concat(e);return u.slice(0,t)},checkMessageVsMaxHash:function(n,t){if(n.length>(t.maxMessageSize||4294967295))throw new Error("message too long");return}},p=p||{};return p.oaep=function(n,t){function e(n,i){var e,c,l,a,o,v,s,y,p,h;if(n.length>u-t.hashLen/4-2)throw new Error("Message too long.");return i||(i=[]),e=t.computeHash(i),c=u-n.length-2*e.length-2,l=r.getVector(c),a=e.concat(l,[1],n),o=f.getBytes(e.length),v=et.mgf1(o,u-e.length-1,t),s=r.xorVectors(a,v),y=et.mgf1(s,e.length,t),p=r.xorVectors(o,y),h=[0].concat(p).concat(s),n=h.slice(),h}function o(n,i){var f,s,o,h,c,l,e,a,v;if(i||(i=[]),f=t.computeHash(i),n[0]!==0)throw new Error("Encryption Error");if(s=n.slice(1,f.length+1),o=n.slice(f.length+1),h=et.mgf1(o,f.length,t),c=r.xorVectors(s,h),l=et.mgf1(c,u-f.length-1,t),e=r.xorVectors(o,l),a=e.slice(0,f.length),!r.arraysEqual(f,a))throw new Error("Encryption Error");return e=e.slice(f.length),v=e.indexOf(1),e.slice(v+1)}var r=i,f=s,u=n.n.length;if(t===null)throw new Error("must supply hashFunction");return{pad:function(n,t){return e(n,t)},unpad:function(n,t){return o(n,t)}}},p=p||{},p.pkcs1Encrypt=function(n){function r(n){var r;if(n.length>t-11)throw new Error("message too long");return r=i.getNonZeroBytes(t-n.length-3),[0,2].concat(r,[0],n)}function u(n){for(var t=1;t<n.length;t+=1)if(n[t]===0)break;return n.slice(t+1)}var i=s,t=n.n.length;return{pad:function(n){return r(n)},unpad:function(n){return u(n)}}},p.pkcs1Sign=function(n,t){function f(n){var i,e,f;if(e=t.computeHash(n.slice()),i=t.der.concat(e),f=i.length,u<f+11)throw new Error("intended encoded message length too short");return[0,1].concat(r.getVector(u-f-3,255),[0],i)}var r=i,u=n.n.length;return{sign:function(n){return f(n)},verify:function(n,t){var i=f(t);return r.arraysEqual(n,i)}}},p=p||{},p.pss=function(n,t){function f(i,f,e){var l=n.n.length*8-1,o=Math.ceil(l/8),c=t.computeHash(i),h;if(f=e?e.length:f||c.length,o<c.length+f+2)throw new Error("encoding error");e=e||u.getBytes(f);var y=[0,0,0,0,0,0,0,0].concat(c,e),s=t.computeHash(y),p=r.getVector(o-e.length-s.length-2),w=p.concat([1],e),b=et.mgf1(s,o-s.length-1,t),a=r.xorVectors(w,b),v=0;for(h=0;h<8-(8*o-l);h++)v+=1<<h;return a[0]&=v,a.concat(s,[188])}function e(i,u,f){var l=n.n.length*8-1,o=Math.ceil(l/8),a=t.computeHash(u),e=a.length,h;if(f=f||e,o<e+f+2)return!1;var c=i.slice(0,o-e-1),v=i.slice(c.length,c.length+e),y=et.mgf1(v,o-e-1,t),s=r.xorVectors(c,y);for(s[0]&=255>>>8-(8*o-l),h=0;h<o-e-f-2;h++)if(s[h]!==0)return!1;if(s[o-e-f-2]!==1)return!1;var p=s.slice(-f),w=[0,0,0,0,0,0,0,0].concat(a,p),b=t.computeHash(w);return r.arraysEqual(b,v)}var r=i,u=s;return{sign:function(n,t,i){return f(n,t,i)},verify:function(n,t,i){return e(n,t,i)}}},r=function(n,t,i){function o(){if(!i||!i.computeHash)throw new Error("missing hash function");}var e=ni(n),u,f,r;if(!t)throw new Error("padding mode");u=null;f=null;switch(t){case"rsaes-pkcs1-v1_5":r=p.pkcs1Encrypt(n);break;case"rsassa-pkcs1-v1_5":o();r=p.pkcs1Sign(n,i);break;case"rsa-oaep":o();r=p.oaep(n,i);break;case"rsa-pss":o();r=p.pss(n,i);break;case"raw":r={pad:function(n){return n},unpad:function(n){return n}};break;default:throw new Error("invalid mode");}return r&&(u=r.pad||r.sign,f=r.unpad||r.verify),{encrypt:function(n,t){var i;return i=u!==null?u(n,t):n.slice(),e.encrypt(i)},decrypt:function(n,t){var i=e.decrypt(n);return f!==null?f(i,t):i.slice(0)},signData:function(n,t,i){return e.decrypt(u(n,t,i))},verifySignature:function(n,t,i){var r=e.encrypt(n);return f(r,t,i)},mode:t}},typeof t!="undefined"&&(r.sign=function(n){var t,i=n.algorithm.hash.name,u=y[i.toLowerCase()],f=n.algorithm.saltLength,e=n.algorithm.salt;return t=r(n.keyData,n.algorithm.name,u),t.signData(n.buffer,f,e)},r.verify=function(n){var i=n.algorithm.hash.name,u=y[i.toLowerCase()],t,f=n.algorithm.saltLength;return t=r(n.keyData,n.algorithm.name,u),t.verifySignature(n.signature,n.buffer,f)},r.workerEncrypt=function(n){var i,t,f,u;switch(n.algorithm.name){case"rsaes-pkcs1-v1_5":t=r(n.keyData,n.algorithm.name);i=t.encrypt(n.buffer);break;case"rsa-oaep":if(u=n.algorithm.hash.name,!u)throw new Error("unsupported hash algorithm");f=y[u.toLowerCase()];t=r(n.keyData,n.algorithm.name,f);i=t.encrypt(n.buffer);break;default:throw new Error("unsupported algorithm");}return i},r.workerDecrypt=function(n){var i,t,f,u;switch(n.algorithm.name){case"rsaes-pkcs1-v1_5":t=r(n.keyData,n.algorithm.name);i=t.decrypt(n.buffer);break;case"rsa-oaep":if(u=n.algorithm.hash.name,!u)throw new Error("unsupported hash algorithm");f=y[u.toLowerCase()];t=r(n.keyData,n.algorithm.name,f);i=t.decrypt(n.buffer);break;default:throw new Error("unsupported algorithm");}return i},r.importKey=function(n){var t=c.jwkToKey(n.keyData,n.algorithm,["n","e","d","q","p","dq","dp","qi"]);return{type:"keyImport",keyData:t,keyHandle:{algorithm:n.algorithm,extractable:n.extractable||t.extractable,keyUsage:null||n.keyUsage,type:t.d||t.dq?"private":"public"}}},r.exportKey=function(n){var t=c.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("sign","rsassa-pkcs1-v1_5",r.sign),t.register("sign","rsa-pss",r.sign),t.register("verify","rsassa-pkcs1-v1_5",r.verify),t.register("verify","rsa-pss",r.verify),t.register("encrypt","rsa-oaep",r.workerEncrypt),t.register("encrypt","rsaes-pkcs1-v1_5",r.workerEncrypt),t.register("decrypt","rsa-oaep",r.workerDecrypt),t.register("decrypt","rsaes-pkcs1-v1_5",r.workerDecrypt),t.register("importKey","rsa-oaep",r.importKey),t.register("importKey","rsaes-pkcs1-v1_5",r.importKey),t.register("importKey","rsassa-pkcs1-v1_5",r.importKey),t.register("importKey","rsa-pss",r.importKey),t.register("exportKey","rsa-oaep",r.exportKey),t.register("exportKey","rsaes-pkcs1-v1_5",r.exportKey),t.register("exportKey","rsassa-pkcs1-v1_5",r.exportKey),t.register("exportKey","rsa-pss",r.exportKey)),nt=function(n){function r(i,r,u){for(var o,s,h=Math.ceil(u/(n.hashLen/8)),c=1,l=i.concat(r),f=[],e=0;e<h;e++)o=t.int32ToBytes(c++).concat(l),s=n.computeHash(o),f=f.concat(s);return f.slice(0,u)}var t=i;return{deriveKey:r}},tt=null,typeof t!="undefined"&&(nt.deriveKey=function(n){var t=i,u=n.algorithm.hash.name,f=y[u.toLowerCase()];tt=nt(f);var r=n.algorithm,e=t.toArray(r.algorithmId).concat(t.toArray(r.partyUInfo),t.toArray(r.partyVInfo),t.toArray(r.publicInfo),t.toArray(r.privateInfo)),o=tt.deriveKey(n.keyData,e,n.derivedKeyType.length);return tt=null,{type:"keyDerive",keyData:o,keyHandle:{algorithm:n.derivedKeyType,extractable:n.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},nt.deriveBits=function(n){var i=n.algorithm.hash.name,r=y[i.toLowerCase()];tt=nt(r);var t=n.algorithm,u=t.algorithmId.concat(t.partyUInfo,t.partyVInfo,t.publicInfo||[],t.privateInfo||[]),f=tt.deriveKey(n.keyData,u,n.length);return tt=null,f},t.register("deriveKey","concat",nt.deriveKey),t.register("deriveBits","concat",nt.deriveBits)),b=function(t){function o(u){var o=[],h=s.getBytes(t.order.length*n.DIGIT_NUM_BYTES),e;return h=u||h,n.reduce(n.bytesToDigits(h),r.order,o),e=r.allocatePointStorage(),i.scalarMultiply(o,r.generator,e),{privateKey:{x:f(e.x),y:f(e.y),d:f(o)},publicKey:{x:f(e.x),y:f(e.y)}}}function h(t,f,o){var h=new u.EllipticCurvePointFp(r,!1,e(f.x),e(f.y),null,!1),s,c;if(h.isInMontgomeryForm||i.convertToMontgomeryForm(h),h.isAffine||i.convertToAffineForm(h),s=r.allocatePointStorage(),i.convertToJacobianForm(s),i.convertToMontgomeryForm(s),i.scalarMultiply(e(t.d),h,s),i.convertToAffineForm(s),i.convertToStandardForm(s),c=n.digitsToBytes(s.x),o&&c.length*8<o)throw new Error("DataError");return o?c.slice(0,o/8):c}function c(n){r.generator.isInMontgomeryForm||i.convertToMontgomeryForm(r.generator);var t=r.allocatePointStorage();return i.convertToJacobianForm(t),i.convertToMontgomeryForm(t),i.scalarMultiply(e(n),r.generator,t),{x:f(t.x),y:f(t.y)}}var e=n.bytesToDigits,f=n.digitsToBytes,r=t,i=new u.EllipticCurveOperatorFp(t);return{generateKey:o,deriveBits:h,computePublicKey:c}},ft=null,typeof t!="undefined"&&(b.deriveBits=function(n){var t=u.createCurve(n.algorithm.namedCurve.toUpperCase()),i=n.keyData,r=n.additionalKeyData;return ft=b(t),ft.deriveBits(i,r,n.length)},b.generateKey=function(n){var i=u.createCurve(n.algorithm.namedCurve.toUpperCase()),t;return ft=b(i),t=ft.generateKey(),{type:"keyPairGeneration",keyPair:{publicKey:{keyData:t.publicKey,keyHandle:{algorithm:n.algorithm,extractable:n.extractable,keyUsage:n.keyUsage,type:"public"}},privateKey:{keyData:t.privateKey,keyHandle:{algorithm:n.algorithm,extractable:n.extractable,keyUsage:n.keyUsage,type:"private"}}}}},b.importKey=function(n){var t=c.jwkToKey(n.keyData,n.algorithm,["x","y","d","crv"]),r,i;return!t.d||t.x&&t.y||(r=u.createCurve(n.algorithm.namedCurve.toUpperCase()),ft=b(r),i=ft.computePublicKey(t.d),t.x=i.x,t.y=i.y),{type:"keyImport",keyData:t,keyHandle:{algorithm:n.algorithm,extractable:n.extractable||t.extractable,keyUsage:n.keyUsage,type:t.d?"private":"public"}}},b.exportKey=function(n){var t=c.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("importKey","ecdh",b.importKey),t.register("exportKey","ecdh",b.exportKey),t.register("generateKey","ecdh",b.generateKey),t.register("deriveBits","ecdh",b.deriveBits)),o=function(t){function a(n){return h(r(n))}function h(n){var r=t.allocatePointStorage();return i.scalarMultiply(n,t.generator,r),{publicKey:r,privateKey:n}}function c(i){var r=[];return i||(i=s.getBytes(t.order.length*n.DIGIT_NUM_BYTES)),n.reduce(n.bytesToDigits(i),t.order,r),h(r)}function l(i){var u,e;return i.length>f&&(i.length=f),u=r(i),o&&(e=8-t.rbits%8,n.shiftRight(u,u,e)),n.reduce(u,t.order,u),u}function v(i,u,o){o||(o=c());var h=o.publicKey.x,v=o.privateKey,y=r(i.d),p=l(u.slice()),s=[],a=[];return n.reduce(h,t.order,h),n.modMul(h,y,t.order,s),n.add(s,p,s),n.reduce(s,t.order,s),n.modInv(v,t.order,a),n.modMul(s,a,t.order,s),e(h,!0,f).concat(e(s,!0,f))}function y(f,e,s){var p=Math.floor(e.length/2),w=r(e.slice(0,p)),v=r(e.slice(p)),k=l(s.slice()),c=[],y=[],b=new u.EllipticCurvePointFp(t,!1,r(f.x),r(f.y),null,!1),h,a;return(n.modInv(v,t.order,v),n.modMul(k,v,t.order,c),n.modMul(w,v,t.order,y),h=t.allocatePointStorage(),a=t.allocatePointStorage(),o?(n.add(c,c,c),n.add(c,c,c),n.reduce(c,t.order,c),i.scalarMultiply(c,t.generator,h,!1),i.scalarMultiply(y,b,a,!1),i.convertToExtendedProjective(h),i.convertToExtendedProjective(a),i.add(a,h,h),i.normalize(h)):(i.scalarMultiply(c,t.generator,h),i.scalarMultiply(y,b,a),i.convertToJacobianForm(h),i.convertToMontgomeryForm(h),i.convertToMontgomeryForm(a),i.mixedAdd(h,a,h),i.convertToAffineForm(h),i.convertToStandardForm(h)),h.isInfinity)?!1:(n.reduce(h.x,t.order,h.x),n.compareDigits(h.x,w)===0)}var r=n.bytesToDigits,e=n.digitsToBytes,i=new u.EllipticCurveOperatorFp(t),f=e(t.order).length,o=t.type===1;return{createKey:a,generateKey:c,sign:v,verify:y}},typeof t!="undefined"&&(o.sign=function(n){var t=n.algorithm.hash.name,i=u.createCurve(n.algorithm.namedCurve.toUpperCase()),r=y[t.toLowerCase()],f=r.computeHash(n.buffer),e=o(i);return e.sign(n.keyData,f)},o.verify=function(n){var t=n.algorithm.hash.name,i=u.createCurve(n.algorithm.namedCurve.toUpperCase()),r=y[t.toLowerCase()],f=r.computeHash(n.buffer),e=o(i);return e.verify(n.keyData,n.signature,f)},o.generateKey=function(t){function e(n){return i.padFront(n,0,Math.ceil(n.length/8)*8)}var c=u.createCurve(t.algorithm.namedCurve.toUpperCase()),l=o(c),r=l.generateKey(),f=n.digitsToBytes,s=e(f(r.publicKey.x)),h=e(f(r.publicKey.y)),a=e(f(r.privateKey));return{type:"keyPairGeneration",keyPair:{publicKey:{keyData:{x:s,y:h},keyHandle:{algorithm:t.algorithm,extractable:t.extractable,keyUsage:null||t.keyUsage,type:"public"}},privateKey:{keyData:{x:s,y:h,d:a},keyHandle:{algorithm:t.algorithm,extractable:t.extractable,keyUsage:null||t.keyUsage,type:"private"}}}}},o.importKey=function(n){var t=c.jwkToKey(n.keyData,n.algorithm,["x","y","d","crv"]);if(t.d&&(!t.x||!t.y)){var r=o.curves[n.algorithm.namedCurve](),u=o(r),i=u.computePublicKey(t.d);t.x=i.x;t.y=i.y}return{type:"keyImport",keyData:t,keyHandle:{algorithm:n.algorithm,extractable:n.extractable||t.extractable,keyUsage:null||n.keyUsage,type:t.d?"private":"public"}}},o.exportKey=function(n){var t=c.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("sign","ecdsa",o.sign),t.register("verify","ecdsa",o.verify),t.register("generateKey","ecdsa",o.generateKey),t.register("importKey","ecdsa",o.importKey),t.register("exportKey","ecdsa",o.exportKey)),ct||(wt=function(){function c(){function t(t){try{n=pt.jsCryptoRunner({data:t})}catch(i){this.onerror({data:i.description,type:"error"});return}if(!t.operationSubType||t.operationSubType!=="process")this.onmessage({data:n})}var n;return{postMessage:t,onmessage:null,onerror:null,terminate:function(){}}}function h(n){function u(u){if(u.type==="error"){i&&i.apply(t,[u.message?u.message:u]);return}this.result=n(u.data);r.apply(t,[this.result]);return}var t,r,i;return t=new Promise(function(n,t){r=n;i=t}),{dispatchEvent:u,promise:t,result:null}}function y(){function t(t){switch(t.type){case"keyGeneration":case"keyImport":case"keyDerive":return n.add(t.keyHandle,t.keyData),t.keyHandle;case"keyExport":return t.keyHandle;case"keyPairGeneration":return n.add(t.keyPair.publicKey.keyHandle,t.keyPair.publicKey.keyData),n.add(t.keyPair.privateKey.keyHandle,t.keyPair.privateKey.keyData),{publicKey:t.keyPair.publicKey.keyHandle,privateKey:t.keyPair.privateKey.keyHandle};default:throw new Error("Unknown key operation");}return}return h(t)}function w(n){function i(n){return b(n)}var t=h(i);return t.process=function(t){n.operationSubType="process";n.buffer=u.toArray(t);f.continueJob(this,u.clone(n))},t.finish=function(){n.operationSubType="finish";n.buffer=[];f.continueJob(this,u.clone(n))},t.abort=function(){f.abortJob(this)},t.onabort=null,t.onprogress=null,t.algorithm=n.algorithm||null,t.key=n.keyHandle||null,t}function b(n){return fi&&n.pop?new Uint8Array(n).buffer:n}function v(n,i){if(!t.exists(n,i))throw new Error("unsupported algorithm");}function e(t){var i=n.lookup(t);if(!i)throw new Error("key not found");return i}function p(n,t){for(var f,r,e={operationType:n},s=a[n],o=0;o<s.length;o+=1){if(f=l[s[o]],r=t[o],!r)if(f.required)throw new Error(f.name);else continue;if(r.subarray&&(r=u.toArray(r)),u.getObjectType(r)=="ArrayBuffer"&&(r=u.toArray(r)),i.getObjectType(r)!==f.type)throw new Error(f.name);f.name==="algorithm"&&(r.name=r.name.toLowerCase(),r.iv&&(r.iv=u.toArray(r.iv)),r.salt&&(r.salt=u.toArray(r.salt)),r.additionalData&&(r.additionalData=u.toArray(r.additionalData)),r.hash&&!r.hash.name&&i.getObjectType(r.hash)==="String"&&(r.hash={name:r.hash}));e.hasOwnProperty(f.name)?e[f.name+"1"]=r:e[f.name]=r}return e}function r(n,t,i){var r=p(n,t),u;return v(n,r.algorithm.name),r.keyHandle&&(r.keyData=e(r.keyHandle)),r.keyHandle1&&(r.keyData1=e(r.keyHandle1)),r.algorithm&&r.algorithm.public&&(r.additionalKeyData=e(r.algorithm.public)),u=i?y(r):w(r),(i||r.buffer||n==="deriveBits"||n==="wrapKey")&&f.runJob(u,r),u.promise}var n,f,u,l,a,o;return window.Promise||(window.Promise=function(n){function s(n){for(var f,u=0;u<r.length;u++)f=r[u](n),f&&f.then?f.then(t[u],e[u]):t[u]&&t[u](f);i={result:n};return}var o;if(!(this instanceof Promise))throw new Error("use 'new' keyword with Promise constructor");var u=null,i=null,f=[],r=[],e=[],t=[];this.then=function(n,o){var s;return u?(s=n(u.result),s&&s.then)?s:Promise.resolve(s):i?(s=o?o(i.result):i.result,s&&s.then)?s:Promise.resolve(s):(f.push(n),o&&r.push(o),new Promise(function(n,i){t.push(n);e.push(i)}))};this["catch"]=function(n){var u;return i?(u=n(i.result),u&&u.then)?u:Promise.resolve(u):(r.push(n),new Promise(function(n,i){t.push(n);e.push(i)}))};o=function(n){for(var r,i=0;i<f.length;i++)r=f[i](n),r&&r.then?r.then(t[i]):t[i]&&t[i](r);u={result:n};return};n(o,s);return},window.Promise.all=function(n){function r(r,u){return function(f){t[r]=f;++i==n.length&&u(t)}}var t=[],i=0;return new Promise(function(t,i){for(var u=0;u<n.length;u++)n[u].then(r(u,t)),n[u]["catch"](function(n){i(n)})})},window.Promise.race=function(n){function i(n){return function(i){t||(t=!0,n(i))}}var t=!1;return new Promise(function(t,r){for(var u=0;u<n.length;u++)n[u].then(i(t),i(r))})},window.Promise.reject=function(n){return new Promise(function(t,i){i(n)})},window.Promise.resolve=function(n){return new Promise(function(t){t(n)})}),n=[],n.add=function(t,i){n.push({keyHandle:t,keyData:i})},n.remove=function(t){for(var i=0;i<n.length;i++)if(n[i].keyHandle===t){n=n.splice(i,1);return}},n.lookup=function(t){for(var i=0;i<n.length;i++)if(n[i].keyHandle===t)return n[i].keyData;return null},f=function(){function p(){w(!it);for(var t=0;t<n.length;t++)if(!n[t].busy)return n[t];return null}function w(t){for(var i=n.length-1;i>=0;i-=1)n[i].isWebWorker===t&&(n[i].terminate(),n.splice(i,1))}function b(){for(var i=0,t=0;t<n.length;t++)n[t].busy||(i+=1);return i}function k(t){n.push(t)}function r(t){for(var i=0;i<n.length;i++)if(n[i]===t){t.terminate();n.splice(i,1);return}}function u(t){for(var i=0;i<n.length;i++)if(n[i].operation===t)return n[i];return null}function f(n,i){t.push({operation:n,data:i,id:y++})}function e(n){if(n.busy=!1,n.operation=null,it)if(t.length>0){var i=t.shift();l(i.operation,i.data)}else b()>v&&r(n)}function d(n){var r;if(it)try{r=new Worker(yt);r.postMessage({prngSeed:s.getBytes(48)});r.isWebWorker=!0}catch(u){it=!1;o.forceSync=!0;r=c();r.isWebWorker=!1}else r=c(),r.isWebWorker=!1;return r.operation=n,r.busy=!1,r.onmessage=function(n){for(var o,f=r.operation,u=0;u<t.length;u++)if(t[u].operation===r.operation){o=t[u];t.splice(u,1);i(r,o.data);return}f&&n.data.type!=="process"&&(e(r),f.dispatchEvent(n))},r.onerror=function(n){var t=r.operation;e(r);t.dispatchEvent(n)},k(r),r}function g(n){var t=u(n);t&&r(t)}function h(t,r){var u=null;if(it=bt&&!o.forceSync,u=p(),it&&u===null&&n.length>=a){f(t,r);return}if(u===null&&(u=d(t)),u===null){f(t,r);throw new Error("could not create new worker");}u.operation=t;u.busy=!0;i(u,r)}function l(n,t){var r=u(n);if(r){i(r,t);return}h(n,t)}function i(n,t){if(it)n.data=t,n.postMessage(t);else var i=function(t){return function(){return n.postMessage(t)}}(t),r=setTimeout(i,0);return}var a=12,v=2,n=[],t=[],y=0;return{runJob:h,continueJob:l,abortJob:g}}(),u=i,l=[{name:"algorithm",type:"Object",required:!0},{name:"keyHandle",type:"Object",required:!0},{name:"buffer",type:"Array",required:!1},{name:"signature",type:"Array",required:!0},{name:"format",type:"String",required:!0},{name:"keyData",type:"Object",required:!0},{name:"extractable",type:"Boolean",required:!1},{name:"keyUsage",type:"Array",required:!1},{name:"derivedKeyType",type:"Object",required:!0},{name:"length",type:"Number",required:!1},{name:"extractable",type:"Boolean",required:!0},{name:"keyUsage",type:"Array",required:!0}],a={encrypt:[0,1,2],decrypt:[0,1,2],sign:[0,1,2],verify:[0,1,3,2],digest:[0,2],generateKey:[0,6,7],importKey:[4,5,0,10,11],exportKey:[0,4,1,6,7],deriveKey:[0,1,8,6,7],deriveBits:[0,1,9],wrapKey:[1,1,0],unwrapKey:[2,0,1,6,7]},o={encrypt:function(){return r("encrypt",arguments,0)},decrypt:function(){return r("decrypt",arguments,0)},sign:function(){return r("sign",arguments,0)},verify:function(){return r("verify",arguments,0)},digest:function(){return r("digest",arguments,0)},generateKey:function(){return r("generateKey",arguments,1)},deriveKey:function(){return r("deriveKey",arguments,1)},deriveBits:function(){return r("deriveBits",arguments,0)},importKey:function(){return r("importKey",arguments,1)},exportKey:function(n,t){return r("exportKey",[t.algorithm,n,t],1)},wrapKey:function(){return r("wrapKey",arguments,0)},unwrapKey:function(){return r("unwrapKey",arguments,1)}}}()),lt=function(){function t(t){var w=r(t.keyData1,t.keyHandle1.algorithm.name,y["sha-1"]),u=128,b=c.keyToJwkOld(t.keyHandle,t.keyData),d={alg:t.keyHandle1.algorithm.name.toUpperCase(),enc:"A128GCM"},f=n.toBase64(JSON.stringify(d),!0),e=s.getBytes(32),g=w.encrypt(e),o=n.toBase64(g,!0),h=s.getBytes(12),l=n.toBase64(h,!0),nt=f.concat(".",o,".",l),a=v(k.aes(e));a.init(h,n.stringToBytes(nt),u);var i=a.encrypt(b),p=i.slice(-(u/8)),tt=n.toBase64(p,!0),it=n.toBase64(i.slice(0,i.length-p.length),!0),rt={recipients:[{header:f,encrypted_key:o,integrity_value:tt}],initialization_vector:l,ciphertext:it};return n.stringToBytes(JSON.stringify(rt))}function u(t){var u=n.base64ToBytes,i=JSON.parse(String.fromCharCode.apply(null,t.buffer)),g=n.base64ToString(i.recipients[0].header),s=u(i.recipients[0].encrypted_key),h=u(i.recipients[0].integrity_value),l=u(i.initialization_vector),a=u(i.ciphertext),p=y["sha-1"],w=r(t.keyData,t.keyHandle.algorithm.name,p),b=w.decrypt(s),d=i.recipients[0].header.concat(".",i.recipients[0].encrypted_key,".",i.initialization_vector),e=v(k.aes(b)),o,f;return e.init(l,n.stringToBytes(d),128),o=e.decrypt(a,h),f=c.jwkToKey(o,t.algorithm,["k"]),{type:"keyImport",keyData:f.k,keyHandle:{algorithm:{name:t.algorithm.name},extractable:t.extractable||f.extractable,keyUsage:t.keyUsage,type:"secret"}}}var n=i;return{wrapKey:t,unwrapKey:u}}(),typeof t!="undefined"&&(t.register("wrapKey","aes-gcm",lt.wrapKey),t.register("unwrapKey","aes-cbc",lt.unwrapKey)),st={subtle:wt,getRandomValues:function(n){for(var i=s.getBytes(n.length),t=0;t<n.length;t+=1)n[t]=i[t];return n},initPrng:function(n){var t=Object.prototype.toString.call(n);if(t!=="[object Array]"&&t!=="[object Uint8Array]")throw new Error("entropyData must be a Array or Uint8Array");ut&&ut.reseed(n);s.reseed(ut.read(48));ui=!0},toBase64:function(n){return i.toBase64(n,!1)},base64ToString:function(n){return i.base64ToString(n)},url:yt},typeof n!="undefined"&&(st.cryptoMath=n),typeof testInterface!="undefined"&&(st.testInterface=testInterface),ct||(ut=ut||new ti,ut.init(),kt=ut.read(48),s.init(kt)),st}();
|
|
//# sourceMappingURL=msrcrypto.min.js.map
|